@tstdl/base 0.78.0-beta1 → 0.78.0-beta10
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/api/server/gateway.js +3 -0
- package/api/server/gateway.js.map +1 -1
- package/api/types.d.ts +11 -8
- package/api/types.js.map +1 -1
- package/container/container.js.map +1 -1
- package/container/resolve-chain.d.ts +5 -5
- package/container/resolve-chain.js.map +1 -1
- package/database/mongo/mongo-base.repository.js.map +1 -1
- package/database/mongo/types.d.ts +2 -2
- package/enumerable/async-enumerable.d.ts +2 -1
- package/enumerable/async-enumerable.js +3 -0
- package/enumerable/async-enumerable.js.map +1 -1
- package/enumerable/enumerable-methods.d.ts +1 -0
- package/enumerable/enumerable.d.ts +1 -0
- package/enumerable/enumerable.js +12 -18
- package/enumerable/enumerable.js.map +1 -1
- package/http/client/adapters/utils.js.map +1 -1
- package/key-value-store/mongo/mongo-key-value.model.d.ts +1 -0
- package/mail/template-providers/file-mail-template.provider.js +2 -2
- package/mail/template-providers/file-mail-template.provider.js.map +1 -1
- package/package.json +5 -6
- package/promise/deferred-promise.d.ts +2 -15
- package/promise/deferred-promise.js +5 -10
- package/promise/deferred-promise.js.map +1 -1
- package/promise/lazy-promise.d.ts +11 -0
- package/promise/lazy-promise.js +31 -0
- package/promise/lazy-promise.js.map +1 -0
- package/queue/mongo/mongo-job.repository.js +1 -1
- package/queue/mongo/mongo-job.repository.js.map +1 -1
- package/reflection/registry.d.ts +8 -8
- package/reflection/registry.js.map +1 -1
- package/schema/array-constraints/maximum-length.js +2 -2
- package/schema/array-constraints/maximum-length.js.map +1 -1
- package/schema/array-constraints/minimum-length.js +2 -2
- package/schema/array-constraints/minimum-length.js.map +1 -1
- package/schema/coercers/default-value.coercer.d.ts +1 -1
- package/schema/coercers/default-value.coercer.js +1 -1
- package/schema/coercers/default-value.coercer.js.map +1 -1
- package/schema/coercers/uint8-array.coercer.js +4 -9
- package/schema/coercers/uint8-array.coercer.js.map +1 -1
- package/schema/constraints/enumeration.js +2 -2
- package/schema/constraints/enumeration.js.map +1 -1
- package/schema/constraints/generic.js +2 -2
- package/schema/constraints/generic.js.map +1 -1
- package/schema/constraints/integer.js +3 -3
- package/schema/constraints/integer.js.map +1 -1
- package/schema/constraints/literal.js +2 -2
- package/schema/constraints/literal.js.map +1 -1
- package/schema/constraints/maximum-date.js +3 -3
- package/schema/constraints/maximum-date.js.map +1 -1
- package/schema/constraints/maximum-length.js +2 -2
- package/schema/constraints/maximum-length.js.map +1 -1
- package/schema/constraints/maximum.js +3 -3
- package/schema/constraints/maximum.js.map +1 -1
- package/schema/constraints/minimum-date.js +3 -3
- package/schema/constraints/minimum-date.js.map +1 -1
- package/schema/constraints/minimum-length.js +2 -2
- package/schema/constraints/minimum-length.js.map +1 -1
- package/schema/constraints/minimum.js +3 -3
- package/schema/constraints/minimum.js.map +1 -1
- package/schema/constraints/pattern.js +3 -3
- package/schema/constraints/pattern.js.map +1 -1
- package/schema/decorators/array.d.ts +3 -2
- package/schema/decorators/array.js +1 -1
- package/schema/decorators/array.js.map +1 -1
- package/schema/decorators/defaulted.d.ts +3 -2
- package/schema/decorators/defaulted.js +1 -1
- package/schema/decorators/defaulted.js.map +1 -1
- package/schema/decorators/property.d.ts +3 -3
- package/schema/decorators/property.js +4 -1
- package/schema/decorators/property.js.map +1 -1
- package/schema/decorators/types.d.ts +3 -3
- package/schema/decorators/utils.d.ts +3 -2
- package/schema/decorators/utils.js +4 -8
- package/schema/decorators/utils.js.map +1 -1
- package/schema/schema.d.ts +10 -9
- package/schema/schema.js +106 -110
- package/schema/schema.js.map +1 -1
- package/schema/schemas/any.d.ts +2 -2
- package/schema/schemas/any.js +2 -2
- package/schema/schemas/any.js.map +1 -1
- package/schema/schemas/array.d.ts +4 -2
- package/schema/schemas/array.js +1 -2
- package/schema/schemas/array.js.map +1 -1
- package/schema/schemas/assign.d.ts +5 -5
- package/schema/schemas/assign.js +0 -1
- package/schema/schemas/assign.js.map +1 -1
- package/schema/schemas/boolean.js +2 -3
- package/schema/schemas/boolean.js.map +1 -1
- package/schema/schemas/constraint.d.ts +1 -1
- package/schema/schemas/constraint.js +1 -2
- package/schema/schemas/constraint.js.map +1 -1
- package/schema/schemas/date.js +2 -3
- package/schema/schemas/date.js.map +1 -1
- package/schema/schemas/defaulted.d.ts +4 -2
- package/schema/schemas/defaulted.js +1 -2
- package/schema/schemas/defaulted.js.map +1 -1
- package/schema/schemas/enumeration.js +2 -3
- package/schema/schemas/enumeration.js.map +1 -1
- package/schema/schemas/exclude.js.map +1 -1
- package/schema/schemas/index.d.ts +1 -0
- package/schema/schemas/index.js +1 -0
- package/schema/schemas/index.js.map +1 -1
- package/schema/schemas/instance.d.ts +2 -2
- package/schema/schemas/instance.js +1 -1
- package/schema/schemas/instance.js.map +1 -1
- package/schema/schemas/literal.js +2 -3
- package/schema/schemas/literal.js.map +1 -1
- package/schema/schemas/nullable.d.ts +1 -1
- package/schema/schemas/nullable.js +1 -1
- package/schema/schemas/nullable.js.map +1 -1
- package/schema/schemas/number.d.ts +1 -1
- package/schema/schemas/number.js +5 -3
- package/schema/schemas/number.js.map +1 -1
- package/schema/schemas/object.d.ts +2 -3
- package/schema/schemas/object.js.map +1 -1
- package/schema/schemas/optional.d.ts +1 -1
- package/schema/schemas/optional.js +1 -1
- package/schema/schemas/optional.js.map +1 -1
- package/schema/schemas/pick.js.map +1 -1
- package/schema/schemas/readable-stream.d.ts +2 -2
- package/schema/schemas/readable-stream.js +3 -4
- package/schema/schemas/readable-stream.js.map +1 -1
- package/schema/schemas/record.d.ts +5 -4
- package/schema/schemas/record.js +2 -2
- package/schema/schemas/record.js.map +1 -1
- package/schema/schemas/regexp.js +3 -3
- package/schema/schemas/regexp.js.map +1 -1
- package/schema/schemas/string.js +2 -3
- package/schema/schemas/string.js.map +1 -1
- package/schema/schemas/transform.d.ts +4 -3
- package/schema/schemas/transform.js +1 -3
- package/schema/schemas/transform.js.map +1 -1
- package/schema/schemas/uint8-array.d.ts +2 -3
- package/schema/schemas/uint8-array.js +4 -4
- package/schema/schemas/uint8-array.js.map +1 -1
- package/schema/schemas/union.d.ts +9 -4
- package/schema/schemas/union.js +5 -4
- package/schema/schemas/union.js.map +1 -1
- package/schema/schemas/unknown.d.ts +2 -2
- package/schema/schemas/unknown.js +2 -2
- package/schema/schemas/unknown.js.map +1 -1
- package/schema/transformers/generic.d.ts +9 -9
- package/schema/transformers/generic.js.map +1 -1
- package/schema/transformers/lowercase.d.ts +2 -2
- package/schema/transformers/lowercase.js +1 -1
- package/schema/transformers/lowercase.js.map +1 -1
- package/schema/transformers/trim.d.ts +2 -2
- package/schema/transformers/trim.js +1 -1
- package/schema/transformers/trim.js.map +1 -1
- package/schema/transformers/uppercase.d.ts +2 -2
- package/schema/transformers/uppercase.js +1 -1
- package/schema/transformers/uppercase.js.map +1 -1
- package/schema/types.d.ts +70 -52
- package/schema/types.js +47 -12
- package/schema/types.js.map +1 -1
- package/schema/utils/schema.d.ts +10 -9
- package/schema/utils/schema.js +43 -47
- package/schema/utils/schema.js.map +1 -1
- package/schema/utils/value-type.d.ts +4 -3
- package/schema/utils/value-type.js +18 -14
- package/schema/utils/value-type.js.map +1 -1
- package/templates/providers/file-template.provider.js.map +1 -1
- package/types.d.ts +35 -1
- package/utils/async-iterable-helpers/includes.d.ts +2 -0
- package/utils/async-iterable-helpers/includes.js +13 -0
- package/utils/async-iterable-helpers/includes.js.map +1 -0
- package/utils/async-iterable-helpers/index.d.ts +1 -0
- package/utils/async-iterable-helpers/index.js +1 -0
- package/utils/async-iterable-helpers/index.js.map +1 -1
- package/utils/compression.d.ts +13 -13
- package/utils/compression.js +2 -1
- package/utils/compression.js.map +1 -1
- package/utils/encoding.js +1 -1
- package/utils/encoding.js.map +1 -1
- package/utils/iterable-helpers/includes.d.ts +1 -0
- package/utils/iterable-helpers/includes.js +9 -0
- package/utils/iterable-helpers/includes.js.map +1 -0
- package/utils/iterable-helpers/index.d.ts +1 -0
- package/utils/iterable-helpers/index.js +1 -0
- package/utils/iterable-helpers/index.js.map +1 -1
package/schema/utils/schema.js
CHANGED
|
@@ -1,38 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getArrayItemSchema = exports.normalizeTypeSchema = exports.normalizeValueSchema = exports.normalizeObjectSchema = exports.normalizeSchema = void 0;
|
|
4
4
|
const array_1 = require("../../utils/array/array");
|
|
5
5
|
const memoize_1 = require("../../utils/function/memoize");
|
|
6
6
|
const object_1 = require("../../utils/object/object");
|
|
7
7
|
const type_guards_1 = require("../../utils/type-guards");
|
|
8
8
|
const types_1 = require("../types");
|
|
9
|
-
exports.normalizeSchema = (0, memoize_1.memoizeSingle)(
|
|
9
|
+
exports.normalizeSchema = (0, memoize_1.memoizeSingle)(_normalizeSchema, { weak: true });
|
|
10
|
+
exports.normalizeObjectSchema = (0, memoize_1.memoizeSingle)(_normalizeObjectSchema, { weak: true });
|
|
10
11
|
exports.normalizeValueSchema = (0, memoize_1.memoizeSingle)(_normalizeValueSchema, { weak: true });
|
|
12
|
+
exports.normalizeTypeSchema = (0, memoize_1.memoizeSingle)(_normalizeTypeSchema, { weak: true });
|
|
11
13
|
exports.getArrayItemSchema = (0, memoize_1.memoizeSingle)(_getArrayItemSchema, { weak: true });
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
function _normalizeSchema(schema) {
|
|
15
|
+
if ((0, types_1.isObjectSchema)(schema)) {
|
|
16
|
+
return (0, exports.normalizeObjectSchema)(schema);
|
|
17
|
+
}
|
|
18
|
+
if ((0, types_1.isValueSchema)(schema)) {
|
|
19
|
+
return (0, exports.normalizeValueSchema)(schema);
|
|
20
|
+
}
|
|
21
|
+
if ((0, types_1.isTypeSchema)(schema)) {
|
|
22
|
+
return (0, exports.normalizeTypeSchema)(schema);
|
|
23
|
+
}
|
|
24
|
+
throw new Error('Unsupported schema.');
|
|
25
|
+
}
|
|
26
|
+
function _normalizeObjectSchema(schema) {
|
|
27
|
+
const normalizedSchema = {
|
|
28
|
+
factory: schema.factory,
|
|
29
|
+
properties: (0, object_1.mapObjectValues)(schema.properties, (propertyValueType) => ((0, type_guards_1.isArray)(propertyValueType) ? (0, types_1.valueSchema)(propertyValueType) : propertyValueType)),
|
|
30
|
+
mask: schema.mask,
|
|
31
|
+
allowUnknownProperties: new Set((0, array_1.toArray)(schema.allowUnknownProperties ?? []).map(types_1.valueTypeOrSchemaToSchema))
|
|
18
32
|
};
|
|
19
|
-
return
|
|
33
|
+
return normalizedSchema;
|
|
20
34
|
}
|
|
21
|
-
|
|
22
|
-
function _normalizeValueSchema(valueSchema) {
|
|
23
|
-
const valueTypes = maybeDeferredValueTypesToValueTypes(valueSchema.type);
|
|
35
|
+
function _normalizeValueSchema(schema) {
|
|
24
36
|
const normalizedValueSchema = {
|
|
25
|
-
|
|
26
|
-
array:
|
|
27
|
-
optional:
|
|
28
|
-
nullable:
|
|
29
|
-
coerce:
|
|
37
|
+
schema: new Set((0, array_1.toArray)(schema.schema)),
|
|
38
|
+
array: schema.array ?? false,
|
|
39
|
+
optional: schema.optional ?? false,
|
|
40
|
+
nullable: schema.nullable ?? false,
|
|
41
|
+
coerce: schema.coerce ?? false,
|
|
30
42
|
coercers: new Map(),
|
|
31
|
-
transformers: (0, array_1.toArray)(
|
|
32
|
-
arrayConstraints: (0, array_1.toArray)(
|
|
33
|
-
valueConstraints: (0, array_1.toArray)(
|
|
43
|
+
transformers: (0, array_1.toArray)(schema.transformers ?? []),
|
|
44
|
+
arrayConstraints: (0, array_1.toArray)(schema.arrayConstraints ?? []),
|
|
45
|
+
valueConstraints: (0, array_1.toArray)(schema.valueConstraints ?? [])
|
|
34
46
|
};
|
|
35
|
-
for (const coercer of (0, array_1.toArray)(
|
|
47
|
+
for (const coercer of (0, array_1.toArray)(schema.coercers ?? [])) {
|
|
36
48
|
for (const sourceType of (0, array_1.toArray)(coercer.sourceType)) {
|
|
37
49
|
if (!normalizedValueSchema.coercers.has(sourceType)) {
|
|
38
50
|
normalizedValueSchema.coercers.set(sourceType, []);
|
|
@@ -42,37 +54,21 @@ function _normalizeValueSchema(valueSchema) {
|
|
|
42
54
|
}
|
|
43
55
|
return normalizedValueSchema;
|
|
44
56
|
}
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
function _normalizeTypeSchema(schema) {
|
|
58
|
+
const normalizedSchema = {
|
|
59
|
+
foo: (0, types_1.resolveValueType)(schema.type)
|
|
60
|
+
};
|
|
61
|
+
return normalizedSchema;
|
|
62
|
+
}
|
|
63
|
+
function _getArrayItemSchema(schema) {
|
|
47
64
|
const itemSchema = {
|
|
48
|
-
|
|
65
|
+
schema: schema.schema,
|
|
49
66
|
array: false,
|
|
50
67
|
optional: false,
|
|
51
68
|
nullable: false,
|
|
52
|
-
transformers:
|
|
53
|
-
valueConstraints:
|
|
69
|
+
transformers: schema.transformers,
|
|
70
|
+
valueConstraints: schema.valueConstraints
|
|
54
71
|
};
|
|
55
72
|
return itemSchema;
|
|
56
73
|
}
|
|
57
|
-
function maybeDeferredValueTypesToValueTypes(valueTypes) {
|
|
58
|
-
if ((0, type_guards_1.isArray)(valueTypes)) {
|
|
59
|
-
return valueTypes.flatMap((valueType) => maybeDeferredValueTypesToValueTypes(valueType));
|
|
60
|
-
}
|
|
61
|
-
return (0, types_1.isDeferredValueType)(valueTypes)
|
|
62
|
-
? valueTypes.deferred()
|
|
63
|
-
: valueTypes;
|
|
64
|
-
}
|
|
65
|
-
exports.maybeDeferredValueTypesToValueTypes = maybeDeferredValueTypesToValueTypes;
|
|
66
|
-
function valueTypesToSchema(valueType) {
|
|
67
|
-
if ((0, type_guards_1.isFunction)(valueType) || (0, type_guards_1.isArray)(valueType) || (0, type_guards_1.isString)(valueType)) {
|
|
68
|
-
return { type: valueType };
|
|
69
|
-
}
|
|
70
|
-
return valueType;
|
|
71
|
-
}
|
|
72
|
-
exports.valueTypesToSchema = valueTypesToSchema;
|
|
73
|
-
function maybeDeferredValueTypesToSchema(valueType) {
|
|
74
|
-
const deferredValueTypes = maybeDeferredValueTypesToValueTypes(valueType);
|
|
75
|
-
return valueTypesToSchema(deferredValueTypes);
|
|
76
|
-
}
|
|
77
|
-
exports.maybeDeferredValueTypesToSchema = maybeDeferredValueTypesToSchema;
|
|
78
74
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../source/schema/utils/schema.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,0DAAyD;AACzD,sDAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../source/schema/utils/schema.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,0DAAyD;AACzD,sDAAwD;AACxD,yDAA8C;AAG9C,oCAAiI;AAEpH,QAAA,eAAe,GAAG,IAAA,uBAAa,EAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAClE,QAAA,qBAAqB,GAAG,IAAA,uBAAa,EAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9E,QAAA,oBAAoB,GAAG,IAAA,uBAAa,EAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5E,QAAA,mBAAmB,GAAG,IAAA,uBAAa,EAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1E,QAAA,kBAAkB,GAAG,IAAA,uBAAa,EAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAGrF,SAAS,gBAAgB,CAAO,MAAoB;IAClD,IAAI,IAAA,sBAAc,EAAC,MAAM,CAAC,EAAE;QAC1B,OAAO,IAAA,6BAAqB,EAAC,MAAM,CAAC,CAAC;K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schema';
|
|
2
|
+
import type { ResolvedValueType, ValueType } from '../types';
|
|
3
|
+
export declare function getValueType(value: unknown): ResolvedValueType<any>;
|
|
3
4
|
export declare function getValueTypeName(valueType: ValueType): string;
|
|
4
|
-
export declare function
|
|
5
|
+
export declare function getSchemaTypeNames(schema: Schema): string[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getSchemaTypeNames = exports.getValueTypeName = exports.getValueType = void 0;
|
|
4
|
+
const array_1 = require("../../utils/array/array");
|
|
4
5
|
const type_guards_1 = require("../../utils/type-guards");
|
|
5
6
|
const types_1 = require("../types");
|
|
6
|
-
const schema_1 = require("./schema");
|
|
7
7
|
function getValueType(value) {
|
|
8
8
|
if ((0, type_guards_1.isUndefined)(value)) {
|
|
9
9
|
return 'undefined';
|
|
@@ -15,21 +15,25 @@ function getValueType(value) {
|
|
|
15
15
|
}
|
|
16
16
|
exports.getValueType = getValueType;
|
|
17
17
|
function getValueTypeName(valueType) {
|
|
18
|
-
|
|
18
|
+
const resolvedValueType = (0, types_1.resolveValueType)(valueType);
|
|
19
|
+
return (0, type_guards_1.isString)(resolvedValueType)
|
|
20
|
+
? resolvedValueType
|
|
21
|
+
: resolvedValueType.name;
|
|
19
22
|
}
|
|
20
23
|
exports.getValueTypeName = getValueTypeName;
|
|
21
|
-
function
|
|
22
|
-
if ((0, types_1.
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
return resolvedValueTypes.some((innerType) => valueTypeHasValueType(innerType, typeToCheck));
|
|
26
|
-
}
|
|
27
|
-
return valueTypeHasValueType(resolvedValueTypes, typeToCheck);
|
|
24
|
+
function getSchemaTypeNames(schema) {
|
|
25
|
+
if ((0, types_1.isTypeSchema)(schema)) {
|
|
26
|
+
const name = getValueTypeName(schema.type);
|
|
27
|
+
return [name];
|
|
28
28
|
}
|
|
29
|
-
if ((0, types_1.isObjectSchema)(
|
|
30
|
-
|
|
29
|
+
if ((0, types_1.isObjectSchema)(schema)) {
|
|
30
|
+
const name = getValueTypeName(schema.sourceType ?? Object);
|
|
31
|
+
return [name];
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
+
if ((0, types_1.isValueSchema)(schema)) {
|
|
34
|
+
return [...new Set((0, array_1.toArray)(schema.schema).flatMap(getSchemaTypeNames))];
|
|
35
|
+
}
|
|
36
|
+
throw new Error('Unsupported schema');
|
|
33
37
|
}
|
|
34
|
-
exports.
|
|
38
|
+
exports.getSchemaTypeNames = getSchemaTypeNames;
|
|
35
39
|
//# sourceMappingURL=value-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value-type.js","sourceRoot":"","sources":["../../../source/schema/utils/value-type.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"value-type.js","sourceRoot":"","sources":["../../../source/schema/utils/value-type.ts"],"names":[],"mappings":";;;AACA,mDAA8C;AAC9C,yDAAoE;AAGpE,oCAAyF;AAEzF,SAAgB,YAAY,CAAC,KAAc;IACzC,IAAI,IAAA,yBAAW,EAAC,KAAK,CAAC,EAAE;QACtB,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,IAAA,oBAAM,EAAC,KAAK,CAAC,EAAE;QACjB,OAAO,MAAM,CAAC;KACf;IAED,OAAQ,KAAgB,CAAC,WAAkC,CAAC;AAC9D,CAAC;AAVD,oCAUC;AAED,SAAgB,gBAAgB,CAAC,SAAoB;IACnD,MAAM,iBAAiB,GAAG,IAAA,wBAAgB,EAAC,SAAS,CAAC,CAAC;IAEtD,OAAO,IAAA,sBAAQ,EAAC,iBAAiB,CAAC;QAChC,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC;AAC7B,CAAC;AAND,4CAMC;AAED,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,IAAI,IAAA,oBAAY,EAAC,MAAM,CAAC,EAAE;QACxB,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,CAAC;KACf;IAED,IAAI,IAAA,sBAAc,EAAC,MAAM,CAAC,EAAE;QAC1B,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,CAAC;QAC3D,OAAO,CAAC,IAAI,CAAC,CAAC;KACf;IAED,IAAI,IAAA,qBAAa,EAAC,MAAM,CAAC,EAAE;QACzB,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,IAAA,eAAO,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;KACzE;IAED,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACxC,CAAC;AAhBD,gDAgBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-template.provider.js","sourceRoot":"","sources":["../../../source/templates/providers/file-template.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,+CAAwE;AAExE,yCAA6D;AAI7D,+EAAyE;AAe5D,QAAA,0BAA0B,GAA+B,EAAE,CAAC;AAEzE,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"file-template.provider.js","sourceRoot":"","sources":["../../../source/templates/providers/file-template.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,+CAAwE;AAExE,yCAA6D;AAI7D,+EAAyE;AAe5D,QAAA,0BAA0B,GAA+B,EAAE,CAAC;AAEzE,MAAM,kBAAkB,GAAG,IAAA,eAAM,EAAe;IAC9C,IAAI,EAAE,IAAA,eAAM,GAAE;IACd,QAAQ,EAAE,IAAA,iBAAQ,EAAC,IAAA,eAAM,GAAE,CAAC;IAC5B,YAAY,EAAE,IAAA,iBAAQ,EAAC,IAAA,eAAM,GAAE,CAAC;IAChC,OAAO,EAAE,IAAA,iBAAQ,EAAC,IAAA,gBAAO,GAAE,CAAC;CAC7B,CAAC,CAAC;AAKH,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,sDAAgD;IAGxF,YAAyB,QAAgB;QACvC,KAAK,CAAC,kBAAkB,EAAE,QAAQ,EAAE,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC;CACF,CAAA;AANY,oBAAoB;IAHhC,IAAA,qBAAS,EAAC;QACT,uBAAuB,EAAE,GAAG,EAAE,CAAC,kCAA0B,CAAC,QAAQ;KACnE,CAAC;IAIa,WAAA,IAAA,qBAAS,GAAE,CAAA;;GAHb,oBAAoB,CAMhC;AANY,oDAAoB;AAQjC,SAAgB,6BAA6B,CAAC,SAA8C,EAAE;IAC5F,kCAA0B,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,kCAA0B,CAAC,QAAQ,CAAC;AAC/F,CAAC;AAFD,sEAEC;AAED,SAAgB,YAAY,CAAyB,QAAW;IAC9D,OAAO,QAAQ,CAAC;AAClB,CAAC;AAFD,oCAEC"}
|
package/types.d.ts
CHANGED
|
@@ -82,7 +82,8 @@ export declare type OmitBy<T, V> = Omit<T, {
|
|
|
82
82
|
/**
|
|
83
83
|
* normalize properties of a type that allow `undefined` to make them optional.
|
|
84
84
|
*/
|
|
85
|
-
export declare type Optionalize<
|
|
85
|
+
export declare type Optionalize<T extends object> = OmitBy<T, undefined> & Partial<PickBy<T, undefined>>;
|
|
86
|
+
export declare type SimplifiedOptionalize<T extends object> = Simplify<Optionalize<T>>;
|
|
86
87
|
/**
|
|
87
88
|
* remove nested type information
|
|
88
89
|
*/
|
|
@@ -143,3 +144,36 @@ export declare type DeepPartialObject<T> = {
|
|
|
143
144
|
export declare type DeepPartialArray<T> = DeepPartial<T>[];
|
|
144
145
|
export declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|
|
145
146
|
export declare type BinaryData = ArrayBuffer | ArrayBufferView;
|
|
147
|
+
declare type JoinPaths<K, P> = K extends string | number ? P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never : never;
|
|
148
|
+
declare type Prev = [
|
|
149
|
+
never,
|
|
150
|
+
0,
|
|
151
|
+
1,
|
|
152
|
+
2,
|
|
153
|
+
3,
|
|
154
|
+
4,
|
|
155
|
+
5,
|
|
156
|
+
6,
|
|
157
|
+
7,
|
|
158
|
+
8,
|
|
159
|
+
9,
|
|
160
|
+
10,
|
|
161
|
+
11,
|
|
162
|
+
12,
|
|
163
|
+
13,
|
|
164
|
+
14,
|
|
165
|
+
15,
|
|
166
|
+
16,
|
|
167
|
+
17,
|
|
168
|
+
18,
|
|
169
|
+
19,
|
|
170
|
+
20,
|
|
171
|
+
...0[]
|
|
172
|
+
];
|
|
173
|
+
export declare type Paths<T, D extends number = 10> = [D] extends [never] ? never : T extends object ? {
|
|
174
|
+
[K in keyof T]-?: K extends string | number ? `${K}` | (Paths<T[K], Prev[D]> extends infer R ? JoinPaths<K, R> : never) : never;
|
|
175
|
+
}[keyof T] : '';
|
|
176
|
+
export declare type LeavePaths<T, D extends number = 10> = [D] extends [never] ? never : T extends object ? {
|
|
177
|
+
[K in keyof T]-?: JoinPaths<K, LeavePaths<T[K], Prev[D]>>;
|
|
178
|
+
}[keyof T] : '';
|
|
179
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.includesAsync = void 0;
|
|
4
|
+
const any_1 = require("../iterable-helpers/any");
|
|
5
|
+
const any_2 = require("./any");
|
|
6
|
+
const is_async_iterable_1 = require("./is-async-iterable");
|
|
7
|
+
async function includesAsync(iterable, value) {
|
|
8
|
+
return (0, is_async_iterable_1.isAsyncIterable)(iterable)
|
|
9
|
+
? (0, any_2.anyAsync)(iterable, (item) => item == value)
|
|
10
|
+
: (0, any_1.any)(iterable, (item) => item == value);
|
|
11
|
+
}
|
|
12
|
+
exports.includesAsync = includesAsync;
|
|
13
|
+
//# sourceMappingURL=includes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"includes.js","sourceRoot":"","sources":["../../../source/utils/async-iterable-helpers/includes.ts"],"names":[],"mappings":";;;AACA,iDAA8C;AAC9C,+BAAiC;AACjC,2DAAsD;AAE/C,KAAK,UAAU,aAAa,CAAI,QAAwB,EAAE,KAAQ;IACvE,OAAO,IAAA,mCAAe,EAAC,QAAQ,CAAC;QAC9B,CAAC,CAAC,IAAA,cAAQ,EAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,KAAK,CAAC;QAC7C,CAAC,CAAC,IAAA,SAAG,EAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC;AAC7C,CAAC;AAJD,sCAIC"}
|
|
@@ -17,6 +17,7 @@ export * from './group';
|
|
|
17
17
|
export * from './group-single';
|
|
18
18
|
export * from './group-to-map';
|
|
19
19
|
export * from './group-to-single-map';
|
|
20
|
+
export * from './includes';
|
|
20
21
|
export * from './interrupt';
|
|
21
22
|
export * from './is-async-iterable';
|
|
22
23
|
export * from './last';
|
|
@@ -33,6 +33,7 @@ __exportStar(require("./group"), exports);
|
|
|
33
33
|
__exportStar(require("./group-single"), exports);
|
|
34
34
|
__exportStar(require("./group-to-map"), exports);
|
|
35
35
|
__exportStar(require("./group-to-single-map"), exports);
|
|
36
|
+
__exportStar(require("./includes"), exports);
|
|
36
37
|
__exportStar(require("./interrupt"), exports);
|
|
37
38
|
__exportStar(require("./is-async-iterable"), exports);
|
|
38
39
|
__exportStar(require("./last"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/utils/async-iterable-helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,wCAAsB;AACtB,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,qDAAmC;AACnC,6CAA2B;AAC3B,+CAA6B;AAC7B,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,qDAAmC;AACnC,6CAA2B;AAC3B,0CAAwB;AACxB,iDAA+B;AAC/B,iDAA+B;AAC/B,wDAAsC;AACtC,8CAA4B;AAC5B,sDAAoC;AACpC,yCAAuB;AACvB,oDAAkC;AAClC,wCAAsB;AACtB,6CAA2B;AAC3B,gDAA8B;AAC9B,6CAA2B;AAC3B,8CAA4B;AAC5B,6CAA2B;AAC3B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,sDAAoC;AACpC,yCAAuB;AACvB,yCAAuB;AACvB,yCAAuB;AACvB,+CAA6B;AAC7B,+CAA6B;AAC7B,wCAAsB;AACtB,6CAA2B;AAC3B,6CAA2B;AAC3B,+DAA6C;AAC7C,sDAAoC;AACpC,2CAAyB;AACzB,qDAAmC;AACnC,0CAAwB;AACxB,0CAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/utils/async-iterable-helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,wCAAsB;AACtB,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,qDAAmC;AACnC,6CAA2B;AAC3B,+CAA6B;AAC7B,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,qDAAmC;AACnC,6CAA2B;AAC3B,0CAAwB;AACxB,iDAA+B;AAC/B,iDAA+B;AAC/B,wDAAsC;AACtC,6CAA2B;AAC3B,8CAA4B;AAC5B,sDAAoC;AACpC,yCAAuB;AACvB,oDAAkC;AAClC,wCAAsB;AACtB,6CAA2B;AAC3B,gDAA8B;AAC9B,6CAA2B;AAC3B,8CAA4B;AAC5B,6CAA2B;AAC3B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,sDAAoC;AACpC,yCAAuB;AACvB,yCAAuB;AACvB,yCAAuB;AACvB,+CAA6B;AAC7B,+CAA6B;AAC7B,wCAAsB;AACtB,6CAA2B;AAC3B,6CAA2B;AAC3B,+DAA6C;AAC7C,sDAAoC;AACpC,2CAAyB;AACzB,qDAAmC;AACnC,0CAAwB;AACxB,0CAAwB"}
|
package/utils/compression.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import * as
|
|
3
|
+
import type * as ZlibType from 'zlib';
|
|
4
4
|
export interface CompressionResult {
|
|
5
5
|
toBuffer(): Promise<Uint8Array>;
|
|
6
6
|
toHex(): Promise<string>;
|
|
@@ -12,16 +12,16 @@ export interface DecompressionResult extends CompressionResult {
|
|
|
12
12
|
toUtf8(): Promise<string>;
|
|
13
13
|
}
|
|
14
14
|
declare type Algorithms = 'gzip' | 'brotli' | 'deflate' | 'deflate-raw';
|
|
15
|
-
export declare function compressString(input: string, algorithm: 'gzip' | 'deflate' | 'deflate-raw', options?:
|
|
16
|
-
export declare function compressString(input: string, algorithm: 'brotli', options?:
|
|
17
|
-
export declare function compressString(input: string, algorithm: Algorithms, options?:
|
|
18
|
-
export declare function compress(buffer:
|
|
19
|
-
export declare function compress(buffer:
|
|
20
|
-
export declare function compress(buffer:
|
|
21
|
-
export declare function decompressString(input: string, encoding: BufferEncoding, algorithm: 'gzip' | 'deflate' | 'deflate-raw', options?:
|
|
22
|
-
export declare function decompressString(input: string, encoding: BufferEncoding, algorithm: 'brotli', options?:
|
|
23
|
-
export declare function decompressString(input: string, encoding: BufferEncoding, algorithm: Algorithms, options?:
|
|
24
|
-
export declare function decompress(buffer:
|
|
25
|
-
export declare function decompress(buffer:
|
|
26
|
-
export declare function decompress(buffer:
|
|
15
|
+
export declare function compressString(input: string, algorithm: 'gzip' | 'deflate' | 'deflate-raw', options?: ZlibType.ZlibOptions): CompressionResult;
|
|
16
|
+
export declare function compressString(input: string, algorithm: 'brotli', options?: ZlibType.BrotliOptions): CompressionResult;
|
|
17
|
+
export declare function compressString(input: string, algorithm: Algorithms, options?: ZlibType.ZlibOptions | ZlibType.BrotliOptions): CompressionResult;
|
|
18
|
+
export declare function compress(buffer: ZlibType.InputType, algorithm: 'gzip' | 'deflate' | 'deflate-raw', options?: ZlibType.ZlibOptions): CompressionResult;
|
|
19
|
+
export declare function compress(buffer: ZlibType.InputType, algorithm: 'brotli', options?: ZlibType.BrotliOptions): CompressionResult;
|
|
20
|
+
export declare function compress(buffer: ZlibType.InputType, algorithm: Algorithms, options?: ZlibType.ZlibOptions | ZlibType.BrotliOptions): CompressionResult;
|
|
21
|
+
export declare function decompressString(input: string, encoding: BufferEncoding, algorithm: 'gzip' | 'deflate' | 'deflate-raw', options?: ZlibType.ZlibOptions): DecompressionResult;
|
|
22
|
+
export declare function decompressString(input: string, encoding: BufferEncoding, algorithm: 'brotli', options?: ZlibType.BrotliOptions): DecompressionResult;
|
|
23
|
+
export declare function decompressString(input: string, encoding: BufferEncoding, algorithm: Algorithms, options?: ZlibType.ZlibOptions | ZlibType.BrotliOptions): DecompressionResult;
|
|
24
|
+
export declare function decompress(buffer: ZlibType.InputType, algorithm: 'gzip' | 'deflate' | 'deflate-raw', options?: ZlibType.ZlibOptions): DecompressionResult;
|
|
25
|
+
export declare function decompress(buffer: ZlibType.InputType, algorithm: 'brotli', options?: ZlibType.BrotliOptions): DecompressionResult;
|
|
26
|
+
export declare function decompress(buffer: ZlibType.InputType, algorithm: Algorithms, options?: ZlibType.ZlibOptions | ZlibType.BrotliOptions): DecompressionResult;
|
|
27
27
|
export {};
|
package/utils/compression.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.decompress = exports.decompressString = exports.compress = exports.compressString = void 0;
|
|
4
|
-
const Zlib = require("zlib");
|
|
5
4
|
const base64_1 = require("./base64");
|
|
6
5
|
const encoding_1 = require("./encoding");
|
|
7
6
|
const z_base32_1 = require("./z-base32");
|
|
@@ -22,6 +21,7 @@ function compress(buffer, algorithm, options) {
|
|
|
22
21
|
}
|
|
23
22
|
exports.compress = compress;
|
|
24
23
|
async function _compress(buffer, algorithm, options) {
|
|
24
|
+
const Zlib = await Promise.resolve().then(() => require('zlib'));
|
|
25
25
|
return new Promise((resolve, reject) => {
|
|
26
26
|
const compressor = algorithm == 'gzip' ? Zlib.gzip
|
|
27
27
|
: algorithm == 'brotli' ? Zlib.brotliDecompress
|
|
@@ -65,6 +65,7 @@ function decompress(buffer, algorithm, options) {
|
|
|
65
65
|
}
|
|
66
66
|
exports.decompress = decompress;
|
|
67
67
|
async function _decompress(buffer, algorithm, options) {
|
|
68
|
+
const Zlib = await Promise.resolve().then(() => require('zlib'));
|
|
68
69
|
return new Promise((resolve, reject) => {
|
|
69
70
|
const decompressor = algorithm == 'gzip' ? Zlib.gunzip
|
|
70
71
|
: algorithm == 'brotli' ? Zlib.brotliDecompress
|
package/utils/compression.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compression.js","sourceRoot":"","sources":["../../source/utils/compression.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"compression.js","sourceRoot":"","sources":["../../source/utils/compression.ts"],"names":[],"mappings":";;;AACA,qCAAyD;AACzD,yCAA+D;AAC/D,yCAA2C;AAmB3C,SAAgB,cAAc,CAAC,KAAa,EAAE,SAAqB,EAAE,OAAuD;IAC1H,MAAM,WAAW,GAAG,IAAA,qBAAU,EAAC,KAAK,CAAC,CAAC;IACtC,OAAO,QAAQ,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC;AAHD,wCAGC;AAKD,SAAgB,QAAQ,CAAC,MAA0B,EAAE,SAAqB,EAAE,OAAuD;IACjI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U,WAAW,CAAC,MAA0B,EAAE,SAAqB,EAAE,OAAuD;IACnI,MAAM,IAAI,GAAG,2CAAa,MAAM,EAAC,CAAC;IAElC,OAAO,IAAI,OAAO,CAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACjD,MAAM,YAAY,GACd,SAAS,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM;YACjC,CAAC,CAAC,SAAS,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB;gBAC7C,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO;oBACrC,CAAC,CAAC,SAAS,IAAI,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,kEAAkE;wBAC/G,CAAC,CAAC,SAAS,CAAC;QAEtB,IAAI,YAAY,IAAI,SAAS,EAAE;YAC7B,MAAM,IAAI,KAAK,CAAC,yBAAyB,SAAS,EAAE,CAAC,CAAC;SACvD;QAED,MAAM,QAAQ,GAA8B,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YAC5D,IAAI,KAAK,IAAI,SAAS,EAAE;gBACtB,MAAM,CAAC,KAAK,CAAC,CAAC;aACf;iBACI;gBACH,OAAO,CAAC,MAAM,CAAC,CAAC;aACjB;QACH,CAAC,CAAC;QAEF,IAAI,OAAO,IAAI,SAAS,EAAE;YACvB,YAA0F,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;SAC/G;aACI;YACF,YAAkJ,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;SAChL;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/utils/encoding.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.decodeHex = exports.encodeHex = exports.decodeText = exports.encodeUtf8 = void 0;
|
|
4
4
|
const error_1 = require("../error");
|
|
5
|
-
const array_1 = require("./array");
|
|
5
|
+
const array_1 = require("./array/array");
|
|
6
6
|
const binary_1 = require("./binary");
|
|
7
7
|
const type_guards_1 = require("./type-guards");
|
|
8
8
|
const byteToHex = (0, array_1.createArray)(2 ** 8, (i) => i).map((value) => value.toString(16).padStart(2, '0'));
|
package/utils/encoding.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../source/utils/encoding.ts"],"names":[],"mappings":";;;AAAA,oCAAyC;AAEzC,
|
|
1
|
+
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../source/utils/encoding.ts"],"names":[],"mappings":";;;AAAA,oCAAyC;AAEzC,yCAA4C;AAC5C,qCAAwC;AACxC,+CAA4C;AAE5C,MAAM,SAAS,GAAG,IAAA,mBAAW,EAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACpG,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAEvE;;;;GAIG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAHD,gCAGC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,MAAmB,EAAE,QAAiB;IAC/D,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAHD,gCAGC;AAED;;;;GAIG;AACH,SAAgB,SAAS,CAAC,MAAkB;IAC1C,MAAM,KAAK,GAAG,IAAA,qBAAY,EAAC,MAAM,CAAC,CAAC;IACnC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,4DAA4D;IAC5D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC;KAChC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAVD,8BAUC;AAED;;;;GAIG;AACH,SAAgB,SAAS,CAAC,GAAW;IACnC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACtC,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAEpC,IAAI,IAAA,yBAAW,EAAC,IAAI,CAAC,EAAE;YACrB,MAAM,IAAI,sBAAc,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAAC;SACjE;QAED,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;KACrB;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAfD,8BAeC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function includes<T>(iterable: Iterable<T>, value: T): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.includes = void 0;
|
|
4
|
+
const any_1 = require("./any");
|
|
5
|
+
function includes(iterable, value) {
|
|
6
|
+
return (0, any_1.any)(iterable, (item) => item == value);
|
|
7
|
+
}
|
|
8
|
+
exports.includes = includes;
|
|
9
|
+
//# sourceMappingURL=includes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"includes.js","sourceRoot":"","sources":["../../../source/utils/iterable-helpers/includes.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAE5B,SAAgB,QAAQ,CAAI,QAAqB,EAAE,KAAQ;IACzD,OAAO,IAAA,SAAG,EAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC;AAChD,CAAC;AAFD,4BAEC"}
|
|
@@ -16,6 +16,7 @@ export * from './group';
|
|
|
16
16
|
export * from './group-single';
|
|
17
17
|
export * from './group-to-map';
|
|
18
18
|
export * from './group-to-single-map';
|
|
19
|
+
export * from './includes';
|
|
19
20
|
export * from './is-iterable';
|
|
20
21
|
export * from './last';
|
|
21
22
|
export * from './last-or-default';
|
|
@@ -32,6 +32,7 @@ __exportStar(require("./group"), exports);
|
|
|
32
32
|
__exportStar(require("./group-single"), exports);
|
|
33
33
|
__exportStar(require("./group-to-map"), exports);
|
|
34
34
|
__exportStar(require("./group-to-single-map"), exports);
|
|
35
|
+
__exportStar(require("./includes"), exports);
|
|
35
36
|
__exportStar(require("./is-iterable"), exports);
|
|
36
37
|
__exportStar(require("./last"), exports);
|
|
37
38
|
__exportStar(require("./last-or-default"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/utils/iterable-helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,wCAAsB;AACtB,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,qDAAmC;AACnC,6CAA2B;AAC3B,+CAA6B;AAC7B,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,qDAAmC;AACnC,6CAA2B;AAC3B,0CAAwB;AACxB,iDAA+B;AAC/B,iDAA+B;AAC/B,wDAAsC;AACtC,gDAA8B;AAC9B,yCAAuB;AACvB,oDAAkC;AAClC,wCAAsB;AACtB,6CAA2B;AAC3B,gDAA8B;AAC9B,6CAA2B;AAC3B,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,sDAAoC;AACpC,yCAAuB;AACvB,yCAAuB;AACvB,yCAAuB;AACvB,+CAA6B;AAC7B,+CAA6B;AAC7B,wCAAsB;AACtB,0CAAwB;AACxB,0CAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/utils/iterable-helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,wCAAsB;AACtB,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,qDAAmC;AACnC,6CAA2B;AAC3B,+CAA6B;AAC7B,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,qDAAmC;AACnC,6CAA2B;AAC3B,0CAAwB;AACxB,iDAA+B;AAC/B,iDAA+B;AAC/B,wDAAsC;AACtC,6CAA2B;AAC3B,gDAA8B;AAC9B,yCAAuB;AACvB,oDAAkC;AAClC,wCAAsB;AACtB,6CAA2B;AAC3B,gDAA8B;AAC9B,6CAA2B;AAC3B,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,sDAAoC;AACpC,yCAAuB;AACvB,yCAAuB;AACvB,yCAAuB;AACvB,+CAA6B;AAC7B,+CAA6B;AAC7B,wCAAsB;AACtB,0CAAwB;AACxB,0CAAwB"}
|