@gorules/zen-engine 0.55.0-beta.0 → 0.55.0-beta.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.
Files changed (2) hide show
  1. package/index.d.ts +43 -9
  2. package/package.json +9 -9
package/index.d.ts CHANGED
@@ -18,7 +18,9 @@ export type PolicyRenameTarget =
18
18
  export type PolicyCursorTarget =
19
19
  | { kind: 'expression'; id: string }
20
20
  | { kind: 'assertionOutput' }
21
- | { kind: 'decisionTreeStatementKey'; id: string }
21
+ | { kind: 'expressionKey' }
22
+ | { kind: 'matchTarget' }
23
+ | { kind: 'matchValue'; id: string }
22
24
  | { kind: 'decisionTableHead'; col: string }
23
25
  | { kind: 'decisionTableCell'; row: string; col: string }
24
26
  | { kind: 'dataModelName' }
@@ -173,10 +175,6 @@ export interface PolicyDecisionTableExtras {
173
175
  inputPass: string;
174
176
  }
175
177
 
176
- export interface PolicyDecisionTreeExtras {
177
- branchResults: Record<string, boolean>;
178
- }
179
-
180
178
  export type PolicyBlockTrace =
181
179
  | {
182
180
  kind: 'assertion';
@@ -190,10 +188,15 @@ export type PolicyBlockTrace =
190
188
  extras?: PolicyDecisionTableExtras;
191
189
  }
192
190
  | {
193
- kind: 'decisionTree';
194
- path: string[];
195
- assignments: { statementId: string; property: string; value: unknown }[];
196
- extras?: PolicyDecisionTreeExtras;
191
+ kind: 'expression';
192
+ property: string;
193
+ value: unknown;
194
+ }
195
+ | {
196
+ kind: 'match';
197
+ matchedArm?: string;
198
+ value: unknown;
199
+ arms: { id: string; result: boolean }[];
197
200
  };
198
201
 
199
202
  export declare class PolicyWorkspace {
@@ -226,6 +229,7 @@ export declare class PolicyWorkspace {
226
229
  globals(req: PolicyScopeRequest): Array<PolicyGlobalInfo>
227
230
  inputs(req: PolicyScopeRequest): Array<PolicyInputProperty>
228
231
  outputs(req: PolicyScopeRequest): Array<PolicyOutputProperty>
232
+ conditionalSchema(req: PolicyScopeRequest): PolicyConditionalSchema
229
233
  inspect(cursor: PolicyExpressionCursor): PolicyInspectResult | null
230
234
  completions(cursor: PolicyExpressionCursor): Array<PolicyCompletion>
231
235
  prepareRename(cursor: PolicyExpressionCursor): PolicyPrepareRenameResult | null
@@ -328,6 +332,13 @@ export interface PolicyCompletion {
328
332
  info: string
329
333
  }
330
334
 
335
+ export interface PolicyConditionalSchema {
336
+ kind: "union" | "flat"
337
+ common: PolicySchemaGroup
338
+ union?: PolicyDiscriminatedUnion
339
+ conditional?: PolicySchemaGroup
340
+ }
341
+
331
342
  export interface PolicyDiagnostic {
332
343
  code: PolicyDiagnosticCode
333
344
  message: string
@@ -339,6 +350,18 @@ export interface PolicyDiagnostic {
339
350
  target?: PolicyCursorTarget
340
351
  }
341
352
 
353
+ export interface PolicyDiscriminantVariant {
354
+ value?: string
355
+ arm: string
356
+ group: PolicySchemaGroup
357
+ }
358
+
359
+ export interface PolicyDiscriminatedUnion {
360
+ property: string
361
+ resolvedType: PolicyVariableType
362
+ variants: Array<PolicyDiscriminantVariant>
363
+ }
364
+
342
365
  export interface PolicyEntityFieldInfo {
343
366
  name: string
344
367
  resolvedType: PolicyVariableType
@@ -386,6 +409,12 @@ export interface PolicyGlobalInfo {
386
409
  origin: PolicyFieldOrigin
387
410
  }
388
411
 
412
+ export interface PolicyGuardedProperty {
413
+ path: string
414
+ resolvedType: PolicyVariableType
415
+ requiredWhen?: string
416
+ }
417
+
389
418
  export interface PolicyInputProperty {
390
419
  path: string
391
420
  resolvedType: PolicyVariableType
@@ -424,6 +453,11 @@ export interface PolicyRenameRequest {
424
453
  newName: string
425
454
  }
426
455
 
456
+ export interface PolicySchemaGroup {
457
+ inputs: Array<PolicyGuardedProperty>
458
+ outputs: Array<PolicyGuardedProperty>
459
+ }
460
+
427
461
  export interface PolicyScopeRequest {
428
462
  policyPath: string
429
463
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gorules/zen-engine",
3
- "version": "0.55.0-beta.0",
3
+ "version": "0.55.0-beta.1",
4
4
  "main": "index.js",
5
5
  "browser": "browser.js",
6
6
  "types": "./index.d.ts",
@@ -98,13 +98,13 @@
98
98
  "form-data@^4.0.0": "4.0.4"
99
99
  },
100
100
  "optionalDependencies": {
101
- "@gorules/zen-engine-darwin-x64": "0.55.0-beta.0",
102
- "@gorules/zen-engine-linux-x64-gnu": "0.55.0-beta.0",
103
- "@gorules/zen-engine-linux-x64-musl": "0.55.0-beta.0",
104
- "@gorules/zen-engine-win32-x64-msvc": "0.55.0-beta.0",
105
- "@gorules/zen-engine-linux-arm64-gnu": "0.55.0-beta.0",
106
- "@gorules/zen-engine-linux-arm64-musl": "0.55.0-beta.0",
107
- "@gorules/zen-engine-darwin-arm64": "0.55.0-beta.0",
108
- "@gorules/zen-engine-wasm32-wasi": "0.55.0-beta.0"
101
+ "@gorules/zen-engine-darwin-x64": "0.55.0-beta.1",
102
+ "@gorules/zen-engine-linux-x64-gnu": "0.55.0-beta.1",
103
+ "@gorules/zen-engine-linux-x64-musl": "0.55.0-beta.1",
104
+ "@gorules/zen-engine-win32-x64-msvc": "0.55.0-beta.1",
105
+ "@gorules/zen-engine-linux-arm64-gnu": "0.55.0-beta.1",
106
+ "@gorules/zen-engine-linux-arm64-musl": "0.55.0-beta.1",
107
+ "@gorules/zen-engine-darwin-arm64": "0.55.0-beta.1",
108
+ "@gorules/zen-engine-wasm32-wasi": "0.55.0-beta.1"
109
109
  }
110
110
  }