@bemedev/typings 0.1.0 → 0.2.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 +8 -7
- package/lib/_virtual/_rolldown/runtime.cjs +13 -0
- package/lib/_virtual/_rolldown/runtime.js +13 -0
- package/lib/constants.cjs +9 -2
- package/lib/constants.cjs.map +1 -1
- package/lib/constants.d.ts +2 -2
- package/lib/constants.js +9 -2
- package/lib/constants.js.map +1 -1
- package/lib/helpers/any.cjs +2 -1
- package/lib/helpers/any.cjs.map +1 -1
- package/lib/helpers/any.d.ts +3 -3
- package/lib/helpers/any.js +1 -1
- package/lib/helpers/any.js.map +1 -1
- package/lib/helpers/array.cjs +2 -1
- package/lib/helpers/array.cjs.map +1 -1
- package/lib/helpers/array.d.ts +3 -3
- package/lib/helpers/array.js +1 -1
- package/lib/helpers/array.js.map +1 -1
- package/lib/helpers/custom.cjs +2 -1
- package/lib/helpers/custom.cjs.map +1 -1
- package/lib/helpers/custom.d.ts +2 -2
- package/lib/helpers/custom.js +1 -1
- package/lib/helpers/custom.js.map +1 -1
- package/lib/helpers/index.cjs +40 -12
- package/lib/helpers/index.cjs.map +1 -0
- package/lib/helpers/index.d.ts +13 -12
- package/lib/helpers/index.js +34 -13
- package/lib/helpers/index.js.map +1 -0
- package/lib/helpers/intersection.cjs +2 -1
- package/lib/helpers/intersection.cjs.map +1 -1
- package/lib/helpers/intersection.d.ts +2 -2
- package/lib/helpers/intersection.js +1 -1
- package/lib/helpers/intersection.js.map +1 -1
- package/lib/helpers/litterals.cjs +2 -1
- package/lib/helpers/litterals.cjs.map +1 -1
- package/lib/helpers/litterals.d.ts +2 -2
- package/lib/helpers/litterals.js +1 -1
- package/lib/helpers/litterals.js.map +1 -1
- package/lib/helpers/optional.cjs +2 -1
- package/lib/helpers/optional.cjs.map +1 -1
- package/lib/helpers/optional.d.ts +3 -3
- package/lib/helpers/optional.js +1 -1
- package/lib/helpers/optional.js.map +1 -1
- package/lib/helpers/partial.cjs +2 -1
- package/lib/helpers/partial.cjs.map +1 -1
- package/lib/helpers/partial.d.ts +3 -3
- package/lib/helpers/partial.js +1 -1
- package/lib/helpers/partial.js.map +1 -1
- package/lib/helpers/primitiveObject.cjs +11 -0
- package/lib/helpers/primitiveObject.cjs.map +1 -0
- package/lib/helpers/primitiveObject.d.ts +5 -0
- package/lib/helpers/primitiveObject.js +11 -0
- package/lib/helpers/primitiveObject.js.map +1 -0
- package/lib/helpers/record.cjs +2 -1
- package/lib/helpers/record.cjs.map +1 -1
- package/lib/helpers/record.d.ts +3 -3
- package/lib/helpers/record.js +1 -1
- package/lib/helpers/record.js.map +1 -1
- package/lib/helpers/soa.cjs +2 -1
- package/lib/helpers/soa.cjs.map +1 -1
- package/lib/helpers/soa.d.ts +3 -3
- package/lib/helpers/soa.js +1 -1
- package/lib/helpers/soa.js.map +1 -1
- package/lib/helpers/sv.cjs +2 -1
- package/lib/helpers/sv.cjs.map +1 -1
- package/lib/helpers/sv.d.ts +2 -2
- package/lib/helpers/sv.js +1 -1
- package/lib/helpers/sv.js.map +1 -1
- package/lib/helpers/tuple.cjs +2 -1
- package/lib/helpers/tuple.cjs.map +1 -1
- package/lib/helpers/tuple.d.ts +3 -3
- package/lib/helpers/tuple.js +1 -1
- package/lib/helpers/tuple.js.map +1 -1
- package/lib/helpers/union.cjs +4 -3
- package/lib/helpers/union.cjs.map +1 -1
- package/lib/helpers/union.d.ts +4 -4
- package/lib/helpers/union.js +3 -3
- package/lib/helpers/union.js.map +1 -1
- package/lib/index.cjs +7 -25
- package/lib/index.d.ts +4 -4
- package/lib/index.js +2 -14
- package/lib/type.d.ts +1 -1
- package/lib/type.types.d.ts +4 -3
- package/lib/types.d.ts +25 -20
- package/lib/utils/expandFn.cjs +2 -0
- package/lib/utils/expandFn.cjs.map +1 -1
- package/lib/utils/expandFn.d.ts +1 -1
- package/lib/utils/expandFn.js +2 -0
- package/lib/utils/expandFn.js.map +1 -1
- package/package.json +16 -17
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Typings by variables
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
import { type } from
|
|
8
|
+
import { type } from "@bemedev/typings";
|
|
9
9
|
|
|
10
10
|
const result = type(({ array, optional, intersection }) => ({
|
|
11
11
|
nodes: optional(
|
|
@@ -13,16 +13,16 @@ const result = type(({ array, optional, intersection }) => ({
|
|
|
13
13
|
intersection(
|
|
14
14
|
{
|
|
15
15
|
position: {
|
|
16
|
-
x:
|
|
17
|
-
y:
|
|
16
|
+
x: "number",
|
|
17
|
+
y: "number",
|
|
18
18
|
},
|
|
19
19
|
data: {
|
|
20
|
-
label: optional(
|
|
21
|
-
content:
|
|
20
|
+
label: optional("string"),
|
|
21
|
+
content: "string",
|
|
22
22
|
},
|
|
23
|
-
input:
|
|
23
|
+
input: "boolean",
|
|
24
24
|
},
|
|
25
|
-
{ id:
|
|
25
|
+
{ id: "string" },
|
|
26
26
|
),
|
|
27
27
|
),
|
|
28
28
|
),
|
|
@@ -49,6 +49,7 @@ expectTypeOf(result).toEqualTypeOf<{
|
|
|
49
49
|
- `litterals`: Literal types
|
|
50
50
|
- `optional`: Optional types
|
|
51
51
|
- `partial`: Partial types
|
|
52
|
+
- `primitiveObject`: Primitive object schema
|
|
52
53
|
- `record`: Record types
|
|
53
54
|
- `soa`: Single or Array types
|
|
54
55
|
- `sv`: State Value
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.__exportAll = __exportAll;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll };
|
package/lib/constants.cjs
CHANGED
|
@@ -7,9 +7,16 @@ const PRIMITIVES = [
|
|
|
7
7
|
"bigint",
|
|
8
8
|
"symbol",
|
|
9
9
|
"undefined",
|
|
10
|
-
"null"
|
|
10
|
+
"null",
|
|
11
|
+
"unknown",
|
|
12
|
+
"never",
|
|
13
|
+
"primitive"
|
|
14
|
+
];
|
|
15
|
+
const PRIMITIVE_OBJECTS = [
|
|
16
|
+
"date",
|
|
17
|
+
"any",
|
|
18
|
+
"object"
|
|
11
19
|
];
|
|
12
|
-
const PRIMITIVE_OBJECTS = ["date", "primitive"];
|
|
13
20
|
const OPTIONAL = "$$app-ts => optional$$";
|
|
14
21
|
const CUSTOM = "$$app-ts => custom$$";
|
|
15
22
|
const PARTIAL = "$$app-ts => partial$$";
|
package/lib/constants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const PRIMITIVES = [\n
|
|
1
|
+
{"version":3,"file":"constants.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const PRIMITIVES = [\n \"string\",\n \"number\",\n \"boolean\",\n \"bigint\",\n \"symbol\",\n \"undefined\",\n \"null\",\n \"unknown\",\n \"never\",\n \"primitive\",\n] as const;\n\nexport const PRIMITIVE_OBJECTS = [\"date\", \"any\", \"object\"] as const;\nexport const OPTIONAL = \"$$app-ts => optional$$\" as const;\nexport const CUSTOM = \"$$app-ts => custom$$\" as const;\nexport const PARTIAL = \"$$app-ts => partial$$\" as const;\nexport const ARRAY = \"$$app-ts => array$$\" as const;\nexport const SOA = \"$$app-ts => soa$$\" as const;\n"],"mappings":";;AAAA,MAAa,aAAa;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,oBAAoB;CAAC;CAAQ;CAAO;CAAS;AAC1D,MAAa,WAAW;AACxB,MAAa,SAAS;AACtB,MAAa,UAAU;AACvB,MAAa,QAAQ;AACrB,MAAa,MAAM"}
|
package/lib/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const PRIMITIVES: readonly ["string", "number", "boolean", "bigint", "symbol", "undefined", "null"];
|
|
2
|
-
export declare const PRIMITIVE_OBJECTS: readonly ["date", "
|
|
1
|
+
export declare const PRIMITIVES: readonly ["string", "number", "boolean", "bigint", "symbol", "undefined", "null", "unknown", "never", "primitive"];
|
|
2
|
+
export declare const PRIMITIVE_OBJECTS: readonly ["date", "any", "object"];
|
|
3
3
|
export declare const OPTIONAL: "$$app-ts => optional$$";
|
|
4
4
|
export declare const CUSTOM: "$$app-ts => custom$$";
|
|
5
5
|
export declare const PARTIAL: "$$app-ts => partial$$";
|
package/lib/constants.js
CHANGED
|
@@ -6,9 +6,16 @@ const PRIMITIVES = [
|
|
|
6
6
|
"bigint",
|
|
7
7
|
"symbol",
|
|
8
8
|
"undefined",
|
|
9
|
-
"null"
|
|
9
|
+
"null",
|
|
10
|
+
"unknown",
|
|
11
|
+
"never",
|
|
12
|
+
"primitive"
|
|
13
|
+
];
|
|
14
|
+
const PRIMITIVE_OBJECTS = [
|
|
15
|
+
"date",
|
|
16
|
+
"any",
|
|
17
|
+
"object"
|
|
10
18
|
];
|
|
11
|
-
const PRIMITIVE_OBJECTS = ["date", "primitive"];
|
|
12
19
|
const OPTIONAL = "$$app-ts => optional$$";
|
|
13
20
|
const CUSTOM = "$$app-ts => custom$$";
|
|
14
21
|
const PARTIAL = "$$app-ts => partial$$";
|
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const PRIMITIVES = [\n
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const PRIMITIVES = [\n \"string\",\n \"number\",\n \"boolean\",\n \"bigint\",\n \"symbol\",\n \"undefined\",\n \"null\",\n \"unknown\",\n \"never\",\n \"primitive\",\n] as const;\n\nexport const PRIMITIVE_OBJECTS = [\"date\", \"any\", \"object\"] as const;\nexport const OPTIONAL = \"$$app-ts => optional$$\" as const;\nexport const CUSTOM = \"$$app-ts => custom$$\" as const;\nexport const PARTIAL = \"$$app-ts => partial$$\" as const;\nexport const ARRAY = \"$$app-ts => array$$\" as const;\nexport const SOA = \"$$app-ts => soa$$\" as const;\n"],"mappings":";AAAA,MAAa,aAAa;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,oBAAoB;CAAC;CAAQ;CAAO;CAAS;AAC1D,MAAa,WAAW;AACxB,MAAa,SAAS;AACtB,MAAa,UAAU;AACvB,MAAa,QAAQ;AACrB,MAAa,MAAM"}
|
package/lib/helpers/any.cjs
CHANGED
package/lib/helpers/any.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any.cjs","names":[],"sources":["../../src/helpers/any.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"any.cjs","names":[],"sources":["../../src/helpers/any.ts"],"sourcesContent":["import type { ObjectT } from \"../types\";\n\nconst any = <T extends ObjectT = ObjectT>(value?: T) =>\n value as ObjectT extends T ? \"any\" : T;\nexport { any };\n"],"mappings":";;AAEA,MAAM,OAAoC,UACxC"}
|
package/lib/helpers/any.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const any: <T extends
|
|
3
|
-
export
|
|
1
|
+
import type { ObjectT } from "../types";
|
|
2
|
+
declare const any: <T extends ObjectT = ObjectT>(value?: T) => ObjectT extends T ? "any" : T;
|
|
3
|
+
export { any };
|
package/lib/helpers/any.js
CHANGED
package/lib/helpers/any.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any.js","names":[],"sources":["../../src/helpers/any.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"any.js","names":[],"sources":["../../src/helpers/any.ts"],"sourcesContent":["import type { ObjectT } from \"../types\";\n\nconst any = <T extends ObjectT = ObjectT>(value?: T) =>\n value as ObjectT extends T ? \"any\" : T;\nexport { any };\n"],"mappings":";AAEA,MAAM,OAAoC,UACxC"}
|
package/lib/helpers/array.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
2
|
const require_constants = require("../constants.cjs");
|
|
2
3
|
//#region src/helpers/array.ts
|
|
3
4
|
const array = (value) => {
|
|
4
5
|
return { [require_constants.ARRAY]: value };
|
|
5
6
|
};
|
|
6
7
|
//#endregion
|
|
7
|
-
|
|
8
|
+
exports.array = array;
|
|
8
9
|
|
|
9
10
|
//# sourceMappingURL=array.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.cjs","names":["ARRAY"],"sources":["../../src/helpers/array.ts"],"sourcesContent":["import { ARRAY } from
|
|
1
|
+
{"version":3,"file":"array.cjs","names":["ARRAY"],"sources":["../../src/helpers/array.ts"],"sourcesContent":["import { ARRAY } from \"../constants\";\nimport type { ArrayCustom, NotReadonly, ObjectT } from \"../types\";\n\nconst array = <const T extends ObjectT>(value: T) => {\n type Out = ArrayCustom<Extract<NotReadonly<T>, ObjectT>>;\n\n return { [ARRAY]: value } as Out;\n};\n\nexport { array };\n"],"mappings":";;;AAGA,MAAM,SAAkC,UAAa;AAGnD,QAAO,GAAGA,kBAAAA,QAAQ,OAAO"}
|
package/lib/helpers/array.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { ArrayCustom, NotReadonly,
|
|
2
|
-
declare const array: <const T extends
|
|
3
|
-
export
|
|
1
|
+
import type { ArrayCustom, NotReadonly, ObjectT } from "../types";
|
|
2
|
+
declare const array: <const T extends ObjectT>(value: T) => ArrayCustom<Extract<NotReadonly<T>, ObjectT>>;
|
|
3
|
+
export { array };
|
package/lib/helpers/array.js
CHANGED
package/lib/helpers/array.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","names":[],"sources":["../../src/helpers/array.ts"],"sourcesContent":["import { ARRAY } from
|
|
1
|
+
{"version":3,"file":"array.js","names":[],"sources":["../../src/helpers/array.ts"],"sourcesContent":["import { ARRAY } from \"../constants\";\nimport type { ArrayCustom, NotReadonly, ObjectT } from \"../types\";\n\nconst array = <const T extends ObjectT>(value: T) => {\n type Out = ArrayCustom<Extract<NotReadonly<T>, ObjectT>>;\n\n return { [ARRAY]: value } as Out;\n};\n\nexport { array };\n"],"mappings":";;AAGA,MAAM,SAAkC,UAAa;AAGnD,QAAO,GAAG,QAAQ,OAAO"}
|
package/lib/helpers/custom.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
2
|
const require_constants = require("../constants.cjs");
|
|
2
3
|
//#region src/helpers/custom.ts
|
|
3
4
|
const custom = (value) => ({ [require_constants.CUSTOM]: value });
|
|
4
5
|
//#endregion
|
|
5
|
-
|
|
6
|
+
exports.custom = custom;
|
|
6
7
|
|
|
7
8
|
//# sourceMappingURL=custom.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.cjs","names":["CUSTOM"],"sources":["../../src/helpers/custom.ts"],"sourcesContent":["import { CUSTOM } from
|
|
1
|
+
{"version":3,"file":"custom.cjs","names":["CUSTOM"],"sources":["../../src/helpers/custom.ts"],"sourcesContent":["import { CUSTOM } from \"../constants\";\nimport type { Custom } from \"../types\";\n\nconst custom = <T = any>(value?: T) =>\n ({\n [CUSTOM]: value,\n }) as Custom<T>;\n\nexport { custom };\n"],"mappings":";;;AAGA,MAAM,UAAmB,WACtB,GACEA,kBAAAA,SAAS,OACX"}
|
package/lib/helpers/custom.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Custom } from
|
|
1
|
+
import type { Custom } from "../types";
|
|
2
2
|
declare const custom: <T = any>(value?: T) => Custom<T>;
|
|
3
|
-
export
|
|
3
|
+
export { custom };
|
package/lib/helpers/custom.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.js","names":[],"sources":["../../src/helpers/custom.ts"],"sourcesContent":["import { CUSTOM } from
|
|
1
|
+
{"version":3,"file":"custom.js","names":[],"sources":["../../src/helpers/custom.ts"],"sourcesContent":["import { CUSTOM } from \"../constants\";\nimport type { Custom } from \"../types\";\n\nconst custom = <T = any>(value?: T) =>\n ({\n [CUSTOM]: value,\n }) as Custom<T>;\n\nexport { custom };\n"],"mappings":";;AAGA,MAAM,UAAmB,WACtB,GACE,SAAS,OACX"}
|
package/lib/helpers/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
3
|
const require_helpers_any = require("./any.cjs");
|
|
3
4
|
const require_helpers_array = require("./array.cjs");
|
|
4
5
|
const require_helpers_custom = require("./custom.cjs");
|
|
@@ -11,15 +12,42 @@ const require_helpers_soa = require("./soa.cjs");
|
|
|
11
12
|
const require_helpers_sv = require("./sv.cjs");
|
|
12
13
|
const require_helpers_tuple = require("./tuple.cjs");
|
|
13
14
|
const require_helpers_union = require("./union.cjs");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
const require_helpers_primitiveObject = require("./primitiveObject.cjs");
|
|
16
|
+
//#region src/helpers/index.ts
|
|
17
|
+
var helpers_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
18
|
+
any: () => require_helpers_any.any,
|
|
19
|
+
array: () => require_helpers_array.array,
|
|
20
|
+
custom: () => require_helpers_custom.custom,
|
|
21
|
+
intersection: () => require_helpers_intersection.intersection,
|
|
22
|
+
litterals: () => require_helpers_litterals.litterals,
|
|
23
|
+
optional: () => require_helpers_optional.optional,
|
|
24
|
+
partial: () => require_helpers_partial.partial,
|
|
25
|
+
primitiveObject: () => require_helpers_primitiveObject.primitiveObject,
|
|
26
|
+
record: () => require_helpers_record.record,
|
|
27
|
+
soa: () => require_helpers_soa.soa,
|
|
28
|
+
sv: () => require_helpers_sv.sv,
|
|
29
|
+
tuple: () => require_helpers_tuple.tuple,
|
|
30
|
+
union: () => require_helpers_union.union
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.any = require_helpers_any.any;
|
|
34
|
+
exports.array = require_helpers_array.array;
|
|
35
|
+
exports.custom = require_helpers_custom.custom;
|
|
36
|
+
Object.defineProperty(exports, "helpers_exports", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function() {
|
|
39
|
+
return helpers_exports;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
exports.intersection = require_helpers_intersection.intersection;
|
|
43
|
+
exports.litterals = require_helpers_litterals.litterals;
|
|
44
|
+
exports.optional = require_helpers_optional.optional;
|
|
45
|
+
exports.partial = require_helpers_partial.partial;
|
|
46
|
+
exports.primitiveObject = require_helpers_primitiveObject.primitiveObject;
|
|
47
|
+
exports.record = require_helpers_record.record;
|
|
48
|
+
exports.soa = require_helpers_soa.soa;
|
|
49
|
+
exports.sv = require_helpers_sv.sv;
|
|
50
|
+
exports.tuple = require_helpers_tuple.tuple;
|
|
51
|
+
exports.union = require_helpers_union.union;
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/helpers/index.ts"],"sourcesContent":["export * from \"./any\";\nexport * from \"./array\";\nexport * from \"./custom\";\nexport * from \"./intersection\";\nexport * from \"./litterals\";\nexport * from \"./optional\";\nexport * from \"./partial\";\nexport * from \"./record\";\nexport * from \"./soa\";\nexport * from \"./sv\";\nexport * from \"./tuple\";\nexport * from \"./union\";\nexport * from \"./primitiveObject\";\n"],"mappings":""}
|
package/lib/helpers/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
1
|
+
export * from "./any";
|
|
2
|
+
export * from "./array";
|
|
3
|
+
export * from "./custom";
|
|
4
|
+
export * from "./intersection";
|
|
5
|
+
export * from "./litterals";
|
|
6
|
+
export * from "./optional";
|
|
7
|
+
export * from "./partial";
|
|
8
|
+
export * from "./record";
|
|
9
|
+
export * from "./soa";
|
|
10
|
+
export * from "./sv";
|
|
11
|
+
export * from "./tuple";
|
|
12
|
+
export * from "./union";
|
|
13
|
+
export * from "./primitiveObject";
|
package/lib/helpers/index.js
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { any } from "./any.js";
|
|
3
|
+
import { array } from "./array.js";
|
|
4
|
+
import { custom } from "./custom.js";
|
|
5
|
+
import { intersection } from "./intersection.js";
|
|
6
|
+
import { litterals } from "./litterals.js";
|
|
7
|
+
import { optional } from "./optional.js";
|
|
8
|
+
import { partial } from "./partial.js";
|
|
9
|
+
import { record } from "./record.js";
|
|
10
|
+
import { soa } from "./soa.js";
|
|
11
|
+
import { sv } from "./sv.js";
|
|
12
|
+
import { tuple } from "./tuple.js";
|
|
13
|
+
import { union } from "./union.js";
|
|
14
|
+
import { primitiveObject } from "./primitiveObject.js";
|
|
15
|
+
//#region src/helpers/index.ts
|
|
16
|
+
var helpers_exports = /* @__PURE__ */ __exportAll({
|
|
17
|
+
any: () => any,
|
|
18
|
+
array: () => array,
|
|
19
|
+
custom: () => custom,
|
|
20
|
+
intersection: () => intersection,
|
|
21
|
+
litterals: () => litterals,
|
|
22
|
+
optional: () => optional,
|
|
23
|
+
partial: () => partial,
|
|
24
|
+
primitiveObject: () => primitiveObject,
|
|
25
|
+
record: () => record,
|
|
26
|
+
soa: () => soa,
|
|
27
|
+
sv: () => sv,
|
|
28
|
+
tuple: () => tuple,
|
|
29
|
+
union: () => union
|
|
30
|
+
});
|
|
31
|
+
//#endregion
|
|
32
|
+
export { any, array, custom, helpers_exports, intersection, litterals, optional, partial, primitiveObject, record, soa, sv, tuple, union };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/helpers/index.ts"],"sourcesContent":["export * from \"./any\";\nexport * from \"./array\";\nexport * from \"./custom\";\nexport * from \"./intersection\";\nexport * from \"./litterals\";\nexport * from \"./optional\";\nexport * from \"./partial\";\nexport * from \"./record\";\nexport * from \"./soa\";\nexport * from \"./sv\";\nexport * from \"./tuple\";\nexport * from \"./union\";\nexport * from \"./primitiveObject\";\n"],"mappings":""}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
2
|
//#region src/helpers/intersection.ts
|
|
2
3
|
const intersection = (...values) => {
|
|
3
4
|
return values.reduce((acc, curr) => {
|
|
@@ -8,6 +9,6 @@ const intersection = (...values) => {
|
|
|
8
9
|
}, {});
|
|
9
10
|
};
|
|
10
11
|
//#endregion
|
|
11
|
-
|
|
12
|
+
exports.intersection = intersection;
|
|
12
13
|
|
|
13
14
|
//# sourceMappingURL=intersection.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intersection.cjs","names":[],"sources":["../../src/helpers/intersection.ts"],"sourcesContent":["import type { ObjectMapS } from
|
|
1
|
+
{"version":3,"file":"intersection.cjs","names":[],"sources":["../../src/helpers/intersection.ts"],"sourcesContent":["import type { ObjectMapS } from \"../types\";\n\ntype _IntersectionCustom<T extends ObjectMapS[]> = T extends [\n infer First extends ObjectMapS,\n ...infer Rest extends ObjectMapS[],\n]\n ? First & IntersectionCustom<Rest>\n : unknown;\n\nexport type IntersectionCustom<T extends ObjectMapS[]> =\n _IntersectionCustom<T> extends infer R\n ? {\n [K in keyof R]: R[K];\n }\n : never;\n\nconst intersection = <T extends [ObjectMapS, ObjectMapS, ...ObjectMapS[]]>(\n ...values: T\n) => {\n const out = values.reduce((acc, curr) => {\n Object.entries(curr).forEach(([key, value]) => {\n acc[key] = value;\n });\n return acc;\n }, {} as any);\n return out as IntersectionCustom<T>;\n};\n\nexport { intersection };\n"],"mappings":";;AAgBA,MAAM,gBACJ,GAAG,WACA;AAOH,QANY,OAAO,QAAQ,KAAK,SAAS;AACvC,SAAO,QAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,WAAW;AAC7C,OAAI,OAAO;IACX;AACF,SAAO;IACN,EAAE,CAAQ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ObjectMapS } from
|
|
1
|
+
import type { ObjectMapS } from "../types";
|
|
2
2
|
type _IntersectionCustom<T extends ObjectMapS[]> = T extends [
|
|
3
3
|
infer First extends ObjectMapS,
|
|
4
4
|
...infer Rest extends ObjectMapS[]
|
|
@@ -7,4 +7,4 @@ export type IntersectionCustom<T extends ObjectMapS[]> = _IntersectionCustom<T>
|
|
|
7
7
|
[K in keyof R]: R[K];
|
|
8
8
|
} : never;
|
|
9
9
|
declare const intersection: <T extends [ObjectMapS, ObjectMapS, ...ObjectMapS[]]>(...values: T) => IntersectionCustom<T>;
|
|
10
|
-
export
|
|
10
|
+
export { intersection };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intersection.js","names":[],"sources":["../../src/helpers/intersection.ts"],"sourcesContent":["import type { ObjectMapS } from
|
|
1
|
+
{"version":3,"file":"intersection.js","names":[],"sources":["../../src/helpers/intersection.ts"],"sourcesContent":["import type { ObjectMapS } from \"../types\";\n\ntype _IntersectionCustom<T extends ObjectMapS[]> = T extends [\n infer First extends ObjectMapS,\n ...infer Rest extends ObjectMapS[],\n]\n ? First & IntersectionCustom<Rest>\n : unknown;\n\nexport type IntersectionCustom<T extends ObjectMapS[]> =\n _IntersectionCustom<T> extends infer R\n ? {\n [K in keyof R]: R[K];\n }\n : never;\n\nconst intersection = <T extends [ObjectMapS, ObjectMapS, ...ObjectMapS[]]>(\n ...values: T\n) => {\n const out = values.reduce((acc, curr) => {\n Object.entries(curr).forEach(([key, value]) => {\n acc[key] = value;\n });\n return acc;\n }, {} as any);\n return out as IntersectionCustom<T>;\n};\n\nexport { intersection };\n"],"mappings":";AAgBA,MAAM,gBACJ,GAAG,WACA;AAOH,QANY,OAAO,QAAQ,KAAK,SAAS;AACvC,SAAO,QAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,WAAW;AAC7C,OAAI,OAAO;IACX;AACF,SAAO;IACN,EAAE,CAAQ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
2
|
//#region src/helpers/litterals.ts
|
|
2
3
|
const litterals = (...values) => values[0];
|
|
3
4
|
//#endregion
|
|
4
|
-
|
|
5
|
+
exports.litterals = litterals;
|
|
5
6
|
|
|
6
7
|
//# sourceMappingURL=litterals.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"litterals.cjs","names":[],"sources":["../../src/helpers/litterals.ts"],"sourcesContent":["import type { Custom } from
|
|
1
|
+
{"version":3,"file":"litterals.cjs","names":[],"sources":["../../src/helpers/litterals.ts"],"sourcesContent":["import type { Custom } from \"../types\";\n\nconst litterals = <const T extends (string | number | boolean)[]>(\n ...values: T\n) => values[0] as unknown as Custom<T[number]>;\n\nexport { litterals };\n"],"mappings":";;AAEA,MAAM,aACJ,GAAG,WACA,OAAO"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Custom } from
|
|
1
|
+
import type { Custom } from "../types";
|
|
2
2
|
declare const litterals: <const T extends (string | number | boolean)[]>(...values: T) => Custom<T[number]>;
|
|
3
|
-
export
|
|
3
|
+
export { litterals };
|
package/lib/helpers/litterals.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"litterals.js","names":[],"sources":["../../src/helpers/litterals.ts"],"sourcesContent":["import type { Custom } from
|
|
1
|
+
{"version":3,"file":"litterals.js","names":[],"sources":["../../src/helpers/litterals.ts"],"sourcesContent":["import type { Custom } from \"../types\";\n\nconst litterals = <const T extends (string | number | boolean)[]>(\n ...values: T\n) => values[0] as unknown as Custom<T[number]>;\n\nexport { litterals };\n"],"mappings":";AAEA,MAAM,aACJ,GAAG,WACA,OAAO"}
|
package/lib/helpers/optional.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
2
|
const require_constants = require("../constants.cjs");
|
|
2
3
|
//#region src/helpers/optional.ts
|
|
3
4
|
const optional = (value) => ({ [require_constants.OPTIONAL]: value });
|
|
4
5
|
//#endregion
|
|
5
|
-
|
|
6
|
+
exports.optional = optional;
|
|
6
7
|
|
|
7
8
|
//# sourceMappingURL=optional.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional.cjs","names":["OPTIONAL"],"sources":["../../src/helpers/optional.ts"],"sourcesContent":["import { OPTIONAL } from
|
|
1
|
+
{"version":3,"file":"optional.cjs","names":["OPTIONAL"],"sources":["../../src/helpers/optional.ts"],"sourcesContent":["import { OPTIONAL } from \"../constants\";\nimport type { __ObjectT, AnyArray, ArrayCustom, Optional } from \"../types\";\n\nconst optional = <T extends __ObjectT | ArrayCustom | AnyArray<__ObjectT>>(\n value?: T,\n) =>\n ({\n [OPTIONAL]: value,\n }) as Optional<T>;\n\nexport { optional };\n"],"mappings":";;;AAGA,MAAM,YACJ,WAEC,GACEA,kBAAAA,WAAW,OACb"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const optional: <T extends
|
|
3
|
-
export
|
|
1
|
+
import type { __ObjectT, AnyArray, ArrayCustom, Optional } from "../types";
|
|
2
|
+
declare const optional: <T extends __ObjectT | ArrayCustom | AnyArray<__ObjectT>>(value?: T) => Optional<T>;
|
|
3
|
+
export { optional };
|
package/lib/helpers/optional.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional.js","names":[],"sources":["../../src/helpers/optional.ts"],"sourcesContent":["import { OPTIONAL } from
|
|
1
|
+
{"version":3,"file":"optional.js","names":[],"sources":["../../src/helpers/optional.ts"],"sourcesContent":["import { OPTIONAL } from \"../constants\";\nimport type { __ObjectT, AnyArray, ArrayCustom, Optional } from \"../types\";\n\nconst optional = <T extends __ObjectT | ArrayCustom | AnyArray<__ObjectT>>(\n value?: T,\n) =>\n ({\n [OPTIONAL]: value,\n }) as Optional<T>;\n\nexport { optional };\n"],"mappings":";;AAGA,MAAM,YACJ,WAEC,GACE,WAAW,OACb"}
|
package/lib/helpers/partial.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
2
|
const require_constants = require("../constants.cjs");
|
|
2
3
|
//#region src/helpers/partial.ts
|
|
3
4
|
const partial = (value) => {
|
|
@@ -9,6 +10,6 @@ const partial = (value) => {
|
|
|
9
10
|
return out;
|
|
10
11
|
};
|
|
11
12
|
//#endregion
|
|
12
|
-
|
|
13
|
+
exports.partial = partial;
|
|
13
14
|
|
|
14
15
|
//# sourceMappingURL=partial.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partial.cjs","names":["PARTIAL"],"sources":["../../src/helpers/partial.ts"],"sourcesContent":["import { PARTIAL } from
|
|
1
|
+
{"version":3,"file":"partial.cjs","names":["PARTIAL"],"sources":["../../src/helpers/partial.ts"],"sourcesContent":["import { PARTIAL } from \"../constants\";\nimport type { ObjectT, PartialCustom } from \"../types\";\n\nconst partial = <T extends ObjectT>(value: T): T & PartialCustom => {\n const entries = Object.entries(value).filter(([key]) => key !== PARTIAL);\n const out: any = {};\n\n entries.forEach(([key, value]) => {\n out[key] = value;\n });\n\n return out;\n};\n\nexport { partial };\n"],"mappings":";;;AAGA,MAAM,WAA8B,UAAgC;CAClE,MAAM,UAAU,OAAO,QAAQ,MAAM,CAAC,QAAQ,CAAC,SAAS,QAAQA,kBAAAA,QAAQ;CACxE,MAAM,MAAW,EAAE;AAEnB,SAAQ,SAAS,CAAC,KAAK,WAAW;AAChC,MAAI,OAAO;GACX;AAEF,QAAO"}
|
package/lib/helpers/partial.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const partial: <T extends
|
|
3
|
-
export
|
|
1
|
+
import type { ObjectT, PartialCustom } from "../types";
|
|
2
|
+
declare const partial: <T extends ObjectT>(value: T) => T & PartialCustom;
|
|
3
|
+
export { partial };
|
package/lib/helpers/partial.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partial.js","names":[],"sources":["../../src/helpers/partial.ts"],"sourcesContent":["import { PARTIAL } from
|
|
1
|
+
{"version":3,"file":"partial.js","names":[],"sources":["../../src/helpers/partial.ts"],"sourcesContent":["import { PARTIAL } from \"../constants\";\nimport type { ObjectT, PartialCustom } from \"../types\";\n\nconst partial = <T extends ObjectT>(value: T): T & PartialCustom => {\n const entries = Object.entries(value).filter(([key]) => key !== PARTIAL);\n const out: any = {};\n\n entries.forEach(([key, value]) => {\n out[key] = value;\n });\n\n return out;\n};\n\nexport { partial };\n"],"mappings":";;AAGA,MAAM,WAA8B,UAAgC;CAClE,MAAM,UAAU,OAAO,QAAQ,MAAM,CAAC,QAAQ,CAAC,SAAS,QAAQ,QAAQ;CACxE,MAAM,MAAW,EAAE;AAEnB,SAAQ,SAAS,CAAC,KAAK,WAAW;AAChC,MAAI,OAAO;GACX;AAEF,QAAO"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/helpers/primitiveObject.ts
|
|
3
|
+
const primitiveObject = require("../utils/expandFn.cjs").expandFn((value) => {
|
|
4
|
+
return value || {};
|
|
5
|
+
}, { map: (value) => {
|
|
6
|
+
return value || {};
|
|
7
|
+
} });
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.primitiveObject = primitiveObject;
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=primitiveObject.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitiveObject.cjs","names":["expandFn"],"sources":["../../src/helpers/primitiveObject.ts"],"sourcesContent":["import type {\n NotReadonly,\n PrimitiveObjectMapS,\n PrimitiveObjectT,\n} from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nconst primitiveObject = expandFn(\n <const T extends PrimitiveObjectT = PrimitiveObjectT>(\n value?: T,\n ): Exclude<NotReadonly<T>, undefined> => {\n return (value || {}) as any;\n },\n {\n map: <const T extends PrimitiveObjectMapS = PrimitiveObjectMapS>(\n value?: T,\n ): Exclude<NotReadonly<T>, undefined> => {\n return (value || {}) as any;\n },\n },\n);\n\nexport { primitiveObject };\n"],"mappings":";;AAOA,MAAM,mDAAkBA,UAEpB,UACuC;AACvC,QAAQ,SAAS,EAAE;GAErB,EACE,MACE,UACuC;AACvC,QAAQ,SAAS,EAAE;GAEtB,CACF"}
|