@xylex-group/athena 2.11.0 → 2.12.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.
Files changed (62) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.cjs +299 -240
  3. package/dist/browser.cjs.map +1 -1
  4. package/dist/browser.d.cts +9 -8
  5. package/dist/browser.d.ts +9 -8
  6. package/dist/browser.js +299 -240
  7. package/dist/browser.js.map +1 -1
  8. package/dist/cli/index.cjs +272 -240
  9. package/dist/cli/index.cjs.map +1 -1
  10. package/dist/cli/index.d.cts +4 -3
  11. package/dist/cli/index.d.ts +4 -3
  12. package/dist/cli/index.js +272 -240
  13. package/dist/cli/index.js.map +1 -1
  14. package/dist/{client-DD_UeF3Q.d.ts → client-CMtx5P4D.d.cts} +20 -9
  15. package/dist/{client-WqBuu60O.d.cts → client-Dre8H24u.d.ts} +20 -9
  16. package/dist/index.cjs +299 -240
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +9 -8
  19. package/dist/index.d.ts +9 -8
  20. package/dist/index.js +299 -240
  21. package/dist/index.js.map +1 -1
  22. package/dist/{model-form-ByvyyvxB.d.ts → model-form-CU0mWrF9.d.ts} +2 -1
  23. package/dist/{model-form-DACdBLYG.d.cts → model-form-DfTi8-D1.d.cts} +2 -1
  24. package/dist/{module-DRkIHtY-.d.ts → module-DBGmbIuh.d.ts} +5 -4
  25. package/dist/{module-BFMyVmwX.d.cts → module-GoijrBXV.d.cts} +5 -4
  26. package/dist/next/client.cjs +299 -240
  27. package/dist/next/client.cjs.map +1 -1
  28. package/dist/next/client.d.cts +4 -3
  29. package/dist/next/client.d.ts +4 -3
  30. package/dist/next/client.js +299 -240
  31. package/dist/next/client.js.map +1 -1
  32. package/dist/next/server.cjs +299 -240
  33. package/dist/next/server.cjs.map +1 -1
  34. package/dist/next/server.d.cts +4 -3
  35. package/dist/next/server.d.ts +4 -3
  36. package/dist/next/server.js +299 -240
  37. package/dist/next/server.js.map +1 -1
  38. package/dist/{pipeline-DZMsPxUg.d.ts → pipeline-DrjU2vNA.d.ts} +1 -1
  39. package/dist/{pipeline-CmUZsXsi.d.cts → pipeline-c7Gdm0qv.d.cts} +1 -1
  40. package/dist/react.cjs +237 -98
  41. package/dist/react.cjs.map +1 -1
  42. package/dist/react.d.cts +5 -4
  43. package/dist/react.d.ts +5 -4
  44. package/dist/react.js +237 -98
  45. package/dist/react.js.map +1 -1
  46. package/dist/{shared-B1ueL-Ox.d.cts → shared-DZSGAmXs.d.cts} +2 -2
  47. package/dist/{shared-GPAprhBb.d.ts → shared-MMnVBBfy.d.ts} +2 -2
  48. package/dist/{types-CRjDwmtJ.d.ts → types-BLizCLd1.d.cts} +2 -1
  49. package/dist/types-BRUHGXo2.d.cts +236 -0
  50. package/dist/types-BRUHGXo2.d.ts +236 -0
  51. package/dist/types-Bez4HSbI.d.cts +204 -0
  52. package/dist/{types-C-YvfgYh.d.cts → types-DRRb0Fd0.d.ts} +2 -1
  53. package/dist/types-kPaHUqUa.d.ts +204 -0
  54. package/dist/utils.cjs +279 -0
  55. package/dist/utils.cjs.map +1 -1
  56. package/dist/utils.d.cts +58 -1
  57. package/dist/utils.d.ts +58 -1
  58. package/dist/utils.js +272 -1
  59. package/dist/utils.js.map +1 -1
  60. package/package.json +1 -1
  61. package/dist/types-BeZIHduP.d.cts +0 -428
  62. package/dist/types-BeZIHduP.d.ts +0 -428
@@ -0,0 +1,204 @@
1
+ import { p as BackendType } from './types-BRUHGXo2.cjs';
2
+
3
+ type ModelKey = string;
4
+ type ColumnKey = string;
5
+ /**
6
+ * Supported column helper families for table-builder definitions.
7
+ */
8
+ type ModelColumnKind = 'boolean' | 'number' | 'string' | 'json' | 'enumeration';
9
+ /**
10
+ * Optional per-column metadata carried by model contracts.
11
+ */
12
+ interface ModelColumnMetadata {
13
+ kind: ModelColumnKind;
14
+ columnName?: string;
15
+ nullable?: boolean;
16
+ hasDefault?: boolean;
17
+ isGenerated?: boolean;
18
+ enumValues?: readonly string[];
19
+ }
20
+ /**
21
+ * Runtime values that can safely be serialized into tenant-scoped headers.
22
+ */
23
+ type TenantContextValue = string | number | boolean | null | undefined;
24
+ /**
25
+ * Compile-time map of tenant context keys to outbound header names.
26
+ */
27
+ type TenantKeyMap = Record<string, string>;
28
+ /**
29
+ * Partial tenant context keyed by `TenantKeyMap`.
30
+ */
31
+ type TenantContext<TMap extends TenantKeyMap> = Partial<Record<keyof TMap, TenantContextValue>>;
32
+ /**
33
+ * Supported relationship cardinalities for model metadata and introspection snapshots.
34
+ */
35
+ type ModelRelationKind = 'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many';
36
+ /**
37
+ * Base metadata shape shared by typed model definitions and introspection snapshots.
38
+ * This type is intentionally row-agnostic so it can be used for generic registries.
39
+ */
40
+ interface ModelMetadataBase {
41
+ database?: string;
42
+ schema?: string;
43
+ model?: string;
44
+ tableName?: string;
45
+ primaryKey: string[];
46
+ nullable?: Partial<Record<string, boolean>>;
47
+ columns?: Partial<Record<string, ModelColumnMetadata>>;
48
+ relations?: Record<string, ModelRelationMetadata>;
49
+ }
50
+ /**
51
+ * Strongly-typed model metadata linked to a row shape.
52
+ */
53
+ type ModelMetadata<Row> = Omit<ModelMetadataBase, 'primaryKey' | 'nullable'> & {
54
+ primaryKey: Array<Extract<keyof Row, string>>;
55
+ nullable?: Partial<Record<Extract<keyof Row, string>, boolean>>;
56
+ columns?: Partial<Record<Extract<keyof Row, string>, ModelColumnMetadata>>;
57
+ };
58
+ /**
59
+ * Relation metadata for model contracts and introspection snapshots.
60
+ */
61
+ interface ModelRelationMetadata {
62
+ kind: ModelRelationKind;
63
+ sourceColumns: ColumnKey[];
64
+ targetSchema: string;
65
+ targetModel: ModelKey;
66
+ targetColumns: ColumnKey[];
67
+ targetDatabase?: string;
68
+ through?: {
69
+ schema: string;
70
+ model: string;
71
+ sourceColumns: ColumnKey[];
72
+ targetColumns: ColumnKey[];
73
+ };
74
+ }
75
+ /**
76
+ * Core model definition contract used by typed registries.
77
+ */
78
+ interface ModelDef<Row, Insert = Partial<Row>, Update = Partial<Insert>, Meta extends ModelMetadataBase = ModelMetadata<Row>> {
79
+ readonly meta: Meta;
80
+ readonly __types?: {
81
+ row: Row;
82
+ insert: Insert;
83
+ update: Update;
84
+ };
85
+ }
86
+ /**
87
+ * Row-agnostic model definition used as a generic constraint.
88
+ */
89
+ type AnyModelDef = ModelDef<unknown, unknown, unknown, ModelMetadataBase>;
90
+ /**
91
+ * Public model/table value that carries Athena target metadata plus row/write typings.
92
+ * This can be passed directly to `client.from(...)` for opt-in target inference.
93
+ */
94
+ type AthenaModelTarget<Row = unknown, Insert = unknown, Update = unknown> = ModelDef<Row, Insert, Update, ModelMetadataBase>;
95
+ /**
96
+ * Schema-level model registry.
97
+ */
98
+ interface SchemaDef<Models extends Record<ModelKey, AnyModelDef>> {
99
+ readonly models: Models;
100
+ }
101
+ /**
102
+ * Database-level schema registry.
103
+ */
104
+ interface DatabaseDef<Schemas extends Record<string, SchemaDef<Record<ModelKey, AnyModelDef>>>> {
105
+ readonly schemas: Schemas;
106
+ }
107
+ /**
108
+ * Top-level registry keyed by logical database names.
109
+ */
110
+ type RegistryDef<Databases extends Record<string, DatabaseDef<Record<string, SchemaDef<Record<ModelKey, AnyModelDef>>>>>> = Databases;
111
+ /**
112
+ * Extracts row type from a model definition.
113
+ */
114
+ type RowOf<TModel extends AnyModelDef> = TModel extends ModelDef<infer TRow, unknown, unknown, ModelMetadataBase> ? TRow : never;
115
+ /**
116
+ * Extracts insert type from a model definition.
117
+ */
118
+ type InsertOf<TModel extends AnyModelDef> = TModel extends ModelDef<unknown, infer TInsert, unknown, ModelMetadataBase> ? TInsert : never;
119
+ /**
120
+ * Extracts update type from a model definition.
121
+ */
122
+ type UpdateOf<TModel extends AnyModelDef> = TModel extends ModelDef<unknown, unknown, infer TUpdate, ModelMetadataBase> ? TUpdate : never;
123
+ /**
124
+ * Resolves a model definition from a registry path.
125
+ */
126
+ type ModelAt<TRegistry extends RegistryDef<Record<string, DatabaseDef<Record<string, SchemaDef<Record<ModelKey, AnyModelDef>>>>>>, TDatabase extends keyof TRegistry & string, TSchema extends keyof TRegistry[TDatabase]['schemas'] & string, TModel extends keyof TRegistry[TDatabase]['schemas'][TSchema]['models'] & string> = TRegistry[TDatabase]['schemas'][TSchema]['models'][TModel];
127
+ /**
128
+ * Introspection-level column type families.
129
+ */
130
+ type IntrospectionTypeKind = 'scalar' | 'enum' | 'domain' | 'range' | 'multirange' | 'composite';
131
+ /**
132
+ * Introspected column metadata.
133
+ */
134
+ interface IntrospectionColumn {
135
+ name: string;
136
+ dataType: string;
137
+ udtName: string;
138
+ typeKind: IntrospectionTypeKind;
139
+ isNullable: boolean;
140
+ isPrimaryKey: boolean;
141
+ hasDefault: boolean;
142
+ isGenerated: boolean;
143
+ arrayDimensions: number;
144
+ enumValues?: string[];
145
+ }
146
+ /**
147
+ * Introspected relationship metadata.
148
+ */
149
+ interface IntrospectionRelation {
150
+ name: string;
151
+ kind: ModelRelationKind;
152
+ sourceColumns: string[];
153
+ targetSchema: string;
154
+ targetModel: string;
155
+ targetColumns: string[];
156
+ targetDatabase?: string;
157
+ through?: {
158
+ schema: string;
159
+ model: string;
160
+ sourceColumns: string[];
161
+ targetColumns: string[];
162
+ };
163
+ }
164
+ /**
165
+ * Introspected table metadata.
166
+ */
167
+ interface IntrospectionTable {
168
+ schema: string;
169
+ name: string;
170
+ columns: Record<string, IntrospectionColumn>;
171
+ primaryKey: string[];
172
+ relations: Record<string, IntrospectionRelation>;
173
+ }
174
+ /**
175
+ * Introspected schema metadata.
176
+ */
177
+ interface IntrospectionSchema {
178
+ name: string;
179
+ tables: Record<string, IntrospectionTable>;
180
+ }
181
+ /**
182
+ * Normalized output of a schema introspection pass.
183
+ */
184
+ interface IntrospectionSnapshot {
185
+ backend: BackendType;
186
+ database: string;
187
+ generatedAt: string;
188
+ schemas: Record<string, IntrospectionSchema>;
189
+ }
190
+ /**
191
+ * Options accepted by introspection providers.
192
+ */
193
+ interface IntrospectionInspectOptions {
194
+ schemas?: string[];
195
+ }
196
+ /**
197
+ * Provider contract implemented by backend-specific introspection adapters.
198
+ */
199
+ interface SchemaIntrospectionProvider {
200
+ readonly backend: BackendType;
201
+ inspect(options?: IntrospectionInspectOptions): Promise<IntrospectionSnapshot>;
202
+ }
203
+
204
+ export type { AthenaModelTarget as A, DatabaseDef as D, IntrospectionSnapshot as I, ModelAt as M, RegistryDef as R, SchemaIntrospectionProvider as S, TenantContext as T, UpdateOf as U, InsertOf as a, IntrospectionColumn as b, IntrospectionInspectOptions as c, IntrospectionRelation as d, IntrospectionSchema as e, IntrospectionTable as f, IntrospectionTypeKind as g, ModelColumnKind as h, ModelColumnMetadata as i, ModelDef as j, ModelMetadata as k, ModelRelationKind as l, ModelRelationMetadata as m, RowOf as n, SchemaDef as o, TenantContextValue as p, TenantKeyMap as q, AnyModelDef as r };
@@ -1,4 +1,5 @@
1
- import { q as BackendType, I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-BeZIHduP.cjs';
1
+ import { p as BackendType } from './types-BRUHGXo2.js';
2
+ import { I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-kPaHUqUa.js';
2
3
 
3
4
  /**
4
5
  * Supported case transformations for generated symbols and path token variants.
@@ -0,0 +1,204 @@
1
+ import { p as BackendType } from './types-BRUHGXo2.js';
2
+
3
+ type ModelKey = string;
4
+ type ColumnKey = string;
5
+ /**
6
+ * Supported column helper families for table-builder definitions.
7
+ */
8
+ type ModelColumnKind = 'boolean' | 'number' | 'string' | 'json' | 'enumeration';
9
+ /**
10
+ * Optional per-column metadata carried by model contracts.
11
+ */
12
+ interface ModelColumnMetadata {
13
+ kind: ModelColumnKind;
14
+ columnName?: string;
15
+ nullable?: boolean;
16
+ hasDefault?: boolean;
17
+ isGenerated?: boolean;
18
+ enumValues?: readonly string[];
19
+ }
20
+ /**
21
+ * Runtime values that can safely be serialized into tenant-scoped headers.
22
+ */
23
+ type TenantContextValue = string | number | boolean | null | undefined;
24
+ /**
25
+ * Compile-time map of tenant context keys to outbound header names.
26
+ */
27
+ type TenantKeyMap = Record<string, string>;
28
+ /**
29
+ * Partial tenant context keyed by `TenantKeyMap`.
30
+ */
31
+ type TenantContext<TMap extends TenantKeyMap> = Partial<Record<keyof TMap, TenantContextValue>>;
32
+ /**
33
+ * Supported relationship cardinalities for model metadata and introspection snapshots.
34
+ */
35
+ type ModelRelationKind = 'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many';
36
+ /**
37
+ * Base metadata shape shared by typed model definitions and introspection snapshots.
38
+ * This type is intentionally row-agnostic so it can be used for generic registries.
39
+ */
40
+ interface ModelMetadataBase {
41
+ database?: string;
42
+ schema?: string;
43
+ model?: string;
44
+ tableName?: string;
45
+ primaryKey: string[];
46
+ nullable?: Partial<Record<string, boolean>>;
47
+ columns?: Partial<Record<string, ModelColumnMetadata>>;
48
+ relations?: Record<string, ModelRelationMetadata>;
49
+ }
50
+ /**
51
+ * Strongly-typed model metadata linked to a row shape.
52
+ */
53
+ type ModelMetadata<Row> = Omit<ModelMetadataBase, 'primaryKey' | 'nullable'> & {
54
+ primaryKey: Array<Extract<keyof Row, string>>;
55
+ nullable?: Partial<Record<Extract<keyof Row, string>, boolean>>;
56
+ columns?: Partial<Record<Extract<keyof Row, string>, ModelColumnMetadata>>;
57
+ };
58
+ /**
59
+ * Relation metadata for model contracts and introspection snapshots.
60
+ */
61
+ interface ModelRelationMetadata {
62
+ kind: ModelRelationKind;
63
+ sourceColumns: ColumnKey[];
64
+ targetSchema: string;
65
+ targetModel: ModelKey;
66
+ targetColumns: ColumnKey[];
67
+ targetDatabase?: string;
68
+ through?: {
69
+ schema: string;
70
+ model: string;
71
+ sourceColumns: ColumnKey[];
72
+ targetColumns: ColumnKey[];
73
+ };
74
+ }
75
+ /**
76
+ * Core model definition contract used by typed registries.
77
+ */
78
+ interface ModelDef<Row, Insert = Partial<Row>, Update = Partial<Insert>, Meta extends ModelMetadataBase = ModelMetadata<Row>> {
79
+ readonly meta: Meta;
80
+ readonly __types?: {
81
+ row: Row;
82
+ insert: Insert;
83
+ update: Update;
84
+ };
85
+ }
86
+ /**
87
+ * Row-agnostic model definition used as a generic constraint.
88
+ */
89
+ type AnyModelDef = ModelDef<unknown, unknown, unknown, ModelMetadataBase>;
90
+ /**
91
+ * Public model/table value that carries Athena target metadata plus row/write typings.
92
+ * This can be passed directly to `client.from(...)` for opt-in target inference.
93
+ */
94
+ type AthenaModelTarget<Row = unknown, Insert = unknown, Update = unknown> = ModelDef<Row, Insert, Update, ModelMetadataBase>;
95
+ /**
96
+ * Schema-level model registry.
97
+ */
98
+ interface SchemaDef<Models extends Record<ModelKey, AnyModelDef>> {
99
+ readonly models: Models;
100
+ }
101
+ /**
102
+ * Database-level schema registry.
103
+ */
104
+ interface DatabaseDef<Schemas extends Record<string, SchemaDef<Record<ModelKey, AnyModelDef>>>> {
105
+ readonly schemas: Schemas;
106
+ }
107
+ /**
108
+ * Top-level registry keyed by logical database names.
109
+ */
110
+ type RegistryDef<Databases extends Record<string, DatabaseDef<Record<string, SchemaDef<Record<ModelKey, AnyModelDef>>>>>> = Databases;
111
+ /**
112
+ * Extracts row type from a model definition.
113
+ */
114
+ type RowOf<TModel extends AnyModelDef> = TModel extends ModelDef<infer TRow, unknown, unknown, ModelMetadataBase> ? TRow : never;
115
+ /**
116
+ * Extracts insert type from a model definition.
117
+ */
118
+ type InsertOf<TModel extends AnyModelDef> = TModel extends ModelDef<unknown, infer TInsert, unknown, ModelMetadataBase> ? TInsert : never;
119
+ /**
120
+ * Extracts update type from a model definition.
121
+ */
122
+ type UpdateOf<TModel extends AnyModelDef> = TModel extends ModelDef<unknown, unknown, infer TUpdate, ModelMetadataBase> ? TUpdate : never;
123
+ /**
124
+ * Resolves a model definition from a registry path.
125
+ */
126
+ type ModelAt<TRegistry extends RegistryDef<Record<string, DatabaseDef<Record<string, SchemaDef<Record<ModelKey, AnyModelDef>>>>>>, TDatabase extends keyof TRegistry & string, TSchema extends keyof TRegistry[TDatabase]['schemas'] & string, TModel extends keyof TRegistry[TDatabase]['schemas'][TSchema]['models'] & string> = TRegistry[TDatabase]['schemas'][TSchema]['models'][TModel];
127
+ /**
128
+ * Introspection-level column type families.
129
+ */
130
+ type IntrospectionTypeKind = 'scalar' | 'enum' | 'domain' | 'range' | 'multirange' | 'composite';
131
+ /**
132
+ * Introspected column metadata.
133
+ */
134
+ interface IntrospectionColumn {
135
+ name: string;
136
+ dataType: string;
137
+ udtName: string;
138
+ typeKind: IntrospectionTypeKind;
139
+ isNullable: boolean;
140
+ isPrimaryKey: boolean;
141
+ hasDefault: boolean;
142
+ isGenerated: boolean;
143
+ arrayDimensions: number;
144
+ enumValues?: string[];
145
+ }
146
+ /**
147
+ * Introspected relationship metadata.
148
+ */
149
+ interface IntrospectionRelation {
150
+ name: string;
151
+ kind: ModelRelationKind;
152
+ sourceColumns: string[];
153
+ targetSchema: string;
154
+ targetModel: string;
155
+ targetColumns: string[];
156
+ targetDatabase?: string;
157
+ through?: {
158
+ schema: string;
159
+ model: string;
160
+ sourceColumns: string[];
161
+ targetColumns: string[];
162
+ };
163
+ }
164
+ /**
165
+ * Introspected table metadata.
166
+ */
167
+ interface IntrospectionTable {
168
+ schema: string;
169
+ name: string;
170
+ columns: Record<string, IntrospectionColumn>;
171
+ primaryKey: string[];
172
+ relations: Record<string, IntrospectionRelation>;
173
+ }
174
+ /**
175
+ * Introspected schema metadata.
176
+ */
177
+ interface IntrospectionSchema {
178
+ name: string;
179
+ tables: Record<string, IntrospectionTable>;
180
+ }
181
+ /**
182
+ * Normalized output of a schema introspection pass.
183
+ */
184
+ interface IntrospectionSnapshot {
185
+ backend: BackendType;
186
+ database: string;
187
+ generatedAt: string;
188
+ schemas: Record<string, IntrospectionSchema>;
189
+ }
190
+ /**
191
+ * Options accepted by introspection providers.
192
+ */
193
+ interface IntrospectionInspectOptions {
194
+ schemas?: string[];
195
+ }
196
+ /**
197
+ * Provider contract implemented by backend-specific introspection adapters.
198
+ */
199
+ interface SchemaIntrospectionProvider {
200
+ readonly backend: BackendType;
201
+ inspect(options?: IntrospectionInspectOptions): Promise<IntrospectionSnapshot>;
202
+ }
203
+
204
+ export type { AthenaModelTarget as A, DatabaseDef as D, IntrospectionSnapshot as I, ModelAt as M, RegistryDef as R, SchemaIntrospectionProvider as S, TenantContext as T, UpdateOf as U, InsertOf as a, IntrospectionColumn as b, IntrospectionInspectOptions as c, IntrospectionRelation as d, IntrospectionSchema as e, IntrospectionTable as f, IntrospectionTypeKind as g, ModelColumnKind as h, ModelColumnMetadata as i, ModelDef as j, ModelMetadata as k, ModelRelationKind as l, ModelRelationMetadata as m, RowOf as n, SchemaDef as o, TenantContextValue as p, TenantKeyMap as q, AnyModelDef as r };