@xylex-group/athena 1.9.0 → 2.1.2
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/README.md +86 -68
- package/bin/athena-js.js +0 -0
- package/dist/browser.cjs +3319 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +25 -0
- package/dist/browser.d.ts +25 -0
- package/dist/browser.js +3276 -0
- package/dist/browser.js.map +1 -0
- package/dist/cli/index.cjs +1839 -275
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +3 -2
- package/dist/cli/index.d.ts +3 -2
- package/dist/cli/index.js +1840 -276
- package/dist/cli/index.js.map +1 -1
- package/dist/client-BX0NQqOn.d.ts +435 -0
- package/dist/client-dpAp-NZK.d.cts +435 -0
- package/dist/cookies.cjs +890 -0
- package/dist/cookies.cjs.map +1 -0
- package/dist/cookies.d.cts +174 -0
- package/dist/cookies.d.ts +174 -0
- package/dist/cookies.js +869 -0
- package/dist/cookies.js.map +1 -0
- package/dist/index.cjs +2724 -1777
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -641
- package/dist/index.d.ts +8 -641
- package/dist/index.js +2725 -1779
- package/dist/index.js.map +1 -1
- package/dist/model-form-2hqmoOUX.d.ts +1284 -0
- package/dist/model-form-Cy-zaO0u.d.cts +1284 -0
- package/dist/pipeline-BOPszLsL.d.ts +8 -0
- package/dist/pipeline-E3FDbs4W.d.cts +8 -0
- package/dist/react.cjs +93 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +38 -4
- package/dist/react.d.ts +38 -4
- package/dist/react.js +93 -1
- package/dist/react.js.map +1 -1
- package/dist/{types-BnzoaNRC.d.cts → types-BaBzjwXr.d.cts} +1 -1
- package/dist/{types-BnzoaNRC.d.ts → types-BaBzjwXr.d.ts} +1 -1
- package/dist/{pipeline-CQgV-Yfo.d.ts → types-CeBPrnGj.d.ts} +2 -7
- package/dist/{pipeline-C-cN0ACi.d.cts → types-CpqL-pZx.d.cts} +2 -7
- package/package.json +36 -17
- package/dist/model-form-Bm_kqCn2.d.ts +0 -92
- package/dist/model-form-DkS48fsh.d.cts +0 -92
|
@@ -377,4 +377,4 @@ interface SchemaIntrospectionProvider {
|
|
|
377
377
|
inspect(options?: IntrospectionInspectOptions): Promise<IntrospectionSnapshot>;
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
export { type
|
|
380
|
+
export { type AthenaConditionCastType as A, Backend as B, type SchemaDef as C, type DatabaseDef as D, type TenantContextValue as E, type TenantKeyMap as F, type AthenaConditionValue as G, type AthenaConditionArrayValue as H, type IntrospectionSnapshot as I, type AthenaConditionOperator as J, type AnyModelDef as K, type AthenaGatewayHookConfig as L, type ModelAt as M, type AthenaGatewayHookResult as N, type AthenaDeletePayload as O, type AthenaFetchPayload as P, type AthenaGatewayResponse as Q, type RegistryDef as R, type SchemaIntrospectionProvider as S, type TenantContext as T, type UpdateOf as U, type AthenaInsertPayload as V, type AthenaUpdatePayload as W, type AthenaGatewayEndpointPath as X, type AthenaGatewayMethod as Y, type AthenaGatewayCallOptions as a, type AthenaGatewayErrorCode as b, type AthenaGatewayErrorDetails as c, type AthenaJsonArray as d, type AthenaJsonObject as e, type AthenaJsonPrimitive as f, type AthenaJsonValue as g, type AthenaRpcCallOptions as h, type AthenaRpcFilter as i, type AthenaRpcFilterOperator as j, type AthenaRpcOrder as k, type AthenaRpcPayload as l, type BackendConfig as m, type BackendType as n, type InsertOf as o, type IntrospectionColumn as p, type IntrospectionInspectOptions as q, type IntrospectionRelation as r, type IntrospectionSchema as s, type IntrospectionTable as t, type IntrospectionTypeKind as u, type ModelDef as v, type ModelMetadata as w, type ModelRelationKind as x, type ModelRelationMetadata as y, type RowOf as z };
|
|
@@ -377,4 +377,4 @@ interface SchemaIntrospectionProvider {
|
|
|
377
377
|
inspect(options?: IntrospectionInspectOptions): Promise<IntrospectionSnapshot>;
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
export { type
|
|
380
|
+
export { type AthenaConditionCastType as A, Backend as B, type SchemaDef as C, type DatabaseDef as D, type TenantContextValue as E, type TenantKeyMap as F, type AthenaConditionValue as G, type AthenaConditionArrayValue as H, type IntrospectionSnapshot as I, type AthenaConditionOperator as J, type AnyModelDef as K, type AthenaGatewayHookConfig as L, type ModelAt as M, type AthenaGatewayHookResult as N, type AthenaDeletePayload as O, type AthenaFetchPayload as P, type AthenaGatewayResponse as Q, type RegistryDef as R, type SchemaIntrospectionProvider as S, type TenantContext as T, type UpdateOf as U, type AthenaInsertPayload as V, type AthenaUpdatePayload as W, type AthenaGatewayEndpointPath as X, type AthenaGatewayMethod as Y, type AthenaGatewayCallOptions as a, type AthenaGatewayErrorCode as b, type AthenaGatewayErrorDetails as c, type AthenaJsonArray as d, type AthenaJsonObject as e, type AthenaJsonPrimitive as f, type AthenaJsonValue as g, type AthenaRpcCallOptions as h, type AthenaRpcFilter as i, type AthenaRpcFilterOperator as j, type AthenaRpcOrder as k, type AthenaRpcPayload as l, type BackendConfig as m, type BackendType as n, type InsertOf as o, type IntrospectionColumn as p, type IntrospectionInspectOptions as q, type IntrospectionRelation as r, type IntrospectionSchema as s, type IntrospectionTable as t, type IntrospectionTypeKind as u, type ModelDef as v, type ModelMetadata as w, type ModelRelationKind as x, type ModelRelationMetadata as y, type RowOf as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as BackendType, I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-BaBzjwXr.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Supported case transformations for generated symbols and path token variants.
|
|
@@ -156,9 +156,4 @@ interface RunGeneratorResult extends GeneratedArtifacts {
|
|
|
156
156
|
writtenFiles: string[];
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
* End-to-end generator execution: load config, introspect, render, and optionally write files.
|
|
161
|
-
*/
|
|
162
|
-
declare function runSchemaGenerator(options?: RunGeneratorOptions): Promise<RunGeneratorResult>;
|
|
163
|
-
|
|
164
|
-
export { type AthenaGeneratorConfig as A, type GeneratedArtifacts as G, type LoadGeneratorConfigOptions as L, type NormalizedAthenaGeneratorConfig as N, type RunGeneratorOptions as R, type LoadedGeneratorConfig as a, type GeneratorProviderConfig as b, type GeneratorExperimentalFlags as c, type GeneratorSchemaSelection as d, type GeneratedArtifact as e, type GeneratorArtifactKind as f, type GeneratorFeatureFlags as g, type GeneratorNamingConfig as h, type GeneratorOutputConfig as i, type GeneratorOutputTargets as j, type NamingStyle as k, type RunGeneratorResult as l, runSchemaGenerator as r };
|
|
159
|
+
export type { AthenaGeneratorConfig as A, GeneratedArtifacts as G, LoadGeneratorConfigOptions as L, NormalizedAthenaGeneratorConfig as N, RunGeneratorOptions as R, LoadedGeneratorConfig as a, GeneratorProviderConfig as b, GeneratorExperimentalFlags as c, GeneratedArtifact as d, GeneratorArtifactKind as e, GeneratorFeatureFlags as f, GeneratorNamingConfig as g, GeneratorOutputConfig as h, GeneratorOutputTargets as i, GeneratorSchemaSelection as j, NamingStyle as k, RunGeneratorResult as l };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as BackendType, I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-BaBzjwXr.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Supported case transformations for generated symbols and path token variants.
|
|
@@ -156,9 +156,4 @@ interface RunGeneratorResult extends GeneratedArtifacts {
|
|
|
156
156
|
writtenFiles: string[];
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
* End-to-end generator execution: load config, introspect, render, and optionally write files.
|
|
161
|
-
*/
|
|
162
|
-
declare function runSchemaGenerator(options?: RunGeneratorOptions): Promise<RunGeneratorResult>;
|
|
163
|
-
|
|
164
|
-
export { type AthenaGeneratorConfig as A, type GeneratedArtifacts as G, type LoadGeneratorConfigOptions as L, type NormalizedAthenaGeneratorConfig as N, type RunGeneratorOptions as R, type LoadedGeneratorConfig as a, type GeneratorProviderConfig as b, type GeneratorExperimentalFlags as c, type GeneratorSchemaSelection as d, type GeneratedArtifact as e, type GeneratorArtifactKind as f, type GeneratorFeatureFlags as g, type GeneratorNamingConfig as h, type GeneratorOutputConfig as i, type GeneratorOutputTargets as j, type NamingStyle as k, type RunGeneratorResult as l, runSchemaGenerator as r };
|
|
159
|
+
export type { AthenaGeneratorConfig as A, GeneratedArtifacts as G, LoadGeneratorConfigOptions as L, NormalizedAthenaGeneratorConfig as N, RunGeneratorOptions as R, LoadedGeneratorConfig as a, GeneratorProviderConfig as b, GeneratorExperimentalFlags as c, GeneratedArtifact as d, GeneratorArtifactKind as e, GeneratorFeatureFlags as f, GeneratorNamingConfig as g, GeneratorOutputConfig as h, GeneratorOutputTargets as i, GeneratorSchemaSelection as j, NamingStyle as k, RunGeneratorResult as l };
|
package/package.json
CHANGED
|
@@ -35,10 +35,24 @@
|
|
|
35
35
|
},
|
|
36
36
|
"exports": {
|
|
37
37
|
".": {
|
|
38
|
+
"browser": {
|
|
39
|
+
"import": "./dist/browser.js",
|
|
40
|
+
"require": "./dist/browser.cjs"
|
|
41
|
+
},
|
|
38
42
|
"import": "./dist/index.js",
|
|
39
43
|
"require": "./dist/index.cjs",
|
|
40
44
|
"types": "./dist/index.d.ts"
|
|
41
45
|
},
|
|
46
|
+
"./browser": {
|
|
47
|
+
"import": "./dist/browser.js",
|
|
48
|
+
"require": "./dist/browser.cjs",
|
|
49
|
+
"types": "./dist/browser.d.ts"
|
|
50
|
+
},
|
|
51
|
+
"./cookies": {
|
|
52
|
+
"import": "./dist/cookies.js",
|
|
53
|
+
"require": "./dist/cookies.cjs",
|
|
54
|
+
"types": "./dist/cookies.d.ts"
|
|
55
|
+
},
|
|
42
56
|
"./react": {
|
|
43
57
|
"import": "./dist/react.js",
|
|
44
58
|
"require": "./dist/react.cjs",
|
|
@@ -79,6 +93,25 @@
|
|
|
79
93
|
"type": "git",
|
|
80
94
|
"url": "git+https://github.com/xylex-group/athena-js.git"
|
|
81
95
|
},
|
|
96
|
+
"type": "module",
|
|
97
|
+
"types": "./dist/index.d.ts",
|
|
98
|
+
"typesVersions": {
|
|
99
|
+
"*": {
|
|
100
|
+
"*": [
|
|
101
|
+
"dist/index.d.ts"
|
|
102
|
+
],
|
|
103
|
+
"browser": [
|
|
104
|
+
"dist/browser.d.ts"
|
|
105
|
+
],
|
|
106
|
+
"cookies": [
|
|
107
|
+
"dist/cookies.d.ts"
|
|
108
|
+
],
|
|
109
|
+
"react": [
|
|
110
|
+
"dist/react.d.ts"
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"version": "2.1.2",
|
|
82
115
|
"scripts": {
|
|
83
116
|
"build": "tsup",
|
|
84
117
|
"check:all": "pnpm lint && pnpm typecheck && pnpm test && pnpm build",
|
|
@@ -92,24 +125,10 @@
|
|
|
92
125
|
"example:retry-patterns": "cd examples/retry-patterns && bun run start",
|
|
93
126
|
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
94
127
|
"lint:fix": "pnpm lint -- --fix",
|
|
95
|
-
"prepublishOnly": "pnpm typecheck && pnpm build",
|
|
96
128
|
"publish:token": "node scripts/publish.js",
|
|
97
|
-
"test": "node --import tsx --test test/*.test.ts",
|
|
129
|
+
"test": "node --preserve-symlinks --import tsx --test --test-force-exit test/*.test.ts",
|
|
98
130
|
"test:integration:postgres": "node scripts/run-postgres-introspection-test.mjs",
|
|
99
|
-
"test:watch": "node --import tsx --test --watch test/*.test.ts",
|
|
131
|
+
"test:watch": "node --preserve-symlinks --import tsx --test --watch test/*.test.ts",
|
|
100
132
|
"typecheck": "tsc -p tsconfig.typecheck.json"
|
|
101
|
-
}
|
|
102
|
-
"type": "module",
|
|
103
|
-
"types": "./dist/index.d.ts",
|
|
104
|
-
"typesVersions": {
|
|
105
|
-
"*": {
|
|
106
|
-
"*": [
|
|
107
|
-
"dist/index.d.ts"
|
|
108
|
-
],
|
|
109
|
-
"react": [
|
|
110
|
-
"dist/react.d.ts"
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
"version": "1.9.0"
|
|
133
|
+
}
|
|
115
134
|
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { r as AthenaGatewayErrorCode, X as AthenaGatewayEndpointPath, Y as AthenaGatewayMethod, g as AthenaGatewayErrorDetails, Q as AthenaGatewayResponse, j as AnyModelDef, m as RowOf, I as InsertOf, U as UpdateOf } from './types-BnzoaNRC.js';
|
|
2
|
-
|
|
3
|
-
interface AthenaGatewayErrorInput {
|
|
4
|
-
code: AthenaGatewayErrorCode;
|
|
5
|
-
message: string;
|
|
6
|
-
status?: number;
|
|
7
|
-
endpoint?: AthenaGatewayEndpointPath;
|
|
8
|
-
method?: AthenaGatewayMethod;
|
|
9
|
-
requestId?: string;
|
|
10
|
-
hint?: string;
|
|
11
|
-
cause?: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Canonical error for gateway failures.
|
|
15
|
-
* Holds request context and machine-readable classification.
|
|
16
|
-
*/
|
|
17
|
-
declare class AthenaGatewayError extends Error {
|
|
18
|
-
readonly code: AthenaGatewayErrorCode;
|
|
19
|
-
readonly status: number;
|
|
20
|
-
readonly endpoint?: AthenaGatewayEndpointPath;
|
|
21
|
-
readonly method?: AthenaGatewayMethod;
|
|
22
|
-
readonly requestId?: string;
|
|
23
|
-
readonly hint?: string;
|
|
24
|
-
readonly causeDetail?: string;
|
|
25
|
-
constructor(input: AthenaGatewayErrorInput);
|
|
26
|
-
toDetails(): AthenaGatewayErrorDetails;
|
|
27
|
-
static fromResponse<T>(response: AthenaGatewayResponse<T>, fallback: Omit<AthenaGatewayErrorInput, 'code' | 'message' | 'status'>): AthenaGatewayError;
|
|
28
|
-
}
|
|
29
|
-
declare function isAthenaGatewayError(error: unknown): error is AthenaGatewayError;
|
|
30
|
-
|
|
31
|
-
type ModelFormNullishMode = 'empty-string' | 'undefined' | 'null';
|
|
32
|
-
type NullishValueByMode = {
|
|
33
|
-
'empty-string': '';
|
|
34
|
-
undefined: undefined;
|
|
35
|
-
null: null;
|
|
36
|
-
};
|
|
37
|
-
type MapNullableToFormValue<TField, TMode extends ModelFormNullishMode> = null extends TField ? Exclude<TField, null> | NullishValueByMode[TMode] : TField;
|
|
38
|
-
/**
|
|
39
|
-
* Form value shape derived from a model insert payload.
|
|
40
|
-
* Nullable fields are remapped to the selected nullish representation.
|
|
41
|
-
*/
|
|
42
|
-
type ModelFormValues<TModel extends AnyModelDef, TMode extends ModelFormNullishMode = 'empty-string'> = {
|
|
43
|
-
[K in keyof InsertOf<TModel>]: MapNullableToFormValue<InsertOf<TModel>[K], TMode>;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Default value shape for form initialization.
|
|
47
|
-
*/
|
|
48
|
-
type ModelFormDefaults<TModel extends AnyModelDef, TMode extends ModelFormNullishMode = 'empty-string'> = Partial<ModelFormValues<TModel, TMode>>;
|
|
49
|
-
interface ToModelFormDefaultsOptions<TMode extends ModelFormNullishMode = 'empty-string'> {
|
|
50
|
-
/**
|
|
51
|
-
* Controls how nullable model values are represented in form defaults.
|
|
52
|
-
* - `empty-string` (default): `null -> ""`
|
|
53
|
-
* - `undefined`: `null -> undefined`
|
|
54
|
-
* - `null`: keeps `null`
|
|
55
|
-
*/
|
|
56
|
-
nullishMode?: TMode;
|
|
57
|
-
}
|
|
58
|
-
interface ToModelPayloadOptions {
|
|
59
|
-
/**
|
|
60
|
-
* Converts `""` into `null` for nullable model fields.
|
|
61
|
-
* Defaults to `true`.
|
|
62
|
-
*/
|
|
63
|
-
emptyStringAsNull?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Omits `undefined` keys from the outgoing payload.
|
|
66
|
-
* Defaults to `true`.
|
|
67
|
-
*/
|
|
68
|
-
stripUndefined?: boolean;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Normalizes model data into form-safe defaults using model nullability metadata.
|
|
72
|
-
*/
|
|
73
|
-
declare function toModelFormDefaults<TModel extends AnyModelDef, TMode extends ModelFormNullishMode = 'empty-string'>(model: TModel, values?: Partial<RowOf<TModel>> | Partial<InsertOf<TModel>> | null, options?: ToModelFormDefaultsOptions<TMode>): ModelFormDefaults<TModel, TMode>;
|
|
74
|
-
/**
|
|
75
|
-
* Normalizes form values back into model-compatible insert/update payloads.
|
|
76
|
-
*/
|
|
77
|
-
declare function toModelPayload<TModel extends AnyModelDef>(model: TModel, formValues: Partial<ModelFormValues<TModel, 'empty-string' | 'undefined' | 'null'>>, options?: ToModelPayloadOptions): Partial<InsertOf<TModel>>;
|
|
78
|
-
/**
|
|
79
|
-
* Runtime form adapter bound to a model contract.
|
|
80
|
-
*/
|
|
81
|
-
interface ModelFormAdapter<TModel extends AnyModelDef> {
|
|
82
|
-
model: TModel;
|
|
83
|
-
toDefaults<TMode extends ModelFormNullishMode = 'empty-string'>(values?: Partial<RowOf<TModel>> | Partial<InsertOf<TModel>> | null, options?: ToModelFormDefaultsOptions<TMode>): ModelFormDefaults<TModel, TMode>;
|
|
84
|
-
toInsert(values: Partial<ModelFormValues<TModel, 'empty-string' | 'undefined' | 'null'>>, options?: ToModelPayloadOptions): Partial<InsertOf<TModel>>;
|
|
85
|
-
toUpdate(values: Partial<ModelFormValues<TModel, 'empty-string' | 'undefined' | 'null'>>, options?: ToModelPayloadOptions): Partial<UpdateOf<TModel>>;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Creates a small model-aware adapter for form defaults and payload normalization.
|
|
89
|
-
*/
|
|
90
|
-
declare function createModelFormAdapter<TModel extends AnyModelDef>(model: TModel): ModelFormAdapter<TModel>;
|
|
91
|
-
|
|
92
|
-
export { AthenaGatewayError as A, type ModelFormAdapter as M, type ToModelFormDefaultsOptions as T, type ModelFormDefaults as a, type ModelFormNullishMode as b, type ModelFormValues as c, type ToModelPayloadOptions as d, createModelFormAdapter as e, toModelPayload as f, isAthenaGatewayError as i, toModelFormDefaults as t };
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { r as AthenaGatewayErrorCode, X as AthenaGatewayEndpointPath, Y as AthenaGatewayMethod, g as AthenaGatewayErrorDetails, Q as AthenaGatewayResponse, j as AnyModelDef, m as RowOf, I as InsertOf, U as UpdateOf } from './types-BnzoaNRC.cjs';
|
|
2
|
-
|
|
3
|
-
interface AthenaGatewayErrorInput {
|
|
4
|
-
code: AthenaGatewayErrorCode;
|
|
5
|
-
message: string;
|
|
6
|
-
status?: number;
|
|
7
|
-
endpoint?: AthenaGatewayEndpointPath;
|
|
8
|
-
method?: AthenaGatewayMethod;
|
|
9
|
-
requestId?: string;
|
|
10
|
-
hint?: string;
|
|
11
|
-
cause?: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Canonical error for gateway failures.
|
|
15
|
-
* Holds request context and machine-readable classification.
|
|
16
|
-
*/
|
|
17
|
-
declare class AthenaGatewayError extends Error {
|
|
18
|
-
readonly code: AthenaGatewayErrorCode;
|
|
19
|
-
readonly status: number;
|
|
20
|
-
readonly endpoint?: AthenaGatewayEndpointPath;
|
|
21
|
-
readonly method?: AthenaGatewayMethod;
|
|
22
|
-
readonly requestId?: string;
|
|
23
|
-
readonly hint?: string;
|
|
24
|
-
readonly causeDetail?: string;
|
|
25
|
-
constructor(input: AthenaGatewayErrorInput);
|
|
26
|
-
toDetails(): AthenaGatewayErrorDetails;
|
|
27
|
-
static fromResponse<T>(response: AthenaGatewayResponse<T>, fallback: Omit<AthenaGatewayErrorInput, 'code' | 'message' | 'status'>): AthenaGatewayError;
|
|
28
|
-
}
|
|
29
|
-
declare function isAthenaGatewayError(error: unknown): error is AthenaGatewayError;
|
|
30
|
-
|
|
31
|
-
type ModelFormNullishMode = 'empty-string' | 'undefined' | 'null';
|
|
32
|
-
type NullishValueByMode = {
|
|
33
|
-
'empty-string': '';
|
|
34
|
-
undefined: undefined;
|
|
35
|
-
null: null;
|
|
36
|
-
};
|
|
37
|
-
type MapNullableToFormValue<TField, TMode extends ModelFormNullishMode> = null extends TField ? Exclude<TField, null> | NullishValueByMode[TMode] : TField;
|
|
38
|
-
/**
|
|
39
|
-
* Form value shape derived from a model insert payload.
|
|
40
|
-
* Nullable fields are remapped to the selected nullish representation.
|
|
41
|
-
*/
|
|
42
|
-
type ModelFormValues<TModel extends AnyModelDef, TMode extends ModelFormNullishMode = 'empty-string'> = {
|
|
43
|
-
[K in keyof InsertOf<TModel>]: MapNullableToFormValue<InsertOf<TModel>[K], TMode>;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Default value shape for form initialization.
|
|
47
|
-
*/
|
|
48
|
-
type ModelFormDefaults<TModel extends AnyModelDef, TMode extends ModelFormNullishMode = 'empty-string'> = Partial<ModelFormValues<TModel, TMode>>;
|
|
49
|
-
interface ToModelFormDefaultsOptions<TMode extends ModelFormNullishMode = 'empty-string'> {
|
|
50
|
-
/**
|
|
51
|
-
* Controls how nullable model values are represented in form defaults.
|
|
52
|
-
* - `empty-string` (default): `null -> ""`
|
|
53
|
-
* - `undefined`: `null -> undefined`
|
|
54
|
-
* - `null`: keeps `null`
|
|
55
|
-
*/
|
|
56
|
-
nullishMode?: TMode;
|
|
57
|
-
}
|
|
58
|
-
interface ToModelPayloadOptions {
|
|
59
|
-
/**
|
|
60
|
-
* Converts `""` into `null` for nullable model fields.
|
|
61
|
-
* Defaults to `true`.
|
|
62
|
-
*/
|
|
63
|
-
emptyStringAsNull?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Omits `undefined` keys from the outgoing payload.
|
|
66
|
-
* Defaults to `true`.
|
|
67
|
-
*/
|
|
68
|
-
stripUndefined?: boolean;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Normalizes model data into form-safe defaults using model nullability metadata.
|
|
72
|
-
*/
|
|
73
|
-
declare function toModelFormDefaults<TModel extends AnyModelDef, TMode extends ModelFormNullishMode = 'empty-string'>(model: TModel, values?: Partial<RowOf<TModel>> | Partial<InsertOf<TModel>> | null, options?: ToModelFormDefaultsOptions<TMode>): ModelFormDefaults<TModel, TMode>;
|
|
74
|
-
/**
|
|
75
|
-
* Normalizes form values back into model-compatible insert/update payloads.
|
|
76
|
-
*/
|
|
77
|
-
declare function toModelPayload<TModel extends AnyModelDef>(model: TModel, formValues: Partial<ModelFormValues<TModel, 'empty-string' | 'undefined' | 'null'>>, options?: ToModelPayloadOptions): Partial<InsertOf<TModel>>;
|
|
78
|
-
/**
|
|
79
|
-
* Runtime form adapter bound to a model contract.
|
|
80
|
-
*/
|
|
81
|
-
interface ModelFormAdapter<TModel extends AnyModelDef> {
|
|
82
|
-
model: TModel;
|
|
83
|
-
toDefaults<TMode extends ModelFormNullishMode = 'empty-string'>(values?: Partial<RowOf<TModel>> | Partial<InsertOf<TModel>> | null, options?: ToModelFormDefaultsOptions<TMode>): ModelFormDefaults<TModel, TMode>;
|
|
84
|
-
toInsert(values: Partial<ModelFormValues<TModel, 'empty-string' | 'undefined' | 'null'>>, options?: ToModelPayloadOptions): Partial<InsertOf<TModel>>;
|
|
85
|
-
toUpdate(values: Partial<ModelFormValues<TModel, 'empty-string' | 'undefined' | 'null'>>, options?: ToModelPayloadOptions): Partial<UpdateOf<TModel>>;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Creates a small model-aware adapter for form defaults and payload normalization.
|
|
89
|
-
*/
|
|
90
|
-
declare function createModelFormAdapter<TModel extends AnyModelDef>(model: TModel): ModelFormAdapter<TModel>;
|
|
91
|
-
|
|
92
|
-
export { AthenaGatewayError as A, type ModelFormAdapter as M, type ToModelFormDefaultsOptions as T, type ModelFormDefaults as a, type ModelFormNullishMode as b, type ModelFormValues as c, type ToModelPayloadOptions as d, createModelFormAdapter as e, toModelPayload as f, isAthenaGatewayError as i, toModelFormDefaults as t };
|