greybel-interpreter 3.2.0 → 3.3.1

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.
package/dist/context.d.ts CHANGED
@@ -76,6 +76,7 @@ export interface ContextOptions {
76
76
  environmentVariables?: Map<string, string>;
77
77
  ignoreOuter?: boolean;
78
78
  contextTypeIntrinsics?: ContextTypeIntrinsics;
79
+ time?: number;
79
80
  }
80
81
  export interface ContextForkOptions {
81
82
  type: ContextType;
@@ -97,6 +98,7 @@ export declare class OperationContext {
97
98
  readonly state: ContextState;
98
99
  readonly scope: Scope;
99
100
  readonly cps: CPS;
101
+ readonly time: number;
100
102
  readonly processState: ProcessState;
101
103
  loopState: LoopState;
102
104
  functionState: FunctionState;
package/dist/context.js CHANGED
@@ -163,33 +163,34 @@ class FunctionState {
163
163
  exports.FunctionState = FunctionState;
164
164
  class OperationContext {
165
165
  constructor(options = {}) {
166
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
166
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
167
167
  this.target = (_a = options.target) !== null && _a !== void 0 ? _a : 'unknown';
168
168
  this.stackTrace = (_b = options.stackTrace) !== null && _b !== void 0 ? _b : [];
169
- this.previous = (_c = options.previous) !== null && _c !== void 0 ? _c : null;
170
- this.type = (_d = options.type) !== null && _d !== void 0 ? _d : ContextType.Api;
171
- this.state = (_e = options.state) !== null && _e !== void 0 ? _e : ContextState.Default;
169
+ this.time = (_c = options.time) !== null && _c !== void 0 ? _c : Date.now();
170
+ this.previous = (_d = options.previous) !== null && _d !== void 0 ? _d : null;
171
+ this.type = (_e = options.type) !== null && _e !== void 0 ? _e : ContextType.Api;
172
+ this.state = (_f = options.state) !== null && _f !== void 0 ? _f : ContextState.Default;
172
173
  this.scope = new Scope(this);
173
- this.isProtected = (_f = options.isProtected) !== null && _f !== void 0 ? _f : false;
174
- this.injected = (_g = options.injected) !== null && _g !== void 0 ? _g : false;
175
- this.debugger = (_h = options.debugger) !== null && _h !== void 0 ? _h : new Debugger();
176
- this.handler = (_j = options.handler) !== null && _j !== void 0 ? _j : new handler_container_1.HandlerContainer();
177
- this.contextTypeIntrinsics = (_k = options.contextTypeIntrinsics) !== null && _k !== void 0 ? _k : {
174
+ this.isProtected = (_g = options.isProtected) !== null && _g !== void 0 ? _g : false;
175
+ this.injected = (_h = options.injected) !== null && _h !== void 0 ? _h : false;
176
+ this.debugger = (_j = options.debugger) !== null && _j !== void 0 ? _j : new Debugger();
177
+ this.handler = (_k = options.handler) !== null && _k !== void 0 ? _k : new handler_container_1.HandlerContainer();
178
+ this.contextTypeIntrinsics = (_l = options.contextTypeIntrinsics) !== null && _l !== void 0 ? _l : {
178
179
  string: null,
179
180
  number: null,
180
181
  list: null,
181
182
  map: null,
182
183
  function: null
183
184
  };
184
- this.cps = (_l = options.cps) !== null && _l !== void 0 ? _l : null;
185
- this.processState = (_m = options.processState) !== null && _m !== void 0 ? _m : new ProcessState();
186
- this.environmentVariables = (_o = options.environmentVariables) !== null && _o !== void 0 ? _o : new Map();
185
+ this.cps = (_m = options.cps) !== null && _m !== void 0 ? _m : null;
186
+ this.processState = (_o = options.processState) !== null && _o !== void 0 ? _o : new ProcessState();
187
+ this.environmentVariables = (_p = options.environmentVariables) !== null && _p !== void 0 ? _p : new Map();
187
188
  this.functionState = new FunctionState();
188
189
  this.loopState = new LoopState();
189
190
  this.api = this.lookupApi();
190
191
  this.globals = this.lookupGlobals();
191
- this.locals = (_p = this.lookupLocals()) !== null && _p !== void 0 ? _p : this;
192
- this.outer = (_q = (options.ignoreOuter ? null : this.lookupOuter())) !== null && _q !== void 0 ? _q : this.globals;
192
+ this.locals = (_q = this.lookupLocals()) !== null && _q !== void 0 ? _q : this;
193
+ this.outer = (_r = (options.ignoreOuter ? null : this.lookupOuter())) !== null && _r !== void 0 ? _r : this.globals;
193
194
  }
194
195
  isIgnoredInDebugging(op) {
195
196
  return op instanceof operation_1.OperationBlock || op instanceof noop_1.Noop;
@@ -344,7 +345,8 @@ class OperationContext {
344
345
  cps: this.cps,
345
346
  processState: (_b = options.processState) !== null && _b !== void 0 ? _b : this.processState,
346
347
  environmentVariables: this.environmentVariables,
347
- contextTypeIntrinsics: this.contextTypeIntrinsics
348
+ contextTypeIntrinsics: this.contextTypeIntrinsics,
349
+ time: this.time
348
350
  });
349
351
  if (options.type !== ContextType.Function) {
350
352
  if (options.type !== ContextType.Loop) {
@@ -10,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Evaluate = exports.handle = exports.handleFunction = exports.handleNil = exports.handleMap = exports.handleList = exports.handleString = exports.handleNumber = exports.FunctionProcessorHandler = exports.NilProcessorHandler = exports.MapProcessorHandler = exports.ListProcessorHandler = exports.divideList = exports.multiplyList = exports.StringProcessorHandler = exports.divideString = exports.multiplyString = exports.minusString = exports.NumberProcessorHandler = exports.GenericProcessorHandler = void 0;
13
- const miniscript_core_1 = require("miniscript-core");
14
13
  const operators_1 = require("greybel-core/dist/types/operators");
14
+ const miniscript_core_1 = require("miniscript-core");
15
15
  const boolean_1 = require("../types/boolean");
16
16
  const default_1 = require("../types/default");
17
17
  const function_1 = require("../types/function");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-interpreter",
3
- "version": "3.2.0",
3
+ "version": "3.3.1",
4
4
  "description": "Interpreter",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "lru-cache": "^10.0.1",
52
- "greybel-core": "^1.2.0"
52
+ "greybel-core": "^1.3.0"
53
53
  },
54
54
  "keywords": [
55
55
  "miniscript"