@gorules/zen-engine 1.0.0-beta.6 → 1.0.0-beta.7

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.
Files changed (2) hide show
  1. package/index.d.ts +47 -9
  2. package/package.json +10 -10
package/index.d.ts CHANGED
@@ -8,11 +8,14 @@ export type PolicySeverity = 'error' | 'warning' | 'hint';
8
8
  /** Text range, `[start, end)` byte offsets. */
9
9
  export type PolicySpan = [number, number];
10
10
 
11
- /** Rename target — a top-level entity, an entity field, or a global property. */
11
+ /** Rename target — a top-level entity, an entity field, a global property,
12
+ * or a property path within a graph document. */
12
13
  export type PolicyRenameTarget =
13
14
  | { kind: 'entity'; name: string }
14
15
  | { kind: 'field'; entity: string; field: string }
15
- | { kind: 'global'; name: string };
16
+ | { kind: 'global'; name: string }
17
+ | { kind: 'graphProperty'; document: string; path: string }
18
+ | { kind: 'graphNode'; document: string; nodeId: string };
16
19
 
17
20
  /** What kind of span a cursor is sitting in, with any disambiguation. */
18
21
  export type PolicyCursorTarget =
@@ -24,7 +27,8 @@ export type PolicyCursorTarget =
24
27
  | { kind: 'decisionTableHead'; col: string }
25
28
  | { kind: 'decisionTableCell'; row: string; col: string }
26
29
  | { kind: 'dataModelName' }
27
- | { kind: 'dataModelProperty'; id: string };
30
+ | { kind: 'dataModelProperty'; id: string }
31
+ | { kind: 'transformInput' };
28
32
 
29
33
  /**
30
34
  * How an entity field came into existence — declared by a DataModel
@@ -58,6 +62,13 @@ export type PolicyDiagnosticCode =
58
62
  | 'MAX_DEPTH_EXCEEDED'
59
63
  | 'IMPORT_NOT_FOUND'
60
64
  | 'CIRCULAR_IMPORT'
65
+ | 'UNSUPPORTED_NESTED_ITERATION'
66
+ | 'INVALID_GRAPH_STRUCTURE'
67
+ | 'UNREACHABLE_NODE'
68
+ | 'MISSING_INPUT_SCHEMA'
69
+ | 'UNRESOLVED_FUNCTION_TYPE'
70
+ | 'IMPLICIT_ANY'
71
+ | 'UNCHECKED_NODE'
61
72
  | 'REDUNDANT_NULLISH'
62
73
  | 'REPEATED_DERIVATION'
63
74
  | 'PREFER_MATCH'
@@ -82,6 +93,8 @@ export type PolicyVariableType =
82
93
  /** Language-agnostic symbol key for an infix operator. The client maps the key to a localized phrase. */
83
94
  export type NlOpSym =
84
95
  | 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'ne' | 'in' | 'notIn'
96
+ | 'contains' | 'notContains'
97
+ | 'containsAny' | 'containsAll' | 'containsNone' | 'containsOnly'
85
98
  | 'add' | 'sub' | 'mul' | 'div' | 'mod' | 'pow'
86
99
  | 'and' | 'or' | 'not' | 'coalesce';
87
100
 
@@ -128,11 +141,19 @@ export interface NlEnumOption {
128
141
  * (`options` indexes the `enums` table), expected dates, or the operator choices valid for the
129
142
  * operand types — ordered comparisons only for number/date/unknown operands, eq/ne otherwise.
130
143
  */
144
+ /**
145
+ * `quantSelect` marks a quantified-membership phrase (contains any/all/none/only). `subject` and
146
+ * `list` are ready-to-splice ZEN source slices; the client rebuilds the whole spanned expression
147
+ * from its canonical template for the picked symbol. `funcSelect` swaps a closure-function name
148
+ * in place (all/some/none); the token span covers exactly the name.
149
+ */
131
150
  export type NlEditHint =
132
151
  | { kind: 'datePicker' }
133
152
  | { kind: 'select'; options: number }
134
153
  | { kind: 'multiSelect'; options: number }
135
- | { kind: 'opSelect'; options: NlOpChoice[] };
154
+ | { kind: 'opSelect'; options: NlOpChoice[] }
155
+ | { kind: 'quantSelect'; options: NlOpSym[]; subject: string; list: string }
156
+ | { kind: 'funcSelect'; options: string[] };
136
157
 
137
158
  /**
138
159
  * One token in the symbolic NL stream. Structure is explicit via the
@@ -251,6 +272,12 @@ export type PolicyEngineEdit =
251
272
  policyPath: string;
252
273
  afterBlockId?: string;
253
274
  newBlock: PolicyWireBlock;
275
+ }
276
+ | {
277
+ kind: 'replaceNode';
278
+ document: string;
279
+ nodeId: string;
280
+ newNode: unknown;
254
281
  };
255
282
 
256
283
  /**
@@ -362,13 +389,18 @@ export type PolicyBlockTrace =
362
389
  arms: { id: string; result: boolean }[];
363
390
  };
364
391
 
365
- export declare class PolicyWorkspace {
366
- constructor()
392
+ export declare class Workspace {
393
+ constructor(resolveFunctionType?: (source: string, inputType: PolicyVariableType) => string | null | undefined)
394
+ functionResolutionRequests(): Array<PolicyFunctionResolutionRequest>
395
+ setFunctionType(source: string, inputType: PolicyVariableType, tsType?: string | undefined | null): void
396
+ setDocument(path: string, document: any): void
367
397
  setPolicy(path: string, document: any): void
368
- removePolicy(path: string): boolean
398
+ removePath(path: string): boolean
399
+ isGraph(path: string): boolean
400
+ uncheckedNodes(path: string): Array<string>
401
+ paths(): Array<string>
369
402
  updateBlock(req: PolicyUpdateBlockRequest): void
370
403
  removeBlock(req: PolicyRemoveBlockRequest): boolean
371
- policyPaths(): Array<string>
372
404
  diagnostics(policyPath: string, maxDiagnostics?: number | undefined | null): Array<PolicyDiagnostic>
373
405
  allDiagnostics(maxDiagnostics?: number | undefined | null): Array<PolicyDiagnostic>
374
406
  entities(req: PolicyScopeRequest): Array<PolicyEntityInfo>
@@ -385,9 +417,10 @@ export declare class PolicyWorkspace {
385
417
  rename(req: PolicyRenameRequest): PolicyEngineEdit[]
386
418
  references(target: any): PolicyReferenceSite[]
387
419
  inputSkeleton(req: PolicyScopeRequest): unknown
388
- dependencies(target: string): PolicyDependencyNode
420
+ dependencies(target: string, document?: string | undefined | null): PolicyDependencyNode
389
421
  evaluate(req: PolicyEvaluateRequest): PolicyEvaluationResult
390
422
  enhanceTrace(req: PolicyEvaluateRequest): PolicyEvaluationResult
423
+ enhanceGraphTrace(path: string, trace: Record<string, unknown>): PolicyTrace
391
424
  componentMembers(policy: string): Array<string>
392
425
  crossComponentWriteConflicts(): Array<PolicyWriteConflict>
393
426
  }
@@ -537,6 +570,11 @@ export interface PolicyFieldKindInfo {
537
570
  array?: boolean
538
571
  }
539
572
 
573
+ export interface PolicyFunctionResolutionRequest {
574
+ source: string
575
+ inputType: PolicyVariableType
576
+ }
577
+
540
578
  export interface PolicyGlobalInfo {
541
579
  name: string
542
580
  resolvedType: PolicyVariableType
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gorules/zen-engine",
3
- "version": "1.0.0-beta.6",
3
+ "version": "1.0.0-beta.7",
4
4
  "main": "index.js",
5
5
  "browser": "browser.js",
6
6
  "types": "./index.d.ts",
@@ -97,15 +97,15 @@
97
97
  "resolutions": {
98
98
  "form-data@^4.0.0": "4.0.4"
99
99
  },
100
- "gitHead": "48cc2e38d5ef9c01dbf6a783ecff57a07eecc358",
100
+ "gitHead": "7c8f847c6d358686a653be7eba21e278b8d1e5db",
101
101
  "optionalDependencies": {
102
- "@gorules/zen-engine-darwin-x64": "1.0.0-beta.6",
103
- "@gorules/zen-engine-linux-x64-gnu": "1.0.0-beta.6",
104
- "@gorules/zen-engine-linux-x64-musl": "1.0.0-beta.6",
105
- "@gorules/zen-engine-win32-x64-msvc": "1.0.0-beta.6",
106
- "@gorules/zen-engine-linux-arm64-gnu": "1.0.0-beta.6",
107
- "@gorules/zen-engine-linux-arm64-musl": "1.0.0-beta.6",
108
- "@gorules/zen-engine-darwin-arm64": "1.0.0-beta.6",
109
- "@gorules/zen-engine-wasm32-wasi": "1.0.0-beta.6"
102
+ "@gorules/zen-engine-darwin-x64": "1.0.0-beta.7",
103
+ "@gorules/zen-engine-linux-x64-gnu": "1.0.0-beta.7",
104
+ "@gorules/zen-engine-linux-x64-musl": "1.0.0-beta.7",
105
+ "@gorules/zen-engine-win32-x64-msvc": "1.0.0-beta.7",
106
+ "@gorules/zen-engine-linux-arm64-gnu": "1.0.0-beta.7",
107
+ "@gorules/zen-engine-linux-arm64-musl": "1.0.0-beta.7",
108
+ "@gorules/zen-engine-darwin-arm64": "1.0.0-beta.7",
109
+ "@gorules/zen-engine-wasm32-wasi": "1.0.0-beta.7"
110
110
  }
111
111
  }