@xylex-group/athena 1.7.0 → 1.9.0

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.
@@ -1,195 +0,0 @@
1
- /**
2
- * athena gateway types
3
- *
4
- * type definitions for the athena gateway api client and react hook
5
- */
6
- type AthenaGatewayMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
7
- type AthenaGatewayEndpointPath = '/gateway/fetch' | '/gateway/insert' | '/gateway/update' | '/gateway/delete' | '/gateway/rpc' | '/gateway/query' | `/rpc/${string}`;
8
- type AthenaCountOption = 'exact' | 'planned' | 'estimated';
9
- type AthenaConditionValue = string | number | boolean | null;
10
- type AthenaConditionArrayValue = Array<AthenaConditionValue>;
11
- type AthenaConditionCastType = string;
12
- type AthenaConditionOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in' | 'contains' | 'containedBy' | 'not' | 'or';
13
- interface AthenaGatewayCondition {
14
- column?: string;
15
- operator: AthenaConditionOperator;
16
- value?: AthenaConditionValue | AthenaConditionArrayValue | string;
17
- /**
18
- * Optional explicit cast for `value` (for example `"uuid"`).
19
- * Older gateways ignore unknown fields; newer gateways may use this hint.
20
- */
21
- value_cast?: AthenaConditionCastType;
22
- /**
23
- * Optional explicit cast for `column` (for example `"text"`).
24
- * Used by SDK SQL fallback for typed comparisons.
25
- */
26
- column_cast?: AthenaConditionCastType;
27
- /** Back-compat shape expected by older gateway implementations */
28
- eq_column?: string;
29
- eq_value?: AthenaConditionValue | AthenaConditionArrayValue | string;
30
- /** Optional cast hint aligned with legacy eq_* fields */
31
- eq_value_cast?: AthenaConditionCastType;
32
- /** Optional cast hint aligned with legacy eq_* fields */
33
- eq_column_cast?: AthenaConditionCastType;
34
- }
35
- type AthenaSortDirection = 'ascending' | 'descending';
36
- interface AthenaSortBy {
37
- field: string;
38
- direction: AthenaSortDirection;
39
- }
40
- interface AthenaFetchPayload {
41
- view_name?: string;
42
- table_name?: string;
43
- columns?: string[] | string;
44
- conditions?: AthenaGatewayCondition[];
45
- limit?: number;
46
- offset?: number;
47
- current_page?: number;
48
- page_size?: number;
49
- total_pages?: number;
50
- strip_nulls?: boolean;
51
- group_by?: string;
52
- time_granularity?: 'day' | 'hour' | 'minute';
53
- aggregation_column?: string;
54
- aggregation_strategy?: 'cumulative_sum';
55
- aggregation_dedup?: boolean;
56
- sort_by?: AthenaSortBy;
57
- }
58
- interface AthenaInsertPayload {
59
- table_name: string;
60
- insert_body: Record<string, unknown> | Record<string, unknown>[];
61
- update_body?: Record<string, unknown>;
62
- columns?: string[] | string;
63
- count?: AthenaCountOption;
64
- head?: boolean;
65
- default_to_null?: boolean;
66
- on_conflict?: string | string[];
67
- }
68
- interface AthenaDeletePayload {
69
- table_name: string;
70
- resource_id?: string;
71
- columns?: string[] | string;
72
- conditions?: AthenaGatewayCondition[];
73
- sort_by?: AthenaSortBy;
74
- current_page?: number;
75
- page_size?: number;
76
- total_pages?: number;
77
- }
78
- interface AthenaUpdatePayload extends AthenaFetchPayload {
79
- set?: Record<string, unknown>;
80
- data?: Record<string, unknown>;
81
- }
82
- type AthenaRpcFilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in';
83
- interface AthenaRpcFilter {
84
- column: string;
85
- operator: AthenaRpcFilterOperator;
86
- value?: AthenaConditionValue | AthenaConditionArrayValue | string;
87
- }
88
- interface AthenaRpcOrder {
89
- column: string;
90
- ascending?: boolean;
91
- }
92
- interface AthenaRpcPayload {
93
- function: string;
94
- function_name?: string;
95
- schema?: string;
96
- args?: Record<string, unknown>;
97
- select?: string;
98
- filters?: AthenaRpcFilter[];
99
- count?: AthenaCountOption;
100
- head?: boolean;
101
- limit?: number;
102
- offset?: number;
103
- order?: AthenaRpcOrder;
104
- }
105
- /** Backend type for Athena client (aligns with athena-rs) */
106
- type BackendType = 'athena' | 'postgrest' | 'postgresql' | 'scylladb';
107
- /** Backend config: type from SDK + backend-scoped options */
108
- interface BackendConfig {
109
- type: BackendType;
110
- options?: Record<string, unknown>;
111
- }
112
- /** Pre-defined backends for lean usage: backend: Backend.Athena */
113
- declare const Backend: {
114
- readonly Athena: {
115
- readonly type: "athena";
116
- };
117
- readonly Postgrest: {
118
- readonly type: "postgrest";
119
- };
120
- readonly PostgreSQL: {
121
- readonly type: "postgresql";
122
- };
123
- readonly ScyllaDB: {
124
- readonly type: "scylladb";
125
- };
126
- };
127
- type BackendOption = BackendConfig | BackendType;
128
- interface AthenaGatewayBaseOptions {
129
- baseUrl?: string;
130
- apiKey?: string;
131
- client?: string;
132
- backend?: BackendOption;
133
- publishEvent?: string;
134
- headers?: Record<string, string>;
135
- userId?: string | null;
136
- organizationId?: string | null;
137
- }
138
- type AthenaGatewayHookConfig = AthenaGatewayBaseOptions;
139
- interface AthenaGatewayCallOptions extends AthenaGatewayBaseOptions {
140
- count?: AthenaCountOption;
141
- head?: boolean;
142
- defaultToNull?: boolean;
143
- stripNulls?: boolean;
144
- onConflict?: string | string[];
145
- updateBody?: Record<string, unknown>;
146
- }
147
- interface AthenaRpcCallOptions extends AthenaGatewayCallOptions {
148
- schema?: string;
149
- count?: AthenaCountOption;
150
- get?: boolean;
151
- }
152
- interface AthenaGatewayResponse<T = unknown> {
153
- ok: boolean;
154
- status: number;
155
- data: T | null;
156
- count?: number | null;
157
- error?: string;
158
- errorDetails?: AthenaGatewayErrorDetails | null;
159
- raw: unknown;
160
- }
161
- type AthenaGatewayErrorCode = 'NETWORK_ERROR' | 'HTTP_ERROR' | 'INVALID_JSON' | 'UNKNOWN_ERROR';
162
- interface AthenaGatewayErrorDetails {
163
- code: AthenaGatewayErrorCode;
164
- message: string;
165
- status: number;
166
- endpoint?: AthenaGatewayEndpointPath;
167
- method?: AthenaGatewayMethod;
168
- requestId?: string;
169
- hint?: string;
170
- cause?: string;
171
- }
172
- interface AthenaGatewayResponseLog extends AthenaGatewayResponse {
173
- timestamp: string;
174
- }
175
- interface AthenaGatewayCallLog {
176
- endpoint: AthenaGatewayEndpointPath;
177
- method: AthenaGatewayMethod;
178
- payload: unknown;
179
- headers: Record<string, string>;
180
- timestamp: string;
181
- }
182
- interface AthenaGatewayHookResult {
183
- fetchGateway: <T = unknown>(payload: AthenaFetchPayload, options?: AthenaGatewayCallOptions) => Promise<AthenaGatewayResponse<T>>;
184
- insertGateway: <T = unknown>(payload: AthenaInsertPayload, options?: AthenaGatewayCallOptions) => Promise<AthenaGatewayResponse<T>>;
185
- updateGateway: <T = unknown>(payload: AthenaUpdatePayload, options?: AthenaGatewayCallOptions) => Promise<AthenaGatewayResponse<T>>;
186
- deleteGateway: <T = unknown>(payload: AthenaDeletePayload, options?: AthenaGatewayCallOptions) => Promise<AthenaGatewayResponse<T>>;
187
- rpcGateway: <T = unknown>(payload: AthenaRpcPayload, options?: AthenaRpcCallOptions) => Promise<AthenaGatewayResponse<T>>;
188
- isLoading: boolean;
189
- error: string | null;
190
- lastRequest: AthenaGatewayCallLog | null;
191
- lastResponse: AthenaGatewayResponseLog | null;
192
- baseUrl: string;
193
- }
194
-
195
- export { type AthenaConditionValue as A, type BackendConfig as B, type BackendType as a, type AthenaConditionCastType as b, type AthenaConditionArrayValue as c, type AthenaConditionOperator as d, type AthenaGatewayCallOptions as e, type AthenaGatewayErrorDetails as f, type AthenaRpcCallOptions as g, type AthenaGatewayErrorCode as h, type AthenaRpcFilter as i, type AthenaRpcFilterOperator as j, type AthenaRpcOrder as k, type AthenaRpcPayload as l, Backend as m, type AthenaGatewayHookConfig as n, type AthenaGatewayHookResult as o, type AthenaDeletePayload as p, type AthenaFetchPayload as q, type AthenaGatewayResponse as r, type AthenaInsertPayload as s, type AthenaUpdatePayload as t, type AthenaGatewayEndpointPath as u, type AthenaGatewayMethod as v };
@@ -1,195 +0,0 @@
1
- /**
2
- * athena gateway types
3
- *
4
- * type definitions for the athena gateway api client and react hook
5
- */
6
- type AthenaGatewayMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
7
- type AthenaGatewayEndpointPath = '/gateway/fetch' | '/gateway/insert' | '/gateway/update' | '/gateway/delete' | '/gateway/rpc' | '/gateway/query' | `/rpc/${string}`;
8
- type AthenaCountOption = 'exact' | 'planned' | 'estimated';
9
- type AthenaConditionValue = string | number | boolean | null;
10
- type AthenaConditionArrayValue = Array<AthenaConditionValue>;
11
- type AthenaConditionCastType = string;
12
- type AthenaConditionOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in' | 'contains' | 'containedBy' | 'not' | 'or';
13
- interface AthenaGatewayCondition {
14
- column?: string;
15
- operator: AthenaConditionOperator;
16
- value?: AthenaConditionValue | AthenaConditionArrayValue | string;
17
- /**
18
- * Optional explicit cast for `value` (for example `"uuid"`).
19
- * Older gateways ignore unknown fields; newer gateways may use this hint.
20
- */
21
- value_cast?: AthenaConditionCastType;
22
- /**
23
- * Optional explicit cast for `column` (for example `"text"`).
24
- * Used by SDK SQL fallback for typed comparisons.
25
- */
26
- column_cast?: AthenaConditionCastType;
27
- /** Back-compat shape expected by older gateway implementations */
28
- eq_column?: string;
29
- eq_value?: AthenaConditionValue | AthenaConditionArrayValue | string;
30
- /** Optional cast hint aligned with legacy eq_* fields */
31
- eq_value_cast?: AthenaConditionCastType;
32
- /** Optional cast hint aligned with legacy eq_* fields */
33
- eq_column_cast?: AthenaConditionCastType;
34
- }
35
- type AthenaSortDirection = 'ascending' | 'descending';
36
- interface AthenaSortBy {
37
- field: string;
38
- direction: AthenaSortDirection;
39
- }
40
- interface AthenaFetchPayload {
41
- view_name?: string;
42
- table_name?: string;
43
- columns?: string[] | string;
44
- conditions?: AthenaGatewayCondition[];
45
- limit?: number;
46
- offset?: number;
47
- current_page?: number;
48
- page_size?: number;
49
- total_pages?: number;
50
- strip_nulls?: boolean;
51
- group_by?: string;
52
- time_granularity?: 'day' | 'hour' | 'minute';
53
- aggregation_column?: string;
54
- aggregation_strategy?: 'cumulative_sum';
55
- aggregation_dedup?: boolean;
56
- sort_by?: AthenaSortBy;
57
- }
58
- interface AthenaInsertPayload {
59
- table_name: string;
60
- insert_body: Record<string, unknown> | Record<string, unknown>[];
61
- update_body?: Record<string, unknown>;
62
- columns?: string[] | string;
63
- count?: AthenaCountOption;
64
- head?: boolean;
65
- default_to_null?: boolean;
66
- on_conflict?: string | string[];
67
- }
68
- interface AthenaDeletePayload {
69
- table_name: string;
70
- resource_id?: string;
71
- columns?: string[] | string;
72
- conditions?: AthenaGatewayCondition[];
73
- sort_by?: AthenaSortBy;
74
- current_page?: number;
75
- page_size?: number;
76
- total_pages?: number;
77
- }
78
- interface AthenaUpdatePayload extends AthenaFetchPayload {
79
- set?: Record<string, unknown>;
80
- data?: Record<string, unknown>;
81
- }
82
- type AthenaRpcFilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in';
83
- interface AthenaRpcFilter {
84
- column: string;
85
- operator: AthenaRpcFilterOperator;
86
- value?: AthenaConditionValue | AthenaConditionArrayValue | string;
87
- }
88
- interface AthenaRpcOrder {
89
- column: string;
90
- ascending?: boolean;
91
- }
92
- interface AthenaRpcPayload {
93
- function: string;
94
- function_name?: string;
95
- schema?: string;
96
- args?: Record<string, unknown>;
97
- select?: string;
98
- filters?: AthenaRpcFilter[];
99
- count?: AthenaCountOption;
100
- head?: boolean;
101
- limit?: number;
102
- offset?: number;
103
- order?: AthenaRpcOrder;
104
- }
105
- /** Backend type for Athena client (aligns with athena-rs) */
106
- type BackendType = 'athena' | 'postgrest' | 'postgresql' | 'scylladb';
107
- /** Backend config: type from SDK + backend-scoped options */
108
- interface BackendConfig {
109
- type: BackendType;
110
- options?: Record<string, unknown>;
111
- }
112
- /** Pre-defined backends for lean usage: backend: Backend.Athena */
113
- declare const Backend: {
114
- readonly Athena: {
115
- readonly type: "athena";
116
- };
117
- readonly Postgrest: {
118
- readonly type: "postgrest";
119
- };
120
- readonly PostgreSQL: {
121
- readonly type: "postgresql";
122
- };
123
- readonly ScyllaDB: {
124
- readonly type: "scylladb";
125
- };
126
- };
127
- type BackendOption = BackendConfig | BackendType;
128
- interface AthenaGatewayBaseOptions {
129
- baseUrl?: string;
130
- apiKey?: string;
131
- client?: string;
132
- backend?: BackendOption;
133
- publishEvent?: string;
134
- headers?: Record<string, string>;
135
- userId?: string | null;
136
- organizationId?: string | null;
137
- }
138
- type AthenaGatewayHookConfig = AthenaGatewayBaseOptions;
139
- interface AthenaGatewayCallOptions extends AthenaGatewayBaseOptions {
140
- count?: AthenaCountOption;
141
- head?: boolean;
142
- defaultToNull?: boolean;
143
- stripNulls?: boolean;
144
- onConflict?: string | string[];
145
- updateBody?: Record<string, unknown>;
146
- }
147
- interface AthenaRpcCallOptions extends AthenaGatewayCallOptions {
148
- schema?: string;
149
- count?: AthenaCountOption;
150
- get?: boolean;
151
- }
152
- interface AthenaGatewayResponse<T = unknown> {
153
- ok: boolean;
154
- status: number;
155
- data: T | null;
156
- count?: number | null;
157
- error?: string;
158
- errorDetails?: AthenaGatewayErrorDetails | null;
159
- raw: unknown;
160
- }
161
- type AthenaGatewayErrorCode = 'NETWORK_ERROR' | 'HTTP_ERROR' | 'INVALID_JSON' | 'UNKNOWN_ERROR';
162
- interface AthenaGatewayErrorDetails {
163
- code: AthenaGatewayErrorCode;
164
- message: string;
165
- status: number;
166
- endpoint?: AthenaGatewayEndpointPath;
167
- method?: AthenaGatewayMethod;
168
- requestId?: string;
169
- hint?: string;
170
- cause?: string;
171
- }
172
- interface AthenaGatewayResponseLog extends AthenaGatewayResponse {
173
- timestamp: string;
174
- }
175
- interface AthenaGatewayCallLog {
176
- endpoint: AthenaGatewayEndpointPath;
177
- method: AthenaGatewayMethod;
178
- payload: unknown;
179
- headers: Record<string, string>;
180
- timestamp: string;
181
- }
182
- interface AthenaGatewayHookResult {
183
- fetchGateway: <T = unknown>(payload: AthenaFetchPayload, options?: AthenaGatewayCallOptions) => Promise<AthenaGatewayResponse<T>>;
184
- insertGateway: <T = unknown>(payload: AthenaInsertPayload, options?: AthenaGatewayCallOptions) => Promise<AthenaGatewayResponse<T>>;
185
- updateGateway: <T = unknown>(payload: AthenaUpdatePayload, options?: AthenaGatewayCallOptions) => Promise<AthenaGatewayResponse<T>>;
186
- deleteGateway: <T = unknown>(payload: AthenaDeletePayload, options?: AthenaGatewayCallOptions) => Promise<AthenaGatewayResponse<T>>;
187
- rpcGateway: <T = unknown>(payload: AthenaRpcPayload, options?: AthenaRpcCallOptions) => Promise<AthenaGatewayResponse<T>>;
188
- isLoading: boolean;
189
- error: string | null;
190
- lastRequest: AthenaGatewayCallLog | null;
191
- lastResponse: AthenaGatewayResponseLog | null;
192
- baseUrl: string;
193
- }
194
-
195
- export { type AthenaConditionValue as A, type BackendConfig as B, type BackendType as a, type AthenaConditionCastType as b, type AthenaConditionArrayValue as c, type AthenaConditionOperator as d, type AthenaGatewayCallOptions as e, type AthenaGatewayErrorDetails as f, type AthenaRpcCallOptions as g, type AthenaGatewayErrorCode as h, type AthenaRpcFilter as i, type AthenaRpcFilterOperator as j, type AthenaRpcOrder as k, type AthenaRpcPayload as l, Backend as m, type AthenaGatewayHookConfig as n, type AthenaGatewayHookResult as o, type AthenaDeletePayload as p, type AthenaFetchPayload as q, type AthenaGatewayResponse as r, type AthenaInsertPayload as s, type AthenaUpdatePayload as t, type AthenaGatewayEndpointPath as u, type AthenaGatewayMethod as v };