@toolproof-npm/schema 0.1.35 → 0.1.36

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.
@@ -28,6 +28,7 @@ export type ExtractionSchemaValue = {
28
28
  }[];
29
29
  properties?: {
30
30
  };
31
+ required?: string[];
31
32
  additionalProperties?: false;
32
33
  unevaluatedProperties?: false;
33
34
  $anchor: string;
@@ -77,11 +77,12 @@ export type ExtractionSchemaValue =
77
77
  } & {
78
78
  $schema: "https://json-schema.org/draft/2020-12/schema";
79
79
  $defs?: {
80
- };
80
+ };
81
81
  type: "object";
82
- allOf?: [{type: "array"; items: {type: "object"}}];
82
+ allOf?: Array<{[k: string]: unknown}>;
83
83
  properties?: {
84
- };
84
+ };
85
+ required?: string[];
85
86
  additionalProperties?: false;
86
87
  unevaluatedProperties?: false;
87
88
  $anchor: string;
@@ -394,7 +395,7 @@ export interface IdentityProp {
394
395
  properties: {
395
396
  identity: IdentityValue;
396
397
  };
397
- required: [{type: "array"; contains: {const: "identity"}; items: {type: "string"}; uniqueItems: true}];
398
+ required?: string[];
398
399
  additionalProperties?: unknown;
399
400
  }
400
401
  /**
@@ -557,11 +558,12 @@ export type ExtractionSchemaValue =
557
558
  } & {
558
559
  $schema: "https://json-schema.org/draft/2020-12/schema";
559
560
  $defs?: {
560
- };
561
+ };
561
562
  type: "object";
562
- allOf?: [{type: "array"; items: {type: "object"}}];
563
+ allOf?: Array<{[k: string]: unknown}>;
563
564
  properties?: {
564
- };
565
+ };
566
+ required?: string[];
565
567
  additionalProperties?: false;
566
568
  unevaluatedProperties?: false;
567
569
  $anchor: string;
@@ -350,6 +350,13 @@
350
350
  "type": {
351
351
  "const": "object"
352
352
  },
353
+ "required": {
354
+ "type": "array",
355
+ "items": {
356
+ "type": "string"
357
+ },
358
+ "uniqueItems": true
359
+ },
353
360
  "properties": {
354
361
  "$schema": "https://json-schema.org/draft/2020-12/schema",
355
362
  "type": "object"
@@ -244,6 +244,13 @@
244
244
  "$schema": "https://json-schema.org/draft/2020-12/schema",
245
245
  "type": "object"
246
246
  },
247
+ "required": {
248
+ "type": "array",
249
+ "items": {
250
+ "type": "string"
251
+ },
252
+ "uniqueItems": true
253
+ },
247
254
  "additionalProperties": {
248
255
  "const": false
249
256
  },
@@ -208,6 +208,13 @@
208
208
  "$schema": "https://json-schema.org/draft/2020-12/schema",
209
209
  "type": "object"
210
210
  },
211
+ "required": {
212
+ "type": "array",
213
+ "items": {
214
+ "type": "string"
215
+ },
216
+ "uniqueItems": true
217
+ },
211
218
  "additionalProperties": {
212
219
  "const": false
213
220
  },
@@ -259,6 +259,13 @@
259
259
  "type": {
260
260
  "const": "object"
261
261
  },
262
+ "required": {
263
+ "type": "array",
264
+ "items": {
265
+ "type": "string"
266
+ },
267
+ "uniqueItems": true
268
+ },
262
269
  "properties": {
263
270
  "$schema": "https://json-schema.org/draft/2020-12/schema",
264
271
  "type": "object"
@@ -235,6 +235,15 @@ async function main() {
235
235
  // Robust single-pass: delete the entire line (with optional trailing newline) where the signature appears.
236
236
  // This avoids introducing extra blank lines while handling CRLF/LF and varying indentation.
237
237
  ts = ts.replace(/^\s*\[k:\s*string\]:\s*unknown;\s*(?:\r?\n)?/gm, '');
238
+ // Fix meta-schema types where json-schema-to-typescript incorrectly interprets
239
+ // schema definitions as literal values. ExtractionSchemaValue describes what
240
+ // an extraction schema looks like, not what the schema meta-properties should be.
241
+ ts = ts.replace(/^(export type ExtractionSchemaValue =[\s\S]*?)(\$defs\?:\s*\{[\s\S]*?};)/gm, '$1$defs?: {\n [k: string]: unknown;\n };');
242
+ ts = ts.replace(/^(export type ExtractionSchemaValue =[\s\S]*?)(properties\?:\s*\{[\s\S]*?};)/gm, '$1properties?: {\n [k: string]: unknown;\n };');
243
+ ts = ts.replace(/^(export type ExtractionSchemaValue =[\s\S]*?)(allOf\?:\s*\[\{type:\s*"array";\s*items:\s*\{type:\s*"object"\}\}\];)/gm, '$1allOf?: Array<{[k: string]: unknown}>;');
244
+ ts = ts.replace(/^(export type ExtractionSchemaValue =[\s\S]*?)(required\?:\s*\[\{type:\s*"array";\s*items:\s*\{type:\s*"string"\};\s*uniqueItems:\s*true\}\];)/gm, '$1required?: string[];');
245
+ // Similarly fix IdentityProp which has the same issue
246
+ ts = ts.replace(/^(export interface IdentityProp[\s\S]*?)(required:\s*\[\{type:\s*"array";\s*contains:\s*\{const:\s*"identity"\};\s*items:\s*\{type:\s*"string"\};\s*uniqueItems:\s*true\}\];)/gm, '$1required?: string[];');
238
247
  // Prune verbose type/interface names produced from absolute $id URLs.
239
248
  // Deterministic pruning based on original $id -> baseName map
240
249
  // This avoids heuristic truncation that dropped prefixes like Resource / Workflow.
package/package.json CHANGED
@@ -1,51 +1,56 @@
1
- {
2
- "name": "@toolproof-npm/schema",
3
- "version": "0.1.35",
4
- "description": "JSON schemas and TypeScript types for ToolProof",
5
- "keywords": ["toolproof", "schemas", "json-schema", "typescript"],
6
- "author": "ToolProof Team",
7
- "license": "MIT",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/ToolProof/core.git",
11
- "directory": "packages/_schemas"
12
- },
13
- "homepage": "https://github.com/ToolProof/core#readme",
14
- "bugs": {
15
- "url": "https://github.com/ToolProof/core/issues"
16
- },
17
- "type": "module",
18
- "main": "dist/index.js",
19
- "types": "dist/index.d.ts",
20
- "exports": {
21
- ".": {
22
- "import": "./dist/index.js",
23
- "types": "./dist/index.d.ts"
24
- }
25
- },
26
- "scripts": {
27
- "build": "tsc -b",
28
- "build:scripts": "tsc -p tsconfig.scripts.json",
29
- "rewriteAnchors": "node ./dist/scripts/rewriteAnchors.js",
30
- "extractSchemas": "node ./dist/scripts/extractSchemas.js",
31
- "extractSubschema": "node ./dist/scripts/extractSubschemaWithDefs.js",
32
- "generateTypes": "node ./dist/scripts/generateTypes.js",
33
- "generateResourceTypeType": "node ./dist/scripts/generateResourceTypeType.js",
34
- "generateResourceEnvelopes": "node ./dist/scripts/generateResourceEnvelopes.js",
35
- "generateSchemaShims": "node ./dist/scripts/generateSchemaShims.js",
36
- "update": "rimraf /s /q dist && pnpm run build:scripts && pnpm run rewriteAnchors && pnpm run generateResourceEnvelopes && pnpm run extractSchemas && pnpm run extractSubschema -- --name Job && pnpm run extractSubschema -- --name ResourceFormat && pnpm run extractSubschema -- --name ResourceType && pnpm run extractSubschema -- --name StatelessStrategy && pnpm run extractSubschema -- --name StatefulStrategy && pnpm run generateSchemaShims && pnpm run generateTypes && pnpm run generateResourceTypeType -- --name Job && pnpm run generateResourceTypeType -- --name ResourceFormat && pnpm run generateResourceTypeType -- --name ResourceType && pnpm run generateResourceTypeType -- --name StatelessStrategy && pnpm run build"
37
- },
38
- "files": [
39
- "dist",
40
- "README.md"
41
- ],
42
- "devDependencies": {
43
- "@apidevtools/json-schema-ref-parser": "^14.2.1",
44
- "@types/node": "^20.8.1",
45
- "ajv-cli": "^5.0.0",
46
- "ajv-formats": "^3.0.1",
47
- "json-schema-to-typescript": "^15.0.4",
48
- "rimraf": "^5.0.0",
49
- "typescript": "^5.0.0"
50
- }
1
+ {
2
+ "name": "@toolproof-npm/schema",
3
+ "version": "0.1.36",
4
+ "description": "JSON schemas and TypeScript types for ToolProof",
5
+ "keywords": [
6
+ "toolproof",
7
+ "schemas",
8
+ "json-schema",
9
+ "typescript"
10
+ ],
11
+ "author": "ToolProof Team",
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/ToolProof/core.git",
16
+ "directory": "packages/_schemas"
17
+ },
18
+ "homepage": "https://github.com/ToolProof/core#readme",
19
+ "bugs": {
20
+ "url": "https://github.com/ToolProof/core/issues"
21
+ },
22
+ "type": "module",
23
+ "main": "dist/index.js",
24
+ "types": "dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "import": "./dist/index.js",
28
+ "types": "./dist/index.d.ts"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "README.md"
34
+ ],
35
+ "devDependencies": {
36
+ "@apidevtools/json-schema-ref-parser": "^14.2.1",
37
+ "@types/node": "^20.8.1",
38
+ "ajv-cli": "^5.0.0",
39
+ "ajv-formats": "^3.0.1",
40
+ "json-schema-to-typescript": "^15.0.4",
41
+ "rimraf": "^5.0.0",
42
+ "typescript": "^5.0.0"
43
+ },
44
+ "scripts": {
45
+ "build": "tsc -b",
46
+ "build:scripts": "tsc -p tsconfig.scripts.json",
47
+ "rewriteAnchors": "node ./dist/scripts/rewriteAnchors.js",
48
+ "extractSchemas": "node ./dist/scripts/extractSchemas.js",
49
+ "extractSubschema": "node ./dist/scripts/extractSubschemaWithDefs.js",
50
+ "generateTypes": "node ./dist/scripts/generateTypes.js",
51
+ "generateResourceTypeType": "node ./dist/scripts/generateResourceTypeType.js",
52
+ "generateResourceEnvelopes": "node ./dist/scripts/generateResourceEnvelopes.js",
53
+ "generateSchemaShims": "node ./dist/scripts/generateSchemaShims.js",
54
+ "update": "rimraf /s /q dist && pnpm run build:scripts && pnpm run rewriteAnchors && pnpm run generateResourceEnvelopes && pnpm run extractSchemas && pnpm run extractSubschema -- --name Job && pnpm run extractSubschema -- --name ResourceFormat && pnpm run extractSubschema -- --name ResourceType && pnpm run extractSubschema -- --name StatelessStrategy && pnpm run extractSubschema -- --name StatefulStrategy && pnpm run generateSchemaShims && pnpm run generateTypes && pnpm run generateResourceTypeType -- --name Job && pnpm run generateResourceTypeType -- --name ResourceFormat && pnpm run generateResourceTypeType -- --name ResourceType && pnpm run generateResourceTypeType -- --name StatelessStrategy && pnpm run build"
55
+ }
51
56
  }