@toolproof-npm/schema 0.1.78 → 0.1.79
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.
|
@@ -448,9 +448,7 @@ export interface Named {
|
|
|
448
448
|
* This interface was referenced by `GenesisJson`'s JSON-Schema
|
|
449
449
|
* via the `definition` "ExecutionSocket".
|
|
450
450
|
*/
|
|
451
|
-
export
|
|
452
|
-
[k: string]: ResourceMissing | ResourcePotentialInput | ResourcePotentialOutput | Resource;
|
|
453
|
-
}
|
|
451
|
+
export type ExecutionSocket = Record<ResourceRoleIdentity, ResourceMissing | ResourcePotentialInput | ResourcePotentialOutput | Resource>;
|
|
454
452
|
/**
|
|
455
453
|
* This interface was referenced by `GenesisJson`'s JSON-Schema
|
|
456
454
|
* via the `definition` "ResourceBase".
|
|
@@ -484,9 +482,7 @@ export interface Path {
|
|
|
484
482
|
* This interface was referenced by `GenesisJson`'s JSON-Schema
|
|
485
483
|
* via the `definition` "ExecutionSocketMaterialized".
|
|
486
484
|
*/
|
|
487
|
-
export
|
|
488
|
-
[k: string]: Resource;
|
|
489
|
-
}
|
|
485
|
+
export type ExecutionSocketMaterialized = Record<ResourceRoleIdentity, Resource>;
|
|
490
486
|
/**
|
|
491
487
|
* This interface was referenced by `GenesisJson`'s JSON-Schema
|
|
492
488
|
* via the `definition` "ExtractionSchemaWrapper".
|
|
@@ -591,9 +587,7 @@ export interface StrategyStateWrapper {
|
|
|
591
587
|
* This interface was referenced by `GenesisJson`'s JSON-Schema
|
|
592
588
|
* via the `definition` "StrategyState".
|
|
593
589
|
*/
|
|
594
|
-
export
|
|
595
|
-
[k: string]: ExecutionSocket;
|
|
596
|
-
}
|
|
590
|
+
export type StrategyState = Record<ExecutionIdentity, ExecutionSocket>;
|
|
597
591
|
/**
|
|
598
592
|
* This interface was referenced by `GenesisJson`'s JSON-Schema
|
|
599
593
|
* via the `definition` "StrategyRunContext".
|
|
@@ -610,9 +604,7 @@ export interface StrategyThreadMapWrapper {
|
|
|
610
604
|
* This interface was referenced by `GenesisJson`'s JSON-Schema
|
|
611
605
|
* via the `definition` "StrategyThreadMap".
|
|
612
606
|
*/
|
|
613
|
-
export
|
|
614
|
-
[k: string]: Step[];
|
|
615
|
-
}
|
|
607
|
+
export type StrategyThreadMap = Record<StrategyThreadIdentity, Step[]>;
|
|
616
608
|
export interface StrategyStateWrapper1 {
|
|
617
609
|
strategyState: StrategyState;
|
|
618
610
|
}
|
|
@@ -623,12 +615,8 @@ export interface StrategyStateWrapper1 {
|
|
|
623
615
|
export interface StrategyRunUpdate {
|
|
624
616
|
strategyRun?: StrategyRun1;
|
|
625
617
|
strategyRunRef: StrategyRunIdentity;
|
|
626
|
-
strategyStateUpdate:
|
|
627
|
-
|
|
628
|
-
};
|
|
629
|
-
strategyStateUpdateWide?: {
|
|
630
|
-
[k: string]: ExecutionSocket;
|
|
631
|
-
};
|
|
618
|
+
strategyStateUpdate: Record<ExecutionIdentity, ExecutionSocketMaterialized>;
|
|
619
|
+
strategyStateUpdateWide?: Record<ExecutionIdentity, ExecutionSocket>;
|
|
632
620
|
}
|
|
633
621
|
/**
|
|
634
622
|
* This interface was referenced by `GenesisJson`'s JSON-Schema
|
|
@@ -860,12 +848,8 @@ export interface Conditional {
|
|
|
860
848
|
export interface StrategyStateWrapper {
|
|
861
849
|
strategyState: StrategyState;
|
|
862
850
|
}
|
|
863
|
-
export
|
|
864
|
-
|
|
865
|
-
}
|
|
866
|
-
export interface ExecutionSocket {
|
|
867
|
-
[k: string]: ResourceMissing | ResourcePotentialInput | ResourcePotentialOutput | Resource;
|
|
868
|
-
}
|
|
851
|
+
export type StrategyState = Record<ExecutionIdentity, ExecutionSocket>;
|
|
852
|
+
export type ExecutionSocket = Record<ResourceRoleIdentity, ResourceMissing | ResourcePotentialInput | ResourcePotentialOutput | Resource>;
|
|
869
853
|
export interface ResourceBase {
|
|
870
854
|
identity: ResourceIdentity;
|
|
871
855
|
resourceTypeRef: ResourceTypeIdentity;
|
|
@@ -1163,9 +1147,7 @@ export interface Timestamp {
|
|
|
1163
1147
|
export interface StrategyThreadMapWrapper {
|
|
1164
1148
|
strategyThreadMap: StrategyThreadMap;
|
|
1165
1149
|
}
|
|
1166
|
-
export
|
|
1167
|
-
[k: string]: Step[];
|
|
1168
|
-
}
|
|
1150
|
+
export type StrategyThreadMap = Record<StrategyThreadIdentity, Step[]>;
|
|
1169
1151
|
export interface RoleBindingsWrapper {
|
|
1170
1152
|
roleBindings: RoleBindings;
|
|
1171
1153
|
}
|
|
@@ -1184,12 +1166,8 @@ export interface Conditional {
|
|
|
1184
1166
|
export interface StrategyStateWrapper {
|
|
1185
1167
|
strategyState: StrategyState;
|
|
1186
1168
|
}
|
|
1187
|
-
export
|
|
1188
|
-
|
|
1189
|
-
}
|
|
1190
|
-
export interface ExecutionSocket {
|
|
1191
|
-
[k: string]: ResourceMissing | ResourcePotentialInput | ResourcePotentialOutput | Resource;
|
|
1192
|
-
}
|
|
1169
|
+
export type StrategyState = Record<ExecutionIdentity, ExecutionSocket>;
|
|
1170
|
+
export type ExecutionSocket = Record<ResourceRoleIdentity, ResourceMissing | ResourcePotentialInput | ResourcePotentialOutput | Resource>;
|
|
1193
1171
|
export interface ResourceBase {
|
|
1194
1172
|
identity: ResourceIdentity;
|
|
1195
1173
|
resourceTypeRef: ResourceTypeIdentity;
|
|
@@ -469,9 +469,20 @@ async function main() {
|
|
|
469
469
|
const resourceRoleKeyType = 'ResourceRoleIdentity';
|
|
470
470
|
const resourceKeyType = 'ResourceIdentity';
|
|
471
471
|
const executionKeyType = 'ExecutionIdentity';
|
|
472
|
+
const strategyThreadKeyType = 'StrategyThreadIdentity';
|
|
472
473
|
ts = ts.replace(/export interface RoleMap\s*{[^}]*}/g, `export type RoleMap = Record<${resourceRoleKeyType}, ResourceRoleValue>;`);
|
|
473
474
|
ts = ts.replace(/export interface RoleBindingMap\s*{[^}]*}/g, `export type RoleBindingMap = Record<${resourceRoleKeyType}, ${resourceKeyType}>;`);
|
|
474
|
-
|
|
475
|
+
// Normalize StrategyState & related socket maps to identity-keyed Records.
|
|
476
|
+
// These are emitted as `[k: string]` by json-schema-to-typescript but are identity-keyed in practice.
|
|
477
|
+
const executionSocketValueType = 'ResourceMissing | ResourcePotentialInput | ResourcePotentialOutput | Resource';
|
|
478
|
+
ts = ts.replace(/export interface ExecutionSocket\s*\{\s*\[k:\s*string\]:\s*[^;]+;\s*\}/g, `export type ExecutionSocket = Record<${resourceRoleKeyType}, ${executionSocketValueType}>;`);
|
|
479
|
+
ts = ts.replace(/export interface ExecutionSocketMaterialized\s*\{\s*\[k:\s*string\]:\s*Resource;\s*\}/g, `export type ExecutionSocketMaterialized = Record<${resourceRoleKeyType}, Resource>;`);
|
|
480
|
+
ts = ts.replace(/export interface StrategyState\s*\{\s*\[k:\s*string\]:\s*ExecutionSocket;\s*\}/g, `export type StrategyState = Record<${executionKeyType}, ExecutionSocket>;`);
|
|
481
|
+
ts = ts.replace(/(strategyStateUpdate:\s*)\{\s*\[k:\s*string\]:\s*ExecutionSocketMaterialized;\s*\};/g, `$1Record<${executionKeyType}, ExecutionSocketMaterialized>;`);
|
|
482
|
+
ts = ts.replace(/(strategyStateUpdateWide\??:\s*)\{\s*\[k:\s*string\]:\s*ExecutionSocket;\s*\};/g, `$1Record<${executionKeyType}, ExecutionSocket>;`);
|
|
483
|
+
// Ensure key constraints for strategyThreadMap are preserved as template-literal identity keys.
|
|
484
|
+
// json-schema-to-typescript emits `[k: string]: Step[];`, but we want keys to be `StrategyThreadIdentity`.
|
|
485
|
+
ts = ts.replace(/export interface StrategyThreadMap\s*\{\s*\[k:\s*string\]:\s*Step\[\];\s*\}/g, `export type StrategyThreadMap = Record<${strategyThreadKeyType}, Step[]>;`);
|
|
475
486
|
parts.push(ts);
|
|
476
487
|
let output = parts.join('\n');
|
|
477
488
|
// Final guard: strip any lingering `[k: string]: unknown;` that might have been
|