at-shared-types 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/domain/chat.d.ts +29 -0
- package/dist/ai/domain/chat.d.ts.map +1 -0
- package/dist/ai/transport/chat/chat.request.d.ts +3 -6
- package/dist/ai/transport/chat/chat.request.d.ts.map +1 -1
- package/dist/ai/transport/chat/chat.response.d.ts +3 -9
- package/dist/ai/transport/chat/chat.response.d.ts.map +1 -1
- package/dist/ai/transport/chat/chatWithIntent.request.d.ts +3 -6
- package/dist/ai/transport/chat/chatWithIntent.request.d.ts.map +1 -1
- package/dist/ai/transport/chat/chatWithIntent.response.d.ts +3 -5
- package/dist/ai/transport/chat/chatWithIntent.response.d.ts.map +1 -1
- package/dist/ai/transport/wire.types.d.ts +15 -10
- package/dist/ai/transport/wire.types.d.ts.map +1 -1
- package/dist/casing/case.runtime.d.ts.map +1 -1
- package/dist/casing/case.types.d.ts +2 -1
- package/dist/casing/case.types.d.ts.map +1 -1
- package/dist/core/transport/responses.d.ts +2 -1
- package/dist/core/transport/responses.d.ts.map +1 -1
- package/dist/domain.cjs.map +1 -1
- package/dist/domain.d.ts +4 -0
- package/dist/domain.d.ts.map +1 -1
- package/dist/domain.mjs.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AIChatMessageDTO, AIChatWithIntentOptionsDTO, AIIntentDTO } from "./engine";
|
|
2
|
+
export interface AIChatUsageDTO {
|
|
3
|
+
tokens?: number;
|
|
4
|
+
}
|
|
5
|
+
/** Internal/domain request (camelCase) */
|
|
6
|
+
export interface AIChatRequestDTO {
|
|
7
|
+
sessionID: string;
|
|
8
|
+
messages: AIChatMessageDTO[];
|
|
9
|
+
options?: AIChatWithIntentOptionsDTO;
|
|
10
|
+
}
|
|
11
|
+
/** Domain response (camelCase) */
|
|
12
|
+
export interface AIChatResponseDTO {
|
|
13
|
+
message: AIChatMessageDTO;
|
|
14
|
+
usage?: AIChatUsageDTO;
|
|
15
|
+
engineID?: string;
|
|
16
|
+
raw?: unknown;
|
|
17
|
+
debug?: unknown;
|
|
18
|
+
}
|
|
19
|
+
/** Domain request (camelCase) */
|
|
20
|
+
export interface AIChatWithIntentRequestDTO {
|
|
21
|
+
sessionID: string;
|
|
22
|
+
messages: AIChatMessageDTO[];
|
|
23
|
+
options?: AIChatWithIntentOptionsDTO;
|
|
24
|
+
}
|
|
25
|
+
/** Domain response (camelCase) */
|
|
26
|
+
export interface AIChatWithIntentResponseDTO extends AIChatResponseDTO {
|
|
27
|
+
intents?: AIIntentDTO[];
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/ai/domain/chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,gBAAgB,EAChB,0BAA0B,EAC1B,WAAW,EACd,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,cAAc;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,0CAA0C;AAC1C,MAAM,WAAW,gBAAgB;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,0BAA0B,CAAC;CACxC;AAED,kCAAkC;AAClC,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,iCAAiC;AACjC,MAAM,WAAW,0BAA0B;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,0BAA0B,CAAC;CACxC;AAED,kCAAkC;AAClC,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IAClE,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;CAC3B"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
messages: AIChatMessageWireDTO[];
|
|
5
|
-
options?: AIChatWithIntentOptionsWireDTO;
|
|
6
|
-
}
|
|
1
|
+
import type { DeepSnakeKeys } from "../../../casing";
|
|
2
|
+
import type { AIChatRequestDTO as DomainAIChatRequestDTO } from "../../domain/chat";
|
|
3
|
+
export type AIChatRequestDTO = DeepSnakeKeys<DomainAIChatRequestDTO>;
|
|
7
4
|
//# sourceMappingURL=chat.request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.request.d.ts","sourceRoot":"","sources":["../../../../src/ai/transport/chat/chat.request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"chat.request.d.ts","sourceRoot":"","sources":["../../../../src/ai/transport/chat/chat.request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,IAAI,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEpF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,sBAAsB,CAAC,CAAC"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
usage?: {
|
|
5
|
-
tokens?: number;
|
|
6
|
-
};
|
|
7
|
-
raw?: any;
|
|
8
|
-
debug?: any;
|
|
9
|
-
}
|
|
1
|
+
import type { DeepSnakeKeys } from "../../../casing";
|
|
2
|
+
import type { AIChatResponseDTO as DomainAIChatResponseDTO } from "../../domain/chat";
|
|
3
|
+
export type AIChatResponseDTO = DeepSnakeKeys<DomainAIChatResponseDTO>;
|
|
10
4
|
//# sourceMappingURL=chat.response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.response.d.ts","sourceRoot":"","sources":["../../../../src/ai/transport/chat/chat.response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"chat.response.d.ts","sourceRoot":"","sources":["../../../../src/ai/transport/chat/chat.response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,IAAI,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEtF,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,uBAAuB,CAAC,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
messages: AIChatMessageWireDTO[];
|
|
5
|
-
options?: AIChatWithIntentOptionsWireDTO;
|
|
6
|
-
}
|
|
1
|
+
import type { DeepSnakeKeys } from "../../../casing";
|
|
2
|
+
import type { AIChatWithIntentRequestDTO as DomainAIChatWithIntentRequestDTO } from "../../domain/chat";
|
|
3
|
+
export type AIChatWithIntentRequestDTO = DeepSnakeKeys<DomainAIChatWithIntentRequestDTO>;
|
|
7
4
|
//# sourceMappingURL=chatWithIntent.request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatWithIntent.request.d.ts","sourceRoot":"","sources":["../../../../src/ai/transport/chat/chatWithIntent.request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"chatWithIntent.request.d.ts","sourceRoot":"","sources":["../../../../src/ai/transport/chat/chatWithIntent.request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,0BAA0B,IAAI,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAExG,MAAM,MAAM,0BAA0B,GAAG,aAAa,CAAC,gCAAgC,CAAC,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export
|
|
4
|
-
intents?: AIIntentWireDTO[];
|
|
5
|
-
}
|
|
1
|
+
import type { DeepSnakeKeys } from "../../../casing";
|
|
2
|
+
import type { AIChatWithIntentResponseDTO as DomainAIChatWithIntentResponseDTO } from "../../domain/chat";
|
|
3
|
+
export type AIChatWithIntentResponseDTO = DeepSnakeKeys<DomainAIChatWithIntentResponseDTO>;
|
|
6
4
|
//# sourceMappingURL=chatWithIntent.response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatWithIntent.response.d.ts","sourceRoot":"","sources":["../../../../src/ai/transport/chat/chatWithIntent.response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"chatWithIntent.response.d.ts","sourceRoot":"","sources":["../../../../src/ai/transport/chat/chatWithIntent.response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,2BAA2B,IAAI,iCAAiC,EAAE,MAAM,mBAAmB,CAAC;AAE1G,MAAM,MAAM,2BAA2B,GAAG,aAAa,CAAC,iCAAiC,CAAC,CAAC"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import type { DeepSnakeKeys } from "../../casing";
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
4
|
-
|
|
5
|
-
export type
|
|
6
|
-
export type
|
|
7
|
-
export type
|
|
8
|
-
export type
|
|
9
|
-
export type
|
|
10
|
-
export type
|
|
11
|
-
export type
|
|
2
|
+
import type * as DomainEngine from "../domain/engine";
|
|
3
|
+
import type * as DomainSession from "../domain/session";
|
|
4
|
+
import type * as DomainChat from "../domain/chat";
|
|
5
|
+
export type AIChatMessageWireDTO = DeepSnakeKeys<DomainEngine.AIChatMessageDTO>;
|
|
6
|
+
export type AIChatOptionsWireDTO = DeepSnakeKeys<DomainEngine.AIChatOptionsDTO>;
|
|
7
|
+
export type AIRequestContextWireDTO = DeepSnakeKeys<DomainEngine.AIRequestContextDTO>;
|
|
8
|
+
export type AIChatWithIntentOptionsWireDTO = DeepSnakeKeys<DomainEngine.AIChatWithIntentOptionsDTO>;
|
|
9
|
+
export type AIIntentWireDTO = DeepSnakeKeys<DomainEngine.AIIntentDTO>;
|
|
10
|
+
export type AICapabilityWireDTO = DeepSnakeKeys<DomainEngine.AICapabilityDTO>;
|
|
11
|
+
export type AIPageContextWireDTO = DeepSnakeKeys<DomainEngine.AIPageContextDTO>;
|
|
12
|
+
export type AISessionConfigWireDTO = DeepSnakeKeys<DomainSession.AISessionConfigDTO>;
|
|
13
|
+
export type AIChatRequestWireDTO = DeepSnakeKeys<DomainChat.AIChatRequestDTO>;
|
|
14
|
+
export type AIChatResponseWireDTO = DeepSnakeKeys<DomainChat.AIChatResponseDTO>;
|
|
15
|
+
export type AIChatWithIntentRequestWireDTO = DeepSnakeKeys<DomainChat.AIChatWithIntentRequestDTO>;
|
|
16
|
+
export type AIChatWithIntentResponseWireDTO = DeepSnakeKeys<DomainChat.AIChatWithIntentResponseDTO>;
|
|
12
17
|
//# sourceMappingURL=wire.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.types.d.ts","sourceRoot":"","sources":["../../../src/ai/transport/wire.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"wire.types.d.ts","sourceRoot":"","sources":["../../../src/ai/transport/wire.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa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file":"case.runtime.d.ts","sourceRoot":"","sources":["../../src/casing/case.runtime.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU,GAAI,GAAG,MAAM,WACwC,CAAC;AAE7E,eAAO,MAAM,UAAU,GAAI,GAAG,MAAM,WACoB,CAAC;AAEzD,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,cAAoB,GAAG,GAAG,CAY5E;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAW5C"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
type FixAcronyms<S extends string> = S extends `${infer A}ID${infer B}` ? FixAcronyms<`${A}Id${B}`> : S;
|
|
1
2
|
export type SnakeCase<S extends string> = S extends `${infer H}${infer T}` ? T extends Uncapitalize<T> ? `${Lowercase<H>}${SnakeCase<T>}` : `${Lowercase<H>}_${SnakeCase<Uncapitalize<T>>}` : S;
|
|
2
3
|
export type CamelCase<S extends string> = S extends `${infer A}_${infer B}` ? `${A}${Capitalize<CamelCase<B>>}` : S;
|
|
3
4
|
type Primitive = string | number | boolean | bigint | symbol | null | undefined;
|
|
@@ -5,7 +6,7 @@ type Builtin = Primitive | Date | RegExp | Error;
|
|
|
5
6
|
export type DeepSnakeKeys<T> = T extends Builtin ? T : T extends (...args: any[]) => any ? T : T extends readonly [any, ...any[]] ? {
|
|
6
7
|
[I in keyof T]: DeepSnakeKeys<T[I]>;
|
|
7
8
|
} : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepSnakeKeys<U>> : T extends Map<infer K, infer V> ? Map<DeepSnakeKeys<K>, DeepSnakeKeys<V>> : T extends Set<infer U> ? Set<DeepSnakeKeys<U>> : T extends object ? {
|
|
8
|
-
[K in keyof T as K extends string ? SnakeCase<K
|
|
9
|
+
[K in keyof T as K extends string ? SnakeCase<FixAcronyms<K>> : K]: DeepSnakeKeys<T[K]>;
|
|
9
10
|
} : T;
|
|
10
11
|
export type DeepCamelKeys<T> = T extends Builtin ? T : T extends (...args: any[]) => any ? T : T extends readonly [any, ...any[]] ? {
|
|
11
12
|
[I in keyof T]: DeepCamelKeys<T[I]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case.types.d.ts","sourceRoot":"","sources":["../../src/casing/case.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAClC,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,GAC9B,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,GACzB,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,GAChC,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,GAC/C,CAAC,CAAC;AAER,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAClC,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,MAAM,CAAC,EAAE,GAC/B,GAAG,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,GACjC,CAAC,CAAC;AAER,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAChF,KAAK,OAAO,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC;AAEjD,MAAM,MAAM,aAAa,CAAC,CAAC,IACvB,CAAC,SAAS,OAAO,GAAG,CAAC,GACrB,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,CAAC,GACrC,CAAC,SAAS,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC,GAChC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;C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Aa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACzC,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAC9B,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GACjC,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAC7B,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,GACzC,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,CAAC,GACpB,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GACvB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC9E,CAAC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { ATAPIErrorCode } from "../protocol/errors";
|
|
1
2
|
export interface ResponseSuccessDTO<T> {
|
|
2
3
|
code: number;
|
|
3
4
|
data: T;
|
|
4
5
|
}
|
|
5
6
|
export interface ResponseErrorDTO {
|
|
6
|
-
code:
|
|
7
|
+
code: ATAPIErrorCode;
|
|
7
8
|
message: string;
|
|
8
9
|
errors?: any[];
|
|
9
10
|
timestamp: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../src/core/transport/responses.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;CACX;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../src/core/transport/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;CACX;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/domain.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/domain.ts"],"sourcesContent":["export type * from \"./ai/domain/engine\";\r\nexport type * from \"./ai/domain/session\";\r\n\r\n/**\r\n * Runtime value so consumers can use:\r\n * import { ATDomainDTO } from \"at-shared-types/domain\";\r\n * ATDomainDTO.<autocomplete>\r\n */\r\nexport const ATDomainDTO = {} as const;\r\n\r\n/**\r\n * Merge types into the runtime value for dot-access.\r\n * This is emitted correctly by tsc (not tsup dts bundler).\r\n */\r\nexport namespace ATDomainDTO {\r\n export type ATChatMessageContentDTO =\r\n import(\"./ai/domain/engine\").ATChatMessageContentDTO;\r\n\r\n export type AIChatMessageDTO =\r\n import(\"./ai/domain/engine\").AIChatMessageDTO;\r\n\r\n export type AIChatOptionsResponseFormatDTO =\r\n import(\"./ai/domain/engine\").AIChatOptionsResponseFormatDTO;\r\n\r\n export type AIRequestContextDTO =\r\n import(\"./ai/domain/engine\").AIRequestContextDTO;\r\n\r\n export type AIChatOptionsDTO =\r\n import(\"./ai/domain/engine\").AIChatOptionsDTO;\r\n\r\n export type AIIntentDTO =\r\n import(\"./ai/domain/engine\").AIIntentDTO;\r\n\r\n export type AICapabilityDTO =\r\n import(\"./ai/domain/engine\").AICapabilityDTO;\r\n\r\n export type AIPageContextDTO =\r\n import(\"./ai/domain/engine\").AIPageContextDTO;\r\n\r\n export type AIChatWithIntentOptionsDTO =\r\n import(\"./ai/domain/engine\").AIChatWithIntentOptionsDTO;\r\n\r\n export type AIPromptRoleDTO =\r\n import(\"./ai/domain/session\").AIPromptRoleDTO;\r\n\r\n export type AISessionConfigDTO =\r\n import(\"./ai/domain/session\").AISessionConfigDTO;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../src/domain.ts"],"sourcesContent":["export type * from \"./ai/domain/engine\";\r\nexport type * from \"./ai/domain/session\";\r\nexport type * from \"./ai/domain/chat\";\r\n\r\n/**\r\n * Runtime value so consumers can use:\r\n * import { ATDomainDTO } from \"at-shared-types/domain\";\r\n * ATDomainDTO.<autocomplete>\r\n */\r\nexport const ATDomainDTO = {} as const;\r\n\r\n/**\r\n * Merge types into the runtime value for dot-access.\r\n * This is emitted correctly by tsc (not tsup dts bundler).\r\n */\r\nexport namespace ATDomainDTO {\r\n export type AIChatUsageDTO =\r\n import(\"./ai/domain/chat\").AIChatUsageDTO;\r\n\r\n export type AIChatResponseDTO =\r\n import(\"./ai/domain/chat\").AIChatResponseDTO;\r\n\r\n export type AIChatWithIntentResponseDTO =\r\n import(\"./ai/domain/chat\").AIChatWithIntentResponseDTO;\r\n\r\n export type ATChatMessageContentDTO =\r\n import(\"./ai/domain/engine\").ATChatMessageContentDTO;\r\n\r\n export type AIChatMessageDTO =\r\n import(\"./ai/domain/engine\").AIChatMessageDTO;\r\n\r\n export type AIChatOptionsResponseFormatDTO =\r\n import(\"./ai/domain/engine\").AIChatOptionsResponseFormatDTO;\r\n\r\n export type AIRequestContextDTO =\r\n import(\"./ai/domain/engine\").AIRequestContextDTO;\r\n\r\n export type AIChatOptionsDTO =\r\n import(\"./ai/domain/engine\").AIChatOptionsDTO;\r\n\r\n export type AIIntentDTO =\r\n import(\"./ai/domain/engine\").AIIntentDTO;\r\n\r\n export type AICapabilityDTO =\r\n import(\"./ai/domain/engine\").AICapabilityDTO;\r\n\r\n export type AIPageContextDTO =\r\n import(\"./ai/domain/engine\").AIPageContextDTO;\r\n\r\n export type AIChatWithIntentOptionsDTO =\r\n import(\"./ai/domain/engine\").AIChatWithIntentOptionsDTO;\r\n\r\n export type AIPromptRoleDTO =\r\n import(\"./ai/domain/session\").AIPromptRoleDTO;\r\n\r\n export type AISessionConfigDTO =\r\n import(\"./ai/domain/session\").AISessionConfigDTO;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,cAAc,CAAC;","names":[]}
|
package/dist/domain.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type * from "./ai/domain/engine";
|
|
2
2
|
export type * from "./ai/domain/session";
|
|
3
|
+
export type * from "./ai/domain/chat";
|
|
3
4
|
/**
|
|
4
5
|
* Runtime value so consumers can use:
|
|
5
6
|
* import { ATDomainDTO } from "at-shared-types/domain";
|
|
@@ -11,6 +12,9 @@ export declare const ATDomainDTO: {};
|
|
|
11
12
|
* This is emitted correctly by tsc (not tsup dts bundler).
|
|
12
13
|
*/
|
|
13
14
|
export declare namespace ATDomainDTO {
|
|
15
|
+
type AIChatUsageDTO = import("./ai/domain/chat").AIChatUsageDTO;
|
|
16
|
+
type AIChatResponseDTO = import("./ai/domain/chat").AIChatResponseDTO;
|
|
17
|
+
type AIChatWithIntentResponseDTO = import("./ai/domain/chat").AIChatWithIntentResponseDTO;
|
|
14
18
|
type ATChatMessageContentDTO = import("./ai/domain/engine").ATChatMessageContentDTO;
|
|
15
19
|
type AIChatMessageDTO = import("./ai/domain/engine").AIChatMessageDTO;
|
|
16
20
|
type AIChatOptionsResponseFormatDTO = import("./ai/domain/engine").AIChatOptionsResponseFormatDTO;
|
package/dist/domain.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":"AAAA,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":"AAAA,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,kBAAkB,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,WAAW,IAAc,CAAC;AAEvC;;;GAGG;AACH,yBAAiB,WAAW,CAAC;IACzB,KAAY,cAAc,GACtB,OAAO,kBAAkB,EAAE,cAAc,CAAC;IAE9C,KAAY,iBAAiB,GACzB,OAAO,kBAAkB,EAAE,iBAAiB,CAAC;IAEjD,KAAY,2BAA2B,GACnC,OAAO,kBAAkB,EAAE,2BAA2B,CAAC;IAE3D,KAAY,uBAAuB,GAC/B,OAAO,oBAAoB,EAAE,uBAAuB,CAAC;IAEzD,KAAY,gBAAgB,GACxB,OAAO,oBAAoB,EAAE,gBAAgB,CAAC;IAElD,KAAY,8BAA8B,GACtC,OAAO,oBAAoB,EAAE,8BAA8B,CAAC;IAEhE,KAAY,mBAAmB,GAC3B,OAAO,oBAAoB,EAAE,mBAAmB,CAAC;IAErD,KAAY,gBAAgB,GACxB,OAAO,oBAAoB,EAAE,gBAAgB,CAAC;IAElD,KAAY,WAAW,GACnB,OAAO,oBAAoB,EAAE,WAAW,CAAC;IAE7C,KAAY,eAAe,GACvB,OAAO,oBAAoB,EAAE,eAAe,CAAC;IAEjD,KAAY,gBAAgB,GACxB,OAAO,oBAAoB,EAAE,gBAAgB,CAAC;IAElD,KAAY,0BAA0B,GAClC,OAAO,oBAAoB,EAAE,0BAA0B,CAAC;IAE5D,KAAY,eAAe,GACvB,OAAO,qBAAqB,EAAE,eAAe,CAAC;IAElD,KAAY,kBAAkB,GAC1B,OAAO,qBAAqB,EAAE,kBAAkB,CAAC;CACxD"}
|
package/dist/domain.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/domain.ts"],"sourcesContent":["export type * from \"./ai/domain/engine\";\r\nexport type * from \"./ai/domain/session\";\r\n\r\n/**\r\n * Runtime value so consumers can use:\r\n * import { ATDomainDTO } from \"at-shared-types/domain\";\r\n * ATDomainDTO.<autocomplete>\r\n */\r\nexport const ATDomainDTO = {} as const;\r\n\r\n/**\r\n * Merge types into the runtime value for dot-access.\r\n * This is emitted correctly by tsc (not tsup dts bundler).\r\n */\r\nexport namespace ATDomainDTO {\r\n export type ATChatMessageContentDTO =\r\n import(\"./ai/domain/engine\").ATChatMessageContentDTO;\r\n\r\n export type AIChatMessageDTO =\r\n import(\"./ai/domain/engine\").AIChatMessageDTO;\r\n\r\n export type AIChatOptionsResponseFormatDTO =\r\n import(\"./ai/domain/engine\").AIChatOptionsResponseFormatDTO;\r\n\r\n export type AIRequestContextDTO =\r\n import(\"./ai/domain/engine\").AIRequestContextDTO;\r\n\r\n export type AIChatOptionsDTO =\r\n import(\"./ai/domain/engine\").AIChatOptionsDTO;\r\n\r\n export type AIIntentDTO =\r\n import(\"./ai/domain/engine\").AIIntentDTO;\r\n\r\n export type AICapabilityDTO =\r\n import(\"./ai/domain/engine\").AICapabilityDTO;\r\n\r\n export type AIPageContextDTO =\r\n import(\"./ai/domain/engine\").AIPageContextDTO;\r\n\r\n export type AIChatWithIntentOptionsDTO =\r\n import(\"./ai/domain/engine\").AIChatWithIntentOptionsDTO;\r\n\r\n export type AIPromptRoleDTO =\r\n import(\"./ai/domain/session\").AIPromptRoleDTO;\r\n\r\n export type AISessionConfigDTO =\r\n import(\"./ai/domain/session\").AISessionConfigDTO;\r\n}\r\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/domain.ts"],"sourcesContent":["export type * from \"./ai/domain/engine\";\r\nexport type * from \"./ai/domain/session\";\r\nexport type * from \"./ai/domain/chat\";\r\n\r\n/**\r\n * Runtime value so consumers can use:\r\n * import { ATDomainDTO } from \"at-shared-types/domain\";\r\n * ATDomainDTO.<autocomplete>\r\n */\r\nexport const ATDomainDTO = {} as const;\r\n\r\n/**\r\n * Merge types into the runtime value for dot-access.\r\n * This is emitted correctly by tsc (not tsup dts bundler).\r\n */\r\nexport namespace ATDomainDTO {\r\n export type AIChatUsageDTO =\r\n import(\"./ai/domain/chat\").AIChatUsageDTO;\r\n\r\n export type AIChatResponseDTO =\r\n import(\"./ai/domain/chat\").AIChatResponseDTO;\r\n\r\n export type AIChatWithIntentResponseDTO =\r\n import(\"./ai/domain/chat\").AIChatWithIntentResponseDTO;\r\n\r\n export type ATChatMessageContentDTO =\r\n import(\"./ai/domain/engine\").ATChatMessageContentDTO;\r\n\r\n export type AIChatMessageDTO =\r\n import(\"./ai/domain/engine\").AIChatMessageDTO;\r\n\r\n export type AIChatOptionsResponseFormatDTO =\r\n import(\"./ai/domain/engine\").AIChatOptionsResponseFormatDTO;\r\n\r\n export type AIRequestContextDTO =\r\n import(\"./ai/domain/engine\").AIRequestContextDTO;\r\n\r\n export type AIChatOptionsDTO =\r\n import(\"./ai/domain/engine\").AIChatOptionsDTO;\r\n\r\n export type AIIntentDTO =\r\n import(\"./ai/domain/engine\").AIIntentDTO;\r\n\r\n export type AICapabilityDTO =\r\n import(\"./ai/domain/engine\").AICapabilityDTO;\r\n\r\n export type AIPageContextDTO =\r\n import(\"./ai/domain/engine\").AIPageContextDTO;\r\n\r\n export type AIChatWithIntentOptionsDTO =\r\n import(\"./ai/domain/engine\").AIChatWithIntentOptionsDTO;\r\n\r\n export type AIPromptRoleDTO =\r\n import(\"./ai/domain/session\").AIPromptRoleDTO;\r\n\r\n export type AISessionConfigDTO =\r\n import(\"./ai/domain/session\").AISessionConfigDTO;\r\n}\r\n"],"mappings":";;;AASO,IAAM,cAAc,CAAC;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -48,7 +48,8 @@ __export(case_runtime_exports, {
|
|
|
48
48
|
});
|
|
49
49
|
var CAMEL_TO_SNAKE = /[A-Z]/g;
|
|
50
50
|
var SNAKE_TO_CAMEL = /_([a-z])/g;
|
|
51
|
-
var
|
|
51
|
+
var normalizeAcronyms = (k) => k.replace(/ID/g, "Id");
|
|
52
|
+
var toSnakeKey = (k) => normalizeAcronyms(k).replace(CAMEL_TO_SNAKE, (m) => `_${m.toLowerCase()}`);
|
|
52
53
|
var toCamelKey = (k) => k.replace(SNAKE_TO_CAMEL, (_, c) => c.toUpperCase());
|
|
53
54
|
function toSnakeDeep(value, exceptions = /* @__PURE__ */ new Set()) {
|
|
54
55
|
if (Array.isArray(value)) return value.map((v) => toSnakeDeep(v, exceptions));
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/casing/index.ts","../src/casing/case.types.ts","../src/casing/case.runtime.ts"],"sourcesContent":["export * as ATCasing from \"./casing\";\r\n\r\n","// src/casing/index.ts\r\nexport * from \"./case.types\";\r\nexport * from \"./case.runtime\";\r\n\r\n// (optional) if you still like namespaces, keep them too:\r\nimport * as Types from \"./case.types\";\r\nimport * as Runtime from \"./case.runtime\";\r\nexport { Types, Runtime };\r\n","
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/casing/index.ts","../src/casing/case.types.ts","../src/casing/case.runtime.ts"],"sourcesContent":["export * as ATCasing from \"./casing\";\r\n\r\n","// src/casing/index.ts\r\nexport * from \"./case.types\";\r\nexport * from \"./case.runtime\";\r\n\r\n// (optional) if you still like namespaces, keep them too:\r\nimport * as Types from \"./case.types\";\r\nimport * as Runtime from \"./case.runtime\";\r\nexport { Types, Runtime };\r\n","type FixAcronyms<S extends string> =\r\n S extends `${infer A}ID${infer B}` ? FixAcronyms<`${A}Id${B}`> : S;\r\n\r\nexport type SnakeCase<S extends string> =\r\n S extends `${infer H}${infer T}`\r\n ? T extends Uncapitalize<T>\r\n ? `${Lowercase<H>}${SnakeCase<T>}`\r\n : `${Lowercase<H>}_${SnakeCase<Uncapitalize<T>>}`\r\n : S;\r\n\r\nexport type CamelCase<S extends string> =\r\n S extends `${infer A}_${infer B}`\r\n ? `${A}${Capitalize<CamelCase<B>>}`\r\n : S;\r\n\r\ntype Primitive = string | number | boolean | bigint | symbol | null | undefined;\r\ntype Builtin = Primitive | Date | RegExp | Error;\r\n\r\nexport type DeepSnakeKeys<T> =\r\n T extends Builtin ? T :\r\n T extends (...args: any[]) => any ? T :\r\n T extends readonly [any, ...any[]]\r\n ? { [I in keyof T]: DeepSnakeKeys<T[I]> } :\r\n T extends ReadonlyArray<infer U>\r\n ? ReadonlyArray<DeepSnakeKeys<U>> :\r\n T extends Map<infer K, infer V>\r\n ? Map<DeepSnakeKeys<K>, DeepSnakeKeys<V>> :\r\n T extends Set<infer U>\r\n ? Set<DeepSnakeKeys<U>> :\r\n T extends object\r\n ? {\r\n [K in keyof T as K extends string\r\n ? SnakeCase<FixAcronyms<K>>\r\n : K\r\n ]: DeepSnakeKeys<T[K]>\r\n }\r\n : T;\r\n\r\nexport type DeepCamelKeys<T> =\r\n T extends Builtin ? T :\r\n T extends (...args: any[]) => any ? T :\r\n T extends readonly [any, ...any[]]\r\n ? { [I in keyof T]: DeepCamelKeys<T[I]> } :\r\n T extends ReadonlyArray<infer U>\r\n ? ReadonlyArray<DeepCamelKeys<U>> :\r\n T extends Map<infer K, infer V>\r\n ? Map<DeepCamelKeys<K>, DeepCamelKeys<V>> :\r\n T extends Set<infer U>\r\n ? Set<DeepCamelKeys<U>> :\r\n T extends object\r\n ? { [K in keyof T as K extends string ? CamelCase<K> : K]: DeepCamelKeys<T[K]> }\r\n : T;\r\n","const CAMEL_TO_SNAKE = /[A-Z]/g;\r\nconst SNAKE_TO_CAMEL = /_([a-z])/g;\r\n\r\n// Normalize common acronyms before snake conversion\r\nconst normalizeAcronyms = (k: string) => k.replace(/ID/g, \"Id\");\r\n\r\nexport const toSnakeKey = (k: string) =>\r\n normalizeAcronyms(k).replace(CAMEL_TO_SNAKE, m => `_${m.toLowerCase()}`);\r\n\r\nexport const toCamelKey = (k: string) =>\r\n k.replace(SNAKE_TO_CAMEL, (_, c) => c.toUpperCase());\r\n\r\nexport function toSnakeDeep<T>(value: T, exceptions = new Set<string>()): any {\r\n if (Array.isArray(value)) return value.map(v => toSnakeDeep(v, exceptions));\r\n if (value instanceof Date) return value;\r\n if (value && typeof value === \"object\") {\r\n const out: Record<string, any> = {};\r\n for (const [k, v] of Object.entries(value as any)) {\r\n const nk = exceptions.has(k) ? k : toSnakeKey(k);\r\n out[nk] = toSnakeDeep(v, exceptions);\r\n }\r\n return out;\r\n }\r\n return value;\r\n}\r\n\r\nexport function toCamelDeep<T>(value: T): any {\r\n if (Array.isArray(value)) return value.map(toCamelDeep);\r\n if (value instanceof Date) return value;\r\n if (value && typeof value === \"object\") {\r\n const out: Record<string, any> = {};\r\n for (const [k, v] of Object.entries(value as any)) {\r\n out[toCamelKey(k)] = toCamelDeep(v);\r\n }\r\n return out;\r\n }\r\n return value;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AAGvB,IAAM,oBAAoB,CAAC,MAAc,EAAE,QAAQ,OAAO,IAAI;AAEvD,IAAM,aAAa,CAAC,MACvB,kBAAkB,CAAC,EAAE,QAAQ,gBAAgB,OAAK,IAAI,EAAE,YAAY,CAAC,EAAE;AAEpE,IAAM,aAAa,CAAC,MACvB,EAAE,QAAQ,gBAAgB,CAAC,GAAG,MAAM,EAAE,YAAY,CAAC;AAEhD,SAAS,YAAe,OAAU,aAAa,oBAAI,IAAY,GAAQ;AAC1E,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,OAAK,YAAY,GAAG,UAAU,CAAC;AAC1E,MAAI,iBAAiB,KAAM,QAAO;AAClC,MAAI,SAAS,OAAO,UAAU,UAAU;AACpC,UAAM,MAA2B,CAAC;AAClC,eAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,KAAY,GAAG;AAC/C,YAAM,KAAK,WAAW,IAAI,CAAC,IAAI,IAAI,WAAW,CAAC;AAC/C,UAAI,EAAE,IAAI,YAAY,GAAG,UAAU;AAAA,IACvC;AACA,WAAO;AAAA,EACX;AACA,SAAO;AACX;AAEO,SAAS,YAAe,OAAe;AAC1C,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,WAAW;AACtD,MAAI,iBAAiB,KAAM,QAAO;AAClC,MAAI,SAAS,OAAO,UAAU,UAAU;AACpC,UAAM,MAA2B,CAAC;AAClC,eAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,KAAY,GAAG;AAC/C,UAAI,WAAW,CAAC,CAAC,IAAI,YAAY,CAAC;AAAA,IACtC;AACA,WAAO;AAAA,EACX;AACA,SAAO;AACX;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -26,7 +26,8 @@ __export(case_runtime_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
var CAMEL_TO_SNAKE = /[A-Z]/g;
|
|
28
28
|
var SNAKE_TO_CAMEL = /_([a-z])/g;
|
|
29
|
-
var
|
|
29
|
+
var normalizeAcronyms = (k) => k.replace(/ID/g, "Id");
|
|
30
|
+
var toSnakeKey = (k) => normalizeAcronyms(k).replace(CAMEL_TO_SNAKE, (m) => `_${m.toLowerCase()}`);
|
|
30
31
|
var toCamelKey = (k) => k.replace(SNAKE_TO_CAMEL, (_, c) => c.toUpperCase());
|
|
31
32
|
function toSnakeDeep(value, exceptions = /* @__PURE__ */ new Set()) {
|
|
32
33
|
if (Array.isArray(value)) return value.map((v) => toSnakeDeep(v, exceptions));
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/casing/index.ts","../src/casing/case.types.ts","../src/casing/case.runtime.ts"],"sourcesContent":["// src/casing/index.ts\r\nexport * from \"./case.types\";\r\nexport * from \"./case.runtime\";\r\n\r\n// (optional) if you still like namespaces, keep them too:\r\nimport * as Types from \"./case.types\";\r\nimport * as Runtime from \"./case.runtime\";\r\nexport { Types, Runtime };\r\n","
|
|
1
|
+
{"version":3,"sources":["../src/casing/index.ts","../src/casing/case.types.ts","../src/casing/case.runtime.ts"],"sourcesContent":["// src/casing/index.ts\r\nexport * from \"./case.types\";\r\nexport * from \"./case.runtime\";\r\n\r\n// (optional) if you still like namespaces, keep them too:\r\nimport * as Types from \"./case.types\";\r\nimport * as Runtime from \"./case.runtime\";\r\nexport { Types, Runtime };\r\n","type FixAcronyms<S extends string> =\r\n S extends `${infer A}ID${infer B}` ? FixAcronyms<`${A}Id${B}`> : S;\r\n\r\nexport type SnakeCase<S extends string> =\r\n S extends `${infer H}${infer T}`\r\n ? T extends Uncapitalize<T>\r\n ? `${Lowercase<H>}${SnakeCase<T>}`\r\n : `${Lowercase<H>}_${SnakeCase<Uncapitalize<T>>}`\r\n : S;\r\n\r\nexport type CamelCase<S extends string> =\r\n S extends `${infer A}_${infer B}`\r\n ? `${A}${Capitalize<CamelCase<B>>}`\r\n : S;\r\n\r\ntype Primitive = string | number | boolean | bigint | symbol | null | undefined;\r\ntype Builtin = Primitive | Date | RegExp | Error;\r\n\r\nexport type DeepSnakeKeys<T> =\r\n T extends Builtin ? T :\r\n T extends (...args: any[]) => any ? T :\r\n T extends readonly [any, ...any[]]\r\n ? { [I in keyof T]: DeepSnakeKeys<T[I]> } :\r\n T extends ReadonlyArray<infer U>\r\n ? ReadonlyArray<DeepSnakeKeys<U>> :\r\n T extends Map<infer K, infer V>\r\n ? Map<DeepSnakeKeys<K>, DeepSnakeKeys<V>> :\r\n T extends Set<infer U>\r\n ? Set<DeepSnakeKeys<U>> :\r\n T extends object\r\n ? {\r\n [K in keyof T as K extends string\r\n ? SnakeCase<FixAcronyms<K>>\r\n : K\r\n ]: DeepSnakeKeys<T[K]>\r\n }\r\n : T;\r\n\r\nexport type DeepCamelKeys<T> =\r\n T extends Builtin ? T :\r\n T extends (...args: any[]) => any ? T :\r\n T extends readonly [any, ...any[]]\r\n ? { [I in keyof T]: DeepCamelKeys<T[I]> } :\r\n T extends ReadonlyArray<infer U>\r\n ? ReadonlyArray<DeepCamelKeys<U>> :\r\n T extends Map<infer K, infer V>\r\n ? Map<DeepCamelKeys<K>, DeepCamelKeys<V>> :\r\n T extends Set<infer U>\r\n ? Set<DeepCamelKeys<U>> :\r\n T extends object\r\n ? { [K in keyof T as K extends string ? CamelCase<K> : K]: DeepCamelKeys<T[K]> }\r\n : T;\r\n","const CAMEL_TO_SNAKE = /[A-Z]/g;\r\nconst SNAKE_TO_CAMEL = /_([a-z])/g;\r\n\r\n// Normalize common acronyms before snake conversion\r\nconst normalizeAcronyms = (k: string) => k.replace(/ID/g, \"Id\");\r\n\r\nexport const toSnakeKey = (k: string) =>\r\n normalizeAcronyms(k).replace(CAMEL_TO_SNAKE, m => `_${m.toLowerCase()}`);\r\n\r\nexport const toCamelKey = (k: string) =>\r\n k.replace(SNAKE_TO_CAMEL, (_, c) => c.toUpperCase());\r\n\r\nexport function toSnakeDeep<T>(value: T, exceptions = new Set<string>()): any {\r\n if (Array.isArray(value)) return value.map(v => toSnakeDeep(v, exceptions));\r\n if (value instanceof Date) return value;\r\n if (value && typeof value === \"object\") {\r\n const out: Record<string, any> = {};\r\n for (const [k, v] of Object.entries(value as any)) {\r\n const nk = exceptions.has(k) ? k : toSnakeKey(k);\r\n out[nk] = toSnakeDeep(v, exceptions);\r\n }\r\n return out;\r\n }\r\n return value;\r\n}\r\n\r\nexport function toCamelDeep<T>(value: T): any {\r\n if (Array.isArray(value)) return value.map(toCamelDeep);\r\n if (value instanceof Date) return value;\r\n if (value && typeof value === \"object\") {\r\n const out: Record<string, any> = {};\r\n for (const [k, v] of Object.entries(value as any)) {\r\n out[toCamelKey(k)] = toCamelDeep(v);\r\n }\r\n return out;\r\n }\r\n return value;\r\n}\r\n"],"mappings":";;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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