@jfdevelops/multi-step-form-core 1.0.0-alpha.17 → 1.0.0-alpha.18
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/_internals.cjs +14 -0
- package/dist/_internals.d.cts +4 -0
- package/dist/_internals.d.mts +4 -0
- package/dist/_internals.mjs +5 -0
- package/dist/index.cjs +49 -0
- package/dist/index.d.cts +14 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.mjs +16 -0
- package/dist/internals/step-schema.cjs +389 -0
- package/dist/internals/step-schema.cjs.map +1 -0
- package/dist/internals/step-schema.d.cts +41 -0
- package/dist/internals/step-schema.d.cts.map +1 -0
- package/dist/internals/step-schema.d.mts +41 -0
- package/dist/internals/step-schema.d.mts.map +1 -0
- package/dist/internals/step-schema.mjs +389 -0
- package/dist/internals/step-schema.mjs.map +1 -0
- package/dist/internals/utils.cjs +94 -0
- package/dist/internals/utils.cjs.map +1 -0
- package/dist/internals/utils.d.cts +27 -0
- package/dist/internals/utils.d.cts.map +1 -0
- package/dist/internals/utils.d.mts +27 -0
- package/dist/internals/utils.d.mts.map +1 -0
- package/dist/internals/utils.mjs +91 -0
- package/dist/internals/utils.mjs.map +1 -0
- package/dist/observable.cjs +44 -0
- package/dist/observable.cjs.map +1 -0
- package/dist/observable.d.cts +26 -0
- package/dist/observable.d.cts.map +1 -0
- package/dist/observable.d.mts +26 -0
- package/dist/observable.d.mts.map +1 -0
- package/dist/observable.mjs +44 -0
- package/dist/observable.mjs.map +1 -0
- package/dist/schema.cjs +68 -0
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.cts +28 -0
- package/dist/schema.d.cts.map +1 -0
- package/dist/schema.d.mts +28 -0
- package/dist/schema.d.mts.map +1 -0
- package/dist/schema.mjs +67 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/steps/fields.cjs +23 -0
- package/dist/steps/fields.cjs.map +1 -0
- package/dist/steps/fields.d.cts +18 -0
- package/dist/steps/fields.d.cts.map +1 -0
- package/dist/steps/fields.d.mts +18 -0
- package/dist/steps/fields.d.mts.map +1 -0
- package/dist/steps/fields.mjs +18 -0
- package/dist/steps/fields.mjs.map +1 -0
- package/dist/steps/index.cjs +4 -0
- package/dist/steps/index.mjs +6 -0
- package/dist/steps/schema.cjs +194 -0
- package/dist/steps/schema.cjs.map +1 -0
- package/dist/steps/schema.d.cts +124 -0
- package/dist/steps/schema.d.cts.map +1 -0
- package/dist/steps/schema.d.mts +124 -0
- package/dist/steps/schema.d.mts.map +1 -0
- package/dist/steps/schema.mjs +194 -0
- package/dist/steps/schema.mjs.map +1 -0
- package/dist/steps/types.cjs +33 -0
- package/dist/steps/types.cjs.map +1 -0
- package/dist/steps/types.d.cts +332 -0
- package/dist/steps/types.d.cts.map +1 -0
- package/dist/steps/types.d.mts +332 -0
- package/dist/steps/types.d.mts.map +1 -0
- package/dist/steps/types.mjs +27 -0
- package/dist/steps/types.mjs.map +1 -0
- package/dist/steps/utils.cjs +96 -0
- package/dist/steps/utils.cjs.map +1 -0
- package/dist/steps/utils.d.cts +10 -0
- package/dist/steps/utils.d.cts.map +1 -0
- package/dist/steps/utils.d.mts +10 -0
- package/dist/steps/utils.d.mts.map +1 -0
- package/dist/steps/utils.mjs +94 -0
- package/dist/steps/utils.mjs.map +1 -0
- package/dist/storage.cjs +68 -0
- package/dist/storage.cjs.map +1 -0
- package/dist/storage.d.cts +33 -0
- package/dist/storage.d.cts.map +1 -0
- package/dist/storage.d.mts +33 -0
- package/dist/storage.d.mts.map +1 -0
- package/dist/storage.mjs +67 -0
- package/dist/storage.mjs.map +1 -0
- package/dist/subscribable.cjs +25 -0
- package/dist/subscribable.cjs.map +1 -0
- package/dist/subscribable.d.cts +14 -0
- package/dist/subscribable.d.cts.map +1 -0
- package/dist/subscribable.d.mts +14 -0
- package/dist/subscribable.d.mts.map +1 -0
- package/dist/subscribable.mjs +24 -0
- package/dist/subscribable.mjs.map +1 -0
- package/dist/utils/casing.cjs +63 -0
- package/dist/utils/casing.cjs.map +1 -0
- package/dist/utils/casing.d.cts +40 -0
- package/dist/utils/casing.d.cts.map +1 -0
- package/dist/utils/casing.d.mts +40 -0
- package/dist/utils/casing.d.mts.map +1 -0
- package/dist/utils/casing.mjs +57 -0
- package/dist/utils/casing.mjs.map +1 -0
- package/dist/utils/field-types.cjs +23 -0
- package/dist/utils/field-types.cjs.map +1 -0
- package/dist/utils/field-types.d.cts +11 -0
- package/dist/utils/field-types.d.cts.map +1 -0
- package/dist/utils/field-types.d.mts +11 -0
- package/dist/utils/field-types.d.mts.map +1 -0
- package/dist/utils/field-types.mjs +20 -0
- package/dist/utils/field-types.mjs.map +1 -0
- package/dist/utils/helpers.cjs +30 -0
- package/dist/utils/helpers.cjs.map +1 -0
- package/dist/utils/helpers.mjs +27 -0
- package/dist/utils/helpers.mjs.map +1 -0
- package/dist/utils/invariant.cjs +18 -0
- package/dist/utils/invariant.cjs.map +1 -0
- package/dist/utils/invariant.d.cts +5 -0
- package/dist/utils/invariant.d.cts.map +1 -0
- package/dist/utils/invariant.d.mts +5 -0
- package/dist/utils/invariant.d.mts.map +1 -0
- package/dist/utils/invariant.mjs +17 -0
- package/dist/utils/invariant.mjs.map +1 -0
- package/dist/utils/logger.cjs +58 -0
- package/dist/utils/logger.cjs.map +1 -0
- package/dist/utils/logger.d.cts +53 -0
- package/dist/utils/logger.d.cts.map +1 -0
- package/dist/utils/logger.d.mts +53 -0
- package/dist/utils/logger.d.mts.map +1 -0
- package/dist/utils/logger.mjs +56 -0
- package/dist/utils/logger.mjs.map +1 -0
- package/dist/utils/path.cjs +331 -0
- package/dist/utils/path.cjs.map +1 -0
- package/dist/utils/path.d.cts +139 -0
- package/dist/utils/path.d.cts.map +1 -0
- package/dist/utils/path.d.mts +139 -0
- package/dist/utils/path.d.mts.map +1 -0
- package/dist/utils/path.mjs +325 -0
- package/dist/utils/path.mjs.map +1 -0
- package/dist/utils/types.d.cts +25 -0
- package/dist/utils/types.d.cts.map +1 -0
- package/dist/utils/types.d.mts +25 -0
- package/dist/utils/types.d.mts.map +1 -0
- package/dist/utils/validator.cjs +12 -0
- package/dist/utils/validator.cjs.map +1 -0
- package/dist/utils/validator.d.cts +77 -0
- package/dist/utils/validator.d.cts.map +1 -0
- package/dist/utils/validator.d.mts +77 -0
- package/dist/utils/validator.d.mts.map +1 -0
- package/dist/utils/validator.mjs +11 -0
- package/dist/utils/validator.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/utils/logger.d.ts
|
|
2
|
+
type LogLevel = 'info' | 'warn' | 'error';
|
|
3
|
+
type MultiStepFormLoggerOptions = {
|
|
4
|
+
debug?: boolean;
|
|
5
|
+
prefix?: string | ((prefix: typeof DEFAULT_LOGGER_PREFIX) => string);
|
|
6
|
+
includeTimestamp?: boolean;
|
|
7
|
+
throwOnError?: boolean;
|
|
8
|
+
};
|
|
9
|
+
type WrapWithOptions = '[]' | '{}' | 'none';
|
|
10
|
+
type ReplacePrefixOptions = {
|
|
11
|
+
action: 'replace';
|
|
12
|
+
value: string;
|
|
13
|
+
wrapWith?: WrapWithOptions;
|
|
14
|
+
};
|
|
15
|
+
type AppendOrPrependPrefixOptions = {
|
|
16
|
+
action: 'append' | 'prepend';
|
|
17
|
+
value: string;
|
|
18
|
+
delimiter?: string;
|
|
19
|
+
wrapWith?: {
|
|
20
|
+
originalPrefix?: WrapWithOptions;
|
|
21
|
+
addedPrefix?: WrapWithOptions;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
type PrefixOptions = ReplacePrefixOptions | AppendOrPrependPrefixOptions;
|
|
25
|
+
type BaseLogOptions = {
|
|
26
|
+
prefix?: PrefixOptions;
|
|
27
|
+
logLevelOptions?: {
|
|
28
|
+
level?: LogLevel;
|
|
29
|
+
wrapWith?: WrapWithOptions;
|
|
30
|
+
};
|
|
31
|
+
includeTimestamp?: boolean;
|
|
32
|
+
};
|
|
33
|
+
type ErrorLogOptions = BaseLogOptions & {
|
|
34
|
+
throw?: boolean;
|
|
35
|
+
};
|
|
36
|
+
declare const DEFAULT_LOGGER_PREFIX = "MultiStepFormSchema";
|
|
37
|
+
declare class MultiStepFormLogger {
|
|
38
|
+
private readonly debug;
|
|
39
|
+
private readonly prefix;
|
|
40
|
+
private readonly includeTimestamp;
|
|
41
|
+
private readonly throwOnError;
|
|
42
|
+
constructor(options?: MultiStepFormLoggerOptions);
|
|
43
|
+
private wrapValue;
|
|
44
|
+
private formatPrefix;
|
|
45
|
+
private formatMessage;
|
|
46
|
+
info(message: string, options?: BaseLogOptions): void;
|
|
47
|
+
warn(message: string, options?: BaseLogOptions): void;
|
|
48
|
+
error(message: string, options?: BaseLogOptions): void;
|
|
49
|
+
error(message: string, options?: ErrorLogOptions): never;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { DEFAULT_LOGGER_PREFIX, MultiStepFormLogger };
|
|
53
|
+
//# sourceMappingURL=logger.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.cts","names":[],"sources":["../../src/utils/logger.ts"],"sourcesContent":[],"mappings":";KAAK,QAAA;KACA,0BAAA,GADQ;EACR,KAAA,CAAA,EAAA,OAAA;EAOA,MAAA,CAAA,EAAA,MAAA,GAAe,CAAA,CAAA,MAAA,EAAA,OALiB,qBAKjB,EAAA,GAAA,MAAA,CAAA;EACf,gBAAA,CAAA,EAAA,OAAoB;EAKpB,YAAA,CAAA,EAAA,OAAA;AAM4B,CAAA;AAGuC,KAfnE,eAAA,GAgBc,IAAA,GAAA,IAAA,GAAA,MAAA;KAfd,oBAAA,GAgBM;EAEC,MAAA,EAAA,SAAA;EACG,KAAA,EAAA,MAAA;EAAe,QAAA,CAAA,EAhBjB,eAgBiB;AAAA,CAAA;AAQ9B,KAtBK,4BAAA,GAsB6B;EACrB,MAAA,EAAA,QAAA,GAAA,SAAmB;EAMR,KAAA,EAAA,MAAA;EAgGU,SAAA,CAAA,EAAA,MAAA;EAQA,QAAA,CAAA,EAAA;IAQC,cAAA,CAAA,EAxId,eAwIc;IACA,WAAA,CAAA,EAxIjB,eAwIiB;EAAe,CAAA;;KArI7C,aAAA,GAAgB,uBAAuB;KACvC,cAAA;WACM;;YAEC;eACG;;;;KAIV,eAAA,GAAkB;;;cAIV,qBAAA;cACA,mBAAA;;;;;wBAMW;;;;kCAgGU;kCAQA;mCAQC;mCACA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/utils/logger.d.ts
|
|
2
|
+
type LogLevel = 'info' | 'warn' | 'error';
|
|
3
|
+
type MultiStepFormLoggerOptions = {
|
|
4
|
+
debug?: boolean;
|
|
5
|
+
prefix?: string | ((prefix: typeof DEFAULT_LOGGER_PREFIX) => string);
|
|
6
|
+
includeTimestamp?: boolean;
|
|
7
|
+
throwOnError?: boolean;
|
|
8
|
+
};
|
|
9
|
+
type WrapWithOptions = '[]' | '{}' | 'none';
|
|
10
|
+
type ReplacePrefixOptions = {
|
|
11
|
+
action: 'replace';
|
|
12
|
+
value: string;
|
|
13
|
+
wrapWith?: WrapWithOptions;
|
|
14
|
+
};
|
|
15
|
+
type AppendOrPrependPrefixOptions = {
|
|
16
|
+
action: 'append' | 'prepend';
|
|
17
|
+
value: string;
|
|
18
|
+
delimiter?: string;
|
|
19
|
+
wrapWith?: {
|
|
20
|
+
originalPrefix?: WrapWithOptions;
|
|
21
|
+
addedPrefix?: WrapWithOptions;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
type PrefixOptions = ReplacePrefixOptions | AppendOrPrependPrefixOptions;
|
|
25
|
+
type BaseLogOptions = {
|
|
26
|
+
prefix?: PrefixOptions;
|
|
27
|
+
logLevelOptions?: {
|
|
28
|
+
level?: LogLevel;
|
|
29
|
+
wrapWith?: WrapWithOptions;
|
|
30
|
+
};
|
|
31
|
+
includeTimestamp?: boolean;
|
|
32
|
+
};
|
|
33
|
+
type ErrorLogOptions = BaseLogOptions & {
|
|
34
|
+
throw?: boolean;
|
|
35
|
+
};
|
|
36
|
+
declare const DEFAULT_LOGGER_PREFIX = "MultiStepFormSchema";
|
|
37
|
+
declare class MultiStepFormLogger {
|
|
38
|
+
private readonly debug;
|
|
39
|
+
private readonly prefix;
|
|
40
|
+
private readonly includeTimestamp;
|
|
41
|
+
private readonly throwOnError;
|
|
42
|
+
constructor(options?: MultiStepFormLoggerOptions);
|
|
43
|
+
private wrapValue;
|
|
44
|
+
private formatPrefix;
|
|
45
|
+
private formatMessage;
|
|
46
|
+
info(message: string, options?: BaseLogOptions): void;
|
|
47
|
+
warn(message: string, options?: BaseLogOptions): void;
|
|
48
|
+
error(message: string, options?: BaseLogOptions): void;
|
|
49
|
+
error(message: string, options?: ErrorLogOptions): never;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { DEFAULT_LOGGER_PREFIX, MultiStepFormLogger };
|
|
53
|
+
//# sourceMappingURL=logger.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.mts","names":[],"sources":["../../src/utils/logger.ts"],"sourcesContent":[],"mappings":";KAAK,QAAA;KACA,0BAAA,GADQ;EACR,KAAA,CAAA,EAAA,OAAA;EAOA,MAAA,CAAA,EAAA,MAAA,GAAe,CAAA,CAAA,MAAA,EAAA,OALiB,qBAKjB,EAAA,GAAA,MAAA,CAAA;EACf,gBAAA,CAAA,EAAA,OAAoB;EAKpB,YAAA,CAAA,EAAA,OAAA;AAM4B,CAAA;AAGuC,KAfnE,eAAA,GAgBc,IAAA,GAAA,IAAA,GAAA,MAAA;KAfd,oBAAA,GAgBM;EAEC,MAAA,EAAA,SAAA;EACG,KAAA,EAAA,MAAA;EAAe,QAAA,CAAA,EAhBjB,eAgBiB;AAAA,CAAA;AAQ9B,KAtBK,4BAAA,GAsB6B;EACrB,MAAA,EAAA,QAAA,GAAA,SAAmB;EAMR,KAAA,EAAA,MAAA;EAgGU,SAAA,CAAA,EAAA,MAAA;EAQA,QAAA,CAAA,EAAA;IAQC,cAAA,CAAA,EAxId,eAwIc;IACA,WAAA,CAAA,EAxIjB,eAwIiB;EAAe,CAAA;;KArI7C,aAAA,GAAgB,uBAAuB;KACvC,cAAA;WACM;;YAEC;eACG;;;;KAIV,eAAA,GAAkB;;;cAIV,qBAAA;cACA,mBAAA;;;;;wBAMW;;;;kCAgGU;kCAQA;mCAQC;mCACA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/utils/logger.ts
|
|
2
|
+
const DEFAULT_LOGGER_PREFIX = "MultiStepFormSchema";
|
|
3
|
+
var MultiStepFormLogger = class {
|
|
4
|
+
debug;
|
|
5
|
+
prefix = DEFAULT_LOGGER_PREFIX;
|
|
6
|
+
includeTimestamp = false;
|
|
7
|
+
throwOnError = false;
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.debug = options?.debug ?? false;
|
|
10
|
+
if (this.debug && options?.debug) {
|
|
11
|
+
const { includeTimestamp = false, prefix = DEFAULT_LOGGER_PREFIX, throwOnError = false } = options;
|
|
12
|
+
this.includeTimestamp = includeTimestamp;
|
|
13
|
+
this.prefix = typeof prefix === "string" ? prefix : prefix(DEFAULT_LOGGER_PREFIX);
|
|
14
|
+
this.throwOnError = throwOnError;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
wrapValue(wrapWith, value) {
|
|
18
|
+
if (wrapWith === "[]") return `[${value}]`;
|
|
19
|
+
if (wrapWith === "{}") return `{${value}}`;
|
|
20
|
+
if (wrapWith === "none") return value;
|
|
21
|
+
throw new Error(`The first argument ${wrapWith} is not valid. Valid options include: "[]", "{}", and "none"`);
|
|
22
|
+
}
|
|
23
|
+
formatPrefix(options) {
|
|
24
|
+
if (!options) return this.prefix;
|
|
25
|
+
const { action, value, wrapWith } = options;
|
|
26
|
+
if (action === "replace") return this.wrapValue(wrapWith ?? "[]", value);
|
|
27
|
+
const { delimiter } = options;
|
|
28
|
+
if (action === "append") return `${this.wrapValue(wrapWith?.originalPrefix ?? "[]", this.prefix)}${delimiter}${this.wrapValue(wrapWith?.addedPrefix ?? "[]", value)}`.trim();
|
|
29
|
+
if (action === "prepend") return `${this.wrapValue(wrapWith?.addedPrefix ?? "[]", value)}${delimiter}${this.wrapValue(wrapWith?.originalPrefix ?? "[]", this.prefix)}`.trim();
|
|
30
|
+
return this.prefix;
|
|
31
|
+
}
|
|
32
|
+
formatMessage(level, message, options) {
|
|
33
|
+
const { includeTimestamp = this.includeTimestamp, prefix, logLevelOptions } = options ?? {};
|
|
34
|
+
const formattedMessage = `${this.formatPrefix(prefix)} ${this.wrapValue(logLevelOptions?.wrapWith ?? "[]", (logLevelOptions?.level ?? level).toUpperCase())} ${message}`;
|
|
35
|
+
if (includeTimestamp) return `[${(/* @__PURE__ */ new Date()).toISOString()}] ${formattedMessage}`;
|
|
36
|
+
return formattedMessage;
|
|
37
|
+
}
|
|
38
|
+
info(message, options) {
|
|
39
|
+
if (!this.debug) return;
|
|
40
|
+
console.info(this.formatMessage("info", message, options));
|
|
41
|
+
}
|
|
42
|
+
warn(message, options) {
|
|
43
|
+
if (!this.debug) return;
|
|
44
|
+
console.warn(this.formatMessage("warn", message, options));
|
|
45
|
+
}
|
|
46
|
+
error(message, options) {
|
|
47
|
+
if (!this.debug) return;
|
|
48
|
+
const formatted = this.formatMessage("error", message, options);
|
|
49
|
+
console.error(formatted);
|
|
50
|
+
if (options?.throw ?? this.throwOnError) throw new Error(formatted);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
export { DEFAULT_LOGGER_PREFIX, MultiStepFormLogger };
|
|
56
|
+
//# sourceMappingURL=logger.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.mjs","names":[],"sources":["../../src/utils/logger.ts"],"sourcesContent":["type LogLevel = 'info' | 'warn' | 'error';\ntype MultiStepFormLoggerOptions = {\n debug?: boolean;\n prefix?: string | ((prefix: typeof DEFAULT_LOGGER_PREFIX) => string);\n includeTimestamp?: boolean;\n throwOnError?: boolean;\n};\n\ntype WrapWithOptions = '[]' | '{}' | 'none';\ntype ReplacePrefixOptions = {\n action: 'replace';\n value: string;\n wrapWith?: WrapWithOptions;\n};\ntype AppendOrPrependPrefixOptions = {\n action: 'append' | 'prepend';\n value: string;\n delimiter?: string;\n wrapWith?: {\n originalPrefix?: WrapWithOptions;\n addedPrefix?: WrapWithOptions;\n };\n};\ntype PrefixOptions = ReplacePrefixOptions | AppendOrPrependPrefixOptions;\ntype BaseLogOptions = {\n prefix?: PrefixOptions;\n logLevelOptions?: {\n level?: LogLevel;\n wrapWith?: WrapWithOptions;\n };\n includeTimestamp?: boolean;\n};\ntype ErrorLogOptions = BaseLogOptions & {\n throw?: boolean;\n};\n\nexport const DEFAULT_LOGGER_PREFIX = 'MultiStepFormSchema';\nexport class MultiStepFormLogger {\n private readonly debug: boolean;\n private readonly prefix: string = DEFAULT_LOGGER_PREFIX;\n private readonly includeTimestamp: boolean = false;\n private readonly throwOnError: boolean = false;\n\n constructor(options?: MultiStepFormLoggerOptions) {\n this.debug = options?.debug ?? false;\n if (this.debug && options?.debug) {\n const {\n includeTimestamp = false,\n prefix = DEFAULT_LOGGER_PREFIX,\n throwOnError = false,\n } = options;\n\n this.includeTimestamp = includeTimestamp;\n this.prefix =\n typeof prefix === 'string' ? prefix : prefix(DEFAULT_LOGGER_PREFIX);\n this.throwOnError = throwOnError;\n }\n }\n\n private wrapValue(wrapWith: WrapWithOptions, value: string) {\n if (wrapWith === '[]') {\n return `[${value}]`;\n }\n\n if (wrapWith === '{}') {\n return `{${value}}`;\n }\n\n if (wrapWith === 'none') {\n return value;\n }\n\n throw new Error(\n `The first argument ${wrapWith} is not valid. Valid options include: \"[]\", \"{}\", and \"none\"`\n );\n }\n\n private formatPrefix(options: PrefixOptions | undefined) {\n if (!options) {\n return this.prefix;\n }\n\n const { action, value, wrapWith } = options;\n\n if (action === 'replace') {\n return this.wrapValue(wrapWith ?? '[]', value);\n }\n\n const { delimiter } = options;\n\n if (action === 'append') {\n return `${this.wrapValue(\n wrapWith?.originalPrefix ?? '[]',\n this.prefix\n )}${delimiter}${this.wrapValue(\n wrapWith?.addedPrefix ?? '[]',\n value\n )}`.trim();\n }\n\n if (action === 'prepend') {\n return `${this.wrapValue(\n wrapWith?.addedPrefix ?? '[]',\n value\n )}${delimiter}${this.wrapValue(\n wrapWith?.originalPrefix ?? '[]',\n this.prefix\n )}`.trim();\n }\n\n return this.prefix;\n }\n\n private formatMessage(\n level: LogLevel,\n message: string,\n options?: BaseLogOptions\n ) {\n const {\n includeTimestamp = this.includeTimestamp,\n prefix,\n logLevelOptions,\n } = options ?? {};\n const formattedPrefix = this.formatPrefix(prefix);\n const formattedLogLevel = this.wrapValue(\n logLevelOptions?.wrapWith ?? '[]',\n (logLevelOptions?.level ?? level).toUpperCase()\n );\n const formattedMessage = `${formattedPrefix} ${formattedLogLevel} ${message}`;\n\n if (includeTimestamp) {\n const timestamp = new Date().toISOString();\n\n return `[${timestamp}] ${formattedMessage}`;\n }\n\n return formattedMessage;\n }\n\n info(message: string, options?: BaseLogOptions) {\n if (!this.debug) {\n return;\n }\n\n console.info(this.formatMessage('info', message, options));\n }\n\n warn(message: string, options?: BaseLogOptions) {\n if (!this.debug) {\n return;\n }\n\n console.warn(this.formatMessage('warn', message, options));\n }\n\n error(message: string, options?: BaseLogOptions): void;\n error(message: string, options?: ErrorLogOptions): never;\n error(message: string, options?: ErrorLogOptions) {\n if (!this.debug) {\n return;\n }\n\n const formatted = this.formatMessage('error', message, options);\n\n console.error(formatted);\n\n const throwOnError = options?.throw ?? this.throwOnError;\n\n if (throwOnError) {\n throw new Error(formatted);\n }\n }\n}\n"],"mappings":";AAoCA,MAAa,wBAAwB;AACrC,IAAa,sBAAb,MAAiC;CAC/B,AAAiB;CACjB,AAAiB,SAAiB;CAClC,AAAiB,mBAA4B;CAC7C,AAAiB,eAAwB;CAEzC,YAAY,SAAsC;AAChD,OAAK,QAAQ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I,CAAC,KAAK,MACR;AAGF,UAAQ,KAAK,KAAK,cAAc,QAAQ,SAAS,QAAQ,CAAC;;CAG5D,KAAK,SAAiB,SAA0B;AAC9C,MAAI,CAAC,KAAK,MACR;AAGF,UAAQ,KAAK,KAAK,cAAc,QAAQ,SAAS,QAAQ,CAAC;;CAK5D,MAAM,SAAiB,SAA2B;AAChD,MAAI,CAAC,KAAK,MACR;EAGF,MAAM,YAAY,KAAK,cAAc,SAAS,SAAS,QAAQ;AAE/D,UAAQ,MAAM,UAAU;AAIxB,MAFqB,SAAS,SAAS,KAAK,aAG1C,OAAM,IAAI,MAAM,UAAU"}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/path.ts
|
|
3
|
+
let path;
|
|
4
|
+
(function(_path) {
|
|
5
|
+
function getBy(obj, path$1) {
|
|
6
|
+
return path$1.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
|
7
|
+
}
|
|
8
|
+
function setBy(target, path$1, value) {
|
|
9
|
+
const keys = path$1.split(".");
|
|
10
|
+
let current = target;
|
|
11
|
+
for (let i = 0; i < keys.length; i++) {
|
|
12
|
+
const k = keys[i];
|
|
13
|
+
if (i === keys.length - 1) if (current[k] !== void 0 && typeof current[k] === "object" && typeof value === "object" && value !== null) Object.assign(current[k], value);
|
|
14
|
+
else current[k] = value;
|
|
15
|
+
else {
|
|
16
|
+
if (typeof current[k] !== "object" || current[k] === null) current[k] = {};
|
|
17
|
+
current = current[k];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return current;
|
|
21
|
+
}
|
|
22
|
+
_path.setBy = setBy;
|
|
23
|
+
function normalizePaths(...paths) {
|
|
24
|
+
const sorted = [...paths].sort((a, b) => b.split(".").length - a.split(".").length);
|
|
25
|
+
const finalPaths = [];
|
|
26
|
+
for (const path$1 of sorted) if (!finalPaths.some((p) => p.startsWith(path$1 + "."))) finalPaths.push(path$1);
|
|
27
|
+
return finalPaths.reverse();
|
|
28
|
+
}
|
|
29
|
+
_path.normalizePaths = normalizePaths;
|
|
30
|
+
function pickBy(obj, ...paths) {
|
|
31
|
+
const norm = normalizePaths(...paths);
|
|
32
|
+
if (norm.length === 1) return getBy(obj, norm[0]);
|
|
33
|
+
const result = {};
|
|
34
|
+
for (const p of norm) setBy(result, p, getBy(obj, p));
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
_path.pickBy = pickBy;
|
|
38
|
+
function createDeep(obj) {
|
|
39
|
+
const paths = [];
|
|
40
|
+
function traverse(current, prefix = "") {
|
|
41
|
+
if (current === null || current === void 0) return;
|
|
42
|
+
if (typeof current !== "object" || Array.isArray(current)) return;
|
|
43
|
+
const keys = Object.keys(current);
|
|
44
|
+
for (const key of keys) {
|
|
45
|
+
const path$1 = prefix ? `${prefix}.${key}` : key;
|
|
46
|
+
paths.push(path$1);
|
|
47
|
+
const value = current[key];
|
|
48
|
+
if (value !== null && value !== void 0 && typeof value === "object" && !Array.isArray(value)) traverse(value, path$1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
traverse(obj);
|
|
52
|
+
return paths;
|
|
53
|
+
}
|
|
54
|
+
_path.createDeep = createDeep;
|
|
55
|
+
function defaultExpectedFormat(value) {
|
|
56
|
+
if (value === null) return "null";
|
|
57
|
+
if (Array.isArray(value)) return "Array";
|
|
58
|
+
const t = typeof value;
|
|
59
|
+
if (t !== "object") return t;
|
|
60
|
+
const ctor = value?.constructor?.name;
|
|
61
|
+
return ctor && ctor !== "Object" ? ctor : "object";
|
|
62
|
+
}
|
|
63
|
+
function splitPath(path$1) {
|
|
64
|
+
if (!path$1) return [];
|
|
65
|
+
const parts = [];
|
|
66
|
+
const regex = /[^.[\]]+|\[(\d+)\]/g;
|
|
67
|
+
let m;
|
|
68
|
+
while (m = regex.exec(path$1)) parts.push(m[1] ?? m[0]);
|
|
69
|
+
return parts;
|
|
70
|
+
}
|
|
71
|
+
function getTransformFunction(root, path$1) {
|
|
72
|
+
if (!root) return void 0;
|
|
73
|
+
if (typeof root === "function") return root;
|
|
74
|
+
const segments = splitPath(path$1);
|
|
75
|
+
let node = root;
|
|
76
|
+
let lastFn;
|
|
77
|
+
for (const seg of segments) {
|
|
78
|
+
if (!node) break;
|
|
79
|
+
if (typeof node === "function") {
|
|
80
|
+
lastFn = node;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
node = node[seg];
|
|
84
|
+
if (typeof node === "function") {
|
|
85
|
+
lastFn = node;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return lastFn;
|
|
90
|
+
}
|
|
91
|
+
function formatExpected(rawExpected, path$1, cfg) {
|
|
92
|
+
const fn = getTransformFunction(cfg, path$1);
|
|
93
|
+
if (fn) return fn(rawExpected, path$1);
|
|
94
|
+
return defaultExpectedFormat(rawExpected);
|
|
95
|
+
}
|
|
96
|
+
function isObjectLike(v) {
|
|
97
|
+
return typeof v === "object" && v !== null;
|
|
98
|
+
}
|
|
99
|
+
function deepCompare(expected, actual, basePath, mismatches, options) {
|
|
100
|
+
if (expected === actual) return mismatches;
|
|
101
|
+
if (expected === null || actual === null || typeof expected !== "object" || typeof actual !== "object") {
|
|
102
|
+
const path$2 = basePath || "(root)";
|
|
103
|
+
if (typeof expected !== typeof actual) {
|
|
104
|
+
mismatches.push({
|
|
105
|
+
path: path$2,
|
|
106
|
+
expected: formatExpected(expected, path$2, options.transformExpected),
|
|
107
|
+
actual,
|
|
108
|
+
reason: "type-mismatch"
|
|
109
|
+
});
|
|
110
|
+
return mismatches;
|
|
111
|
+
}
|
|
112
|
+
if (options.includeValueMismatch) mismatches.push({
|
|
113
|
+
path: path$2,
|
|
114
|
+
expected: formatExpected(expected, path$2, options.transformExpected),
|
|
115
|
+
actual,
|
|
116
|
+
reason: "value-mismatch"
|
|
117
|
+
});
|
|
118
|
+
return mismatches;
|
|
119
|
+
}
|
|
120
|
+
if (Array.isArray(expected) || Array.isArray(actual)) {
|
|
121
|
+
if (!Array.isArray(expected) || !Array.isArray(actual)) {
|
|
122
|
+
const path$2 = basePath || "(root)";
|
|
123
|
+
mismatches.push({
|
|
124
|
+
path: path$2,
|
|
125
|
+
expected: formatExpected(expected, path$2, options.transformExpected),
|
|
126
|
+
actual,
|
|
127
|
+
reason: "type-mismatch"
|
|
128
|
+
});
|
|
129
|
+
return mismatches;
|
|
130
|
+
}
|
|
131
|
+
const maxLen = expected.length;
|
|
132
|
+
for (let i = 0; i < maxLen; i++) {
|
|
133
|
+
const expVal = expected[i];
|
|
134
|
+
const actVal = actual[i];
|
|
135
|
+
deepCompare(expVal, actVal, basePath === "" ? `[${i}]` : `${basePath}[${i}]`, mismatches, options);
|
|
136
|
+
}
|
|
137
|
+
return mismatches;
|
|
138
|
+
}
|
|
139
|
+
if (isObjectLike(expected) && isObjectLike(actual)) {
|
|
140
|
+
const expKeys = Object.keys(expected);
|
|
141
|
+
const actKeys = Object.keys(actual);
|
|
142
|
+
for (const key of expKeys) {
|
|
143
|
+
const expVal = expected[key];
|
|
144
|
+
const actVal = actual[key];
|
|
145
|
+
const path$2 = basePath ? `${basePath}.${key}` : key;
|
|
146
|
+
if (!(key in actual)) {
|
|
147
|
+
mismatches.push({
|
|
148
|
+
path: path$2,
|
|
149
|
+
expected: formatExpected(expVal, path$2, options.transformExpected),
|
|
150
|
+
actual: void 0,
|
|
151
|
+
reason: "missing-key"
|
|
152
|
+
});
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
deepCompare(expVal, actVal, path$2, mismatches, options);
|
|
156
|
+
}
|
|
157
|
+
for (const key of actKeys) if (!(key in expected)) {
|
|
158
|
+
const path$2 = basePath ? `${basePath}.${key}` : key;
|
|
159
|
+
mismatches.push({
|
|
160
|
+
path: path$2,
|
|
161
|
+
expected: void 0,
|
|
162
|
+
actual: actual[key],
|
|
163
|
+
reason: "extra-key"
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return mismatches;
|
|
167
|
+
}
|
|
168
|
+
const path$1 = basePath || "(root)";
|
|
169
|
+
if (typeof expected !== typeof actual) mismatches.push({
|
|
170
|
+
path: path$1,
|
|
171
|
+
expected: formatExpected(expected, path$1, options.transformExpected),
|
|
172
|
+
actual,
|
|
173
|
+
reason: "type-mismatch"
|
|
174
|
+
});
|
|
175
|
+
else if (options.includeValueMismatch) mismatches.push({
|
|
176
|
+
path: path$1,
|
|
177
|
+
expected: formatExpected(expected, path$1, options.transformExpected),
|
|
178
|
+
actual,
|
|
179
|
+
reason: "value-mismatch"
|
|
180
|
+
});
|
|
181
|
+
return mismatches;
|
|
182
|
+
}
|
|
183
|
+
function equalsAtPaths(obj, paths, actual, options) {
|
|
184
|
+
const expected = pickBy(obj, ...paths);
|
|
185
|
+
const mismatches = [];
|
|
186
|
+
deepCompare(expected, actual, paths.length === 1 ? paths[0] : "", mismatches, { transformExpected: options?.transformExpected });
|
|
187
|
+
return {
|
|
188
|
+
ok: mismatches.length === 0,
|
|
189
|
+
mismatches
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
_path.equalsAtPaths = equalsAtPaths;
|
|
193
|
+
function formatValue(v) {
|
|
194
|
+
if (v === void 0) return "undefined";
|
|
195
|
+
if (typeof v === "string") return JSON.stringify(v);
|
|
196
|
+
try {
|
|
197
|
+
return JSON.stringify(v, null, 2);
|
|
198
|
+
} catch {
|
|
199
|
+
return String(v);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function formatReason(m) {
|
|
203
|
+
switch (m.reason) {
|
|
204
|
+
case "missing-key": return "Missing key";
|
|
205
|
+
case "extra-key": return "Extra key";
|
|
206
|
+
case "type-mismatch": return "Type mismatch";
|
|
207
|
+
case "value-mismatch": return "Value mismatch";
|
|
208
|
+
default: return m.reason;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function formatMismatches(result) {
|
|
212
|
+
if (result.ok || result.mismatches.length === 0) return "No mismatches.";
|
|
213
|
+
const lines = [];
|
|
214
|
+
for (const m of result.mismatches) lines.push(`\n● ${formatReason(m)} at "${m.path}":`, ` expected: ${formatValue(m.expected)}`, ` actual: ${formatValue(m.actual)}`, "");
|
|
215
|
+
if (lines.at(-1) === "") lines.pop();
|
|
216
|
+
return lines.join("\n");
|
|
217
|
+
}
|
|
218
|
+
_path.formatMismatches = formatMismatches;
|
|
219
|
+
function printMismatches(result) {
|
|
220
|
+
const msg = formatMismatches(result);
|
|
221
|
+
if (msg !== "No mismatches.") console.error(msg);
|
|
222
|
+
}
|
|
223
|
+
_path.printMismatches = printMismatches;
|
|
224
|
+
function setAtImmutable(root, path$1, value) {
|
|
225
|
+
const keys = path$1.split(".");
|
|
226
|
+
function helper(current, idx) {
|
|
227
|
+
const key = keys[idx];
|
|
228
|
+
const resolvedCurrent = Array.isArray(current) ? [...current] : { ...current };
|
|
229
|
+
if (idx === keys.length - 1) {
|
|
230
|
+
let clone$1 = current && typeof current === "object" ? resolvedCurrent : {};
|
|
231
|
+
clone$1 = {
|
|
232
|
+
...clone$1,
|
|
233
|
+
[key]: value
|
|
234
|
+
};
|
|
235
|
+
return clone$1;
|
|
236
|
+
}
|
|
237
|
+
const updatedChild = helper((current && typeof current === "object" ? current[key] : void 0) ?? {}, idx + 1);
|
|
238
|
+
let clone = current && typeof current === "object" ? resolvedCurrent : {};
|
|
239
|
+
clone = {
|
|
240
|
+
...clone,
|
|
241
|
+
[key]: updatedChild
|
|
242
|
+
};
|
|
243
|
+
return clone;
|
|
244
|
+
}
|
|
245
|
+
return helper(root, 0);
|
|
246
|
+
}
|
|
247
|
+
function findMissingPaths(obj, paths, actual) {
|
|
248
|
+
const keys = [];
|
|
249
|
+
for (const path$1 of paths) {
|
|
250
|
+
const expectedKeys = createDeep(pickBy(obj, path$1));
|
|
251
|
+
const actualKeys = createDeep(actual);
|
|
252
|
+
const missingKeys = expectedKeys.filter((key) => !actualKeys.includes(key)).map((key) => `${path$1}.${key}`);
|
|
253
|
+
keys.push(...missingKeys);
|
|
254
|
+
}
|
|
255
|
+
return keys;
|
|
256
|
+
}
|
|
257
|
+
_path.findMissingPaths = findMissingPaths;
|
|
258
|
+
function getPathThatMatter(path$1) {
|
|
259
|
+
const [, ...rest] = path$1.split(".defaultValue.");
|
|
260
|
+
return rest.join(".");
|
|
261
|
+
}
|
|
262
|
+
function joinAtPath(paths, obj, value) {
|
|
263
|
+
if (paths.length === 1) {
|
|
264
|
+
const [path$1] = paths;
|
|
265
|
+
const missingData = pickBy(obj, ...paths);
|
|
266
|
+
return setBy(value, getPathThatMatter(path$1), missingData);
|
|
267
|
+
}
|
|
268
|
+
if (paths.length > 1) {
|
|
269
|
+
let resolvedValue = {};
|
|
270
|
+
for (const path$1 of paths) {
|
|
271
|
+
const pathThatMatters = getPathThatMatter(path$1);
|
|
272
|
+
const missing = joinAtPath([path$1], obj, value);
|
|
273
|
+
const valueAtPathThatMatters = getBy(obj, path$1);
|
|
274
|
+
if (Object.keys(resolvedValue).length > 0 && valueAtPathThatMatters !== "undefined") {
|
|
275
|
+
const dataAtPath = pickBy(obj, path$1);
|
|
276
|
+
const [key] = pathThatMatters.split(".");
|
|
277
|
+
if (typeof dataAtPath === "object") {
|
|
278
|
+
if (missing) resolvedValue = {
|
|
279
|
+
...resolvedValue,
|
|
280
|
+
[key]: {
|
|
281
|
+
...resolvedValue[key],
|
|
282
|
+
...missing
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
if (missing) resolvedValue = {
|
|
289
|
+
...resolvedValue,
|
|
290
|
+
...missing
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
return resolvedValue;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
_path.joinAtPath = joinAtPath;
|
|
297
|
+
function updateAt(options) {
|
|
298
|
+
const { obj, partial, paths, value } = options;
|
|
299
|
+
const norm = normalizePaths(...paths);
|
|
300
|
+
if (norm.length === 0) return obj;
|
|
301
|
+
let result = obj;
|
|
302
|
+
let resolvedValue = value;
|
|
303
|
+
if (partial) {
|
|
304
|
+
const missingData = joinAtPath(findMissingPaths(obj, paths, value), obj, resolvedValue);
|
|
305
|
+
resolvedValue = {
|
|
306
|
+
...resolvedValue,
|
|
307
|
+
...missingData
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
if (norm.length === 1) {
|
|
311
|
+
const path$1 = norm[0];
|
|
312
|
+
result = setAtImmutable(result, path$1, resolvedValue);
|
|
313
|
+
return result;
|
|
314
|
+
}
|
|
315
|
+
for (const path$1 of norm) {
|
|
316
|
+
const sub = getBy(value, path$1);
|
|
317
|
+
result = setAtImmutable(result, path$1, sub);
|
|
318
|
+
}
|
|
319
|
+
return result;
|
|
320
|
+
}
|
|
321
|
+
_path.updateAt = updateAt;
|
|
322
|
+
})(path || (path = {}));
|
|
323
|
+
|
|
324
|
+
//#endregion
|
|
325
|
+
Object.defineProperty(exports, 'path', {
|
|
326
|
+
enumerable: true,
|
|
327
|
+
get: function () {
|
|
328
|
+
return path;
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
//# sourceMappingURL=path.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.cjs","names":["path","finalPaths: string[]","result: Record<string, unknown>","paths: string[]","parts: string[]","m: RegExpExecArray | null","node: any","lastFn: ExpectedTransformFn | undefined","mismatches: Mismatch[]","lines: string[]","clone","keys: string[]"],"sources":["../../src/utils/path.ts"],"sourcesContent":["import type { DeepKeys, unionHelpers } from './types';\n\nexport namespace path {\n type getBy<T, TPath extends string> = TPath extends `${infer K}.${infer Rest}`\n ? K extends keyof T\n ? getBy<T[K], Rest>\n : never\n : TPath extends keyof T\n ? T[TPath]\n : never;\n\n type buildFromPath<T, P extends string> = P extends `${infer K}.${infer Rest}`\n ? { [Key in K]: buildFromPath<getBy<T, K>, Rest> }\n : P extends keyof T\n ? { [Key in P]: T[P] }\n : never;\n\n /**\n * Does P have any ancestor path in All? (i.e. some Q in All such that Q is a\n * strict prefix of P)\n */\n type hasAncestor<P extends string, All extends string> = true extends (\n All extends string\n ? All extends P\n ? false // same path, not an ancestor\n : P extends `${All}.${string}`\n ? true\n : false\n : never\n )\n ? true\n : false;\n\n /**\n * Normalize a union of paths by removing those that have an ancestor path\n * also in the union.\n *\n * Example:\n * NormalizePaths<'foo.bar.baz' | 'foo.bar'> -> 'foo.bar'\n * NormalizePaths<'foo.bar' | 'other'> -> 'foo.bar' | 'other'\n */\n type normalize<\n Paths extends string,\n All extends string = Paths\n > = Paths extends string\n ? hasAncestor<Paths, All> extends true\n ? never\n : Paths\n : never;\n\n // helper to distribute BuildFromPath over union\n type distributeAndBuild<T, Paths extends string> = Paths extends unknown\n ? buildFromPath<T, Paths>\n : never;\n\n export type generateObjectConfig<T> = {\n [K in keyof T]: T[K] extends object\n ? // K's value is an object: allow stopping at K, or going deeper\n { [P in K]: true } | { [P in K]: generateObjectConfig<T[K]> }\n : // K's value is not object: can only stop at K\n { [P in K]: true };\n }[keyof T];\n export type objectToPath<O> = {\n [K in keyof O]: O[K] extends true\n ? K & string\n : O[K] extends object\n ? `${K & string}.${objectToPath<O[K]>}`\n : never;\n }[keyof O];\n\n /**\n * Pick by paths:\n * - Normalize the paths (remove descendants when parent also present)\n * - If only one normalized path:\n * return GetByPath<T, P> (relative type)\n * - If multiple:\n * intersect root-built shapes for each normalized path\n *\n * @example\n * ```ts\n * type User = {\n * foo: {\n * bar: {\n * baz: number;\n * qux: string;\n * };\n * };\n * other: string;\n * };\n *\n * type Test1 = PickByPaths<User, 'foo.bar'>;\n * // { baz: number; qux: string } ✅ relative object at foo.bar\n *\n * type Test2 = PickByPaths<User, 'foo.bar.baz'>;\n * // number ✅ leaf type\n *\n * type Test3 = PickByPaths<User, 'foo.bar' | 'other'>;\n * // { foo: { bar: { baz: number; qux: string } } } & { other: string } ✅\n *\n * type Test4 = PickByPaths<User, 'foo.bar.baz' | 'foo.bar' | 'other'>;\n * // { baz: number; qux: string } ✅ parent 'foo.bar' wins, relative\n * ```\n */\n export type pickBy<\n T,\n Paths extends DeepKeys<T>\n > = normalize<Paths> extends infer normalized extends string\n ? unionHelpers.is<normalized> extends true\n ? unionHelpers.toIntersection<distributeAndBuild<T, normalized>>\n : getBy<T, normalized>\n : never;\n\n function getBy(obj: any, path: string): any {\n return path\n .split('.')\n .reduce((acc, key) => (acc == null ? undefined : acc[key]), obj);\n }\n export function setBy<\n def extends Record<string, unknown>,\n path extends DeepKeys<def>\n >(target: def, path: path, value: unknown) {\n const keys = path.split('.');\n let current = target;\n\n for (let i = 0; i < keys.length; i++) {\n const k = keys[i];\n if (i === keys.length - 1) {\n // last key -> assign/merge\n if (\n current[k] !== undefined &&\n typeof current[k] === 'object' &&\n typeof value === 'object' &&\n value !== null\n ) {\n Object.assign(current[k] as Record<string, unknown>, value);\n } else {\n (current[k] as any) = value;\n }\n } else {\n if (typeof current[k] !== 'object' || current[k] === null) {\n (current[k] as any) = {};\n }\n (current as any) = current[k];\n }\n }\n\n return current;\n }\n\n // Runtime: normalize paths (drop descendants when ancestor exists)\n export function normalizePaths(...paths: string[]) {\n // Sort by depth (deepest first), so longer paths come before their parents.\n const sorted = [...paths].sort(\n (a, b) => b.split('.').length - a.split('.').length\n );\n\n const finalPaths: string[] = [];\n\n for (const path of sorted) {\n // If the path is contained inside another selected deeper path, skip it\n const isCovered = finalPaths.some((p) => p.startsWith(path + '.'));\n\n if (!isCovered) {\n finalPaths.push(path);\n }\n }\n\n // The order may not matter, but returning in shallow-to-deep order feels natural.\n return finalPaths.reverse();\n }\n\n /**\n * pickByPaths:\n * - paths can be a union of string literals\n * - return type is PickByPaths<T, Paths>\n */\n export function pickBy<def, paths extends DeepKeys<def>>(\n obj: def,\n ...paths: paths[]\n ): pickBy<def, paths> {\n const norm = normalizePaths(...paths);\n\n // Single normalized path -> return relative value at that path\n if (norm.length === 1) {\n return getBy(obj, norm[0]) as pickBy<def, paths>;\n }\n\n // Multiple normalized paths -> build root-based object and intersect\n const result: Record<string, unknown> = {};\n\n for (const p of norm) {\n const value = getBy(obj, p);\n\n setBy(result, p, value);\n }\n\n return result as pickBy<def, paths>;\n }\n\n /**\n * Creates an array of all deep paths in an object.\n * Recursively traverses the object and returns all possible dot-separated paths.\n *\n * @example\n * ```ts\n * const obj = {\n * foo: {\n * bar: {\n * baz: 1,\n * qux: 2\n * }\n * },\n * other: 'value'\n * };\n *\n * createPaths(obj);\n * // ['foo', 'foo.bar', 'foo.bar.baz', 'foo.bar.qux', 'other']\n * ```\n */\n export function createDeep<T>(obj: T): DeepKeys<T>[] {\n const paths: string[] = [];\n\n function traverse(current: any, prefix: string = ''): void {\n if (current === null || current === undefined) {\n return;\n }\n\n if (typeof current !== 'object' || Array.isArray(current)) {\n return;\n }\n\n const keys = Object.keys(current);\n for (const key of keys) {\n const path = prefix ? `${prefix}.${key}` : key;\n paths.push(path);\n\n const value = current[key];\n if (\n value !== null &&\n value !== undefined &&\n typeof value === 'object' &&\n !Array.isArray(value)\n ) {\n traverse(value, path);\n }\n }\n }\n\n traverse(obj);\n return paths as DeepKeys<T>[];\n }\n\n export type MismatchReason =\n | 'value-mismatch'\n | 'type-mismatch'\n | 'missing-key'\n | 'extra-key';\n export interface Mismatch {\n path: string;\n expected: unknown;\n actual: unknown;\n reason: MismatchReason;\n }\n\n export interface CompareResult {\n ok: boolean;\n mismatches: Mismatch[];\n }\n type ExpectedTransformFn<TValue = unknown> = (\n value: TValue,\n path: string\n ) => unknown;\n /**\n * Transform config:\n * - a single function: applies to the whole T\n * - or an object shaped like T, where values are either:\n * - functions (apply at/under that node)\n * - nested objects continuing the shape\n */\n export type ExpectedTransformConfig<T, V = unknown> =\n | ExpectedTransformFn<V>\n | { [K in keyof T]?: ExpectedTransformConfig<T[K], T[K]> };\n export interface EqualsOptions<T> {\n /**\n * How to transform the \"expected\" field in mismatches.\n * If omitted, a default type-ish formatting is used.\n */\n transformExpected?: ExpectedTransformConfig<T>;\n }\n interface DeepCompareOptions<T> {\n includeValueMismatch?: boolean;\n\n transformExpected?: ExpectedTransformConfig<T>;\n }\n\n function defaultExpectedFormat(value: unknown): string {\n if (value === null) return 'null';\n if (Array.isArray(value)) return 'Array';\n const t = typeof value;\n if (t !== 'object') return t; // 'string', 'number', etc.\n const ctor = (value as any)?.constructor?.name;\n return ctor && ctor !== 'Object' ? ctor : 'object';\n }\n\n function splitPath(path: string): string[] {\n if (!path) return [];\n const parts: string[] = [];\n const regex = /[^.[\\]]+|\\[(\\d+)\\]/g;\n let m: RegExpExecArray | null;\n while ((m = regex.exec(path))) {\n parts.push(m[1] ?? m[0]);\n }\n return parts;\n }\n\n function getTransformFunction<T>(\n root: ExpectedTransformConfig<T> | undefined,\n path: string\n ): ExpectedTransformFn | undefined {\n if (!root) return undefined;\n\n if (typeof root === 'function') {\n // TS now knows this is ExpectedTransformFn, but we can be explicit:\n return root as ExpectedTransformFn;\n }\n\n const segments = splitPath(path);\n let node: any = root;\n let lastFn: ExpectedTransformFn | undefined;\n\n for (const seg of segments) {\n if (!node) break;\n\n if (typeof node === 'function') {\n lastFn = node as ExpectedTransformFn;\n break;\n }\n\n node = node[seg];\n\n if (typeof node === 'function') {\n lastFn = node as ExpectedTransformFn;\n break;\n }\n }\n\n return lastFn;\n }\n\n function formatExpected<T>(\n rawExpected: unknown,\n path: string,\n cfg: ExpectedTransformConfig<T> | undefined\n ): unknown {\n const fn = getTransformFunction(cfg, path);\n if (fn) return fn(rawExpected, path);\n return defaultExpectedFormat(rawExpected);\n }\n\n function isObjectLike(v: unknown): v is Record<string, unknown> {\n return typeof v === 'object' && v !== null;\n }\n\n function deepCompare<T>(\n expected: unknown,\n actual: unknown,\n basePath: string,\n mismatches: Mismatch[],\n options: DeepCompareOptions<T>\n ): Mismatch[] {\n // identical (covers primitives + same-ref objects)\n if (expected === actual) {\n return mismatches;\n }\n\n // one is null/undefined OR types not object-like -> primitive / scalar mismatch\n if (\n expected === null ||\n actual === null ||\n typeof expected !== 'object' ||\n typeof actual !== 'object'\n ) {\n const path = basePath || '(root)';\n\n if (typeof expected !== typeof actual) {\n mismatches.push({\n path,\n expected: formatExpected(expected, path, options.transformExpected),\n actual,\n reason: 'type-mismatch',\n });\n return mismatches;\n }\n\n if (options.includeValueMismatch) {\n mismatches.push({\n path,\n expected: formatExpected(expected, path, options.transformExpected),\n actual,\n reason: 'value-mismatch',\n });\n }\n\n return mismatches;\n }\n\n // arrays\n if (Array.isArray(expected) || Array.isArray(actual)) {\n if (!Array.isArray(expected) || !Array.isArray(actual)) {\n const path = basePath || '(root)';\n mismatches.push({\n path,\n expected: formatExpected(expected, path, options.transformExpected),\n actual,\n reason: 'type-mismatch',\n });\n return mismatches;\n }\n\n // Both values are arrays.\n // We *do* compare element structure/types where both have an index, but we\n // intentionally ignore length differences (no missing/extra index errors).\n const maxLen = expected.length;\n\n for (let i = 0; i < maxLen; i++) {\n const expVal = expected[i];\n const actVal = actual[i];\n const path = basePath === '' ? `[${i}]` : `${basePath}[${i}]`;\n\n deepCompare(expVal, actVal, path, mismatches, options);\n }\n\n return mismatches;\n }\n\n // plain objects\n if (isObjectLike(expected) && isObjectLike(actual)) {\n const expKeys = Object.keys(expected);\n const actKeys = Object.keys(actual);\n\n for (const key of expKeys) {\n const expVal = (expected as any)[key];\n const actVal = (actual as any)[key];\n const path = basePath ? `${basePath}.${key}` : key;\n\n if (!(key in actual)) {\n mismatches.push({\n path,\n expected: formatExpected(expVal, path, options.transformExpected),\n actual: undefined,\n reason: 'missing-key',\n });\n continue;\n }\n\n deepCompare(expVal, actVal, path, mismatches, options);\n }\n\n for (const key of actKeys) {\n if (!(key in expected)) {\n const path = basePath ? `${basePath}.${key}` : key;\n mismatches.push({\n path,\n expected: undefined,\n actual: (actual as any)[key],\n reason: 'extra-key',\n });\n }\n }\n\n return mismatches;\n }\n\n const path = basePath || '(root)';\n if (typeof expected !== typeof actual) {\n mismatches.push({\n path,\n expected: formatExpected(expected, path, options.transformExpected),\n actual,\n reason: 'type-mismatch',\n });\n } else if (options.includeValueMismatch) {\n mismatches.push({\n path,\n expected: formatExpected(expected, path, options.transformExpected),\n actual,\n reason: 'value-mismatch',\n });\n }\n\n return mismatches;\n }\n\n export function equalsAtPaths<def, paths extends DeepKeys<def>>(\n obj: def,\n paths: paths[],\n actual: pickBy<def, paths>,\n options?: EqualsOptions<def>\n ): CompareResult {\n // expected comes from obj at the given paths\n const expected = pickBy<def, paths>(obj, ...paths);\n\n const mismatches: Mismatch[] = [];\n\n const basePath = paths.length === 1 ? (paths[0] as string) : '';\n\n deepCompare<def>(expected, actual, basePath, mismatches, {\n transformExpected: options?.transformExpected,\n });\n\n return {\n ok: mismatches.length === 0,\n mismatches,\n };\n }\n\n function formatValue(v: unknown): string {\n if (v === undefined) return 'undefined';\n if (typeof v === 'string') return JSON.stringify(v); // add quotes\n try {\n return JSON.stringify(v, null, 2);\n } catch {\n return String(v);\n }\n }\n\n function formatReason(m: Mismatch): string {\n switch (m.reason) {\n case 'missing-key':\n return 'Missing key';\n case 'extra-key':\n return 'Extra key';\n case 'type-mismatch':\n return 'Type mismatch';\n case 'value-mismatch':\n return 'Value mismatch';\n default:\n return m.reason;\n }\n }\n\n /**\n * Turn a CompareResult into a pretty error string.\n */\n export function formatMismatches(result: CompareResult) {\n if (result.ok || result.mismatches.length === 0) {\n return 'No mismatches.';\n }\n\n const lines: string[] = [];\n\n for (const m of result.mismatches) {\n lines.push(\n `\\n● ${formatReason(m)} at \"${m.path}\":`,\n ` expected: ${formatValue(m.expected)}`,\n ` actual: ${formatValue(m.actual)}`,\n '' // blank line between entries\n );\n }\n\n // trim trailing blank line\n if (lines.at(-1) === '') {\n lines.pop();\n }\n\n return lines.join('\\n');\n }\n\n /**\n * Convenience: log to console.error.\n */\n export function printMismatches(result: CompareResult): void {\n const msg = formatMismatches(result);\n if (msg !== 'No mismatches.') {\n console.error(msg);\n }\n }\n\n function setAtImmutable<\n T extends Record<string, unknown>,\n path extends DeepKeys<T>\n >(root: T, path: path, value: pickBy<T, path>) {\n const keys = path.split('.');\n\n function helper(current: T, idx: number): any {\n const key = keys[idx];\n const resolvedCurrent = Array.isArray(current)\n ? [...current]\n : { ...current };\n\n if (idx === keys.length - 1) {\n let clone =\n current && typeof current === 'object' ? resolvedCurrent : {};\n\n clone = {\n ...clone,\n [key]: value,\n };\n\n return clone;\n }\n\n const next =\n current && typeof current === 'object' ? current[key] : undefined;\n\n const updatedChild = helper((next as T) ?? ({} as T), idx + 1);\n\n let clone = current && typeof current === 'object' ? resolvedCurrent : {};\n\n clone = {\n ...clone,\n [key]: updatedChild,\n };\n\n return clone;\n }\n\n return helper(root, 0);\n }\n\n export function findMissingPaths<\n obj extends Record<string, unknown>,\n path extends DeepKeys<obj>\n >(obj: obj, paths: Array<path>, actual: pickBy<obj, path>) {\n const keys: string[] = [];\n\n for (const path of paths) {\n const value = pickBy(obj, path);\n const expectedKeys = createDeep(value);\n const actualKeys = createDeep(actual);\n const missingKeys = expectedKeys\n .filter((key) => !actualKeys.includes(key))\n .map((key) => `${path}.${key}`);\n\n keys.push(...missingKeys);\n }\n\n return keys as Array<DeepKeys<obj>>;\n }\n\n export type updateAtOptions<\n T extends Record<string, unknown>,\n path extends DeepKeys<T>\n > = {\n obj: T;\n paths: Array<path>;\n value: pickBy<T, path>;\n partial?: boolean;\n };\n\n function getPathThatMatter(path: string) {\n // Only works when updating a `defaultValue`\n // TODO make this work with the entire object - will need to figure out some way to normalize\n const [, ...rest] = path.split('.defaultValue.');\n\n return rest.join('.');\n }\n\n export function joinAtPath<\n obj extends Record<string, unknown>,\n path extends DeepKeys<obj>\n >(paths: Array<path>, obj: obj, value: pickBy<obj, path>) {\n if (paths.length === 1) {\n const [path] = paths;\n const missingData = pickBy(obj, ...paths);\n const setPath = getPathThatMatter(path);\n\n // if (last) {\n // const data = setBy(\n // value as Record<string, unknown>,\n // last,\n // missingData\n // ) as pickBy<obj, path>;\n\n // return data;\n // }\n\n const data = setBy(\n value as Record<string, unknown>,\n setPath,\n missingData\n ) as pickBy<obj, path>;\n\n return data;\n }\n\n if (paths.length > 1) {\n let resolvedValue = {} as Record<string, unknown>;\n\n for (const path of paths) {\n const pathThatMatters = getPathThatMatter(path);\n const missing = joinAtPath([path], obj, value);\n const valueAtPathThatMatters = getBy(obj, path);\n\n // This check is here to ensure `resolvedValue` will only have\n // nested properties where they belong.\n if (\n Object.keys(resolvedValue).length > 0 &&\n valueAtPathThatMatters !== 'undefined'\n ) {\n const dataAtPath = pickBy(obj, path);\n const [key] = pathThatMatters.split('.');\n\n if (typeof dataAtPath === 'object') {\n if (missing) {\n resolvedValue = {\n ...resolvedValue,\n [key]: {\n ...(resolvedValue[key] as Record<string, unknown>),\n ...missing,\n },\n };\n }\n }\n\n continue;\n }\n\n if (missing) {\n resolvedValue = {\n ...resolvedValue,\n ...missing,\n };\n }\n }\n\n return resolvedValue as pickBy<obj, path>;\n }\n }\n\n export function updateAt<\n obj extends Record<string, unknown>,\n path extends DeepKeys<obj>\n >(options: updateAtOptions<obj, path>) {\n const { obj, partial, paths, value } = options;\n const norm = normalizePaths(...paths);\n if (norm.length === 0) return obj;\n\n let result = obj;\n let resolvedValue = value;\n\n if (partial) {\n const missingPaths = findMissingPaths(obj, paths, value);\n\n const missingData = joinAtPath(\n missingPaths as Array<path>,\n obj,\n resolvedValue\n );\n\n resolvedValue = {\n ...(resolvedValue as Record<string, unknown>),\n ...(missingData as Record<string, unknown>),\n } as pickBy<obj, path>;\n }\n\n if (norm.length === 1) {\n // single path: value is relative at that path\n const path = norm[0] as DeepKeys<obj>;\n\n result = setAtImmutable(result, path, resolvedValue as never);\n\n return result;\n }\n\n // multiple paths:\n // value is the root-shaped object that contains all those paths\n for (const path of norm) {\n const sub = getBy(value, path);\n\n result = setAtImmutable(result, path as DeepKeys<obj>, sub);\n }\n\n return result;\n }\n}\n"],"mappings":";;;;CAgHE,SAAS,MAAM,KAAU,QAAmB;AAC1C,SAAOA,OACJ,MAAM,IAAI,CACV,QAAQ,KAAK,QAAS,OAAO,OAAO,SAAY,IAAI,MAAO,IAAI;;CA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