@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.
- package/README.md +13 -15
- package/activeRecord.cjs +1 -1
- package/activeRecord.d.cts +26 -0
- package/activeRecord.js +1 -1
- package/apiKey.d.cts +48 -0
- package/base64Url.d.cts +4 -0
- package/cache/cache.d.cts +17 -0
- package/cache/cookieCache.d.cts +22 -0
- package/cache/fallbackCache.d.cts +11 -0
- package/cache/inMemoryCache.d.cts +11 -0
- package/cache/index.cjs +5 -5
- package/cache/index.d.cts +4 -0
- package/cache/index.js +4 -4
- package/cache/localStorageCache.d.cts +19 -0
- package/channel/channel.cjs +1 -1
- package/channel/channel.d.cts +24 -0
- package/channel/channel.js +1 -1
- package/channel/encodedChannel.d.cts +12 -0
- package/channel/guaranteedChannel.cjs +2 -2
- package/channel/guaranteedChannel.d.cts +33 -0
- package/channel/guaranteedChannel.js +2 -2
- package/channel/httpBeaconChannel.cjs +5 -5
- package/channel/httpBeaconChannel.d.cts +26 -0
- package/channel/httpBeaconChannel.js +5 -5
- package/channel/index.cjs +8 -8
- package/channel/index.d.cts +12 -0
- package/channel/index.js +7 -7
- package/channel/queuedChannel.cjs +7 -3
- package/channel/queuedChannel.d.cts +21 -0
- package/channel/queuedChannel.js +7 -3
- package/channel/retryChannel.cjs +2 -2
- package/channel/retryChannel.d.cts +21 -0
- package/channel/retryChannel.js +2 -2
- package/channel/sandboxChannel.cjs +1 -1
- package/channel/sandboxChannel.d.cts +15 -0
- package/channel/sandboxChannel.js +1 -1
- package/cid/assigner.d.cts +5 -0
- package/cid/cachedAssigner.cjs +1 -1
- package/cid/cachedAssigner.d.cts +17 -0
- package/cid/cachedAssigner.js +1 -1
- package/cid/fixedAssigner.d.cts +9 -0
- package/cid/index.cjs +5 -5
- package/cid/index.d.cts +6 -0
- package/cid/index.js +4 -4
- package/cid/remoteAssigner.cjs +3 -3
- package/cid/remoteAssigner.d.cts +13 -0
- package/cid/remoteAssigner.js +3 -3
- package/constants.cjs +1 -1
- package/constants.d.cts +6 -0
- package/constants.d.ts +2 -2
- package/constants.js +1 -1
- package/container.cjs +18 -18
- package/container.d.cts +95 -0
- package/container.js +18 -18
- package/contentFetcher.cjs +4 -4
- package/contentFetcher.d.cts +69 -0
- package/contentFetcher.js +4 -4
- package/context.cjs +4 -4
- package/context.d.cts +36 -0
- package/context.js +4 -4
- package/error.d.cts +4 -0
- package/evaluator.cjs +5 -5
- package/evaluator.d.cts +86 -0
- package/evaluator.js +5 -5
- package/eventManager.d.cts +21 -0
- package/eventSubjectProcessor.d.cts +22 -0
- package/facade/contentFetcherFacade.cjs +2 -2
- package/facade/contentFetcherFacade.d.cts +36 -0
- package/facade/contentFetcherFacade.js +2 -2
- package/facade/evaluatorFacade.cjs +2 -2
- package/facade/evaluatorFacade.d.cts +41 -0
- package/facade/evaluatorFacade.js +2 -2
- package/facade/index.cjs +7 -9
- package/facade/index.d.cts +29 -0
- package/facade/index.js +7 -8
- package/facade/sdkFacade.cjs +10 -10
- package/facade/sdkFacade.d.cts +86 -0
- package/facade/sdkFacade.js +10 -10
- package/facade/sessionFacade.cjs +1 -1
- package/facade/sessionFacade.d.cts +22 -0
- package/facade/sessionFacade.js +1 -1
- package/facade/sessionPatch.cjs +1 -1
- package/facade/sessionPatch.d.cts +21 -0
- package/facade/sessionPatch.js +1 -1
- package/facade/trackerFacade.cjs +2 -2
- package/facade/trackerFacade.d.cts +25 -0
- package/facade/trackerFacade.js +2 -2
- package/facade/userFacade.cjs +1 -1
- package/facade/userFacade.d.cts +28 -0
- package/facade/userFacade.js +1 -1
- package/facade/userPatch.cjs +1 -1
- package/facade/userPatch.d.cts +21 -0
- package/facade/userPatch.js +1 -1
- package/help.d.cts +5 -0
- package/index.cjs +2 -4
- package/index.d.cts +25 -0
- package/index.js +2 -3
- package/logging/consoleLogger.d.cts +13 -0
- package/logging/filteredLogger.d.cts +22 -0
- package/logging/index.cjs +6 -6
- package/logging/index.d.cts +5 -0
- package/logging/index.js +5 -5
- package/logging/logger.d.cts +11 -0
- package/logging/namespacedLogger.d.cts +14 -0
- package/logging/nullLogger.d.cts +10 -0
- package/namespacedStorage.d.cts +16 -0
- package/package.json +4 -1
- package/patch.d.cts +46 -0
- package/queue/capacityRestrictedQueue.d.cts +16 -0
- package/queue/inMemoryQueue.d.cts +15 -0
- package/queue/index.cjs +6 -6
- package/queue/index.d.cts +6 -0
- package/queue/index.js +5 -5
- package/queue/monitoredQueue.cjs +1 -1
- package/queue/monitoredQueue.d.cts +28 -0
- package/queue/monitoredQueue.js +1 -1
- package/queue/persistentQueue.d.cts +18 -0
- package/queue/queue.d.cts +11 -0
- package/retry/arbitraryPolicy.d.cts +10 -0
- package/retry/backoffPolicy.d.cts +26 -0
- package/retry/index.cjs +6 -6
- package/retry/index.d.cts +5 -0
- package/retry/index.js +5 -5
- package/retry/maxAttemptsPolicy.d.cts +11 -0
- package/retry/neverPolicy.d.cts +8 -0
- package/retry/policy.d.cts +6 -0
- package/schema/attributeSchema.cjs +1 -1
- package/schema/attributeSchema.d.cts +6 -0
- package/schema/attributeSchema.js +1 -1
- package/schema/contentFetcherSchemas.cjs +1 -1
- package/schema/contentFetcherSchemas.d.cts +6 -0
- package/schema/contentFetcherSchemas.js +1 -1
- package/schema/contentSchemas.cjs +1 -1
- package/schema/contentSchemas.d.cts +6 -0
- package/schema/contentSchemas.js +1 -1
- package/schema/contextSchemas.cjs +1 -1
- package/schema/contextSchemas.d.cts +6 -0
- package/schema/contextSchemas.js +1 -1
- package/schema/ecommerceSchemas.cjs +1 -1
- package/schema/ecommerceSchemas.d.cts +10 -0
- package/schema/ecommerceSchemas.js +1 -1
- package/schema/evaluatorSchemas.cjs +1 -1
- package/schema/evaluatorSchemas.d.cts +6 -0
- package/schema/evaluatorSchemas.js +1 -1
- package/schema/eventSchemas.cjs +4 -4
- package/schema/eventSchemas.d.cts +16 -0
- package/schema/eventSchemas.js +4 -4
- package/schema/index.cjs +22 -22
- package/schema/index.d.cts +14 -0
- package/schema/index.js +11 -11
- package/schema/loggerSchema.cjs +1 -1
- package/schema/loggerSchema.d.cts +6 -0
- package/schema/loggerSchema.js +1 -1
- package/schema/operationSchemas.cjs +2 -2
- package/schema/operationSchemas.d.cts +14 -0
- package/schema/operationSchemas.js +2 -2
- package/schema/sdkFacadeSchemas.cjs +4 -4
- package/schema/sdkFacadeSchemas.d.cts +6 -0
- package/schema/sdkFacadeSchemas.js +4 -4
- package/schema/sdkSchemas.cjs +3 -3
- package/schema/sdkSchemas.d.cts +8 -0
- package/schema/sdkSchemas.js +3 -3
- package/schema/tokenSchema.cjs +1 -1
- package/schema/tokenSchema.d.cts +6 -0
- package/schema/tokenSchema.js +1 -1
- package/schema/userSchema.cjs +2 -2
- package/schema/userSchema.d.cts +6 -0
- package/schema/userSchema.js +2 -2
- package/sdk.cjs +4 -4
- package/sdk.d.cts +69 -0
- package/sdk.js +4 -4
- package/sdkEvents.d.cts +15 -0
- package/sourceLocation.d.cts +14 -0
- package/tab.cjs +1 -1
- package/tab.d.cts +40 -0
- package/tab.js +1 -1
- package/token/cachedTokenStore.cjs +1 -1
- package/token/cachedTokenStore.d.cts +13 -0
- package/token/cachedTokenStore.js +1 -1
- package/token/inMemoryTokenStore.d.cts +11 -0
- package/token/index.cjs +5 -5
- package/token/index.d.cts +7 -0
- package/token/index.js +4 -4
- package/token/replicatedTokenStore.d.cts +13 -0
- package/token/token.cjs +3 -3
- package/token/token.d.cts +70 -0
- package/token/token.js +3 -3
- package/tracker.cjs +3 -3
- package/tracker.d.cts +82 -0
- package/tracker.js +3 -3
- package/trackingEvents.d.cts +309 -0
- package/transformer.d.cts +6 -0
- package/utilityTypes.d.cts +4 -0
- package/uuid.d.cts +3 -0
- package/validation/arrayType.cjs +2 -2
- package/validation/arrayType.d.cts +16 -0
- package/validation/arrayType.js +2 -2
- package/validation/booleanType.cjs +2 -2
- package/validation/booleanType.d.cts +9 -0
- package/validation/booleanType.js +2 -2
- package/validation/functionType.cjs +2 -2
- package/validation/functionType.d.cts +9 -0
- package/validation/functionType.js +2 -2
- package/validation/index.cjs +14 -14
- package/validation/index.d.cts +12 -0
- package/validation/index.js +12 -12
- package/validation/jsonType.cjs +2 -2
- package/validation/jsonType.d.cts +35 -0
- package/validation/jsonType.js +2 -2
- package/validation/mixedSchema.d.cts +7 -0
- package/validation/nullType.cjs +2 -2
- package/validation/nullType.d.cts +9 -0
- package/validation/nullType.js +2 -2
- package/validation/numberType.cjs +2 -2
- package/validation/numberType.d.cts +16 -0
- package/validation/numberType.js +2 -2
- package/validation/objectType.cjs +3 -3
- package/validation/objectType.d.cts +30 -0
- package/validation/objectType.js +3 -3
- package/validation/schema.d.cts +18 -0
- package/validation/stringType.cjs +2 -2
- package/validation/stringType.d.cts +24 -0
- package/validation/stringType.js +2 -2
- package/validation/unionType.cjs +2 -2
- package/validation/unionType.d.cts +11 -0
- package/validation/unionType.js +2 -2
- package/validation/violation.d.cts +4 -0
package/validation/index.cjs
CHANGED
|
@@ -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(
|
|
37
|
-
__reExport(validation_exports, require(
|
|
38
|
-
var import_arrayType = require(
|
|
39
|
-
var import_booleanType = require(
|
|
40
|
-
var import_functionType = require(
|
|
41
|
-
var import_jsonType = require(
|
|
42
|
-
var import_mixedSchema = require(
|
|
43
|
-
var import_nullType = require(
|
|
44
|
-
var import_numberType = require(
|
|
45
|
-
var import_objectType = require(
|
|
46
|
-
var import_stringType = require(
|
|
47
|
-
var import_unionType = require(
|
|
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(
|
|
64
|
-
...require(
|
|
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';
|
package/validation/index.js
CHANGED
|
@@ -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,
|
package/validation/jsonType.cjs
CHANGED
|
@@ -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(
|
|
27
|
-
var import_violation = require(
|
|
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 };
|
package/validation/jsonType.js
CHANGED
|
@@ -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
|
}
|
package/validation/nullType.cjs
CHANGED
|
@@ -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(
|
|
24
|
-
var import_violation = require(
|
|
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"];
|
package/validation/nullType.js
CHANGED
|
@@ -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(
|
|
24
|
-
var import_violation = require(
|
|
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 };
|
package/validation/numberType.js
CHANGED
|
@@ -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(
|
|
24
|
-
var import_mixedSchema = require(
|
|
25
|
-
var import_violation = require(
|
|
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 };
|
package/validation/objectType.js
CHANGED
|
@@ -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(
|
|
24
|
-
var import_violation = require(
|
|
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 };
|
package/validation/stringType.js
CHANGED
|
@@ -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);
|
package/validation/unionType.cjs
CHANGED
|
@@ -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(
|
|
24
|
-
var import_violation = require(
|
|
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 };
|
package/validation/unionType.js
CHANGED
|
@@ -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];
|