@toolproof-npm/schema 0.1.31 → 0.1.32

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/_lib/test.js CHANGED
@@ -5,15 +5,15 @@ const Job = {
5
5
  uri: 'uri',
6
6
  roles: {
7
7
  inputMap: {
8
- 'RR-1234': {
9
- resourceTypeId: 'RT-1234',
8
+ 'ROLE-1234': {
9
+ resourceTypeId: 'TYPE-1234',
10
10
  name: 'name',
11
11
  description: 'description'
12
12
  }
13
13
  },
14
14
  outputMap: {
15
- 'RR-5678': {
16
- resourceTypeId: 'RT-5678',
15
+ 'ROLE-5678': {
16
+ resourceTypeId: 'TYPE-5678',
17
17
  name: 'name',
18
18
  description: 'description'
19
19
  }
@@ -67,9 +67,9 @@ const jobBeta = {
67
67
  // This checks (no error expected); we're providing all required fields
68
68
  const resourceDataJobAlpha = {
69
69
  id: 'RESOURCE-1',
70
- resourceTypeId: 'RT-ID',
70
+ resourceTypeId: 'TYPE-ID',
71
71
  creationContext: {
72
- resourceRoleId: 'RR-ID',
72
+ resourceRoleId: 'ROLE-ID',
73
73
  executionId: 'EXECUTION-ID',
74
74
  },
75
75
  kind: 'realized',
@@ -81,9 +81,9 @@ const resourceDataJobAlpha = {
81
81
  // This SHOULD fail (missing path) once ResourceData_Job enforces Path strictly.
82
82
  const resourceDataJobAlpha2 = {
83
83
  id: 'RESOURCE-3',
84
- resourceTypeId: 'RT-ID',
84
+ resourceTypeId: 'TYPE-ID',
85
85
  creationContext: {
86
- resourceRoleId: 'RR-ID',
86
+ resourceRoleId: 'ROLE-ID',
87
87
  executionId: 'EXECUTION-ID',
88
88
  },
89
89
  kind: 'realized',
@@ -95,9 +95,9 @@ const resourceDataJobAlpha2 = {
95
95
  // This should fail; we're missing extractedData
96
96
  const resourceDataJobAlpha3 = {
97
97
  id: 'RESOURCE-2',
98
- resourceTypeId: 'RT-ID',
98
+ resourceTypeId: 'TYPE-ID',
99
99
  creationContext: {
100
- resourceRoleId: 'RR-ID',
100
+ resourceRoleId: 'ROLE-ID',
101
101
  executionId: 'EXECUTION-ID',
102
102
  },
103
103
  kind: 'realized',
@@ -108,9 +108,9 @@ const resourceDataJobAlpha3 = {
108
108
  // This SHOULD fail (missing roles.outputMap) once Job's roles is strictly enforced.
109
109
  const resourceDataJobBeta = {
110
110
  id: 'RESOURCE-4',
111
- resourceTypeId: 'RT-ID',
111
+ resourceTypeId: 'TYPE-ID',
112
112
  creationContext: {
113
- resourceRoleId: 'RR-ID',
113
+ resourceRoleId: 'ROLE-ID',
114
114
  executionId: 'EXECUTION-ID',
115
115
  },
116
116
  kind: 'realized',
@@ -632,7 +632,7 @@ export interface RoleBindingsOuter1 {
632
632
  * This interface was referenced by `GenesisJson`'s JSON-Schema
633
633
  * via the `definition` "RoleMap".
634
634
  */
635
- export type RoleMap = Record<ResourceRoleId, RoleLiteral>;
635
+ export type RoleMap = Record<ResourceRoleId, ResourceRoleValue>;
636
636
  /**
637
637
  * This interface was referenced by `GenesisJson`'s JSON-Schema
638
638
  * via the `definition` "RolesInner".
@@ -663,7 +663,7 @@
663
663
  "$schema": "https://json-schema.org/draft/2020-12/schema",
664
664
  "type": "string",
665
665
  "$anchor": "ResourceFormatId",
666
- "pattern": "^RF-.+$"
666
+ "pattern": "^FORMAT-.+$"
667
667
  },
668
668
  "ResourceFormatMeta": {
669
669
  "$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -802,7 +802,7 @@
802
802
  "$schema": "https://json-schema.org/draft/2020-12/schema",
803
803
  "type": "string",
804
804
  "$anchor": "ResourceRoleId",
805
- "pattern": "^RR-.+$"
805
+ "pattern": "^ROLE-.+$"
806
806
  },
807
807
  "ResourceRoleValue": {
808
808
  "$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -858,7 +858,7 @@
858
858
  "$schema": "https://json-schema.org/draft/2020-12/schema",
859
859
  "type": "string",
860
860
  "$anchor": "ResourceTypeId",
861
- "pattern": "^RT-.+$"
861
+ "pattern": "^TYPE-.+$"
862
862
  },
863
863
  "ResourceTypeMeta": {
864
864
  "$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -874,10 +874,10 @@
874
874
  "if": {
875
875
  "properties": {
876
876
  "resourceFormatId": {
877
- "const": "RF-ApplicationJson"
877
+ "const": "FORMAT-ApplicationJson"
878
878
  }
879
879
  },
880
- "$comment": "If resourceFormatId is RF-ApplicationJson, then uri must not be present, but if resourceFormatId is not RF-ApplicationJson, then uri must be present. This is because resources of types with format RF-ApplicationJson are self-contained and do not need an extractor."
880
+ "$comment": "If resourceFormatId is FORMAT-ApplicationJson, then uri must not be present, but if resourceFormatId is not FORMAT-ApplicationJson, then uri must be present. This is because resources of types with format FORMAT-ApplicationJson are self-contained and do not need an extractor."
881
881
  },
882
882
  "then": {
883
883
  "not": {
@@ -149,13 +149,13 @@
149
149
  "$schema": "https://json-schema.org/draft/2020-12/schema",
150
150
  "type": "string",
151
151
  "$anchor": "ResourceRoleId",
152
- "pattern": "^RR-.+$"
152
+ "pattern": "^ROLE-.+$"
153
153
  },
154
154
  "ResourceTypeId": {
155
155
  "$schema": "https://json-schema.org/draft/2020-12/schema",
156
156
  "type": "string",
157
157
  "$anchor": "ResourceTypeId",
158
- "pattern": "^RT-.+$"
158
+ "pattern": "^TYPE-.+$"
159
159
  }
160
160
  }
161
161
  }
@@ -19,13 +19,13 @@ export function unsafeBrand(s) {
19
19
  return s;
20
20
  }
21
21
  // Known patterns from schemas (when available)
22
- const RE_RT_ID = /^RT-.+$/;
22
+ const RE_TYPE_ID = /^TYPE-.+$/;
23
23
  const RE_SIGNATURE_ID = /^SIGNATURE-.+$/;
24
24
  const RE_JOB_ID = /^JOB-.+$/;
25
- const RE_RR_ID = /^RR-.+$/;
25
+ const RE_ROLE_ID = /^ROLE-.+$/;
26
26
  // Factories for each Id-like type
27
- export const asResourceTypeId = makeFactory("ResourceTypeId", RE_RT_ID);
28
- export const asResourceRoleId = makeFactory("ResourceRoleId", RE_RR_ID);
27
+ export const asResourceTypeId = makeFactory("ResourceTypeId", RE_TYPE_ID);
28
+ export const asResourceRoleId = makeFactory("ResourceRoleId", RE_ROLE_ID);
29
29
  // IDs without strict regex patterns in the current schemas: keep unchecked casts.
30
30
  export const asExecutionId = makeFactory("ExecutionId");
31
31
  export const asResourceId = makeFactory("ResourceId");
@@ -185,7 +185,7 @@ async function main() {
185
185
  }
186
186
  });
187
187
  // Remove permissive index signatures that make interfaces open-ended.
188
- // Keep meaningful map-like signatures (e.g., `[k: string]: RoleLiteral`) intact.
188
+ // Keep meaningful map-like signatures (e.g., `[k: string]: ResourceRoleValue`) intact.
189
189
  // Robust single-pass: delete the entire line (with optional trailing newline) where the signature appears.
190
190
  // This avoids introducing extra blank lines while handling CRLF/LF and varying indentation.
191
191
  ts = ts.replace(/^\s*\[k:\s*string\]:\s*unknown;\s*(?:\r?\n)?/gm, '');
@@ -331,7 +331,7 @@ async function main() {
331
331
  });
332
332
  // Post-process map-like interfaces to enforce key constraints via template literal Id types.
333
333
  // Replace index-signature interfaces with Record<IdType, ValueType> so object literal keys are checked.
334
- ts = ts.replace(/export interface RoleMap\s*{[^}]*}/g, 'export type RoleMap = Record<ResourceRoleId, RoleLiteral>;');
334
+ ts = ts.replace(/export interface RoleMap\s*{[^}]*}/g, 'export type RoleMap = Record<ResourceRoleId, ResourceRoleValue>;');
335
335
  ts = ts.replace(/export interface RoleBindingMap\s*{[^}]*}/g, 'export type RoleBindingMap = Record<ResourceRoleId, ResourceId>;');
336
336
  ts = ts.replace(/export interface ResourceMap\s*\{[^}]*\{[^}]*\}[^}]*\}/gs, 'export type ResourceMap = Record<ExecutionId, Record<ResourceRoleId, ResourcePotentialInput | ResourcePotentialOutput | ResourceData>>;');
337
337
  parts.push(ts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolproof-npm/schema",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "JSON schemas and TypeScript types for ToolProof",
5
5
  "keywords": [
6
6
  "toolproof",