@mongodb-js/mongodb-schema 12.7.1

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 (53) hide show
  1. package/.esm-wrapper.mjs +10 -0
  2. package/LICENSE +201 -0
  3. package/README.md +353 -0
  4. package/bin/mongodb-schema +231 -0
  5. package/dist/index.d.ts +14 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +69 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/schema-accessor.d.ts +30 -0
  10. package/dist/schema-accessor.d.ts.map +1 -0
  11. package/dist/schema-accessor.js +30 -0
  12. package/dist/schema-accessor.js.map +1 -0
  13. package/dist/schema-analyzer.d.ts +161 -0
  14. package/dist/schema-analyzer.d.ts.map +1 -0
  15. package/dist/schema-analyzer.js +379 -0
  16. package/dist/schema-analyzer.js.map +1 -0
  17. package/dist/schema-converters/internal-to-expanded.d.ts +6 -0
  18. package/dist/schema-converters/internal-to-expanded.d.ts.map +1 -0
  19. package/dist/schema-converters/internal-to-expanded.js +97 -0
  20. package/dist/schema-converters/internal-to-expanded.js.map +1 -0
  21. package/dist/schema-converters/internal-to-mongodb.d.ts +7 -0
  22. package/dist/schema-converters/internal-to-mongodb.d.ts.map +1 -0
  23. package/dist/schema-converters/internal-to-mongodb.js +93 -0
  24. package/dist/schema-converters/internal-to-mongodb.js.map +1 -0
  25. package/dist/schema-converters/internal-to-standard.d.ts +228 -0
  26. package/dist/schema-converters/internal-to-standard.d.ts.map +1 -0
  27. package/dist/schema-converters/internal-to-standard.js +318 -0
  28. package/dist/schema-converters/internal-to-standard.js.map +1 -0
  29. package/dist/semantic-types/email.d.ts +2 -0
  30. package/dist/semantic-types/email.d.ts.map +1 -0
  31. package/dist/semantic-types/email.js +8 -0
  32. package/dist/semantic-types/email.js.map +1 -0
  33. package/dist/semantic-types/index.d.ts +6 -0
  34. package/dist/semantic-types/index.d.ts.map +1 -0
  35. package/dist/semantic-types/index.js +7 -0
  36. package/dist/semantic-types/index.js.map +1 -0
  37. package/dist/stats.d.ts +11 -0
  38. package/dist/stats.d.ts.map +1 -0
  39. package/dist/stats.js +82 -0
  40. package/dist/stats.js.map +1 -0
  41. package/dist/to-typescript.d.ts +3 -0
  42. package/dist/to-typescript.d.ts.map +1 -0
  43. package/dist/to-typescript.js +103 -0
  44. package/dist/to-typescript.js.map +1 -0
  45. package/dist/types.d.ts +29 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/dist/types.js +3 -0
  48. package/dist/types.js.map +1 -0
  49. package/dist/util.d.ts +3 -0
  50. package/dist/util.d.ts.map +1 -0
  51. package/dist/util.js +13 -0
  52. package/dist/util.js.map +1 -0
  53. package/package.json +110 -0
@@ -0,0 +1,228 @@
1
+ import type { JSONSchema4TypeName } from 'json-schema';
2
+ import type { Schema as InternalSchema, SchemaType } from '../schema-analyzer';
3
+ import type { StandardJSONSchema } from '../types';
4
+ type StandardTypeDefinition = {
5
+ type: JSONSchema4TypeName;
6
+ $ref?: never;
7
+ } | {
8
+ $ref: string;
9
+ type?: never;
10
+ };
11
+ type TypeToDefinitionMap = Record<SchemaType['name'] | 'Double' | 'BSONSymbol', StandardTypeDefinition>;
12
+ export declare const InternalTypeToStandardTypeMap: TypeToDefinitionMap;
13
+ export declare const RELAXED_EJSON_DEFINITIONS: {
14
+ ObjectId: {
15
+ type: string;
16
+ properties: {
17
+ $oid: {
18
+ type: string;
19
+ pattern: string;
20
+ };
21
+ };
22
+ required: string[];
23
+ additionalProperties: boolean;
24
+ };
25
+ BSONSymbol: {
26
+ type: string;
27
+ properties: {
28
+ $symbol: {
29
+ type: string;
30
+ };
31
+ };
32
+ required: string[];
33
+ additionalProperties: boolean;
34
+ };
35
+ Double: {
36
+ oneOf: ({
37
+ type: string;
38
+ properties?: undefined;
39
+ } | {
40
+ type: string;
41
+ properties: {
42
+ $numberDouble: {
43
+ enum: string[];
44
+ };
45
+ };
46
+ })[];
47
+ };
48
+ Decimal128: {
49
+ type: string;
50
+ properties: {
51
+ $numberDecimal: {
52
+ type: string;
53
+ };
54
+ };
55
+ required: string[];
56
+ additionalProperties: boolean;
57
+ };
58
+ Binary: {
59
+ type: string;
60
+ properties: {
61
+ $binary: {
62
+ type: string;
63
+ properties: {
64
+ base64: {
65
+ type: string;
66
+ };
67
+ subType: {
68
+ type: string;
69
+ pattern: string;
70
+ };
71
+ };
72
+ required: string[];
73
+ additionalProperties: boolean;
74
+ };
75
+ };
76
+ required: string[];
77
+ additionalProperties: boolean;
78
+ };
79
+ Code: {
80
+ type: string;
81
+ properties: {
82
+ $code: {
83
+ type: string;
84
+ };
85
+ };
86
+ required: string[];
87
+ additionalProperties: boolean;
88
+ };
89
+ CodeWScope: {
90
+ type: string;
91
+ properties: {
92
+ $code: {
93
+ type: string;
94
+ };
95
+ $scope: {
96
+ type: string;
97
+ };
98
+ };
99
+ required: string[];
100
+ additionalProperties: boolean;
101
+ };
102
+ Timestamp: {
103
+ type: string;
104
+ properties: {
105
+ $timestamp: {
106
+ type: string;
107
+ properties: {
108
+ t: {
109
+ type: string;
110
+ minimum: number;
111
+ };
112
+ i: {
113
+ type: string;
114
+ minimum: number;
115
+ };
116
+ };
117
+ required: string[];
118
+ additionalProperties: boolean;
119
+ };
120
+ };
121
+ required: string[];
122
+ additionalProperties: boolean;
123
+ };
124
+ RegExp: {
125
+ type: string;
126
+ properties: {
127
+ $regularExpression: {
128
+ type: string;
129
+ properties: {
130
+ pattern: {
131
+ type: string;
132
+ };
133
+ options: {
134
+ type: string;
135
+ pattern: string;
136
+ };
137
+ };
138
+ required: string[];
139
+ additionalProperties: boolean;
140
+ };
141
+ };
142
+ required: string[];
143
+ additionalProperties: boolean;
144
+ };
145
+ DBPointer: {
146
+ type: string;
147
+ properties: {
148
+ $dbPointer: {
149
+ type: string;
150
+ properties: {
151
+ $ref: {
152
+ type: string;
153
+ };
154
+ $id: {
155
+ $ref: string;
156
+ };
157
+ };
158
+ required: string[];
159
+ additionalProperties: boolean;
160
+ };
161
+ };
162
+ required: string[];
163
+ additionalProperties: boolean;
164
+ };
165
+ Date: {
166
+ type: string;
167
+ properties: {
168
+ $date: {
169
+ type: string;
170
+ format: string;
171
+ };
172
+ };
173
+ required: string[];
174
+ additionalProperties: boolean;
175
+ };
176
+ DBRef: {
177
+ type: string;
178
+ properties: {
179
+ $ref: {
180
+ type: string;
181
+ };
182
+ $id: {};
183
+ $db: {
184
+ type: string;
185
+ };
186
+ };
187
+ required: string[];
188
+ additionalProperties: boolean;
189
+ };
190
+ MinKey: {
191
+ type: string;
192
+ properties: {
193
+ $minKey: {
194
+ type: string;
195
+ const: number;
196
+ };
197
+ };
198
+ required: string[];
199
+ additionalProperties: boolean;
200
+ };
201
+ MaxKey: {
202
+ type: string;
203
+ properties: {
204
+ $maxKey: {
205
+ type: string;
206
+ const: number;
207
+ };
208
+ };
209
+ required: string[];
210
+ additionalProperties: boolean;
211
+ };
212
+ Undefined: {
213
+ type: string;
214
+ properties: {
215
+ $undefined: {
216
+ type: string;
217
+ const: boolean;
218
+ };
219
+ };
220
+ required: string[];
221
+ additionalProperties: boolean;
222
+ };
223
+ };
224
+ export declare function convertInternalToStandard(internalSchema: InternalSchema, options?: {
225
+ signal?: AbortSignal;
226
+ }): Promise<StandardJSONSchema>;
227
+ export {};
228
+ //# sourceMappingURL=internal-to-standard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-to-standard.d.ts","sourceRoot":"","sources":["../../src/schema-converters/internal-to-standard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAGV,MAAM,IAAI,cAAc,EACxB,UAAU,EACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,KAAK,sBAAsB,GACvB;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAEnC,KAAK,mBAAmB,GAAG,MAAM,CAC/B,UAAU,CAAC,MAAM,CAAC,GAAG,QAAQ,GAAG,YAAY,EAC5C,sBAAsB,CACvB,CAAC;AACF,eAAO,MAAM,6BAA6B,EAAE,mBAyB3C,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkNrC,CAAC;AAoHF,wBAAgB,yBAAyB,CACvC,cAAc,EAAE,cAAc,EAC9B,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACrC,OAAO,CAAC,kBAAkB,CAAC,CAE7B"}
@@ -0,0 +1,318 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RELAXED_EJSON_DEFINITIONS = exports.InternalTypeToStandardTypeMap = void 0;
4
+ exports.convertInternalToStandard = convertInternalToStandard;
5
+ const util_1 = require("../util");
6
+ exports.InternalTypeToStandardTypeMap = {
7
+ Double: { $ref: '#/$defs/Double' },
8
+ Number: { $ref: '#/$defs/Double' },
9
+ String: { type: 'string' },
10
+ Document: { type: 'object' },
11
+ Array: { type: 'array' },
12
+ Binary: { $ref: '#/$defs/Binary' },
13
+ Undefined: { $ref: '#/$defs/Undefined' },
14
+ ObjectId: { $ref: '#/$defs/ObjectId' },
15
+ Boolean: { type: 'boolean' },
16
+ Date: { $ref: '#/$defs/Date' },
17
+ Null: { type: 'null' },
18
+ RegExp: { $ref: '#/$defs/RegExp' },
19
+ BSONRegExp: { $ref: '#/$defs/RegExp' },
20
+ DBRef: { $ref: '#/$defs/DBRef' },
21
+ DBPointer: { $ref: '#/$defs/DBPointer' },
22
+ BSONSymbol: { $ref: '#/$defs/BSONSymbol' },
23
+ Code: { $ref: '#/$defs/Code' },
24
+ CodeWScope: { $ref: '#/$defs/CodeWScope' },
25
+ Int32: { type: 'integer' },
26
+ Timestamp: { $ref: '#/$defs/Timestamp' },
27
+ Long: { type: 'integer' },
28
+ Decimal128: { $ref: '#/$defs/Decimal128' },
29
+ MinKey: { $ref: '#/$defs/MinKey' },
30
+ MaxKey: { $ref: '#/$defs/MaxKey' },
31
+ };
32
+ exports.RELAXED_EJSON_DEFINITIONS = {
33
+ ObjectId: {
34
+ type: 'object',
35
+ properties: {
36
+ $oid: {
37
+ type: 'string',
38
+ pattern: '^[0-9a-fA-F]{24}$',
39
+ },
40
+ },
41
+ required: ['$oid'],
42
+ additionalProperties: false,
43
+ },
44
+ BSONSymbol: {
45
+ type: 'object',
46
+ properties: {
47
+ $symbol: {
48
+ type: 'string',
49
+ },
50
+ },
51
+ required: ['$symbol'],
52
+ additionalProperties: false,
53
+ },
54
+ Double: {
55
+ oneOf: [
56
+ { type: 'number' },
57
+ {
58
+ type: 'object',
59
+ properties: {
60
+ $numberDouble: {
61
+ enum: ['Infinity', '-Infinity', 'NaN'],
62
+ },
63
+ },
64
+ },
65
+ ],
66
+ },
67
+ Decimal128: {
68
+ type: 'object',
69
+ properties: {
70
+ $numberDecimal: {
71
+ type: 'string',
72
+ },
73
+ },
74
+ required: ['$numberDecimal'],
75
+ additionalProperties: false,
76
+ },
77
+ Binary: {
78
+ type: 'object',
79
+ properties: {
80
+ $binary: {
81
+ type: 'object',
82
+ properties: {
83
+ base64: {
84
+ type: 'string',
85
+ },
86
+ subType: {
87
+ type: 'string',
88
+ pattern: '^[0-9a-fA-F]{1,2}$',
89
+ },
90
+ },
91
+ required: ['base64', 'subType'],
92
+ additionalProperties: false,
93
+ },
94
+ },
95
+ required: ['$binary'],
96
+ additionalProperties: false,
97
+ },
98
+ Code: {
99
+ type: 'object',
100
+ properties: {
101
+ $code: {
102
+ type: 'string',
103
+ },
104
+ },
105
+ required: ['$code'],
106
+ additionalProperties: false,
107
+ },
108
+ CodeWScope: {
109
+ type: 'object',
110
+ properties: {
111
+ $code: {
112
+ type: 'string',
113
+ },
114
+ $scope: {
115
+ type: 'object',
116
+ },
117
+ },
118
+ required: ['$code', '$scope'],
119
+ additionalProperties: false,
120
+ },
121
+ Timestamp: {
122
+ type: 'object',
123
+ properties: {
124
+ $timestamp: {
125
+ type: 'object',
126
+ properties: {
127
+ t: {
128
+ type: 'integer',
129
+ minimum: 0,
130
+ },
131
+ i: {
132
+ type: 'integer',
133
+ minimum: 0,
134
+ },
135
+ },
136
+ required: ['t', 'i'],
137
+ additionalProperties: false,
138
+ },
139
+ },
140
+ required: ['$timestamp'],
141
+ additionalProperties: false,
142
+ },
143
+ RegExp: {
144
+ type: 'object',
145
+ properties: {
146
+ $regularExpression: {
147
+ type: 'object',
148
+ properties: {
149
+ pattern: {
150
+ type: 'string',
151
+ },
152
+ options: {
153
+ type: 'string',
154
+ pattern: '^[gimuy]*$',
155
+ },
156
+ },
157
+ required: ['pattern'],
158
+ additionalProperties: false,
159
+ },
160
+ },
161
+ required: ['$regularExpression'],
162
+ additionalProperties: false,
163
+ },
164
+ DBPointer: {
165
+ type: 'object',
166
+ properties: {
167
+ $dbPointer: {
168
+ type: 'object',
169
+ properties: {
170
+ $ref: {
171
+ type: 'string',
172
+ },
173
+ $id: {
174
+ $ref: '#/$defs/ObjectId',
175
+ },
176
+ },
177
+ required: ['$ref', '$id'],
178
+ additionalProperties: false,
179
+ },
180
+ },
181
+ required: ['$dbPointer'],
182
+ additionalProperties: false,
183
+ },
184
+ Date: {
185
+ type: 'object',
186
+ properties: {
187
+ $date: {
188
+ type: 'string',
189
+ format: 'date-time',
190
+ },
191
+ },
192
+ required: ['$date'],
193
+ additionalProperties: false,
194
+ },
195
+ DBRef: {
196
+ type: 'object',
197
+ properties: {
198
+ $ref: {
199
+ type: 'string',
200
+ },
201
+ $id: {},
202
+ $db: {
203
+ type: 'string',
204
+ },
205
+ },
206
+ required: ['$ref', '$id'],
207
+ additionalProperties: true,
208
+ },
209
+ MinKey: {
210
+ type: 'object',
211
+ properties: {
212
+ $minKey: {
213
+ type: 'integer',
214
+ const: 1,
215
+ },
216
+ },
217
+ required: ['$minKey'],
218
+ additionalProperties: false,
219
+ },
220
+ MaxKey: {
221
+ type: 'object',
222
+ properties: {
223
+ $maxKey: {
224
+ type: 'integer',
225
+ const: 1,
226
+ },
227
+ },
228
+ required: ['$maxKey'],
229
+ additionalProperties: false,
230
+ },
231
+ Undefined: {
232
+ type: 'object',
233
+ properties: {
234
+ $undefined: {
235
+ type: 'boolean',
236
+ const: true,
237
+ },
238
+ },
239
+ required: ['$undefined'],
240
+ additionalProperties: false,
241
+ },
242
+ };
243
+ const createConvertInternalToStandard = function () {
244
+ const usedDefinitions = new Set();
245
+ function getUsedDefinitions() {
246
+ const filteredDefinitions = Object.fromEntries(Object.entries(exports.RELAXED_EJSON_DEFINITIONS).filter(([key]) => usedDefinitions.has(key)));
247
+ return Object.freeze(filteredDefinitions);
248
+ }
249
+ function markUsedDefinition(ref) {
250
+ usedDefinitions.add(ref.split('/')[2]);
251
+ }
252
+ function convertInternalType(internalType) {
253
+ const type = exports.InternalTypeToStandardTypeMap[internalType];
254
+ if (!type)
255
+ throw new Error(`Encountered unknown type: ${internalType}`);
256
+ return { ...type };
257
+ }
258
+ async function parseType(type, signal) {
259
+ await (0, util_1.allowAbort)(signal);
260
+ const schema = convertInternalType(type.bsonType);
261
+ if (schema.$ref)
262
+ markUsedDefinition(schema.$ref);
263
+ switch (type.bsonType) {
264
+ case 'Array':
265
+ schema.items = await parseTypes(type.types, signal);
266
+ break;
267
+ case 'Document':
268
+ Object.assign(schema, await parseFields(type.fields, signal));
269
+ break;
270
+ }
271
+ return schema;
272
+ }
273
+ function isPlainTypesOnly(types) {
274
+ return types.every((definition) => !!definition.type && Object.keys(definition).length === 1);
275
+ }
276
+ async function parseTypes(types, signal) {
277
+ await (0, util_1.allowAbort)(signal);
278
+ const definedTypes = types.filter((type) => type.bsonType.toLowerCase() !== 'undefined');
279
+ const isSingleType = definedTypes.length === 1;
280
+ if (isSingleType) {
281
+ return parseType(definedTypes[0], signal);
282
+ }
283
+ const parsedTypes = await Promise.all(definedTypes.map((type) => parseType(type, signal)));
284
+ if (isPlainTypesOnly(parsedTypes)) {
285
+ return {
286
+ type: parsedTypes.map(({ type }) => type),
287
+ };
288
+ }
289
+ return {
290
+ anyOf: parsedTypes,
291
+ };
292
+ }
293
+ async function parseFields(fields, signal) {
294
+ const required = [];
295
+ const properties = {};
296
+ for (const field of fields) {
297
+ if (field.probability === 1)
298
+ required.push(field.name);
299
+ properties[field.name] = await parseTypes(field.types, signal);
300
+ }
301
+ return { required, properties };
302
+ }
303
+ return async function convert(internalSchema, options = {}) {
304
+ const { required, properties } = await parseFields(internalSchema.fields, options.signal);
305
+ const schema = {
306
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
307
+ type: 'object',
308
+ required,
309
+ properties,
310
+ $defs: getUsedDefinitions(),
311
+ };
312
+ return schema;
313
+ };
314
+ };
315
+ function convertInternalToStandard(internalSchema, options = {}) {
316
+ return createConvertInternalToStandard()(internalSchema, options);
317
+ }
318
+ //# sourceMappingURL=internal-to-standard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-to-standard.js","sourceRoot":"","sources":["../../src/schema-converters/internal-to-standard.ts"],"names":[],"mappings":";;;AAmXA,8DAKC;AAhXD,kCAAqC;AAUxB,QAAA,6BAA6B,GAAwB;IAChE,MAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;IAClC,MAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;IAClC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC1B,QAAQ,EAAE,EAAE,IAAI,EAAE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xB,MAAoC,EACpC,MAAoB;QAKpB,MAAM,QAAQ,GAAG,EAAE,CAAC;QACpB,MAAM,UAAU,GAAqC,EAAE,CAAC;QACxD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,KAAK,CAAC,WAAW,KAAK,CAAC;gBAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACvD,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAClC,CAAC;IAED,OAAO,KAAK,UAAU,OAAO,CAC3B,cAA8B,EAC9B,UAAoC,EAAE;QAEtC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,MAAM,WAAW,CAChD,cAAc,CAAC,MAAM,EACrB,OAAO,CAAC,MAAM,CACf,CAAC;QACF,MAAM,MAAM,GAAuB;YACjC,OAAO,EAAE,8CAA8C;YACvD,IAAI,EAAE,QAAQ;YACd,QAAQ;YACR,UAAU;YACV,KAAK,EAAE,kBAAkB,EAAE;SAC5B,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,SAAgB,yBAAyB,CACvC,cAA8B,EAC9B,UAAoC,EAAE;IAEtC,OAAO,+BAA+B,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AACpE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function isEmail(value: any): boolean;
2
+ //# sourceMappingURL=email.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/semantic-types/email.ts"],"names":[],"mappings":"AAIA,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,WAEjC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEmail = isEmail;
4
+ const emailRegex = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;
5
+ function isEmail(value) {
6
+ return emailRegex.test(value);
7
+ }
8
+ //# sourceMappingURL=email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.js","sourceRoot":"","sources":["../../src/semantic-types/email.ts"],"names":[],"mappings":";;AAIA,0BAEC;AALD,MAAM,UAAU,GACd,uIAAuI,CAAC;AAE1I,SAAgB,OAAO,CAAC,KAAU;IAChC,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { isEmail } from './email';
2
+ declare const _default: {
3
+ Email: typeof isEmail;
4
+ };
5
+ export default _default;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/semantic-types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;;;;AAElC,wBAEE"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const email_1 = require("./email");
4
+ exports.default = {
5
+ Email: email_1.isEmail,
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/semantic-types/index.ts"],"names":[],"mappings":";;AAAA,mCAAkC;AAElC,kBAAe;IACb,KAAK,EAAE,eAAO;CACf,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Schema } from './schema-analyzer';
2
+ declare function widthRecursive(schema?: Schema): number;
3
+ declare function depthRecursive(schema?: Schema): number;
4
+ declare function branchingFactors(schema?: Schema): any[];
5
+ declare const _default: {
6
+ width: typeof widthRecursive;
7
+ depth: typeof depthRecursive;
8
+ branch: typeof branchingFactors;
9
+ };
10
+ export default _default;
11
+ //# sourceMappingURL=stats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../src/stats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAIP,MAAM,mBAAmB,CAAC;AAE3B,iBAAS,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,UA+BtC;AAED,iBAAS,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,UA8BtC;AAED,iBAAS,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,SA0BxC;;;;;;AAED,wBAIE"}