@xylex-group/athena 2.7.0 → 2.8.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 +218 -18
- package/dist/browser.cjs +2173 -675
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +8 -7
- package/dist/browser.d.ts +8 -7
- package/dist/browser.js +2167 -676
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +2068 -559
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +3 -3
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +2068 -559
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +2815 -945
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +2809 -946
- package/dist/index.js.map +1 -1
- package/dist/{model-form-AKYrgede.d.ts → model-form-Cx3wtvi8.d.ts} +963 -93
- package/dist/{model-form-ehfqLuG7.d.cts → model-form-_ugfOXao.d.cts} +963 -93
- package/dist/{pipeline-BfCWSRYl.d.cts → pipeline-BtD-Uo5X.d.cts} +1 -1
- package/dist/{pipeline-BUsR9XlO.d.ts → pipeline-yCIZNJHE.d.ts} +1 -1
- package/dist/{react-email-BQzmXBDE.d.cts → react-email-CiiSVa9F.d.cts} +121 -10
- package/dist/{react-email-BrVRp80B.d.ts → react-email-WN8UU3AL.d.ts} +121 -10
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/{types-t_TVqnmp.d.ts → types-89EfjLjV.d.cts} +48 -5
- package/dist/{types-BSIsyss1.d.cts → types-C2kiTt6-.d.ts} +48 -5
- package/dist/{types-BsyRW49r.d.cts → types-g8G6J0xE.d.cts} +26 -1
- package/dist/{types-BsyRW49r.d.ts → types-g8G6J0xE.d.ts} +26 -1
- package/package.json +28 -57
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { q as BackendType, I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-g8G6J0xE.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Supported case transformations for generated symbols and path token variants.
|
|
@@ -35,6 +35,13 @@ interface GeneratorExperimentalFlags {
|
|
|
35
35
|
*/
|
|
36
36
|
scyllaProviderContracts: boolean;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Internal generator metadata carried on normalized configs and generated
|
|
40
|
+
* registry artifacts so downstream tooling can detect contract revisions.
|
|
41
|
+
*/
|
|
42
|
+
interface GeneratorInternalConfig {
|
|
43
|
+
schemaVersion: number;
|
|
44
|
+
}
|
|
38
45
|
/**
|
|
39
46
|
* Path templates for each generated artifact category.
|
|
40
47
|
*/
|
|
@@ -44,10 +51,20 @@ interface GeneratorOutputTargets {
|
|
|
44
51
|
database: string;
|
|
45
52
|
registry: string;
|
|
46
53
|
}
|
|
54
|
+
type GeneratorOutputFormat = 'define-model' | 'table-builder';
|
|
47
55
|
/**
|
|
48
56
|
* Output configuration including dynamic placeholder aliases.
|
|
49
57
|
*/
|
|
50
58
|
interface GeneratorOutputConfig {
|
|
59
|
+
format?: GeneratorOutputFormat;
|
|
60
|
+
targets?: Partial<GeneratorOutputTargets>;
|
|
61
|
+
placeholderMap?: Record<string, string>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Normalized output configuration with defaults applied.
|
|
65
|
+
*/
|
|
66
|
+
interface NormalizedGeneratorOutputConfig {
|
|
67
|
+
format: GeneratorOutputFormat;
|
|
51
68
|
targets: GeneratorOutputTargets;
|
|
52
69
|
placeholderMap: Record<string, string>;
|
|
53
70
|
}
|
|
@@ -66,6 +83,13 @@ interface PostgresDirectProviderConfig {
|
|
|
66
83
|
database?: string;
|
|
67
84
|
schemas?: GeneratorSchemaSelection;
|
|
68
85
|
}
|
|
86
|
+
interface PostgresDirectProviderInputConfig {
|
|
87
|
+
kind: 'postgres';
|
|
88
|
+
mode: 'direct';
|
|
89
|
+
connectionString?: string;
|
|
90
|
+
database?: string;
|
|
91
|
+
schemas?: GeneratorSchemaSelection;
|
|
92
|
+
}
|
|
69
93
|
/**
|
|
70
94
|
* Athena gateway-backed PostgreSQL introspection mode using `/gateway/query`.
|
|
71
95
|
*/
|
|
@@ -78,6 +102,15 @@ interface PostgresGatewayProviderConfig {
|
|
|
78
102
|
schemas?: GeneratorSchemaSelection;
|
|
79
103
|
backend?: BackendType;
|
|
80
104
|
}
|
|
105
|
+
interface PostgresGatewayProviderInputConfig {
|
|
106
|
+
kind: 'postgres';
|
|
107
|
+
mode: 'gateway';
|
|
108
|
+
gatewayUrl?: string;
|
|
109
|
+
apiKey?: string;
|
|
110
|
+
database?: string;
|
|
111
|
+
schemas?: GeneratorSchemaSelection;
|
|
112
|
+
backend?: BackendType;
|
|
113
|
+
}
|
|
81
114
|
/**
|
|
82
115
|
* Scylla introspection provider contract placeholder (phase-two scaffold).
|
|
83
116
|
*/
|
|
@@ -88,13 +121,21 @@ interface ScyllaDirectProviderConfig {
|
|
|
88
121
|
keyspace: string;
|
|
89
122
|
datacenter?: string;
|
|
90
123
|
}
|
|
124
|
+
interface ScyllaDirectProviderInputConfig {
|
|
125
|
+
kind: 'scylla';
|
|
126
|
+
mode: 'direct';
|
|
127
|
+
contactPoints?: string[];
|
|
128
|
+
keyspace?: string;
|
|
129
|
+
datacenter?: string;
|
|
130
|
+
}
|
|
91
131
|
type GeneratorProviderConfig = PostgresDirectProviderConfig | PostgresGatewayProviderConfig | ScyllaDirectProviderConfig;
|
|
132
|
+
type GeneratorProviderInputConfig = PostgresDirectProviderInputConfig | PostgresGatewayProviderInputConfig | ScyllaDirectProviderInputConfig;
|
|
92
133
|
/**
|
|
93
134
|
* Root config contract loaded from `athena.config.ts`.
|
|
94
135
|
*/
|
|
95
136
|
interface AthenaGeneratorConfig {
|
|
96
|
-
provider:
|
|
97
|
-
output
|
|
137
|
+
provider: GeneratorProviderInputConfig;
|
|
138
|
+
output?: GeneratorOutputConfig;
|
|
98
139
|
naming?: Partial<GeneratorNamingConfig>;
|
|
99
140
|
features?: Partial<GeneratorFeatureFlags>;
|
|
100
141
|
experimental?: Partial<GeneratorExperimentalFlags>;
|
|
@@ -104,10 +145,11 @@ interface AthenaGeneratorConfig {
|
|
|
104
145
|
*/
|
|
105
146
|
interface NormalizedAthenaGeneratorConfig {
|
|
106
147
|
provider: GeneratorProviderConfig;
|
|
107
|
-
output:
|
|
148
|
+
output: NormalizedGeneratorOutputConfig;
|
|
108
149
|
naming: GeneratorNamingConfig;
|
|
109
150
|
features: GeneratorFeatureFlags;
|
|
110
151
|
experimental: GeneratorExperimentalFlags;
|
|
152
|
+
internal: GeneratorInternalConfig;
|
|
111
153
|
}
|
|
112
154
|
/**
|
|
113
155
|
* Config loader options for CLI/programmatic usage.
|
|
@@ -153,7 +195,8 @@ interface RunGeneratorOptions {
|
|
|
153
195
|
*/
|
|
154
196
|
interface RunGeneratorResult extends GeneratedArtifacts {
|
|
155
197
|
configPath: string;
|
|
198
|
+
config: NormalizedAthenaGeneratorConfig;
|
|
156
199
|
writtenFiles: string[];
|
|
157
200
|
}
|
|
158
201
|
|
|
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,
|
|
202
|
+
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, GeneratorInternalConfig as g, GeneratorNamingConfig as h, GeneratorOutputConfig as i, GeneratorOutputFormat as j, GeneratorOutputTargets as k, GeneratorSchemaSelection as l, NamingStyle as m, NormalizedGeneratorOutputConfig as n, RunGeneratorResult as o };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { q as BackendType, I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-g8G6J0xE.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Supported case transformations for generated symbols and path token variants.
|
|
@@ -35,6 +35,13 @@ interface GeneratorExperimentalFlags {
|
|
|
35
35
|
*/
|
|
36
36
|
scyllaProviderContracts: boolean;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Internal generator metadata carried on normalized configs and generated
|
|
40
|
+
* registry artifacts so downstream tooling can detect contract revisions.
|
|
41
|
+
*/
|
|
42
|
+
interface GeneratorInternalConfig {
|
|
43
|
+
schemaVersion: number;
|
|
44
|
+
}
|
|
38
45
|
/**
|
|
39
46
|
* Path templates for each generated artifact category.
|
|
40
47
|
*/
|
|
@@ -44,10 +51,20 @@ interface GeneratorOutputTargets {
|
|
|
44
51
|
database: string;
|
|
45
52
|
registry: string;
|
|
46
53
|
}
|
|
54
|
+
type GeneratorOutputFormat = 'define-model' | 'table-builder';
|
|
47
55
|
/**
|
|
48
56
|
* Output configuration including dynamic placeholder aliases.
|
|
49
57
|
*/
|
|
50
58
|
interface GeneratorOutputConfig {
|
|
59
|
+
format?: GeneratorOutputFormat;
|
|
60
|
+
targets?: Partial<GeneratorOutputTargets>;
|
|
61
|
+
placeholderMap?: Record<string, string>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Normalized output configuration with defaults applied.
|
|
65
|
+
*/
|
|
66
|
+
interface NormalizedGeneratorOutputConfig {
|
|
67
|
+
format: GeneratorOutputFormat;
|
|
51
68
|
targets: GeneratorOutputTargets;
|
|
52
69
|
placeholderMap: Record<string, string>;
|
|
53
70
|
}
|
|
@@ -66,6 +83,13 @@ interface PostgresDirectProviderConfig {
|
|
|
66
83
|
database?: string;
|
|
67
84
|
schemas?: GeneratorSchemaSelection;
|
|
68
85
|
}
|
|
86
|
+
interface PostgresDirectProviderInputConfig {
|
|
87
|
+
kind: 'postgres';
|
|
88
|
+
mode: 'direct';
|
|
89
|
+
connectionString?: string;
|
|
90
|
+
database?: string;
|
|
91
|
+
schemas?: GeneratorSchemaSelection;
|
|
92
|
+
}
|
|
69
93
|
/**
|
|
70
94
|
* Athena gateway-backed PostgreSQL introspection mode using `/gateway/query`.
|
|
71
95
|
*/
|
|
@@ -78,6 +102,15 @@ interface PostgresGatewayProviderConfig {
|
|
|
78
102
|
schemas?: GeneratorSchemaSelection;
|
|
79
103
|
backend?: BackendType;
|
|
80
104
|
}
|
|
105
|
+
interface PostgresGatewayProviderInputConfig {
|
|
106
|
+
kind: 'postgres';
|
|
107
|
+
mode: 'gateway';
|
|
108
|
+
gatewayUrl?: string;
|
|
109
|
+
apiKey?: string;
|
|
110
|
+
database?: string;
|
|
111
|
+
schemas?: GeneratorSchemaSelection;
|
|
112
|
+
backend?: BackendType;
|
|
113
|
+
}
|
|
81
114
|
/**
|
|
82
115
|
* Scylla introspection provider contract placeholder (phase-two scaffold).
|
|
83
116
|
*/
|
|
@@ -88,13 +121,21 @@ interface ScyllaDirectProviderConfig {
|
|
|
88
121
|
keyspace: string;
|
|
89
122
|
datacenter?: string;
|
|
90
123
|
}
|
|
124
|
+
interface ScyllaDirectProviderInputConfig {
|
|
125
|
+
kind: 'scylla';
|
|
126
|
+
mode: 'direct';
|
|
127
|
+
contactPoints?: string[];
|
|
128
|
+
keyspace?: string;
|
|
129
|
+
datacenter?: string;
|
|
130
|
+
}
|
|
91
131
|
type GeneratorProviderConfig = PostgresDirectProviderConfig | PostgresGatewayProviderConfig | ScyllaDirectProviderConfig;
|
|
132
|
+
type GeneratorProviderInputConfig = PostgresDirectProviderInputConfig | PostgresGatewayProviderInputConfig | ScyllaDirectProviderInputConfig;
|
|
92
133
|
/**
|
|
93
134
|
* Root config contract loaded from `athena.config.ts`.
|
|
94
135
|
*/
|
|
95
136
|
interface AthenaGeneratorConfig {
|
|
96
|
-
provider:
|
|
97
|
-
output
|
|
137
|
+
provider: GeneratorProviderInputConfig;
|
|
138
|
+
output?: GeneratorOutputConfig;
|
|
98
139
|
naming?: Partial<GeneratorNamingConfig>;
|
|
99
140
|
features?: Partial<GeneratorFeatureFlags>;
|
|
100
141
|
experimental?: Partial<GeneratorExperimentalFlags>;
|
|
@@ -104,10 +145,11 @@ interface AthenaGeneratorConfig {
|
|
|
104
145
|
*/
|
|
105
146
|
interface NormalizedAthenaGeneratorConfig {
|
|
106
147
|
provider: GeneratorProviderConfig;
|
|
107
|
-
output:
|
|
148
|
+
output: NormalizedGeneratorOutputConfig;
|
|
108
149
|
naming: GeneratorNamingConfig;
|
|
109
150
|
features: GeneratorFeatureFlags;
|
|
110
151
|
experimental: GeneratorExperimentalFlags;
|
|
152
|
+
internal: GeneratorInternalConfig;
|
|
111
153
|
}
|
|
112
154
|
/**
|
|
113
155
|
* Config loader options for CLI/programmatic usage.
|
|
@@ -153,7 +195,8 @@ interface RunGeneratorOptions {
|
|
|
153
195
|
*/
|
|
154
196
|
interface RunGeneratorResult extends GeneratedArtifacts {
|
|
155
197
|
configPath: string;
|
|
198
|
+
config: NormalizedAthenaGeneratorConfig;
|
|
156
199
|
writtenFiles: string[];
|
|
157
200
|
}
|
|
158
201
|
|
|
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,
|
|
202
|
+
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, GeneratorInternalConfig as g, GeneratorNamingConfig as h, GeneratorOutputConfig as i, GeneratorOutputFormat as j, GeneratorOutputTargets as k, GeneratorSchemaSelection as l, NamingStyle as m, NormalizedGeneratorOutputConfig as n, RunGeneratorResult as o };
|
|
@@ -113,6 +113,9 @@ interface AthenaRpcPayload<TArgs = AthenaJsonObject> {
|
|
|
113
113
|
offset?: number;
|
|
114
114
|
order?: AthenaRpcOrder;
|
|
115
115
|
}
|
|
116
|
+
interface AthenaQueryPayload {
|
|
117
|
+
query: string;
|
|
118
|
+
}
|
|
116
119
|
/** Backend type for Athena client (aligns with athena-rs) */
|
|
117
120
|
type BackendType = 'athena' | 'postgrest' | 'postgresql' | 'scylladb';
|
|
118
121
|
/** Backend config: type from SDK + backend-scoped options */
|
|
@@ -222,6 +225,21 @@ interface AthenaGatewayHookResult {
|
|
|
222
225
|
|
|
223
226
|
type ModelKey = string;
|
|
224
227
|
type ColumnKey = string;
|
|
228
|
+
/**
|
|
229
|
+
* Supported column helper families for table-builder definitions.
|
|
230
|
+
*/
|
|
231
|
+
type ModelColumnKind = 'boolean' | 'number' | 'string' | 'json' | 'enumeration';
|
|
232
|
+
/**
|
|
233
|
+
* Optional per-column metadata carried by model contracts.
|
|
234
|
+
*/
|
|
235
|
+
interface ModelColumnMetadata {
|
|
236
|
+
kind: ModelColumnKind;
|
|
237
|
+
columnName?: string;
|
|
238
|
+
nullable?: boolean;
|
|
239
|
+
hasDefault?: boolean;
|
|
240
|
+
isGenerated?: boolean;
|
|
241
|
+
enumValues?: readonly string[];
|
|
242
|
+
}
|
|
225
243
|
/**
|
|
226
244
|
* Runtime values that can safely be serialized into tenant-scoped headers.
|
|
227
245
|
*/
|
|
@@ -249,6 +267,7 @@ interface ModelMetadataBase {
|
|
|
249
267
|
tableName?: string;
|
|
250
268
|
primaryKey: string[];
|
|
251
269
|
nullable?: Partial<Record<string, boolean>>;
|
|
270
|
+
columns?: Partial<Record<string, ModelColumnMetadata>>;
|
|
252
271
|
relations?: Record<string, ModelRelationMetadata>;
|
|
253
272
|
}
|
|
254
273
|
/**
|
|
@@ -257,6 +276,7 @@ interface ModelMetadataBase {
|
|
|
257
276
|
type ModelMetadata<Row> = Omit<ModelMetadataBase, 'primaryKey' | 'nullable'> & {
|
|
258
277
|
primaryKey: Array<Extract<keyof Row, string>>;
|
|
259
278
|
nullable?: Partial<Record<Extract<keyof Row, string>, boolean>>;
|
|
279
|
+
columns?: Partial<Record<Extract<keyof Row, string>, ModelColumnMetadata>>;
|
|
260
280
|
};
|
|
261
281
|
/**
|
|
262
282
|
* Relation metadata for model contracts and introspection snapshots.
|
|
@@ -290,6 +310,11 @@ interface ModelDef<Row, Insert = Partial<Row>, Update = Partial<Insert>, Meta ex
|
|
|
290
310
|
* Row-agnostic model definition used as a generic constraint.
|
|
291
311
|
*/
|
|
292
312
|
type AnyModelDef = ModelDef<unknown, unknown, unknown, ModelMetadataBase>;
|
|
313
|
+
/**
|
|
314
|
+
* Public model/table value that carries Athena target metadata plus row/write typings.
|
|
315
|
+
* This can be passed directly to `client.from(...)` for opt-in target inference.
|
|
316
|
+
*/
|
|
317
|
+
type AthenaModelTarget<Row = unknown, Insert = unknown, Update = unknown> = ModelDef<Row, Insert, Update, ModelMetadataBase>;
|
|
293
318
|
/**
|
|
294
319
|
* Schema-level model registry.
|
|
295
320
|
*/
|
|
@@ -399,4 +424,4 @@ interface SchemaIntrospectionProvider {
|
|
|
399
424
|
inspect(options?: IntrospectionInspectOptions): Promise<IntrospectionSnapshot>;
|
|
400
425
|
}
|
|
401
426
|
|
|
402
|
-
export { type AthenaConditionCastType as A, Backend as B, type
|
|
427
|
+
export { type AthenaGatewayMethod as $, type AthenaConditionCastType as A, Backend as B, type ModelDef as C, type DatabaseDef as D, type ModelMetadata as E, type ModelRelationKind as F, type ModelRelationMetadata as G, type RowOf as H, type IntrospectionSnapshot as I, type SchemaDef as J, type TenantContextValue as K, type TenantKeyMap as L, type ModelAt as M, type AnyModelDef as N, type AthenaGatewayHookConfig as O, type AthenaGatewayHookResult as P, type AthenaDeletePayload as Q, type RegistryDef as R, type SchemaIntrospectionProvider as S, type TenantContext as T, type UpdateOf as U, type AthenaFetchPayload as V, type AthenaGatewayResponse as W, type AthenaInsertPayload as X, type AthenaUpdatePayload as Y, type AthenaQueryPayload as Z, type AthenaGatewayEndpointPath as _, type AthenaGatewayCallOptions as a, type AthenaConditionValue as a0, type AthenaConditionArrayValue as a1, type AthenaGatewayCondition as a2, type AthenaSortBy as a3, type AthenaConditionOperator as a4, type AthenaGatewayConnectionOptions as b, type AthenaGatewayConnectionResult as c, type AthenaGatewayErrorCode as d, type AthenaGatewayErrorDetails as e, type AthenaJsonArray as f, type AthenaJsonObject as g, type AthenaJsonPrimitive as h, type AthenaJsonValue as i, type AthenaModelTarget as j, type AthenaRpcCallOptions as k, type AthenaRpcFilter as l, type AthenaRpcFilterOperator as m, type AthenaRpcOrder as n, type AthenaRpcPayload as o, type BackendConfig as p, type BackendType as q, type InsertOf as r, type IntrospectionColumn as s, type IntrospectionInspectOptions as t, type IntrospectionRelation as u, type IntrospectionSchema as v, type IntrospectionTable as w, type IntrospectionTypeKind as x, type ModelColumnKind as y, type ModelColumnMetadata as z };
|
|
@@ -113,6 +113,9 @@ interface AthenaRpcPayload<TArgs = AthenaJsonObject> {
|
|
|
113
113
|
offset?: number;
|
|
114
114
|
order?: AthenaRpcOrder;
|
|
115
115
|
}
|
|
116
|
+
interface AthenaQueryPayload {
|
|
117
|
+
query: string;
|
|
118
|
+
}
|
|
116
119
|
/** Backend type for Athena client (aligns with athena-rs) */
|
|
117
120
|
type BackendType = 'athena' | 'postgrest' | 'postgresql' | 'scylladb';
|
|
118
121
|
/** Backend config: type from SDK + backend-scoped options */
|
|
@@ -222,6 +225,21 @@ interface AthenaGatewayHookResult {
|
|
|
222
225
|
|
|
223
226
|
type ModelKey = string;
|
|
224
227
|
type ColumnKey = string;
|
|
228
|
+
/**
|
|
229
|
+
* Supported column helper families for table-builder definitions.
|
|
230
|
+
*/
|
|
231
|
+
type ModelColumnKind = 'boolean' | 'number' | 'string' | 'json' | 'enumeration';
|
|
232
|
+
/**
|
|
233
|
+
* Optional per-column metadata carried by model contracts.
|
|
234
|
+
*/
|
|
235
|
+
interface ModelColumnMetadata {
|
|
236
|
+
kind: ModelColumnKind;
|
|
237
|
+
columnName?: string;
|
|
238
|
+
nullable?: boolean;
|
|
239
|
+
hasDefault?: boolean;
|
|
240
|
+
isGenerated?: boolean;
|
|
241
|
+
enumValues?: readonly string[];
|
|
242
|
+
}
|
|
225
243
|
/**
|
|
226
244
|
* Runtime values that can safely be serialized into tenant-scoped headers.
|
|
227
245
|
*/
|
|
@@ -249,6 +267,7 @@ interface ModelMetadataBase {
|
|
|
249
267
|
tableName?: string;
|
|
250
268
|
primaryKey: string[];
|
|
251
269
|
nullable?: Partial<Record<string, boolean>>;
|
|
270
|
+
columns?: Partial<Record<string, ModelColumnMetadata>>;
|
|
252
271
|
relations?: Record<string, ModelRelationMetadata>;
|
|
253
272
|
}
|
|
254
273
|
/**
|
|
@@ -257,6 +276,7 @@ interface ModelMetadataBase {
|
|
|
257
276
|
type ModelMetadata<Row> = Omit<ModelMetadataBase, 'primaryKey' | 'nullable'> & {
|
|
258
277
|
primaryKey: Array<Extract<keyof Row, string>>;
|
|
259
278
|
nullable?: Partial<Record<Extract<keyof Row, string>, boolean>>;
|
|
279
|
+
columns?: Partial<Record<Extract<keyof Row, string>, ModelColumnMetadata>>;
|
|
260
280
|
};
|
|
261
281
|
/**
|
|
262
282
|
* Relation metadata for model contracts and introspection snapshots.
|
|
@@ -290,6 +310,11 @@ interface ModelDef<Row, Insert = Partial<Row>, Update = Partial<Insert>, Meta ex
|
|
|
290
310
|
* Row-agnostic model definition used as a generic constraint.
|
|
291
311
|
*/
|
|
292
312
|
type AnyModelDef = ModelDef<unknown, unknown, unknown, ModelMetadataBase>;
|
|
313
|
+
/**
|
|
314
|
+
* Public model/table value that carries Athena target metadata plus row/write typings.
|
|
315
|
+
* This can be passed directly to `client.from(...)` for opt-in target inference.
|
|
316
|
+
*/
|
|
317
|
+
type AthenaModelTarget<Row = unknown, Insert = unknown, Update = unknown> = ModelDef<Row, Insert, Update, ModelMetadataBase>;
|
|
293
318
|
/**
|
|
294
319
|
* Schema-level model registry.
|
|
295
320
|
*/
|
|
@@ -399,4 +424,4 @@ interface SchemaIntrospectionProvider {
|
|
|
399
424
|
inspect(options?: IntrospectionInspectOptions): Promise<IntrospectionSnapshot>;
|
|
400
425
|
}
|
|
401
426
|
|
|
402
|
-
export { type AthenaConditionCastType as A, Backend as B, type
|
|
427
|
+
export { type AthenaGatewayMethod as $, type AthenaConditionCastType as A, Backend as B, type ModelDef as C, type DatabaseDef as D, type ModelMetadata as E, type ModelRelationKind as F, type ModelRelationMetadata as G, type RowOf as H, type IntrospectionSnapshot as I, type SchemaDef as J, type TenantContextValue as K, type TenantKeyMap as L, type ModelAt as M, type AnyModelDef as N, type AthenaGatewayHookConfig as O, type AthenaGatewayHookResult as P, type AthenaDeletePayload as Q, type RegistryDef as R, type SchemaIntrospectionProvider as S, type TenantContext as T, type UpdateOf as U, type AthenaFetchPayload as V, type AthenaGatewayResponse as W, type AthenaInsertPayload as X, type AthenaUpdatePayload as Y, type AthenaQueryPayload as Z, type AthenaGatewayEndpointPath as _, type AthenaGatewayCallOptions as a, type AthenaConditionValue as a0, type AthenaConditionArrayValue as a1, type AthenaGatewayCondition as a2, type AthenaSortBy as a3, type AthenaConditionOperator as a4, type AthenaGatewayConnectionOptions as b, type AthenaGatewayConnectionResult as c, type AthenaGatewayErrorCode as d, type AthenaGatewayErrorDetails as e, type AthenaJsonArray as f, type AthenaJsonObject as g, type AthenaJsonPrimitive as h, type AthenaJsonValue as i, type AthenaModelTarget as j, type AthenaRpcCallOptions as k, type AthenaRpcFilter as l, type AthenaRpcFilterOperator as m, type AthenaRpcOrder as n, type AthenaRpcPayload as o, type BackendConfig as p, type BackendType as q, type InsertOf as r, type IntrospectionColumn as s, type IntrospectionInspectOptions as t, type IntrospectionRelation as u, type IntrospectionSchema as v, type IntrospectionTable as w, type IntrospectionTypeKind as x, type ModelColumnKind as y, type ModelColumnMetadata as z };
|
package/package.json
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"cron-parser": "^4.9.0",
|
|
10
10
|
"pg": "^8.16.0",
|
|
11
11
|
"use-sync-external-store": "^1.5.0",
|
|
12
|
-
"uuid": "^9.0.1"
|
|
12
|
+
"uuid": "^9.0.1",
|
|
13
|
+
"zod": "^4.0.1"
|
|
13
14
|
},
|
|
14
15
|
"description": "Athena JS SDK",
|
|
15
16
|
"devDependencies": {
|
|
@@ -37,71 +38,41 @@
|
|
|
37
38
|
},
|
|
38
39
|
"exports": {
|
|
39
40
|
".": {
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
40
42
|
"browser": {
|
|
41
|
-
"
|
|
42
|
-
"import":
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
"require": {
|
|
47
|
-
"default": "./dist/browser.cjs",
|
|
48
|
-
"types": "./dist/browser.d.cts"
|
|
49
|
-
}
|
|
43
|
+
"types": "./dist/browser.d.ts",
|
|
44
|
+
"import": "./dist/browser.js",
|
|
45
|
+
"require": "./dist/browser.cjs",
|
|
46
|
+
"default": "./dist/browser.js"
|
|
50
47
|
},
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
"types": "./dist/index.d.ts"
|
|
55
|
-
},
|
|
56
|
-
"require": {
|
|
57
|
-
"default": "./dist/index.cjs",
|
|
58
|
-
"types": "./dist/index.d.cts"
|
|
59
|
-
}
|
|
48
|
+
"import": "./dist/index.js",
|
|
49
|
+
"require": "./dist/index.cjs",
|
|
50
|
+
"default": "./dist/index.js"
|
|
60
51
|
},
|
|
61
52
|
"./browser": {
|
|
62
|
-
"
|
|
63
|
-
"import":
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
"require": {
|
|
68
|
-
"default": "./dist/browser.cjs",
|
|
69
|
-
"types": "./dist/browser.d.cts"
|
|
70
|
-
}
|
|
53
|
+
"types": "./dist/browser.d.ts",
|
|
54
|
+
"import": "./dist/browser.js",
|
|
55
|
+
"require": "./dist/browser.cjs",
|
|
56
|
+
"default": "./dist/browser.js"
|
|
71
57
|
},
|
|
72
58
|
"./cookies": {
|
|
73
|
-
"
|
|
74
|
-
"import":
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
"require": {
|
|
79
|
-
"default": "./dist/cookies.cjs",
|
|
80
|
-
"types": "./dist/cookies.d.cts"
|
|
81
|
-
}
|
|
59
|
+
"types": "./dist/cookies.d.ts",
|
|
60
|
+
"import": "./dist/cookies.js",
|
|
61
|
+
"require": "./dist/cookies.cjs",
|
|
62
|
+
"default": "./dist/cookies.js"
|
|
82
63
|
},
|
|
83
64
|
"./package.json": "./package.json",
|
|
84
65
|
"./react": {
|
|
85
|
-
"
|
|
86
|
-
"import":
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
"require": {
|
|
91
|
-
"default": "./dist/react.cjs",
|
|
92
|
-
"types": "./dist/react.d.cts"
|
|
93
|
-
}
|
|
66
|
+
"types": "./dist/react.d.ts",
|
|
67
|
+
"import": "./dist/react.js",
|
|
68
|
+
"require": "./dist/react.cjs",
|
|
69
|
+
"default": "./dist/react.js"
|
|
94
70
|
},
|
|
95
71
|
"./utils": {
|
|
96
|
-
"
|
|
97
|
-
"import":
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
},
|
|
101
|
-
"require": {
|
|
102
|
-
"default": "./dist/utils.cjs",
|
|
103
|
-
"types": "./dist/utils.d.cts"
|
|
104
|
-
}
|
|
72
|
+
"types": "./dist/utils.d.ts",
|
|
73
|
+
"import": "./dist/utils.js",
|
|
74
|
+
"require": "./dist/utils.cjs",
|
|
75
|
+
"default": "./dist/utils.js"
|
|
105
76
|
}
|
|
106
77
|
},
|
|
107
78
|
"files": [
|
|
@@ -189,5 +160,5 @@
|
|
|
189
160
|
]
|
|
190
161
|
}
|
|
191
162
|
},
|
|
192
|
-
"version": "2.
|
|
193
|
-
}
|
|
163
|
+
"version": "2.8.2"
|
|
164
|
+
}
|