@powerlines/schema 0.11.28 → 0.11.37

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 (82) hide show
  1. package/dist/bundle.cjs +34 -20
  2. package/dist/bundle.d.cts +3 -3
  3. package/dist/bundle.d.cts.map +1 -1
  4. package/dist/bundle.d.mts +3 -3
  5. package/dist/bundle.d.mts.map +1 -1
  6. package/dist/bundle.mjs +35 -21
  7. package/dist/bundle.mjs.map +1 -1
  8. package/dist/codegen.cjs +55 -8
  9. package/dist/codegen.d.cts +12 -6
  10. package/dist/codegen.d.cts.map +1 -1
  11. package/dist/codegen.d.mts +12 -6
  12. package/dist/codegen.d.mts.map +1 -1
  13. package/dist/codegen.mjs +52 -8
  14. package/dist/codegen.mjs.map +1 -1
  15. package/dist/constants.cjs +42 -0
  16. package/dist/constants.d.cts +15 -0
  17. package/dist/constants.d.cts.map +1 -0
  18. package/dist/constants.d.mts +15 -0
  19. package/dist/constants.d.mts.map +1 -0
  20. package/dist/constants.mjs +39 -0
  21. package/dist/constants.mjs.map +1 -0
  22. package/dist/extract.cjs +144 -95
  23. package/dist/extract.d.cts +34 -69
  24. package/dist/extract.d.cts.map +1 -1
  25. package/dist/extract.d.mts +34 -69
  26. package/dist/extract.d.mts.map +1 -1
  27. package/dist/extract.mjs +144 -95
  28. package/dist/extract.mjs.map +1 -1
  29. package/dist/helpers.cjs +87 -0
  30. package/dist/helpers.d.cts +48 -0
  31. package/dist/helpers.d.cts.map +1 -0
  32. package/dist/helpers.d.mts +48 -0
  33. package/dist/helpers.d.mts.map +1 -0
  34. package/dist/helpers.mjs +84 -0
  35. package/dist/helpers.mjs.map +1 -0
  36. package/dist/index.cjs +29 -5
  37. package/dist/index.d.cts +8 -5
  38. package/dist/index.d.mts +8 -5
  39. package/dist/index.mjs +7 -4
  40. package/dist/metadata.cjs +80 -0
  41. package/dist/metadata.d.cts +52 -0
  42. package/dist/metadata.d.cts.map +1 -0
  43. package/dist/metadata.d.mts +52 -0
  44. package/dist/metadata.d.mts.map +1 -0
  45. package/dist/metadata.mjs +76 -0
  46. package/dist/metadata.mjs.map +1 -0
  47. package/dist/persistence.cjs +75 -0
  48. package/dist/persistence.d.cts +47 -0
  49. package/dist/persistence.d.cts.map +1 -0
  50. package/dist/persistence.d.mts +47 -0
  51. package/dist/persistence.d.mts.map +1 -0
  52. package/dist/persistence.mjs +71 -0
  53. package/dist/persistence.mjs.map +1 -0
  54. package/dist/reflection.cjs +292 -299
  55. package/dist/reflection.d.cts +3 -16
  56. package/dist/reflection.d.cts.map +1 -1
  57. package/dist/reflection.d.mts +3 -16
  58. package/dist/reflection.d.mts.map +1 -1
  59. package/dist/reflection.mjs +291 -299
  60. package/dist/reflection.mjs.map +1 -1
  61. package/dist/resolve.cjs +7 -7
  62. package/dist/resolve.mjs +7 -7
  63. package/dist/resolve.mjs.map +1 -1
  64. package/dist/type-checks.cjs +126 -25
  65. package/dist/type-checks.d.cts +45 -23
  66. package/dist/type-checks.d.cts.map +1 -1
  67. package/dist/type-checks.d.mts +45 -23
  68. package/dist/type-checks.d.mts.map +1 -1
  69. package/dist/type-checks.mjs +125 -25
  70. package/dist/type-checks.mjs.map +1 -1
  71. package/dist/types.d.cts +237 -95
  72. package/dist/types.d.cts.map +1 -1
  73. package/dist/types.d.mts +237 -95
  74. package/dist/types.d.mts.map +1 -1
  75. package/package.json +24 -8
  76. package/dist/jtd.cjs +0 -385
  77. package/dist/jtd.d.cts +0 -15
  78. package/dist/jtd.d.cts.map +0 -1
  79. package/dist/jtd.d.mts +0 -15
  80. package/dist/jtd.d.mts.map +0 -1
  81. package/dist/jtd.mjs +0 -384
  82. package/dist/jtd.mjs.map +0 -1
@@ -1,24 +1,11 @@
1
- import { JTDSchemaType, SchemaMetadata } from "./types.cjs";
1
+ import { JsonSchema } from "./types.cjs";
2
2
  import { Type } from "@powerlines/deepkit/vendor/type";
3
3
 
4
4
  //#region src/reflection.d.ts
5
5
  /**
6
- * Converts a Deepkit type reflection into a JSON Type Definition (RFC 8927) form suitable for AJV's JTD validator.
7
- *
8
- * @remarks
9
- * Some TypeScript constructs have no direct JTD equivalent and are handled with the closest available form:
10
- *
11
- * - `null` and `undefined` become the empty JTD form with `nullable: true`.
12
- * - Unions of primitives that cannot be expressed as a JTD enum collapse to the empty form (which validates any value).
13
- * - String/number/bigint literal unions are emitted as a JTD enum (non-string members are stringified, as JTD requires string enum members).
14
- * - Tuples are emitted as a JTD elements form whose element schema is the single tuple member type, or the empty schema for mixed tuples.
15
- * - `Date` is emitted as `{ type: "timestamp" }`.
16
- * - Discriminated unions of object literals (a shared string-literal tag property) are emitted as a JTD discriminator form.
17
- *
18
- * @param reflection - The Deepkit type reflection to convert.
19
- * @returns The corresponding JTD form, or `undefined` if the type cannot be represented.
6
+ * Converts a Deepkit type reflection into a JSON Schema (draft-07) fragment.
20
7
  */
21
- declare function reflectionToJsonSchema<TMetadata extends Partial<SchemaMetadata> = Partial<SchemaMetadata>>(reflection: Type): JTDSchemaType<TMetadata> | undefined;
8
+ declare function reflectionToJsonSchema<T = unknown>(reflection: Type): JsonSchema<T> | undefined;
22
9
  //#endregion
23
10
  export { reflectionToJsonSchema };
24
11
  //# sourceMappingURL=reflection.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reflection.d.cts","names":[],"sources":["../src/reflection.ts"],"mappings":";;;;;;AA2FA;;;;;;;;;;;;;;iBAAgB,sBAAA,mBACI,OAAA,CAAQ,cAAA,IAAkB,OAAA,CAAQ,cAAA,EAAA,CACpD,UAAA,EAAY,IAAA,GAAO,aAAA,CAAc,SAAA"}
1
+ {"version":3,"file":"reflection.d.cts","names":[],"sources":["../src/reflection.ts"],"mappings":";;;;;;AAsJA;iBAAgB,sBAAA,aAAA,CACd,UAAA,EAAY,IAAA,GACX,UAAA,CAAW,CAAA"}
@@ -1,24 +1,11 @@
1
- import { JTDSchemaType, SchemaMetadata } from "./types.mjs";
1
+ import { JsonSchema } from "./types.mjs";
2
2
  import { Type } from "@powerlines/deepkit/vendor/type";
3
3
 
4
4
  //#region src/reflection.d.ts
5
5
  /**
6
- * Converts a Deepkit type reflection into a JSON Type Definition (RFC 8927) form suitable for AJV's JTD validator.
7
- *
8
- * @remarks
9
- * Some TypeScript constructs have no direct JTD equivalent and are handled with the closest available form:
10
- *
11
- * - `null` and `undefined` become the empty JTD form with `nullable: true`.
12
- * - Unions of primitives that cannot be expressed as a JTD enum collapse to the empty form (which validates any value).
13
- * - String/number/bigint literal unions are emitted as a JTD enum (non-string members are stringified, as JTD requires string enum members).
14
- * - Tuples are emitted as a JTD elements form whose element schema is the single tuple member type, or the empty schema for mixed tuples.
15
- * - `Date` is emitted as `{ type: "timestamp" }`.
16
- * - Discriminated unions of object literals (a shared string-literal tag property) are emitted as a JTD discriminator form.
17
- *
18
- * @param reflection - The Deepkit type reflection to convert.
19
- * @returns The corresponding JTD form, or `undefined` if the type cannot be represented.
6
+ * Converts a Deepkit type reflection into a JSON Schema (draft-07) fragment.
20
7
  */
21
- declare function reflectionToJsonSchema<TMetadata extends Partial<SchemaMetadata> = Partial<SchemaMetadata>>(reflection: Type): JTDSchemaType<TMetadata> | undefined;
8
+ declare function reflectionToJsonSchema<T = unknown>(reflection: Type): JsonSchema<T> | undefined;
22
9
  //#endregion
23
10
  export { reflectionToJsonSchema };
24
11
  //# sourceMappingURL=reflection.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reflection.d.mts","names":[],"sources":["../src/reflection.ts"],"mappings":";;;;;;AA2FA;;;;;;;;;;;;;;iBAAgB,sBAAA,mBACI,OAAA,CAAQ,cAAA,IAAkB,OAAA,CAAQ,cAAA,EAAA,CACpD,UAAA,EAAY,IAAA,GAAO,aAAA,CAAc,SAAA"}
1
+ {"version":3,"file":"reflection.d.mts","names":[],"sources":["../src/reflection.ts"],"mappings":";;;;;;AAsJA;iBAAgB,sBAAA,aAAA,CACd,UAAA,EAAY,IAAA,GACX,UAAA,CAAW,CAAA"}