Skip to content

Commit 89488c2

Browse files
Add macros support to jsonata field (#194)
* Add macros support to jsonata field * Update datasource.ts * Update datasource.ts Co-authored-by: Marcus Olsson <marcus.olsson@hey.com>
1 parent 1a28c61 commit 89488c2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/datasource.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,12 @@ export class JsonDataSource extends DataSourceApi<JsonApiQuery, JsonApiDataSourc
145145
.forEach((v) => {
146146
bindings[v.name] = v.value;
147147
});
148-
148+
149+
bindings["__unixEpochFrom"] = range.from.unix().toString()
150+
bindings["__unixEpochTo"] = range.to.unix().toString()
151+
bindings["__isoFrom"] = range.from.unix().toISOString()
152+
bindings["__isoTo"] = range.to.unix().toISOString()
153+
149154
const result = expression.evaluate(json, bindings);
150155

151156
// Ensure that we always return an array.

0 commit comments

Comments
 (0)