@toolproof-npm/schema 0.1.49 → 0.1.52

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 (27) hide show
  1. package/dist/genesis/generated/resource-envelopes/Genesis.d.ts +2 -0
  2. package/dist/genesis/generated/resource-envelopes/Genesis.js +2 -0
  3. package/dist/genesis/generated/resource-envelopes/Genesis.json +2337 -0
  4. package/dist/genesis/{resourceTypes → generated/resource-type-envelopes}/Genesis.json +223 -255
  5. package/dist/genesis/generated/resourceTypes/Genesis.d.ts +2 -0
  6. package/dist/genesis/generated/resourceTypes/Genesis.js +2 -0
  7. package/dist/genesis/generated/resourceTypes/Genesis.json +1757 -0
  8. package/dist/genesis/generated/resources/Genesis.json +157 -189
  9. package/dist/genesis/generated/schemas/Genesis.json +149 -181
  10. package/dist/genesis/generated/schemas/Job.json +20 -22
  11. package/dist/genesis/generated/schemas/ResourceFormat.json +14 -16
  12. package/dist/genesis/generated/schemas/ResourceType.json +28 -30
  13. package/dist/genesis/generated/schemas/StatefulStrategy.json +225 -251
  14. package/dist/genesis/generated/schemas/StatelessStrategy.json +103 -123
  15. package/dist/genesis/generated/types/types.d.ts +174 -86
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/scripts/_lib/config.d.ts +4 -0
  19. package/dist/scripts/_lib/config.js +18 -1
  20. package/dist/scripts/extractSchemas.js +2 -2
  21. package/dist/scripts/generateResourceEnvelopes.js +1 -1
  22. package/dist/scripts/generateSchemaShims.js +21 -0
  23. package/dist/scripts/generateTypes.js +58 -0
  24. package/dist/scripts/rewriteAnchors.js +4 -2
  25. package/package.json +1 -1
  26. /package/dist/genesis/{resourceTypes → generated/resource-type-envelopes}/Genesis.d.ts +0 -0
  27. /package/dist/genesis/{resourceTypes → generated/resource-type-envelopes}/Genesis.js +0 -0
@@ -5,24 +5,24 @@
5
5
  * via the `definition` "BranchStep".
6
6
  */
7
7
  export type BranchStep =
8
- StepKind & {
8
+ {
9
9
  /**
10
10
  * @minItems 1
11
11
  */
12
12
  cases: [Conditional, ...Conditional[]];
13
13
  identity: BranchStepIdentity;
14
14
  kind: "branch";
15
- };
15
+ } & StepKind;
16
16
  /**
17
17
  * This interface was referenced by `GenesisJson`'s JSON-Schema
18
18
  * via the `definition` "WorkStep".
19
19
  */
20
20
  export type WorkStep =
21
- StepKind & {
21
+ {
22
22
  execution: Execution;
23
23
  identity: WorkStepIdentity;
24
24
  kind: "work";
25
- };
25
+ } & StepKind;
26
26
  /**
27
27
  * This interface was referenced by `GenesisJson`'s JSON-Schema
28
28
  * via the `definition` "Execution".
@@ -80,7 +80,6 @@ export type Documented =
80
80
  */
81
81
  export type ExtractionSchema =
82
82
  {
83
- } & {
84
83
  $schema: "https://json-schema.org/draft/2020-12/schema";
85
84
  $defs?: Record<string, unknown>;
86
85
  type: "object";
@@ -90,17 +89,18 @@ export type ExtractionSchema =
90
89
  additionalProperties?: false;
91
90
  unevaluatedProperties?: false;
92
91
  $anchor: string;
92
+ } & {
93
93
  };
94
94
  /**
95
95
  * This interface was referenced by `GenesisJson`'s JSON-Schema
96
96
  * via the `definition` "ForStep".
97
97
  */
98
98
  export type ForStep =
99
- StepKind & {
99
+ {
100
100
  case: Conditional;
101
101
  identity: ForStepIdentity;
102
102
  kind: "for";
103
- };
103
+ } & StepKind;
104
104
  /**
105
105
  * This interface was referenced by `GenesisJson`'s JSON-Schema
106
106
  * via the `definition` "ForStepIdentity".
@@ -116,7 +116,6 @@ export type ForStepIdentity =
116
116
  */
117
117
  export type IdentitySchema =
118
118
  {
119
- } & {
120
119
  $schema?: "https://json-schema.org/draft/2020-12/schema";
121
120
  type: "string" | "number" | "integer" | "boolean";
122
121
  $anchor?: string;
@@ -129,6 +128,7 @@ export type IdentitySchema =
129
128
  maxLength?: number;
130
129
  minLength?: number;
131
130
  pattern?: string;
131
+ } & {
132
132
  };
133
133
  /**
134
134
  * This interface was referenced by `GenesisJson`'s JSON-Schema
@@ -176,7 +176,6 @@ export type JsonData =
176
176
  */
177
177
  export type MeritSchema =
178
178
  {
179
- } & {
180
179
  $schema?: "https://json-schema.org/draft/2020-12/schema";
181
180
  type?: "number" | "integer";
182
181
  $anchor?: string;
@@ -190,6 +189,7 @@ export type MeritSchema =
190
189
  maximum?: number;
191
190
  minimum?: number;
192
191
  multipleOf?: number;
192
+ } & {
193
193
  } & MeritSchema1;
194
194
  export type MeritSchema1 =
195
195
  | {
@@ -206,10 +206,11 @@ export type MeritSchema1 =
206
206
  * via the `definition` "Resource".
207
207
  */
208
208
  export type Resource =
209
- ResourceMetaBase & {
210
- extractedData: {
211
- [k: string]: JsonData;
212
- };
209
+ {
210
+ } & ResourceMetaBase & {
211
+ extractedData: {
212
+ [k: string]: JsonData;
213
+ };
213
214
  };
214
215
  /**
215
216
  * This interface was referenced by `GenesisJson`'s JSON-Schema
@@ -222,15 +223,6 @@ export type ResourceMetaBase =
222
223
  kind: "materialized";
223
224
  } & Timestamp &
224
225
  Path;
225
- /**
226
- * This interface was referenced by `GenesisJson`'s JSON-Schema
227
- * via the `definition` "ResourceBase".
228
- */
229
- export type ResourceBase =
230
- {
231
- identity: ResourceIdentity;
232
- resourceTypeRef: ResourceTypeIdentity;
233
- };
234
226
  /**
235
227
  * This interface was referenced by `GenesisJson`'s JSON-Schema
236
228
  * via the `definition` "ResourceFormat".
@@ -261,7 +253,8 @@ export type ResourceMetaBase1 =
261
253
  * via the `definition` "ResourceMissing".
262
254
  */
263
255
  export type ResourceMissing =
264
- ResourceBase &
256
+ {
257
+ } & ResourceBase &
265
258
  ResourceKind & {
266
259
  kind: "missing";
267
260
  };
@@ -270,7 +263,8 @@ export type ResourceMissing =
270
263
  * via the `definition` "ResourcePotentialInput".
271
264
  */
272
265
  export type ResourcePotentialInput =
273
- ResourceBase &
266
+ {
267
+ } & ResourceBase &
274
268
  CreationContextWrapper &
275
269
  ResourceKind & {
276
270
  kind: "potential-input";
@@ -280,7 +274,8 @@ export type ResourcePotentialInput =
280
274
  * via the `definition` "ResourcePotentialOutput".
281
275
  */
282
276
  export type ResourcePotentialOutput =
283
- ResourceBase &
277
+ {
278
+ } & ResourceBase &
284
279
  CreationContextWrapper &
285
280
  ResourceKind & {
286
281
  kind: "potential-output";
@@ -311,15 +306,6 @@ export type StatefulStrategy =
311
306
  */
312
307
  export type StatefulStrategyIdentity =
313
308
  `STATEFUL_STRATEGY-${string}`;
314
- /**
315
- * This interface was referenced by `GenesisJson`'s JSON-Schema
316
- * via the `definition` "StatelessStrategy".
317
- */
318
- export type StatelessStrategy =
319
- {
320
- identity: StatelessStrategyIdentity;
321
- steps: Step[];
322
- };
323
309
  /**
324
310
  * This interface was referenced by `GenesisJson`'s JSON-Schema
325
311
  * via the `definition` "StatelessStrategyIdentity".
@@ -337,11 +323,11 @@ export type Step =
337
323
  * via the `definition` "WhileStep".
338
324
  */
339
325
  export type WhileStep =
340
- StepKind & {
326
+ {
341
327
  case: Conditional;
342
328
  identity: WhileStepIdentity;
343
329
  kind: "while";
344
- };
330
+ } & StepKind;
345
331
  /**
346
332
  * This interface was referenced by `GenesisJson`'s JSON-Schema
347
333
  * via the `definition` "WhileStepIdentity".
@@ -351,13 +337,6 @@ export type WhileStepIdentity =
351
337
 
352
338
  export interface GenesisJson {
353
339
  }
354
- /**
355
- * This interface was referenced by `GenesisJson`'s JSON-Schema
356
- * via the `definition` "StepKind".
357
- */
358
- export interface StepKind {
359
- kind: "work" | "branch" | "while" | "for";
360
- }
361
340
  /**
362
341
  * This interface was referenced by `GenesisJson`'s JSON-Schema
363
342
  * via the `definition` "Conditional".
@@ -382,6 +361,13 @@ export interface RoleBindings {
382
361
  * via the `definition` "RoleBindingMap".
383
362
  */
384
363
  export type RoleBindingMap = Record<ResourceRoleIdentity, ResourceIdentity>;
364
+ /**
365
+ * This interface was referenced by `GenesisJson`'s JSON-Schema
366
+ * via the `definition` "StepKind".
367
+ */
368
+ export interface StepKind {
369
+ kind: "work" | "branch" | "while" | "for";
370
+ }
385
371
  /**
386
372
  * This interface was referenced by `GenesisJson`'s JSON-Schema
387
373
  * via the `definition` "CreationContext".
@@ -483,6 +469,14 @@ export interface MeritSchemaRef {
483
469
  export interface Path {
484
470
  path: string;
485
471
  }
472
+ /**
473
+ * This interface was referenced by `GenesisJson`'s JSON-Schema
474
+ * via the `definition` "ResourceBase".
475
+ */
476
+ export interface ResourceBase {
477
+ identity: ResourceIdentity;
478
+ resourceTypeRef: ResourceTypeIdentity;
479
+ }
486
480
  /**
487
481
  * This interface was referenced by `GenesisJson`'s JSON-Schema
488
482
  * via the `definition` "ResourceKind".
@@ -504,6 +498,14 @@ export interface Timestamp {
504
498
  export interface RoleBindingsWrapper1 {
505
499
  roleBindings: RoleBindings;
506
500
  }
501
+ /**
502
+ * This interface was referenced by `GenesisJson`'s JSON-Schema
503
+ * via the `definition` "StatelessStrategy".
504
+ */
505
+ export interface StatelessStrategy {
506
+ identity: StatelessStrategyIdentity;
507
+ steps: Step[];
508
+ }
507
509
  /**
508
510
  * This interface was referenced by `GenesisJson`'s JSON-Schema
509
511
  * via the `definition` "StrategyStateWrapper".
@@ -580,7 +582,6 @@ export type Documented =
580
582
  Named & Described;
581
583
  export type ExtractionSchema =
582
584
  {
583
- } & {
584
585
  $schema: "https://json-schema.org/draft/2020-12/schema";
585
586
  $defs?: Record<string, unknown>;
586
587
  type: "object";
@@ -590,6 +591,7 @@ export type ExtractionSchema =
590
591
  additionalProperties?: false;
591
592
  unevaluatedProperties?: false;
592
593
  $anchor: string;
594
+ } & {
593
595
  };
594
596
 
595
597
  export interface Named {
@@ -609,21 +611,16 @@ export type Normalized =
609
611
  } & StrategyStateWrapper;
610
612
  export type StatefulStrategyIdentity =
611
613
  `STATEFUL_STRATEGY-${string}`;
612
- export type StatelessStrategy =
613
- {
614
- identity: StatelessStrategyIdentity;
615
- steps: Step[];
616
- };
617
614
  export type StatelessStrategyIdentity =
618
615
  `STATELESS_STRATEGY-${string}`;
619
616
  export type Step =
620
617
  WorkStep | BranchStep | WhileStep | ForStep;
621
618
  export type WorkStep =
622
- StepKind & {
619
+ {
623
620
  execution: Execution;
624
621
  identity: WorkStepIdentity;
625
622
  kind: "work";
626
- };
623
+ } & StepKind;
627
624
  export type Execution =
628
625
  {
629
626
  identity: ExecutionIdentity;
@@ -638,46 +635,43 @@ export type ResourceIdentity =
638
635
  export type WorkStepIdentity =
639
636
  `WORKSTEP-${string}`;
640
637
  export type BranchStep =
641
- StepKind & {
638
+ {
642
639
  /**
643
640
  * @minItems 1
644
641
  */
645
642
  cases: [Conditional, ...Conditional[]];
646
643
  identity: BranchStepIdentity;
647
644
  kind: "branch";
648
- };
645
+ } & StepKind;
649
646
  export type BranchStepIdentity =
650
647
  `BRANCHSTEP-${string}`;
651
648
  export type WhileStep =
652
- StepKind & {
649
+ {
653
650
  case: Conditional;
654
651
  identity: WhileStepIdentity;
655
652
  kind: "while";
656
- };
653
+ } & StepKind;
657
654
  export type WhileStepIdentity =
658
655
  `WHILESTEP-${string}`;
659
656
  export type ForStep =
660
- StepKind & {
657
+ {
661
658
  case: Conditional;
662
659
  identity: ForStepIdentity;
663
660
  kind: "for";
664
- };
661
+ } & StepKind;
665
662
  export type ForStepIdentity =
666
663
  `FORSTEP-${string}`;
667
664
  export type ResourceMissing =
668
- ResourceBase &
665
+ {
666
+ } & ResourceBase &
669
667
  ResourceKind & {
670
668
  kind: "missing";
671
669
  };
672
- export type ResourceBase =
673
- {
674
- identity: ResourceIdentity;
675
- resourceTypeRef: ResourceTypeIdentity;
676
- };
677
670
  export type ResourceTypeIdentity =
678
671
  `TYPE-${string}`;
679
672
  export type ResourcePotentialInput =
680
- ResourceBase &
673
+ {
674
+ } & ResourceBase &
681
675
  CreationContextWrapper &
682
676
  ResourceKind & {
683
677
  kind: "potential-input";
@@ -685,16 +679,18 @@ export type ResourcePotentialInput =
685
679
  export type ResourceRoleIdentity =
686
680
  `ROLE-${string}`;
687
681
  export type ResourcePotentialOutput =
688
- ResourceBase &
682
+ {
683
+ } & ResourceBase &
689
684
  CreationContextWrapper &
690
685
  ResourceKind & {
691
686
  kind: "potential-output";
692
687
  };
693
688
  export type Resource =
694
- ResourceMetaBase & {
695
- extractedData: {
696
- [k: string]: JsonData;
697
- };
689
+ {
690
+ } & ResourceMetaBase & {
691
+ extractedData: {
692
+ [k: string]: JsonData;
693
+ };
698
694
  };
699
695
  export type ResourceMetaBase =
700
696
  ResourceBase &
@@ -713,8 +709,9 @@ export type JsonData =
713
709
  [k: string]: JsonData;
714
710
  };
715
711
 
716
- export interface StepKind {
717
- kind: "work" | "branch" | "while" | "for";
712
+ export interface StatelessStrategy {
713
+ identity: StatelessStrategyIdentity;
714
+ steps: Step[];
718
715
  }
719
716
  export interface RoleBindingsWrapper {
720
717
  roleBindings: RoleBindings;
@@ -724,6 +721,9 @@ export interface RoleBindings {
724
721
  outputBindingMap: RoleBindingMap;
725
722
  }
726
723
  export type RoleBindingMap = Record<ResourceRoleIdentity, ResourceIdentity>;
724
+ export interface StepKind {
725
+ kind: "work" | "branch" | "while" | "for";
726
+ }
727
727
  export interface Conditional {
728
728
  what: WorkStep;
729
729
  when: WorkStep;
@@ -732,6 +732,10 @@ export interface StrategyStateWrapper {
732
732
  strategyState: StrategyState;
733
733
  }
734
734
  export type StrategyState = Record<ExecutionIdentity, Record<ResourceRoleIdentity, ResourceMissing | ResourcePotentialInput | ResourcePotentialOutput | Resource>>;
735
+ export interface ResourceBase {
736
+ identity: ResourceIdentity;
737
+ resourceTypeRef: ResourceTypeIdentity;
738
+ }
735
739
  export interface ResourceKind {
736
740
  kind: "missing" | "potential-input" | "potential-output" | "materialized";
737
741
  }
@@ -749,75 +753,159 @@ export interface Path {
749
753
  path: string;
750
754
  }
751
755
 
752
- export type Normalized =
753
- {
754
- identity: StatelessStrategyIdentity;
755
- steps: Step[];
756
- };
756
+ /**
757
+ * This interface was referenced by `Normalized`'s JSON-Schema
758
+ * via the `definition` "StatelessStrategyIdentity".
759
+ */
757
760
  export type StatelessStrategyIdentity =
758
761
  `STATELESS_STRATEGY-${string}`;
762
+ /**
763
+ * This interface was referenced by `Normalized`'s JSON-Schema
764
+ * via the `definition` "Step".
765
+ */
759
766
  export type Step =
760
767
  WorkStep | BranchStep | WhileStep | ForStep;
768
+ /**
769
+ * This interface was referenced by `Normalized`'s JSON-Schema
770
+ * via the `definition` "WorkStep".
771
+ */
761
772
  export type WorkStep =
762
- StepKind & {
773
+ {
763
774
  execution: Execution;
764
775
  identity: WorkStepIdentity;
765
776
  kind: "work";
766
- };
777
+ } & StepKind;
778
+ /**
779
+ * This interface was referenced by `Normalized`'s JSON-Schema
780
+ * via the `definition` "Execution".
781
+ */
767
782
  export type Execution =
768
783
  {
769
784
  identity: ExecutionIdentity;
770
785
  jobRef: JobIdentity;
771
786
  } & RoleBindingsWrapper;
787
+ /**
788
+ * This interface was referenced by `Normalized`'s JSON-Schema
789
+ * via the `definition` "ExecutionIdentity".
790
+ */
772
791
  export type ExecutionIdentity =
773
792
  `EXECUTION-${string}`;
793
+ /**
794
+ * This interface was referenced by `Normalized`'s JSON-Schema
795
+ * via the `definition` "JobIdentity".
796
+ */
774
797
  export type JobIdentity =
775
798
  `JOB-${string}`;
799
+ /**
800
+ * This interface was referenced by `Normalized`'s JSON-Schema
801
+ * via the `definition` "ResourceIdentity".
802
+ */
776
803
  export type ResourceIdentity =
777
804
  `RESOURCE-${string}`;
805
+ /**
806
+ * This interface was referenced by `Normalized`'s JSON-Schema
807
+ * via the `definition` "WorkStepIdentity".
808
+ */
778
809
  export type WorkStepIdentity =
779
810
  `WORKSTEP-${string}`;
811
+ /**
812
+ * This interface was referenced by `Normalized`'s JSON-Schema
813
+ * via the `definition` "BranchStep".
814
+ */
780
815
  export type BranchStep =
781
- StepKind & {
816
+ {
782
817
  /**
783
818
  * @minItems 1
784
819
  */
785
820
  cases: [Conditional, ...Conditional[]];
786
821
  identity: BranchStepIdentity;
787
822
  kind: "branch";
788
- };
823
+ } & StepKind;
824
+ /**
825
+ * This interface was referenced by `Normalized`'s JSON-Schema
826
+ * via the `definition` "BranchStepIdentity".
827
+ */
789
828
  export type BranchStepIdentity =
790
829
  `BRANCHSTEP-${string}`;
830
+ /**
831
+ * This interface was referenced by `Normalized`'s JSON-Schema
832
+ * via the `definition` "WhileStep".
833
+ */
791
834
  export type WhileStep =
792
- StepKind & {
835
+ {
793
836
  case: Conditional;
794
837
  identity: WhileStepIdentity;
795
838
  kind: "while";
796
- };
839
+ } & StepKind;
840
+ /**
841
+ * This interface was referenced by `Normalized`'s JSON-Schema
842
+ * via the `definition` "WhileStepIdentity".
843
+ */
797
844
  export type WhileStepIdentity =
798
845
  `WHILESTEP-${string}`;
846
+ /**
847
+ * This interface was referenced by `Normalized`'s JSON-Schema
848
+ * via the `definition` "ForStep".
849
+ */
799
850
  export type ForStep =
800
- StepKind & {
851
+ {
801
852
  case: Conditional;
802
853
  identity: ForStepIdentity;
803
854
  kind: "for";
804
- };
855
+ } & StepKind;
856
+ /**
857
+ * This interface was referenced by `Normalized`'s JSON-Schema
858
+ * via the `definition` "ForStepIdentity".
859
+ */
805
860
  export type ForStepIdentity =
806
861
  `FORSTEP-${string}`;
862
+ /**
863
+ * This interface was referenced by `Normalized`'s JSON-Schema
864
+ * via the `definition` "ResourceRoleIdentity".
865
+ */
866
+ export type ResourceRoleIdentity =
867
+ `ROLE-${string}`;
807
868
 
808
- export interface StepKind {
809
- kind: "work" | "branch" | "while" | "for";
869
+ export interface Normalized {
870
+ identity: StatelessStrategyIdentity;
871
+ steps: Step[];
810
872
  }
811
873
  export interface RoleBindingsWrapper {
812
874
  roleBindings: RoleBindings;
813
875
  }
876
+ /**
877
+ * This interface was referenced by `Normalized`'s JSON-Schema
878
+ * via the `definition` "RoleBindings".
879
+ */
814
880
  export interface RoleBindings {
815
881
  inputBindingMap: RoleBindingMap;
816
882
  outputBindingMap: RoleBindingMap;
817
883
  }
884
+ /**
885
+ * This interface was referenced by `Normalized`'s JSON-Schema
886
+ * via the `definition` "RoleBindingMap".
887
+ */
818
888
  export type RoleBindingMap = Record<ResourceRoleIdentity, ResourceIdentity>;
889
+ /**
890
+ * This interface was referenced by `Normalized`'s JSON-Schema
891
+ * via the `definition` "StepKind".
892
+ */
893
+ export interface StepKind {
894
+ kind: "work" | "branch" | "while" | "for";
895
+ }
896
+ /**
897
+ * This interface was referenced by `Normalized`'s JSON-Schema
898
+ * via the `definition` "Conditional".
899
+ */
819
900
  export interface Conditional {
820
901
  what: WorkStep;
821
902
  when: WorkStep;
822
903
  }
904
+ /**
905
+ * This interface was referenced by `Normalized`'s JSON-Schema
906
+ * via the `definition` "RoleBindingsWrapper".
907
+ */
908
+ export interface RoleBindingsWrapper1 {
909
+ roleBindings: RoleBindings;
910
+ }
823
911
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { default as GenesisSchema } from './genesis/generated/schemas/Genesis.js';
2
- export { default as Genesis } from './genesis/resourceTypes/Genesis.js';
2
+ export { default as GenesisResourceType } from './genesis/generated/resource-type-envelopes/Genesis.js';
3
3
  export { default as JobSchema } from './genesis/generated/schemas/Job.js';
4
4
  export type { Resource_ResourceFormat as Resource_ResourceFormatJson } from './genesis/generated/types/Resource_ResourceFormat.js';
5
5
  export type { Resource_ResourceType as Resource_ResourceTypeJson } from './genesis/generated/types/Resource_ResourceType.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Re-export JSON schemas via .ts shims to avoid .json re-exports in declarations
2
2
  export { default as GenesisSchema } from './genesis/generated/schemas/Genesis.js';
3
- export { default as Genesis } from './genesis/resourceTypes/Genesis.js';
3
+ export { default as GenesisResourceType } from './genesis/generated/resource-type-envelopes/Genesis.js';
4
4
  export { default as JobSchema } from './genesis/generated/schemas/Job.js';
5
5
  // Re-export brand factories so consumers can construct branded identities at runtime.
6
6
  export { unsafeBrand, asResourceTypeIdentity, asResourceRoleIdentity, asExecutionIdentity, asResourceIdentity, asWorkStepIdentity, asBranchStepIdentity, asForStepIdentity, asResourceFormatIdentity, asWhileStepIdentity, asStatelessStrategyIdentity, asStatefulStrategyIdentity, asResourceTypeIdentities, asResourceRoleIdentities, asExecutionIdentities, asResourceIdentities, asWorkStepIdentities, asBranchStepIdentities, asForStepIdentities, asResourceFormatIdentities, asWhileStepIdentities, asStatelessStrategyIdentities, asStatefulStrategyIdentities, } from './scripts/brandFactories.js';
@@ -10,6 +10,7 @@ export declare class SchemaConfig {
10
10
  private readonly root;
11
11
  private readonly sourceDir;
12
12
  private readonly sourceFile;
13
+ private readonly normalizedDir;
13
14
  private readonly outputDir;
14
15
  private readonly typesSrcDir;
15
16
  private readonly typesDistDir;
@@ -20,6 +21,9 @@ export declare class SchemaConfig {
20
21
  getSourceDir(): string;
21
22
  getSourceFile(): string;
22
23
  getSourcePath(): string;
24
+ getNormalizedDir(): string;
25
+ getNormalizedSourceFile(): string;
26
+ getNormalizedSourcePath(): string;
23
27
  getOutputDir(): string;
24
28
  getOutputPath(filename: string): string;
25
29
  getTypesSrcDir(): string;
@@ -18,8 +18,11 @@ export class SchemaConfig {
18
18
  constructor() {
19
19
  // Environment variables with sensible defaults
20
20
  this.root = getEnv('TP_SCHEMA_ROOT', process.cwd());
21
- this.sourceDir = getEnv('TP_SCHEMA_SOURCE_DIR', 'src/genesis/resourceTypes');
21
+ this.sourceDir = getEnv('TP_SCHEMA_SOURCE_DIR', 'src/genesis');
22
22
  this.sourceFile = getEnv('TP_SCHEMA_SOURCE_FILE', 'Genesis.json');
23
+ // Intermediate, generated artifact produced by rewriteAnchors.
24
+ // This should NOT live next to the source-of-truth schemas.
25
+ this.normalizedDir = getEnv('TP_SCHEMA_NORMALIZED_DIR', 'src/genesis/generated/resourceTypes');
23
26
  this.outputDir = getEnv('TP_SCHEMA_OUTPUT_DIR', 'src/genesis/generated/schemas');
24
27
  this.typesSrcDir = getEnv('TP_SCHEMA_TYPES_SRC_DIR', 'src/genesis/generated/types');
25
28
  this.typesDistDir = getEnv('TP_SCHEMA_TYPES_DIST_DIR', 'dist/genesis/generated/types');
@@ -41,6 +44,20 @@ export class SchemaConfig {
41
44
  getSourcePath() {
42
45
  return path.join(this.getSourceDir(), this.sourceFile);
43
46
  }
47
+ getNormalizedDir() {
48
+ return path.isAbsolute(this.normalizedDir)
49
+ ? this.normalizedDir
50
+ : path.join(this.root, this.normalizedDir);
51
+ }
52
+ getNormalizedSourceFile() {
53
+ // We keep the same basename (Genesis.json) in the generated folder.
54
+ // The source-of-truth Genesis.json lives under `TP_SCHEMA_SOURCE_DIR`.
55
+ // The generated/normalized Genesis.json lives under `TP_SCHEMA_NORMALIZED_DIR`.
56
+ return this.sourceFile;
57
+ }
58
+ getNormalizedSourcePath() {
59
+ return path.join(this.getNormalizedDir(), this.getNormalizedSourceFile());
60
+ }
44
61
  getOutputDir() {
45
62
  return path.isAbsolute(this.outputDir)
46
63
  ? this.outputDir
@@ -25,8 +25,8 @@ function parseArgs() {
25
25
  }
26
26
  // Use config defaults if not provided via CLI
27
27
  if (!inPath) {
28
- // Use normalized version with anchor refs rewritten to pointers
29
- inPath = config.getSourcePath().replace('.json', '.normalized.json');
28
+ // Use generated/normalized version with anchor refs rewritten to pointers
29
+ inPath = config.getNormalizedSourcePath();
30
30
  }
31
31
  if (!outPath) {
32
32
  outPath = config.getOutputPath(config.getSourceFile());
@@ -18,7 +18,7 @@ import { getConfig } from './_lib/config.js';
18
18
  async function main() {
19
19
  const config = getConfig();
20
20
  // Use normalized version with anchor refs rewritten to pointers
21
- const genesisSourcePath = config.getSourcePath().replace('.json', '.normalized.json');
21
+ const genesisSourcePath = config.getNormalizedSourcePath();
22
22
  const outputPath = path.join(config.getRoot(), 'src', 'genesis', 'generated', 'resources', 'Genesis.json');
23
23
  if (!fs.existsSync(genesisSourcePath)) {
24
24
  console.error(`Genesis source file not found at ${genesisSourcePath}`);
@@ -18,6 +18,7 @@ async function main() {
18
18
  const config = getConfig();
19
19
  const schemasDir = config.getOutputDir();
20
20
  const resourcesDir = path.join(path.dirname(schemasDir), 'resources');
21
+ const generatedResourceTypesDir = config.getNormalizedDir();
21
22
  // Process schemas directory
22
23
  let totalCount = 0;
23
24
  if (fs.existsSync(schemasDir)) {
@@ -55,6 +56,26 @@ async function main() {
55
56
  else {
56
57
  console.warn(`Resources directory not found at ${resourcesDir}`);
57
58
  }
59
+ // Genesis (normalized) shim
60
+ // We treat the normalized Genesis.json under src/genesis/generated/resourceTypes as the
61
+ // public import target, and generate a shim right next to it.
62
+ try {
63
+ const genesisJsonPath = config.getNormalizedSourcePath();
64
+ if (fs.existsSync(genesisJsonPath)) {
65
+ fs.mkdirSync(generatedResourceTypesDir, { recursive: true });
66
+ const outPath = path.join(generatedResourceTypesDir, 'Genesis.ts');
67
+ const content = `import schema from './Genesis.json' with { type: 'json' };\nexport default schema;\n`;
68
+ fs.writeFileSync(outPath, content, 'utf-8');
69
+ console.log(`Generated Genesis.ts in ${generatedResourceTypesDir}`);
70
+ totalCount++;
71
+ }
72
+ else {
73
+ console.warn(`Genesis source JSON not found at ${genesisJsonPath}; skipping Genesis.ts shim`);
74
+ }
75
+ }
76
+ catch (e) {
77
+ console.warn('Failed to generate Genesis.ts shim:', e);
78
+ }
58
79
  console.log(`Generated ${totalCount} total TypeScript shims`);
59
80
  }
60
81
  main().catch((e) => {