@lowdefy/operators 5.1.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -131,7 +131,7 @@ function evaluateOperators({ input, operators, operatorPrefix = '_', env, dynami
131
131
  const refId = node['~r'];
132
132
  const params = node[key];
133
133
  try {
134
- return operators[op]({
134
+ const result = operators[op]({
135
135
  args,
136
136
  arrayIndices: [],
137
137
  env,
@@ -142,6 +142,28 @@ function evaluateOperators({ input, operators, operatorPrefix = '_', env, dynami
142
142
  parser,
143
143
  runtime: 'node'
144
144
  });
145
+ // Transfer source location markers to the result so addKeys can
146
+ // resolve file + line. Without this, operator results (e.g. from
147
+ // _build.array.concat) lose their source location.
148
+ if ((type.isObject(result) || type.isArray(result)) && result['~r'] === undefined) {
149
+ if (refId !== undefined) {
150
+ Object.defineProperty(result, '~r', {
151
+ value: refId,
152
+ enumerable: false,
153
+ writable: true,
154
+ configurable: true
155
+ });
156
+ }
157
+ if (lineNumber !== undefined) {
158
+ Object.defineProperty(result, '~l', {
159
+ value: lineNumber,
160
+ enumerable: false,
161
+ writable: true,
162
+ configurable: true
163
+ });
164
+ }
165
+ }
166
+ return result;
145
167
  } catch (e) {
146
168
  if (e instanceof ConfigError) {
147
169
  if (!e.configKey) {
@@ -15,7 +15,7 @@
15
15
  */ import { ConfigError, OperatorError } from '@lowdefy/errors';
16
16
  import { serializer, type } from '@lowdefy/helpers';
17
17
  let ServerParser = class ServerParser {
18
- parse({ args, input, items, location, operatorPrefix = '_' }) {
18
+ parse({ args, input, items, location, operatorPrefix = '_', payload, steps }) {
19
19
  if (type.isUndefined(input)) {
20
20
  return {
21
21
  output: input,
@@ -51,11 +51,11 @@ let ServerParser = class ServerParser {
51
51
  operators: this.operators,
52
52
  params,
53
53
  parser: this,
54
- payload: this.payload,
54
+ payload,
55
55
  runtime: 'node',
56
56
  secrets: this.secrets,
57
57
  state: this.state,
58
- steps: this.steps,
58
+ steps,
59
59
  user: this.user
60
60
  });
61
61
  return res;
@@ -88,15 +88,13 @@ let ServerParser = class ServerParser {
88
88
  errors
89
89
  };
90
90
  }
91
- constructor({ env, jsMap, operators, payload, secrets, state, steps, user }){
91
+ constructor({ env, jsMap, operators, secrets, state, user }){
92
92
  this.env = env;
93
93
  this.jsMap = jsMap;
94
94
  this.operators = operators;
95
95
  this.parse = this.parse.bind(this);
96
- this.payload = payload;
97
96
  this.secrets = secrets;
98
97
  this.state = state;
99
- this.steps = steps;
100
98
  this.user = user;
101
99
  }
102
100
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/operators",
3
- "version": "5.1.0",
3
+ "version": "5.3.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -34,8 +34,8 @@
34
34
  "dist/*"
35
35
  ],
36
36
  "dependencies": {
37
- "@lowdefy/errors": "5.1.0",
38
- "@lowdefy/helpers": "5.1.0"
37
+ "@lowdefy/errors": "5.3.0",
38
+ "@lowdefy/helpers": "5.3.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@jest/globals": "28.1.3",