@xylabs/object
Advanced tools
Comparing version 3.6.12 to 4.0.0
@@ -1,20 +0,130 @@ | ||
export * from './AnyObject.ts'; | ||
export * from './asObject.ts'; | ||
export * from './AsObjectFactory.ts'; | ||
export * from './AsTypeFactory.ts'; | ||
export * from './Base.ts'; | ||
export * from './EmptyObject.ts'; | ||
export * from './globallyUnique.ts'; | ||
export * from './isObject.ts'; | ||
export * from './IsObjectFactory.ts'; | ||
export * from './isType.ts'; | ||
export * from './JsonObject.ts'; | ||
export * from './ObjectWrapper.ts'; | ||
export * from './Override.ts'; | ||
export * from './PartialRecord.ts'; | ||
export * from './removeFields.ts'; | ||
export * from './StringKeyObject.ts'; | ||
export * from './toJson.ts'; | ||
export * from './Validator.ts'; | ||
export * from './WithAdditional.ts'; | ||
//# sourceMappingURL=index.d.ts.map | ||
import * as _xylabs_promise from '@xylabs/promise'; | ||
import { TypedKey, AnyNonPromise, TypedValue, TypedObject, Promisable } from '@xylabs/promise'; | ||
import { AssertExMessageFunc } from '@xylabs/assert'; | ||
import { Logger } from '@xylabs/logger'; | ||
type AnyObject = Record<TypedKey, unknown>; | ||
interface TypeCheckConfig { | ||
log?: boolean | Logger; | ||
} | ||
type StringOrAlertFunction<T extends AnyNonPromise> = string | AssertExMessageFunc<T>; | ||
type TypeCheck<T extends TypedValue> = (obj: AnyNonPromise, config?: TypeCheckConfig) => obj is T; | ||
declare const AsTypeFactory: { | ||
create: <T extends AnyNonPromise>(typeCheck: TypeCheck<T>) => { | ||
<TType extends T>(value: AnyNonPromise, config?: TypeCheckConfig): TType | undefined; | ||
<TType extends T>(value: AnyNonPromise, assert: StringOrAlertFunction<T>, config?: TypeCheckConfig): TType; | ||
}; | ||
}; | ||
declare const asAnyObject: { | ||
<TType extends AnyObject>(value: _xylabs_promise.AnyNonPromise, config?: TypeCheckConfig): TType | undefined; | ||
<TType extends AnyObject>(value: _xylabs_promise.AnyNonPromise, assert: StringOrAlertFunction<AnyObject>, config?: TypeCheckConfig): TType; | ||
}; | ||
declare const AsObjectFactory: { | ||
create: <T extends TypedObject>(typeCheck: TypeCheck<T>) => { | ||
<TType extends T>(value: _xylabs_promise.AnyNonPromise, config?: TypeCheckConfig): TType | undefined; | ||
<TType extends T>(value: _xylabs_promise.AnyNonPromise, assert: StringOrAlertFunction<T>, config?: TypeCheckConfig): TType; | ||
}; | ||
}; | ||
type EmptyObject<T extends object = object> = { | ||
[K in keyof T]?: never; | ||
}; | ||
type EmptyObjectOf<T extends object> = EmptyObject<T> extends T ? EmptyObject<T> : never; | ||
type BaseClassName = Exclude<string, 'base-class-name-reserved-32546239486'>; | ||
type BaseParamsFields = { | ||
logger?: Logger; | ||
}; | ||
type BaseParams<TAdditionalParams extends EmptyObject | void = void> = TAdditionalParams extends EmptyObject ? BaseParamsFields & TAdditionalParams : BaseParamsFields; | ||
declare abstract class Base<TParams extends BaseParams | undefined = BaseParams> { | ||
static defaultLogger?: Logger; | ||
static readonly globalInstances: Record<BaseClassName, WeakRef<Base<BaseParams | undefined>>[]>; | ||
static readonly globalInstancesCountHistory: Record<BaseClassName, number[]>; | ||
static readonly uniqueName: string; | ||
private static _historyInterval; | ||
private static _historyTime; | ||
private static _historyTimeout?; | ||
private static _lastGC; | ||
private static _maxGcFrequency; | ||
private _params; | ||
constructor(params: TParams); | ||
static get historyInterval(): number; | ||
static set historyInterval(value: number); | ||
static get historyTime(): number; | ||
static set historyTime(value: number); | ||
static get maxGcFrequency(): number; | ||
static set maxGcFrequency(value: number); | ||
static get maxHistoryDepth(): number; | ||
get logger(): Logger | undefined; | ||
get params(): TParams; | ||
static gc(force?: boolean): void; | ||
static gc(className: string): void; | ||
static instanceCount(className: string): number; | ||
static instanceCounts(): Record<BaseClassName, number>; | ||
static startHistory(): void; | ||
static stopHistory(): void; | ||
private static addToHistory; | ||
private static gcAll; | ||
private static gcClass; | ||
private recordInstance; | ||
} | ||
declare const disableGloballyUnique: () => void; | ||
declare const globallyUnique: (name: string, value: unknown, domain?: string) => string; | ||
declare const isObject: (value: unknown) => value is AnyObject; | ||
type FieldType = 'string' | 'number' | 'object' | 'symbol' | 'symbol' | 'undefined' | 'null' | 'array' | 'function'; | ||
type ObjectTypeShape = Record<string | number | symbol, FieldType>; | ||
declare const isType: (value: unknown, expectedType: FieldType) => boolean; | ||
interface ObjectTypeConfig extends TypeCheckConfig { | ||
} | ||
declare class IsObjectFactory<T extends TypedObject> { | ||
create(shape?: ObjectTypeShape, additionalChecks?: TypeCheck<TypedObject>[]): TypeCheck<T>; | ||
} | ||
type JsonValue = string | number | boolean | null | JsonObject | JsonArray; | ||
type JsonObject = { | ||
[key: string]: JsonValue; | ||
}; | ||
type JsonArray = JsonValue[]; | ||
declare const isJsonValue: (value: unknown) => value is JsonValue; | ||
declare const isJsonArray: (value: unknown) => value is JsonArray; | ||
declare const isValidJsonFieldPair: ([key, value]: [key: unknown, value: unknown]) => boolean; | ||
declare const isJsonObject: (value: unknown) => value is JsonObject; | ||
type StringKeyObject = { | ||
[key: string]: unknown; | ||
}; | ||
declare abstract class ObjectWrapper<T extends EmptyObject = EmptyObject> { | ||
readonly obj: T; | ||
constructor(obj: T); | ||
protected get stringKeyObj(): StringKeyObject; | ||
} | ||
type Override<T1, T2> = Omit<T1, keyof T2> & T2; | ||
type PartialRecord<K extends keyof any, T> = { | ||
[P in K]?: T; | ||
}; | ||
declare const removeFields: <T extends EmptyObject, K extends keyof T>(obj: T, fields: K[]) => Omit<T, K>; | ||
declare const toJsonString: (value: unknown, maxDepth?: number) => string; | ||
declare const toJson: (value: unknown, maxDepth?: number) => JsonValue; | ||
interface Validator<T extends EmptyObject = AnyObject> { | ||
validate(payload: T): Promisable<Error[]>; | ||
} | ||
declare abstract class ValidatorBase<T extends EmptyObject = AnyObject> extends ObjectWrapper<Partial<T>> implements Validator<T> { | ||
abstract validate(payload: T): Promisable<Error[]>; | ||
} | ||
type WithAdditional<T extends EmptyObject | void, TAdditional extends EmptyObject | void = void> = TAdditional extends EmptyObject ? T & TAdditional : T; | ||
export { type AnyObject, AsObjectFactory, AsTypeFactory, Base, type BaseClassName, type BaseParams, type BaseParamsFields, type EmptyObject, type EmptyObjectOf, type FieldType, IsObjectFactory, type JsonArray, type JsonObject, type JsonValue, type ObjectTypeConfig, type ObjectTypeShape, ObjectWrapper, type Override, type PartialRecord, type StringKeyObject, type StringOrAlertFunction, type TypeCheck, type TypeCheckConfig, type Validator, ValidatorBase, type WithAdditional, asAnyObject, disableGloballyUnique, globallyUnique, isJsonArray, isJsonObject, isJsonValue, isObject, isType, isValidJsonFieldPair, removeFields, toJson, toJsonString }; |
@@ -14,9 +14,9 @@ { | ||
"dependencies": { | ||
"@xylabs/assert": "^3.6.12", | ||
"@xylabs/logger": "^3.6.12", | ||
"@xylabs/promise": "^3.6.12" | ||
"@xylabs/assert": "^4.0.0", | ||
"@xylabs/logger": "^4.0.0", | ||
"@xylabs/promise": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@xylabs/ts-scripts-yarn3": "^3.15.14", | ||
"@xylabs/tsconfig": "^3.15.14", | ||
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15", | ||
"@xylabs/tsconfig": "^4.0.0-rc.15", | ||
"typescript": "^5.5.4" | ||
@@ -26,28 +26,9 @@ }, | ||
".": { | ||
"browser": { | ||
"require": { | ||
"types": "./dist/browser/index.d.cts", | ||
"default": "./dist/browser/index.cjs" | ||
}, | ||
"import": { | ||
"types": "./dist/browser/index.d.ts", | ||
"default": "./dist/browser/index.mjs" | ||
} | ||
}, | ||
"node": { | ||
"require": { | ||
"types": "./dist/node/index.d.cts", | ||
"default": "./dist/node/index.cjs" | ||
}, | ||
"import": { | ||
"types": "./dist/node/index.d.ts", | ||
"default": "./dist/node/index.mjs" | ||
} | ||
} | ||
"types": "./dist/neutral/index.d.ts", | ||
"default": "./dist/neutral/index.mjs" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"main": "dist/node/index.cjs", | ||
"module": "dist/node/index.mjs", | ||
"types": "dist/node/index.d.ts", | ||
"module": "dist/neutral/index.mjs", | ||
"types": "dist/neutral/index.d.ts", | ||
"homepage": "https://xyo.network", | ||
@@ -63,4 +44,4 @@ "license": "LGPL-3.0-or-later", | ||
"sideEffects": false, | ||
"version": "3.6.12", | ||
"version": "4.0.0", | ||
"type": "module" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
98458
28
857
1
+ Added@xylabs/assert@4.3.4(transitive)
+ Added@xylabs/error@4.3.4(transitive)
+ Added@xylabs/logger@4.3.4(transitive)
+ Added@xylabs/promise@4.3.4(transitive)
- Removed@xylabs/assert@3.6.12(transitive)
- Removed@xylabs/error@3.6.12(transitive)
- Removed@xylabs/logger@3.6.12(transitive)
- Removed@xylabs/promise@3.6.12(transitive)
Updated@xylabs/assert@^4.0.0
Updated@xylabs/logger@^4.0.0
Updated@xylabs/promise@^4.0.0