@gorules/zen-engine 1.0.0-beta.4 → 1.0.0-beta.6
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/index.d.ts +17 -65
- package/index.js +2 -0
- package/package.json +10 -10
package/index.d.ts
CHANGED
|
@@ -193,6 +193,8 @@ export interface NlResult {
|
|
|
193
193
|
diagnostics: NlDiagnostic[];
|
|
194
194
|
/** Resolved `$` type for unary requests (decision-table input cells); present even for empty text. */
|
|
195
195
|
subjectType?: PolicyVariableType;
|
|
196
|
+
/** Labeled options when the unary subject is an enum (dictionary labels applied); present even for empty text. */
|
|
197
|
+
subjectOptions?: NlEnumOption[];
|
|
196
198
|
}
|
|
197
199
|
|
|
198
200
|
/**
|
|
@@ -212,6 +214,8 @@ export interface PolicyNlExpression {
|
|
|
212
214
|
diagnostics: NlDiagnostic[];
|
|
213
215
|
/** Resolved `$` type for unary cells. */
|
|
214
216
|
subjectType?: PolicyVariableType;
|
|
217
|
+
/** Labeled options when the unary subject is an enum (dictionary labels applied). */
|
|
218
|
+
subjectOptions?: NlEnumOption[];
|
|
215
219
|
}
|
|
216
220
|
|
|
217
221
|
/**
|
|
@@ -362,30 +366,14 @@ export declare class PolicyWorkspace {
|
|
|
362
366
|
constructor()
|
|
363
367
|
setPolicy(path: string, document: any): void
|
|
364
368
|
removePolicy(path: string): boolean
|
|
365
|
-
/**
|
|
366
|
-
* Upsert a single block in an existing policy (replace-by-id or append).
|
|
367
|
-
* Errors when the policy does not exist — call `setPolicy` first to
|
|
368
|
-
* create one.
|
|
369
|
-
*/
|
|
370
369
|
updateBlock(req: PolicyUpdateBlockRequest): void
|
|
371
|
-
/**
|
|
372
|
-
* Remove a block from an existing policy by id. Returns `true` when a
|
|
373
|
-
* block was removed, `false` when the policy or block didn't exist.
|
|
374
|
-
*/
|
|
375
370
|
removeBlock(req: PolicyRemoveBlockRequest): boolean
|
|
376
371
|
policyPaths(): Array<string>
|
|
377
|
-
/**
|
|
378
|
-
* `max_diagnostics` caps the returned list (default: 100). Pass `0` for
|
|
379
|
-
* no cap.
|
|
380
|
-
*/
|
|
381
372
|
diagnostics(policyPath: string, maxDiagnostics?: number | undefined | null): Array<PolicyDiagnostic>
|
|
382
|
-
/**
|
|
383
|
-
* `max_diagnostics` caps the returned list (default: 100). Pass `0` for
|
|
384
|
-
* no cap.
|
|
385
|
-
*/
|
|
386
373
|
allDiagnostics(maxDiagnostics?: number | undefined | null): Array<PolicyDiagnostic>
|
|
387
374
|
entities(req: PolicyScopeRequest): Array<PolicyEntityInfo>
|
|
388
375
|
globals(req: PolicyScopeRequest): Array<PolicyGlobalInfo>
|
|
376
|
+
dictionaries(req: PolicyScopeRequest): Array<PolicyDictionaryInfo>
|
|
389
377
|
inputs(req: PolicyScopeRequest): Array<PolicyInputProperty>
|
|
390
378
|
outputs(req: PolicyScopeRequest): Array<PolicyOutputProperty>
|
|
391
379
|
conditionalSchema(req: PolicyScopeRequest): PolicyConditionalSchema
|
|
@@ -394,32 +382,9 @@ export declare class PolicyWorkspace {
|
|
|
394
382
|
nlTokenize(cursor: PolicyExpressionCursor, text: string): NlResult | null
|
|
395
383
|
completions(cursor: PolicyExpressionCursor): Array<PolicyCompletion>
|
|
396
384
|
prepareRename(cursor: PolicyExpressionCursor): PolicyPrepareRenameResult | null
|
|
397
|
-
/**
|
|
398
|
-
* Returns block-level edits the host applies via id-keyed swap (same
|
|
399
|
-
* path as `update_block`). Each edit's `kind` field discriminates the
|
|
400
|
-
* variant; `replaceBlock` carries a `newBlock` payload that is the
|
|
401
|
-
* rewritten wire-format `BlockDoc`.
|
|
402
|
-
*/
|
|
403
385
|
rename(req: PolicyRenameRequest): PolicyEngineEdit[]
|
|
404
|
-
/**
|
|
405
|
-
* Returns every site in the workspace where `target` is used. Same
|
|
406
|
-
* visitor as `rename`; carries policy/block/expression/source/span/kind
|
|
407
|
-
* for each site so hosts can render a "find references" panel or drive
|
|
408
|
-
* navigation.
|
|
409
|
-
*/
|
|
410
386
|
references(target: any): PolicyReferenceSite[]
|
|
411
|
-
/**
|
|
412
|
-
* Default-valued JSON object that matches the workspace's input shape
|
|
413
|
-
* for `req.policy_path` (and optionally `req.goals`). Hosts use it as
|
|
414
|
-
* the initial value of a "Run simulation" panel so `evaluate` can be
|
|
415
|
-
* called immediately without first authoring an input by hand.
|
|
416
|
-
*/
|
|
417
387
|
inputSkeleton(req: PolicyScopeRequest): unknown
|
|
418
|
-
/**
|
|
419
|
-
* Returns the transitive dependency tree rooted at `target`. Inverse
|
|
420
|
-
* of `references()`. Per-write granularity — multi-output blocks
|
|
421
|
-
* don't conflate sibling outputs' deps.
|
|
422
|
-
*/
|
|
423
388
|
dependencies(target: string): PolicyDependencyNode
|
|
424
389
|
evaluate(req: PolicyEvaluateRequest): PolicyEvaluationResult
|
|
425
390
|
enhanceTrace(req: PolicyEvaluateRequest): PolicyEvaluationResult
|
|
@@ -446,7 +411,7 @@ export declare class ZenEngine {
|
|
|
446
411
|
getDecision(key: string): Promise<ZenDecision>
|
|
447
412
|
safeEvaluate(key: string, context: any, opts?: ZenEvaluateOptions | undefined | null): Promise<{ success: true, data: ZenEngineResponse } | { success: false; error: any; }>
|
|
448
413
|
safeGetDecision(key: string): Promise<{ success: true, data: ZenDecision } | { success: false; error: any; }>
|
|
449
|
-
evaluateBatch(requests: Array<EvaluateBatchRequest>, opts?: ZenEvaluateOptions | undefined | null): Promise<Array<
|
|
414
|
+
evaluateBatch(requests: Array<EvaluateBatchRequest>, opts?: ZenEvaluateOptions | undefined | null): Promise<Array<{ success: true; data: ZenEngineResponse } | { success: false; error: any }>>
|
|
450
415
|
reload(): Promise<void>
|
|
451
416
|
compileFailures(): Array<{ key: string; kind: string; diagnostics?: Array<{ code: string; message: string; severity: string }>; error?: string }>
|
|
452
417
|
dispose(): void
|
|
@@ -472,12 +437,6 @@ export interface EvaluateBatchRequest {
|
|
|
472
437
|
context: any
|
|
473
438
|
}
|
|
474
439
|
|
|
475
|
-
export interface EvaluateBatchResult {
|
|
476
|
-
success: boolean
|
|
477
|
-
data?: any
|
|
478
|
-
error?: any
|
|
479
|
-
}
|
|
480
|
-
|
|
481
440
|
export declare function evaluateExpression(expression: string, context?: any | undefined | null): Promise<any>
|
|
482
441
|
|
|
483
442
|
export declare function evaluateExpressionSync(expression: string, context?: any | undefined | null): any
|
|
@@ -524,6 +483,17 @@ export interface PolicyDiagnostic {
|
|
|
524
483
|
target?: PolicyCursorTarget
|
|
525
484
|
}
|
|
526
485
|
|
|
486
|
+
export interface PolicyDictionaryEntryInfo {
|
|
487
|
+
value: string
|
|
488
|
+
label: string
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export interface PolicyDictionaryInfo {
|
|
492
|
+
name: string
|
|
493
|
+
source: string
|
|
494
|
+
entries: Array<PolicyDictionaryEntryInfo>
|
|
495
|
+
}
|
|
496
|
+
|
|
527
497
|
export interface PolicyDiscriminantVariant {
|
|
528
498
|
value?: string
|
|
529
499
|
arm: string
|
|
@@ -550,7 +520,6 @@ export interface PolicyEntityInfo {
|
|
|
550
520
|
export interface PolicyEvaluateRequest {
|
|
551
521
|
policyPath: string
|
|
552
522
|
input: unknown
|
|
553
|
-
/** Goals to evaluate. Omit or pass empty for full evaluation. */
|
|
554
523
|
goals?: Array<string>
|
|
555
524
|
trace?: boolean
|
|
556
525
|
}
|
|
@@ -559,18 +528,9 @@ export interface PolicyExpressionCursor {
|
|
|
559
528
|
policyPath: string
|
|
560
529
|
blockId: string
|
|
561
530
|
pos: number
|
|
562
|
-
/**
|
|
563
|
-
* Tagged `{ kind, ...payload }` discriminating what kind of span the
|
|
564
|
-
* cursor sits in. See `PolicyCursorTarget` in the TypeScript types.
|
|
565
|
-
*/
|
|
566
531
|
target: PolicyCursorTarget
|
|
567
532
|
}
|
|
568
533
|
|
|
569
|
-
/**
|
|
570
|
-
* Kept as a `#[napi(object)]` struct purely so NAPI-RS emits the TS type
|
|
571
|
-
* used by `PolicyFieldOrigin.schema.fieldKind`. The runtime shape is
|
|
572
|
-
* hand-built in [`field_kind_to_json`].
|
|
573
|
-
*/
|
|
574
534
|
export interface PolicyFieldKindInfo {
|
|
575
535
|
kind: PolicyFieldKind
|
|
576
536
|
target?: string
|
|
@@ -640,19 +600,11 @@ export interface PolicySchemaGroup {
|
|
|
640
600
|
|
|
641
601
|
export interface PolicyScopeRequest {
|
|
642
602
|
policyPath: string
|
|
643
|
-
/**
|
|
644
|
-
* Goals to constrain schema introspection to. Omit or pass empty
|
|
645
|
-
* for everything reachable from the policy.
|
|
646
|
-
*/
|
|
647
603
|
goals?: Array<string>
|
|
648
604
|
}
|
|
649
605
|
|
|
650
606
|
export interface PolicyUpdateBlockRequest {
|
|
651
607
|
policyPath: string
|
|
652
|
-
/**
|
|
653
|
-
* A single wire block (same shape as one entry of `PolicyDocument.blocks`).
|
|
654
|
-
* Upserted by `block.id`: replaces in place if present, appends otherwise.
|
|
655
|
-
*/
|
|
656
608
|
block: unknown
|
|
657
609
|
}
|
|
658
610
|
|
package/index.js
CHANGED
|
@@ -581,6 +581,8 @@ module.exports.evaluateExpression = nativeBinding.evaluateExpression
|
|
|
581
581
|
module.exports.evaluateExpressionSync = nativeBinding.evaluateExpressionSync
|
|
582
582
|
module.exports.evaluateUnaryExpression = nativeBinding.evaluateUnaryExpression
|
|
583
583
|
module.exports.evaluateUnaryExpressionSync = nativeBinding.evaluateUnaryExpressionSync
|
|
584
|
+
module.exports.nlEncodeString = nativeBinding.nlEncodeString
|
|
585
|
+
module.exports.nlTokenizeBatch = nativeBinding.nlTokenizeBatch
|
|
584
586
|
module.exports.overrideConfig = nativeBinding.overrideConfig
|
|
585
587
|
module.exports.renderTemplate = nativeBinding.renderTemplate
|
|
586
588
|
module.exports.renderTemplateSync = nativeBinding.renderTemplateSync
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gorules/zen-engine",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
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": "
|
|
100
|
+
"gitHead": "48cc2e38d5ef9c01dbf6a783ecff57a07eecc358",
|
|
101
101
|
"optionalDependencies": {
|
|
102
|
-
"@gorules/zen-engine-darwin-x64": "1.0.0-beta.
|
|
103
|
-
"@gorules/zen-engine-linux-x64-gnu": "1.0.0-beta.
|
|
104
|
-
"@gorules/zen-engine-linux-x64-musl": "1.0.0-beta.
|
|
105
|
-
"@gorules/zen-engine-win32-x64-msvc": "1.0.0-beta.
|
|
106
|
-
"@gorules/zen-engine-linux-arm64-gnu": "1.0.0-beta.
|
|
107
|
-
"@gorules/zen-engine-linux-arm64-musl": "1.0.0-beta.
|
|
108
|
-
"@gorules/zen-engine-darwin-arm64": "1.0.0-beta.
|
|
109
|
-
"@gorules/zen-engine-wasm32-wasi": "1.0.0-beta.
|
|
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"
|
|
110
110
|
}
|
|
111
111
|
}
|