@stryke/types 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +295 -0
  3. package/dist/convert/buffer-to-string.cjs +8 -0
  4. package/dist/convert/buffer-to-string.d.ts +1 -0
  5. package/dist/convert/buffer-to-string.mjs +1 -0
  6. package/dist/convert/index.cjs +71 -0
  7. package/dist/convert/index.d.ts +6 -0
  8. package/dist/convert/index.mjs +1 -0
  9. package/dist/convert/string-to-uint8-array.cjs +8 -0
  10. package/dist/convert/string-to-uint8-array.d.ts +7 -0
  11. package/dist/convert/string-to-uint8-array.mjs +1 -0
  12. package/dist/convert/to-array.cjs +9 -0
  13. package/dist/convert/to-array.d.ts +8 -0
  14. package/dist/convert/to-array.mjs +1 -0
  15. package/dist/convert/to-string-key.cjs +9 -0
  16. package/dist/convert/to-string-key.d.ts +7 -0
  17. package/dist/convert/to-string-key.mjs +1 -0
  18. package/dist/convert/uint8-array-to-string.cjs +8 -0
  19. package/dist/convert/uint8-array-to-string.d.ts +13 -0
  20. package/dist/convert/uint8-array-to-string.mjs +1 -0
  21. package/dist/convert/utf8-array-to-string.cjs +8 -0
  22. package/dist/convert/utf8-array-to-string.d.ts +13 -0
  23. package/dist/convert/utf8-array-to-string.mjs +1 -0
  24. package/dist/helpers/index.cjs +16 -0
  25. package/dist/helpers/index.d.ts +1 -0
  26. package/dist/helpers/index.mjs +1 -0
  27. package/dist/helpers/parse-type-definition.cjs +33 -0
  28. package/dist/helpers/parse-type-definition.d.ts +8 -0
  29. package/dist/helpers/parse-type-definition.mjs +1 -0
  30. package/dist/index.cjs +49 -0
  31. package/dist/index.d.ts +12 -0
  32. package/dist/index.mjs +1 -0
  33. package/dist/type-checks/get-object-tag.cjs +8 -0
  34. package/dist/type-checks/get-object-tag.d.ts +7 -0
  35. package/dist/type-checks/get-object-tag.mjs +1 -0
  36. package/dist/type-checks/index.cjs +456 -0
  37. package/dist/type-checks/index.d.ts +41 -0
  38. package/dist/type-checks/index.mjs +1 -0
  39. package/dist/type-checks/is-array-like.cjs +11 -0
  40. package/dist/type-checks/is-array-like.d.ts +7 -0
  41. package/dist/type-checks/is-array-like.mjs +1 -0
  42. package/dist/type-checks/is-async-iterable.cjs +10 -0
  43. package/dist/type-checks/is-async-iterable.d.ts +7 -0
  44. package/dist/type-checks/is-async-iterable.mjs +1 -0
  45. package/dist/type-checks/is-bigint.cjs +9 -0
  46. package/dist/type-checks/is-bigint.d.ts +16 -0
  47. package/dist/type-checks/is-bigint.mjs +1 -0
  48. package/dist/type-checks/is-boolean.cjs +14 -0
  49. package/dist/type-checks/is-boolean.d.ts +7 -0
  50. package/dist/type-checks/is-boolean.mjs +1 -0
  51. package/dist/type-checks/is-buffer.cjs +10 -0
  52. package/dist/type-checks/is-buffer.d.ts +5 -0
  53. package/dist/type-checks/is-buffer.mjs +1 -0
  54. package/dist/type-checks/is-collection.cjs +11 -0
  55. package/dist/type-checks/is-collection.d.ts +8 -0
  56. package/dist/type-checks/is-collection.mjs +1 -0
  57. package/dist/type-checks/is-date.cjs +10 -0
  58. package/dist/type-checks/is-date.d.ts +16 -0
  59. package/dist/type-checks/is-date.mjs +1 -0
  60. package/dist/type-checks/is-deep-key.cjs +26 -0
  61. package/dist/type-checks/is-deep-key.d.ts +35 -0
  62. package/dist/type-checks/is-deep-key.mjs +1 -0
  63. package/dist/type-checks/is-empty-object.cjs +23 -0
  64. package/dist/type-checks/is-empty-object.d.ts +14 -0
  65. package/dist/type-checks/is-empty-object.mjs +1 -0
  66. package/dist/type-checks/is-empty-string.cjs +16 -0
  67. package/dist/type-checks/is-empty-string.d.ts +7 -0
  68. package/dist/type-checks/is-empty-string.mjs +1 -0
  69. package/dist/type-checks/is-empty.cjs +35 -0
  70. package/dist/type-checks/is-empty.d.ts +8 -0
  71. package/dist/type-checks/is-empty.mjs +1 -0
  72. package/dist/type-checks/is-equal.cjs +18 -0
  73. package/dist/type-checks/is-equal.d.ts +1 -0
  74. package/dist/type-checks/is-equal.mjs +1 -0
  75. package/dist/type-checks/is-error.cjs +15 -0
  76. package/dist/type-checks/is-error.d.ts +17 -0
  77. package/dist/type-checks/is-error.mjs +1 -0
  78. package/dist/type-checks/is-file-result.cjs +11 -0
  79. package/dist/type-checks/is-file-result.d.ts +8 -0
  80. package/dist/type-checks/is-file-result.mjs +1 -0
  81. package/dist/type-checks/is-float.cjs +9 -0
  82. package/dist/type-checks/is-float.d.ts +8 -0
  83. package/dist/type-checks/is-float.mjs +1 -0
  84. package/dist/type-checks/is-function.cjs +23 -0
  85. package/dist/type-checks/is-function.d.ts +10 -0
  86. package/dist/type-checks/is-function.mjs +1 -0
  87. package/dist/type-checks/is-integer.cjs +10 -0
  88. package/dist/type-checks/is-integer.d.ts +8 -0
  89. package/dist/type-checks/is-integer.mjs +1 -0
  90. package/dist/type-checks/is-mergeable-object.cjs +14 -0
  91. package/dist/type-checks/is-mergeable-object.d.ts +1 -0
  92. package/dist/type-checks/is-mergeable-object.mjs +1 -0
  93. package/dist/type-checks/is-non-null-object.cjs +10 -0
  94. package/dist/type-checks/is-non-null-object.d.ts +7 -0
  95. package/dist/type-checks/is-non-null-object.mjs +1 -0
  96. package/dist/type-checks/is-not-empty.cjs +17 -0
  97. package/dist/type-checks/is-not-empty.d.ts +7 -0
  98. package/dist/type-checks/is-not-empty.mjs +1 -0
  99. package/dist/type-checks/is-null.cjs +14 -0
  100. package/dist/type-checks/is-null.d.ts +1 -0
  101. package/dist/type-checks/is-null.mjs +1 -0
  102. package/dist/type-checks/is-number.cjs +19 -0
  103. package/dist/type-checks/is-number.d.ts +15 -0
  104. package/dist/type-checks/is-number.mjs +1 -0
  105. package/dist/type-checks/is-object-index.cjs +17 -0
  106. package/dist/type-checks/is-object-index.d.ts +7 -0
  107. package/dist/type-checks/is-object-index.mjs +1 -0
  108. package/dist/type-checks/is-object.cjs +30 -0
  109. package/dist/type-checks/is-object.d.ts +30 -0
  110. package/dist/type-checks/is-object.mjs +1 -0
  111. package/dist/type-checks/is-plain-object.cjs +17 -0
  112. package/dist/type-checks/is-plain-object.d.ts +50 -0
  113. package/dist/type-checks/is-plain-object.mjs +1 -0
  114. package/dist/type-checks/is-primitive.cjs +14 -0
  115. package/dist/type-checks/is-primitive.d.ts +1 -0
  116. package/dist/type-checks/is-primitive.mjs +1 -0
  117. package/dist/type-checks/is-promise.cjs +12 -0
  118. package/dist/type-checks/is-promise.d.ts +17 -0
  119. package/dist/type-checks/is-promise.mjs +1 -0
  120. package/dist/type-checks/is-react-element.cjs +8 -0
  121. package/dist/type-checks/is-react-element.d.ts +1 -0
  122. package/dist/type-checks/is-react-element.mjs +1 -0
  123. package/dist/type-checks/is-ref.cjs +14 -0
  124. package/dist/type-checks/is-ref.d.ts +8 -0
  125. package/dist/type-checks/is-ref.mjs +1 -0
  126. package/dist/type-checks/is-regexp.cjs +10 -0
  127. package/dist/type-checks/is-regexp.d.ts +16 -0
  128. package/dist/type-checks/is-regexp.mjs +1 -0
  129. package/dist/type-checks/is-select-option.cjs +15 -0
  130. package/dist/type-checks/is-select-option.d.ts +8 -0
  131. package/dist/type-checks/is-select-option.mjs +1 -0
  132. package/dist/type-checks/is-set-object.cjs +15 -0
  133. package/dist/type-checks/is-set-object.d.ts +7 -0
  134. package/dist/type-checks/is-set-object.mjs +1 -0
  135. package/dist/type-checks/is-set-string.cjs +16 -0
  136. package/dist/type-checks/is-set-string.d.ts +7 -0
  137. package/dist/type-checks/is-set-string.mjs +1 -0
  138. package/dist/type-checks/is-set.cjs +15 -0
  139. package/dist/type-checks/is-set.d.ts +7 -0
  140. package/dist/type-checks/is-set.mjs +1 -0
  141. package/dist/type-checks/is-string.cjs +14 -0
  142. package/dist/type-checks/is-string.d.ts +1 -0
  143. package/dist/type-checks/is-string.mjs +1 -0
  144. package/dist/type-checks/is-symbol.cjs +14 -0
  145. package/dist/type-checks/is-symbol.d.ts +1 -0
  146. package/dist/type-checks/is-symbol.mjs +1 -0
  147. package/dist/type-checks/is-typed-array.cjs +9 -0
  148. package/dist/type-checks/is-typed-array.d.ts +1 -0
  149. package/dist/type-checks/is-typed-array.mjs +1 -0
  150. package/dist/type-checks/is-typed.cjs +16 -0
  151. package/dist/type-checks/is-typed.d.ts +8 -0
  152. package/dist/type-checks/is-typed.mjs +1 -0
  153. package/dist/type-checks/is-undefined.cjs +8 -0
  154. package/dist/type-checks/is-undefined.d.ts +1 -0
  155. package/dist/type-checks/is-undefined.mjs +1 -0
  156. package/dist/type-checks/property-exists.cjs +17 -0
  157. package/dist/type-checks/property-exists.d.ts +16 -0
  158. package/dist/type-checks/property-exists.mjs +1 -0
  159. package/dist/type-checks/type-detect.cjs +38 -0
  160. package/dist/type-checks/type-detect.d.ts +1 -0
  161. package/dist/type-checks/type-detect.mjs +1 -0
  162. package/dist/utility-types/array.cjs +9 -0
  163. package/dist/utility-types/array.d.ts +130 -0
  164. package/dist/utility-types/array.mjs +1 -0
  165. package/dist/utility-types/async.cjs +1 -0
  166. package/dist/utility-types/async.d.ts +103 -0
  167. package/dist/utility-types/async.mjs +0 -0
  168. package/dist/utility-types/base.cjs +16 -0
  169. package/dist/utility-types/base.d.ts +325 -0
  170. package/dist/utility-types/base.mjs +2 -0
  171. package/dist/utility-types/configuration.cjs +1 -0
  172. package/dist/utility-types/configuration.d.ts +59 -0
  173. package/dist/utility-types/configuration.mjs +0 -0
  174. package/dist/utility-types/file.cjs +12 -0
  175. package/dist/utility-types/file.d.ts +29 -0
  176. package/dist/utility-types/file.mjs +1 -0
  177. package/dist/utility-types/form.cjs +1 -0
  178. package/dist/utility-types/form.d.ts +35 -0
  179. package/dist/utility-types/form.mjs +0 -0
  180. package/dist/utility-types/index.cjs +214 -0
  181. package/dist/utility-types/index.d.ts +19 -0
  182. package/dist/utility-types/index.mjs +1 -0
  183. package/dist/utility-types/json.cjs +1 -0
  184. package/dist/utility-types/json.d.ts +82 -0
  185. package/dist/utility-types/json.mjs +0 -0
  186. package/dist/utility-types/logic.cjs +1 -0
  187. package/dist/utility-types/logic.d.ts +152 -0
  188. package/dist/utility-types/logic.mjs +0 -0
  189. package/dist/utility-types/messages.cjs +13 -0
  190. package/dist/utility-types/messages.d.ts +24 -0
  191. package/dist/utility-types/messages.mjs +1 -0
  192. package/dist/utility-types/navigator.cjs +1 -0
  193. package/dist/utility-types/navigator.d.ts +40 -0
  194. package/dist/utility-types/navigator.mjs +0 -0
  195. package/dist/utility-types/number.cjs +1 -0
  196. package/dist/utility-types/number.d.ts +198 -0
  197. package/dist/utility-types/number.mjs +0 -0
  198. package/dist/utility-types/object.cjs +1 -0
  199. package/dist/utility-types/object.d.ts +434 -0
  200. package/dist/utility-types/object.mjs +0 -0
  201. package/dist/utility-types/package-json.cjs +1 -0
  202. package/dist/utility-types/package-json.d.ts +504 -0
  203. package/dist/utility-types/package-json.mjs +0 -0
  204. package/dist/utility-types/package-manager.cjs +18 -0
  205. package/dist/utility-types/package-manager.d.ts +14 -0
  206. package/dist/utility-types/package-manager.mjs +1 -0
  207. package/dist/utility-types/string.cjs +1 -0
  208. package/dist/utility-types/string.d.ts +87 -0
  209. package/dist/utility-types/string.mjs +0 -0
  210. package/dist/utility-types/system.cjs +1 -0
  211. package/dist/utility-types/system.d.ts +1 -0
  212. package/dist/utility-types/system.mjs +0 -0
  213. package/dist/utility-types/tsconfig.cjs +1 -0
  214. package/dist/utility-types/tsconfig.d.ts +800 -0
  215. package/dist/utility-types/tsconfig.mjs +0 -0
  216. package/dist/utility-types/user.cjs +11 -0
  217. package/dist/utility-types/user.d.ts +30 -0
  218. package/dist/utility-types/user.mjs +1 -0
  219. package/dist/utility-types/utilities.cjs +1 -0
  220. package/dist/utility-types/utilities.d.ts +53 -0
  221. package/dist/utility-types/utilities.mjs +0 -0
  222. package/dist/utility-types/validations.cjs +1 -0
  223. package/dist/utility-types/validations.d.ts +16 -0
  224. package/dist/utility-types/validations.mjs +0 -0
  225. package/package.json +1157 -0
@@ -0,0 +1,325 @@
1
+ import type { TypedArray } from "./array";
2
+ export type SerializablePrimitive = null | undefined | string | number | boolean | bigint;
3
+ export type Primitive = SerializablePrimitive | symbol;
4
+ /**
5
+ * Matches any primitive, `void`, `Date`, or `RegExp` value.
6
+ */
7
+ export type BuiltIns = Primitive | void | Date | RegExp;
8
+ /**
9
+ * Matches any non-primitive object
10
+ */
11
+ export type AtomicObject = Function | Promise<any> | Date | RegExp;
12
+ /** Determines if the passed value is of a specific type */
13
+ export type TypeTester = (value: any) => boolean;
14
+ /**
15
+ * The interface for a type mapping (key =\> function) to use for {@link getType}.
16
+ * export * The key represents the name of the type. The function represents the {@link TypeTester | test method}.
17
+ * The map should be ordered by testing preference, with more specific tests first.
18
+ * If a test returns true, it is selected, and the key is returned as the type.
19
+ */
20
+ export type TypeMap = Record<string, TypeTester>;
21
+ declare const emptyObjectSymbol: unique symbol;
22
+ export type FunctionOrValue<Value> = Value extends () => infer X ? X : Value;
23
+ /**
24
+ * A [[List]]
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * type list0 = [1, 2, 3]
29
+ * type list1 = number[]
30
+ * ```
31
+ *
32
+ * @param A - its type
33
+ * @returns [[List]]
34
+ */
35
+ export type List<A = any> = ReadonlyArray<A>;
36
+ /**
37
+ * Alias to create a [[Function]]
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * import { FunctionLike } from '@stryke/types'
42
+ *
43
+ * type test0 = FunctionLike<[string, number], boolean>
44
+ * /// (args_0: string, args_1: number) => boolean
45
+ * ```
46
+ *
47
+ * @param P - parameters
48
+ * @param R - return type
49
+ * @returns [[Function]]
50
+ */
51
+ export type FunctionLike<P extends List = any, R extends any = any> = (...args: P) => R;
52
+ export type AnyFunction = FunctionLike<any, any>;
53
+ export type Nullish = undefined | null;
54
+ export type Nullishable<T> = T | Nullish;
55
+ export type NonNullishObject = object;
56
+ export type NativeClass = abstract new (...args: any) => any;
57
+ export type AnyNumber = number | number;
58
+ export type AnyString = string | string;
59
+ export type AnyBoolean = boolean | boolean;
60
+ export type AnyArray = any[];
61
+ export type PlainObject = Record<any, object>;
62
+ export type AnyMap = Map<any, any>;
63
+ export type AnyWeakMap = WeakMap<WeakKey, any>;
64
+ export type EmptyArray = [];
65
+ export interface EmptyObject {
66
+ [emptyObjectSymbol]?: never;
67
+ }
68
+ export type Any = boolean | number | bigint | string | null | undefined | void | symbol | object | PlainObject | AnyArray | AnyMap | AnyWeakMap;
69
+ /**
70
+ * The valid types of the index for an `Indexable` type object
71
+ */
72
+ export type IndexType = string | number | symbol;
73
+ /**
74
+ * The declaration of a ***dictionary-type*** object
75
+ */
76
+ export type Indexable = Record<IndexType, any>;
77
+ export declare const EMPTY_STRING = "";
78
+ export declare const NEWLINE_STRING = "\r\n";
79
+ export declare const EMPTY_OBJECT: {};
80
+ export type AnyCase<T extends IndexType> = string extends T ? string : T extends `${infer F1}${infer F2}${infer R}` ? `${Uppercase<F1> | Lowercase<F1>}${Uppercase<F2> | Lowercase<F2>}${AnyCase<R>}` : T extends `${infer F}${infer R}` ? `${Uppercase<F> | Lowercase<F>}${AnyCase<R>}` : typeof EMPTY_STRING;
81
+ export type Newable<T> = new (..._args: never[]) => T;
82
+ export interface Abstract<T> {
83
+ prototype: T;
84
+ }
85
+ export interface Clonable<T> {
86
+ clone(): T;
87
+ }
88
+ export type MaybePromise<T> = T | Promise<T>;
89
+ export type ReducerFunction<TState, TAction> = (state: TState, action: TAction) => TState;
90
+ export declare const TYPE_ARGUMENTS = "Arguments";
91
+ export declare const TYPE_ARRAY = "Array";
92
+ export declare const TYPE_OBJECT = "Object";
93
+ export declare const TYPE_MAP = "Map";
94
+ export declare const TYPE_SET = "Set";
95
+ export type Collection = IArguments | unknown[] | Map<unknown, unknown> | Record<string | number | symbol, unknown> | Set<unknown>;
96
+ export type NonUndefined<T> = T extends undefined ? never : T;
97
+ export type BrowserNativeObject = Date | File;
98
+ export type DeepPartial<T> = T extends BrowserNativeObject | NestedValue ? T : {
99
+ [K in keyof T]?: DeepPartial<T[K]>;
100
+ };
101
+ export type Rollback = Record<string, (initialValue: any, currentValue: any) => any>;
102
+ /**
103
+ * Extract all required keys from the given type.
104
+ *
105
+ * @remarks This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
106
+ * @category Utilities
107
+ */
108
+ export type RequiredKeysOf<BaseType extends object> = Exclude<{
109
+ [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never;
110
+ }[keyof BaseType], undefined>;
111
+ /**
112
+ * Returns a boolean for whether the two given types are equal.
113
+ *
114
+ * @remarks Use-cases: If you want to make a conditional branch based on the result of a comparison of two types.
115
+ * @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
116
+ * @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
117
+ * @category Type Guard
118
+ * @category Utilities
119
+ */
120
+ export type IsEqual<A, B> = (<G>() => G extends A ? 1 : 2) extends <G>() => G extends B ? 1 : 2 ? true : false;
121
+ export type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : KeyType extends ExcludeType ? never : KeyType;
122
+ interface ExceptOptions {
123
+ /**
124
+ Disallow assigning non-specified properties.
125
+
126
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
127
+
128
+ @defaultValue false
129
+ */
130
+ requireExactProps?: boolean;
131
+ }
132
+ /**
133
+ * Create a type from an object type without certain keys.
134
+ *
135
+ * @remarks We recommend setting the `requireExactProps` option to `true`.
136
+ * @remarks This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
137
+ * @remarks This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
138
+ * @category Object
139
+ */
140
+ export type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {
141
+ requireExactProps: false;
142
+ }> = {
143
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
144
+ } & (Options["requireExactProps"] extends true ? Partial<Record<KeysType, never>> : Record<string, never>);
145
+ /**
146
+ * Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
147
+ *
148
+ * @remarks Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
149
+ * @remarks If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
150
+ * @link https://github.com/microsoft/TypeScript/issues/15300
151
+ * @category Object
152
+ */
153
+ export type Simplify<T> = {
154
+ [KeyType in keyof T]: T[KeyType];
155
+ } & {};
156
+ /**
157
+ * Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type.
158
+ *
159
+ * @remarks Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.
160
+ * @category Object
161
+ */
162
+ export type SetRequired<BaseType, Keys extends keyof BaseType> = BaseType extends unknown ? Simplify<Except<BaseType, Keys> & Required<Pick<BaseType, Keys>>> : never;
163
+ export declare const $NestedValue: unique symbol;
164
+ export type NestedValue<TValue extends object = object> = {
165
+ [$NestedValue]: never;
166
+ } & TValue;
167
+ export interface RefObject<T> {
168
+ current: T;
169
+ }
170
+ export interface IIdentity<T = string> {
171
+ id: T;
172
+ }
173
+ export interface IVersioned {
174
+ version: number;
175
+ }
176
+ export interface ISequenced {
177
+ /**
178
+ * The sequence number (version, or event counter, etc.) of the record
179
+ */
180
+ sequence: number;
181
+ }
182
+ export interface ITyped {
183
+ /**
184
+ * The type of the record
185
+ */
186
+ __typename: string;
187
+ }
188
+ export interface ClassTypeCheckable<T> extends ITyped {
189
+ /**
190
+ * Run type check on the given value
191
+ * @param value - The value to check
192
+ * @returns True if the value is of the type of the class
193
+ */
194
+ isTypeOf: (value: unknown) => value is T;
195
+ }
196
+ /**
197
+ * Matches non-recursive types.
198
+ */
199
+ export type NonRecursiveType = BuiltIns | Function | (new (...arguments_: any[]) => unknown);
200
+ export type IsPrimitive<T> = [T] extends [Primitive] ? true : false;
201
+ export type IsNever<T> = [T] extends [never] ? true : false;
202
+ export type IsAny<T> = 0 extends 1 & T ? true : false;
203
+ export type IsNull<T> = [T] extends [null] ? true : false;
204
+ export type IsUndefined<T> = T extends undefined ? true : false;
205
+ export type IsUnknown<T> = unknown extends T ? IsNull<T> extends false ? true : false : false;
206
+ export type IsNullish<T> = IsNull<T> & IsUndefined<T>;
207
+ export type IsFunction<T> = T extends AnyFunction ? true : false;
208
+ /**
209
+ * Declare locally scoped properties on `globalThis`.
210
+ *
211
+ * When defining a global variable in a declaration file is inappropriate, it can be helpful to define a `type` or `interface` (say `ExtraGlobals`) with the global variable and then cast `globalThis` via code like `globalThis as unknown as ExtraGlobals`.
212
+ *
213
+ * Instead of casting through `unknown`, you can update your `type` or `interface` to extend `GlobalThis` and then directly cast `globalThis`.
214
+ *
215
+ * @example
216
+ * ```
217
+ * import type {GlobalThis} from 'type-fest';
218
+ *
219
+ * type ExtraGlobals = GlobalThis & {
220
+ * readonly GLOBAL_TOKEN: string;
221
+ * };
222
+ *
223
+ * (globalThis as ExtraGlobals).GLOBAL_TOKEN;
224
+ * ```
225
+ *
226
+ * @category Type
227
+ */
228
+ export type GlobalThis = typeof globalThis;
229
+ /**
230
+ * Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
231
+ *
232
+ * @category Class
233
+ */
234
+ export interface Class<T, Arguments extends unknown[] = any[]> {
235
+ prototype: Pick<T, keyof T>;
236
+ new (...arguments_: Arguments): T;
237
+ }
238
+ /**
239
+ * Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
240
+ *
241
+ * @category Class
242
+ */
243
+ export type Constructor<T, Arguments extends unknown[] = any[]> = new (...arguments_: Arguments) => T;
244
+ /**
245
+ * Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/classes.html#abstract-classes).
246
+ *
247
+ * @category Class
248
+ *
249
+ * @privateRemarks
250
+ * We cannot use a `type` here because TypeScript throws: 'abstract' modifier cannot appear on a type member. (1070)
251
+ */
252
+ export interface AbstractClass<T, Arguments extends unknown[] = any[]> extends AbstractConstructor<T, Arguments> {
253
+ prototype: Pick<T, keyof T>;
254
+ }
255
+ /**
256
+ * Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures) constructor.
257
+ *
258
+ * @category Class
259
+ */
260
+ export type AbstractConstructor<T, Arguments extends unknown[] = any[]> = abstract new (...arguments_: Arguments) => T;
261
+ /**
262
+ * Create a tuple type of the given length `<L>` and fill it with the given type `<Fill>`.
263
+ *
264
+ * If `<Fill>` is not provided, it will default to `unknown`.
265
+ *
266
+ * @link https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f
267
+ */
268
+ export type BuildTuple<L extends number, Fill = unknown, T extends readonly unknown[] = []> = T["length"] extends L ? T : BuildTuple<L, Fill, [...T, Fill]>;
269
+ /**
270
+ * Test if the given function has multiple call signatures.
271
+ *
272
+ * Needed to handle the case of a single call signature with properties.
273
+ *
274
+ * Multiple call signatures cannot currently be supported due to a TypeScript limitation.
275
+ * @see https://github.com/microsoft/TypeScript/issues/29732
276
+ */
277
+ export type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
278
+ (...arguments_: infer A): unknown;
279
+ (...arguments_: infer B): unknown;
280
+ } ? B extends A ? A extends B ? false : true : true : false;
281
+ type StructuredCloneablePrimitive = string | number | bigint | boolean | null | undefined | boolean | number | string;
282
+ type StructuredCloneableData = ArrayBuffer | DataView | Date | Error | RegExp | TypedArray | Blob | File;
283
+ type StructuredCloneableCollection = readonly StructuredCloneable[] | {
284
+ readonly [key: string]: StructuredCloneable;
285
+ readonly [key: number]: StructuredCloneable;
286
+ } | ReadonlyMap<StructuredCloneable, StructuredCloneable> | ReadonlySet<StructuredCloneable>;
287
+ /**
288
+ * Matches a value that can be losslessly cloned using `structuredClone`.
289
+ *
290
+ * Note:
291
+ * - Custom error types will be cloned as the base `Error` type
292
+ * - This type doesn't include types exclusive to the TypeScript DOM library (e.g. `DOMRect` and `VideoFrame`)
293
+ *
294
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
295
+ *
296
+ * @example
297
+ * ```
298
+ * import type {StructuredCloneable} from 'type-fest';
299
+ *
300
+ * class CustomClass {}
301
+ *
302
+ * // @ts-expect-error
303
+ * const error: StructuredCloneable = {
304
+ * custom: new CustomClass(),
305
+ * };
306
+ *
307
+ * structuredClone(error);
308
+ * //=> {custom: {}}
309
+ *
310
+ * const good: StructuredCloneable = {
311
+ * number: 3,
312
+ * date: new Date(),
313
+ * map: new Map<string, number>(),
314
+ * }
315
+ *
316
+ * good.map.set('key', 1);
317
+ *
318
+ * structuredClone(good);
319
+ * //=> {number: 3, date: Date(2022-10-17 22:22:35.920), map: Map {'key' -> 1}}
320
+ * ```
321
+ *
322
+ * @category Structured clone
323
+ */
324
+ export type StructuredCloneable = StructuredCloneablePrimitive | StructuredCloneableData | StructuredCloneableCollection;
325
+ export {};
@@ -0,0 +1,2 @@
1
+ export const EMPTY_STRING="",NEWLINE_STRING=`\r
2
+ `,EMPTY_OBJECT={},TYPE_ARGUMENTS="Arguments",TYPE_ARRAY="Array",TYPE_OBJECT="Object",TYPE_MAP="Map",TYPE_SET="Set",$NestedValue=Symbol("NestedValue");
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Configuration values for specifying a type definition
3
+ */
4
+ export type TypeDefinition = {
5
+ /**
6
+ * The file path to the type definition
7
+ */
8
+ file: string;
9
+ /**
10
+ * The name of the type definition in the file above
11
+ *
12
+ * @remarks
13
+ * If no value is provided, we will attempt to infer the type definition from the module's `default` export.
14
+ */
15
+ name?: string;
16
+ };
17
+ /**
18
+ * Configuration parameter for the {@link TypeDefinition} utility type
19
+ *
20
+ * @remarks
21
+ * When provided as a string, this value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#EnvConfiguration"`.
22
+ */
23
+ export type TypeDefinitionParameter = TypeDefinition | string;
24
+ export interface DotenvTypeDefinitions {
25
+ /**
26
+ * A path to the type definition for the expected env configuration parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#DotenvConfiguration"`.
27
+ *
28
+ * @remarks
29
+ * If a value is not provided for this option, the plugin will attempt to infer the type definition from the `storm.dotenv.types.config` object in the project's `package.json` file.
30
+ */
31
+ variables?: TypeDefinitionParameter;
32
+ /**
33
+ * A path to the type definition for the expected env secret parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#DotenvSecrets"`.
34
+ *
35
+ * @remarks
36
+ * If a value is not provided for this option, the plugin will attempt to infer the type definition from the `storm.dotenv.types.secrets` object in the project's `package.json` file.
37
+ */
38
+ secrets?: TypeDefinitionParameter;
39
+ }
40
+ export interface DotenvConfiguration {
41
+ /**
42
+ * Additional environment variable (.env) files (aside from the default list of files) to load configuration from.
43
+ *
44
+ * @remarks
45
+ * By default, the plugin will load environment variables from `.env` files based on the `mode`. For the `"production"` mode, it will use the following files:
46
+ * - `.env`
47
+ * - `.env.local`
48
+ * - `.env.production`
49
+ * - `.env.production.local`
50
+ */
51
+ additionalFiles?: string[];
52
+ /**
53
+ * The type definitions for the environment variables
54
+ */
55
+ types?: DotenvTypeDefinitions;
56
+ }
57
+ export interface StormConfigurationGroups {
58
+ dotenv?: DotenvConfiguration;
59
+ }
File without changes
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FileStatus = void 0;
7
+ const FileStatus = exports.FileStatus = {
8
+ INITIALIZED: "initialized",
9
+ VALIDATED: "validated",
10
+ UPLOADED: "uploaded",
11
+ FAILED: "failed"
12
+ };
@@ -0,0 +1,29 @@
1
+ import type { ValidationDetails } from "./validations";
2
+ export type FileStatus = "initialized" | "validated" | "uploaded" | "failed";
3
+ export declare const FileStatus: {
4
+ INITIALIZED: FileStatus;
5
+ VALIDATED: FileStatus;
6
+ UPLOADED: FileStatus;
7
+ FAILED: FileStatus;
8
+ };
9
+ /**
10
+ * A type that representing a file object.
11
+ */
12
+ export type FileResult = {
13
+ name: string;
14
+ status: FileStatus;
15
+ issues?: ValidationDetails[];
16
+ size?: number;
17
+ mimeType?: string;
18
+ lastModified?: number;
19
+ } & ({
20
+ uri: string;
21
+ file?: File;
22
+ } | {
23
+ uri?: string;
24
+ file: File;
25
+ });
26
+ /**
27
+ * A valid `picomatch` glob pattern, or array of patterns.
28
+ */
29
+ export type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
@@ -0,0 +1 @@
1
+ export const FileStatus={INITIALIZED:"initialized",VALIDATED:"validated",UPLOADED:"uploaded",FAILED:"failed"};
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,35 @@
1
+ import type { NameValuePair } from "./utilities";
2
+ export type SelectOptionValue = string | number | boolean | null;
3
+ /**
4
+ * A utility type for specifying the type of an option for a Select or Radio form field.
5
+ */
6
+ export interface SelectOption<TValue extends SelectOptionValue = SelectOptionValue, TName = string> extends NameValuePair<TValue, TName> {
7
+ /**
8
+ * The index of the select option
9
+ */
10
+ index: number;
11
+ /**
12
+ * The description of the select option
13
+ */
14
+ description?: string;
15
+ /**
16
+ * A short string describing the status of the select option
17
+ */
18
+ status?: string;
19
+ /**
20
+ * An optional icon to display in the select option
21
+ */
22
+ icon?: any;
23
+ /**
24
+ * An optional image to display in the select option
25
+ */
26
+ image?: any;
27
+ /**
28
+ * Is the option value valid for selection in the dropdown
29
+ */
30
+ disabled: boolean;
31
+ /**
32
+ * Sets or retrieves whether the option in the list box is the default item.
33
+ */
34
+ selected: boolean;
35
+ }
File without changes