@gorules/zen-engine 1.0.0-beta.9 → 2.0.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.
Files changed (2) hide show
  1. package/index.d.ts +48 -0
  2. package/package.json +10 -10
package/index.d.ts CHANGED
@@ -69,9 +69,11 @@ export type PolicyDiagnosticCode =
69
69
  | 'UNRESOLVED_FUNCTION_TYPE'
70
70
  | 'IMPLICIT_ANY'
71
71
  | 'UNCHECKED_NODE'
72
+ | 'NULLABILITY_DIVERGENCE'
72
73
  | 'REDUNDANT_NULLISH'
73
74
  | 'REPEATED_DERIVATION'
74
75
  | 'PREFER_MATCH'
76
+ | 'PREFER_DICTIONARY'
75
77
  | 'REDUNDANT_TABLE_ROW'
76
78
  | 'NON_DISCRIMINATING_COLUMN'
77
79
  | 'REDUNDANT_PARENTHESES';
@@ -308,6 +310,51 @@ export interface PolicyReferenceSite {
308
310
  kind: PolicyReferenceKind;
309
311
  }
310
312
 
313
+ /** What kind of content a `PolicySearchHit` matched. */
314
+ export type PolicySearchHitKind =
315
+ | 'document'
316
+ | 'heading'
317
+ | 'paragraph'
318
+ | 'listItem'
319
+ | 'codeBlock'
320
+ | 'expression'
321
+ | 'expressionKey'
322
+ | 'tableColumn'
323
+ | 'tableCell'
324
+ | 'matchKey'
325
+ | 'matchCondition'
326
+ | 'matchValue'
327
+ | 'assertionOutput'
328
+ | 'assertionCondition'
329
+ | 'dataModel'
330
+ | 'dataModelProperty'
331
+ | 'dictionary'
332
+ | 'dictionaryEntry'
333
+ | 'graphNode'
334
+ | 'switchCondition'
335
+ | 'function';
336
+
337
+ /**
338
+ * One ranked fuzzy-search hit returned by `search()`. Location fields are
339
+ * populated per kind: policy hits carry `blockId` (plus `expressionId`,
340
+ * `row`/`column` for table cells), graph hits carry `nodeId`. `span` is a
341
+ * character range within `text` (which may be a snippet of long sources).
342
+ */
343
+ export interface PolicySearchHit {
344
+ path: string;
345
+ blockId?: string;
346
+ nodeId?: string;
347
+ expressionId?: string;
348
+ row?: number;
349
+ column?: string;
350
+ kind: PolicySearchHitKind;
351
+ text: string;
352
+ /** Human context for the hit, e.g. column name, entity, or node name. */
353
+ context?: string;
354
+ span: PolicySpan;
355
+ score: number;
356
+ }
357
+
311
358
  /**
312
359
  * One node in the transitive dependency tree returned by `dependencies()`.
313
360
  * Each node names a property; `writtenBy` is the block that produces it
@@ -416,6 +463,7 @@ export declare class Workspace {
416
463
  prepareRename(cursor: PolicyExpressionCursor): PolicyPrepareRenameResult | null
417
464
  rename(req: PolicyRenameRequest): PolicyEngineEdit[]
418
465
  references(target: any): PolicyReferenceSite[]
466
+ search(query: string, limit?: number | undefined | null): PolicySearchHit[]
419
467
  inputSkeleton(req: PolicyScopeRequest): unknown
420
468
  dependencies(target: string, document?: string | undefined | null): PolicyDependencyNode
421
469
  evaluate(req: PolicyEvaluateRequest): PolicyEvaluationResult
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gorules/zen-engine",
3
- "version": "1.0.0-beta.9",
3
+ "version": "2.0.0",
4
4
  "main": "index.js",
5
5
  "browser": "browser.js",
6
6
  "types": "./index.d.ts",
@@ -101,15 +101,15 @@
101
101
  "resolutions": {
102
102
  "form-data@^4.0.0": "4.0.4"
103
103
  },
104
- "gitHead": "717cbf5d80fbe236e40e173d52172edddd886b82",
104
+ "gitHead": "112b8dbd429555e5f89dcddc6d327c26fb124d0d",
105
105
  "optionalDependencies": {
106
- "@gorules/zen-engine-darwin-x64": "1.0.0-beta.9",
107
- "@gorules/zen-engine-linux-x64-gnu": "1.0.0-beta.9",
108
- "@gorules/zen-engine-linux-x64-musl": "1.0.0-beta.9",
109
- "@gorules/zen-engine-win32-x64-msvc": "1.0.0-beta.9",
110
- "@gorules/zen-engine-linux-arm64-gnu": "1.0.0-beta.9",
111
- "@gorules/zen-engine-linux-arm64-musl": "1.0.0-beta.9",
112
- "@gorules/zen-engine-darwin-arm64": "1.0.0-beta.9",
113
- "@gorules/zen-engine-wasm32-wasi": "1.0.0-beta.9"
106
+ "@gorules/zen-engine-darwin-x64": "2.0.0",
107
+ "@gorules/zen-engine-linux-x64-gnu": "2.0.0",
108
+ "@gorules/zen-engine-linux-x64-musl": "2.0.0",
109
+ "@gorules/zen-engine-win32-x64-msvc": "2.0.0",
110
+ "@gorules/zen-engine-linux-arm64-gnu": "2.0.0",
111
+ "@gorules/zen-engine-linux-arm64-musl": "2.0.0",
112
+ "@gorules/zen-engine-darwin-arm64": "2.0.0",
113
+ "@gorules/zen-engine-wasm32-wasi": "2.0.0"
114
114
  }
115
115
  }