@major-tech/resource-client 0.2.9 → 0.2.11
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 +91 -2
- package/bin/generate-clients.mjs +5 -3
- package/dist/clients/mssql.cjs +64 -0
- package/dist/clients/mssql.cjs.map +7 -0
- package/dist/clients/mssql.d.ts +29 -0
- package/dist/clients/mssql.d.ts.map +1 -0
- package/dist/clients/mssql.js +37 -0
- package/dist/clients/mssql.js.map +1 -0
- package/dist/clients/postgres.cjs +23 -0
- package/dist/clients/postgres.cjs.map +2 -2
- package/dist/clients/postgres.d.ts +24 -1
- package/dist/clients/postgres.d.ts.map +1 -1
- package/dist/clients/postgres.js +23 -0
- package/dist/clients/postgres.js.map +1 -1
- package/dist/clients/snowflake.cjs +94 -0
- package/dist/clients/snowflake.cjs.map +7 -0
- package/dist/clients/snowflake.d.ts +68 -0
- package/dist/clients/snowflake.d.ts.map +1 -0
- package/dist/clients/snowflake.js +67 -0
- package/dist/clients/snowflake.js.map +1 -0
- package/dist/index.cjs +5 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/schemas/index.cjs +2 -0
- package/dist/schemas/index.cjs.map +2 -2
- package/dist/schemas/index.d.ts +5 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/mssql.cjs +17 -0
- package/dist/schemas/mssql.cjs.map +7 -0
- package/dist/schemas/mssql.d.ts +18 -0
- package/dist/schemas/mssql.d.ts.map +1 -0
- package/dist/schemas/mssql.js +2 -0
- package/dist/schemas/mssql.js.map +1 -0
- package/dist/schemas/postgres.d.ts +3 -3
- package/dist/schemas/postgres.d.ts.map +1 -1
- package/dist/schemas/response.d.ts +8 -3
- package/dist/schemas/response.d.ts.map +1 -1
- package/dist/schemas/snowflake.cjs +17 -0
- package/dist/schemas/snowflake.cjs.map +7 -0
- package/dist/schemas/snowflake.d.ts +154 -0
- package/dist/schemas/snowflake.d.ts.map +1 -0
- package/dist/schemas/snowflake.js +2 -0
- package/dist/schemas/snowflake.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @major-tech/resource-client
|
|
2
2
|
|
|
3
|
-
TS client: PostgreSQL/CustomAPI/HubSpot/S3. Type-safe, 0-dep, universal (Node/browser/edge), ESM+CJS.
|
|
3
|
+
TS client: PostgreSQL/DynamoDB/CosmosDB/Snowflake/CustomAPI/HubSpot/S3. Type-safe, 0-dep, universal (Node/browser/edge), ESM+CJS.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -157,6 +157,95 @@ const r = await c.invoke("GET", "/crm/v3/objects/contacts", "fetch-contacts", {
|
|
|
157
157
|
// r.ok && r.result.body.kind === 'json' ? r.result.body.value : r.error
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
+
## SnowflakeResourceClient
|
|
161
|
+
|
|
162
|
+
**Constructor:** `new SnowflakeResourceClient(config: BaseClientConfig)`
|
|
163
|
+
|
|
164
|
+
**Methods:**
|
|
165
|
+
|
|
166
|
+
- `execute(statement: string, invocationKey: string, options?: SnowflakeExecuteOptions): Promise<SnowflakeInvokeResponse>`
|
|
167
|
+
- `status(statementHandle: string, invocationKey: string, options?: { partition?: number }): Promise<SnowflakeInvokeResponse>`
|
|
168
|
+
- `cancel(statementHandle: string, invocationKey: string): Promise<SnowflakeInvokeResponse>`
|
|
169
|
+
- `invoke(payload: DbSnowflakePayload, invocationKey: string): Promise<SnowflakeInvokeResponse>` - raw payload
|
|
170
|
+
|
|
171
|
+
**Execute Options:**
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
{
|
|
175
|
+
bindings?: Record<string, { type: SnowflakeBindingType; value: string | number | boolean | null }>;
|
|
176
|
+
database?: string; // Override default database
|
|
177
|
+
schema?: string; // Override default schema
|
|
178
|
+
warehouse?: string; // Override default warehouse
|
|
179
|
+
role?: string; // Override default role
|
|
180
|
+
timeout?: number; // Timeout in seconds (max 604800 = 7 days)
|
|
181
|
+
async?: boolean; // Execute asynchronously
|
|
182
|
+
parameters?: SnowflakeSessionParameters; // Session params (timezone, query_tag, etc.)
|
|
183
|
+
nullable?: boolean; // Return NULL as "null" string
|
|
184
|
+
requestId?: string; // Idempotency key
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Binding Types:** `"TEXT" | "FIXED" | "REAL" | "BOOLEAN" | "DATE" | "TIME" | "TIMESTAMP_LTZ" | "TIMESTAMP_NTZ" | "TIMESTAMP_TZ" | "BINARY" | "ARRAY" | "OBJECT" | "VARIANT"`
|
|
189
|
+
|
|
190
|
+
**Result (ok=true):**
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
{
|
|
194
|
+
kind: "snowflake";
|
|
195
|
+
code?: string; // Snowflake response code
|
|
196
|
+
message: string; // Response message
|
|
197
|
+
statementHandle?: string; // Handle for async operations
|
|
198
|
+
statementHandles?: string[]; // Multi-statement handles
|
|
199
|
+
statementStatusUrl?: string; // URL to check status
|
|
200
|
+
createdOn?: number; // Timestamp
|
|
201
|
+
resultSetMetaData?: { // Column metadata
|
|
202
|
+
numRows: number;
|
|
203
|
+
format: string;
|
|
204
|
+
rowType: SnowflakeColumnMetadata[];
|
|
205
|
+
partitionInfo?: SnowflakePartitionInfo[];
|
|
206
|
+
};
|
|
207
|
+
data?: (string | null)[][]; // Result rows
|
|
208
|
+
stats?: { // DML stats
|
|
209
|
+
numRowsInserted?: number;
|
|
210
|
+
numRowsUpdated?: number;
|
|
211
|
+
numRowsDeleted?: number;
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Example:**
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
import { SnowflakeResourceClient } from "@major-tech/resource-client";
|
|
220
|
+
const c = new SnowflakeResourceClient({ baseUrl, applicationId, resourceId, majorJwtToken });
|
|
221
|
+
|
|
222
|
+
// Execute a query
|
|
223
|
+
const r = await c.execute(
|
|
224
|
+
"SELECT * FROM users WHERE region = ?",
|
|
225
|
+
"fetch-users",
|
|
226
|
+
{
|
|
227
|
+
bindings: { "1": { type: "TEXT", value: "US-WEST" } },
|
|
228
|
+
warehouse: "COMPUTE_WH",
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
// r.ok ? r.result.data : r.error.message
|
|
232
|
+
|
|
233
|
+
// Async execution for long-running queries
|
|
234
|
+
const async = await c.execute(
|
|
235
|
+
"INSERT INTO large_table SELECT * FROM source",
|
|
236
|
+
"bulk-insert",
|
|
237
|
+
{ async: true }
|
|
238
|
+
);
|
|
239
|
+
// async.ok ? async.result.statementHandle : async.error
|
|
240
|
+
|
|
241
|
+
// Check status of async query
|
|
242
|
+
const status = await c.status(async.result.statementHandle!, "check-status");
|
|
243
|
+
// status.result.code === "090001" means completed
|
|
244
|
+
|
|
245
|
+
// Cancel a running query
|
|
246
|
+
const cancel = await c.cancel(statementHandle, "cancel-query");
|
|
247
|
+
```
|
|
248
|
+
|
|
160
249
|
## S3ResourceClient
|
|
161
250
|
|
|
162
251
|
**Constructor:** `new S3ResourceClient(config: BaseClientConfig)`
|
|
@@ -215,7 +304,7 @@ catch (e) { if (e instanceof ResourceInvokeError) { e.message, e.httpStatus, e.r
|
|
|
215
304
|
- `npx major-client remove <name>` - Remove resource
|
|
216
305
|
- `npx major-client regenerate` - Regenerate all clients
|
|
217
306
|
|
|
218
|
-
**Types:** `database-postgresql | database-dynamodb | api-custom | api-hubspot | storage-s3`
|
|
307
|
+
**Types:** `database-postgresql | database-dynamodb | database-cosmosdb | database-snowflake | api-custom | api-hubspot | api-googlesheets | storage-s3`
|
|
219
308
|
|
|
220
309
|
**Generated Files:**
|
|
221
310
|
|
package/bin/generate-clients.mjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* npx @major-tech/resource-client remove <name>
|
|
9
9
|
* npx @major-tech/resource-client list
|
|
10
10
|
*
|
|
11
|
-
* Types: database-postgresql | database-dynamodb | database-cosmosdb | api-hubspot | api-googlesheets | api-custom | storage-s3
|
|
11
|
+
* Types: database-postgresql | database-mssql | database-dynamodb | database-cosmosdb | database-snowflake | api-hubspot | api-googlesheets | api-custom | storage-s3
|
|
12
12
|
*
|
|
13
13
|
* Examples:
|
|
14
14
|
* npx @major-tech/resource-client add "abc-123" "orders-db" "database-postgresql" "Orders database" "app-123"
|
|
@@ -141,8 +141,10 @@ function toCamelCase(str) {
|
|
|
141
141
|
function getClientClass(type) {
|
|
142
142
|
const typeMap = {
|
|
143
143
|
'database-postgresql': 'PostgresResourceClient',
|
|
144
|
+
'database-mssql': 'MssqlResourceClient',
|
|
144
145
|
'database-dynamodb': 'DynamoDBResourceClient',
|
|
145
146
|
'database-cosmosdb': 'CosmosDBResourceClient',
|
|
147
|
+
'database-snowflake': 'SnowflakeResourceClient',
|
|
146
148
|
'api-custom': 'CustomApiResourceClient',
|
|
147
149
|
'api-hubspot': 'HubSpotResourceClient',
|
|
148
150
|
'api-googlesheets': 'GoogleSheetsResourceClient',
|
|
@@ -180,7 +182,7 @@ function generateIndexFile(resources) {
|
|
|
180
182
|
}
|
|
181
183
|
|
|
182
184
|
function addResource(resourceId, name, type, description, applicationId, framework) {
|
|
183
|
-
const validTypes = ['database-postgresql', 'database-dynamodb', 'database-cosmosdb', 'api-hubspot', 'api-googlesheets', 'api-custom', 'storage-s3'];
|
|
185
|
+
const validTypes = ['database-postgresql', 'database-mssql', 'database-dynamodb', 'database-cosmosdb', 'database-snowflake', 'api-hubspot', 'api-googlesheets', 'api-custom', 'storage-s3'];
|
|
184
186
|
if (!validTypes.includes(type)) {
|
|
185
187
|
console.error(`❌ Invalid type: ${type}`);
|
|
186
188
|
console.error(` Valid types: ${validTypes.join(', ')}`);
|
|
@@ -317,7 +319,7 @@ function main() {
|
|
|
317
319
|
console.log(' npx @major-tech/resource-client add <resource_id> <name> <type> <description> <application_id> [--framework <nextjs|vite>]');
|
|
318
320
|
console.log(' npx @major-tech/resource-client remove <name> [--framework <nextjs|vite>]');
|
|
319
321
|
console.log(' npx @major-tech/resource-client list');
|
|
320
|
-
console.log('\nTypes: database-postgresql | database-dynamodb | database-cosmosdb | api-hubspot | api-googlesheets | api-custom | storage-s3');
|
|
322
|
+
console.log('\nTypes: database-postgresql | database-mssql | database-dynamodb | database-cosmosdb | database-snowflake | api-hubspot | api-googlesheets | api-custom | storage-s3');
|
|
321
323
|
return;
|
|
322
324
|
}
|
|
323
325
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var mssql_exports = {};
|
|
21
|
+
__export(mssql_exports, {
|
|
22
|
+
MssqlResourceClient: () => MssqlResourceClient
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(mssql_exports);
|
|
25
|
+
var import_base = require("../base");
|
|
26
|
+
class MssqlResourceClient extends import_base.BaseResourceClient {
|
|
27
|
+
static {
|
|
28
|
+
__name(this, "MssqlResourceClient");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Execute a SQL query against MSSQL
|
|
32
|
+
* @param sql The SQL query to execute
|
|
33
|
+
* @param params Optional named parameters (e.g., { id: 123 } for @id in the query)
|
|
34
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
35
|
+
* @param timeoutMs Optional timeout in milliseconds
|
|
36
|
+
* @returns Typed response with rows of type T
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* interface User { id: number; name: string; email: string }
|
|
41
|
+
*
|
|
42
|
+
* const response = await client.invoke<User>(
|
|
43
|
+
* "SELECT id, name, email FROM users WHERE id = @id",
|
|
44
|
+
* { id: 123 },
|
|
45
|
+
* "get-user-123"
|
|
46
|
+
* );
|
|
47
|
+
*
|
|
48
|
+
* if (response.ok) {
|
|
49
|
+
* const users: User[] = response.result.rows;
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
async invoke(sql, params, invocationKey, timeoutMs) {
|
|
54
|
+
const payload = {
|
|
55
|
+
type: "database",
|
|
56
|
+
subtype: "mssql",
|
|
57
|
+
sql,
|
|
58
|
+
params,
|
|
59
|
+
timeoutMs
|
|
60
|
+
};
|
|
61
|
+
return this.invokeRaw(payload, invocationKey);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=mssql.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/clients/mssql.ts"],
|
|
4
|
+
"sourcesContent": ["import type {\n DbMssqlParamValue,\n DbMssqlPayload,\n DatabaseInvokeResponse,\n} from \"../schemas\";\nimport { BaseResourceClient } from \"../base\";\n\nexport class MssqlResourceClient extends BaseResourceClient {\n /**\n * Execute a SQL query against MSSQL\n * @param sql The SQL query to execute\n * @param params Optional named parameters (e.g., { id: 123 } for @id in the query)\n * @param invocationKey Unique key for tracking this invocation\n * @param timeoutMs Optional timeout in milliseconds\n * @returns Typed response with rows of type T\n *\n * @example\n * ```ts\n * interface User { id: number; name: string; email: string }\n *\n * const response = await client.invoke<User>(\n * \"SELECT id, name, email FROM users WHERE id = @id\",\n * { id: 123 },\n * \"get-user-123\"\n * );\n *\n * if (response.ok) {\n * const users: User[] = response.result.rows;\n * }\n * ```\n */\n async invoke<T = Record<string, unknown>>(\n sql: string,\n params: Record<string, DbMssqlParamValue> | undefined,\n invocationKey: string,\n timeoutMs?: number\n ): Promise<DatabaseInvokeResponse<T>> {\n const payload: DbMssqlPayload = {\n type: \"database\",\n subtype: \"mssql\",\n sql,\n params,\n timeoutMs,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<DatabaseInvokeResponse<T>>;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAKA;;;;;AAAA,kBAAmC;AAE7B,MAAO,4BAA4B,+BAAkB;EAF3D,OAE2D;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBzD,MAAM,OACJ,KACA,QACA,eACA,WAAkB;AAElB,UAAM,UAA0B;MAC9B,MAAM;MACN,SAAS;MACT;MACA;MACA;;AAGF,WAAO,KAAK,UAAU,SAAS,aAAa;EAC9C;;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DbMssqlParamValue, DatabaseInvokeResponse } from "../schemas";
|
|
2
|
+
import { BaseResourceClient } from "../base";
|
|
3
|
+
export declare class MssqlResourceClient extends BaseResourceClient {
|
|
4
|
+
/**
|
|
5
|
+
* Execute a SQL query against MSSQL
|
|
6
|
+
* @param sql The SQL query to execute
|
|
7
|
+
* @param params Optional named parameters (e.g., { id: 123 } for @id in the query)
|
|
8
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
9
|
+
* @param timeoutMs Optional timeout in milliseconds
|
|
10
|
+
* @returns Typed response with rows of type T
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* interface User { id: number; name: string; email: string }
|
|
15
|
+
*
|
|
16
|
+
* const response = await client.invoke<User>(
|
|
17
|
+
* "SELECT id, name, email FROM users WHERE id = @id",
|
|
18
|
+
* { id: 123 },
|
|
19
|
+
* "get-user-123"
|
|
20
|
+
* );
|
|
21
|
+
*
|
|
22
|
+
* if (response.ok) {
|
|
23
|
+
* const users: User[] = response.result.rows;
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
invoke<T = Record<string, unknown>>(sql: string, params: Record<string, DbMssqlParamValue> | undefined, invocationKey: string, timeoutMs?: number): Promise<DatabaseInvokeResponse<T>>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=mssql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mssql.d.ts","sourceRoot":"","sources":["../../src/clients/mssql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAEjB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,qBAAa,mBAAoB,SAAQ,kBAAkB;IACzD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAAS,EACrD,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;CAWtC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseResourceClient } from "../base";
|
|
2
|
+
export class MssqlResourceClient extends BaseResourceClient {
|
|
3
|
+
/**
|
|
4
|
+
* Execute a SQL query against MSSQL
|
|
5
|
+
* @param sql The SQL query to execute
|
|
6
|
+
* @param params Optional named parameters (e.g., { id: 123 } for @id in the query)
|
|
7
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
8
|
+
* @param timeoutMs Optional timeout in milliseconds
|
|
9
|
+
* @returns Typed response with rows of type T
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* interface User { id: number; name: string; email: string }
|
|
14
|
+
*
|
|
15
|
+
* const response = await client.invoke<User>(
|
|
16
|
+
* "SELECT id, name, email FROM users WHERE id = @id",
|
|
17
|
+
* { id: 123 },
|
|
18
|
+
* "get-user-123"
|
|
19
|
+
* );
|
|
20
|
+
*
|
|
21
|
+
* if (response.ok) {
|
|
22
|
+
* const users: User[] = response.result.rows;
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
async invoke(sql, params, invocationKey, timeoutMs) {
|
|
27
|
+
const payload = {
|
|
28
|
+
type: "database",
|
|
29
|
+
subtype: "mssql",
|
|
30
|
+
sql,
|
|
31
|
+
params,
|
|
32
|
+
timeoutMs,
|
|
33
|
+
};
|
|
34
|
+
return this.invokeRaw(payload, invocationKey);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=mssql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mssql.js","sourceRoot":"","sources":["../../src/clients/mssql.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,OAAO,mBAAoB,SAAQ,kBAAkB;IACzD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,MAAM,CACV,GAAW,EACX,MAAqD,EACrD,aAAqB,EACrB,SAAkB;QAElB,MAAM,OAAO,GAAmB;YAC9B,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,OAAO;YAChB,GAAG;YACH,MAAM;YACN,SAAS;SACV,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAAuC,CAAC;IACtF,CAAC;CACF"}
|
|
@@ -27,6 +27,29 @@ class PostgresResourceClient extends import_base.BaseResourceClient {
|
|
|
27
27
|
static {
|
|
28
28
|
__name(this, "PostgresResourceClient");
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Execute a SQL query against PostgreSQL
|
|
32
|
+
* @param sql The SQL query to execute
|
|
33
|
+
* @param params Optional positional parameters ($1, $2, etc.)
|
|
34
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
35
|
+
* @param timeoutMs Optional timeout in milliseconds
|
|
36
|
+
* @returns Typed response with rows of type T
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* interface User { id: number; name: string; email: string }
|
|
41
|
+
*
|
|
42
|
+
* const response = await client.invoke<User>(
|
|
43
|
+
* "SELECT id, name, email FROM users WHERE id = $1",
|
|
44
|
+
* [123],
|
|
45
|
+
* "get-user-123"
|
|
46
|
+
* );
|
|
47
|
+
*
|
|
48
|
+
* if (response.ok) {
|
|
49
|
+
* const users: User[] = response.result.rows;
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
30
53
|
async invoke(sql, params, invocationKey, timeoutMs) {
|
|
31
54
|
const payload = {
|
|
32
55
|
type: "database",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/clients/postgres.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n DbParamPrimitive,\n DbPostgresPayload,\n DatabaseInvokeResponse,\n} from \"../schemas\";\nimport { BaseResourceClient } from \"../base\";\n\nexport class PostgresResourceClient extends BaseResourceClient {\n async invoke(\n sql: string,\n params: DbParamPrimitive[] | undefined,\n invocationKey: string,\n timeoutMs?: number\n ): Promise<DatabaseInvokeResponse
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAKA;;;;;AAAA,kBAAmC;AAE7B,MAAO,+BAA+B,+BAAkB;EAF9D,OAE8D
|
|
4
|
+
"sourcesContent": ["import type {\n DbParamPrimitive,\n DbPostgresPayload,\n DatabaseInvokeResponse,\n} from \"../schemas\";\nimport { BaseResourceClient } from \"../base\";\n\nexport class PostgresResourceClient extends BaseResourceClient {\n /**\n * Execute a SQL query against PostgreSQL\n * @param sql The SQL query to execute\n * @param params Optional positional parameters ($1, $2, etc.)\n * @param invocationKey Unique key for tracking this invocation\n * @param timeoutMs Optional timeout in milliseconds\n * @returns Typed response with rows of type T\n *\n * @example\n * ```ts\n * interface User { id: number; name: string; email: string }\n *\n * const response = await client.invoke<User>(\n * \"SELECT id, name, email FROM users WHERE id = $1\",\n * [123],\n * \"get-user-123\"\n * );\n *\n * if (response.ok) {\n * const users: User[] = response.result.rows;\n * }\n * ```\n */\n async invoke<T = Record<string, unknown>>(\n sql: string,\n params: DbParamPrimitive[] | undefined,\n invocationKey: string,\n timeoutMs?: number\n ): Promise<DatabaseInvokeResponse<T>> {\n const payload: DbPostgresPayload = {\n type: \"database\",\n subtype: \"postgresql\",\n sql,\n params,\n timeoutMs,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<DatabaseInvokeResponse<T>>;\n }\n}\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAKA;;;;;AAAA,kBAAmC;AAE7B,MAAO,+BAA+B,+BAAkB;EAF9D,OAE8D;;;;;;;;;;;;;;;;;;;;;;;;;;EAwB5D,MAAM,OACJ,KACA,QACA,eACA,WAAkB;AAElB,UAAM,UAA6B;MACjC,MAAM;MACN,SAAS;MACT;MACA;MACA;;AAGF,WAAO,KAAK,UAAU,SAAS,aAAa;EAC9C;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
import type { DbParamPrimitive, DatabaseInvokeResponse } from "../schemas";
|
|
2
2
|
import { BaseResourceClient } from "../base";
|
|
3
3
|
export declare class PostgresResourceClient extends BaseResourceClient {
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Execute a SQL query against PostgreSQL
|
|
6
|
+
* @param sql The SQL query to execute
|
|
7
|
+
* @param params Optional positional parameters ($1, $2, etc.)
|
|
8
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
9
|
+
* @param timeoutMs Optional timeout in milliseconds
|
|
10
|
+
* @returns Typed response with rows of type T
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* interface User { id: number; name: string; email: string }
|
|
15
|
+
*
|
|
16
|
+
* const response = await client.invoke<User>(
|
|
17
|
+
* "SELECT id, name, email FROM users WHERE id = $1",
|
|
18
|
+
* [123],
|
|
19
|
+
* "get-user-123"
|
|
20
|
+
* );
|
|
21
|
+
*
|
|
22
|
+
* if (response.ok) {
|
|
23
|
+
* const users: User[] = response.result.rows;
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
invoke<T = Record<string, unknown>>(sql: string, params: DbParamPrimitive[] | undefined, invocationKey: string, timeoutMs?: number): Promise<DatabaseInvokeResponse<T>>;
|
|
5
28
|
}
|
|
6
29
|
//# sourceMappingURL=postgres.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/clients/postgres.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,qBAAa,sBAAuB,SAAQ,kBAAkB;
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/clients/postgres.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,gBAAgB,EAAE,GAAG,SAAS,EACtC,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;CAWtC"}
|
package/dist/clients/postgres.js
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
import { BaseResourceClient } from "../base";
|
|
2
2
|
export class PostgresResourceClient extends BaseResourceClient {
|
|
3
|
+
/**
|
|
4
|
+
* Execute a SQL query against PostgreSQL
|
|
5
|
+
* @param sql The SQL query to execute
|
|
6
|
+
* @param params Optional positional parameters ($1, $2, etc.)
|
|
7
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
8
|
+
* @param timeoutMs Optional timeout in milliseconds
|
|
9
|
+
* @returns Typed response with rows of type T
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* interface User { id: number; name: string; email: string }
|
|
14
|
+
*
|
|
15
|
+
* const response = await client.invoke<User>(
|
|
16
|
+
* "SELECT id, name, email FROM users WHERE id = $1",
|
|
17
|
+
* [123],
|
|
18
|
+
* "get-user-123"
|
|
19
|
+
* );
|
|
20
|
+
*
|
|
21
|
+
* if (response.ok) {
|
|
22
|
+
* const users: User[] = response.result.rows;
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
3
26
|
async invoke(sql, params, invocationKey, timeoutMs) {
|
|
4
27
|
const payload = {
|
|
5
28
|
type: "database",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.js","sourceRoot":"","sources":["../../src/clients/postgres.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAC5D,KAAK,CAAC,MAAM,CACV,GAAW,EACX,MAAsC,EACtC,aAAqB,EACrB,SAAkB;QAElB,MAAM,OAAO,GAAsB;YACjC,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,YAAY;YACrB,GAAG;YACH,MAAM;YACN,SAAS;SACV,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"postgres.js","sourceRoot":"","sources":["../../src/clients/postgres.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAC5D;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,MAAM,CACV,GAAW,EACX,MAAsC,EACtC,aAAqB,EACrB,SAAkB;QAElB,MAAM,OAAO,GAAsB;YACjC,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,YAAY;YACrB,GAAG;YACH,MAAM;YACN,SAAS;SACV,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAAuC,CAAC;IACtF,CAAC;CACF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var snowflake_exports = {};
|
|
21
|
+
__export(snowflake_exports, {
|
|
22
|
+
SnowflakeResourceClient: () => SnowflakeResourceClient
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(snowflake_exports);
|
|
25
|
+
var import_base = require("../base");
|
|
26
|
+
class SnowflakeResourceClient extends import_base.BaseResourceClient {
|
|
27
|
+
static {
|
|
28
|
+
__name(this, "SnowflakeResourceClient");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Invoke a Snowflake operation with a raw payload
|
|
32
|
+
* @param payload The complete operation payload
|
|
33
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
34
|
+
*/
|
|
35
|
+
async invoke(payload, invocationKey) {
|
|
36
|
+
return this.invokeRaw(payload, invocationKey);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Execute a SQL statement
|
|
40
|
+
* @param statement The SQL statement to execute
|
|
41
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
42
|
+
* @param options Execution options (bindings, database overrides, async, etc.)
|
|
43
|
+
*/
|
|
44
|
+
async execute(statement, invocationKey, options = {}) {
|
|
45
|
+
const payload = {
|
|
46
|
+
type: "database",
|
|
47
|
+
subtype: "snowflake",
|
|
48
|
+
operation: "execute",
|
|
49
|
+
statement,
|
|
50
|
+
bindings: options.bindings,
|
|
51
|
+
database: options.database,
|
|
52
|
+
schema: options.schema,
|
|
53
|
+
warehouse: options.warehouse,
|
|
54
|
+
role: options.role,
|
|
55
|
+
timeout: options.timeout,
|
|
56
|
+
async: options.async,
|
|
57
|
+
parameters: options.parameters,
|
|
58
|
+
nullable: options.nullable,
|
|
59
|
+
requestId: options.requestId
|
|
60
|
+
};
|
|
61
|
+
return this.invokeRaw(payload, invocationKey);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get status or results of a statement
|
|
65
|
+
* @param statementHandle The statement handle from execute operation
|
|
66
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
67
|
+
* @param options Status options (partition for paginated results)
|
|
68
|
+
*/
|
|
69
|
+
async status(statementHandle, invocationKey, options = {}) {
|
|
70
|
+
const payload = {
|
|
71
|
+
type: "database",
|
|
72
|
+
subtype: "snowflake",
|
|
73
|
+
operation: "status",
|
|
74
|
+
statementHandle,
|
|
75
|
+
partition: options.partition
|
|
76
|
+
};
|
|
77
|
+
return this.invokeRaw(payload, invocationKey);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Cancel a running statement
|
|
81
|
+
* @param statementHandle The statement handle to cancel
|
|
82
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
83
|
+
*/
|
|
84
|
+
async cancel(statementHandle, invocationKey) {
|
|
85
|
+
const payload = {
|
|
86
|
+
type: "database",
|
|
87
|
+
subtype: "snowflake",
|
|
88
|
+
operation: "cancel",
|
|
89
|
+
statementHandle
|
|
90
|
+
};
|
|
91
|
+
return this.invokeRaw(payload, invocationKey);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=snowflake.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/clients/snowflake.ts"],
|
|
4
|
+
"sourcesContent": ["import type {\n DbSnowflakePayload,\n DbSnowflakeResult,\n SnowflakeBindingValue,\n SnowflakeSessionParameters,\n SnowflakeExecutePayload,\n SnowflakeStatusPayload,\n SnowflakeCancelPayload,\n} from \"../schemas\";\nimport type { BaseInvokeSuccess, InvokeFailure } from \"../schemas/response\";\nimport { BaseResourceClient } from \"../base\";\n\n/**\n * Response type for Snowflake operations\n */\nexport type SnowflakeInvokeResponse =\n | BaseInvokeSuccess<DbSnowflakeResult>\n | InvokeFailure;\n\n/**\n * Options for execute operation\n */\nexport interface SnowflakeExecuteOptions {\n /** Parameter bindings */\n bindings?: Record<string, SnowflakeBindingValue>;\n /** Override default database */\n database?: string;\n /** Override default schema */\n schema?: string;\n /** Override default warehouse */\n warehouse?: string;\n /** Override default role */\n role?: string;\n /** Timeout in seconds (0 = max timeout of 604800s / 7 days) */\n timeout?: number;\n /** Execute asynchronously - returns statementHandle immediately */\n async?: boolean;\n /** Session parameters for this execution */\n parameters?: SnowflakeSessionParameters;\n /** Return SQL NULL as string \"null\" instead of JSON null */\n nullable?: boolean;\n /** Request ID for idempotency (auto-generated if not provided) */\n requestId?: string;\n}\n\n/**\n * Options for status operation\n */\nexport interface SnowflakeStatusOptions {\n /** For paginated results - retrieve specific partition (0-indexed) */\n partition?: number;\n}\n\nexport class SnowflakeResourceClient extends BaseResourceClient {\n /**\n * Invoke a Snowflake operation with a raw payload\n * @param payload The complete operation payload\n * @param invocationKey Unique key for tracking this invocation\n */\n async invoke(\n payload: DbSnowflakePayload,\n invocationKey: string\n ): Promise<SnowflakeInvokeResponse> {\n return this.invokeRaw(payload, invocationKey) as Promise<SnowflakeInvokeResponse>;\n }\n\n /**\n * Execute a SQL statement\n * @param statement The SQL statement to execute\n * @param invocationKey Unique key for tracking this invocation\n * @param options Execution options (bindings, database overrides, async, etc.)\n */\n async execute(\n statement: string,\n invocationKey: string,\n options: SnowflakeExecuteOptions = {}\n ): Promise<SnowflakeInvokeResponse> {\n const payload: SnowflakeExecutePayload = {\n type: \"database\",\n subtype: \"snowflake\",\n operation: \"execute\",\n statement,\n bindings: options.bindings,\n database: options.database,\n schema: options.schema,\n warehouse: options.warehouse,\n role: options.role,\n timeout: options.timeout,\n async: options.async,\n parameters: options.parameters,\n nullable: options.nullable,\n requestId: options.requestId,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<SnowflakeInvokeResponse>;\n }\n\n /**\n * Get status or results of a statement\n * @param statementHandle The statement handle from execute operation\n * @param invocationKey Unique key for tracking this invocation\n * @param options Status options (partition for paginated results)\n */\n async status(\n statementHandle: string,\n invocationKey: string,\n options: SnowflakeStatusOptions = {}\n ): Promise<SnowflakeInvokeResponse> {\n const payload: SnowflakeStatusPayload = {\n type: \"database\",\n subtype: \"snowflake\",\n operation: \"status\",\n statementHandle,\n partition: options.partition,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<SnowflakeInvokeResponse>;\n }\n\n /**\n * Cancel a running statement\n * @param statementHandle The statement handle to cancel\n * @param invocationKey Unique key for tracking this invocation\n */\n async cancel(\n statementHandle: string,\n invocationKey: string\n ): Promise<SnowflakeInvokeResponse> {\n const payload: SnowflakeCancelPayload = {\n type: \"database\",\n subtype: \"snowflake\",\n operation: \"cancel\",\n statementHandle,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<SnowflakeInvokeResponse>;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAUA;;;;;AAAA,kBAAmC;AA2C7B,MAAO,gCAAgC,+BAAkB;EA3C/D,OA2C+D;;;;;;;;EAM7D,MAAM,OACJ,SACA,eAAqB;AAErB,WAAO,KAAK,UAAU,SAAS,aAAa;EAC9C;;;;;;;EAQA,MAAM,QACJ,WACA,eACA,UAAmC,CAAA,GAAE;AAErC,UAAM,UAAmC;MACvC,MAAM;MACN,SAAS;MACT,WAAW;MACX;MACA,UAAU,QAAQ;MAClB,UAAU,QAAQ;MAClB,QAAQ,QAAQ;MAChB,WAAW,QAAQ;MACnB,MAAM,QAAQ;MACd,SAAS,QAAQ;MACjB,OAAO,QAAQ;MACf,YAAY,QAAQ;MACpB,UAAU,QAAQ;MAClB,WAAW,QAAQ;;AAGrB,WAAO,KAAK,UAAU,SAAS,aAAa;EAC9C;;;;;;;EAQA,MAAM,OACJ,iBACA,eACA,UAAkC,CAAA,GAAE;AAEpC,UAAM,UAAkC;MACtC,MAAM;MACN,SAAS;MACT,WAAW;MACX;MACA,WAAW,QAAQ;;AAGrB,WAAO,KAAK,UAAU,SAAS,aAAa;EAC9C;;;;;;EAOA,MAAM,OACJ,iBACA,eAAqB;AAErB,UAAM,UAAkC;MACtC,MAAM;MACN,SAAS;MACT,WAAW;MACX;;AAGF,WAAO,KAAK,UAAU,SAAS,aAAa;EAC9C;;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { DbSnowflakePayload, DbSnowflakeResult, SnowflakeBindingValue, SnowflakeSessionParameters } from "../schemas";
|
|
2
|
+
import type { BaseInvokeSuccess, InvokeFailure } from "../schemas/response";
|
|
3
|
+
import { BaseResourceClient } from "../base";
|
|
4
|
+
/**
|
|
5
|
+
* Response type for Snowflake operations
|
|
6
|
+
*/
|
|
7
|
+
export type SnowflakeInvokeResponse = BaseInvokeSuccess<DbSnowflakeResult> | InvokeFailure;
|
|
8
|
+
/**
|
|
9
|
+
* Options for execute operation
|
|
10
|
+
*/
|
|
11
|
+
export interface SnowflakeExecuteOptions {
|
|
12
|
+
/** Parameter bindings */
|
|
13
|
+
bindings?: Record<string, SnowflakeBindingValue>;
|
|
14
|
+
/** Override default database */
|
|
15
|
+
database?: string;
|
|
16
|
+
/** Override default schema */
|
|
17
|
+
schema?: string;
|
|
18
|
+
/** Override default warehouse */
|
|
19
|
+
warehouse?: string;
|
|
20
|
+
/** Override default role */
|
|
21
|
+
role?: string;
|
|
22
|
+
/** Timeout in seconds (0 = max timeout of 604800s / 7 days) */
|
|
23
|
+
timeout?: number;
|
|
24
|
+
/** Execute asynchronously - returns statementHandle immediately */
|
|
25
|
+
async?: boolean;
|
|
26
|
+
/** Session parameters for this execution */
|
|
27
|
+
parameters?: SnowflakeSessionParameters;
|
|
28
|
+
/** Return SQL NULL as string "null" instead of JSON null */
|
|
29
|
+
nullable?: boolean;
|
|
30
|
+
/** Request ID for idempotency (auto-generated if not provided) */
|
|
31
|
+
requestId?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Options for status operation
|
|
35
|
+
*/
|
|
36
|
+
export interface SnowflakeStatusOptions {
|
|
37
|
+
/** For paginated results - retrieve specific partition (0-indexed) */
|
|
38
|
+
partition?: number;
|
|
39
|
+
}
|
|
40
|
+
export declare class SnowflakeResourceClient extends BaseResourceClient {
|
|
41
|
+
/**
|
|
42
|
+
* Invoke a Snowflake operation with a raw payload
|
|
43
|
+
* @param payload The complete operation payload
|
|
44
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
45
|
+
*/
|
|
46
|
+
invoke(payload: DbSnowflakePayload, invocationKey: string): Promise<SnowflakeInvokeResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Execute a SQL statement
|
|
49
|
+
* @param statement The SQL statement to execute
|
|
50
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
51
|
+
* @param options Execution options (bindings, database overrides, async, etc.)
|
|
52
|
+
*/
|
|
53
|
+
execute(statement: string, invocationKey: string, options?: SnowflakeExecuteOptions): Promise<SnowflakeInvokeResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Get status or results of a statement
|
|
56
|
+
* @param statementHandle The statement handle from execute operation
|
|
57
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
58
|
+
* @param options Status options (partition for paginated results)
|
|
59
|
+
*/
|
|
60
|
+
status(statementHandle: string, invocationKey: string, options?: SnowflakeStatusOptions): Promise<SnowflakeInvokeResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Cancel a running statement
|
|
63
|
+
* @param statementHandle The statement handle to cancel
|
|
64
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
65
|
+
*/
|
|
66
|
+
cancel(statementHandle: string, invocationKey: string): Promise<SnowflakeInvokeResponse>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=snowflake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snowflake.d.ts","sourceRoot":"","sources":["../../src/clients/snowflake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAI3B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAC/B,iBAAiB,CAAC,iBAAiB,CAAC,GACpC,aAAa,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IACjD,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,0BAA0B,CAAC;IACxC,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,uBAAwB,SAAQ,kBAAkB;IAC7D;;;;OAIG;IACG,MAAM,CACV,OAAO,EAAE,kBAAkB,EAC3B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,uBAAuB,CAAC;IAInC;;;;;OAKG;IACG,OAAO,CACX,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,uBAAuB,CAAC;IAqBnC;;;;;OAKG;IACG,MAAM,CACV,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,uBAAuB,CAAC;IAYnC;;;;OAIG;IACG,MAAM,CACV,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,uBAAuB,CAAC;CAUpC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BaseResourceClient } from "../base";
|
|
2
|
+
export class SnowflakeResourceClient extends BaseResourceClient {
|
|
3
|
+
/**
|
|
4
|
+
* Invoke a Snowflake operation with a raw payload
|
|
5
|
+
* @param payload The complete operation payload
|
|
6
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
7
|
+
*/
|
|
8
|
+
async invoke(payload, invocationKey) {
|
|
9
|
+
return this.invokeRaw(payload, invocationKey);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Execute a SQL statement
|
|
13
|
+
* @param statement The SQL statement to execute
|
|
14
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
15
|
+
* @param options Execution options (bindings, database overrides, async, etc.)
|
|
16
|
+
*/
|
|
17
|
+
async execute(statement, invocationKey, options = {}) {
|
|
18
|
+
const payload = {
|
|
19
|
+
type: "database",
|
|
20
|
+
subtype: "snowflake",
|
|
21
|
+
operation: "execute",
|
|
22
|
+
statement,
|
|
23
|
+
bindings: options.bindings,
|
|
24
|
+
database: options.database,
|
|
25
|
+
schema: options.schema,
|
|
26
|
+
warehouse: options.warehouse,
|
|
27
|
+
role: options.role,
|
|
28
|
+
timeout: options.timeout,
|
|
29
|
+
async: options.async,
|
|
30
|
+
parameters: options.parameters,
|
|
31
|
+
nullable: options.nullable,
|
|
32
|
+
requestId: options.requestId,
|
|
33
|
+
};
|
|
34
|
+
return this.invokeRaw(payload, invocationKey);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get status or results of a statement
|
|
38
|
+
* @param statementHandle The statement handle from execute operation
|
|
39
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
40
|
+
* @param options Status options (partition for paginated results)
|
|
41
|
+
*/
|
|
42
|
+
async status(statementHandle, invocationKey, options = {}) {
|
|
43
|
+
const payload = {
|
|
44
|
+
type: "database",
|
|
45
|
+
subtype: "snowflake",
|
|
46
|
+
operation: "status",
|
|
47
|
+
statementHandle,
|
|
48
|
+
partition: options.partition,
|
|
49
|
+
};
|
|
50
|
+
return this.invokeRaw(payload, invocationKey);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Cancel a running statement
|
|
54
|
+
* @param statementHandle The statement handle to cancel
|
|
55
|
+
* @param invocationKey Unique key for tracking this invocation
|
|
56
|
+
*/
|
|
57
|
+
async cancel(statementHandle, invocationKey) {
|
|
58
|
+
const payload = {
|
|
59
|
+
type: "database",
|
|
60
|
+
subtype: "snowflake",
|
|
61
|
+
operation: "cancel",
|
|
62
|
+
statementHandle,
|
|
63
|
+
};
|
|
64
|
+
return this.invokeRaw(payload, invocationKey);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=snowflake.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snowflake.js","sourceRoot":"","sources":["../../src/clients/snowflake.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA2C7C,MAAM,OAAO,uBAAwB,SAAQ,kBAAkB;IAC7D;;;;OAIG;IACH,KAAK,CAAC,MAAM,CACV,OAA2B,EAC3B,a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,eAAe;SAChB,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAAqC,CAAC;IACpF,CAAC;CACF"}
|
package/dist/index.cjs
CHANGED
|
@@ -25,17 +25,21 @@ __export(index_exports, {
|
|
|
25
25
|
DynamoDBResourceClient: () => import_dynamodb.DynamoDBResourceClient,
|
|
26
26
|
GoogleSheetsResourceClient: () => import_googlesheets.GoogleSheetsResourceClient,
|
|
27
27
|
HubSpotResourceClient: () => import_hubspot.HubSpotResourceClient,
|
|
28
|
+
MssqlResourceClient: () => import_mssql.MssqlResourceClient,
|
|
28
29
|
PostgresResourceClient: () => import_postgres.PostgresResourceClient,
|
|
29
30
|
ResourceInvokeError: () => import_errors.ResourceInvokeError,
|
|
30
|
-
S3ResourceClient: () => import_s3.S3ResourceClient
|
|
31
|
+
S3ResourceClient: () => import_s3.S3ResourceClient,
|
|
32
|
+
SnowflakeResourceClient: () => import_snowflake.SnowflakeResourceClient
|
|
31
33
|
});
|
|
32
34
|
module.exports = __toCommonJS(index_exports);
|
|
33
35
|
__reExport(index_exports, require("./schemas"), module.exports);
|
|
34
36
|
var import_base = require("./base");
|
|
35
37
|
var import_errors = require("./errors");
|
|
36
38
|
var import_postgres = require("./clients/postgres");
|
|
39
|
+
var import_mssql = require("./clients/mssql");
|
|
37
40
|
var import_dynamodb = require("./clients/dynamodb");
|
|
38
41
|
var import_cosmosdb = require("./clients/cosmosdb");
|
|
42
|
+
var import_snowflake = require("./clients/snowflake");
|
|
39
43
|
var import_api_custom = require("./clients/api-custom");
|
|
40
44
|
var import_hubspot = require("./clients/hubspot");
|
|
41
45
|
var import_googlesheets = require("./clients/googlesheets");
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["// Export all schemas and types\nexport * from \"./schemas\";\n\n// Export base client and config\nexport { BaseResourceClient, type BaseClientConfig } from \"./base\";\n\n// Export errors\nexport { ResourceInvokeError } from \"./errors\";\n\n// Export individual clients\nexport { PostgresResourceClient } from \"./clients/postgres\";\nexport { DynamoDBResourceClient } from \"./clients/dynamodb\";\nexport { CosmosDBResourceClient } from \"./clients/cosmosdb\";\nexport { CustomApiResourceClient } from \"./clients/api-custom\";\nexport { HubSpotResourceClient } from \"./clients/hubspot\";\nexport { GoogleSheetsResourceClient } from \"./clients/googlesheets\";\nexport { S3ResourceClient } from \"./clients/s3\";\n\n// Re-export common response types for convenience\nexport type {\n DatabaseInvokeResponse,\n DynamoDBInvokeResponse,\n CosmosDBInvokeResponse,\n ApiInvokeResponse,\n StorageInvokeResponse,\n BaseInvokeSuccess,\n} from \"./schemas/response\";\n\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA
|
|
4
|
+
"sourcesContent": ["// Export all schemas and types\nexport * from \"./schemas\";\n\n// Export base client and config\nexport { BaseResourceClient, type BaseClientConfig } from \"./base\";\n\n// Export errors\nexport { ResourceInvokeError } from \"./errors\";\n\n// Export individual clients\nexport { PostgresResourceClient } from \"./clients/postgres\";\nexport { MssqlResourceClient } from \"./clients/mssql\";\nexport { DynamoDBResourceClient } from \"./clients/dynamodb\";\nexport { CosmosDBResourceClient } from \"./clients/cosmosdb\";\nexport { SnowflakeResourceClient } from \"./clients/snowflake\";\nexport { CustomApiResourceClient } from \"./clients/api-custom\";\nexport { HubSpotResourceClient } from \"./clients/hubspot\";\nexport { GoogleSheetsResourceClient } from \"./clients/googlesheets\";\nexport { S3ResourceClient } from \"./clients/s3\";\n\n// Re-export common response types for convenience\nexport type {\n DatabaseInvokeResponse,\n DynamoDBInvokeResponse,\n CosmosDBInvokeResponse,\n SnowflakeInvokeResponse,\n ApiInvokeResponse,\n StorageInvokeResponse,\n BaseInvokeSuccess,\n} from \"./schemas/response\";\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;AACA,0BAAc,sBADd;AAIA,kBAA0D;AAG1D,oBAAoC;AAGpC,sBAAuC;AACvC,mBAAoC;AACpC,sBAAuC;AACvC,sBAAuC;AACvC,uBAAwC;AACxC,wBAAwC;AACxC,qBAAsC;AACtC,0BAA2C;AAC3C,gBAAiC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,13 @@ export * from "./schemas";
|
|
|
2
2
|
export { BaseResourceClient, type BaseClientConfig } from "./base";
|
|
3
3
|
export { ResourceInvokeError } from "./errors";
|
|
4
4
|
export { PostgresResourceClient } from "./clients/postgres";
|
|
5
|
+
export { MssqlResourceClient } from "./clients/mssql";
|
|
5
6
|
export { DynamoDBResourceClient } from "./clients/dynamodb";
|
|
6
7
|
export { CosmosDBResourceClient } from "./clients/cosmosdb";
|
|
8
|
+
export { SnowflakeResourceClient } from "./clients/snowflake";
|
|
7
9
|
export { CustomApiResourceClient } from "./clients/api-custom";
|
|
8
10
|
export { HubSpotResourceClient } from "./clients/hubspot";
|
|
9
11
|
export { GoogleSheetsResourceClient } from "./clients/googlesheets";
|
|
10
12
|
export { S3ResourceClient } from "./clients/s3";
|
|
11
|
-
export type { DatabaseInvokeResponse, DynamoDBInvokeResponse, CosmosDBInvokeResponse, ApiInvokeResponse, StorageInvokeResponse, BaseInvokeSuccess, } from "./schemas/response";
|
|
13
|
+
export type { DatabaseInvokeResponse, DynamoDBInvokeResponse, CosmosDBInvokeResponse, SnowflakeInvokeResponse, ApiInvokeResponse, StorageInvokeResponse, BaseInvokeSuccess, } from "./schemas/response";
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE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,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,8 +6,10 @@ export { BaseResourceClient } from "./base";
|
|
|
6
6
|
export { ResourceInvokeError } from "./errors";
|
|
7
7
|
// Export individual clients
|
|
8
8
|
export { PostgresResourceClient } from "./clients/postgres";
|
|
9
|
+
export { MssqlResourceClient } from "./clients/mssql";
|
|
9
10
|
export { DynamoDBResourceClient } from "./clients/dynamodb";
|
|
10
11
|
export { CosmosDBResourceClient } from "./clients/cosmosdb";
|
|
12
|
+
export { SnowflakeResourceClient } from "./clients/snowflake";
|
|
11
13
|
export { CustomApiResourceClient } from "./clients/api-custom";
|
|
12
14
|
export { HubSpotResourceClient } from "./clients/hubspot";
|
|
13
15
|
export { GoogleSheetsResourceClient } from "./clients/googlesheets";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,cAAc,WAAW,CAAC;AAE1B,gCAAgC;AAChC,OAAO,EAAE,kBAAkB,EAAyB,MAAM,QAAQ,CAAC;AAEnE,gBAAgB;AAChB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,4BAA4B;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,cAAc,WAAW,CAAC;AAE1B,gCAAgC;AAChC,OAAO,EAAE,kBAAkB,EAAyB,MAAM,QAAQ,CAAC;AAEnE,gBAAgB;AAChB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,4BAA4B;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/schemas/index.cjs
CHANGED
|
@@ -17,8 +17,10 @@ var index_exports = {};
|
|
|
17
17
|
module.exports = __toCommonJS(index_exports);
|
|
18
18
|
__reExport(index_exports, require("./common"), module.exports);
|
|
19
19
|
__reExport(index_exports, require("./postgres"), module.exports);
|
|
20
|
+
__reExport(index_exports, require("./mssql"), module.exports);
|
|
20
21
|
__reExport(index_exports, require("./dynamodb"), module.exports);
|
|
21
22
|
__reExport(index_exports, require("./cosmosdb"), module.exports);
|
|
23
|
+
__reExport(index_exports, require("./snowflake"), module.exports);
|
|
22
24
|
__reExport(index_exports, require("./s3"), module.exports);
|
|
23
25
|
__reExport(index_exports, require("./api-custom"), module.exports);
|
|
24
26
|
__reExport(index_exports, require("./api-hubspot"), module.exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/schemas/index.ts"],
|
|
4
|
-
"sourcesContent": ["// Re-export all types\nexport * from \"./common\";\nexport * from \"./postgres\";\nexport * from \"./dynamodb\";\nexport * from \"./cosmosdb\";\nexport * from \"./s3\";\nexport * from \"./api-custom\";\nexport * from \"./api-hubspot\";\nexport * from \"./api-googlesheets\";\nexport * from \"./request\";\nexport * from \"./response\";\n\n// Import for discriminated union\nimport type { ApiCustomPayload } from \"./api-custom\";\nimport type { ApiHubSpotPayload } from \"./api-hubspot\";\nimport type { ApiGoogleSheetsPayload } from \"./api-googlesheets\";\nimport type { DbPostgresPayload } from \"./postgres\";\nimport type { DbDynamoDBPayload } from \"./dynamodb\";\nimport type { DbCosmosDBPayload } from \"./cosmosdb\";\nimport type { StorageS3Payload } from \"./s3\";\n\n/**\n * Discriminated union of all resource payload types\n * Use the 'subtype' field to narrow the type\n */\nexport type ResourceInvokePayload =\n | ApiCustomPayload\n | DbPostgresPayload\n | DbDynamoDBPayload\n | DbCosmosDBPayload\n | ApiHubSpotPayload\n | ApiGoogleSheetsPayload\n | StorageS3Payload;\n\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;;AACA,0BAAc,qBADd;AAEA,0BAAc,uBAFd;AAGA,0BAAc,
|
|
4
|
+
"sourcesContent": ["// Re-export all types\nexport * from \"./common\";\nexport * from \"./postgres\";\nexport * from \"./mssql\";\nexport * from \"./dynamodb\";\nexport * from \"./cosmosdb\";\nexport * from \"./snowflake\";\nexport * from \"./s3\";\nexport * from \"./api-custom\";\nexport * from \"./api-hubspot\";\nexport * from \"./api-googlesheets\";\nexport * from \"./request\";\nexport * from \"./response\";\n\n// Import for discriminated union\nimport type { ApiCustomPayload } from \"./api-custom\";\nimport type { ApiHubSpotPayload } from \"./api-hubspot\";\nimport type { ApiGoogleSheetsPayload } from \"./api-googlesheets\";\nimport type { DbPostgresPayload } from \"./postgres\";\nimport type { DbMssqlPayload } from \"./mssql\";\nimport type { DbDynamoDBPayload } from \"./dynamodb\";\nimport type { DbCosmosDBPayload } from \"./cosmosdb\";\nimport type { DbSnowflakePayload } from \"./snowflake\";\nimport type { StorageS3Payload } from \"./s3\";\n\n/**\n * Discriminated union of all resource payload types\n * Use the 'subtype' field to narrow the type\n */\nexport type ResourceInvokePayload =\n | ApiCustomPayload\n | DbPostgresPayload\n | DbMssqlPayload\n | DbDynamoDBPayload\n | DbCosmosDBPayload\n | DbSnowflakePayload\n | ApiHubSpotPayload\n | ApiGoogleSheetsPayload\n | StorageS3Payload;\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;AACA,0BAAc,qBADd;AAEA,0BAAc,uBAFd;AAGA,0BAAc,oBAHd;AAIA,0BAAc,uBAJd;AAKA,0BAAc,uBALd;AAMA,0BAAc,wBANd;AAOA,0BAAc,iBAPd;AAQA,0BAAc,yBARd;AASA,0BAAc,0BATd;AAUA,0BAAc,+BAVd;AAWA,0BAAc,sBAXd;AAYA,0BAAc,uBAZd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from "./common";
|
|
2
2
|
export * from "./postgres";
|
|
3
|
+
export * from "./mssql";
|
|
3
4
|
export * from "./dynamodb";
|
|
4
5
|
export * from "./cosmosdb";
|
|
6
|
+
export * from "./snowflake";
|
|
5
7
|
export * from "./s3";
|
|
6
8
|
export * from "./api-custom";
|
|
7
9
|
export * from "./api-hubspot";
|
|
@@ -12,12 +14,14 @@ import type { ApiCustomPayload } from "./api-custom";
|
|
|
12
14
|
import type { ApiHubSpotPayload } from "./api-hubspot";
|
|
13
15
|
import type { ApiGoogleSheetsPayload } from "./api-googlesheets";
|
|
14
16
|
import type { DbPostgresPayload } from "./postgres";
|
|
17
|
+
import type { DbMssqlPayload } from "./mssql";
|
|
15
18
|
import type { DbDynamoDBPayload } from "./dynamodb";
|
|
16
19
|
import type { DbCosmosDBPayload } from "./cosmosdb";
|
|
20
|
+
import type { DbSnowflakePayload } from "./snowflake";
|
|
17
21
|
import type { StorageS3Payload } from "./s3";
|
|
18
22
|
/**
|
|
19
23
|
* Discriminated union of all resource payload types
|
|
20
24
|
* Use the 'subtype' field to narrow the type
|
|
21
25
|
*/
|
|
22
|
-
export type ResourceInvokePayload = ApiCustomPayload | DbPostgresPayload | DbDynamoDBPayload | DbCosmosDBPayload | ApiHubSpotPayload | ApiGoogleSheetsPayload | StorageS3Payload;
|
|
26
|
+
export type ResourceInvokePayload = ApiCustomPayload | DbPostgresPayload | DbMssqlPayload | DbDynamoDBPayload | DbCosmosDBPayload | DbSnowflakePayload | ApiHubSpotPayload | ApiGoogleSheetsPayload | StorageS3Payload;
|
|
23
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,MAAM,CAAC;AACrB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAG3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK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,GAC7B,gBAAgB,GAChB,iBAAiB,GACjB,cAAc,GACd,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,sBAAsB,GACtB,gBAAgB,CAAC"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Re-export all types
|
|
2
2
|
export * from "./common";
|
|
3
3
|
export * from "./postgres";
|
|
4
|
+
export * from "./mssql";
|
|
4
5
|
export * from "./dynamodb";
|
|
5
6
|
export * from "./cosmosdb";
|
|
7
|
+
export * from "./snowflake";
|
|
6
8
|
export * from "./s3";
|
|
7
9
|
export * from "./api-custom";
|
|
8
10
|
export * from "./api-hubspot";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,MAAM,CAAC;AACrB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,MAAM,CAAC;AACrB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var mssql_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(mssql_exports);
|
|
17
|
+
//# sourceMappingURL=mssql.cjs.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allowed types for MSSQL query parameters (named parameters)
|
|
3
|
+
*/
|
|
4
|
+
export type DbMssqlParamValue = string | number | boolean | null;
|
|
5
|
+
/**
|
|
6
|
+
* Payload for invoking a Microsoft SQL Server database resource
|
|
7
|
+
*/
|
|
8
|
+
export interface DbMssqlPayload {
|
|
9
|
+
type: "database";
|
|
10
|
+
subtype: "mssql";
|
|
11
|
+
/** SQL query to execute */
|
|
12
|
+
sql: string;
|
|
13
|
+
/** Optional named parameters for the query (e.g., { id: 123 } for @id) */
|
|
14
|
+
params?: Record<string, DbMssqlParamValue>;
|
|
15
|
+
/** Optional timeout in milliseconds */
|
|
16
|
+
timeoutMs?: number;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=mssql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mssql.d.ts","sourceRoot":"","sources":["../../src/schemas/mssql.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC3C,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mssql.js","sourceRoot":"","sources":["../../src/schemas/mssql.ts"],"names":[],"mappings":""}
|
|
@@ -16,12 +16,12 @@ export interface DbPostgresPayload {
|
|
|
16
16
|
timeoutMs?: number;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Result from a database query execution
|
|
19
|
+
* Result from a database query execution with typed rows
|
|
20
20
|
*/
|
|
21
|
-
export interface DbResult {
|
|
21
|
+
export interface DbResult<T = Record<string, unknown>> {
|
|
22
22
|
kind: "database";
|
|
23
23
|
/** Array of row objects returned by the query */
|
|
24
|
-
rows:
|
|
24
|
+
rows: T[];
|
|
25
25
|
/** Number of rows affected by the query (for INSERT, UPDATE, DELETE) */
|
|
26
26
|
rowsAffected?: number;
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/schemas/postgres.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC5B,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/schemas/postgres.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC5B,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnD,IAAI,EAAE,UAAU,CAAC;IACjB,iDAAiD;IACjD,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -3,10 +3,11 @@ import type { DbResult } from "./postgres";
|
|
|
3
3
|
import type { StorageS3Result } from "./s3";
|
|
4
4
|
import type { DbDynamoDBResult } from "./dynamodb";
|
|
5
5
|
import type { DbCosmosDBResult, DbCosmosDBResultGeneric } from "./cosmosdb";
|
|
6
|
+
import type { DbSnowflakeResult } from "./snowflake";
|
|
6
7
|
/**
|
|
7
8
|
* Union of all possible resource invocation result types
|
|
8
9
|
*/
|
|
9
|
-
export type ResourceInvokeSuccess = ApiResult | DbResult | StorageS3Result | DbDynamoDBResult | DbCosmosDBResult;
|
|
10
|
+
export type ResourceInvokeSuccess = ApiResult | DbResult | StorageS3Result | DbDynamoDBResult | DbCosmosDBResult | DbSnowflakeResult;
|
|
10
11
|
/**
|
|
11
12
|
* Base successful invocation response - generic over result type
|
|
12
13
|
*/
|
|
@@ -39,9 +40,9 @@ export interface InvokeFailure {
|
|
|
39
40
|
*/
|
|
40
41
|
export type InvokeResponse = InvokeSuccess | InvokeFailure;
|
|
41
42
|
/**
|
|
42
|
-
* Response from database resource invocation
|
|
43
|
+
* Response from database resource invocation (generic for typed rows)
|
|
43
44
|
*/
|
|
44
|
-
export type DatabaseInvokeResponse = BaseInvokeSuccess<DbResult
|
|
45
|
+
export type DatabaseInvokeResponse<T = Record<string, unknown>> = BaseInvokeSuccess<DbResult<T>> | InvokeFailure;
|
|
45
46
|
/**
|
|
46
47
|
* Response from API resource invocation (custom or HubSpot)
|
|
47
48
|
*/
|
|
@@ -58,4 +59,8 @@ export type DynamoDBInvokeResponse = BaseInvokeSuccess<DbDynamoDBResult> | Invok
|
|
|
58
59
|
* Response from CosmosDB database resource invocation (generic for typed documents)
|
|
59
60
|
*/
|
|
60
61
|
export type CosmosDBInvokeResponse<T = Record<string, unknown>> = BaseInvokeSuccess<DbCosmosDBResultGeneric<T>> | InvokeFailure;
|
|
62
|
+
/**
|
|
63
|
+
* Response from Snowflake database resource invocation
|
|
64
|
+
*/
|
|
65
|
+
export type SnowflakeInvokeResponse = BaseInvokeSuccess<DbSnowflakeResult> | InvokeFailure;
|
|
61
66
|
//# sourceMappingURL=response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/schemas/response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,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AAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAC1D,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAC9B,aAAa,CAAC;AAElB;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,SAAS,CAAC,GAAG,aAAa,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC;AAEvF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,aAAa,CAAC;AAEzF;;GAEG;AACH,MAAM,MAAM,sBAAsB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAC1D,iBAAiB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,GAC7C,aAAa,CAAC;AAElB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var snowflake_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(snowflake_exports);
|
|
17
|
+
//# sourceMappingURL=snowflake.cjs.map
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snowflake binding value types matching Snowflake's supported types
|
|
3
|
+
*/
|
|
4
|
+
export interface SnowflakeBindingValue {
|
|
5
|
+
type: "TEXT" | "FIXED" | "REAL" | "BOOLEAN" | "DATE" | "TIME" | "TIMESTAMP_LTZ" | "TIMESTAMP_NTZ" | "TIMESTAMP_TZ" | "BINARY" | "ARRAY" | "OBJECT" | "VARIANT";
|
|
6
|
+
value: string | number | boolean | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Snowflake session parameters for query execution
|
|
10
|
+
*/
|
|
11
|
+
export interface SnowflakeSessionParameters {
|
|
12
|
+
binary_output_format?: "HEX" | "BASE64";
|
|
13
|
+
date_output_format?: string;
|
|
14
|
+
time_output_format?: string;
|
|
15
|
+
timestamp_ltz_output_format?: string;
|
|
16
|
+
timestamp_ntz_output_format?: string;
|
|
17
|
+
timestamp_tz_output_format?: string;
|
|
18
|
+
timestamp_output_format?: string;
|
|
19
|
+
timezone?: string;
|
|
20
|
+
query_tag?: string;
|
|
21
|
+
rows_per_resultset?: number;
|
|
22
|
+
use_cached_result?: boolean;
|
|
23
|
+
client_result_chunk_size?: number;
|
|
24
|
+
/** For multi-statement execution (0 = variable count, 1 = single, >1 = exact count) */
|
|
25
|
+
multi_statement_count?: string;
|
|
26
|
+
/** Additional parameters */
|
|
27
|
+
[key: string]: string | number | boolean | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Execute operation payload - submit a SQL statement
|
|
31
|
+
*/
|
|
32
|
+
export interface SnowflakeExecutePayload {
|
|
33
|
+
type: "database";
|
|
34
|
+
subtype: "snowflake";
|
|
35
|
+
operation: "execute";
|
|
36
|
+
/** SQL statement to execute */
|
|
37
|
+
statement: string;
|
|
38
|
+
/** Parameter bindings */
|
|
39
|
+
bindings?: Record<string, SnowflakeBindingValue>;
|
|
40
|
+
/** Override default database */
|
|
41
|
+
database?: string;
|
|
42
|
+
/** Override default schema */
|
|
43
|
+
schema?: string;
|
|
44
|
+
/** Override default warehouse */
|
|
45
|
+
warehouse?: string;
|
|
46
|
+
/** Override default role */
|
|
47
|
+
role?: string;
|
|
48
|
+
/** Timeout in seconds (0 = max timeout of 604800s / 7 days) */
|
|
49
|
+
timeout?: number;
|
|
50
|
+
/** Execute asynchronously - returns statementHandle immediately */
|
|
51
|
+
async?: boolean;
|
|
52
|
+
/** Session parameters for this execution */
|
|
53
|
+
parameters?: SnowflakeSessionParameters;
|
|
54
|
+
/** Return SQL NULL as string "null" instead of JSON null */
|
|
55
|
+
nullable?: boolean;
|
|
56
|
+
/** Request ID for idempotency (auto-generated if not provided) */
|
|
57
|
+
requestId?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Status operation payload - get status/results of a running query
|
|
61
|
+
*/
|
|
62
|
+
export interface SnowflakeStatusPayload {
|
|
63
|
+
type: "database";
|
|
64
|
+
subtype: "snowflake";
|
|
65
|
+
operation: "status";
|
|
66
|
+
/** Statement handle from execute operation */
|
|
67
|
+
statementHandle: string;
|
|
68
|
+
/** For paginated results - retrieve specific partition (0-indexed) */
|
|
69
|
+
partition?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Cancel operation payload - cancel a running query
|
|
73
|
+
*/
|
|
74
|
+
export interface SnowflakeCancelPayload {
|
|
75
|
+
type: "database";
|
|
76
|
+
subtype: "snowflake";
|
|
77
|
+
operation: "cancel";
|
|
78
|
+
/** Statement handle to cancel */
|
|
79
|
+
statementHandle: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Discriminated union of all Snowflake operation payloads
|
|
83
|
+
*/
|
|
84
|
+
export type DbSnowflakePayload = SnowflakeExecutePayload | SnowflakeStatusPayload | SnowflakeCancelPayload;
|
|
85
|
+
/**
|
|
86
|
+
* Column metadata from Snowflake result set
|
|
87
|
+
*/
|
|
88
|
+
export interface SnowflakeColumnMetadata {
|
|
89
|
+
name: string;
|
|
90
|
+
type: string;
|
|
91
|
+
length?: number | null;
|
|
92
|
+
precision?: number | null;
|
|
93
|
+
scale?: number | null;
|
|
94
|
+
nullable: boolean;
|
|
95
|
+
byteLength?: number | null;
|
|
96
|
+
collation?: string | null;
|
|
97
|
+
database?: string;
|
|
98
|
+
schema?: string;
|
|
99
|
+
table?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Partition info for large result sets
|
|
103
|
+
*/
|
|
104
|
+
export interface SnowflakePartitionInfo {
|
|
105
|
+
rowCount: number;
|
|
106
|
+
uncompressedSize: number;
|
|
107
|
+
compressedSize?: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Result set metadata
|
|
111
|
+
*/
|
|
112
|
+
export interface SnowflakeResultSetMetadata {
|
|
113
|
+
numRows: number;
|
|
114
|
+
format: string;
|
|
115
|
+
rowType: SnowflakeColumnMetadata[];
|
|
116
|
+
partitionInfo?: SnowflakePartitionInfo[];
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* DML statistics
|
|
120
|
+
*/
|
|
121
|
+
export interface SnowflakeStats {
|
|
122
|
+
numRowsInserted?: number;
|
|
123
|
+
numRowsUpdated?: number;
|
|
124
|
+
numRowsDeleted?: number;
|
|
125
|
+
numDuplicateRowsUpdated?: number;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Result from a Snowflake operation
|
|
129
|
+
* This is a thin passthrough of Snowflake's SQL API response with `kind` added
|
|
130
|
+
*/
|
|
131
|
+
export interface DbSnowflakeResult {
|
|
132
|
+
kind: "snowflake";
|
|
133
|
+
/** Snowflake response code */
|
|
134
|
+
code?: string;
|
|
135
|
+
/** Response message */
|
|
136
|
+
message: string;
|
|
137
|
+
/** SQL state code for errors */
|
|
138
|
+
sqlState?: string;
|
|
139
|
+
/** Handle for the executed statement */
|
|
140
|
+
statementHandle?: string;
|
|
141
|
+
/** Handles for multi-statement execution */
|
|
142
|
+
statementHandles?: string[];
|
|
143
|
+
/** URL to check statement status */
|
|
144
|
+
statementStatusUrl?: string;
|
|
145
|
+
/** Timestamp when statement was created */
|
|
146
|
+
createdOn?: number;
|
|
147
|
+
/** Metadata about the result set */
|
|
148
|
+
resultSetMetaData?: SnowflakeResultSetMetadata;
|
|
149
|
+
/** Result data as array of arrays (each inner array is a row) */
|
|
150
|
+
data?: (string | null)[][];
|
|
151
|
+
/** DML operation statistics */
|
|
152
|
+
stats?: SnowflakeStats;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=snowflake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snowflake.d.ts","sourceRoot":"","sources":["../../src/schemas/snowflake.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EACA,MAAM,GACN,OAAO,GACP,MAAM,GACN,SAAS,GACT,MAAM,GACN,MAAM,GACN,eAAe,GACf,eAAe,GACf,cAAc,GACd,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,SAAS,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,oBAAoB,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IACxC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;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C;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,oCAAoC;IACpC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,iBAAiB,CAAC,EAAE,0BAA0B,CAAC;IAC/C,iEAAiE;IACjE,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC3B,+BAA+B;IAC/B,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snowflake.js","sourceRoot":"","sources":["../../src/schemas/snowflake.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED