@republicroad/seal-editor 1.15.0 → 1.16.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.
- package/dist/index.d.ts +171 -6
- package/dist/index.js +3874 -3377
- package/dist/index.js.map +1 -1
- package/dist/{schema-Csyt47SS.js → schema-BDvVbmiV.js} +384 -162
- package/dist/schema-BDvVbmiV.js.map +1 -0
- package/dist/schema.d.ts +39 -6
- package/dist/schema.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -1
- package/dist/schema-Csyt47SS.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ export declare const anyNodeSchema: z.ZodObject<{
|
|
|
43
43
|
}, z.core.$strip>>;
|
|
44
44
|
}, z.core.$strip>;
|
|
45
45
|
|
|
46
|
+
export declare const applySchemaTextToInputContract: (contract: InputContract, schemaText: string) => InputContract;
|
|
47
|
+
|
|
46
48
|
declare type Arrayable<T> = T | T[];
|
|
47
49
|
|
|
48
50
|
export declare const AUTO_SYNC_DEBOUNCE_MS = 700;
|
|
@@ -221,8 +223,35 @@ export declare const compareAndUnifyLists: <T extends BaseItem>(newList: T[], ol
|
|
|
221
223
|
|
|
222
224
|
export declare const compareStringFields: (field1?: string | null, field2?: string | null) => boolean;
|
|
223
225
|
|
|
226
|
+
export declare const computeExampleDrift: (data: Record<string, unknown>, definitions: Array<Pick<RequestDefinition, "name" | "path" | "type">>) => RequestExampleDrift;
|
|
227
|
+
|
|
224
228
|
export declare const computeGraphDiff: (a: DecisionGraphType, b: DecisionGraphType) => GraphDiff;
|
|
225
229
|
|
|
230
|
+
export declare type ContractDriftEvent = {
|
|
231
|
+
at: string;
|
|
232
|
+
nodeId: string;
|
|
233
|
+
nodeName?: string;
|
|
234
|
+
kind: ContractDriftEventKind;
|
|
235
|
+
exampleNames: string[];
|
|
236
|
+
counts?: {
|
|
237
|
+
missing: number;
|
|
238
|
+
extra: number;
|
|
239
|
+
conflicts: number;
|
|
240
|
+
constraints: number;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export declare type ContractDriftEventKind = 'drift-detected' | 'drift-migrated' | 'drift-confirmed';
|
|
245
|
+
|
|
246
|
+
export declare const contractExamplesToSources: (contract: InputContract, options?: {
|
|
247
|
+
dataLabel?: string;
|
|
248
|
+
}) => RequestExampleSource[];
|
|
249
|
+
|
|
250
|
+
export declare type ContractFixture = {
|
|
251
|
+
name: string;
|
|
252
|
+
input: unknown;
|
|
253
|
+
};
|
|
254
|
+
|
|
226
255
|
declare type ControlToType<T> = T extends keyof InputTypeMap ? InputTypeMap[T] : never;
|
|
227
256
|
|
|
228
257
|
declare type CreateDynamicType<T extends ReadonlyArray<unknown>, Result = {}> = T extends readonly [infer First, ...infer Rest] ? First extends {
|
|
@@ -342,6 +371,8 @@ declare type DecisionGraphEmptyType = {
|
|
|
342
371
|
mode?: JdmUiMode;
|
|
343
372
|
onChange?: DecisionGraphStoreType['listeners']['onChange'];
|
|
344
373
|
onReactFlowInit?: DecisionGraphStoreType['listeners']['onReactFlowInit'];
|
|
374
|
+
fixturesRunner?: DecisionGraphStoreType['state']['fixturesRunner'];
|
|
375
|
+
onContractEvent?: DecisionGraphStoreType['listeners']['onContractEvent'];
|
|
345
376
|
onCodeExtension?: DecisionGraphStoreType['listeners']['onCodeExtension'];
|
|
346
377
|
onFunctionReady?: DecisionGraphStoreType['listeners']['onFunctionReady'];
|
|
347
378
|
};
|
|
@@ -378,6 +409,7 @@ declare type DecisionGraphStoreType = {
|
|
|
378
409
|
user: string;
|
|
379
410
|
simulatorRequest?: string;
|
|
380
411
|
simulatorExampleBinding?: SimulatorExampleBinding;
|
|
412
|
+
fixturesRunner?: FixturesRunner | null;
|
|
381
413
|
compactMode?: boolean;
|
|
382
414
|
dictionaries?: DictionaryMap;
|
|
383
415
|
mode?: JdmUiMode;
|
|
@@ -424,11 +456,14 @@ declare type DecisionGraphStoreType = {
|
|
|
424
456
|
removeNodeType: (id: string, kind?: NodeTypeKind) => void;
|
|
425
457
|
setSimulatorRequest: (req: string) => void;
|
|
426
458
|
setSimulatorExampleBinding: (binding?: SimulatorExampleBinding) => void;
|
|
459
|
+
setFixturesRunner: (runner: FixturesRunner | null) => void;
|
|
460
|
+
emitContractEvent: (event: ContractDriftEvent) => void;
|
|
427
461
|
triggerNodeSelect: (id: string, mode: 'toggle' | 'only') => void;
|
|
428
462
|
};
|
|
429
463
|
listeners: {
|
|
430
464
|
onChange?: (val: DecisionGraphType) => void;
|
|
431
465
|
onPanelsChange?: (val?: string) => void;
|
|
466
|
+
onContractEvent?: (event: ContractDriftEvent) => void;
|
|
432
467
|
onReactFlowInit?: (instance: ReactFlowInstance) => void;
|
|
433
468
|
onCodeExtension?: CodeEditorProps['extension'];
|
|
434
469
|
onFunctionReady?: (monaco: Monaco) => void;
|
|
@@ -639,6 +674,17 @@ export declare const decisionModelSchema: z.ZodObject<{
|
|
|
639
674
|
}, z.core.$strip>>>;
|
|
640
675
|
inputField: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>, z.ZodTransform<string | null, string | null>>;
|
|
641
676
|
outputPath: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>, z.ZodTransform<string | null, string | null>>;
|
|
677
|
+
inputContract: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
678
|
+
contractVersion: z.ZodDefault<z.ZodNumber>;
|
|
679
|
+
schema: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>>, z.ZodTransform<Record<string, any>, string | Record<string, any> | null | undefined>>;
|
|
680
|
+
examples: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
681
|
+
id: z.ZodString;
|
|
682
|
+
name: z.ZodDefault<z.ZodString>;
|
|
683
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
684
|
+
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
685
|
+
schemaFingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
686
|
+
}, z.core.$strip>>>;
|
|
687
|
+
}, z.core.$strip>>>;
|
|
642
688
|
}, z.core.$strip>>;
|
|
643
689
|
id: z.ZodDefault<z.ZodString>;
|
|
644
690
|
name: z.ZodString;
|
|
@@ -1204,6 +1250,36 @@ declare const en: {
|
|
|
1204
1250
|
readonly 'request.fieldNamePlaceholder': "Field name";
|
|
1205
1251
|
readonly 'request.formatSchema': "Format schema";
|
|
1206
1252
|
readonly 'request.noDataSources': "No data";
|
|
1253
|
+
readonly 'request.driftSchemaChanged': "Schema changed since last validation";
|
|
1254
|
+
readonly 'request.driftMissing': "missing";
|
|
1255
|
+
readonly 'request.driftExtra': "extra";
|
|
1256
|
+
readonly 'request.driftConflicts': "type conflicts";
|
|
1257
|
+
readonly 'request.driftMigrate': "Migrate";
|
|
1258
|
+
readonly 'request.driftMigrateTooltip': "Fill missing values from defaults and remove fields that no longer exist";
|
|
1259
|
+
readonly 'request.driftMigrateAll': "Migrate all";
|
|
1260
|
+
readonly 'request.driftMigrateAllTooltip': "Apply the safe migration to every example";
|
|
1261
|
+
readonly 'request.driftConfirmValid': "Mark valid";
|
|
1262
|
+
readonly 'request.driftConfirmTooltip': "The example already matches the current schema - record its fingerprint";
|
|
1263
|
+
readonly 'request.driftConstraints': "constraint violations";
|
|
1264
|
+
readonly 'request.importContract': "Import contract";
|
|
1265
|
+
readonly 'request.importContractTooltip': "Adopt a shared contract envelope (contractVersion + schema + examples)";
|
|
1266
|
+
readonly 'request.importContractSuccess': "Contract envelope imported";
|
|
1267
|
+
readonly 'request.importContractInvalidJson': "The file is not valid JSON";
|
|
1268
|
+
readonly 'request.importContractInvalidShape': "Not a contract envelope (contractVersion + schema + examples are required)";
|
|
1269
|
+
readonly 'request.importContractUnsupportedVersion': "The envelope contractVersion is newer than this version supports";
|
|
1270
|
+
readonly 'request.exportContract': "Export contract";
|
|
1271
|
+
readonly 'request.exportContractTooltip': "Download the contract envelope for sharing (OpenAPI / mock / fixtures)";
|
|
1272
|
+
readonly 'request.showRemainingSources': "Show remaining examples";
|
|
1273
|
+
readonly 'request.runAll': "Run all";
|
|
1274
|
+
readonly 'request.runAllTooltip': "Execute every example against the current graph (runs on the host engine)";
|
|
1275
|
+
readonly 'request.runAllFailed': "Run failed";
|
|
1276
|
+
readonly 'request.runAllMatrixTitle': "Run report";
|
|
1277
|
+
readonly 'request.runAllMatrixLabel': "Run all result matrix";
|
|
1278
|
+
readonly 'request.runAllPassed': "passed";
|
|
1279
|
+
readonly 'request.runAllFailedCount': "failed";
|
|
1280
|
+
readonly 'request.outcomePassed': "passed";
|
|
1281
|
+
readonly 'request.outcomeAssertionFailed': "assertion failed";
|
|
1282
|
+
readonly 'request.outcomeExecutionError': "error";
|
|
1207
1283
|
readonly 'request.noDefinitions': "No field definitions";
|
|
1208
1284
|
readonly 'request.schemaPriorityTooltip': "Schema has the highest priority. Definitions and example data sync into schema, but schema remains the source of truth.";
|
|
1209
1285
|
readonly 'request.simulateTooltip': "Open simulator";
|
|
@@ -1241,6 +1317,24 @@ declare const en: {
|
|
|
1241
1317
|
|
|
1242
1318
|
export declare const ensureWasmLoaded: () => Promise<void>;
|
|
1243
1319
|
|
|
1320
|
+
export declare type ExampleRunOutcome = 'passed' | 'assertion-failed' | 'execution-error';
|
|
1321
|
+
|
|
1322
|
+
export declare type ExampleRunReport = {
|
|
1323
|
+
passed: number;
|
|
1324
|
+
failed: number;
|
|
1325
|
+
results: ExampleRunResult[];
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1328
|
+
export declare type ExampleRunResult = {
|
|
1329
|
+
name: string;
|
|
1330
|
+
passed: boolean;
|
|
1331
|
+
outcome: ExampleRunOutcome;
|
|
1332
|
+
actual?: unknown;
|
|
1333
|
+
error?: string;
|
|
1334
|
+
durationMs?: number;
|
|
1335
|
+
traceHits?: string[];
|
|
1336
|
+
};
|
|
1337
|
+
|
|
1244
1338
|
declare type ExposedStore<T> = UseBoundStore<StoreApi<T>> & {
|
|
1245
1339
|
setState: (partial: Partial<T>) => void;
|
|
1246
1340
|
};
|
|
@@ -1334,6 +1428,8 @@ declare type ExtensionParams = {
|
|
|
1334
1428
|
type?: 'standard' | 'unary' | 'template';
|
|
1335
1429
|
};
|
|
1336
1430
|
|
|
1431
|
+
export declare type FixturesRunner = (graph: DecisionGraphType, fixtures: ContractFixture[]) => Promise<ExampleRunReport>;
|
|
1432
|
+
|
|
1337
1433
|
declare const Function_2: default_2.FC<FunctionProps>;
|
|
1338
1434
|
export { Function_2 as Function }
|
|
1339
1435
|
|
|
@@ -1497,6 +1593,8 @@ declare type GraphTabsProps = {
|
|
|
1497
1593
|
tabBarExtraContent?: TabsProps['tabBarExtraContent'];
|
|
1498
1594
|
};
|
|
1499
1595
|
|
|
1596
|
+
export declare const hasExampleDrift: (drift: RequestExampleDrift) => boolean;
|
|
1597
|
+
|
|
1500
1598
|
declare type HitPolicy = 'first' | 'collect';
|
|
1501
1599
|
|
|
1502
1600
|
export declare type I18nMessages = Record<string, string>;
|
|
@@ -1522,6 +1620,22 @@ declare type InferTypeData<T> = {
|
|
|
1522
1620
|
|
|
1523
1621
|
declare type Input = unknown;
|
|
1524
1622
|
|
|
1623
|
+
export declare const INPUT_CONTRACT_VERSION = 1;
|
|
1624
|
+
|
|
1625
|
+
export declare type InputContract = {
|
|
1626
|
+
contractVersion: number;
|
|
1627
|
+
schema: RequestJsonSchema;
|
|
1628
|
+
examples: InputContractExample[];
|
|
1629
|
+
};
|
|
1630
|
+
|
|
1631
|
+
export declare type InputContractExample = {
|
|
1632
|
+
id: string;
|
|
1633
|
+
name: string;
|
|
1634
|
+
description?: string;
|
|
1635
|
+
data: Record<string, unknown>;
|
|
1636
|
+
schemaFingerprint?: string;
|
|
1637
|
+
};
|
|
1638
|
+
|
|
1525
1639
|
export declare const inputNodeSchema: z.ZodObject<{
|
|
1526
1640
|
type: z.ZodLiteral<NodeKind.Input>;
|
|
1527
1641
|
content: z.ZodDefault<z.ZodObject<{
|
|
@@ -1534,6 +1648,17 @@ export declare const inputNodeSchema: z.ZodObject<{
|
|
|
1534
1648
|
}, z.core.$strip>>>;
|
|
1535
1649
|
inputField: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>, z.ZodTransform<string | null, string | null>>;
|
|
1536
1650
|
outputPath: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>, z.ZodTransform<string | null, string | null>>;
|
|
1651
|
+
inputContract: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1652
|
+
contractVersion: z.ZodDefault<z.ZodNumber>;
|
|
1653
|
+
schema: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>>, z.ZodTransform<Record<string, any>, string | Record<string, any> | null | undefined>>;
|
|
1654
|
+
examples: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1655
|
+
id: z.ZodString;
|
|
1656
|
+
name: z.ZodDefault<z.ZodString>;
|
|
1657
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1658
|
+
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1659
|
+
schemaFingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1660
|
+
}, z.core.$strip>>>;
|
|
1661
|
+
}, z.core.$strip>>>;
|
|
1537
1662
|
}, z.core.$strip>>;
|
|
1538
1663
|
id: z.ZodDefault<z.ZodString>;
|
|
1539
1664
|
name: z.ZodString;
|
|
@@ -1617,6 +1742,11 @@ declare interface MenuProps {
|
|
|
1617
1742
|
onClick?: MenuItemType['onClick'];
|
|
1618
1743
|
}
|
|
1619
1744
|
|
|
1745
|
+
export declare const migrateRequestExampleDataByDefinitions: (data: Record<string, unknown>, definitions: Array<Pick<RequestDefinition, "name" | "path" | "type" | "defaultValue">>) => {
|
|
1746
|
+
data: Record<string, unknown>;
|
|
1747
|
+
conflicts: RequestDefinitionSyncConflict[];
|
|
1748
|
+
};
|
|
1749
|
+
|
|
1620
1750
|
export declare type MinimalNodeProps = Pick<NodeProps, 'id' | 'selected'> & {
|
|
1621
1751
|
data: any;
|
|
1622
1752
|
};
|
|
@@ -1855,6 +1985,17 @@ export declare const nodeSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
1855
1985
|
}, z.core.$strip>>>;
|
|
1856
1986
|
inputField: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>, z.ZodTransform<string | null, string | null>>;
|
|
1857
1987
|
outputPath: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>, z.ZodTransform<string | null, string | null>>;
|
|
1988
|
+
inputContract: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1989
|
+
contractVersion: z.ZodDefault<z.ZodNumber>;
|
|
1990
|
+
schema: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>>, z.ZodTransform<Record<string, any>, string | Record<string, any> | null | undefined>>;
|
|
1991
|
+
examples: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1992
|
+
id: z.ZodString;
|
|
1993
|
+
name: z.ZodDefault<z.ZodString>;
|
|
1994
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1995
|
+
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1996
|
+
schemaFingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1997
|
+
}, z.core.$strip>>>;
|
|
1998
|
+
}, z.core.$strip>>>;
|
|
1858
1999
|
}, z.core.$strip>>;
|
|
1859
2000
|
id: z.ZodDefault<z.ZodString>;
|
|
1860
2001
|
name: z.ZodString;
|
|
@@ -2054,10 +2195,16 @@ declare interface RadioGroupProps {
|
|
|
2054
2195
|
style?: React_2.CSSProperties;
|
|
2055
2196
|
}
|
|
2056
2197
|
|
|
2198
|
+
export declare const readRequestInputContract: (content?: RequestContentLike | null) => {
|
|
2199
|
+
contract: InputContract;
|
|
2200
|
+
origin: RequestInputContractOrigin;
|
|
2201
|
+
};
|
|
2202
|
+
|
|
2057
2203
|
declare type RequestContentLike = {
|
|
2058
2204
|
schema?: unknown;
|
|
2059
2205
|
schemaUI?: unknown;
|
|
2060
2206
|
inputs?: LegacyRequestInput[];
|
|
2207
|
+
inputContract?: InputContract;
|
|
2061
2208
|
};
|
|
2062
2209
|
|
|
2063
2210
|
export declare type RequestDefinition = {
|
|
@@ -2074,8 +2221,20 @@ export declare type RequestDefinition = {
|
|
|
2074
2221
|
defaultValue?: string;
|
|
2075
2222
|
};
|
|
2076
2223
|
|
|
2224
|
+
declare type RequestDefinitionSyncConflict = {
|
|
2225
|
+
path: string;
|
|
2226
|
+
nextType: RequestDefinitionType;
|
|
2227
|
+
value: unknown;
|
|
2228
|
+
};
|
|
2229
|
+
|
|
2077
2230
|
export declare type RequestDefinitionType = 'number' | 'string' | 'array' | 'object' | 'datetime' | 'boolean';
|
|
2078
2231
|
|
|
2232
|
+
export declare type RequestExampleDrift = {
|
|
2233
|
+
missing: Array<Pick<RequestDefinition, 'name' | 'path' | 'type'>>;
|
|
2234
|
+
extra: string[];
|
|
2235
|
+
conflicts: RequestDefinitionSyncConflict[];
|
|
2236
|
+
};
|
|
2237
|
+
|
|
2079
2238
|
declare type RequestExampleMeta = {
|
|
2080
2239
|
name?: string;
|
|
2081
2240
|
description?: string;
|
|
@@ -2089,6 +2248,8 @@ export declare type RequestExampleSource = {
|
|
|
2089
2248
|
source: 'schema.examples' | 'content.inputs';
|
|
2090
2249
|
};
|
|
2091
2250
|
|
|
2251
|
+
declare type RequestInputContractOrigin = 'contract' | 'legacy';
|
|
2252
|
+
|
|
2092
2253
|
declare type RequestJsonSchema = {
|
|
2093
2254
|
'type'?: string | string[];
|
|
2094
2255
|
'description'?: string;
|
|
@@ -2101,6 +2262,8 @@ declare type RequestJsonSchema = {
|
|
|
2101
2262
|
[key: string]: unknown;
|
|
2102
2263
|
};
|
|
2103
2264
|
|
|
2265
|
+
export declare const requestSchemaFingerprint: (schema: unknown) => string;
|
|
2266
|
+
|
|
2104
2267
|
export declare const resolveRequestSchemaValue: (content?: RequestContentLike | null, options?: {
|
|
2105
2268
|
includeExamples?: boolean;
|
|
2106
2269
|
}) => RequestJsonSchema | null;
|
|
@@ -2508,19 +2671,21 @@ declare type ViewConfig = {
|
|
|
2508
2671
|
|
|
2509
2672
|
declare type ViewConfigPermission = 'edit:values' | 'edit:rules' | 'edit:full';
|
|
2510
2673
|
|
|
2674
|
+
export declare const writeRequestInputContract: (content: RequestContentLike & Record<string, any>, contract: InputContract) => InputContract;
|
|
2675
|
+
|
|
2511
2676
|
export { }
|
|
2512
2677
|
|
|
2513
2678
|
|
|
2514
|
-
declare
|
|
2515
|
-
interface
|
|
2516
|
-
|
|
2679
|
+
declare module '@gorules/zen-engine-wasm' {
|
|
2680
|
+
interface VariableType {
|
|
2681
|
+
__hash: string;
|
|
2517
2682
|
}
|
|
2518
2683
|
}
|
|
2519
2684
|
|
|
2520
2685
|
|
|
2521
|
-
declare
|
|
2522
|
-
interface
|
|
2523
|
-
|
|
2686
|
+
declare global {
|
|
2687
|
+
interface Window {
|
|
2688
|
+
monaco?: Monaco;
|
|
2524
2689
|
}
|
|
2525
2690
|
}
|
|
2526
2691
|
|