typetify 1.0.0 → 2.0.0
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/dist/index.d.mts +855 -7
- package/dist/index.d.ts +855 -7
- package/dist/index.js +852 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +828 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -6,18 +6,817 @@ export { Deferred, RetryOptions } from './async/index.mjs';
|
|
|
6
6
|
import { unique, groupBy, indexBy, partition, chunk, compact, flatten, sortBy, first, last, range, shuffle, sample, zip, unzip, difference, intersection, take, drop, takeWhile, dropWhile, findLast, countBy, maxBy, minBy, sumBy, head, tail, init } from './collection/index.mjs';
|
|
7
7
|
import { safeJsonParse, safeJsonStringify, parseNumber, parseInteger, parseBoolean, parseDate, coerceString, coerceArray, trimAll, defaults, clamp, isEmail, isUrl, isUuid, isIpAddress, parseUrl } from './input/index.mjs';
|
|
8
8
|
export { JsonParseResult, JsonStringifyResult } from './input/index.mjs';
|
|
9
|
-
import {
|
|
10
|
-
export { TryCatchAsyncResult, TryCatchResult } from './flow/index.mjs';
|
|
9
|
+
import { tap, when, unless, match, tryCatch, tryCatchAsync, ifElse, constant } from './flow/index.mjs';
|
|
10
|
+
export { TryCatchAsyncResult, TryCatchResult, compose, pipe } from './flow/index.mjs';
|
|
11
11
|
import { debug, invariant, assertNever, exhaustive, todo, deprecated, measure, measureAsync, setLogLevel, getLogLevel } from './dx/index.mjs';
|
|
12
12
|
export { LogLevel, MeasureResult, log } from './dx/index.mjs';
|
|
13
13
|
export { A as ArrayElement, b as Awaited, B as Brand, c as DeepPartial, d as DeepReadonly, e as DeepRequired, f as Dictionary, E as ElementOf, g as EnumValue, K as KeysOfType, M as Merge, i as Mutable, j as NonNullableDeep, k as Nullable, O as Optional, l as OptionalKeys, n as PartialBy, P as Prettify, o as PromiseValue, R as ReadonlyDictionary, p as RequireAtLeastOne, q as RequireExactlyOne, r as RequireKeys, s as RequiredBy, U as UnionToIntersection, V as ValueOf, u as brand, v as createMap, w as createSet, x as defineConst, y as defineEnum, z as defineTuple, C as narrow } from './types-CPlzx7Jp.mjs';
|
|
14
14
|
import { capitalize, uncapitalize, camelCase, kebabCase, snakeCase, pascalCase, truncate, slugify, template, words } from './string/index.mjs';
|
|
15
|
-
import {
|
|
15
|
+
import { negate, flip, partial, curry, ary, unary } from './fn/index.mjs';
|
|
16
|
+
export { memoize } from './fn/index.mjs';
|
|
16
17
|
import { sum, average, median, round, randomInt, randomFloat, percentage, min, max } from './math/index.mjs';
|
|
17
18
|
export { E as Err, N as None, O as Ok, a as Option, R as Result, S as Some } from './types-VsDp2t8s.mjs';
|
|
18
19
|
import { ok, err, some, none, mapResult, mapOption, mapErr, andThen, orElse, matchResult, matchOption, isOk, isErr, unwrap, unwrapOption, unwrapOr, unwrapOptionOr, fromNullable, toNullable } from './result/index.mjs';
|
|
19
20
|
import { Memoize, Debounce, Throttle, Bind, Log, Measure, Retry, Deprecated, Sealed, Frozen, Validate, Lazy } from './decorator/index.mjs';
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Type-Safe Environment Variables
|
|
24
|
+
*/
|
|
25
|
+
type EnvSchema = Record<string, EnvVar<unknown>>;
|
|
26
|
+
interface EnvVar<T> {
|
|
27
|
+
_type: T;
|
|
28
|
+
_parse: (value: string | undefined) => T;
|
|
29
|
+
_default?: T | undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Environment variable type builders
|
|
33
|
+
*/
|
|
34
|
+
declare const env: {
|
|
35
|
+
/**
|
|
36
|
+
* String environment variable
|
|
37
|
+
*/
|
|
38
|
+
string(options?: {
|
|
39
|
+
default?: string;
|
|
40
|
+
}): EnvVar<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Number environment variable
|
|
43
|
+
*/
|
|
44
|
+
number(options?: {
|
|
45
|
+
default?: number;
|
|
46
|
+
}): EnvVar<number>;
|
|
47
|
+
/**
|
|
48
|
+
* Boolean environment variable
|
|
49
|
+
*/
|
|
50
|
+
boolean(options?: {
|
|
51
|
+
default?: boolean;
|
|
52
|
+
}): EnvVar<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Enum environment variable
|
|
55
|
+
*/
|
|
56
|
+
enum<T extends string>(values: readonly T[], options?: {
|
|
57
|
+
default?: T;
|
|
58
|
+
}): EnvVar<T>;
|
|
59
|
+
/**
|
|
60
|
+
* URL environment variable
|
|
61
|
+
*/
|
|
62
|
+
url(options?: {
|
|
63
|
+
default?: string;
|
|
64
|
+
}): EnvVar<string>;
|
|
65
|
+
/**
|
|
66
|
+
* JSON environment variable
|
|
67
|
+
*/
|
|
68
|
+
json<T>(options?: {
|
|
69
|
+
default?: T;
|
|
70
|
+
}): EnvVar<T>;
|
|
71
|
+
/**
|
|
72
|
+
* Array environment variable (comma-separated)
|
|
73
|
+
*/
|
|
74
|
+
array(options?: {
|
|
75
|
+
default?: string[];
|
|
76
|
+
separator?: string;
|
|
77
|
+
}): EnvVar<string[]>;
|
|
78
|
+
};
|
|
79
|
+
type InferEnv<T extends EnvSchema> = {
|
|
80
|
+
[K in keyof T]: T[K]['_type'];
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Creates a type-safe environment configuration.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* const config = createEnv({
|
|
87
|
+
* DATABASE_URL: env.url(),
|
|
88
|
+
* API_KEY: env.string(),
|
|
89
|
+
* PORT: env.number({ default: 3000 }),
|
|
90
|
+
* NODE_ENV: env.enum(['development', 'production', 'test'] as const),
|
|
91
|
+
* DEBUG: env.boolean({ default: false }),
|
|
92
|
+
* ALLOWED_ORIGINS: env.array({ default: ['localhost'] }),
|
|
93
|
+
* })
|
|
94
|
+
*
|
|
95
|
+
* // All values are typed!
|
|
96
|
+
* config.DATABASE_URL // string (validated as URL)
|
|
97
|
+
* config.PORT // number
|
|
98
|
+
* config.NODE_ENV // 'development' | 'production' | 'test'
|
|
99
|
+
* config.DEBUG // boolean
|
|
100
|
+
*/
|
|
101
|
+
declare function createEnv<T extends EnvSchema>(schema: T, envSource?: Record<string, string | undefined>): InferEnv<T>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Type-Safe Feature Flags
|
|
105
|
+
*/
|
|
106
|
+
type FlagType = 'boolean' | 'string' | 'number';
|
|
107
|
+
interface FlagConfig {
|
|
108
|
+
type: FlagType;
|
|
109
|
+
default: unknown;
|
|
110
|
+
}
|
|
111
|
+
type InferFlagType<T extends FlagType> = T extends 'boolean' ? boolean : T extends 'string' ? string : T extends 'number' ? number : never;
|
|
112
|
+
type FlagSchema = Record<string, FlagConfig>;
|
|
113
|
+
type InferFlags<T extends FlagSchema> = {
|
|
114
|
+
[K in keyof T]: InferFlagType<T[K]['type']>;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Flag type builders
|
|
118
|
+
*/
|
|
119
|
+
declare const flag: {
|
|
120
|
+
boolean(defaultValue?: boolean): FlagConfig;
|
|
121
|
+
string(defaultValue?: string): FlagConfig;
|
|
122
|
+
number(defaultValue?: number): FlagConfig;
|
|
123
|
+
};
|
|
124
|
+
interface FeatureFlags<T extends FlagSchema> {
|
|
125
|
+
/** Check if a boolean flag is enabled */
|
|
126
|
+
is<K extends keyof T>(key: K): T[K]['type'] extends 'boolean' ? boolean : never;
|
|
127
|
+
/** Get a flag value */
|
|
128
|
+
get<K extends keyof T>(key: K): InferFlagType<T[K]['type']>;
|
|
129
|
+
/** Set a flag value */
|
|
130
|
+
set<K extends keyof T>(key: K, value: InferFlagType<T[K]['type']>): void;
|
|
131
|
+
/** Get all flags */
|
|
132
|
+
all(): InferFlags<T>;
|
|
133
|
+
/** Reset all flags to defaults */
|
|
134
|
+
reset(): void;
|
|
135
|
+
/** Load flags from an object */
|
|
136
|
+
load(flags: Partial<InferFlags<T>>): void;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Creates a type-safe feature flag system.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* const flags = createFeatureFlags({
|
|
143
|
+
* newDashboard: flag.boolean(false),
|
|
144
|
+
* betaFeatures: flag.boolean(false),
|
|
145
|
+
* maxUploadSize: flag.number(10),
|
|
146
|
+
* theme: flag.string('light'),
|
|
147
|
+
* })
|
|
148
|
+
*
|
|
149
|
+
* // Check boolean flags
|
|
150
|
+
* if (flags.is('newDashboard')) {
|
|
151
|
+
* renderNewDashboard()
|
|
152
|
+
* }
|
|
153
|
+
*
|
|
154
|
+
* // Get any flag value
|
|
155
|
+
* const maxSize = flags.get('maxUploadSize') // number
|
|
156
|
+
* const theme = flags.get('theme') // string
|
|
157
|
+
*
|
|
158
|
+
* // Set flags
|
|
159
|
+
* flags.set('betaFeatures', true)
|
|
160
|
+
* flags.set('maxUploadSize', 50)
|
|
161
|
+
*
|
|
162
|
+
* // Load from config/API
|
|
163
|
+
* flags.load({
|
|
164
|
+
* newDashboard: true,
|
|
165
|
+
* maxUploadSize: 100,
|
|
166
|
+
* })
|
|
167
|
+
*/
|
|
168
|
+
declare function createFeatureFlags<T extends FlagSchema>(schema: T): FeatureFlags<T>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Reactive Signals - Fine-grained reactivity like Solid.js
|
|
172
|
+
*
|
|
173
|
+
* Signals are the foundation of reactive programming.
|
|
174
|
+
* They hold a value and notify subscribers when it changes.
|
|
175
|
+
*/
|
|
176
|
+
type Subscriber<T> = (value: T) => void;
|
|
177
|
+
type Unsubscribe$1 = () => void;
|
|
178
|
+
interface Signal<T> {
|
|
179
|
+
/** Get the current value */
|
|
180
|
+
(): T;
|
|
181
|
+
/** Set a new value */
|
|
182
|
+
set(value: T): void;
|
|
183
|
+
/** Update value using a function */
|
|
184
|
+
update(fn: (current: T) => T): void;
|
|
185
|
+
/** Subscribe to changes */
|
|
186
|
+
subscribe(fn: Subscriber<T>): Unsubscribe$1;
|
|
187
|
+
/** Get value without tracking */
|
|
188
|
+
peek(): T;
|
|
189
|
+
}
|
|
190
|
+
interface ReadonlySignal<T> {
|
|
191
|
+
/** Get the current value */
|
|
192
|
+
(): T;
|
|
193
|
+
/** Subscribe to changes */
|
|
194
|
+
subscribe(fn: Subscriber<T>): Unsubscribe$1;
|
|
195
|
+
/** Get value without tracking */
|
|
196
|
+
peek(): T;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Creates a reactive signal that notifies subscribers on change.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* const count = signal(0)
|
|
203
|
+
*
|
|
204
|
+
* // Read value
|
|
205
|
+
* console.log(count()) // 0
|
|
206
|
+
*
|
|
207
|
+
* // Set value
|
|
208
|
+
* count.set(5)
|
|
209
|
+
*
|
|
210
|
+
* // Update with function
|
|
211
|
+
* count.update(n => n + 1)
|
|
212
|
+
*
|
|
213
|
+
* // Subscribe to changes
|
|
214
|
+
* const unsubscribe = count.subscribe(value => {
|
|
215
|
+
* console.log('Count changed:', value)
|
|
216
|
+
* })
|
|
217
|
+
*/
|
|
218
|
+
declare function signal<T>(initialValue: T): Signal<T>;
|
|
219
|
+
/**
|
|
220
|
+
* Creates a computed value that automatically updates when dependencies change.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* const firstName = signal('John')
|
|
224
|
+
* const lastName = signal('Doe')
|
|
225
|
+
*
|
|
226
|
+
* const fullName = computed(() => `${firstName()} ${lastName()}`)
|
|
227
|
+
*
|
|
228
|
+
* console.log(fullName()) // "John Doe"
|
|
229
|
+
*
|
|
230
|
+
* firstName.set('Jane')
|
|
231
|
+
* console.log(fullName()) // "Jane Doe"
|
|
232
|
+
*/
|
|
233
|
+
declare function computed<T>(fn: () => T): ReadonlySignal<T>;
|
|
234
|
+
/**
|
|
235
|
+
* Runs a function whenever its dependencies change.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* const count = signal(0)
|
|
239
|
+
*
|
|
240
|
+
* const stop = effect(() => {
|
|
241
|
+
* console.log('Count is:', count())
|
|
242
|
+
* })
|
|
243
|
+
*
|
|
244
|
+
* count.set(1) // Logs: "Count is: 1"
|
|
245
|
+
* count.set(2) // Logs: "Count is: 2"
|
|
246
|
+
*
|
|
247
|
+
* stop() // Stop the effect
|
|
248
|
+
*/
|
|
249
|
+
declare function effect(fn: () => void | (() => void)): Unsubscribe$1;
|
|
250
|
+
declare function batch(fn: () => void): void;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Undoable State - State management with undo/redo history
|
|
254
|
+
*
|
|
255
|
+
* Perfect for editors, forms, and any UI that needs history.
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
interface UndoableState<T> {
|
|
259
|
+
/** Current state value */
|
|
260
|
+
value: Signal<T>;
|
|
261
|
+
/** Undo the last change */
|
|
262
|
+
undo(): void;
|
|
263
|
+
/** Redo the last undone change */
|
|
264
|
+
redo(): void;
|
|
265
|
+
/** Check if undo is available */
|
|
266
|
+
canUndo(): boolean;
|
|
267
|
+
/** Check if redo is available */
|
|
268
|
+
canRedo(): boolean;
|
|
269
|
+
/** Clear all history */
|
|
270
|
+
clearHistory(): void;
|
|
271
|
+
/** Get history length */
|
|
272
|
+
historyLength(): number;
|
|
273
|
+
/** Commit current state (creates a checkpoint) */
|
|
274
|
+
commit(): void;
|
|
275
|
+
}
|
|
276
|
+
interface UndoableOptions {
|
|
277
|
+
/** Maximum history size (default: 100) */
|
|
278
|
+
maxHistory?: number;
|
|
279
|
+
/** Debounce commits in ms (default: 0 = no debounce) */
|
|
280
|
+
debounce?: number;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Creates an undoable state with undo/redo capabilities.
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* const state = createUndoableState({ count: 0, text: '' })
|
|
287
|
+
*
|
|
288
|
+
* state.value.set({ count: 1, text: 'hello' })
|
|
289
|
+
* state.commit()
|
|
290
|
+
*
|
|
291
|
+
* state.value.set({ count: 2, text: 'world' })
|
|
292
|
+
* state.commit()
|
|
293
|
+
*
|
|
294
|
+
* console.log(state.value().count) // 2
|
|
295
|
+
*
|
|
296
|
+
* state.undo()
|
|
297
|
+
* console.log(state.value().count) // 1
|
|
298
|
+
*
|
|
299
|
+
* state.redo()
|
|
300
|
+
* console.log(state.value().count) // 2
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* // With auto-commit on every change
|
|
304
|
+
* const counter = createUndoableState(0)
|
|
305
|
+
*
|
|
306
|
+
* counter.value.set(1)
|
|
307
|
+
* counter.commit()
|
|
308
|
+
* counter.value.set(2)
|
|
309
|
+
* counter.commit()
|
|
310
|
+
*
|
|
311
|
+
* counter.undo() // Back to 1
|
|
312
|
+
* counter.undo() // Back to 0
|
|
313
|
+
*/
|
|
314
|
+
declare function createUndoableState<T>(initialValue: T, options?: UndoableOptions): UndoableState<T>;
|
|
315
|
+
/**
|
|
316
|
+
* Creates an undoable state that auto-commits on every change.
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* const state = createAutoUndoableState({ name: '', age: 0 })
|
|
320
|
+
*
|
|
321
|
+
* state.set({ name: 'John', age: 30 })
|
|
322
|
+
* state.set({ name: 'Jane', age: 25 })
|
|
323
|
+
*
|
|
324
|
+
* state.undo() // { name: 'John', age: 30 }
|
|
325
|
+
* state.undo() // { name: '', age: 0 }
|
|
326
|
+
*/
|
|
327
|
+
declare function createAutoUndoableState<T>(initialValue: T, options?: UndoableOptions): {
|
|
328
|
+
(): T;
|
|
329
|
+
set(value: T): void;
|
|
330
|
+
update(fn: (current: T) => T): void;
|
|
331
|
+
undo(): void;
|
|
332
|
+
redo(): void;
|
|
333
|
+
canUndo(): boolean;
|
|
334
|
+
canRedo(): boolean;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Smart Cache - Intelligent caching with TTL and invalidation
|
|
339
|
+
*/
|
|
340
|
+
interface CacheOptions<K extends unknown[], V> {
|
|
341
|
+
/** Time to live in milliseconds or string like '5m', '1h', '1d' */
|
|
342
|
+
ttl?: number | string;
|
|
343
|
+
/** Maximum cache size */
|
|
344
|
+
maxSize?: number;
|
|
345
|
+
/** Custom key generator */
|
|
346
|
+
key?: (...args: K) => string;
|
|
347
|
+
/** Events that invalidate the cache */
|
|
348
|
+
invalidateOn?: string[];
|
|
349
|
+
/** Called when cache is hit */
|
|
350
|
+
onHit?: (key: string, value: V) => void;
|
|
351
|
+
/** Called when cache is missed */
|
|
352
|
+
onMiss?: (key: string) => void;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Creates a smart cache wrapper around a function.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* const fetchUser = smartCache(
|
|
359
|
+
* async (userId: string) => {
|
|
360
|
+
* const response = await fetch(`/api/users/${userId}`)
|
|
361
|
+
* return response.json()
|
|
362
|
+
* },
|
|
363
|
+
* {
|
|
364
|
+
* ttl: '5m',
|
|
365
|
+
* maxSize: 100,
|
|
366
|
+
* key: (userId) => `user:${userId}`
|
|
367
|
+
* }
|
|
368
|
+
* )
|
|
369
|
+
*
|
|
370
|
+
* // First call - fetches from API
|
|
371
|
+
* const user1 = await fetchUser('123')
|
|
372
|
+
*
|
|
373
|
+
* // Second call - returns cached value
|
|
374
|
+
* const user2 = await fetchUser('123')
|
|
375
|
+
*
|
|
376
|
+
* // Invalidate cache
|
|
377
|
+
* fetchUser.invalidate('123')
|
|
378
|
+
*
|
|
379
|
+
* // Clear all cache
|
|
380
|
+
* fetchUser.clear()
|
|
381
|
+
*/
|
|
382
|
+
declare function smartCache<K extends unknown[], V>(fn: (...args: K) => V | Promise<V>, options?: CacheOptions<K, V>): ((...args: K) => Promise<V>) & {
|
|
383
|
+
invalidate: (...args: K) => void;
|
|
384
|
+
invalidateAll: () => void;
|
|
385
|
+
clear: () => void;
|
|
386
|
+
has: (...args: K) => boolean;
|
|
387
|
+
size: () => number;
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* Creates a simple memoization cache (no TTL, infinite size).
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* const expensive = memoize((n: number) => {
|
|
394
|
+
* console.log('Computing...')
|
|
395
|
+
* return n * n
|
|
396
|
+
* })
|
|
397
|
+
*
|
|
398
|
+
* expensive(5) // Logs "Computing...", returns 25
|
|
399
|
+
* expensive(5) // Returns 25 (cached)
|
|
400
|
+
*/
|
|
401
|
+
declare function memoize<K extends unknown[], V>(fn: (...args: K) => V): (...args: K) => V;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Type-Safe Event Bus - Decoupled communication with full type safety
|
|
405
|
+
*/
|
|
406
|
+
type EventHandler<T> = (data: T) => void;
|
|
407
|
+
type Unsubscribe = () => void;
|
|
408
|
+
interface EventBus<Events extends Record<string, unknown>> {
|
|
409
|
+
/** Subscribe to an event */
|
|
410
|
+
on<K extends keyof Events>(event: K, handler: EventHandler<Events[K]>): Unsubscribe;
|
|
411
|
+
/** Subscribe to an event (fires only once) */
|
|
412
|
+
once<K extends keyof Events>(event: K, handler: EventHandler<Events[K]>): Unsubscribe;
|
|
413
|
+
/** Emit an event */
|
|
414
|
+
emit<K extends keyof Events>(event: K, data: Events[K]): void;
|
|
415
|
+
/** Remove all handlers for an event */
|
|
416
|
+
off<K extends keyof Events>(event: K): void;
|
|
417
|
+
/** Remove all handlers */
|
|
418
|
+
clear(): void;
|
|
419
|
+
/** Get number of handlers for an event */
|
|
420
|
+
listenerCount<K extends keyof Events>(event: K): number;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Creates a type-safe event bus for decoupled communication.
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* // Define your events with their payload types
|
|
427
|
+
* type AppEvents = {
|
|
428
|
+
* 'user.login': { userId: string; timestamp: number }
|
|
429
|
+
* 'user.logout': { userId: string }
|
|
430
|
+
* 'order.created': { orderId: string; amount: number }
|
|
431
|
+
* 'notification': string
|
|
432
|
+
* }
|
|
433
|
+
*
|
|
434
|
+
* const events = createEventBus<AppEvents>()
|
|
435
|
+
*
|
|
436
|
+
* // Subscribe to events (fully typed!)
|
|
437
|
+
* events.on('user.login', (data) => {
|
|
438
|
+
* console.log(`User ${data.userId} logged in at ${data.timestamp}`)
|
|
439
|
+
* })
|
|
440
|
+
*
|
|
441
|
+
* // Emit events (type-checked!)
|
|
442
|
+
* events.emit('user.login', {
|
|
443
|
+
* userId: '123',
|
|
444
|
+
* timestamp: Date.now()
|
|
445
|
+
* })
|
|
446
|
+
*
|
|
447
|
+
* // TypeScript error: missing 'timestamp'
|
|
448
|
+
* events.emit('user.login', { userId: '123' })
|
|
449
|
+
*
|
|
450
|
+
* // TypeScript error: unknown event
|
|
451
|
+
* events.emit('unknown.event', {})
|
|
452
|
+
*/
|
|
453
|
+
declare function createEventBus<Events extends Record<string, unknown>>(): EventBus<Events>;
|
|
454
|
+
/**
|
|
455
|
+
* Creates a typed event emitter for a single component/class.
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* class UserService {
|
|
459
|
+
* private events = createTypedEmitter<{
|
|
460
|
+
* created: User
|
|
461
|
+
* updated: User
|
|
462
|
+
* deleted: string
|
|
463
|
+
* }>()
|
|
464
|
+
*
|
|
465
|
+
* readonly on = this.events.on
|
|
466
|
+
*
|
|
467
|
+
* async createUser(data: CreateUserDto) {
|
|
468
|
+
* const user = await db.users.create(data)
|
|
469
|
+
* this.events.emit('created', user)
|
|
470
|
+
* return user
|
|
471
|
+
* }
|
|
472
|
+
* }
|
|
473
|
+
*/
|
|
474
|
+
declare function createTypedEmitter<Events extends Record<string, unknown>>(): EventBus<Events>;
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Pipeline - Functional composition with full type inference
|
|
478
|
+
*/
|
|
479
|
+
/**
|
|
480
|
+
* Pipes a value through a series of functions.
|
|
481
|
+
* Each function receives the result of the previous one.
|
|
482
|
+
*
|
|
483
|
+
* @example
|
|
484
|
+
* const result = pipe(
|
|
485
|
+
* [1, 2, 3, 4, 5],
|
|
486
|
+
* arr => arr.filter(x => x % 2 === 0),
|
|
487
|
+
* arr => arr.map(x => x * 2),
|
|
488
|
+
* arr => arr.reduce((a, b) => a + b, 0)
|
|
489
|
+
* )
|
|
490
|
+
* // result: 12
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* // With async functions
|
|
494
|
+
* const user = await pipeAsync(
|
|
495
|
+
* userId,
|
|
496
|
+
* id => fetchUser(id),
|
|
497
|
+
* user => enrichUserData(user),
|
|
498
|
+
* user => validateUser(user)
|
|
499
|
+
* )
|
|
500
|
+
*/
|
|
501
|
+
declare function pipe<A>(value: A): A;
|
|
502
|
+
declare function pipe<A, B>(value: A, fn1: (a: A) => B): B;
|
|
503
|
+
declare function pipe<A, B, C>(value: A, fn1: (a: A) => B, fn2: (b: B) => C): C;
|
|
504
|
+
declare function pipe<A, B, C, D>(value: A, fn1: (a: A) => B, fn2: (b: B) => C, fn3: (c: C) => D): D;
|
|
505
|
+
declare function pipe<A, B, C, D, E>(value: A, fn1: (a: A) => B, fn2: (b: B) => C, fn3: (c: C) => D, fn4: (d: D) => E): E;
|
|
506
|
+
declare function pipe<A, B, C, D, E, F>(value: A, fn1: (a: A) => B, fn2: (b: B) => C, fn3: (c: C) => D, fn4: (d: D) => E, fn5: (e: E) => F): F;
|
|
507
|
+
declare function pipe<A, B, C, D, E, F, G>(value: A, fn1: (a: A) => B, fn2: (b: B) => C, fn3: (c: C) => D, fn4: (d: D) => E, fn5: (e: E) => F, fn6: (f: F) => G): G;
|
|
508
|
+
declare function pipe<A, B, C, D, E, F, G, H>(value: A, fn1: (a: A) => B, fn2: (b: B) => C, fn3: (c: C) => D, fn4: (d: D) => E, fn5: (e: E) => F, fn6: (f: F) => G, fn7: (g: G) => H): H;
|
|
509
|
+
declare function pipe<A, B, C, D, E, F, G, H, I>(value: A, fn1: (a: A) => B, fn2: (b: B) => C, fn3: (c: C) => D, fn4: (d: D) => E, fn5: (e: E) => F, fn6: (f: F) => G, fn7: (g: G) => H, fn8: (h: H) => I): I;
|
|
510
|
+
/**
|
|
511
|
+
* Async version of pipe that handles promises.
|
|
512
|
+
*/
|
|
513
|
+
declare function pipeAsync<A>(value: A): Promise<A>;
|
|
514
|
+
declare function pipeAsync<A, B>(value: A, fn1: (a: A) => B | Promise<B>): Promise<B>;
|
|
515
|
+
declare function pipeAsync<A, B, C>(value: A, fn1: (a: A) => B | Promise<B>, fn2: (b: B) => C | Promise<C>): Promise<C>;
|
|
516
|
+
declare function pipeAsync<A, B, C, D>(value: A, fn1: (a: A) => B | Promise<B>, fn2: (b: B) => C | Promise<C>, fn3: (c: C) => D | Promise<D>): Promise<D>;
|
|
517
|
+
declare function pipeAsync<A, B, C, D, E>(value: A, fn1: (a: A) => B | Promise<B>, fn2: (b: B) => C | Promise<C>, fn3: (c: C) => D | Promise<D>, fn4: (d: D) => E | Promise<E>): Promise<E>;
|
|
518
|
+
declare function pipeAsync<A, B, C, D, E, F>(value: A, fn1: (a: A) => B | Promise<B>, fn2: (b: B) => C | Promise<C>, fn3: (c: C) => D | Promise<D>, fn4: (d: D) => E | Promise<E>, fn5: (e: E) => F | Promise<F>): Promise<F>;
|
|
519
|
+
/**
|
|
520
|
+
* Creates a pipeline function that can be reused.
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* const processUser = flow(
|
|
524
|
+
* (user: User) => validateUser(user),
|
|
525
|
+
* user => enrichUser(user),
|
|
526
|
+
* user => formatUser(user)
|
|
527
|
+
* )
|
|
528
|
+
*
|
|
529
|
+
* const result = processUser(rawUser)
|
|
530
|
+
*/
|
|
531
|
+
declare function flow<A, B>(fn1: (a: A) => B): (a: A) => B;
|
|
532
|
+
declare function flow<A, B, C>(fn1: (a: A) => B, fn2: (b: B) => C): (a: A) => C;
|
|
533
|
+
declare function flow<A, B, C, D>(fn1: (a: A) => B, fn2: (b: B) => C, fn3: (c: C) => D): (a: A) => D;
|
|
534
|
+
declare function flow<A, B, C, D, E>(fn1: (a: A) => B, fn2: (b: B) => C, fn3: (c: C) => D, fn4: (d: D) => E): (a: A) => E;
|
|
535
|
+
declare function flow<A, B, C, D, E, F>(fn1: (a: A) => B, fn2: (b: B) => C, fn3: (c: C) => D, fn4: (d: D) => E, fn5: (e: E) => F): (a: A) => F;
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Middleware Pipeline - Express-style middleware with type safety
|
|
539
|
+
*/
|
|
540
|
+
type NextFunction = () => Promise<void> | void;
|
|
541
|
+
type Middleware<Context> = (ctx: Context, next: NextFunction) => Promise<void> | void;
|
|
542
|
+
interface MiddlewarePipeline<Context> {
|
|
543
|
+
/** Add a middleware to the pipeline */
|
|
544
|
+
use(middleware: Middleware<Context>): MiddlewarePipeline<Context>;
|
|
545
|
+
/** Execute the pipeline with a context */
|
|
546
|
+
execute(ctx: Context): Promise<void>;
|
|
547
|
+
/** Create a handler that executes the pipeline */
|
|
548
|
+
handler(): (ctx: Context) => Promise<void>;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Creates a middleware pipeline for processing requests or data.
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* interface RequestContext {
|
|
555
|
+
* user?: User
|
|
556
|
+
* body: unknown
|
|
557
|
+
* headers: Record<string, string>
|
|
558
|
+
* }
|
|
559
|
+
*
|
|
560
|
+
* const pipeline = createMiddleware<RequestContext>()
|
|
561
|
+
* .use(async (ctx, next) => {
|
|
562
|
+
* // Authentication
|
|
563
|
+
* const token = ctx.headers['authorization']
|
|
564
|
+
* ctx.user = await validateToken(token)
|
|
565
|
+
* await next()
|
|
566
|
+
* })
|
|
567
|
+
* .use(async (ctx, next) => {
|
|
568
|
+
* // Logging
|
|
569
|
+
* console.log('Request from:', ctx.user?.id)
|
|
570
|
+
* await next()
|
|
571
|
+
* console.log('Request completed')
|
|
572
|
+
* })
|
|
573
|
+
* .use(async (ctx, next) => {
|
|
574
|
+
* // Rate limiting
|
|
575
|
+
* await checkRateLimit(ctx.user?.id)
|
|
576
|
+
* await next()
|
|
577
|
+
* })
|
|
578
|
+
*
|
|
579
|
+
* // Execute the pipeline
|
|
580
|
+
* await pipeline.execute({
|
|
581
|
+
* body: { name: 'John' },
|
|
582
|
+
* headers: { authorization: 'Bearer ...' }
|
|
583
|
+
* })
|
|
584
|
+
*/
|
|
585
|
+
declare function createMiddleware<Context>(): MiddlewarePipeline<Context>;
|
|
586
|
+
/**
|
|
587
|
+
* Composes multiple middlewares into a single middleware.
|
|
588
|
+
*
|
|
589
|
+
* @example
|
|
590
|
+
* const authMiddleware = compose(
|
|
591
|
+
* validateToken,
|
|
592
|
+
* checkPermissions,
|
|
593
|
+
* loadUser
|
|
594
|
+
* )
|
|
595
|
+
*
|
|
596
|
+
* pipeline.use(authMiddleware)
|
|
597
|
+
*/
|
|
598
|
+
declare function compose<Context>(...middlewares: Middleware<Context>[]): Middleware<Context>;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Dependency Injection Container - Type-safe DI with automatic resolution
|
|
602
|
+
*/
|
|
603
|
+
type Factory<T> = (container: Container) => T;
|
|
604
|
+
type ServiceKey = string | symbol;
|
|
605
|
+
interface Container {
|
|
606
|
+
/** Register a service factory */
|
|
607
|
+
register<T>(key: ServiceKey, factory: Factory<T>): Container;
|
|
608
|
+
/** Register a singleton service */
|
|
609
|
+
singleton<T>(key: ServiceKey, factory: Factory<T>): Container;
|
|
610
|
+
/** Register a constant value */
|
|
611
|
+
constant<T>(key: ServiceKey, value: T): Container;
|
|
612
|
+
/** Resolve a service by key */
|
|
613
|
+
resolve<T>(key: ServiceKey): T;
|
|
614
|
+
/** Check if a service is registered */
|
|
615
|
+
has(key: ServiceKey): boolean;
|
|
616
|
+
/** Create a child container */
|
|
617
|
+
createChild(): Container;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Creates a dependency injection container.
|
|
621
|
+
*
|
|
622
|
+
* @example
|
|
623
|
+
* // Define your services
|
|
624
|
+
* class Logger {
|
|
625
|
+
* log(msg: string) { console.log(msg) }
|
|
626
|
+
* }
|
|
627
|
+
*
|
|
628
|
+
* class Database {
|
|
629
|
+
* constructor(private logger: Logger) {}
|
|
630
|
+
* query(sql: string) {
|
|
631
|
+
* this.logger.log(`Executing: ${sql}`)
|
|
632
|
+
* return []
|
|
633
|
+
* }
|
|
634
|
+
* }
|
|
635
|
+
*
|
|
636
|
+
* class UserService {
|
|
637
|
+
* constructor(private db: Database) {}
|
|
638
|
+
* getUsers() {
|
|
639
|
+
* return this.db.query('SELECT * FROM users')
|
|
640
|
+
* }
|
|
641
|
+
* }
|
|
642
|
+
*
|
|
643
|
+
* // Create container and register services
|
|
644
|
+
* const container = createContainer()
|
|
645
|
+
* .singleton('logger', () => new Logger())
|
|
646
|
+
* .singleton('db', (c) => new Database(c.resolve('logger')))
|
|
647
|
+
* .register('userService', (c) => new UserService(c.resolve('db')))
|
|
648
|
+
*
|
|
649
|
+
* // Resolve services
|
|
650
|
+
* const userService = container.resolve<UserService>('userService')
|
|
651
|
+
* userService.getUsers()
|
|
652
|
+
*
|
|
653
|
+
* @example
|
|
654
|
+
* // With constants
|
|
655
|
+
* const container = createContainer()
|
|
656
|
+
* .constant('apiUrl', 'https://api.example.com')
|
|
657
|
+
* .constant('apiKey', process.env.API_KEY)
|
|
658
|
+
* .singleton('api', (c) => new ApiClient(
|
|
659
|
+
* c.resolve('apiUrl'),
|
|
660
|
+
* c.resolve('apiKey')
|
|
661
|
+
* ))
|
|
662
|
+
*/
|
|
663
|
+
declare function createContainer(parent?: Container): Container;
|
|
664
|
+
/**
|
|
665
|
+
* Creates a typed container with predefined service types.
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* interface Services {
|
|
669
|
+
* logger: Logger
|
|
670
|
+
* db: Database
|
|
671
|
+
* userService: UserService
|
|
672
|
+
* }
|
|
673
|
+
*
|
|
674
|
+
* const container = createTypedContainer<Services>()
|
|
675
|
+
* .singleton('logger', () => new Logger())
|
|
676
|
+
* .singleton('db', (c) => new Database(c.resolve('logger')))
|
|
677
|
+
*
|
|
678
|
+
* // Fully typed!
|
|
679
|
+
* const logger = container.resolve('logger') // Type: Logger
|
|
680
|
+
*/
|
|
681
|
+
declare function createTypedContainer<Services extends Record<string, unknown>>(): {
|
|
682
|
+
register<K extends keyof Services>(key: K, factory: (container: {
|
|
683
|
+
resolve<K2 extends keyof Services>(key: K2): Services[K2];
|
|
684
|
+
}) => Services[K]): ReturnType<typeof createTypedContainer<Services>>;
|
|
685
|
+
singleton<K extends keyof Services>(key: K, factory: (container: {
|
|
686
|
+
resolve<K2 extends keyof Services>(key: K2): Services[K2];
|
|
687
|
+
}) => Services[K]): ReturnType<typeof createTypedContainer<Services>>;
|
|
688
|
+
constant<K extends keyof Services>(key: K, value: Services[K]): ReturnType<typeof createTypedContainer<Services>>;
|
|
689
|
+
resolve<K extends keyof Services>(key: K): Services[K];
|
|
690
|
+
has(key: keyof Services): boolean;
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Type-Safe Router - Routes with typed parameters
|
|
695
|
+
*/
|
|
696
|
+
type ParamType = 'string' | 'number' | 'boolean';
|
|
697
|
+
interface RouteParams {
|
|
698
|
+
[key: string]: ParamType;
|
|
699
|
+
}
|
|
700
|
+
type InferParamType<T extends ParamType> = T extends 'string' ? string : T extends 'number' ? number : T extends 'boolean' ? boolean : never;
|
|
701
|
+
type InferParams<T extends RouteParams> = {
|
|
702
|
+
[K in keyof T]: InferParamType<T[K]>;
|
|
703
|
+
};
|
|
704
|
+
interface Route<Params extends RouteParams = Record<string, never>> {
|
|
705
|
+
path: string;
|
|
706
|
+
params: Params;
|
|
707
|
+
build: (params: InferParams<Params>) => string;
|
|
708
|
+
match: (path: string) => InferParams<Params> | null;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Creates a type-safe route definition.
|
|
712
|
+
*
|
|
713
|
+
* @example
|
|
714
|
+
* const userRoute = route('/users/:id', { id: 'string' })
|
|
715
|
+
*
|
|
716
|
+
* // Build URL (type-checked!)
|
|
717
|
+
* userRoute.build({ id: '123' }) // '/users/123'
|
|
718
|
+
*
|
|
719
|
+
* // Match URL
|
|
720
|
+
* userRoute.match('/users/123') // { id: '123' }
|
|
721
|
+
* userRoute.match('/posts/123') // null
|
|
722
|
+
*/
|
|
723
|
+
declare function route<Params extends RouteParams = Record<string, never>>(path: string, params?: Params): Route<Params>;
|
|
724
|
+
interface Router<Routes extends Record<string, Route<RouteParams>>> {
|
|
725
|
+
routes: Routes;
|
|
726
|
+
navigate: <K extends keyof Routes>(name: K, params: Routes[K] extends Route<infer P> ? InferParams<P> : never) => string;
|
|
727
|
+
match: (path: string) => {
|
|
728
|
+
name: keyof Routes;
|
|
729
|
+
params: Record<string, unknown>;
|
|
730
|
+
} | null;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Creates a type-safe router with named routes.
|
|
734
|
+
*
|
|
735
|
+
* @example
|
|
736
|
+
* const router = createRouter({
|
|
737
|
+
* home: route('/'),
|
|
738
|
+
* users: route('/users'),
|
|
739
|
+
* user: route('/users/:id', { id: 'string' }),
|
|
740
|
+
* post: route('/posts/:postId/comments/:commentId', {
|
|
741
|
+
* postId: 'number',
|
|
742
|
+
* commentId: 'number'
|
|
743
|
+
* }),
|
|
744
|
+
* })
|
|
745
|
+
*
|
|
746
|
+
* // Navigate (fully typed!)
|
|
747
|
+
* router.navigate('user', { id: '123' }) // '/users/123'
|
|
748
|
+
* router.navigate('post', { postId: 1, commentId: 5 }) // '/posts/1/comments/5'
|
|
749
|
+
*
|
|
750
|
+
* // TypeScript error: missing 'id'
|
|
751
|
+
* router.navigate('user', {})
|
|
752
|
+
*
|
|
753
|
+
* // Match current path
|
|
754
|
+
* const matched = router.match('/users/123')
|
|
755
|
+
* // { name: 'user', params: { id: '123' } }
|
|
756
|
+
*/
|
|
757
|
+
declare function createRouter<Routes extends Record<string, Route<RouteParams>>>(routes: Routes): Router<Routes>;
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Type-Safe Form - Form handling with validation
|
|
761
|
+
*/
|
|
762
|
+
|
|
763
|
+
interface FieldState<T> {
|
|
764
|
+
value: Signal<T>;
|
|
765
|
+
error: Signal<string | null>;
|
|
766
|
+
touched: Signal<boolean>;
|
|
767
|
+
dirty: Signal<boolean>;
|
|
768
|
+
}
|
|
769
|
+
interface FormState<T extends Record<string, unknown>> {
|
|
770
|
+
fields: {
|
|
771
|
+
[K in keyof T]: FieldState<T[K]>;
|
|
772
|
+
};
|
|
773
|
+
values: () => T;
|
|
774
|
+
errors: () => Partial<Record<keyof T, string>>;
|
|
775
|
+
isValid: () => boolean;
|
|
776
|
+
isDirty: () => boolean;
|
|
777
|
+
isTouched: () => boolean;
|
|
778
|
+
reset: () => void;
|
|
779
|
+
validate: () => boolean;
|
|
780
|
+
submit: (handler: (values: T) => void | Promise<void>) => Promise<void>;
|
|
781
|
+
}
|
|
782
|
+
type Validator<T> = (value: T) => string | null;
|
|
783
|
+
interface FieldConfig<T> {
|
|
784
|
+
initial: T;
|
|
785
|
+
validate?: Validator<T> | undefined;
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Creates a form field configuration.
|
|
789
|
+
*/
|
|
790
|
+
declare function field<T>(initial: T, validate?: Validator<T>): FieldConfig<T>;
|
|
791
|
+
/**
|
|
792
|
+
* Creates a type-safe form with validation.
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* const form = createForm({
|
|
796
|
+
* email: field('', (v) => !v.includes('@') ? 'Invalid email' : null),
|
|
797
|
+
* password: field('', (v) => v.length < 8 ? 'Min 8 characters' : null),
|
|
798
|
+
* remember: field(false),
|
|
799
|
+
* })
|
|
800
|
+
*
|
|
801
|
+
* // Access field values
|
|
802
|
+
* form.fields.email.value.set('test@example.com')
|
|
803
|
+
*
|
|
804
|
+
* // Check validation
|
|
805
|
+
* console.log(form.isValid()) // true/false
|
|
806
|
+
* console.log(form.errors()) // { email: null, password: 'Min 8 characters' }
|
|
807
|
+
*
|
|
808
|
+
* // Submit form
|
|
809
|
+
* await form.submit(async (values) => {
|
|
810
|
+
* await api.login(values)
|
|
811
|
+
* })
|
|
812
|
+
*
|
|
813
|
+
* // Reset form
|
|
814
|
+
* form.reset()
|
|
815
|
+
*/
|
|
816
|
+
declare function createForm<T extends Record<string, unknown>>(config: {
|
|
817
|
+
[K in keyof T]: FieldConfig<T[K]>;
|
|
818
|
+
}): FormState<T>;
|
|
819
|
+
|
|
21
820
|
/**
|
|
22
821
|
* Creates a new array concatenating array with any additional arrays and/or values.
|
|
23
822
|
*
|
|
@@ -487,6 +1286,58 @@ declare function zipWith<T, R>(iteratee: (...values: T[]) => R, ...arrays: reado
|
|
|
487
1286
|
* ```
|
|
488
1287
|
*/
|
|
489
1288
|
declare const _: {
|
|
1289
|
+
createFeatureFlags: typeof createFeatureFlags;
|
|
1290
|
+
flag: {
|
|
1291
|
+
boolean(defaultValue?: boolean): FlagConfig;
|
|
1292
|
+
string(defaultValue?: string): FlagConfig;
|
|
1293
|
+
number(defaultValue?: number): FlagConfig;
|
|
1294
|
+
};
|
|
1295
|
+
createForm: typeof createForm;
|
|
1296
|
+
field: typeof field;
|
|
1297
|
+
route: typeof route;
|
|
1298
|
+
createRouter: typeof createRouter;
|
|
1299
|
+
env: {
|
|
1300
|
+
string(options?: {
|
|
1301
|
+
default?: string;
|
|
1302
|
+
}): EnvVar<string>;
|
|
1303
|
+
number(options?: {
|
|
1304
|
+
default?: number;
|
|
1305
|
+
}): EnvVar<number>;
|
|
1306
|
+
boolean(options?: {
|
|
1307
|
+
default?: boolean;
|
|
1308
|
+
}): EnvVar<boolean>;
|
|
1309
|
+
enum<T extends string>(values: readonly T[], options?: {
|
|
1310
|
+
default?: T;
|
|
1311
|
+
}): EnvVar<T>;
|
|
1312
|
+
url(options?: {
|
|
1313
|
+
default?: string;
|
|
1314
|
+
}): EnvVar<string>;
|
|
1315
|
+
json<T>(options?: {
|
|
1316
|
+
default?: T;
|
|
1317
|
+
}): EnvVar<T>;
|
|
1318
|
+
array(options?: {
|
|
1319
|
+
default?: string[];
|
|
1320
|
+
separator?: string;
|
|
1321
|
+
}): EnvVar<string[]>;
|
|
1322
|
+
};
|
|
1323
|
+
createEnv: typeof createEnv;
|
|
1324
|
+
createContainer: typeof createContainer;
|
|
1325
|
+
createTypedContainer: typeof createTypedContainer;
|
|
1326
|
+
pipe: typeof pipe;
|
|
1327
|
+
pipeAsync: typeof pipeAsync;
|
|
1328
|
+
flow: typeof flow;
|
|
1329
|
+
createMiddleware: typeof createMiddleware;
|
|
1330
|
+
compose: typeof compose;
|
|
1331
|
+
createEventBus: typeof createEventBus;
|
|
1332
|
+
createTypedEmitter: typeof createTypedEmitter;
|
|
1333
|
+
smartCache: typeof smartCache;
|
|
1334
|
+
memoize: typeof memoize;
|
|
1335
|
+
signal: typeof signal;
|
|
1336
|
+
computed: typeof computed;
|
|
1337
|
+
effect: typeof effect;
|
|
1338
|
+
batch: typeof batch;
|
|
1339
|
+
createUndoableState: typeof createUndoableState;
|
|
1340
|
+
createAutoUndoableState: typeof createAutoUndoableState;
|
|
490
1341
|
concat: typeof concat;
|
|
491
1342
|
differenceBy: typeof differenceBy;
|
|
492
1343
|
differenceWith: typeof differenceWith;
|
|
@@ -575,7 +1426,6 @@ declare const _: {
|
|
|
575
1426
|
percentage: typeof percentage;
|
|
576
1427
|
min: typeof min;
|
|
577
1428
|
max: typeof max;
|
|
578
|
-
memoize: typeof memoize;
|
|
579
1429
|
negate: typeof negate;
|
|
580
1430
|
flip: typeof flip;
|
|
581
1431
|
partial: typeof partial;
|
|
@@ -608,8 +1458,6 @@ declare const _: {
|
|
|
608
1458
|
};
|
|
609
1459
|
setLogLevel: typeof setLogLevel;
|
|
610
1460
|
getLogLevel: typeof getLogLevel;
|
|
611
|
-
pipe: typeof pipe;
|
|
612
|
-
compose: typeof compose;
|
|
613
1461
|
tap: typeof tap;
|
|
614
1462
|
when: typeof when;
|
|
615
1463
|
unless: typeof unless;
|
|
@@ -765,4 +1613,4 @@ declare const _: {
|
|
|
765
1613
|
unreachable: typeof unreachable;
|
|
766
1614
|
};
|
|
767
1615
|
|
|
768
|
-
export { Bind, Debounce, Deprecated, Frozen, Lazy, Log, Measure, Memoize, Retry, Sealed, Throttle, Validate, _, andThen, ary, assert, assertDefined, assertNever, average, awaitTo, camelCase, capitalize, castArray, chunk, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, coerceArray, coerceString, compact, compose, concat, conformsTo, constant, countBy, curry, debounce, debug, deepMerge, _ as default, defaults, defer, deprecated, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, entriesTyped, eq, err, exhaustive, fail, fill, filterObject, findIndex, findLast, findLastIndex, first, flatten, flattenDeep, flattenDepth, flip, fromEntriesTyped, fromNullable, fromPairs, get, getLogLevel, groupBy, gt, gte, has, hasKey, hasKeys, head, identity, ifElse, indexBy, indexOf, init, intersection, intersectionBy, intersectionWith, invariant, invert, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isDefined, isElement, isEmail, isEmpty, isEqual, isEqualWith, isErr, isError, isFinite, isFunction, isInteger, isIpAddress, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNonEmpty, isNull, isNumber, isObject, isObjectLike, isOk, isPlainObject, isPromise, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isUrl, isUuid, isWeakMap, isWeakSet, join, kebabCase, keysTyped, last, lastIndexOf, lt, lte, mapErr, mapObject, mapOption, mapResult, match, matchOption, matchResult, max, maxBy, measure, measureAsync, median,
|
|
1616
|
+
export { Bind, type CacheOptions, type Container, Debounce, Deprecated, type EventBus, type FeatureFlags, type FieldState, type FormState, Frozen, Lazy, Log, Measure, Memoize, type Middleware, type MiddlewarePipeline, type ReadonlySignal, Retry, type Route, type Router, Sealed, type Signal, Throttle, type UndoableOptions, type UndoableState, Validate, _, andThen, ary, assert, assertDefined, assertNever, average, awaitTo, batch, camelCase, capitalize, castArray, chunk, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, coerceArray, coerceString, compact, compose as composeMiddleware, computed, concat, conformsTo, constant, countBy, createAutoUndoableState, createContainer, createEnv, createEventBus, createFeatureFlags, createForm, createMiddleware, createRouter, createTypedContainer, createTypedEmitter, createUndoableState, curry, debounce, debug, deepMerge, _ as default, defaults, defer, deprecated, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, effect, entriesTyped, env, eq, err, exhaustive, fail, field, fill, filterObject, findIndex, findLast, findLastIndex, first, flag, flatten, flattenDeep, flattenDepth, flip, flow, fromEntriesTyped, fromNullable, fromPairs, get, getLogLevel, groupBy, gt, gte, has, hasKey, hasKeys, head, identity, ifElse, indexBy, indexOf, init, intersection, intersectionBy, intersectionWith, invariant, invert, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isDefined, isElement, isEmail, isEmpty, isEqual, isEqualWith, isErr, isError, isFinite, isFunction, isInteger, isIpAddress, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNonEmpty, isNull, isNumber, isObject, isObjectLike, isOk, isPlainObject, isPromise, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isUrl, isUuid, isWeakMap, isWeakSet, join, kebabCase, keysTyped, last, lastIndexOf, lt, lte, mapErr, mapObject, mapOption, mapResult, match, matchOption, matchResult, max, maxBy, measure, measureAsync, median, mergeShallow, min, minBy, negate, none, noop, nth, ok, omit, once, onceAsync, orElse, parallel, parseBoolean, parseDate, parseInteger, parseNumber, parseUrl, partial, partition, pascalCase, paths, percentage, pick, pipeAsync, pipe as pipeValue, pull, pullAll, pullAllBy, pullAllWith, pullAt, randomFloat, randomInt, range, remove, retry, reverse, round, route, safeJsonParse, safeJsonStringify, sample, set, setLogLevel, shuffle, signal, sleep, slice, slugify, smartCache, memoize as smartMemoize, snakeCase, some, sortBy, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, sortedUniq, sortedUniqBy, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, tap, template, throttle, toArray, toFinite, toInteger, toLength, toNullable, toNumber, toPlainObject, toSafeInteger, toString, todo, transform, trimAll, truncate, tryCatch, tryCatchAsync, unary, uncapitalize, union, unionBy, unionWith, uniqBy, uniqWith, unique, unless, unreachable, unset, unwrap, unwrapOption, unwrapOptionOr, unwrapOr, unzip, unzipWith, valuesTyped, when, withTimeout, without, words, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith };
|