@croct/sdk 0.17.12 → 0.18.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 (227) hide show
  1. package/README.md +13 -15
  2. package/activeRecord.cjs +1 -1
  3. package/activeRecord.d.cts +26 -0
  4. package/activeRecord.js +1 -1
  5. package/apiKey.d.cts +48 -0
  6. package/base64Url.d.cts +4 -0
  7. package/cache/cache.d.cts +17 -0
  8. package/cache/cookieCache.d.cts +22 -0
  9. package/cache/fallbackCache.d.cts +11 -0
  10. package/cache/inMemoryCache.d.cts +11 -0
  11. package/cache/index.cjs +5 -5
  12. package/cache/index.d.cts +4 -0
  13. package/cache/index.js +4 -4
  14. package/cache/localStorageCache.d.cts +19 -0
  15. package/channel/channel.cjs +1 -1
  16. package/channel/channel.d.cts +24 -0
  17. package/channel/channel.js +1 -1
  18. package/channel/encodedChannel.d.cts +12 -0
  19. package/channel/guaranteedChannel.cjs +2 -2
  20. package/channel/guaranteedChannel.d.cts +33 -0
  21. package/channel/guaranteedChannel.js +2 -2
  22. package/channel/httpBeaconChannel.cjs +5 -5
  23. package/channel/httpBeaconChannel.d.cts +26 -0
  24. package/channel/httpBeaconChannel.js +5 -5
  25. package/channel/index.cjs +8 -8
  26. package/channel/index.d.cts +12 -0
  27. package/channel/index.js +7 -7
  28. package/channel/queuedChannel.cjs +7 -3
  29. package/channel/queuedChannel.d.cts +21 -0
  30. package/channel/queuedChannel.js +7 -3
  31. package/channel/retryChannel.cjs +2 -2
  32. package/channel/retryChannel.d.cts +21 -0
  33. package/channel/retryChannel.js +2 -2
  34. package/channel/sandboxChannel.cjs +1 -1
  35. package/channel/sandboxChannel.d.cts +15 -0
  36. package/channel/sandboxChannel.js +1 -1
  37. package/cid/assigner.d.cts +5 -0
  38. package/cid/cachedAssigner.cjs +1 -1
  39. package/cid/cachedAssigner.d.cts +17 -0
  40. package/cid/cachedAssigner.js +1 -1
  41. package/cid/fixedAssigner.d.cts +9 -0
  42. package/cid/index.cjs +5 -5
  43. package/cid/index.d.cts +6 -0
  44. package/cid/index.js +4 -4
  45. package/cid/remoteAssigner.cjs +3 -3
  46. package/cid/remoteAssigner.d.cts +13 -0
  47. package/cid/remoteAssigner.js +3 -3
  48. package/constants.cjs +1 -1
  49. package/constants.d.cts +6 -0
  50. package/constants.d.ts +2 -2
  51. package/constants.js +1 -1
  52. package/container.cjs +18 -18
  53. package/container.d.cts +95 -0
  54. package/container.js +18 -18
  55. package/contentFetcher.cjs +4 -4
  56. package/contentFetcher.d.cts +69 -0
  57. package/contentFetcher.js +4 -4
  58. package/context.cjs +4 -4
  59. package/context.d.cts +36 -0
  60. package/context.js +4 -4
  61. package/error.d.cts +4 -0
  62. package/evaluator.cjs +5 -5
  63. package/evaluator.d.cts +86 -0
  64. package/evaluator.js +5 -5
  65. package/eventManager.d.cts +21 -0
  66. package/eventSubjectProcessor.d.cts +22 -0
  67. package/facade/contentFetcherFacade.cjs +2 -2
  68. package/facade/contentFetcherFacade.d.cts +36 -0
  69. package/facade/contentFetcherFacade.js +2 -2
  70. package/facade/evaluatorFacade.cjs +2 -2
  71. package/facade/evaluatorFacade.d.cts +41 -0
  72. package/facade/evaluatorFacade.js +2 -2
  73. package/facade/index.cjs +7 -9
  74. package/facade/index.d.cts +29 -0
  75. package/facade/index.js +7 -8
  76. package/facade/sdkFacade.cjs +10 -10
  77. package/facade/sdkFacade.d.cts +86 -0
  78. package/facade/sdkFacade.js +10 -10
  79. package/facade/sessionFacade.cjs +1 -1
  80. package/facade/sessionFacade.d.cts +22 -0
  81. package/facade/sessionFacade.js +1 -1
  82. package/facade/sessionPatch.cjs +1 -1
  83. package/facade/sessionPatch.d.cts +21 -0
  84. package/facade/sessionPatch.js +1 -1
  85. package/facade/trackerFacade.cjs +2 -2
  86. package/facade/trackerFacade.d.cts +25 -0
  87. package/facade/trackerFacade.js +2 -2
  88. package/facade/userFacade.cjs +1 -1
  89. package/facade/userFacade.d.cts +28 -0
  90. package/facade/userFacade.js +1 -1
  91. package/facade/userPatch.cjs +1 -1
  92. package/facade/userPatch.d.cts +21 -0
  93. package/facade/userPatch.js +1 -1
  94. package/help.d.cts +5 -0
  95. package/index.cjs +2 -4
  96. package/index.d.cts +25 -0
  97. package/index.js +2 -3
  98. package/logging/consoleLogger.d.cts +13 -0
  99. package/logging/filteredLogger.d.cts +22 -0
  100. package/logging/index.cjs +6 -6
  101. package/logging/index.d.cts +5 -0
  102. package/logging/index.js +5 -5
  103. package/logging/logger.d.cts +11 -0
  104. package/logging/namespacedLogger.d.cts +14 -0
  105. package/logging/nullLogger.d.cts +10 -0
  106. package/namespacedStorage.d.cts +16 -0
  107. package/package.json +4 -1
  108. package/patch.d.cts +46 -0
  109. package/queue/capacityRestrictedQueue.d.cts +16 -0
  110. package/queue/inMemoryQueue.d.cts +15 -0
  111. package/queue/index.cjs +6 -6
  112. package/queue/index.d.cts +6 -0
  113. package/queue/index.js +5 -5
  114. package/queue/monitoredQueue.cjs +1 -1
  115. package/queue/monitoredQueue.d.cts +28 -0
  116. package/queue/monitoredQueue.js +1 -1
  117. package/queue/persistentQueue.d.cts +18 -0
  118. package/queue/queue.d.cts +11 -0
  119. package/retry/arbitraryPolicy.d.cts +10 -0
  120. package/retry/backoffPolicy.d.cts +26 -0
  121. package/retry/index.cjs +6 -6
  122. package/retry/index.d.cts +5 -0
  123. package/retry/index.js +5 -5
  124. package/retry/maxAttemptsPolicy.d.cts +11 -0
  125. package/retry/neverPolicy.d.cts +8 -0
  126. package/retry/policy.d.cts +6 -0
  127. package/schema/attributeSchema.cjs +1 -1
  128. package/schema/attributeSchema.d.cts +6 -0
  129. package/schema/attributeSchema.js +1 -1
  130. package/schema/contentFetcherSchemas.cjs +1 -1
  131. package/schema/contentFetcherSchemas.d.cts +6 -0
  132. package/schema/contentFetcherSchemas.js +1 -1
  133. package/schema/contentSchemas.cjs +1 -1
  134. package/schema/contentSchemas.d.cts +6 -0
  135. package/schema/contentSchemas.js +1 -1
  136. package/schema/contextSchemas.cjs +1 -1
  137. package/schema/contextSchemas.d.cts +6 -0
  138. package/schema/contextSchemas.js +1 -1
  139. package/schema/ecommerceSchemas.cjs +1 -1
  140. package/schema/ecommerceSchemas.d.cts +10 -0
  141. package/schema/ecommerceSchemas.js +1 -1
  142. package/schema/evaluatorSchemas.cjs +1 -1
  143. package/schema/evaluatorSchemas.d.cts +6 -0
  144. package/schema/evaluatorSchemas.js +1 -1
  145. package/schema/eventSchemas.cjs +4 -4
  146. package/schema/eventSchemas.d.cts +16 -0
  147. package/schema/eventSchemas.js +4 -4
  148. package/schema/index.cjs +22 -22
  149. package/schema/index.d.cts +14 -0
  150. package/schema/index.js +11 -11
  151. package/schema/loggerSchema.cjs +1 -1
  152. package/schema/loggerSchema.d.cts +6 -0
  153. package/schema/loggerSchema.js +1 -1
  154. package/schema/operationSchemas.cjs +2 -2
  155. package/schema/operationSchemas.d.cts +14 -0
  156. package/schema/operationSchemas.js +2 -2
  157. package/schema/sdkFacadeSchemas.cjs +4 -4
  158. package/schema/sdkFacadeSchemas.d.cts +6 -0
  159. package/schema/sdkFacadeSchemas.js +4 -4
  160. package/schema/sdkSchemas.cjs +3 -3
  161. package/schema/sdkSchemas.d.cts +8 -0
  162. package/schema/sdkSchemas.js +3 -3
  163. package/schema/tokenSchema.cjs +1 -1
  164. package/schema/tokenSchema.d.cts +6 -0
  165. package/schema/tokenSchema.js +1 -1
  166. package/schema/userSchema.cjs +2 -2
  167. package/schema/userSchema.d.cts +6 -0
  168. package/schema/userSchema.js +2 -2
  169. package/sdk.cjs +4 -4
  170. package/sdk.d.cts +69 -0
  171. package/sdk.js +4 -4
  172. package/sdkEvents.d.cts +15 -0
  173. package/sourceLocation.d.cts +14 -0
  174. package/tab.cjs +1 -1
  175. package/tab.d.cts +40 -0
  176. package/tab.js +1 -1
  177. package/token/cachedTokenStore.cjs +1 -1
  178. package/token/cachedTokenStore.d.cts +13 -0
  179. package/token/cachedTokenStore.js +1 -1
  180. package/token/inMemoryTokenStore.d.cts +11 -0
  181. package/token/index.cjs +5 -5
  182. package/token/index.d.cts +7 -0
  183. package/token/index.js +4 -4
  184. package/token/replicatedTokenStore.d.cts +13 -0
  185. package/token/token.cjs +3 -3
  186. package/token/token.d.cts +70 -0
  187. package/token/token.js +3 -3
  188. package/tracker.cjs +3 -3
  189. package/tracker.d.cts +82 -0
  190. package/tracker.js +3 -3
  191. package/trackingEvents.d.cts +309 -0
  192. package/transformer.d.cts +6 -0
  193. package/utilityTypes.d.cts +4 -0
  194. package/uuid.d.cts +3 -0
  195. package/validation/arrayType.cjs +2 -2
  196. package/validation/arrayType.d.cts +16 -0
  197. package/validation/arrayType.js +2 -2
  198. package/validation/booleanType.cjs +2 -2
  199. package/validation/booleanType.d.cts +9 -0
  200. package/validation/booleanType.js +2 -2
  201. package/validation/functionType.cjs +2 -2
  202. package/validation/functionType.d.cts +9 -0
  203. package/validation/functionType.js +2 -2
  204. package/validation/index.cjs +14 -14
  205. package/validation/index.d.cts +12 -0
  206. package/validation/index.js +12 -12
  207. package/validation/jsonType.cjs +2 -2
  208. package/validation/jsonType.d.cts +35 -0
  209. package/validation/jsonType.js +2 -2
  210. package/validation/mixedSchema.d.cts +7 -0
  211. package/validation/nullType.cjs +2 -2
  212. package/validation/nullType.d.cts +9 -0
  213. package/validation/nullType.js +2 -2
  214. package/validation/numberType.cjs +2 -2
  215. package/validation/numberType.d.cts +16 -0
  216. package/validation/numberType.js +2 -2
  217. package/validation/objectType.cjs +3 -3
  218. package/validation/objectType.d.cts +30 -0
  219. package/validation/objectType.js +3 -3
  220. package/validation/schema.d.cts +18 -0
  221. package/validation/stringType.cjs +2 -2
  222. package/validation/stringType.d.cts +24 -0
  223. package/validation/stringType.js +2 -2
  224. package/validation/unionType.cjs +2 -2
  225. package/validation/unionType.d.cts +11 -0
  226. package/validation/unionType.js +2 -2
  227. package/validation/violation.d.cts +4 -0
@@ -0,0 +1,9 @@
1
+ import { TypeSchema } from './schema.cjs';
2
+
3
+ declare class FunctionType implements TypeSchema {
4
+ getTypes(): string[];
5
+ isValidType(value: unknown): value is boolean;
6
+ validate(value: unknown, path?: string[]): void;
7
+ }
8
+
9
+ export { FunctionType };
@@ -1,5 +1,5 @@
1
- import { Violation } from "./schema";
2
- import { describe, formatPath } from "./violation";
1
+ import { Violation } from "./schema.js";
2
+ import { describe, formatPath } from "./violation.js";
3
3
  class FunctionType {
4
4
  getTypes() {
5
5
  return ["function"];
@@ -33,18 +33,18 @@ __export(validation_exports, {
33
33
  UnionType: () => import_unionType.UnionType
34
34
  });
35
35
  module.exports = __toCommonJS(validation_exports);
36
- __reExport(validation_exports, require("./schema"), module.exports);
37
- __reExport(validation_exports, require("./violation"), module.exports);
38
- var import_arrayType = require("./arrayType");
39
- var import_booleanType = require("./booleanType");
40
- var import_functionType = require("./functionType");
41
- var import_jsonType = require("./jsonType");
42
- var import_mixedSchema = require("./mixedSchema");
43
- var import_nullType = require("./nullType");
44
- var import_numberType = require("./numberType");
45
- var import_objectType = require("./objectType");
46
- var import_stringType = require("./stringType");
47
- var import_unionType = require("./unionType");
36
+ __reExport(validation_exports, require('./schema.cjs'), module.exports);
37
+ __reExport(validation_exports, require('./violation.cjs'), module.exports);
38
+ var import_arrayType = require('./arrayType.cjs');
39
+ var import_booleanType = require('./booleanType.cjs');
40
+ var import_functionType = require('./functionType.cjs');
41
+ var import_jsonType = require('./jsonType.cjs');
42
+ var import_mixedSchema = require('./mixedSchema.cjs');
43
+ var import_nullType = require('./nullType.cjs');
44
+ var import_numberType = require('./numberType.cjs');
45
+ var import_objectType = require('./objectType.cjs');
46
+ var import_stringType = require('./stringType.cjs');
47
+ var import_unionType = require('./unionType.cjs');
48
48
  // Annotate the CommonJS export names for ESM import in node:
49
49
  0 && (module.exports = {
50
50
  ArrayType,
@@ -60,6 +60,6 @@ var import_unionType = require("./unionType");
60
60
  ObjectType,
61
61
  StringType,
62
62
  UnionType,
63
- ...require("./schema"),
64
- ...require("./violation")
63
+ ...require('./schema.cjs'),
64
+ ...require('./violation.cjs')
65
65
  });
@@ -0,0 +1,12 @@
1
+ export { Schema, TypeSchema, Violation } from './schema.cjs';
2
+ export { describe, formatPath } from './violation.cjs';
3
+ export { ArrayType } from './arrayType.cjs';
4
+ export { BooleanType } from './booleanType.cjs';
5
+ export { FunctionType } from './functionType.cjs';
6
+ export { JsonArrayType, JsonObjectType, JsonPrimitiveType, JsonType } from './jsonType.cjs';
7
+ export { MixedSchema } from './mixedSchema.cjs';
8
+ export { NullType } from './nullType.cjs';
9
+ export { NumberType } from './numberType.cjs';
10
+ export { ObjectType } from './objectType.cjs';
11
+ export { StringType } from './stringType.cjs';
12
+ export { UnionType } from './unionType.cjs';
@@ -1,15 +1,15 @@
1
- export * from "./schema";
2
- export * from "./violation";
3
- import { ArrayType } from "./arrayType";
4
- import { BooleanType } from "./booleanType";
5
- import { FunctionType } from "./functionType";
6
- import { JsonType, JsonArrayType, JsonObjectType, JsonPrimitiveType } from "./jsonType";
7
- import { MixedSchema } from "./mixedSchema";
8
- import { NullType } from "./nullType";
9
- import { NumberType } from "./numberType";
10
- import { ObjectType } from "./objectType";
11
- import { StringType } from "./stringType";
12
- import { UnionType } from "./unionType";
1
+ export * from "./schema.js";
2
+ export * from "./violation.js";
3
+ import { ArrayType } from "./arrayType.js";
4
+ import { BooleanType } from "./booleanType.js";
5
+ import { FunctionType } from "./functionType.js";
6
+ import { JsonType, JsonArrayType, JsonObjectType, JsonPrimitiveType } from "./jsonType.js";
7
+ import { MixedSchema } from "./mixedSchema.js";
8
+ import { NullType } from "./nullType.js";
9
+ import { NumberType } from "./numberType.js";
10
+ import { ObjectType } from "./objectType.js";
11
+ import { StringType } from "./stringType.js";
12
+ import { UnionType } from "./unionType.js";
13
13
  export {
14
14
  ArrayType,
15
15
  BooleanType,
@@ -23,8 +23,8 @@ __export(jsonType_exports, {
23
23
  JsonType: () => JsonType
24
24
  });
25
25
  module.exports = __toCommonJS(jsonType_exports);
26
- var import_schema = require("./schema");
27
- var import_violation = require("./violation");
26
+ var import_schema = require('./schema.cjs');
27
+ var import_violation = require('./violation.cjs');
28
28
  function isJsonPrimitive(value) {
29
29
  return value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number";
30
30
  }
@@ -0,0 +1,35 @@
1
+ import { TypeSchema, Schema } from './schema.cjs';
2
+
3
+ type JsonObjectDefinition = {
4
+ properties?: Schema;
5
+ propertyNames?: Schema;
6
+ };
7
+ declare class JsonObjectType implements TypeSchema {
8
+ private readonly definition;
9
+ constructor(definition?: JsonObjectDefinition);
10
+ getTypes(): string[];
11
+ isValidType(value: unknown): boolean;
12
+ validate(value: unknown, path?: string[]): void;
13
+ }
14
+ type JsonArrayDefinition = {
15
+ items?: Schema;
16
+ };
17
+ declare class JsonArrayType implements TypeSchema {
18
+ private readonly definition;
19
+ constructor(definition?: JsonArrayDefinition);
20
+ getTypes(): string[];
21
+ isValidType(value: unknown): boolean;
22
+ validate(value: unknown, path?: string[]): void;
23
+ }
24
+ declare class JsonPrimitiveType implements TypeSchema {
25
+ getTypes(): string[];
26
+ isValidType(value: unknown): boolean;
27
+ validate(value: unknown, path?: string[]): void;
28
+ }
29
+ declare class JsonType implements TypeSchema {
30
+ getTypes(): string[];
31
+ isValidType(value: unknown): boolean;
32
+ validate(value: unknown, path?: string[]): void;
33
+ }
34
+
35
+ export { JsonArrayType, JsonObjectType, JsonPrimitiveType, JsonType };
@@ -1,5 +1,5 @@
1
- import { Violation } from "./schema";
2
- import { describe, formatPath } from "./violation";
1
+ import { Violation } from "./schema.js";
2
+ import { describe, formatPath } from "./violation.js";
3
3
  function isJsonPrimitive(value) {
4
4
  return value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number";
5
5
  }
@@ -0,0 +1,7 @@
1
+ import { Schema } from './schema.cjs';
2
+
3
+ declare class MixedSchema implements Schema {
4
+ validate(): void;
5
+ }
6
+
7
+ export { MixedSchema };
@@ -20,8 +20,8 @@ __export(nullType_exports, {
20
20
  NullType: () => NullType
21
21
  });
22
22
  module.exports = __toCommonJS(nullType_exports);
23
- var import_schema = require("./schema");
24
- var import_violation = require("./violation");
23
+ var import_schema = require('./schema.cjs');
24
+ var import_violation = require('./violation.cjs');
25
25
  class NullType {
26
26
  getTypes() {
27
27
  return ["null"];
@@ -0,0 +1,9 @@
1
+ import { TypeSchema } from './schema.cjs';
2
+
3
+ declare class NullType implements TypeSchema {
4
+ getTypes(): string[];
5
+ isValidType(value: unknown): value is null;
6
+ validate(value: unknown, path?: string[]): void;
7
+ }
8
+
9
+ export { NullType };
@@ -1,5 +1,5 @@
1
- import { Violation } from "./schema";
2
- import { describe, formatPath } from "./violation";
1
+ import { Violation } from "./schema.js";
2
+ import { describe, formatPath } from "./violation.js";
3
3
  class NullType {
4
4
  getTypes() {
5
5
  return ["null"];
@@ -20,8 +20,8 @@ __export(numberType_exports, {
20
20
  NumberType: () => NumberType
21
21
  });
22
22
  module.exports = __toCommonJS(numberType_exports);
23
- var import_schema = require("./schema");
24
- var import_violation = require("./violation");
23
+ var import_schema = require('./schema.cjs');
24
+ var import_violation = require('./violation.cjs');
25
25
  class NumberType {
26
26
  constructor(definition = {}) {
27
27
  this.definition = {
@@ -0,0 +1,16 @@
1
+ import { TypeSchema } from './schema.cjs';
2
+
3
+ type NumberDefinition = {
4
+ integer: boolean;
5
+ minimum: number;
6
+ maximum: number;
7
+ };
8
+ declare class NumberType implements TypeSchema {
9
+ private readonly definition;
10
+ constructor(definition?: Partial<NumberDefinition>);
11
+ getTypes(): string[];
12
+ isValidType(value: unknown): value is number;
13
+ validate(value: unknown, path?: string[]): void;
14
+ }
15
+
16
+ export { NumberType };
@@ -1,5 +1,5 @@
1
- import { Violation } from "./schema";
2
- import { describe, formatPath } from "./violation";
1
+ import { Violation } from "./schema.js";
2
+ import { describe, formatPath } from "./violation.js";
3
3
  class NumberType {
4
4
  constructor(definition = {}) {
5
5
  this.definition = {
@@ -20,9 +20,9 @@ __export(objectType_exports, {
20
20
  ObjectType: () => ObjectType
21
21
  });
22
22
  module.exports = __toCommonJS(objectType_exports);
23
- var import_schema = require("./schema");
24
- var import_mixedSchema = require("./mixedSchema");
25
- var import_violation = require("./violation");
23
+ var import_schema = require('./schema.cjs');
24
+ var import_mixedSchema = require('./mixedSchema.cjs');
25
+ var import_violation = require('./violation.cjs');
26
26
  class ObjectType {
27
27
  constructor(schema = {}) {
28
28
  this.definition = {
@@ -0,0 +1,30 @@
1
+ import { TypeSchema, Schema } from './schema.cjs';
2
+
3
+ type ObjectDefinition = {
4
+ type?: {
5
+ new (...args: any): any;
6
+ };
7
+ properties: {
8
+ [key: string]: Schema;
9
+ };
10
+ additionalProperties: boolean | Schema;
11
+ subtypes?: {
12
+ discriminator: string;
13
+ schemas: {
14
+ [key: string]: ObjectType;
15
+ };
16
+ };
17
+ propertyNames: Schema;
18
+ required: string[];
19
+ minProperties: number;
20
+ maxProperties: number;
21
+ };
22
+ declare class ObjectType implements TypeSchema {
23
+ private readonly definition;
24
+ constructor(schema?: Partial<ObjectDefinition>);
25
+ getTypes(): string[];
26
+ isValidType(value: unknown): value is object;
27
+ validate(value: unknown, path?: string[]): void;
28
+ }
29
+
30
+ export { ObjectType };
@@ -1,6 +1,6 @@
1
- import { Violation } from "./schema";
2
- import { MixedSchema } from "./mixedSchema";
3
- import { describe, formatPath } from "./violation";
1
+ import { Violation } from "./schema.js";
2
+ import { MixedSchema } from "./mixedSchema.js";
3
+ import { describe, formatPath } from "./violation.js";
4
4
  class ObjectType {
5
5
  constructor(schema = {}) {
6
6
  this.definition = {
@@ -0,0 +1,18 @@
1
+ interface Schema {
2
+ validate(value: unknown, path?: string[]): void;
3
+ }
4
+ interface TypeSchema extends Schema {
5
+ getTypes(): string[];
6
+ isValidType(value: unknown): boolean;
7
+ }
8
+ declare class Violation extends Error {
9
+ readonly path: string[];
10
+ readonly params: {
11
+ [key: string]: unknown;
12
+ };
13
+ constructor(message: string, path: string[], params: {
14
+ [p: string]: unknown;
15
+ });
16
+ }
17
+
18
+ export { type Schema, type TypeSchema, Violation };
@@ -20,8 +20,8 @@ __export(stringType_exports, {
20
20
  StringType: () => StringType
21
21
  });
22
22
  module.exports = __toCommonJS(stringType_exports);
23
- var import_schema = require("./schema");
24
- var import_violation = require("./violation");
23
+ var import_schema = require('./schema.cjs');
24
+ var import_violation = require('./violation.cjs');
25
25
  const FORMAT = {
26
26
  pointer: function pointer(value) {
27
27
  return /^(\.|([a-zA-Z_][a-zA-Z0-9_]*|\[[0-9]+])(\.[a-zA-Z_][a-zA-Z0-9_]*|\[[0-9]+])*)$/.test(value);
@@ -0,0 +1,24 @@
1
+ import { TypeSchema } from './schema.cjs';
2
+
3
+ interface Format {
4
+ (value: string): boolean;
5
+ }
6
+ declare const FORMAT: {
7
+ [key: string]: Format;
8
+ };
9
+ type StringDefinition = {
10
+ minLength: number;
11
+ maxLength: number;
12
+ enumeration: string[];
13
+ pattern?: RegExp;
14
+ format?: keyof typeof FORMAT;
15
+ };
16
+ declare class StringType implements TypeSchema {
17
+ private readonly definition;
18
+ constructor(definition?: Partial<StringDefinition>);
19
+ getTypes(): string[];
20
+ isValidType(value: unknown): value is string;
21
+ validate(value: unknown, path?: string[]): void;
22
+ }
23
+
24
+ export { StringType };
@@ -1,5 +1,5 @@
1
- import { Violation } from "./schema";
2
- import { describe, formatPath } from "./violation";
1
+ import { Violation } from "./schema.js";
2
+ import { describe, formatPath } from "./violation.js";
3
3
  const FORMAT = {
4
4
  pointer: function pointer(value) {
5
5
  return /^(\.|([a-zA-Z_][a-zA-Z0-9_]*|\[[0-9]+])(\.[a-zA-Z_][a-zA-Z0-9_]*|\[[0-9]+])*)$/.test(value);
@@ -20,8 +20,8 @@ __export(unionType_exports, {
20
20
  UnionType: () => UnionType
21
21
  });
22
22
  module.exports = __toCommonJS(unionType_exports);
23
- var import_schema = require("./schema");
24
- var import_violation = require("./violation");
23
+ var import_schema = require('./schema.cjs');
24
+ var import_violation = require('./violation.cjs');
25
25
  class UnionType {
26
26
  constructor(first, second, ...others) {
27
27
  this.schemas = [first, second, ...others];
@@ -0,0 +1,11 @@
1
+ import { TypeSchema } from './schema.cjs';
2
+
3
+ declare class UnionType implements TypeSchema {
4
+ private readonly schemas;
5
+ constructor(first: TypeSchema, second: TypeSchema, ...others: TypeSchema[]);
6
+ getTypes(): string[];
7
+ isValidType(value: unknown): boolean;
8
+ validate(value: unknown, path?: string[]): void;
9
+ }
10
+
11
+ export { UnionType };
@@ -1,5 +1,5 @@
1
- import { Violation } from "./schema";
2
- import { describe, formatPath } from "./violation";
1
+ import { Violation } from "./schema.js";
2
+ import { describe, formatPath } from "./violation.js";
3
3
  class UnionType {
4
4
  constructor(first, second, ...others) {
5
5
  this.schemas = [first, second, ...others];
@@ -0,0 +1,4 @@
1
+ declare function describe(value: unknown): string;
2
+ declare function formatPath(path: string[]): string;
3
+
4
+ export { describe, formatPath };