@xylabs/object 4.4.21 → 4.4.23
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/neutral/Enum.d.ts +84 -0
- package/dist/neutral/Enum.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +1 -0
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +6 -0
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/Enum.ts +87 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transforms a given record object into a readonly "enum-like" structure while preserving
|
|
3
|
+
* the literal types of its values. This allows you to use the returned object both at runtime
|
|
4
|
+
* (for lookups) and at compile time (for strongly typed values).
|
|
5
|
+
*
|
|
6
|
+
* To maintain literal types (i.e., prevent them from being widened to `string`, `number`, etc.),
|
|
7
|
+
* ensure you annotate your object with `as const` before passing it to `Enum`.
|
|
8
|
+
*
|
|
9
|
+
* @template T - A record type with string keys and any kind of values.
|
|
10
|
+
* @param obj - A readonly record object annotated with `as const`.
|
|
11
|
+
* @returns A readonly version of the provided record, preserving exact literal value types.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Defining a record with literal types using as const:
|
|
16
|
+
* const DnsRecordType = Enum({
|
|
17
|
+
* A: 1,
|
|
18
|
+
* AAAA: 28,
|
|
19
|
+
* CAA: 257,
|
|
20
|
+
* CNAME: 5,
|
|
21
|
+
* DNAME: 39,
|
|
22
|
+
* MX: 15,
|
|
23
|
+
* NS: 2,
|
|
24
|
+
* PTR: 12,
|
|
25
|
+
* SOA: 6,
|
|
26
|
+
* SPF: 99,
|
|
27
|
+
* SRV: 33,
|
|
28
|
+
* TXT: 16,
|
|
29
|
+
* } as const);
|
|
30
|
+
*
|
|
31
|
+
* // DnsRecordType is now a readonly object:
|
|
32
|
+
* // {
|
|
33
|
+
* // readonly A: 1;
|
|
34
|
+
* // readonly AAAA: 28;
|
|
35
|
+
* // readonly CAA: 257;
|
|
36
|
+
* // readonly CNAME: 5;
|
|
37
|
+
* // readonly DNAME: 39;
|
|
38
|
+
* // readonly MX: 15;
|
|
39
|
+
* // readonly NS: 2;
|
|
40
|
+
* // readonly PTR: 12;
|
|
41
|
+
* // readonly SOA: 6;
|
|
42
|
+
* // readonly SPF: 99;
|
|
43
|
+
* // readonly SRV: 33;
|
|
44
|
+
* // readonly TXT: 16;
|
|
45
|
+
* // }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const Enum: <const T extends Record<string | number | symbol, unknown>>(obj: Readonly<T>) => Enum<T>;
|
|
49
|
+
/**
|
|
50
|
+
* A utility type that, given a `Record<string, unknown>`, returns a readonly version
|
|
51
|
+
* of that record. This results in a type where all properties of `T` are readonly.
|
|
52
|
+
*
|
|
53
|
+
* @template T - The record type to make readonly.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* // Given a record:
|
|
58
|
+
* export const DnsRecordType = Enum({
|
|
59
|
+
* A: 1,
|
|
60
|
+
* AAAA: 28,
|
|
61
|
+
* CAA: 257,
|
|
62
|
+
* CNAME: 5,
|
|
63
|
+
* DNAME: 39,
|
|
64
|
+
* MX: 15,
|
|
65
|
+
* NS: 2,
|
|
66
|
+
* PTR: 12,
|
|
67
|
+
* SOA: 6,
|
|
68
|
+
* SPF: 99,
|
|
69
|
+
* SRV: 33,
|
|
70
|
+
* TXT: 16,
|
|
71
|
+
* })
|
|
72
|
+
*
|
|
73
|
+
* // Now the type inference will preserve the literal types:
|
|
74
|
+
* export type DnsRecordType = Enum<typeof DnsRecordType>
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export type Enum<T extends Readonly<Record<string | number | symbol, unknown>>> = {
|
|
78
|
+
readonly [K in keyof T]: T[K];
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* A utility type that, given an `Enum` object, returns the union of its values.
|
|
82
|
+
*/
|
|
83
|
+
export type EnumValue<T extends Record<string | number | symbol, unknown>, K = Enum<T>> = K[keyof K];
|
|
84
|
+
//# sourceMappingURL=Enum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Enum.d.ts","sourceRoot":"","sources":["../../src/Enum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,eAAO,MAAM,IAAI,SAAU,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAG,IAAI,CAAC,CAAC,CAExG,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;IAChF,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC9B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA"}
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './AsObjectFactory.ts';
|
|
|
4
4
|
export * from './AsTypeFactory.ts';
|
|
5
5
|
export * from './Base.ts';
|
|
6
6
|
export * from './EmptyObject.ts';
|
|
7
|
+
export * from './Enum.ts';
|
|
7
8
|
export * from './globallyUnique.ts';
|
|
8
9
|
export * from './isObject.ts';
|
|
9
10
|
export * from './IsObjectFactory.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -206,6 +206,11 @@ var Base = class _Base {
|
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
208
|
|
|
209
|
+
// src/Enum.ts
|
|
210
|
+
var Enum = (obj) => {
|
|
211
|
+
return obj;
|
|
212
|
+
};
|
|
213
|
+
|
|
209
214
|
// src/IsObjectFactory.ts
|
|
210
215
|
var IsObjectFactory = class {
|
|
211
216
|
create(shape, additionalChecks) {
|
|
@@ -388,6 +393,7 @@ export {
|
|
|
388
393
|
AsObjectFactory,
|
|
389
394
|
AsTypeFactory,
|
|
390
395
|
Base,
|
|
396
|
+
Enum,
|
|
391
397
|
IsObjectFactory,
|
|
392
398
|
ObjectWrapper,
|
|
393
399
|
ValidatorBase,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/AsTypeFactory.ts","../../src/AsObjectFactory.ts","../../src/isType.ts","../../src/isObject.ts","../../src/asObject.ts","../../src/Base.ts","../../src/globallyUnique.ts","../../src/IsObjectFactory.ts","../../src/JsonObject.ts","../../src/ObjectWrapper.ts","../../src/omitBy.ts","../../src/pickBy.ts","../../src/removeFields.ts","../../src/toJson.ts","../../src/Validator.ts"],"sourcesContent":["import type { AssertExMessageFunc } from '@xylabs/assert'\nimport { assertEx } from '@xylabs/assert'\nimport type { Logger } from '@xylabs/logger'\nimport type { AnyNonPromise } from '@xylabs/promise'\nimport { isPromise } from '@xylabs/promise'\nimport type { TypedValue } from '@xylabs/typeof'\n\nexport interface TypeCheckConfig {\n log?: boolean | Logger\n}\n\nexport type StringOrAlertFunction<T extends AnyNonPromise> = string | AssertExMessageFunc<T>\n\nexport type TypeCheck<T extends TypedValue> = (obj: AnyNonPromise, config?: TypeCheckConfig) => obj is T\n\nexport const AsTypeFactory = {\n create: <T extends AnyNonPromise>(typeCheck: TypeCheck<T>) => {\n function func<TType extends T>(value: AnyNonPromise, config?: TypeCheckConfig): TType | undefined\n function func<TType extends T>(value: AnyNonPromise, assert: StringOrAlertFunction<T>, config?: TypeCheckConfig): TType\n function func<TType extends T>(\n value: AnyNonPromise,\n assertOrConfig?: StringOrAlertFunction<T> | TypeCheckConfig,\n config?: TypeCheckConfig,\n ): TType | undefined {\n if (value === undefined) {\n return undefined\n }\n\n if (value === null) {\n return undefined\n }\n\n if (isPromise(value)) {\n throw new TypeError('un-awaited promises may not be sent to \"as\" functions')\n }\n\n const resolvedAssert = (typeof assertOrConfig === 'object' ? undefined : assertOrConfig) as StringOrAlertFunction<T> | undefined\n const resolvedConfig = typeof assertOrConfig === 'object' ? assertOrConfig : config\n const result = typeCheck(value, resolvedConfig) ? (value as TType) : undefined\n\n if (resolvedAssert) {\n if (typeof resolvedAssert === 'function') {\n assertEx<T>(result, resolvedAssert)\n } else {\n assertEx<T>(result, () => resolvedAssert)\n }\n }\n return result\n }\n return func\n },\n}\n","import type { TypedObject } from '@xylabs/typeof'\n\nimport type { TypeCheck } from './AsTypeFactory.ts'\nimport { AsTypeFactory } from './AsTypeFactory.ts'\n\nexport const AsObjectFactory = {\n create: <T extends TypedObject>(typeCheck: TypeCheck<T>) => {\n return AsTypeFactory.create<T>(typeCheck)\n },\n}\n","import type { FieldType } from '@xylabs/typeof'\n\nexport const isType = (value: unknown, expectedType: FieldType) => {\n const typeofValue = typeof value\n switch (expectedType) {\n case 'array': {\n return Array.isArray(value)\n }\n case 'null': {\n return value === null\n }\n case 'undefined': {\n return value === undefined\n }\n case 'object': {\n // nulls resolve to objects, so exclude them\n if (value === null) {\n return false\n }\n // arrays resolve to objects, so exclude them\n return typeofValue === 'object' && !Array.isArray(value)\n }\n default: {\n return typeofValue === expectedType\n }\n }\n}\n","import type { AnyObject } from './AnyObject.ts'\nimport { isType } from './isType.ts'\n\nexport const isObject = (value: unknown): value is AnyObject => {\n return isType(value, 'object')\n}\n","import type { AnyObject } from './AnyObject.ts'\nimport { AsObjectFactory } from './AsObjectFactory.ts'\nimport { isObject } from './isObject.ts'\n\nexport const asAnyObject = (() => AsObjectFactory.create<AnyObject>(<T extends AnyObject>(obj: unknown): obj is T => isObject(obj)))()\n","import { assertEx } from '@xylabs/assert'\nimport type { Logger } from '@xylabs/logger'\n\nimport type { EmptyObject } from './EmptyObject.ts'\nimport { globallyUnique } from './globallyUnique.ts'\n\nconst DEFAULT_HISTORY_INTERVAL = 1000 * 5\nconst DEFAULT_HISTORY_TIME = 60 * 60 * 1000\nconst MAX_GC_FREQUENCY = 1000 * 60\nconst MIN_GC_FREQUENCY = 1000\nconst MIN_HISTORY_INTERVAL = 1000\n\nexport type BaseClassName = Exclude<string, 'base-class-name-reserved-32546239486'>\n\nexport type BaseParamsFields = {\n logger?: Logger\n}\n\nexport type BaseParams<TAdditionalParams extends EmptyObject | void = void> =\n TAdditionalParams extends EmptyObject ? BaseParamsFields & TAdditionalParams : BaseParamsFields\n\nexport abstract class Base<TParams extends BaseParams | undefined = BaseParams> {\n static defaultLogger?: Logger\n static readonly globalInstances: Record<BaseClassName, WeakRef<Base<BaseParams | undefined>>[]> = {}\n static readonly globalInstancesCountHistory: Record<BaseClassName, number[]> = {}\n static readonly uniqueName = globallyUnique(this.name, this, 'xyo')\n private static _historyInterval = DEFAULT_HISTORY_INTERVAL\n private static _historyTime = DEFAULT_HISTORY_TIME\n private static _historyTimeout?: ReturnType<typeof setTimeout>\n private static _lastGC = 0\n private static _maxGcFrequency = MAX_GC_FREQUENCY\n private _params: TParams\n\n constructor(params: TParams) {\n this._params = params\n params?.logger?.debug(`Base constructed [${Object(this).name}]`)\n this.recordInstance()\n }\n\n static get historyInterval() {\n return this._historyInterval\n }\n\n static set historyInterval(value: number) {\n assertEx(value <= this.historyTime, () => `historyInterval [${value}] must be less than or equal to historyTime [${this.historyTime}]`)\n this._historyInterval = Math.max(value, MIN_HISTORY_INTERVAL)\n }\n\n static get historyTime() {\n return this._historyTime\n }\n\n static set historyTime(value: number) {\n assertEx(value >= this.historyInterval, () => `historyTime [${value}] must be greater than or equal to historyInterval [${this.historyInterval}]`)\n this._historyInterval = value\n }\n\n static get maxGcFrequency() {\n return this._maxGcFrequency\n }\n\n static set maxGcFrequency(value: number) {\n this._maxGcFrequency = Math.max(value, MIN_GC_FREQUENCY)\n }\n\n static get maxHistoryDepth() {\n return Math.floor(this.historyTime / this.historyInterval)\n }\n\n get logger() {\n return this.params?.logger ?? Base.defaultLogger\n }\n\n get params() {\n return this._params\n }\n\n static gc(force?: boolean): void\n static gc(className: string): void\n static gc(classNameOrForce: string | boolean = false): void {\n if (typeof classNameOrForce === 'string') {\n this.gcClass(classNameOrForce)\n } else {\n if (classNameOrForce || Date.now() - this._lastGC > this._maxGcFrequency) {\n this.gcAll()\n }\n }\n }\n\n static instanceCount(className: string): number {\n return this.globalInstances[className]?.length ?? 0\n }\n\n static instanceCounts(): Record<BaseClassName, number> {\n this.gc()\n const result: Record<BaseClassName, number> = {}\n for (const [className, instances] of Object.entries(this.globalInstances)) result[className] = instances.length\n return result\n }\n\n static startHistory(): void {\n if (this._historyTimeout) {\n this.stopHistory()\n }\n\n const timeoutHandler = () => {\n if (this._historyTimeout) {\n this.addToHistory()\n this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval)\n }\n }\n\n this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval)\n }\n\n static stopHistory(): void {\n if (this._historyTimeout) {\n clearTimeout(this._historyTimeout)\n this._historyTimeout = undefined\n }\n }\n\n private static addToHistory() {\n const counts = this.instanceCounts()\n for (const className of Object.keys(this.globalInstances)) {\n this.globalInstancesCountHistory[className] = this.globalInstancesCountHistory[className]?.slice(-this.maxHistoryDepth) ?? []\n this.globalInstancesCountHistory[className].push(counts[className])\n }\n }\n\n private static gcAll() {\n for (const className of Object.keys(this.globalInstances)) {\n this.gcClass(className)\n }\n }\n\n private static gcClass(className: BaseClassName) {\n // remove all the weak refs that are now empty\n this.globalInstances[className] = this.globalInstances[className]?.filter(ref => ref.deref() !== null) ?? []\n }\n\n private recordInstance() {\n const instanceArray = Base.globalInstances[this.constructor.name] ?? []\n instanceArray.push(new WeakRef(this))\n Base.globalInstances[this.constructor.name] = instanceArray\n }\n}\n","interface XylabsGlobalThis {\n xylabs: {\n unique: Record<string, unknown>\n uniqueDisabled?: boolean\n }\n}\n\nconst xyoGlobal = () => {\n return ((globalThis as unknown as XylabsGlobalThis).xylabs = (globalThis as unknown as XylabsGlobalThis).xylabs ?? {})\n}\n\nexport const disableGloballyUnique = () => {\n xyoGlobal().uniqueDisabled = true\n}\n\nexport const globallyUnique = (name: string, value: unknown, domain = 'global') => {\n const uniqueName = [domain, name].join(':')\n if (!xyoGlobal().uniqueDisabled) {\n const xyo = ((globalThis as unknown as XylabsGlobalThis).xylabs = (globalThis as unknown as XylabsGlobalThis).xylabs ?? {})\n const unique = (xyo.unique = xyo.unique ?? {})\n if (unique[uniqueName] === undefined) {\n unique[uniqueName] = value\n } else {\n if (unique[uniqueName] !== value) {\n throw new Error(\n `Global unique item ${uniqueName} already defined. Make sure you are not importing two versions of the package that contains this item`,\n )\n }\n }\n }\n return uniqueName\n}\n","import type { ObjectTypeShape, TypedObject } from '@xylabs/typeof'\n\nimport type { TypeCheck, TypeCheckConfig } from './AsTypeFactory.ts'\nimport { isType } from './isType.ts'\n\nexport interface ObjectTypeConfig extends TypeCheckConfig {}\n\nexport class IsObjectFactory<T extends TypedObject> {\n create(shape?: ObjectTypeShape, additionalChecks?: TypeCheck<TypedObject>[]): TypeCheck<T> {\n return (obj, { log } = {}): obj is T => {\n if (!obj || typeof obj !== 'object') {\n return false\n }\n return (\n // do primary check\n Object.entries(shape ?? {}).filter(([key, type]) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result = isType((obj as any)[key], type)\n if (!result && log) {\n const logger = typeof log === 'object' ? log : console\n logger.warn(`isType Failed: ${key}: ${type}`)\n }\n return !result\n }).length === 0\n // perform additional checks\n && (additionalChecks?.reduce((prev, check) => prev && check(obj, { log }), true) ?? true)\n )\n }\n }\n}\n","import { isObject } from './isObject.ts'\n\nexport type JsonValue = string | number | boolean | null | JsonObject | JsonArray\nexport type JsonObject = { [key: string]: JsonValue }\nexport type JsonArray = JsonValue[]\n\nexport const isJsonValue = (value: unknown): value is JsonValue => {\n switch (typeof value) {\n case 'string':\n case 'number':\n case 'boolean': {\n return true\n }\n default: {\n return value === null || isJsonObject(value) || isJsonArray(value)\n }\n }\n}\n\nexport const isJsonArray = (value: unknown): value is JsonArray => {\n return Array.isArray(value) && !value.some(item => !isJsonValue(item))\n}\n\nexport const isValidJsonFieldPair = ([key, value]: [key: unknown, value: unknown]) => {\n return typeof key === 'string' && isJsonValue(value)\n}\n\nexport const isJsonObject = (value: unknown): value is JsonObject => {\n return (\n isObject(value)\n // check if all keys are strings\n && !Object.entries(value).some(item => !isValidJsonFieldPair(item))\n )\n}\n","import type { EmptyObject } from './EmptyObject.ts'\nimport type { StringKeyObject } from './StringKeyObject.ts'\n\nexport abstract class ObjectWrapper<T extends EmptyObject = EmptyObject> {\n readonly obj: T\n constructor(obj: T) {\n this.obj = obj\n }\n\n protected get stringKeyObj() {\n return this.obj as StringKeyObject\n }\n}\n","import { assertEx } from '@xylabs/assert'\n\nimport type { EmptyObject } from './EmptyObject.ts'\nimport type { JsonObject } from './JsonObject.ts'\nimport type { DeepOmitStartsWith } from './OmitStartsWith.ts'\n\nexport type OmitByPredicate<T extends EmptyObject = Record<string, unknown>> = (value: T[keyof T], key: keyof T) => boolean\n\nconst omitByArray = <T>(\n obj: T[],\n predicate: OmitByPredicate,\n maxDepth: number,\n): T[] => {\n return obj.map((value) => {\n return (value !== null && typeof value === 'object') ? omitBy(value, predicate, maxDepth) : value\n }) as T[]\n}\n\nconst omitByObject = <T extends EmptyObject>(\n obj: T,\n predicate: OmitByPredicate,\n maxDepth: number,\n): Partial<T> => {\n const result: JsonObject = {}\n\n for (const key in obj) {\n if (Object.hasOwn(obj, key)) {\n const value = obj[key]\n if (!predicate(value, key)) {\n result[key] = ((value !== null && typeof value === 'object') ? omitBy(value, predicate, maxDepth - 1) : value) as JsonObject\n }\n }\n }\n\n return result as T\n}\n\nexport const omitBy = <T extends EmptyObject>(\n obj: T,\n predicate: OmitByPredicate,\n maxDepth = 1,\n): Partial<T> => {\n if (maxDepth <= 0) {\n return obj\n }\n\n return Array.isArray(obj) ? omitByArray(obj, predicate, maxDepth - 1) as T : omitByObject(obj, predicate, maxDepth - 1) as T\n}\n\nconst omitByPrefixPredicate = (prefix: string) => (_: unknown, key: string) => {\n assertEx(typeof key === 'string', () => `Invalid key type [${key}, ${typeof key}]`)\n return key.startsWith(prefix)\n}\n\nexport const omitByPrefix = <T extends EmptyObject, P extends string>(payload: T, prefix: P, maxDepth = 100): DeepOmitStartsWith<T, P> => {\n return omitBy(payload, omitByPrefixPredicate(prefix), maxDepth) as unknown as DeepOmitStartsWith<T, P>\n}\n","import { assertEx } from '@xylabs/assert'\n\nimport type { EmptyObject } from './EmptyObject.ts'\nimport type { JsonObject } from './JsonObject.ts'\nimport type { DeepPickStartsWith } from './PickStartsWith.ts'\n\nexport type PickByPredicate<T extends EmptyObject = Record<string, unknown>> = (value: T[keyof T], key: keyof T) => boolean\n\nconst pickByArray = <T>(\n obj: T[],\n predicate: PickByPredicate,\n maxDepth: number,\n): T[] => {\n return obj.map((value) => {\n return (value !== null && typeof value === 'object') ? pickBy(value, predicate, maxDepth) : value\n }) as T[]\n}\n\nconst pickByObject = <T extends EmptyObject>(\n obj: T,\n predicate: PickByPredicate,\n maxDepth: number,\n): Partial<T> => {\n const result: JsonObject = {}\n\n for (const key in obj) {\n if (Object.hasOwn(obj, key)) {\n const value = obj[key]\n if (predicate(value, key)) {\n result[key] = ((value !== null && typeof value === 'object') ? pickBy(value, predicate, maxDepth - 1) : value) as JsonObject\n }\n }\n }\n\n return result as T\n}\n\nexport const pickBy = <T extends EmptyObject>(\n obj: T,\n predicate: PickByPredicate,\n maxDepth = 1,\n): Partial<T> => {\n if (maxDepth <= 0) {\n return obj\n }\n\n return Array.isArray(obj) ? pickByArray(obj, predicate, maxDepth - 1) as T : pickByObject(obj, predicate, maxDepth - 1) as T\n}\n\nconst pickByPrefixPredicate = (prefix: string) => (_: unknown, key: string) => {\n assertEx(typeof key === 'string', () => `Invalid key type [${key}, ${typeof key}]`)\n return key.startsWith(prefix)\n}\n\nexport const pickByPrefix = <T extends EmptyObject, P extends string>(payload: T, prefix: P, maxDepth = 100): DeepPickStartsWith<T, P> => {\n return pickBy(payload, pickByPrefixPredicate(prefix), maxDepth) as unknown as DeepPickStartsWith<T, P>\n}\n","import type { EmptyObject } from './EmptyObject.ts'\n\nexport const removeFields = <T extends EmptyObject, K extends keyof T>(obj: T, fields: K[]): Omit<T, K> => {\n const clone = { ...obj }\n for (const field of fields) {\n delete clone[field]\n }\n return clone\n}\n","import type {\n JsonArray, JsonObject, JsonValue,\n} from './JsonObject.ts'\n\nexport const toJsonArray = (value: unknown[], cycleList?: unknown[], maxDepth = 3): JsonArray => {\n return value.map(item => toJsonValue(item, cycleList, maxDepth))\n}\n\nexport const toJsonObject = (value: object, cycleList?: unknown[], maxDepth = 3): JsonObject => {\n const result: JsonObject = {}\n for (const [key, entry] of Object.entries(value)) {\n result[key] = value === undefined ? '[Undefined]' : toJsonValue(entry, cycleList, maxDepth)\n }\n return result\n}\n\nexport const toJsonValue = (value: unknown, cycleList?: unknown[], maxDepth = 3): JsonValue => {\n if (maxDepth <= 0 && typeof value === 'object') {\n return '[MaxDepth]'\n }\n if (cycleList?.includes(value)) {\n return '[Circular]'\n }\n switch (typeof value) {\n case 'string':\n case 'boolean':\n case 'number': {\n return value\n }\n case 'object': {\n if (value === null) {\n return null\n }\n const newCycleList = cycleList ?? []\n newCycleList.push(value)\n return Array.isArray(value) ? toJsonArray(value, newCycleList, maxDepth - 1) : toJsonObject(value, newCycleList, maxDepth - 1)\n }\n default: {\n return `[${typeof value}]`\n }\n }\n}\n\nexport const toJsonString = (value: unknown, maxDepth = 3) => {\n return JSON.stringify(toJson(value, maxDepth), null, 2)\n}\n\nexport const toJson = (value: unknown, maxDepth = 3): JsonValue => {\n return toJsonValue(value, undefined, maxDepth)\n}\n","import type { Promisable } from '@xylabs/promise'\n\nimport type { AnyObject } from './AnyObject.ts'\nimport type { EmptyObject } from './EmptyObject.ts'\nimport { ObjectWrapper } from './ObjectWrapper.ts'\n\nexport interface Validator<T extends EmptyObject = AnyObject> {\n validate(payload: T): Promisable<Error[]>\n}\n\nexport abstract class ValidatorBase<T extends EmptyObject = AnyObject> extends ObjectWrapper<Partial<T>> implements Validator<T> {\n abstract validate(payload: T): Promisable<Error[]>\n}\n"],"mappings":";AACA,SAAS,gBAAgB;AAGzB,SAAS,iBAAiB;AAWnB,IAAM,gBAAgB;AAAA,EAC3B,QAAQ,CAA0B,cAA4B;AAG5D,aAAS,KACP,OACA,gBACA,QACmB;AACnB,UAAI,UAAU,QAAW;AACvB,eAAO;AAAA,MACT;AAEA,UAAI,UAAU,MAAM;AAClB,eAAO;AAAA,MACT;AAEA,UAAI,UAAU,KAAK,GAAG;AACpB,cAAM,IAAI,UAAU,uDAAuD;AAAA,MAC7E;AAEA,YAAM,iBAAkB,OAAO,mBAAmB,WAAW,SAAY;AACzE,YAAM,iBAAiB,OAAO,mBAAmB,WAAW,iBAAiB;AAC7E,YAAM,SAAS,UAAU,OAAO,cAAc,IAAK,QAAkB;AAErE,UAAI,gBAAgB;AAClB,YAAI,OAAO,mBAAmB,YAAY;AACxC,mBAAY,QAAQ,cAAc;AAAA,QACpC,OAAO;AACL,mBAAY,QAAQ,MAAM,cAAc;AAAA,QAC1C;AAAA,MACF;AACA,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AACF;;;AC9CO,IAAM,kBAAkB;AAAA,EAC7B,QAAQ,CAAwB,cAA4B;A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ACb,UAAI,UAAU,MAAM;AAClB,eAAO;AAAA,MACT;AACA,YAAM,eAAe,aAAa,CAAC;AACnC,mBAAa,KAAK,KAAK;AACvB,aAAO,MAAM,QAAQ,KAAK,IAAI,YAAY,OAAO,cAAc,WAAW,CAAC,IAAI,aAAa,OAAO,cAAc,WAAW,CAAC;AAAA,IAC/H;AAAA,IACA,SAAS;AACP,aAAO,IAAI,OAAO,KAAK;AAAA,IACzB;AAAA,EACF;AACF;AAEO,IAAM,eAAe,CAAC,OAAgB,WAAW,MAAM;AAC5D,SAAO,KAAK,UAAU,OAAO,OAAO,QAAQ,GAAG,MAAM,CAAC;AACxD;AAEO,IAAM,SAAS,CAAC,OAAgB,WAAW,MAAiB;AACjE,SAAO,YAAY,OAAO,QAAW,QAAQ;AAC/C;;;ACvCO,IAAe,gBAAf,cAAwE,cAAkD;AAEjI;","names":["assertEx","assertEx","assertEx","assertEx"]}
|
|
1
|
+
{"version":3,"sources":["../../src/AsTypeFactory.ts","../../src/AsObjectFactory.ts","../../src/isType.ts","../../src/isObject.ts","../../src/asObject.ts","../../src/Base.ts","../../src/globallyUnique.ts","../../src/Enum.ts","../../src/IsObjectFactory.ts","../../src/JsonObject.ts","../../src/ObjectWrapper.ts","../../src/omitBy.ts","../../src/pickBy.ts","../../src/removeFields.ts","../../src/toJson.ts","../../src/Validator.ts"],"sourcesContent":["import type { AssertExMessageFunc } from '@xylabs/assert'\nimport { assertEx } from '@xylabs/assert'\nimport type { Logger } from '@xylabs/logger'\nimport type { AnyNonPromise } from '@xylabs/promise'\nimport { isPromise } from '@xylabs/promise'\nimport type { TypedValue } from '@xylabs/typeof'\n\nexport interface TypeCheckConfig {\n log?: boolean | Logger\n}\n\nexport type StringOrAlertFunction<T extends AnyNonPromise> = string | AssertExMessageFunc<T>\n\nexport type TypeCheck<T extends TypedValue> = (obj: AnyNonPromise, config?: TypeCheckConfig) => obj is T\n\nexport const AsTypeFactory = {\n create: <T extends AnyNonPromise>(typeCheck: TypeCheck<T>) => {\n function func<TType extends T>(value: AnyNonPromise, config?: TypeCheckConfig): TType | undefined\n function func<TType extends T>(value: AnyNonPromise, assert: StringOrAlertFunction<T>, config?: TypeCheckConfig): TType\n function func<TType extends T>(\n value: AnyNonPromise,\n assertOrConfig?: StringOrAlertFunction<T> | TypeCheckConfig,\n config?: TypeCheckConfig,\n ): TType | undefined {\n if (value === undefined) {\n return undefined\n }\n\n if (value === null) {\n return undefined\n }\n\n if (isPromise(value)) {\n throw new TypeError('un-awaited promises may not be sent to \"as\" functions')\n }\n\n const resolvedAssert = (typeof assertOrConfig === 'object' ? undefined : assertOrConfig) as StringOrAlertFunction<T> | undefined\n const resolvedConfig = typeof assertOrConfig === 'object' ? assertOrConfig : config\n const result = typeCheck(value, resolvedConfig) ? (value as TType) : undefined\n\n if (resolvedAssert) {\n if (typeof resolvedAssert === 'function') {\n assertEx<T>(result, resolvedAssert)\n } else {\n assertEx<T>(result, () => resolvedAssert)\n }\n }\n return result\n }\n return func\n },\n}\n","import type { TypedObject } from '@xylabs/typeof'\n\nimport type { TypeCheck } from './AsTypeFactory.ts'\nimport { AsTypeFactory } from './AsTypeFactory.ts'\n\nexport const AsObjectFactory = {\n create: <T extends TypedObject>(typeCheck: TypeCheck<T>) => {\n return AsTypeFactory.create<T>(typeCheck)\n },\n}\n","import type { FieldType } from '@xylabs/typeof'\n\nexport const isType = (value: unknown, expectedType: FieldType) => {\n const typeofValue = typeof value\n switch (expectedType) {\n case 'array': {\n return Array.isArray(value)\n }\n case 'null': {\n return value === null\n }\n case 'undefined': {\n return value === undefined\n }\n case 'object': {\n // nulls resolve to objects, so exclude them\n if (value === null) {\n return false\n }\n // arrays resolve to objects, so exclude them\n return typeofValue === 'object' && !Array.isArray(value)\n }\n default: {\n return typeofValue === expectedType\n }\n }\n}\n","import type { AnyObject } from './AnyObject.ts'\nimport { isType } from './isType.ts'\n\nexport const isObject = (value: unknown): value is AnyObject => {\n return isType(value, 'object')\n}\n","import type { AnyObject } from './AnyObject.ts'\nimport { AsObjectFactory } from './AsObjectFactory.ts'\nimport { isObject } from './isObject.ts'\n\nexport const asAnyObject = (() => AsObjectFactory.create<AnyObject>(<T extends AnyObject>(obj: unknown): obj is T => isObject(obj)))()\n","import { assertEx } from '@xylabs/assert'\nimport type { Logger } from '@xylabs/logger'\n\nimport type { EmptyObject } from './EmptyObject.ts'\nimport { globallyUnique } from './globallyUnique.ts'\n\nconst DEFAULT_HISTORY_INTERVAL = 1000 * 5\nconst DEFAULT_HISTORY_TIME = 60 * 60 * 1000\nconst MAX_GC_FREQUENCY = 1000 * 60\nconst MIN_GC_FREQUENCY = 1000\nconst MIN_HISTORY_INTERVAL = 1000\n\nexport type BaseClassName = Exclude<string, 'base-class-name-reserved-32546239486'>\n\nexport type BaseParamsFields = {\n logger?: Logger\n}\n\nexport type BaseParams<TAdditionalParams extends EmptyObject | void = void> =\n TAdditionalParams extends EmptyObject ? BaseParamsFields & TAdditionalParams : BaseParamsFields\n\nexport abstract class Base<TParams extends BaseParams | undefined = BaseParams> {\n static defaultLogger?: Logger\n static readonly globalInstances: Record<BaseClassName, WeakRef<Base<BaseParams | undefined>>[]> = {}\n static readonly globalInstancesCountHistory: Record<BaseClassName, number[]> = {}\n static readonly uniqueName = globallyUnique(this.name, this, 'xyo')\n private static _historyInterval = DEFAULT_HISTORY_INTERVAL\n private static _historyTime = DEFAULT_HISTORY_TIME\n private static _historyTimeout?: ReturnType<typeof setTimeout>\n private static _lastGC = 0\n private static _maxGcFrequency = MAX_GC_FREQUENCY\n private _params: TParams\n\n constructor(params: TParams) {\n this._params = params\n params?.logger?.debug(`Base constructed [${Object(this).name}]`)\n this.recordInstance()\n }\n\n static get historyInterval() {\n return this._historyInterval\n }\n\n static set historyInterval(value: number) {\n assertEx(value <= this.historyTime, () => `historyInterval [${value}] must be less than or equal to historyTime [${this.historyTime}]`)\n this._historyInterval = Math.max(value, MIN_HISTORY_INTERVAL)\n }\n\n static get historyTime() {\n return this._historyTime\n }\n\n static set historyTime(value: number) {\n assertEx(value >= this.historyInterval, () => `historyTime [${value}] must be greater than or equal to historyInterval [${this.historyInterval}]`)\n this._historyInterval = value\n }\n\n static get maxGcFrequency() {\n return this._maxGcFrequency\n }\n\n static set maxGcFrequency(value: number) {\n this._maxGcFrequency = Math.max(value, MIN_GC_FREQUENCY)\n }\n\n static get maxHistoryDepth() {\n return Math.floor(this.historyTime / this.historyInterval)\n }\n\n get logger() {\n return this.params?.logger ?? Base.defaultLogger\n }\n\n get params() {\n return this._params\n }\n\n static gc(force?: boolean): void\n static gc(className: string): void\n static gc(classNameOrForce: string | boolean = false): void {\n if (typeof classNameOrForce === 'string') {\n this.gcClass(classNameOrForce)\n } else {\n if (classNameOrForce || Date.now() - this._lastGC > this._maxGcFrequency) {\n this.gcAll()\n }\n }\n }\n\n static instanceCount(className: string): number {\n return this.globalInstances[className]?.length ?? 0\n }\n\n static instanceCounts(): Record<BaseClassName, number> {\n this.gc()\n const result: Record<BaseClassName, number> = {}\n for (const [className, instances] of Object.entries(this.globalInstances)) result[className] = instances.length\n return result\n }\n\n static startHistory(): void {\n if (this._historyTimeout) {\n this.stopHistory()\n }\n\n const timeoutHandler = () => {\n if (this._historyTimeout) {\n this.addToHistory()\n this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval)\n }\n }\n\n this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval)\n }\n\n static stopHistory(): void {\n if (this._historyTimeout) {\n clearTimeout(this._historyTimeout)\n this._historyTimeout = undefined\n }\n }\n\n private static addToHistory() {\n const counts = this.instanceCounts()\n for (const className of Object.keys(this.globalInstances)) {\n this.globalInstancesCountHistory[className] = this.globalInstancesCountHistory[className]?.slice(-this.maxHistoryDepth) ?? []\n this.globalInstancesCountHistory[className].push(counts[className])\n }\n }\n\n private static gcAll() {\n for (const className of Object.keys(this.globalInstances)) {\n this.gcClass(className)\n }\n }\n\n private static gcClass(className: BaseClassName) {\n // remove all the weak refs that are now empty\n this.globalInstances[className] = this.globalInstances[className]?.filter(ref => ref.deref() !== null) ?? []\n }\n\n private recordInstance() {\n const instanceArray = Base.globalInstances[this.constructor.name] ?? []\n instanceArray.push(new WeakRef(this))\n Base.globalInstances[this.constructor.name] = instanceArray\n }\n}\n","interface XylabsGlobalThis {\n xylabs: {\n unique: Record<string, unknown>\n uniqueDisabled?: boolean\n }\n}\n\nconst xyoGlobal = () => {\n return ((globalThis as unknown as XylabsGlobalThis).xylabs = (globalThis as unknown as XylabsGlobalThis).xylabs ?? {})\n}\n\nexport const disableGloballyUnique = () => {\n xyoGlobal().uniqueDisabled = true\n}\n\nexport const globallyUnique = (name: string, value: unknown, domain = 'global') => {\n const uniqueName = [domain, name].join(':')\n if (!xyoGlobal().uniqueDisabled) {\n const xyo = ((globalThis as unknown as XylabsGlobalThis).xylabs = (globalThis as unknown as XylabsGlobalThis).xylabs ?? {})\n const unique = (xyo.unique = xyo.unique ?? {})\n if (unique[uniqueName] === undefined) {\n unique[uniqueName] = value\n } else {\n if (unique[uniqueName] !== value) {\n throw new Error(\n `Global unique item ${uniqueName} already defined. Make sure you are not importing two versions of the package that contains this item`,\n )\n }\n }\n }\n return uniqueName\n}\n","/**\n * Transforms a given record object into a readonly \"enum-like\" structure while preserving\n * the literal types of its values. This allows you to use the returned object both at runtime\n * (for lookups) and at compile time (for strongly typed values).\n *\n * To maintain literal types (i.e., prevent them from being widened to `string`, `number`, etc.),\n * ensure you annotate your object with `as const` before passing it to `Enum`.\n *\n * @template T - A record type with string keys and any kind of values.\n * @param obj - A readonly record object annotated with `as const`.\n * @returns A readonly version of the provided record, preserving exact literal value types.\n *\n * @example\n * ```typescript\n * // Defining a record with literal types using as const:\n * const DnsRecordType = Enum({\n * A: 1,\n * AAAA: 28,\n * CAA: 257,\n * CNAME: 5,\n * DNAME: 39,\n * MX: 15,\n * NS: 2,\n * PTR: 12,\n * SOA: 6,\n * SPF: 99,\n * SRV: 33,\n * TXT: 16,\n * } as const);\n *\n * // DnsRecordType is now a readonly object:\n * // {\n * // readonly A: 1;\n * // readonly AAAA: 28;\n * // readonly CAA: 257;\n * // readonly CNAME: 5;\n * // readonly DNAME: 39;\n * // readonly MX: 15;\n * // readonly NS: 2;\n * // readonly PTR: 12;\n * // readonly SOA: 6;\n * // readonly SPF: 99;\n * // readonly SRV: 33;\n * // readonly TXT: 16;\n * // }\n * ```\n */\nexport const Enum = <const T extends Record<string | number | symbol, unknown>>(obj: Readonly<T>): Enum<T> => {\n return obj\n}\n\n/**\n * A utility type that, given a `Record<string, unknown>`, returns a readonly version\n * of that record. This results in a type where all properties of `T` are readonly.\n *\n * @template T - The record type to make readonly.\n *\n * @example\n * ```typescript\n * // Given a record:\n * export const DnsRecordType = Enum({\n * A: 1,\n * AAAA: 28,\n * CAA: 257,\n * CNAME: 5,\n * DNAME: 39,\n * MX: 15,\n * NS: 2,\n * PTR: 12,\n * SOA: 6,\n * SPF: 99,\n * SRV: 33,\n * TXT: 16,\n * })\n *\n * // Now the type inference will preserve the literal types:\n * export type DnsRecordType = Enum<typeof DnsRecordType>\n * ```\n */\nexport type Enum<T extends Readonly<Record<string | number | symbol, unknown>>> = {\n readonly [K in keyof T]: T[K]\n}\n\n/**\n * A utility type that, given an `Enum` object, returns the union of its values.\n */\nexport type EnumValue<T extends Record<string | number | symbol, unknown>, K = Enum<T>> = K[keyof K]\n","import type { ObjectTypeShape, TypedObject } from '@xylabs/typeof'\n\nimport type { TypeCheck, TypeCheckConfig } from './AsTypeFactory.ts'\nimport { isType } from './isType.ts'\n\nexport interface ObjectTypeConfig extends TypeCheckConfig {}\n\nexport class IsObjectFactory<T extends TypedObject> {\n create(shape?: ObjectTypeShape, additionalChecks?: TypeCheck<TypedObject>[]): TypeCheck<T> {\n return (obj, { log } = {}): obj is T => {\n if (!obj || typeof obj !== 'object') {\n return false\n }\n return (\n // do primary check\n Object.entries(shape ?? {}).filter(([key, type]) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result = isType((obj as any)[key], type)\n if (!result && log) {\n const logger = typeof log === 'object' ? log : console\n logger.warn(`isType Failed: ${key}: ${type}`)\n }\n return !result\n }).length === 0\n // perform additional checks\n && (additionalChecks?.reduce((prev, check) => prev && check(obj, { log }), true) ?? true)\n )\n }\n }\n}\n","import { isObject } from './isObject.ts'\n\nexport type JsonValue = string | number | boolean | null | JsonObject | JsonArray\nexport type JsonObject = { [key: string]: JsonValue }\nexport type JsonArray = JsonValue[]\n\nexport const isJsonValue = (value: unknown): value is JsonValue => {\n switch (typeof value) {\n case 'string':\n case 'number':\n case 'boolean': {\n return true\n }\n default: {\n return value === null || isJsonObject(value) || isJsonArray(value)\n }\n }\n}\n\nexport const isJsonArray = (value: unknown): value is JsonArray => {\n return Array.isArray(value) && !value.some(item => !isJsonValue(item))\n}\n\nexport const isValidJsonFieldPair = ([key, value]: [key: unknown, value: unknown]) => {\n return typeof key === 'string' && isJsonValue(value)\n}\n\nexport const isJsonObject = (value: unknown): value is JsonObject => {\n return (\n isObject(value)\n // check if all keys are strings\n && !Object.entries(value).some(item => !isValidJsonFieldPair(item))\n )\n}\n","import type { EmptyObject } from './EmptyObject.ts'\nimport type { StringKeyObject } from './StringKeyObject.ts'\n\nexport abstract class ObjectWrapper<T extends EmptyObject = EmptyObject> {\n readonly obj: T\n constructor(obj: T) {\n this.obj = obj\n }\n\n protected get stringKeyObj() {\n return this.obj as StringKeyObject\n }\n}\n","import { assertEx } from '@xylabs/assert'\n\nimport type { EmptyObject } from './EmptyObject.ts'\nimport type { JsonObject } from './JsonObject.ts'\nimport type { DeepOmitStartsWith } from './OmitStartsWith.ts'\n\nexport type OmitByPredicate<T extends EmptyObject = Record<string, unknown>> = (value: T[keyof T], key: keyof T) => boolean\n\nconst omitByArray = <T>(\n obj: T[],\n predicate: OmitByPredicate,\n maxDepth: number,\n): T[] => {\n return obj.map((value) => {\n return (value !== null && typeof value === 'object') ? omitBy(value, predicate, maxDepth) : value\n }) as T[]\n}\n\nconst omitByObject = <T extends EmptyObject>(\n obj: T,\n predicate: OmitByPredicate,\n maxDepth: number,\n): Partial<T> => {\n const result: JsonObject = {}\n\n for (const key in obj) {\n if (Object.hasOwn(obj, key)) {\n const value = obj[key]\n if (!predicate(value, key)) {\n result[key] = ((value !== null && typeof value === 'object') ? omitBy(value, predicate, maxDepth - 1) : value) as JsonObject\n }\n }\n }\n\n return result as T\n}\n\nexport const omitBy = <T extends EmptyObject>(\n obj: T,\n predicate: OmitByPredicate,\n maxDepth = 1,\n): Partial<T> => {\n if (maxDepth <= 0) {\n return obj\n }\n\n return Array.isArray(obj) ? omitByArray(obj, predicate, maxDepth - 1) as T : omitByObject(obj, predicate, maxDepth - 1) as T\n}\n\nconst omitByPrefixPredicate = (prefix: string) => (_: unknown, key: string) => {\n assertEx(typeof key === 'string', () => `Invalid key type [${key}, ${typeof key}]`)\n return key.startsWith(prefix)\n}\n\nexport const omitByPrefix = <T extends EmptyObject, P extends string>(payload: T, prefix: P, maxDepth = 100): DeepOmitStartsWith<T, P> => {\n return omitBy(payload, omitByPrefixPredicate(prefix), maxDepth) as unknown as DeepOmitStartsWith<T, P>\n}\n","import { assertEx } from '@xylabs/assert'\n\nimport type { EmptyObject } from './EmptyObject.ts'\nimport type { JsonObject } from './JsonObject.ts'\nimport type { DeepPickStartsWith } from './PickStartsWith.ts'\n\nexport type PickByPredicate<T extends EmptyObject = Record<string, unknown>> = (value: T[keyof T], key: keyof T) => boolean\n\nconst pickByArray = <T>(\n obj: T[],\n predicate: PickByPredicate,\n maxDepth: number,\n): T[] => {\n return obj.map((value) => {\n return (value !== null && typeof value === 'object') ? pickBy(value, predicate, maxDepth) : value\n }) as T[]\n}\n\nconst pickByObject = <T extends EmptyObject>(\n obj: T,\n predicate: PickByPredicate,\n maxDepth: number,\n): Partial<T> => {\n const result: JsonObject = {}\n\n for (const key in obj) {\n if (Object.hasOwn(obj, key)) {\n const value = obj[key]\n if (predicate(value, key)) {\n result[key] = ((value !== null && typeof value === 'object') ? pickBy(value, predicate, maxDepth - 1) : value) as JsonObject\n }\n }\n }\n\n return result as T\n}\n\nexport const pickBy = <T extends EmptyObject>(\n obj: T,\n predicate: PickByPredicate,\n maxDepth = 1,\n): Partial<T> => {\n if (maxDepth <= 0) {\n return obj\n }\n\n return Array.isArray(obj) ? pickByArray(obj, predicate, maxDepth - 1) as T : pickByObject(obj, predicate, maxDepth - 1) as T\n}\n\nconst pickByPrefixPredicate = (prefix: string) => (_: unknown, key: string) => {\n assertEx(typeof key === 'string', () => `Invalid key type [${key}, ${typeof key}]`)\n return key.startsWith(prefix)\n}\n\nexport const pickByPrefix = <T extends EmptyObject, P extends string>(payload: T, prefix: P, maxDepth = 100): DeepPickStartsWith<T, P> => {\n return pickBy(payload, pickByPrefixPredicate(prefix), maxDepth) as unknown as DeepPickStartsWith<T, P>\n}\n","import type { EmptyObject } from './EmptyObject.ts'\n\nexport const removeFields = <T extends EmptyObject, K extends keyof T>(obj: T, fields: K[]): Omit<T, K> => {\n const clone = { ...obj }\n for (const field of fields) {\n delete clone[field]\n }\n return clone\n}\n","import type {\n JsonArray, JsonObject, JsonValue,\n} from './JsonObject.ts'\n\nexport const toJsonArray = (value: unknown[], cycleList?: unknown[], maxDepth = 3): JsonArray => {\n return value.map(item => toJsonValue(item, cycleList, maxDepth))\n}\n\nexport const toJsonObject = (value: object, cycleList?: unknown[], maxDepth = 3): JsonObject => {\n const result: JsonObject = {}\n for (const [key, entry] of Object.entries(value)) {\n result[key] = value === undefined ? '[Undefined]' : toJsonValue(entry, cycleList, maxDepth)\n }\n return result\n}\n\nexport const toJsonValue = (value: unknown, cycleList?: unknown[], maxDepth = 3): JsonValue => {\n if (maxDepth <= 0 && typeof value === 'object') {\n return '[MaxDepth]'\n }\n if (cycleList?.includes(value)) {\n return '[Circular]'\n }\n switch (typeof value) {\n case 'string':\n case 'boolean':\n case 'number': {\n return value\n }\n case 'object': {\n if (value === null) {\n return null\n }\n const newCycleList = cycleList ?? []\n newCycleList.push(value)\n return Array.isArray(value) ? toJsonArray(value, newCycleList, maxDepth - 1) : toJsonObject(value, newCycleList, maxDepth - 1)\n }\n default: {\n return `[${typeof value}]`\n }\n }\n}\n\nexport const toJsonString = (value: unknown, maxDepth = 3) => {\n return JSON.stringify(toJson(value, maxDepth), null, 2)\n}\n\nexport const toJson = (value: unknown, maxDepth = 3): JsonValue => {\n return toJsonValue(value, undefined, maxDepth)\n}\n","import type { Promisable } from '@xylabs/promise'\n\nimport type { AnyObject } from './AnyObject.ts'\nimport type { EmptyObject } from './EmptyObject.ts'\nimport { ObjectWrapper } from './ObjectWrapper.ts'\n\nexport interface Validator<T extends EmptyObject = AnyObject> {\n validate(payload: T): Promisable<Error[]>\n}\n\nexport abstract class ValidatorBase<T extends EmptyObject = AnyObject> extends ObjectWrapper<Partial<T>> implements Validator<T> {\n abstract validate(payload: T): Promisable<Error[]>\n}\n"],"mappings":";AACA,SAAS,gBAAgB;AAGzB,SAAS,iBAAiB;AAWnB,IAAM,gBAAgB;AAAA,EAC3B,QAAQ,CAA0B,cAA4B;AAG5D,aAAS,KACP,OACA,gBACA,QACmB;AACnB,UAAI,UAAU,QAAW;AACvB,eAAO;AAAA,MACT;AAEA,UAAI,UAAU,MAAM;AAClB,eAAO;AAAA,MACT;AAEA,UAAI,UAAU,KAAK,GAAG;AACpB,cAAM,IAAI,UAAU,uDAAuD;AAAA,MAC7E;AAEA,YAAM,iBAAkB,OAAO,mBAAmB,WAAW,SAAY;AACzE,YAAM,iBAAiB,OAAO,mBAAmB,WAAW,iBAAiB;AAC7E,YAAM,SAAS,UAAU,OAAO,cAAc,IAAK,QAAkB;AAErE,UAAI,gBAAgB;AAClB,YAAI,OAAO,mBAAmB,YAAY;AACxC,mBAAY,QAAQ,cAAc;AAAA,QACpC,OAAO;AACL,mBAAY,QAAQ,MAAM,cAAc;AAAA,QAC1C;AAAA,MACF;AACA,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AACF;;;AC9CO,IAAM,kBAAkB;AAAA,EAC7B,QAAQ,CAAwB,cAA4B;AAC1D,WAAO,cA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AAO;AAAA,IACT;AAAA,IACA,KAAK,UAAU;AACb,UAAI,UAAU,MAAM;AAClB,eAAO;AAAA,MACT;AACA,YAAM,eAAe,aAAa,CAAC;AACnC,mBAAa,KAAK,KAAK;AACvB,aAAO,MAAM,QAAQ,KAAK,IAAI,YAAY,OAAO,cAAc,WAAW,CAAC,IAAI,aAAa,OAAO,cAAc,WAAW,CAAC;AAAA,IAC/H;AAAA,IACA,SAAS;AACP,aAAO,IAAI,OAAO,KAAK;AAAA,IACzB;AAAA,EACF;AACF;AAEO,IAAM,eAAe,CAAC,OAAgB,WAAW,MAAM;AAC5D,SAAO,KAAK,UAAU,OAAO,OAAO,QAAQ,GAAG,MAAM,CAAC;AACxD;AAEO,IAAM,SAAS,CAAC,OAAgB,WAAW,MAAiB;AACjE,SAAO,YAAY,OAAO,QAAW,QAAQ;AAC/C;;;ACvCO,IAAe,gBAAf,cAAwE,cAAkD;AAEjI;","names":["assertEx","assertEx","assertEx","assertEx"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/object",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.23",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"module": "dist/neutral/index.mjs",
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xylabs/assert": "^4.4.
|
|
33
|
-
"@xylabs/logger": "^4.4.
|
|
34
|
-
"@xylabs/promise": "^4.4.
|
|
35
|
-
"@xylabs/typeof": "^4.4.
|
|
32
|
+
"@xylabs/assert": "^4.4.23",
|
|
33
|
+
"@xylabs/logger": "^4.4.23",
|
|
34
|
+
"@xylabs/promise": "^4.4.23",
|
|
35
|
+
"@xylabs/typeof": "^4.4.23"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@xylabs/ts-scripts-yarn3": "^4.2.4",
|
package/src/Enum.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transforms a given record object into a readonly "enum-like" structure while preserving
|
|
3
|
+
* the literal types of its values. This allows you to use the returned object both at runtime
|
|
4
|
+
* (for lookups) and at compile time (for strongly typed values).
|
|
5
|
+
*
|
|
6
|
+
* To maintain literal types (i.e., prevent them from being widened to `string`, `number`, etc.),
|
|
7
|
+
* ensure you annotate your object with `as const` before passing it to `Enum`.
|
|
8
|
+
*
|
|
9
|
+
* @template T - A record type with string keys and any kind of values.
|
|
10
|
+
* @param obj - A readonly record object annotated with `as const`.
|
|
11
|
+
* @returns A readonly version of the provided record, preserving exact literal value types.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Defining a record with literal types using as const:
|
|
16
|
+
* const DnsRecordType = Enum({
|
|
17
|
+
* A: 1,
|
|
18
|
+
* AAAA: 28,
|
|
19
|
+
* CAA: 257,
|
|
20
|
+
* CNAME: 5,
|
|
21
|
+
* DNAME: 39,
|
|
22
|
+
* MX: 15,
|
|
23
|
+
* NS: 2,
|
|
24
|
+
* PTR: 12,
|
|
25
|
+
* SOA: 6,
|
|
26
|
+
* SPF: 99,
|
|
27
|
+
* SRV: 33,
|
|
28
|
+
* TXT: 16,
|
|
29
|
+
* } as const);
|
|
30
|
+
*
|
|
31
|
+
* // DnsRecordType is now a readonly object:
|
|
32
|
+
* // {
|
|
33
|
+
* // readonly A: 1;
|
|
34
|
+
* // readonly AAAA: 28;
|
|
35
|
+
* // readonly CAA: 257;
|
|
36
|
+
* // readonly CNAME: 5;
|
|
37
|
+
* // readonly DNAME: 39;
|
|
38
|
+
* // readonly MX: 15;
|
|
39
|
+
* // readonly NS: 2;
|
|
40
|
+
* // readonly PTR: 12;
|
|
41
|
+
* // readonly SOA: 6;
|
|
42
|
+
* // readonly SPF: 99;
|
|
43
|
+
* // readonly SRV: 33;
|
|
44
|
+
* // readonly TXT: 16;
|
|
45
|
+
* // }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export const Enum = <const T extends Record<string | number | symbol, unknown>>(obj: Readonly<T>): Enum<T> => {
|
|
49
|
+
return obj
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A utility type that, given a `Record<string, unknown>`, returns a readonly version
|
|
54
|
+
* of that record. This results in a type where all properties of `T` are readonly.
|
|
55
|
+
*
|
|
56
|
+
* @template T - The record type to make readonly.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* // Given a record:
|
|
61
|
+
* export const DnsRecordType = Enum({
|
|
62
|
+
* A: 1,
|
|
63
|
+
* AAAA: 28,
|
|
64
|
+
* CAA: 257,
|
|
65
|
+
* CNAME: 5,
|
|
66
|
+
* DNAME: 39,
|
|
67
|
+
* MX: 15,
|
|
68
|
+
* NS: 2,
|
|
69
|
+
* PTR: 12,
|
|
70
|
+
* SOA: 6,
|
|
71
|
+
* SPF: 99,
|
|
72
|
+
* SRV: 33,
|
|
73
|
+
* TXT: 16,
|
|
74
|
+
* })
|
|
75
|
+
*
|
|
76
|
+
* // Now the type inference will preserve the literal types:
|
|
77
|
+
* export type DnsRecordType = Enum<typeof DnsRecordType>
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export type Enum<T extends Readonly<Record<string | number | symbol, unknown>>> = {
|
|
81
|
+
readonly [K in keyof T]: T[K]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* A utility type that, given an `Enum` object, returns the union of its values.
|
|
86
|
+
*/
|
|
87
|
+
export type EnumValue<T extends Record<string | number | symbol, unknown>, K = Enum<T>> = K[keyof K]
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './AsObjectFactory.ts'
|
|
|
4
4
|
export * from './AsTypeFactory.ts'
|
|
5
5
|
export * from './Base.ts'
|
|
6
6
|
export * from './EmptyObject.ts'
|
|
7
|
+
export * from './Enum.ts'
|
|
7
8
|
export * from './globallyUnique.ts'
|
|
8
9
|
export * from './isObject.ts'
|
|
9
10
|
export * from './IsObjectFactory.ts'
|