@bemedev/typings 1.1.0 → 1.1.2

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/lib/index.cjs CHANGED
@@ -1,17 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_constants = require("./constants.cjs");
3
2
  const require_type = require("./type.cjs");
4
- exports.ARRAY = require_constants.ARRAY;
5
- exports.CUSTOM = require_constants.CUSTOM;
6
- exports.LITTERALS = require_constants.LITTERALS;
7
- exports.OPTIONAL = require_constants.OPTIONAL;
8
- exports.PARTIAL = require_constants.PARTIAL;
9
- exports.PRIMITIVES = require_constants.PRIMITIVES;
10
- exports.PRIMITIVE_OBJECTS = require_constants.PRIMITIVE_OBJECTS;
11
- exports.SOA = require_constants.SOA;
12
- exports.SORA = require_constants.SORA;
13
- exports.STANDARD_KEY = require_constants.STANDARD_KEY;
14
- exports.UNION = require_constants.UNION;
15
3
  exports.pretype = require_type.pretype;
16
4
  exports.type = require_type.type;
17
- exports.vendor = require_constants.vendor;
package/lib/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export * from './constants';
2
1
  export * from './type';
3
2
  export * from './types';
package/lib/index.js CHANGED
@@ -1,3 +1,2 @@
1
- import { ARRAY, CUSTOM, LITTERALS, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, STANDARD_KEY, UNION, vendor } from "./constants.js";
2
1
  import { pretype, type } from "./type.js";
3
- export { ARRAY, CUSTOM, LITTERALS, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, STANDARD_KEY, UNION, pretype, type, vendor };
2
+ export { pretype, type };
package/lib/type.cjs CHANGED
@@ -51,7 +51,7 @@ const type = (option) => {
51
51
  else out = _transform(option);
52
52
  return require_standard.standardize(out);
53
53
  };
54
- const pretype = () => type;
54
+ const pretype = (_) => type;
55
55
  //#endregion
56
56
  exports.pretype = pretype;
57
57
  exports.type = type;
package/lib/type.d.ts CHANGED
@@ -22,7 +22,10 @@ type Helpers = {
22
22
  sora: typeof sora;
23
23
  };
24
24
  export type Transform_F = <T extends ObjectT = ObjectT>(option?: ((helpers: Helpers) => T) | T) => inferSh<T>;
25
- export type PreTransform = <U extends ObjectT>() => <T extends U = U>(option?: ((helpers: Helpers) => T) | T) => inferSh<T>;
25
+ export type PreTransform = <U extends ObjectT>(_?: inferSh<U>) => {
26
+ <T extends U = U>(option?: ((helpers: Helpers) => T) | T): inferSh<T>;
27
+ type: <T extends U = U>(option?: ((helpers: Helpers) => T) | T) => inferSh<T>;
28
+ };
26
29
  export declare const type: Transform_F;
27
30
  export declare const pretype: PreTransform;
28
31
  export {};
package/lib/type.js CHANGED
@@ -50,6 +50,6 @@ const type = (option) => {
50
50
  else out = _transform(option);
51
51
  return standardize(out);
52
52
  };
53
- const pretype = () => type;
53
+ const pretype = (_) => type;
54
54
  //#endregion
55
55
  export { pretype, type };
package/lib/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { ARRAY, CUSTOM, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, STANDARD_KEY, UNION } from "./constants";
2
- import type { StandardSchemaV1 } from "./standard.types";
1
+ import type { ARRAY, CUSTOM, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, STANDARD_KEY, UNION } from './constants';
2
+ import type { StandardSchemaV1 } from './standard.types';
3
3
  export type Ru = Record<Keys, unknown>;
4
4
  type Equals<T, U> = T extends U ? (U extends T ? true : false) : false;
5
5
  export type TrueObject = Ru & {
@@ -28,9 +28,9 @@ export type SingleOrRecursiveArrayOf<T> = T | RecursiveArrayOf<T>;
28
28
  export type SoRa<T> = SingleOrRecursiveArrayOf<T>;
29
29
  export type Primitive = string | number | boolean | bigint | null | undefined | symbol | never;
30
30
  export type PrimitiveT = (typeof PRIMITIVES)[number];
31
- type TransformPrimitiveS<T extends PrimitiveT> = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends "bigint" ? bigint : T extends "null" ? null : T extends "undefined" ? undefined : T extends "symbol" ? symbol : T extends "never" ? never : Primitive;
31
+ type TransformPrimitiveS<T extends PrimitiveT> = T extends 'string' ? string : T extends 'number' ? number : T extends 'boolean' ? boolean : T extends 'bigint' ? bigint : T extends 'null' ? null : T extends 'undefined' ? undefined : T extends 'symbol' ? symbol : T extends 'never' ? never : Primitive;
32
32
  export type Types = PrimitiveT | (typeof PRIMITIVE_OBJECTS)[number];
33
- export type TransformTypes<T extends Types> = T extends PrimitiveT ? TransformPrimitiveS<T> : T extends "date" ? Date : T extends "any" ? any : T extends "unknown" ? unknown : object;
33
+ export type TransformTypes<T extends Types> = T extends PrimitiveT ? TransformPrimitiveS<T> : T extends 'date' ? Date : T extends 'any' ? any : T extends 'unknown' ? unknown : object;
34
34
  export type Custom<T = any> = {
35
35
  [CUSTOM]: T;
36
36
  };
@@ -84,7 +84,7 @@ type ReduceTuple2<T extends AnyArray<ObjectT>> = T extends [
84
84
  type ReduceTupleU<T extends AnyArray> = T extends [
85
85
  infer First,
86
86
  ...infer Rest extends AnyArray
87
- ] ? [Undefiny<First>, ...ReduceTupleU<Rest>] : T[number] extends never ? [] : T["length"] extends 0 ? [] : number extends T["length"] ? T : Undefiny<T[number]>[];
87
+ ] ? [Undefiny<First>, ...ReduceTupleU<Rest>] : T[number] extends never ? [] : T['length'] extends 0 ? [] : number extends T['length'] ? T : Undefiny<T[number]>[];
88
88
  type EmptyObject = {};
89
89
  type __TransformUnion<T extends UnionCustom> = T extends UnionCustom<infer TCustom> ? Omit<T, typeof UNION> extends infer Ot ? Equals<Ot, EmptyObject> extends true ? TransformT<TCustom[number]> : TransformT<TCustom[number]> & TransformT<Ot> : never : never;
90
90
  type HasUndefined<T> = unknown extends T ? false : OptionalHelperClass extends T ? true : false;
@@ -96,10 +96,9 @@ type UndefinyObject<T extends object> = {
96
96
  [K in keyof F]: F[K];
97
97
  } : never;
98
98
  type Undefiny<T, U = Exclude<T, OptionalHelperClass>> = U extends AnyArray ? ReduceTupleU<U> : U extends Ru ? UndefinyObject<U> : U;
99
- type __TransformPrimitiveObject<T> = Equals<ObjectMapS, T> extends true ? object : T extends Types ? TransformTypes<T> : T extends ArrayCustom<infer A> ? TransformT<A>[] : T extends UnionCustom ? __TransformUnion<T> : T extends SoRaCustom<infer TSoA> ? SoRa<__TransformPrimitiveObject<TSoA>> : T extends SoaCustom<infer TSoA> ? SoA<__TransformPrimitiveObject<TSoA>> : T extends Custom<infer TCustom> ? TCustom : T extends AnyArray<ObjectT> ? ReduceTuple2<T> : T extends PartialCustom<infer TPartial> ? Partial<__TransformPrimitiveObject<TPartial>> : T extends Optional<infer TOptional> ? __TransformPrimitiveObject<TOptional> | OptionalHelperClass : Undefiny<{
100
- [K in keyof T]: __TransformPrimitiveObject<T[K]>;
99
+ type TransformT<T> = Equals<ObjectMapS, T> extends true ? object : T extends Types ? TransformTypes<T> : T extends ArrayCustom<infer A> ? TransformT<A>[] : T extends UnionCustom ? __TransformUnion<T> : T extends SoRaCustom<infer TSoA> ? SoRa<TransformT<TSoA>> : T extends SoaCustom<infer TSoA> ? SoA<TransformT<TSoA>> : T extends Custom<infer TCustom> ? TCustom : T extends AnyArray<ObjectT> ? ReduceTuple2<T> : T extends PartialCustom<infer TPartial> ? Partial<TransformT<TPartial>> : T extends Optional<infer TOptional> ? TransformT<TOptional> | OptionalHelperClass : Undefiny<{
100
+ [K in keyof T]: TransformT<T[K]>;
101
101
  }>;
102
- type TransformT<T> = __TransformPrimitiveObject<T>;
103
102
  export type StandardHelper<T1 = any, T2 = any> = {
104
103
  __type: T1;
105
104
  type: T2;
@@ -115,7 +114,7 @@ export type StandardOutput<T = any> = {
115
114
  };
116
115
  export type inferO<T extends ObjectT = ObjectT> = ObjectT extends T ? unknown : T extends Optional<infer U> ? TransformT<U> | undefined : TransformT<T>;
117
116
  export type inferSh<T extends ObjectT = ObjectT> = _Sh<T, inferO<T>>;
118
- export type inferT<T extends StandardOutput = StandardOutput> = Exclude<T[typeof STANDARD_KEY]["types"], undefined>["output"];
117
+ export type inferT<T extends StandardOutput = StandardOutput> = Exclude<T[typeof STANDARD_KEY]['types'], undefined>['output'];
119
118
  export type ProduceObject<T extends ObjectT = ObjectT> = T;
120
119
  export type FnBasic<Main extends Fn, Tr extends object> = Tr & Main;
121
- export * from "./standard.types";
120
+ export * from './standard.types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bemedev/typings",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Typings by variables",
5
5
  "author": {
6
6
  "email": "bri_lvi@icloud.com",
@@ -27,6 +27,11 @@
27
27
  "require": "./lib/helpers/index.cjs",
28
28
  "types": "./lib/helpers/index.d.ts"
29
29
  },
30
+ "./constants": {
31
+ "import": "./lib/constants.js",
32
+ "require": "./lib/constants.cjs",
33
+ "types": "./lib/constants.d.ts"
34
+ },
30
35
  "./package.json": "./package.json",
31
36
  "./tsconfig.json": "./tsconfig.json",
32
37
  "./types": {
@@ -64,8 +69,9 @@
64
69
  },
65
70
  "scripts": {
66
71
  "build": "pnpm rm:lib && pnpm run rolldown",
67
- "ci": "CI_START=$(date +%s) && pnpm run config:off && pnpm run lint && pnpm run test && pnpm run p-q && echo \"\n✅ CI takes $(($(date +%s) - CI_START))s\n\"",
68
- "ci:admin": "pnpm run rm && pnpm run upgrade:fast && pnpm run ci",
72
+ "_ci": "pnpm run config:off && pnpm run lint && pnpm run test",
73
+ "ci": "CI_START=$(date +%s) && pnpm run _ci && pnpm run p-q && echo \"\n✅ CI takes $(($(date +%s) - CI_START))s\n\"",
74
+ "ci:admin": "CI_START=$(date +%s) && pnpm run rm && pnpm run upgrade:fast && pnpm run _ci && echo \"\n✅ Admin CI takes $(($(date +%s) - CI_START))s\n\"",
69
75
  "clean": "pnpm run rm && pnpm run config",
70
76
  "config": "pnpm install",
71
77
  "config:off": "pnpm run config --offline",