@stryke/json 0.9.43 → 0.10.0

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 (201) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/code-frames-BMkA9i6j.d.mts +17 -0
  3. package/dist/code-frames-BMkA9i6j.d.mts.map +1 -0
  4. package/dist/code-frames-BUtrssZ5.d.cts +17 -0
  5. package/dist/code-frames-BUtrssZ5.d.cts.map +1 -0
  6. package/dist/code-frames-Cv8r5tSN.cjs +82 -0
  7. package/dist/code-frames-DISWdYL6.mjs +77 -0
  8. package/dist/code-frames-DISWdYL6.mjs.map +1 -0
  9. package/dist/find-reference-BCg3dQx1.cjs +157 -0
  10. package/dist/find-reference-C-YleCds.d.cts +52 -0
  11. package/dist/find-reference-C-YleCds.d.cts.map +1 -0
  12. package/dist/find-reference-b7rRdLFx.d.mts +52 -0
  13. package/dist/find-reference-b7rRdLFx.d.mts.map +1 -0
  14. package/dist/find-reference-woYMiWzN.mjs +135 -0
  15. package/dist/find-reference-woYMiWzN.mjs.map +1 -0
  16. package/dist/index-B_e8BwCm.d.cts +1 -0
  17. package/dist/index-CDAfh8Ew.d.cts +1 -0
  18. package/dist/index-DwO9IdNa.d.mts +1 -0
  19. package/dist/index-VWno75SQ.d.mts +1 -0
  20. package/dist/index.cjs +32 -14
  21. package/dist/index.d.cts +11 -8
  22. package/dist/index.d.mts +12 -9
  23. package/dist/index.mjs +13 -8
  24. package/dist/is-number-BIwzZzyi.mjs +31 -0
  25. package/dist/is-number-BIwzZzyi.mjs.map +1 -0
  26. package/dist/is-number-c5xguIbS.cjs +42 -0
  27. package/dist/{type-checks/src/is-plain-object.mjs → is-object-BpfmzHWa.mjs} +19 -3
  28. package/dist/is-object-BpfmzHWa.mjs.map +1 -0
  29. package/dist/{type-checks/src/is-plain-object.cjs → is-object-umGh91v1.cjs} +24 -3
  30. package/dist/{type-checks/src/is-string.mjs → is-string-C2RK4Gjs.cjs} +7 -2
  31. package/dist/{type-checks/src/is-string.cjs → is-string-CLiBUSKV.mjs} +2 -2
  32. package/dist/is-string-CLiBUSKV.mjs.map +1 -0
  33. package/dist/{type-checks/src/is-undefined.cjs → is-undefined-CmyJWYGD.mjs} +2 -2
  34. package/dist/is-undefined-CmyJWYGD.mjs.map +1 -0
  35. package/dist/{type-checks/src/is-undefined.mjs → is-undefined-CnI0qe-z.cjs} +7 -2
  36. package/dist/parse-BGlhbY16.d.cts +9 -0
  37. package/dist/parse-BGlhbY16.d.cts.map +1 -0
  38. package/dist/parse-Crgv3Nl1.mjs +81 -0
  39. package/dist/parse-Crgv3Nl1.mjs.map +1 -0
  40. package/dist/parse-DZfi3d96.d.cts +51 -0
  41. package/dist/parse-DZfi3d96.d.cts.map +1 -0
  42. package/dist/parse-DgYW5BBj.d.mts +9 -0
  43. package/dist/parse-DgYW5BBj.d.mts.map +1 -0
  44. package/dist/parse-KiRakdIR.cjs +127 -0
  45. package/dist/parse-ZRTh45ZI.d.mts +51 -0
  46. package/dist/parse-ZRTh45ZI.d.mts.map +1 -0
  47. package/dist/parse-error-7K8s4vWf.d.cts +15 -0
  48. package/dist/parse-error-7K8s4vWf.d.cts.map +1 -0
  49. package/dist/parse-error-C3Qmubee.mjs +34 -0
  50. package/dist/parse-error-C3Qmubee.mjs.map +1 -0
  51. package/dist/parse-error-DY_MelEh.d.mts +15 -0
  52. package/dist/parse-error-DY_MelEh.d.mts.map +1 -0
  53. package/dist/parse-error-Dzwg4sdE.cjs +39 -0
  54. package/dist/parse-obdkJfj5.mjs +52 -0
  55. package/dist/parse-obdkJfj5.mjs.map +1 -0
  56. package/dist/parse-wxSDzBPf.cjs +62 -0
  57. package/dist/pointer/find-reference.cjs +5 -65
  58. package/dist/pointer/find-reference.d.cts +2 -52
  59. package/dist/pointer/find-reference.d.mts +2 -52
  60. package/dist/pointer/find-reference.mjs +2 -63
  61. package/dist/pointer/index.cjs +15 -14
  62. package/dist/pointer/index.d.cts +2 -2
  63. package/dist/pointer/index.d.mts +2 -2
  64. package/dist/pointer/index.mjs +3 -2
  65. package/dist/pointer/parse.cjs +9 -86
  66. package/dist/pointer/parse.d.cts +2 -44
  67. package/dist/pointer/parse.d.mts +2 -44
  68. package/dist/pointer/parse.mjs +2 -80
  69. package/dist/pointer-Cc7IR0Bj.cjs +0 -0
  70. package/dist/pointer-CiTXvh1G.mjs +0 -0
  71. package/dist/schema-B1RVJHzJ.d.cts +7 -0
  72. package/dist/schema-B1RVJHzJ.d.cts.map +1 -0
  73. package/dist/schema-CfhPLy30.mjs +9 -0
  74. package/dist/schema-CfhPLy30.mjs.map +1 -0
  75. package/dist/schema-D5Aqvh2i.cjs +14 -0
  76. package/dist/schema-ai_NU-JC.d.mts +7 -0
  77. package/dist/schema-ai_NU-JC.d.mts.map +1 -0
  78. package/dist/schema.cjs +3 -0
  79. package/dist/schema.d.cts +2 -0
  80. package/dist/schema.d.mts +3 -0
  81. package/dist/schema.mjs +3 -0
  82. package/dist/storm-json-6WpS7qnH.cjs +154 -0
  83. package/dist/storm-json-AaFeOao2.d.cts +70 -0
  84. package/dist/storm-json-AaFeOao2.d.cts.map +1 -0
  85. package/dist/storm-json-BvRkzAlR.d.mts +70 -0
  86. package/dist/storm-json-BvRkzAlR.d.mts.map +1 -0
  87. package/dist/storm-json-Cy3PuAhj.mjs +116 -0
  88. package/dist/storm-json-Cy3PuAhj.mjs.map +1 -0
  89. package/dist/storm-json.cjs +3 -116
  90. package/dist/storm-json.d.cts +2 -70
  91. package/dist/storm-json.d.mts +3 -70
  92. package/dist/storm-json.mjs +3 -115
  93. package/dist/stringify-B6iAeg0u.d.mts +13 -0
  94. package/dist/stringify-B6iAeg0u.d.mts.map +1 -0
  95. package/dist/stringify-Bc8OkhIr.d.cts +13 -0
  96. package/dist/stringify-Bc8OkhIr.d.cts.map +1 -0
  97. package/dist/stringify-D5baUfEe.mjs +68 -0
  98. package/dist/stringify-D5baUfEe.mjs.map +1 -0
  99. package/dist/stringify-DEw3S4_Z.cjs +78 -0
  100. package/dist/strip-comments-Bg3R_Y4S.d.mts +11 -0
  101. package/dist/strip-comments-Bg3R_Y4S.d.mts.map +1 -0
  102. package/dist/strip-comments-CMaAgTqz.mjs +89 -0
  103. package/dist/strip-comments-CMaAgTqz.mjs.map +1 -0
  104. package/dist/strip-comments-CtFoX0xG.cjs +94 -0
  105. package/dist/strip-comments-Cz_Wc25t.d.cts +11 -0
  106. package/dist/strip-comments-Cz_Wc25t.d.cts.map +1 -0
  107. package/dist/types-BUeTTE_U.d.cts +222 -0
  108. package/dist/types-BUeTTE_U.d.cts.map +1 -0
  109. package/dist/types-C_KlcCNw.d.mts +222 -0
  110. package/dist/types-C_KlcCNw.d.mts.map +1 -0
  111. package/dist/types.d.cts +2 -69
  112. package/dist/types.d.mts +2 -69
  113. package/dist/types.mjs +0 -1
  114. package/dist/utils/code-frames.cjs +2 -76
  115. package/dist/utils/code-frames.d.cts +2 -17
  116. package/dist/utils/code-frames.d.mts +2 -17
  117. package/dist/utils/code-frames.mjs +2 -76
  118. package/dist/utils/index.cjs +13 -12
  119. package/dist/utils/index.d.cts +5 -5
  120. package/dist/utils/index.d.mts +6 -5
  121. package/dist/utils/index.mjs +6 -5
  122. package/dist/utils/parse-error.cjs +2 -33
  123. package/dist/utils/parse-error.d.cts +2 -15
  124. package/dist/utils/parse-error.d.mts +2 -15
  125. package/dist/utils/parse-error.mjs +2 -33
  126. package/dist/utils/parse.cjs +3 -51
  127. package/dist/utils/parse.d.cts +2 -9
  128. package/dist/utils/parse.d.mts +2 -9
  129. package/dist/utils/parse.mjs +2 -51
  130. package/dist/utils/stringify.cjs +3 -67
  131. package/dist/utils/stringify.d.cts +2 -13
  132. package/dist/utils/stringify.d.mts +2 -13
  133. package/dist/utils/stringify.mjs +2 -67
  134. package/dist/utils/strip-comments.cjs +2 -85
  135. package/dist/utils/strip-comments.d.cts +2 -11
  136. package/dist/utils/strip-comments.d.mts +2 -11
  137. package/dist/utils/strip-comments.mjs +2 -86
  138. package/dist/utils-CVcIdLuL.mjs +0 -0
  139. package/dist/utils-Cz3OCwUK.cjs +0 -0
  140. package/package.json +8 -3
  141. package/dist/_virtual/rolldown_runtime.cjs +0 -29
  142. package/dist/pointer/find-reference.d.cts.map +0 -1
  143. package/dist/pointer/find-reference.d.mts.map +0 -1
  144. package/dist/pointer/find-reference.mjs.map +0 -1
  145. package/dist/pointer/parse.d.cts.map +0 -1
  146. package/dist/pointer/parse.d.mts.map +0 -1
  147. package/dist/pointer/parse.mjs.map +0 -1
  148. package/dist/storm-json.d.cts.map +0 -1
  149. package/dist/storm-json.d.mts.map +0 -1
  150. package/dist/storm-json.mjs.map +0 -1
  151. package/dist/type-checks/src/get-object-tag.cjs +0 -15
  152. package/dist/type-checks/src/get-object-tag.mjs +0 -15
  153. package/dist/type-checks/src/get-object-tag.mjs.map +0 -1
  154. package/dist/type-checks/src/is-empty.cjs +0 -20
  155. package/dist/type-checks/src/is-empty.mjs +0 -21
  156. package/dist/type-checks/src/is-empty.mjs.map +0 -1
  157. package/dist/type-checks/src/is-non-null-object.cjs +0 -16
  158. package/dist/type-checks/src/is-non-null-object.mjs +0 -17
  159. package/dist/type-checks/src/is-non-null-object.mjs.map +0 -1
  160. package/dist/type-checks/src/is-null.cjs +0 -12
  161. package/dist/type-checks/src/is-null.mjs +0 -12
  162. package/dist/type-checks/src/is-null.mjs.map +0 -1
  163. package/dist/type-checks/src/is-number.cjs +0 -18
  164. package/dist/type-checks/src/is-number.mjs +0 -18
  165. package/dist/type-checks/src/is-number.mjs.map +0 -1
  166. package/dist/type-checks/src/is-object.cjs +0 -19
  167. package/dist/type-checks/src/is-object.mjs +0 -20
  168. package/dist/type-checks/src/is-object.mjs.map +0 -1
  169. package/dist/type-checks/src/is-plain-object.mjs.map +0 -1
  170. package/dist/type-checks/src/is-set-object.cjs +0 -19
  171. package/dist/type-checks/src/is-set-object.mjs +0 -20
  172. package/dist/type-checks/src/is-set-object.mjs.map +0 -1
  173. package/dist/type-checks/src/is-set.cjs +0 -19
  174. package/dist/type-checks/src/is-set.mjs +0 -20
  175. package/dist/type-checks/src/is-set.mjs.map +0 -1
  176. package/dist/type-checks/src/is-string.mjs.map +0 -1
  177. package/dist/type-checks/src/is-undefined.mjs.map +0 -1
  178. package/dist/types/src/base.cjs +0 -6
  179. package/dist/types/src/base.mjs +0 -6
  180. package/dist/types/src/base.mjs.map +0 -1
  181. package/dist/types/src/json.d.cts +0 -12
  182. package/dist/types/src/json.d.cts.map +0 -1
  183. package/dist/types/src/json.d.mts +0 -12
  184. package/dist/types/src/json.d.mts.map +0 -1
  185. package/dist/types.d.cts.map +0 -1
  186. package/dist/types.d.mts.map +0 -1
  187. package/dist/utils/code-frames.d.cts.map +0 -1
  188. package/dist/utils/code-frames.d.mts.map +0 -1
  189. package/dist/utils/code-frames.mjs.map +0 -1
  190. package/dist/utils/parse-error.d.cts.map +0 -1
  191. package/dist/utils/parse-error.d.mts.map +0 -1
  192. package/dist/utils/parse-error.mjs.map +0 -1
  193. package/dist/utils/parse.d.cts.map +0 -1
  194. package/dist/utils/parse.d.mts.map +0 -1
  195. package/dist/utils/parse.mjs.map +0 -1
  196. package/dist/utils/stringify.d.cts.map +0 -1
  197. package/dist/utils/stringify.d.mts.map +0 -1
  198. package/dist/utils/stringify.mjs.map +0 -1
  199. package/dist/utils/strip-comments.d.cts.map +0 -1
  200. package/dist/utils/strip-comments.d.mts.map +0 -1
  201. package/dist/utils/strip-comments.mjs.map +0 -1
@@ -0,0 +1,222 @@
1
+ import { ParseOptions } from "jsonc-parser";
2
+
3
+ //#region src/types.d.ts
4
+ type PrimitiveJsonValue = string | number | boolean | undefined | null;
5
+ interface Class {
6
+ new (...args: any[]): any;
7
+ }
8
+ type JsonValue = PrimitiveJsonValue | JsonArray | JsonObject;
9
+ type JsonArray = Array<JsonValue>;
10
+ interface JsonObject {
11
+ [key: string]: JsonValue;
12
+ }
13
+ type ClassInstance = any;
14
+ type SerializableJsonValue = symbol | Set<JsonValue> | Map<JsonValue, JsonValue> | undefined | bigint | Date | ClassInstance | RegExp;
15
+ type Tree<T> = InnerNode<T> | Leaf<T>;
16
+ type Leaf<T> = [T];
17
+ type InnerNode<T> = [T, Record<string, Tree<T>>];
18
+ type PrimitiveTypeAnnotation = "number" | "undefined" | "bigint";
19
+ type LeafTypeAnnotation = PrimitiveTypeAnnotation | "regexp" | "Date" | "Error" | "URL";
20
+ type TypedArrayAnnotation = ["typed-array", string];
21
+ type ClassTypeAnnotation = ["class", string];
22
+ type SymbolTypeAnnotation = ["symbol", string];
23
+ type CustomTypeAnnotation = ["custom", string];
24
+ type SimpleTypeAnnotation = LeafTypeAnnotation | "map" | "set";
25
+ type CompositeTypeAnnotation = TypedArrayAnnotation | ClassTypeAnnotation | SymbolTypeAnnotation | CustomTypeAnnotation;
26
+ type TypeAnnotation = SimpleTypeAnnotation | CompositeTypeAnnotation;
27
+ interface JsonParseOptions extends ParseOptions {
28
+ /**
29
+ * Expect JSON with javascript-style
30
+ *
31
+ * @defaultValue false
32
+ */
33
+ expectComments?: boolean;
34
+ /**
35
+ * Disallow javascript-style
36
+ *
37
+ * @defaultValue false
38
+ */
39
+ disallowComments?: boolean;
40
+ /**
41
+ * Allow trailing commas in the JSON content
42
+ */
43
+ allowTrailingComma?: boolean;
44
+ }
45
+ interface JsonSerializeOptions {
46
+ /**
47
+ * the whitespaces to add as indentation to make the output more readable.
48
+ *
49
+ * @defaultValue 2
50
+ */
51
+ spaces?: number;
52
+ }
53
+ interface JsonParserResult {
54
+ json: JsonValue;
55
+ meta?: {
56
+ values?: Tree<TypeAnnotation> | Record<string, Tree<TypeAnnotation>> | undefined;
57
+ referentialEqualities?: Record<string, string[]> | [string[]] | [string[], Record<string, string[]>];
58
+ };
59
+ }
60
+ interface JsonParserInterface {
61
+ parse: <TData = any>(strData: string) => TData;
62
+ stringify: <TData = any>(data: TData) => string;
63
+ serialize: (object: JsonValue) => JsonParserResult;
64
+ deserialize: <TData = any>(payload: JsonParserResult) => TData;
65
+ register: <TData = any, TJsonValue extends JsonValue = JsonValue>(name: string, serialize: (object: JsonValue) => TJsonValue, deserialize: (payload: TJsonValue) => TData, isApplicable: (data: any) => data is TData) => void;
66
+ }
67
+ interface JsonSchema7AnyType {
68
+ $ref?: string;
69
+ }
70
+ interface JsonSchema7ArrayType {
71
+ type: "array";
72
+ items?: JsonSchema7Type;
73
+ minItems?: number;
74
+ maxItems?: number;
75
+ }
76
+ interface JsonSchema7BigintType {
77
+ type: "integer";
78
+ format: "int64";
79
+ minimum?: bigint;
80
+ exclusiveMinimum?: bigint;
81
+ maximum?: bigint;
82
+ exclusiveMaximum?: bigint;
83
+ multipleOf?: bigint;
84
+ }
85
+ interface JsonSchema7BooleanType {
86
+ type: "boolean";
87
+ }
88
+ type JsonSchema7DateType = {
89
+ type: "integer" | "string";
90
+ format: "unix-time" | "date-time" | "date";
91
+ minimum?: number;
92
+ maximum?: number;
93
+ } | {
94
+ anyOf: JsonSchema7DateType[];
95
+ };
96
+ interface JsonSchema7EnumType {
97
+ type: "string";
98
+ enum: string[];
99
+ }
100
+ interface JsonSchema7AllOfType {
101
+ allOf: JsonSchema7Type[];
102
+ unevaluatedProperties?: boolean;
103
+ }
104
+ type JsonSchema7LiteralType = {
105
+ type: "string" | "number" | "integer" | "boolean";
106
+ const: string | number | boolean;
107
+ } | {
108
+ type: "object" | "array";
109
+ };
110
+ interface JsonSchema7MapType {
111
+ type: "array";
112
+ maxItems: 125;
113
+ items: {
114
+ type: "array";
115
+ items: [JsonSchema7Type, JsonSchema7Type];
116
+ minItems: 2;
117
+ maxItems: 2;
118
+ };
119
+ }
120
+ interface JsonSchema7NativeEnumType {
121
+ type: "string" | "number" | ["string", "number"];
122
+ enum: (string | number)[];
123
+ }
124
+ interface JsonSchema7NeverType {
125
+ not: JsonSchema7AnyType;
126
+ }
127
+ interface JsonSchema7NullType {
128
+ type: "null";
129
+ }
130
+ type JsonSchema7NullableType = {
131
+ anyOf: [JsonSchema7Type, JsonSchema7NullType];
132
+ } | {
133
+ type: [string, "null"];
134
+ };
135
+ interface JsonSchema7NumberType {
136
+ type: "number" | "integer";
137
+ minimum?: number;
138
+ exclusiveMinimum?: number;
139
+ maximum?: number;
140
+ exclusiveMaximum?: number;
141
+ multipleOf?: number;
142
+ }
143
+ interface JsonSchema7ObjectType {
144
+ type: "object";
145
+ properties: Record<string, JsonSchema7Type>;
146
+ additionalProperties?: boolean | JsonSchema7Type;
147
+ required?: string[];
148
+ }
149
+ interface JsonSchema7StringType {
150
+ type: "string";
151
+ minLength?: number;
152
+ maxLength?: number;
153
+ format?: "email" | "idn-email" | "uri" | "uuid" | "date-time" | "ipv4" | "ipv6" | "date" | "time" | "duration";
154
+ pattern?: string;
155
+ contentEncoding?: string;
156
+ }
157
+ interface JsonSchema7SetType {
158
+ type: "array";
159
+ uniqueItems: true;
160
+ items?: JsonSchema7Type;
161
+ minItems?: number;
162
+ maxItems?: number;
163
+ }
164
+ type JsonSchema7RecordPropertyNamesType = Omit<JsonSchema7StringType, "type"> | Omit<JsonSchema7EnumType, "type">;
165
+ interface JsonSchema7RecordType {
166
+ type: "object";
167
+ additionalProperties?: JsonSchema7Type | true;
168
+ propertyNames?: JsonSchema7RecordPropertyNamesType;
169
+ }
170
+ type JsonSchema7TupleType = {
171
+ type: "array";
172
+ minItems: number;
173
+ items: JsonSchema7Type[];
174
+ } & ({
175
+ maxItems: number;
176
+ } | {
177
+ additionalItems?: JsonSchema7Type;
178
+ });
179
+ interface JsonSchema7UndefinedType {
180
+ not: JsonSchema7AnyType;
181
+ }
182
+ type JsonSchema7Primitive = "string" | "number" | "integer" | "boolean" | "null";
183
+ type JsonSchema7UnionType = JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType;
184
+ type JsonSchema7PrimitiveUnionType = {
185
+ type: JsonSchema7Primitive | JsonSchema7Primitive[];
186
+ } | {
187
+ type: JsonSchema7Primitive | JsonSchema7Primitive[];
188
+ enum: (string | number | bigint | boolean | null)[];
189
+ };
190
+ type JsonSchema7UnknownType = JsonSchema7AnyType;
191
+ interface JsonSchema7AnyOfType {
192
+ anyOf: JsonSchema7Type[];
193
+ }
194
+ interface JsonSchema7RefType {
195
+ $ref: string;
196
+ }
197
+ interface JsonSchema7Meta {
198
+ $id?: string;
199
+ $ref?: string;
200
+ $schema?: string;
201
+ $comment?: string;
202
+ title?: string;
203
+ default?: any;
204
+ description?: string;
205
+ markdownDescription?: string;
206
+ /**
207
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
208
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
209
+ */
210
+ $defs?: {
211
+ [key: string]: JsonSchema7Type;
212
+ };
213
+ }
214
+ type JsonSchema7TypeUnion = JsonSchema7StringType | JsonSchema7ArrayType | JsonSchema7NumberType | JsonSchema7BigintType | JsonSchema7BooleanType | JsonSchema7DateType | JsonSchema7EnumType | JsonSchema7LiteralType | JsonSchema7NativeEnumType | JsonSchema7NullType | JsonSchema7NumberType | JsonSchema7ObjectType | JsonSchema7RecordType | JsonSchema7TupleType | JsonSchema7UnionType | JsonSchema7UndefinedType | JsonSchema7RefType | JsonSchema7NeverType | JsonSchema7MapType | JsonSchema7AnyType | JsonSchema7NullableType | JsonSchema7AllOfType | JsonSchema7UnknownType | JsonSchema7SetType;
215
+ /**
216
+ * JSON Schema v7
217
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
218
+ */
219
+ type JsonSchema7Type = JsonSchema7TypeUnion & JsonSchema7Meta;
220
+ //#endregion
221
+ export { TypedArrayAnnotation as $, JsonSchema7PrimitiveUnionType as A, JsonSchema7UnionType as B, JsonSchema7NativeEnumType as C, JsonSchema7NumberType as D, JsonSchema7NullableType as E, JsonSchema7StringType as F, LeafTypeAnnotation as G, JsonSerializeOptions as H, JsonSchema7TupleType as I, SerializableJsonValue as J, PrimitiveJsonValue as K, JsonSchema7Type as L, JsonSchema7RecordType as M, JsonSchema7RefType as N, JsonSchema7ObjectType as O, JsonSchema7SetType as P, TypeAnnotation as Q, JsonSchema7TypeUnion as R, JsonSchema7Meta as S, JsonSchema7NullType as T, JsonValue as U, JsonSchema7UnknownType as V, Leaf as W, SymbolTypeAnnotation as X, SimpleTypeAnnotation as Y, Tree as Z, JsonSchema7BooleanType as _, CustomTypeAnnotation as a, JsonSchema7LiteralType as b, JsonObject as c, JsonParserResult as d, JsonSchema7AllOfType as f, JsonSchema7BigintType as g, JsonSchema7ArrayType as h, CompositeTypeAnnotation as i, JsonSchema7RecordPropertyNamesType as j, JsonSchema7Primitive as k, JsonParseOptions as l, JsonSchema7AnyType as m, ClassInstance as n, InnerNode as o, JsonSchema7AnyOfType as p, PrimitiveTypeAnnotation as q, ClassTypeAnnotation as r, JsonArray as s, Class as t, JsonParserInterface as u, JsonSchema7DateType as v, JsonSchema7NeverType as w, JsonSchema7MapType as x, JsonSchema7EnumType as y, JsonSchema7UndefinedType as z };
222
+ //# sourceMappingURL=types-BUeTTE_U.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BUeTTE_U.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAoBY,kBAAA;UAEK,KAAA;EAFL,KAAA,GAAA,IAAA,EAAA,GAAA,EAAA,CAAA,EAAkB,GAAA;AAE9B;AAIY,KAAA,SAAA,GAAY,kBAAH,GAAwB,SAAxB,GAAoC,UAApC;AAAG,KAEZ,SAAA,GAAY,KAFA,CAEM,SAFN,CAAA;AAAqB,UAI5B,UAAA,CAJ4B;EAAY,CAAA,GAAA,EAAA,MAAA,CAAA,EAKxC,SALwC;;AAE7C,KAMA,aAAA,GANkB,GAAA;AAEb,KAML,qBAAA,GALK,MAAS,GAOtB,GAPsB,CAOlB,SAPkB,CAAA,GAQtB,GARsB,CAQlB,SARkB,EAQP,SARO,CAAA,GAAA,SAAA,GAAA,MAAA,GAWtB,IAXsB,GAYtB,aAZsB,GAatB,MAbsB;AAGd,KAYA,IAZA,CAAA,CAAA,CA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ts
4
+ type PrimitiveJsonValue = string | number | boolean | undefined | null;
5
+ interface Class {
6
+ new (...args: any[]): any;
7
+ }
8
+ type JsonValue = PrimitiveJsonValue | JsonArray | JsonObject;
9
+ type JsonArray = Array<JsonValue>;
10
+ interface JsonObject {
11
+ [key: string]: JsonValue;
12
+ }
13
+ type ClassInstance = any;
14
+ type SerializableJsonValue = symbol | Set<JsonValue> | Map<JsonValue, JsonValue> | undefined | bigint | Date | ClassInstance | RegExp;
15
+ type Tree<T> = InnerNode<T> | Leaf<T>;
16
+ type Leaf<T> = [T];
17
+ type InnerNode<T> = [T, Record<string, Tree<T>>];
18
+ type PrimitiveTypeAnnotation = "number" | "undefined" | "bigint";
19
+ type LeafTypeAnnotation = PrimitiveTypeAnnotation | "regexp" | "Date" | "Error" | "URL";
20
+ type TypedArrayAnnotation = ["typed-array", string];
21
+ type ClassTypeAnnotation = ["class", string];
22
+ type SymbolTypeAnnotation = ["symbol", string];
23
+ type CustomTypeAnnotation = ["custom", string];
24
+ type SimpleTypeAnnotation = LeafTypeAnnotation | "map" | "set";
25
+ type CompositeTypeAnnotation = TypedArrayAnnotation | ClassTypeAnnotation | SymbolTypeAnnotation | CustomTypeAnnotation;
26
+ type TypeAnnotation = SimpleTypeAnnotation | CompositeTypeAnnotation;
27
+ interface JsonParseOptions extends ParseOptions {
28
+ /**
29
+ * Expect JSON with javascript-style
30
+ *
31
+ * @defaultValue false
32
+ */
33
+ expectComments?: boolean;
34
+ /**
35
+ * Disallow javascript-style
36
+ *
37
+ * @defaultValue false
38
+ */
39
+ disallowComments?: boolean;
40
+ /**
41
+ * Allow trailing commas in the JSON content
42
+ */
43
+ allowTrailingComma?: boolean;
44
+ }
45
+ interface JsonSerializeOptions {
46
+ /**
47
+ * the whitespaces to add as indentation to make the output more readable.
48
+ *
49
+ * @defaultValue 2
50
+ */
51
+ spaces?: number;
52
+ }
53
+ interface JsonParserResult {
54
+ json: JsonValue;
55
+ meta?: {
56
+ values?: Tree<TypeAnnotation> | Record<string, Tree<TypeAnnotation>> | undefined;
57
+ referentialEqualities?: Record<string, string[]> | [string[]] | [string[], Record<string, string[]>];
58
+ };
59
+ }
60
+ interface JsonParserInterface {
61
+ parse: <TData = any>(strData: string) => TData;
62
+ stringify: <TData = any>(data: TData) => string;
63
+ serialize: (object: JsonValue) => JsonParserResult;
64
+ deserialize: <TData = any>(payload: JsonParserResult) => TData;
65
+ register: <TData = any, TJsonValue extends JsonValue = JsonValue>(name: string, serialize: (object: JsonValue) => TJsonValue, deserialize: (payload: TJsonValue) => TData, isApplicable: (data: any) => data is TData) => void;
66
+ }
67
+ interface JsonSchema7AnyType {
68
+ $ref?: string;
69
+ }
70
+ interface JsonSchema7ArrayType {
71
+ type: "array";
72
+ items?: JsonSchema7Type;
73
+ minItems?: number;
74
+ maxItems?: number;
75
+ }
76
+ interface JsonSchema7BigintType {
77
+ type: "integer";
78
+ format: "int64";
79
+ minimum?: bigint;
80
+ exclusiveMinimum?: bigint;
81
+ maximum?: bigint;
82
+ exclusiveMaximum?: bigint;
83
+ multipleOf?: bigint;
84
+ }
85
+ interface JsonSchema7BooleanType {
86
+ type: "boolean";
87
+ }
88
+ type JsonSchema7DateType = {
89
+ type: "integer" | "string";
90
+ format: "unix-time" | "date-time" | "date";
91
+ minimum?: number;
92
+ maximum?: number;
93
+ } | {
94
+ anyOf: JsonSchema7DateType[];
95
+ };
96
+ interface JsonSchema7EnumType {
97
+ type: "string";
98
+ enum: string[];
99
+ }
100
+ interface JsonSchema7AllOfType {
101
+ allOf: JsonSchema7Type[];
102
+ unevaluatedProperties?: boolean;
103
+ }
104
+ type JsonSchema7LiteralType = {
105
+ type: "string" | "number" | "integer" | "boolean";
106
+ const: string | number | boolean;
107
+ } | {
108
+ type: "object" | "array";
109
+ };
110
+ interface JsonSchema7MapType {
111
+ type: "array";
112
+ maxItems: 125;
113
+ items: {
114
+ type: "array";
115
+ items: [JsonSchema7Type, JsonSchema7Type];
116
+ minItems: 2;
117
+ maxItems: 2;
118
+ };
119
+ }
120
+ interface JsonSchema7NativeEnumType {
121
+ type: "string" | "number" | ["string", "number"];
122
+ enum: (string | number)[];
123
+ }
124
+ interface JsonSchema7NeverType {
125
+ not: JsonSchema7AnyType;
126
+ }
127
+ interface JsonSchema7NullType {
128
+ type: "null";
129
+ }
130
+ type JsonSchema7NullableType = {
131
+ anyOf: [JsonSchema7Type, JsonSchema7NullType];
132
+ } | {
133
+ type: [string, "null"];
134
+ };
135
+ interface JsonSchema7NumberType {
136
+ type: "number" | "integer";
137
+ minimum?: number;
138
+ exclusiveMinimum?: number;
139
+ maximum?: number;
140
+ exclusiveMaximum?: number;
141
+ multipleOf?: number;
142
+ }
143
+ interface JsonSchema7ObjectType {
144
+ type: "object";
145
+ properties: Record<string, JsonSchema7Type>;
146
+ additionalProperties?: boolean | JsonSchema7Type;
147
+ required?: string[];
148
+ }
149
+ interface JsonSchema7StringType {
150
+ type: "string";
151
+ minLength?: number;
152
+ maxLength?: number;
153
+ format?: "email" | "idn-email" | "uri" | "uuid" | "date-time" | "ipv4" | "ipv6" | "date" | "time" | "duration";
154
+ pattern?: string;
155
+ contentEncoding?: string;
156
+ }
157
+ interface JsonSchema7SetType {
158
+ type: "array";
159
+ uniqueItems: true;
160
+ items?: JsonSchema7Type;
161
+ minItems?: number;
162
+ maxItems?: number;
163
+ }
164
+ type JsonSchema7RecordPropertyNamesType = Omit<JsonSchema7StringType, "type"> | Omit<JsonSchema7EnumType, "type">;
165
+ interface JsonSchema7RecordType {
166
+ type: "object";
167
+ additionalProperties?: JsonSchema7Type | true;
168
+ propertyNames?: JsonSchema7RecordPropertyNamesType;
169
+ }
170
+ type JsonSchema7TupleType = {
171
+ type: "array";
172
+ minItems: number;
173
+ items: JsonSchema7Type[];
174
+ } & ({
175
+ maxItems: number;
176
+ } | {
177
+ additionalItems?: JsonSchema7Type;
178
+ });
179
+ interface JsonSchema7UndefinedType {
180
+ not: JsonSchema7AnyType;
181
+ }
182
+ type JsonSchema7Primitive = "string" | "number" | "integer" | "boolean" | "null";
183
+ type JsonSchema7UnionType = JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType;
184
+ type JsonSchema7PrimitiveUnionType = {
185
+ type: JsonSchema7Primitive | JsonSchema7Primitive[];
186
+ } | {
187
+ type: JsonSchema7Primitive | JsonSchema7Primitive[];
188
+ enum: (string | number | bigint | boolean | null)[];
189
+ };
190
+ type JsonSchema7UnknownType = JsonSchema7AnyType;
191
+ interface JsonSchema7AnyOfType {
192
+ anyOf: JsonSchema7Type[];
193
+ }
194
+ interface JsonSchema7RefType {
195
+ $ref: string;
196
+ }
197
+ interface JsonSchema7Meta {
198
+ $id?: string;
199
+ $ref?: string;
200
+ $schema?: string;
201
+ $comment?: string;
202
+ title?: string;
203
+ default?: any;
204
+ description?: string;
205
+ markdownDescription?: string;
206
+ /**
207
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
208
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
209
+ */
210
+ $defs?: {
211
+ [key: string]: JsonSchema7Type;
212
+ };
213
+ }
214
+ type JsonSchema7TypeUnion = JsonSchema7StringType | JsonSchema7ArrayType | JsonSchema7NumberType | JsonSchema7BigintType | JsonSchema7BooleanType | JsonSchema7DateType | JsonSchema7EnumType | JsonSchema7LiteralType | JsonSchema7NativeEnumType | JsonSchema7NullType | JsonSchema7NumberType | JsonSchema7ObjectType | JsonSchema7RecordType | JsonSchema7TupleType | JsonSchema7UnionType | JsonSchema7UndefinedType | JsonSchema7RefType | JsonSchema7NeverType | JsonSchema7MapType | JsonSchema7AnyType | JsonSchema7NullableType | JsonSchema7AllOfType | JsonSchema7UnknownType | JsonSchema7SetType;
215
+ /**
216
+ * JSON Schema v7
217
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
218
+ */
219
+ type JsonSchema7Type = JsonSchema7TypeUnion & JsonSchema7Meta;
220
+ //#endregion
221
+ export { TypedArrayAnnotation as $, JsonSchema7PrimitiveUnionType as A, JsonSchema7UnionType as B, JsonSchema7NativeEnumType as C, JsonSchema7NumberType as D, JsonSchema7NullableType as E, JsonSchema7StringType as F, LeafTypeAnnotation as G, JsonSerializeOptions as H, JsonSchema7TupleType as I, SerializableJsonValue as J, PrimitiveJsonValue as K, JsonSchema7Type as L, JsonSchema7RecordType as M, JsonSchema7RefType as N, JsonSchema7ObjectType as O, JsonSchema7SetType as P, TypeAnnotation as Q, JsonSchema7TypeUnion as R, JsonSchema7Meta as S, JsonSchema7NullType as T, JsonValue as U, JsonSchema7UnknownType as V, Leaf as W, SymbolTypeAnnotation as X, SimpleTypeAnnotation as Y, Tree as Z, JsonSchema7BooleanType as _, CustomTypeAnnotation as a, JsonSchema7LiteralType as b, JsonObject as c, JsonParserResult as d, JsonSchema7AllOfType as f, JsonSchema7BigintType as g, JsonSchema7ArrayType as h, CompositeTypeAnnotation as i, JsonSchema7RecordPropertyNamesType as j, JsonSchema7Primitive as k, JsonParseOptions as l, JsonSchema7AnyType as m, ClassInstance as n, InnerNode as o, JsonSchema7AnyOfType as p, PrimitiveTypeAnnotation as q, ClassTypeAnnotation as r, JsonArray as s, Class as t, JsonParserInterface as u, JsonSchema7DateType as v, JsonSchema7NeverType as w, JsonSchema7MapType as x, JsonSchema7EnumType as y, JsonSchema7UndefinedType as z };
222
+ //# sourceMappingURL=types-C_KlcCNw.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-C_KlcCNw.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAoBY,kBAAA;UAEK,KAAA;EAFL,KAAA,GAAA,IAAA,EAAA,GAAA,EAAA,CAAA,EAAkB,GAAA;AAE9B;AAIY,KAAA,SAAA,GAAY,kBAAH,GAAwB,SAAxB,GAAoC,UAApC;AAAG,KAEZ,SAAA,GAAY,KAFA,CAEM,SAFN,CAAA;AAAqB,UAI5B,UAAA,CAJ4B;EAAY,CAAA,GAAA,EAAA,MAAA,CAAA,EA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GACR,wBACA,uBACA,wBACA,wBACA,yBACA,sBACA,sBACA,yBACA,4BACA,sBACA,wBACA,wBACA,wBACA,uBACA,uBACA,2BACA,qBACA,uBACA,qBACA,qBACA,0BACA,uBACA,yBACA;;;;;KAMQ,eAAA,GAAkB,uBAAuB"}
package/dist/types.d.cts CHANGED
@@ -1,69 +1,2 @@
1
- import { ParseOptions } from "jsonc-parser";
2
-
3
- //#region src/types.d.ts
4
- type PrimitiveJsonValue = string | number | boolean | undefined | null;
5
- interface Class {
6
- new (...args: any[]): any;
7
- }
8
- type JsonValue = PrimitiveJsonValue | JsonArray | JsonObject;
9
- type JsonArray = Array<JsonValue>;
10
- interface JsonObject {
11
- [key: string]: JsonValue;
12
- }
13
- type ClassInstance = any;
14
- type SerializableJsonValue = symbol | Set<JsonValue> | Map<JsonValue, JsonValue> | undefined | bigint | Date | ClassInstance | RegExp;
15
- type Tree<T> = InnerNode<T> | Leaf<T>;
16
- type Leaf<T> = [T];
17
- type InnerNode<T> = [T, Record<string, Tree<T>>];
18
- type PrimitiveTypeAnnotation = "number" | "undefined" | "bigint";
19
- type LeafTypeAnnotation = PrimitiveTypeAnnotation | "regexp" | "Date" | "Error" | "URL";
20
- type TypedArrayAnnotation = ["typed-array", string];
21
- type ClassTypeAnnotation = ["class", string];
22
- type SymbolTypeAnnotation = ["symbol", string];
23
- type CustomTypeAnnotation = ["custom", string];
24
- type SimpleTypeAnnotation = LeafTypeAnnotation | "map" | "set";
25
- type CompositeTypeAnnotation = TypedArrayAnnotation | ClassTypeAnnotation | SymbolTypeAnnotation | CustomTypeAnnotation;
26
- type TypeAnnotation = SimpleTypeAnnotation | CompositeTypeAnnotation;
27
- interface JsonParseOptions extends ParseOptions {
28
- /**
29
- * Expect JSON with javascript-style
30
- *
31
- * @defaultValue false
32
- */
33
- expectComments?: boolean;
34
- /**
35
- * Disallow javascript-style
36
- *
37
- * @defaultValue false
38
- */
39
- disallowComments?: boolean;
40
- /**
41
- * Allow trailing commas in the JSON content
42
- */
43
- allowTrailingComma?: boolean;
44
- }
45
- interface JsonSerializeOptions {
46
- /**
47
- * the whitespaces to add as indentation to make the output more readable.
48
- *
49
- * @defaultValue 2
50
- */
51
- spaces?: number;
52
- }
53
- interface JsonParserResult {
54
- json: JsonValue;
55
- meta?: {
56
- values?: Tree<TypeAnnotation> | Record<string, Tree<TypeAnnotation>> | undefined;
57
- referentialEqualities?: Record<string, string[]> | [string[]] | [string[], Record<string, string[]>];
58
- };
59
- }
60
- interface JsonParserInterface {
61
- parse: <TData = any>(strData: string) => TData;
62
- stringify: <TData = any>(data: TData) => string;
63
- serialize: (object: JsonValue) => JsonParserResult;
64
- deserialize: <TData = any>(payload: JsonParserResult) => TData;
65
- register: <TData = any, TJsonValue extends JsonValue = JsonValue>(name: string, serialize: (object: JsonValue) => TJsonValue, deserialize: (payload: TJsonValue) => TData, isApplicable: (data: any) => data is TData) => void;
66
- }
67
- //#endregion
68
- export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation };
69
- //# sourceMappingURL=types.d.cts.map
1
+ import { $ as TypedArrayAnnotation, A as JsonSchema7PrimitiveUnionType, B as JsonSchema7UnionType, C as JsonSchema7NativeEnumType, D as JsonSchema7NumberType, E as JsonSchema7NullableType, F as JsonSchema7StringType, G as LeafTypeAnnotation, H as JsonSerializeOptions, I as JsonSchema7TupleType, J as SerializableJsonValue, K as PrimitiveJsonValue, L as JsonSchema7Type, M as JsonSchema7RecordType, N as JsonSchema7RefType, O as JsonSchema7ObjectType, P as JsonSchema7SetType, Q as TypeAnnotation, R as JsonSchema7TypeUnion, S as JsonSchema7Meta, T as JsonSchema7NullType, U as JsonValue, V as JsonSchema7UnknownType, W as Leaf, X as SymbolTypeAnnotation, Y as SimpleTypeAnnotation, Z as Tree, _ as JsonSchema7BooleanType, a as CustomTypeAnnotation, b as JsonSchema7LiteralType, c as JsonObject, d as JsonParserResult, f as JsonSchema7AllOfType, g as JsonSchema7BigintType, h as JsonSchema7ArrayType, i as CompositeTypeAnnotation, j as JsonSchema7RecordPropertyNamesType, k as JsonSchema7Primitive, l as JsonParseOptions, m as JsonSchema7AnyType, n as ClassInstance, o as InnerNode, p as JsonSchema7AnyOfType, q as PrimitiveTypeAnnotation, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as JsonSchema7DateType, w as JsonSchema7NeverType, x as JsonSchema7MapType, y as JsonSchema7EnumType, z as JsonSchema7UndefinedType } from "./types-BUeTTE_U.cjs";
2
+ export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation };
package/dist/types.d.mts CHANGED
@@ -1,69 +1,2 @@
1
- import { ParseOptions } from "jsonc-parser";
2
-
3
- //#region src/types.d.ts
4
- type PrimitiveJsonValue = string | number | boolean | undefined | null;
5
- interface Class {
6
- new (...args: any[]): any;
7
- }
8
- type JsonValue = PrimitiveJsonValue | JsonArray | JsonObject;
9
- type JsonArray = Array<JsonValue>;
10
- interface JsonObject {
11
- [key: string]: JsonValue;
12
- }
13
- type ClassInstance = any;
14
- type SerializableJsonValue = symbol | Set<JsonValue> | Map<JsonValue, JsonValue> | undefined | bigint | Date | ClassInstance | RegExp;
15
- type Tree<T> = InnerNode<T> | Leaf<T>;
16
- type Leaf<T> = [T];
17
- type InnerNode<T> = [T, Record<string, Tree<T>>];
18
- type PrimitiveTypeAnnotation = "number" | "undefined" | "bigint";
19
- type LeafTypeAnnotation = PrimitiveTypeAnnotation | "regexp" | "Date" | "Error" | "URL";
20
- type TypedArrayAnnotation = ["typed-array", string];
21
- type ClassTypeAnnotation = ["class", string];
22
- type SymbolTypeAnnotation = ["symbol", string];
23
- type CustomTypeAnnotation = ["custom", string];
24
- type SimpleTypeAnnotation = LeafTypeAnnotation | "map" | "set";
25
- type CompositeTypeAnnotation = TypedArrayAnnotation | ClassTypeAnnotation | SymbolTypeAnnotation | CustomTypeAnnotation;
26
- type TypeAnnotation = SimpleTypeAnnotation | CompositeTypeAnnotation;
27
- interface JsonParseOptions extends ParseOptions {
28
- /**
29
- * Expect JSON with javascript-style
30
- *
31
- * @defaultValue false
32
- */
33
- expectComments?: boolean;
34
- /**
35
- * Disallow javascript-style
36
- *
37
- * @defaultValue false
38
- */
39
- disallowComments?: boolean;
40
- /**
41
- * Allow trailing commas in the JSON content
42
- */
43
- allowTrailingComma?: boolean;
44
- }
45
- interface JsonSerializeOptions {
46
- /**
47
- * the whitespaces to add as indentation to make the output more readable.
48
- *
49
- * @defaultValue 2
50
- */
51
- spaces?: number;
52
- }
53
- interface JsonParserResult {
54
- json: JsonValue;
55
- meta?: {
56
- values?: Tree<TypeAnnotation> | Record<string, Tree<TypeAnnotation>> | undefined;
57
- referentialEqualities?: Record<string, string[]> | [string[]] | [string[], Record<string, string[]>];
58
- };
59
- }
60
- interface JsonParserInterface {
61
- parse: <TData = any>(strData: string) => TData;
62
- stringify: <TData = any>(data: TData) => string;
63
- serialize: (object: JsonValue) => JsonParserResult;
64
- deserialize: <TData = any>(payload: JsonParserResult) => TData;
65
- register: <TData = any, TJsonValue extends JsonValue = JsonValue>(name: string, serialize: (object: JsonValue) => TJsonValue, deserialize: (payload: TJsonValue) => TData, isApplicable: (data: any) => data is TData) => void;
66
- }
67
- //#endregion
68
- export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation };
69
- //# sourceMappingURL=types.d.mts.map
1
+ import { $ as TypedArrayAnnotation, A as JsonSchema7PrimitiveUnionType, B as JsonSchema7UnionType, C as JsonSchema7NativeEnumType, D as JsonSchema7NumberType, E as JsonSchema7NullableType, F as JsonSchema7StringType, G as LeafTypeAnnotation, H as JsonSerializeOptions, I as JsonSchema7TupleType, J as SerializableJsonValue, K as PrimitiveJsonValue, L as JsonSchema7Type, M as JsonSchema7RecordType, N as JsonSchema7RefType, O as JsonSchema7ObjectType, P as JsonSchema7SetType, Q as TypeAnnotation, R as JsonSchema7TypeUnion, S as JsonSchema7Meta, T as JsonSchema7NullType, U as JsonValue, V as JsonSchema7UnknownType, W as Leaf, X as SymbolTypeAnnotation, Y as SimpleTypeAnnotation, Z as Tree, _ as JsonSchema7BooleanType, a as CustomTypeAnnotation, b as JsonSchema7LiteralType, c as JsonObject, d as JsonParserResult, f as JsonSchema7AllOfType, g as JsonSchema7BigintType, h as JsonSchema7ArrayType, i as CompositeTypeAnnotation, j as JsonSchema7RecordPropertyNamesType, k as JsonSchema7Primitive, l as JsonParseOptions, m as JsonSchema7AnyType, n as ClassInstance, o as InnerNode, p as JsonSchema7AnyOfType, q as PrimitiveTypeAnnotation, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as JsonSchema7DateType, w as JsonSchema7NeverType, x as JsonSchema7MapType, y as JsonSchema7EnumType, z as JsonSchema7UndefinedType } from "./types-C_KlcCNw.mjs";
2
+ export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation };
package/dist/types.mjs CHANGED
@@ -1 +0,0 @@
1
- export { };