@keystrokehq/snowflake 0.0.16 → 0.0.17
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/LICENSE +1 -1
- package/README.md +9 -233
- package/dist/actions/index.cjs +18 -0
- package/dist/actions/index.d.cts +2 -0
- package/dist/actions/index.d.mts +2 -0
- package/dist/actions/index.mjs +2 -0
- package/dist/actions-BGkaZb6a.cjs +801 -0
- package/dist/actions-BGkaZb6a.cjs.map +1 -0
- package/dist/actions-BR_JWhT_.mjs +700 -0
- package/dist/actions-BR_JWhT_.mjs.map +1 -0
- package/dist/index-DUGCZPGQ.d.cts +443 -0
- package/dist/index-DUGCZPGQ.d.cts.map +1 -0
- package/dist/index-RhOmpRxD.d.mts +445 -0
- package/dist/index-RhOmpRxD.d.mts.map +1 -0
- package/dist/index.cjs +34 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +19 -4
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +15 -5
- package/dist/index.mjs.map +1 -0
- package/package.json +39 -171
- package/dist/accounts/index.d.mts +0 -40
- package/dist/accounts/index.mjs +0 -51
- package/dist/bulk/index.d.mts +0 -71
- package/dist/bulk/index.mjs +0 -65
- package/dist/catalog/index.d.mts +0 -144
- package/dist/catalog/index.mjs +0 -158
- package/dist/client/index.d.mts +0 -44
- package/dist/client/index.mjs +0 -273
- package/dist/common-DfpCwJx5.mjs +0 -92
- package/dist/credential-sets/index.d.mts +0 -3
- package/dist/credential-sets/index.mjs +0 -4
- package/dist/databases/index.d.mts +0 -2
- package/dist/databases/index.mjs +0 -3
- package/dist/errors-60AsF7Su.mjs +0 -95
- package/dist/events/index.d.mts +0 -382
- package/dist/events/index.mjs +0 -291
- package/dist/file-formats/index.d.mts +0 -39
- package/dist/file-formats/index.mjs +0 -48
- package/dist/functions/index.d.mts +0 -53
- package/dist/functions/index.mjs +0 -56
- package/dist/grants/index.d.mts +0 -93
- package/dist/grants/index.mjs +0 -102
- package/dist/operations/index.d.mts +0 -1
- package/dist/operations/index.mjs +0 -1
- package/dist/org-admin/index.d.mts +0 -80
- package/dist/org-admin/index.mjs +0 -79
- package/dist/pipes/index.d.mts +0 -119
- package/dist/pipes/index.mjs +0 -106
- package/dist/procedures/index.d.mts +0 -61
- package/dist/procedures/index.mjs +0 -79
- package/dist/results/index.d.mts +0 -16
- package/dist/results/index.mjs +0 -64
- package/dist/retry-B4-9MZIp.mjs +0 -164
- package/dist/retry-w7cTp1QL.d.mts +0 -10
- package/dist/roles/index.d.mts +0 -60
- package/dist/roles/index.mjs +0 -74
- package/dist/rows/index.d.mts +0 -106
- package/dist/rows/index.mjs +0 -223
- package/dist/schemas/index.d.mts +0 -2
- package/dist/schemas/index.mjs +0 -4
- package/dist/schemas-catalog/index.d.mts +0 -2
- package/dist/schemas-catalog/index.mjs +0 -3
- package/dist/shares/index.d.mts +0 -56
- package/dist/shares/index.mjs +0 -77
- package/dist/snowflake-s3-sns-webhook.credential-set-D6bLAWy5.d.mts +0 -50
- package/dist/snowflake-s3-sns-webhook.credential-set-DzR7oWNK.mjs +0 -44
- package/dist/snowflake.credential-set-BxT7Gf3A.d.mts +0 -114
- package/dist/snowflake.credential-set-DE3gXf-a.mjs +0 -106
- package/dist/sql/index.d.mts +0 -84
- package/dist/sql/index.mjs +0 -209
- package/dist/sql-options-2k5xQ-oS.d.mts +0 -32
- package/dist/sql-options-D6GEa21F.mjs +0 -79
- package/dist/sql-safety-BZpAPsq6.mjs +0 -56
- package/dist/stages/index.d.mts +0 -64
- package/dist/stages/index.mjs +0 -81
- package/dist/statements-BumhMhN4.mjs +0 -81
- package/dist/statements-DJL0qVNA.d.mts +0 -238
- package/dist/status-page/index.d.mts +0 -510
- package/dist/status-page/index.mjs +0 -261
- package/dist/streaming/index.d.mts +0 -70
- package/dist/streaming/index.mjs +0 -56
- package/dist/streams/index.d.mts +0 -71
- package/dist/streams/index.mjs +0 -78
- package/dist/tables/index.d.mts +0 -2
- package/dist/tables/index.mjs +0 -3
- package/dist/tasks/index.d.mts +0 -79
- package/dist/tasks/index.mjs +0 -104
- package/dist/triggers/index.d.mts +0 -381
- package/dist/triggers/index.mjs +0 -1100
- package/dist/users/index.d.mts +0 -61
- package/dist/users/index.mjs +0 -67
- package/dist/verification/index.d.mts +0 -201
- package/dist/verification/index.mjs +0 -512
- package/dist/views/index.d.mts +0 -2
- package/dist/views/index.mjs +0 -3
- package/dist/warehouses/index.d.mts +0 -68
- package/dist/warehouses/index.mjs +0 -101
package/package.json
CHANGED
|
@@ -1,188 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keystrokehq/snowflake",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"version": "0.0.17",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/dallinbentley/keystroke.git",
|
|
7
|
+
"directory": "packages/integrations/snowflake"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
6
12
|
"type": "module",
|
|
13
|
+
"main": "./dist/index.cjs",
|
|
14
|
+
"module": "./dist/index.mjs",
|
|
15
|
+
"types": "./dist/index.d.mts",
|
|
7
16
|
"exports": {
|
|
8
17
|
".": {
|
|
9
18
|
"types": "./dist/index.d.mts",
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
"./credential-sets": {
|
|
13
|
-
"types": "./dist/credential-sets/index.d.mts",
|
|
14
|
-
"default": "./dist/credential-sets/index.mjs"
|
|
15
|
-
},
|
|
16
|
-
"./operations": {
|
|
17
|
-
"types": "./dist/operations/index.d.mts",
|
|
18
|
-
"default": "./dist/operations/index.mjs"
|
|
19
|
-
},
|
|
20
|
-
"./client": {
|
|
21
|
-
"types": "./dist/client.d.mts",
|
|
22
|
-
"default": "./dist/client.mjs"
|
|
23
|
-
},
|
|
24
|
-
"./schemas": {
|
|
25
|
-
"types": "./dist/schemas/index.d.mts",
|
|
26
|
-
"default": "./dist/schemas/index.mjs"
|
|
27
|
-
},
|
|
28
|
-
"./events": {
|
|
29
|
-
"types": "./dist/events/index.d.mts",
|
|
30
|
-
"default": "./dist/events/index.mjs"
|
|
31
|
-
},
|
|
32
|
-
"./triggers": {
|
|
33
|
-
"types": "./dist/triggers/index.d.mts",
|
|
34
|
-
"default": "./dist/triggers/index.mjs"
|
|
35
|
-
},
|
|
36
|
-
"./verification": {
|
|
37
|
-
"types": "./dist/verification.d.mts",
|
|
38
|
-
"default": "./dist/verification.mjs"
|
|
39
|
-
},
|
|
40
|
-
"./sql": {
|
|
41
|
-
"types": "./dist/sql.d.mts",
|
|
42
|
-
"default": "./dist/sql.mjs"
|
|
43
|
-
},
|
|
44
|
-
"./results": {
|
|
45
|
-
"types": "./dist/results.d.mts",
|
|
46
|
-
"default": "./dist/results.mjs"
|
|
47
|
-
},
|
|
48
|
-
"./bulk": {
|
|
49
|
-
"types": "./dist/bulk.d.mts",
|
|
50
|
-
"default": "./dist/bulk.mjs"
|
|
51
|
-
},
|
|
52
|
-
"./pipes": {
|
|
53
|
-
"types": "./dist/pipes.d.mts",
|
|
54
|
-
"default": "./dist/pipes.mjs"
|
|
55
|
-
},
|
|
56
|
-
"./streaming": {
|
|
57
|
-
"types": "./dist/streaming.d.mts",
|
|
58
|
-
"default": "./dist/streaming.mjs"
|
|
59
|
-
},
|
|
60
|
-
"./rows": {
|
|
61
|
-
"types": "./dist/rows.d.mts",
|
|
62
|
-
"default": "./dist/rows.mjs"
|
|
63
|
-
},
|
|
64
|
-
"./databases": {
|
|
65
|
-
"types": "./dist/databases.d.mts",
|
|
66
|
-
"default": "./dist/databases.mjs"
|
|
67
|
-
},
|
|
68
|
-
"./schemas-catalog": {
|
|
69
|
-
"types": "./dist/schemas-catalog.d.mts",
|
|
70
|
-
"default": "./dist/schemas-catalog.mjs"
|
|
71
|
-
},
|
|
72
|
-
"./tables": {
|
|
73
|
-
"types": "./dist/tables.d.mts",
|
|
74
|
-
"default": "./dist/tables.mjs"
|
|
75
|
-
},
|
|
76
|
-
"./views": {
|
|
77
|
-
"types": "./dist/views.d.mts",
|
|
78
|
-
"default": "./dist/views.mjs"
|
|
79
|
-
},
|
|
80
|
-
"./stages": {
|
|
81
|
-
"types": "./dist/stages.d.mts",
|
|
82
|
-
"default": "./dist/stages.mjs"
|
|
83
|
-
},
|
|
84
|
-
"./file-formats": {
|
|
85
|
-
"types": "./dist/file-formats.d.mts",
|
|
86
|
-
"default": "./dist/file-formats.mjs"
|
|
87
|
-
},
|
|
88
|
-
"./streams": {
|
|
89
|
-
"types": "./dist/streams.d.mts",
|
|
90
|
-
"default": "./dist/streams.mjs"
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"require": "./dist/index.cjs"
|
|
91
21
|
},
|
|
92
|
-
"./
|
|
93
|
-
"types": "./dist/
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
"./warehouses": {
|
|
97
|
-
"types": "./dist/warehouses.d.mts",
|
|
98
|
-
"default": "./dist/warehouses.mjs"
|
|
99
|
-
},
|
|
100
|
-
"./roles": {
|
|
101
|
-
"types": "./dist/roles.d.mts",
|
|
102
|
-
"default": "./dist/roles.mjs"
|
|
103
|
-
},
|
|
104
|
-
"./users": {
|
|
105
|
-
"types": "./dist/users.d.mts",
|
|
106
|
-
"default": "./dist/users.mjs"
|
|
107
|
-
},
|
|
108
|
-
"./grants": {
|
|
109
|
-
"types": "./dist/grants.d.mts",
|
|
110
|
-
"default": "./dist/grants.mjs"
|
|
111
|
-
},
|
|
112
|
-
"./shares": {
|
|
113
|
-
"types": "./dist/shares.d.mts",
|
|
114
|
-
"default": "./dist/shares.mjs"
|
|
115
|
-
},
|
|
116
|
-
"./functions": {
|
|
117
|
-
"types": "./dist/functions.d.mts",
|
|
118
|
-
"default": "./dist/functions.mjs"
|
|
119
|
-
},
|
|
120
|
-
"./procedures": {
|
|
121
|
-
"types": "./dist/procedures.d.mts",
|
|
122
|
-
"default": "./dist/procedures.mjs"
|
|
123
|
-
},
|
|
124
|
-
"./accounts": {
|
|
125
|
-
"types": "./dist/accounts.d.mts",
|
|
126
|
-
"default": "./dist/accounts.mjs"
|
|
127
|
-
},
|
|
128
|
-
"./org-admin": {
|
|
129
|
-
"types": "./dist/org-admin.d.mts",
|
|
130
|
-
"default": "./dist/org-admin.mjs"
|
|
131
|
-
},
|
|
132
|
-
"./catalog": {
|
|
133
|
-
"types": "./dist/catalog.d.mts",
|
|
134
|
-
"default": "./dist/catalog.mjs"
|
|
135
|
-
},
|
|
136
|
-
"./status-page": {
|
|
137
|
-
"types": "./dist/status-page.d.mts",
|
|
138
|
-
"default": "./dist/status-page.mjs"
|
|
22
|
+
"./actions": {
|
|
23
|
+
"types": "./dist/actions/index.d.mts",
|
|
24
|
+
"import": "./dist/actions/index.mjs",
|
|
25
|
+
"require": "./dist/actions/index.cjs"
|
|
139
26
|
}
|
|
140
27
|
},
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"LICENSE"
|
|
145
|
-
],
|
|
146
|
-
"dependencies": {
|
|
147
|
-
"zod": "^4.3.6"
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public",
|
|
30
|
+
"registry": "https://registry.npmjs.org"
|
|
148
31
|
},
|
|
149
|
-
"
|
|
150
|
-
"
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"zod": "^4.4.3",
|
|
34
|
+
"@keystrokehq/keystroke": "0.0.179"
|
|
151
35
|
},
|
|
152
36
|
"devDependencies": {
|
|
153
|
-
"@types/node": "^
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"@keystrokehq/
|
|
159
|
-
"@keystrokehq/
|
|
160
|
-
"@keystrokehq/
|
|
161
|
-
|
|
162
|
-
"keywords": [
|
|
163
|
-
"snowflake",
|
|
164
|
-
"keystroke",
|
|
165
|
-
"integration",
|
|
166
|
-
"data-warehouse",
|
|
167
|
-
"sql",
|
|
168
|
-
"snowpipe"
|
|
169
|
-
],
|
|
170
|
-
"repository": {
|
|
171
|
-
"type": "git",
|
|
172
|
-
"url": "https://github.com/keystrokehq/integrations",
|
|
173
|
-
"directory": "integrations/snowflake"
|
|
174
|
-
},
|
|
175
|
-
"license": "MIT",
|
|
176
|
-
"publishConfig": {
|
|
177
|
-
"access": "public",
|
|
178
|
-
"registry": "https://registry.npmjs.org/"
|
|
37
|
+
"@types/node": "^25.9.1",
|
|
38
|
+
"oxlint": "^1.66.0",
|
|
39
|
+
"tsdown": "^0.22.0",
|
|
40
|
+
"typescript": "^6.0.3",
|
|
41
|
+
"vitest": "^4.1.7",
|
|
42
|
+
"@keystrokehq/tsconfig": "0.0.3",
|
|
43
|
+
"@keystrokehq/oxlint-config": "0.0.4",
|
|
44
|
+
"@keystrokehq/tsdown-config": "0.0.3",
|
|
45
|
+
"@keystrokehq/vitest-config": "0.0.5"
|
|
179
46
|
},
|
|
180
47
|
"scripts": {
|
|
181
|
-
"typecheck": "tsgo --build",
|
|
182
48
|
"build": "tsdown",
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"test
|
|
186
|
-
"
|
|
49
|
+
"dev": "tsdown --watch --no-clean",
|
|
50
|
+
"lint": "oxlint .",
|
|
51
|
+
"test": "vitest run",
|
|
52
|
+
"test:unit": "vitest run --project unit",
|
|
53
|
+
"test:integration": "vitest run --project integration",
|
|
54
|
+
"typecheck": "tsc --noEmit"
|
|
187
55
|
}
|
|
188
56
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { SnowflakeClient } from "../client/index.mjs";
|
|
2
|
-
import { d as HydratedRow, m as ColumnMeta } from "../statements-DJL0qVNA.mjs";
|
|
3
|
-
//#region src/accounts/index.d.ts
|
|
4
|
-
interface AccountContext {
|
|
5
|
-
readonly warehouse?: string;
|
|
6
|
-
readonly role?: string;
|
|
7
|
-
}
|
|
8
|
-
interface DescribeAccountOptions extends AccountContext {}
|
|
9
|
-
/**
|
|
10
|
-
* Returns a single-row identity snapshot for the account that the
|
|
11
|
-
* current connection is bound to. Useful as a "whoami" / health probe.
|
|
12
|
-
*
|
|
13
|
-
* The helper is deliberately a single SELECT so we don't need any
|
|
14
|
-
* privileged role; `CURRENT_*` functions work for any authenticated user.
|
|
15
|
-
*/
|
|
16
|
-
declare function describeAccount(client: SnowflakeClient, options?: DescribeAccountOptions): Promise<HydratedRow>;
|
|
17
|
-
interface ShowRegionsOptions extends AccountContext {
|
|
18
|
-
readonly like?: string;
|
|
19
|
-
}
|
|
20
|
-
interface ShowRegionsResult {
|
|
21
|
-
readonly columns: readonly ColumnMeta[];
|
|
22
|
-
readonly rows: readonly HydratedRow[];
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* `SHOW REGIONS` — requires ORGADMIN. Returns the globally-available
|
|
26
|
-
* Snowflake regions along with region-group / cloud-provider metadata.
|
|
27
|
-
*/
|
|
28
|
-
declare function showRegions(client: SnowflakeClient, options?: ShowRegionsOptions): Promise<ShowRegionsResult>;
|
|
29
|
-
interface FetchCatalogIntegrationOptions extends AccountContext {
|
|
30
|
-
readonly name: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* `DESC CATALOG INTEGRATION <name>` — returns the property list for a
|
|
34
|
-
* Snowflake Iceberg catalog integration (the `SNOWFLAKE_FETCH_CATALOG_INTEGRATION`
|
|
35
|
-
* Composio op). Every row has a `property` / `value` / `default` / `description`
|
|
36
|
-
* shape.
|
|
37
|
-
*/
|
|
38
|
-
declare function fetchCatalogIntegration(client: SnowflakeClient, options: FetchCatalogIntegrationOptions): Promise<readonly HydratedRow[]>;
|
|
39
|
-
//#endregion
|
|
40
|
-
export { AccountContext, DescribeAccountOptions, FetchCatalogIntegrationOptions, ShowRegionsOptions, ShowRegionsResult, describeAccount, fetchCatalogIntegration, showRegions };
|
package/dist/accounts/index.mjs
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { executeSql } from "../sql/index.mjs";
|
|
2
|
-
import { i as quoteIdentifier, r as likeClause } from "../sql-safety-BZpAPsq6.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/accounts/index.ts
|
|
5
|
-
/**
|
|
6
|
-
* Returns a single-row identity snapshot for the account that the
|
|
7
|
-
* current connection is bound to. Useful as a "whoami" / health probe.
|
|
8
|
-
*
|
|
9
|
-
* The helper is deliberately a single SELECT so we don't need any
|
|
10
|
-
* privileged role; `CURRENT_*` functions work for any authenticated user.
|
|
11
|
-
*/
|
|
12
|
-
async function describeAccount(client, options = {}) {
|
|
13
|
-
const row = (await executeSql(client, {
|
|
14
|
-
statement: "SELECT CURRENT_ACCOUNT() AS ACCOUNT_LOCATOR, CURRENT_ACCOUNT_NAME() AS ACCOUNT_NAME, CURRENT_REGION() AS REGION, CURRENT_ORGANIZATION_NAME() AS ORGANIZATION_NAME, CURRENT_VERSION() AS SNOWFLAKE_VERSION, CURRENT_ROLE() AS ROLE, CURRENT_WAREHOUSE() AS WAREHOUSE, CURRENT_DATABASE() AS DATABASE, CURRENT_SCHEMA() AS SCHEMA",
|
|
15
|
-
warehouse: options.warehouse,
|
|
16
|
-
role: options.role
|
|
17
|
-
})).rows[0];
|
|
18
|
-
if (!row) throw new Error("describeAccount: Snowflake returned no rows for identity SELECT");
|
|
19
|
-
return row;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* `SHOW REGIONS` — requires ORGADMIN. Returns the globally-available
|
|
23
|
-
* Snowflake regions along with region-group / cloud-provider metadata.
|
|
24
|
-
*/
|
|
25
|
-
async function showRegions(client, options = {}) {
|
|
26
|
-
const result = await executeSql(client, {
|
|
27
|
-
statement: `SHOW REGIONS${likeClause(options.like)}`,
|
|
28
|
-
warehouse: options.warehouse,
|
|
29
|
-
role: options.role
|
|
30
|
-
});
|
|
31
|
-
return {
|
|
32
|
-
columns: result.columns,
|
|
33
|
-
rows: result.rows
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* `DESC CATALOG INTEGRATION <name>` — returns the property list for a
|
|
38
|
-
* Snowflake Iceberg catalog integration (the `SNOWFLAKE_FETCH_CATALOG_INTEGRATION`
|
|
39
|
-
* Composio op). Every row has a `property` / `value` / `default` / `description`
|
|
40
|
-
* shape.
|
|
41
|
-
*/
|
|
42
|
-
async function fetchCatalogIntegration(client, options) {
|
|
43
|
-
return (await executeSql(client, {
|
|
44
|
-
statement: `DESCRIBE CATALOG INTEGRATION ${quoteIdentifier(options.name)}`,
|
|
45
|
-
warehouse: options.warehouse,
|
|
46
|
-
role: options.role
|
|
47
|
-
})).rows;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
//#endregion
|
|
51
|
-
export { describeAccount, fetchCatalogIntegration, showRegions };
|
package/dist/bulk/index.d.mts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { SnowflakeClient } from "../client/index.mjs";
|
|
2
|
-
import { d as HydratedRow } from "../statements-DJL0qVNA.mjs";
|
|
3
|
-
import { ExecuteSqlResult } from "../sql/index.mjs";
|
|
4
|
-
import { t as OptionMap } from "../sql-options-2k5xQ-oS.mjs";
|
|
5
|
-
import { StageRef } from "../stages/index.mjs";
|
|
6
|
-
|
|
7
|
-
//#region src/bulk/index.d.ts
|
|
8
|
-
interface TableRef {
|
|
9
|
-
readonly database?: string;
|
|
10
|
-
readonly schema?: string;
|
|
11
|
-
readonly table: string;
|
|
12
|
-
}
|
|
13
|
-
interface BulkContext {
|
|
14
|
-
readonly warehouse?: string;
|
|
15
|
-
readonly role?: string;
|
|
16
|
-
}
|
|
17
|
-
interface CopyIntoSourceStage {
|
|
18
|
-
readonly kind: 'stage';
|
|
19
|
-
readonly stage: StageRef;
|
|
20
|
-
readonly pathSuffix?: string;
|
|
21
|
-
readonly files?: readonly string[];
|
|
22
|
-
readonly pattern?: string;
|
|
23
|
-
}
|
|
24
|
-
interface CopyIntoSourceExternalLocation {
|
|
25
|
-
readonly kind: 'location';
|
|
26
|
-
/** e.g. `'s3://bucket/path/'` — caller is responsible for URL shape. */
|
|
27
|
-
readonly url: string;
|
|
28
|
-
readonly credentials?: OptionMap;
|
|
29
|
-
readonly encryption?: OptionMap;
|
|
30
|
-
readonly files?: readonly string[];
|
|
31
|
-
readonly pattern?: string;
|
|
32
|
-
}
|
|
33
|
-
interface CopyIntoSourceQuery {
|
|
34
|
-
readonly kind: 'query';
|
|
35
|
-
/** Pre-composed SELECT body (caller owns identifier escaping). */
|
|
36
|
-
readonly sql: string;
|
|
37
|
-
}
|
|
38
|
-
type CopyIntoSource = CopyIntoSourceStage | CopyIntoSourceExternalLocation | CopyIntoSourceQuery;
|
|
39
|
-
interface CopyIntoOptions extends TableRef, BulkContext {
|
|
40
|
-
readonly columns?: readonly string[];
|
|
41
|
-
readonly source: CopyIntoSource;
|
|
42
|
-
readonly fileFormat?: OptionMap;
|
|
43
|
-
readonly copyOptions?: OptionMap;
|
|
44
|
-
/** `VALIDATION_MODE = RETURN_ERRORS | RETURN_ALL_ERRORS | RETURN_n_ROWS`. */
|
|
45
|
-
readonly validationMode?: string;
|
|
46
|
-
readonly onError?: string;
|
|
47
|
-
readonly force?: boolean;
|
|
48
|
-
readonly truncateColumns?: boolean;
|
|
49
|
-
}
|
|
50
|
-
declare function copyInto(client: SnowflakeClient, options: CopyIntoOptions): Promise<ExecuteSqlResult<HydratedRow | readonly unknown[]>>;
|
|
51
|
-
declare function validateCopyInto(client: SnowflakeClient, options: CopyIntoOptions): Promise<ExecuteSqlResult<HydratedRow | readonly unknown[]>>;
|
|
52
|
-
interface UnloadOptions extends BulkContext {
|
|
53
|
-
readonly stage: StageRef;
|
|
54
|
-
readonly pathSuffix?: string;
|
|
55
|
-
/** Pre-composed SELECT body; the helper wraps it in parens. */
|
|
56
|
-
readonly query: string;
|
|
57
|
-
readonly fileFormat?: OptionMap;
|
|
58
|
-
readonly copyOptions?: OptionMap;
|
|
59
|
-
readonly overwrite?: boolean;
|
|
60
|
-
readonly header?: boolean;
|
|
61
|
-
readonly singleFile?: boolean;
|
|
62
|
-
readonly maxFileSize?: number | bigint;
|
|
63
|
-
readonly partitionBy?: string;
|
|
64
|
-
}
|
|
65
|
-
declare function unload(client: SnowflakeClient, options: UnloadOptions): Promise<ExecuteSqlResult<HydratedRow | readonly unknown[]>>;
|
|
66
|
-
interface TruncateTableOptions extends TableRef, BulkContext {
|
|
67
|
-
readonly ifExists?: boolean;
|
|
68
|
-
}
|
|
69
|
-
declare function truncateTable(client: SnowflakeClient, options: TruncateTableOptions): Promise<void>;
|
|
70
|
-
//#endregion
|
|
71
|
-
export { BulkContext, CopyIntoOptions, CopyIntoSource, CopyIntoSourceExternalLocation, CopyIntoSourceQuery, CopyIntoSourceStage, TableRef, TruncateTableOptions, UnloadOptions, copyInto, truncateTable, unload, validateCopyInto };
|
package/dist/bulk/index.mjs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { executeSql } from "../sql/index.mjs";
|
|
2
|
-
import { a as quoteLiteral, t as buildFqn } from "../sql-safety-BZpAPsq6.mjs";
|
|
3
|
-
import { n as renderOptionGroup, t as formatOptions } from "../sql-options-D6GEa21F.mjs";
|
|
4
|
-
import { stagePath } from "../stages/index.mjs";
|
|
5
|
-
|
|
6
|
-
//#region src/bulk/index.ts
|
|
7
|
-
function tableFqn(ref) {
|
|
8
|
-
return buildFqn(ref.database, ref.schema, ref.table);
|
|
9
|
-
}
|
|
10
|
-
function renderSource(source) {
|
|
11
|
-
if (source.kind === "query") return `(${source.sql})`;
|
|
12
|
-
if (source.kind === "stage") return `${stagePath(source.stage, source.pathSuffix)}${source.files && source.files.length > 0 ? ` FILES = (${source.files.map(quoteLiteral).join(", ")})` : ""}${source.pattern ? ` PATTERN = ${quoteLiteral(source.pattern)}` : ""}`;
|
|
13
|
-
const files = source.files && source.files.length > 0 ? ` FILES = (${source.files.map(quoteLiteral).join(", ")})` : "";
|
|
14
|
-
const pattern = source.pattern ? ` PATTERN = ${quoteLiteral(source.pattern)}` : "";
|
|
15
|
-
const creds = renderOptionGroup("CREDENTIALS", source.credentials);
|
|
16
|
-
const enc = renderOptionGroup("ENCRYPTION", source.encryption);
|
|
17
|
-
return `${quoteLiteral(source.url)}${creds}${enc}${files}${pattern}`;
|
|
18
|
-
}
|
|
19
|
-
function collectCopyOptions(opts) {
|
|
20
|
-
const merged = { ...opts.copyOptions ?? {} };
|
|
21
|
-
if (opts.onError !== void 0) merged.onError = opts.onError;
|
|
22
|
-
if (opts.force !== void 0) merged.force = opts.force;
|
|
23
|
-
if (opts.truncateColumns !== void 0) merged.truncateColumns = opts.truncateColumns;
|
|
24
|
-
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
25
|
-
}
|
|
26
|
-
async function copyInto(client, options) {
|
|
27
|
-
const columnList = options.columns && options.columns.length > 0 ? `(${options.columns.map((c) => `"${c.replaceAll("\"", "\"\"")}"`).join(", ")})` : "";
|
|
28
|
-
const copyOpts = collectCopyOptions(options);
|
|
29
|
-
return executeSql(client, {
|
|
30
|
-
statement: `COPY INTO ${tableFqn(options)}${columnList ? ` ${columnList}` : ""} FROM ${renderSource(options.source)}` + renderOptionGroup("FILE_FORMAT", options.fileFormat) + (copyOpts ? ` ${formatOptions(copyOpts)}` : "") + (options.validationMode ? ` VALIDATION_MODE = ${options.validationMode}` : ""),
|
|
31
|
-
warehouse: options.warehouse,
|
|
32
|
-
role: options.role
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
async function validateCopyInto(client, options) {
|
|
36
|
-
return copyInto(client, {
|
|
37
|
-
...options,
|
|
38
|
-
validationMode: options.validationMode ?? "RETURN_ERRORS"
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
async function unload(client, options) {
|
|
42
|
-
const scope = stagePath(options.stage, options.pathSuffix);
|
|
43
|
-
const copyOpts = { ...options.copyOptions ?? {} };
|
|
44
|
-
if (options.overwrite !== void 0) copyOpts.overwrite = options.overwrite;
|
|
45
|
-
if (options.header !== void 0) copyOpts.header = options.header;
|
|
46
|
-
if (options.singleFile !== void 0) copyOpts.singleFile = options.singleFile;
|
|
47
|
-
if (options.maxFileSize !== void 0) copyOpts.maxFileSize = options.maxFileSize;
|
|
48
|
-
const copyOptions = Object.keys(copyOpts).length > 0 ? copyOpts : void 0;
|
|
49
|
-
const partition = options.partitionBy ? ` PARTITION BY (${options.partitionBy})` : "";
|
|
50
|
-
return executeSql(client, {
|
|
51
|
-
statement: `COPY INTO ${scope} FROM (${options.query})` + renderOptionGroup("FILE_FORMAT", options.fileFormat) + (copyOptions ? ` ${formatOptions(copyOptions)}` : "") + partition,
|
|
52
|
-
warehouse: options.warehouse,
|
|
53
|
-
role: options.role
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
async function truncateTable(client, options) {
|
|
57
|
-
await executeSql(client, {
|
|
58
|
-
statement: `TRUNCATE TABLE${options.ifExists ? " IF EXISTS" : ""} ${tableFqn(options)}`,
|
|
59
|
-
warehouse: options.warehouse,
|
|
60
|
-
role: options.role
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
//#endregion
|
|
65
|
-
export { copyInto, truncateTable, unload, validateCopyInto };
|
package/dist/catalog/index.d.mts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { SnowflakeClient } from "../client/index.mjs";
|
|
2
|
-
import { d as HydratedRow } from "../statements-DJL0qVNA.mjs";
|
|
3
|
-
//#region src/catalog/index.d.ts
|
|
4
|
-
interface ShowOptions {
|
|
5
|
-
/** Optional `LIKE '<pattern>'` filter. Escaped via {@link quoteLiteral}. */
|
|
6
|
-
readonly like?: string;
|
|
7
|
-
/** Cap results. Snowflake supports `LIMIT <n>` on SHOW. */
|
|
8
|
-
readonly limit?: number;
|
|
9
|
-
/** Runtime overrides forwarded to {@link executeSql}. */
|
|
10
|
-
readonly warehouse?: string;
|
|
11
|
-
readonly role?: string;
|
|
12
|
-
readonly database?: string;
|
|
13
|
-
readonly schema?: string;
|
|
14
|
-
}
|
|
15
|
-
interface ShowScopedOptions extends ShowOptions {
|
|
16
|
-
/** Restrict results to the named database. */
|
|
17
|
-
readonly inDatabase?: string;
|
|
18
|
-
/** Restrict to a `DB.SCHEMA` scope. */
|
|
19
|
-
readonly inSchema?: {
|
|
20
|
-
readonly database: string;
|
|
21
|
-
readonly schema: string;
|
|
22
|
-
};
|
|
23
|
-
/** Restrict to `SHOW X IN ACCOUNT`. */
|
|
24
|
-
readonly inAccount?: boolean;
|
|
25
|
-
}
|
|
26
|
-
interface CatalogResult {
|
|
27
|
-
readonly rows: readonly HydratedRow[];
|
|
28
|
-
readonly columns: readonly {
|
|
29
|
-
readonly name: string;
|
|
30
|
-
readonly type: string;
|
|
31
|
-
}[];
|
|
32
|
-
}
|
|
33
|
-
interface ShowDatabasesOptions extends ShowOptions {}
|
|
34
|
-
declare function showDatabases(client: SnowflakeClient, options?: ShowDatabasesOptions): Promise<CatalogResult>;
|
|
35
|
-
interface ShowSchemasOptions extends ShowScopedOptions {
|
|
36
|
-
/** `HISTORY` variant returns dropped schemas too. */
|
|
37
|
-
readonly history?: boolean;
|
|
38
|
-
}
|
|
39
|
-
declare function showSchemas(client: SnowflakeClient, options?: ShowSchemasOptions): Promise<CatalogResult>;
|
|
40
|
-
interface ShowTablesOptions extends ShowScopedOptions {
|
|
41
|
-
readonly history?: boolean;
|
|
42
|
-
/** Cascading to TEMPORARY + TRANSIENT + EXTERNAL tables. */
|
|
43
|
-
readonly terse?: boolean;
|
|
44
|
-
}
|
|
45
|
-
declare function showTables(client: SnowflakeClient, options?: ShowTablesOptions): Promise<CatalogResult>;
|
|
46
|
-
interface ShowViewsOptions extends ShowScopedOptions {
|
|
47
|
-
readonly terse?: boolean;
|
|
48
|
-
}
|
|
49
|
-
declare function showViews(client: SnowflakeClient, options?: ShowViewsOptions): Promise<CatalogResult>;
|
|
50
|
-
interface ShowMaterializedViewsOptions extends ShowScopedOptions {}
|
|
51
|
-
declare function showMaterializedViews(client: SnowflakeClient, options?: ShowMaterializedViewsOptions): Promise<CatalogResult>;
|
|
52
|
-
interface ShowColumnsOptions extends ShowOptions {
|
|
53
|
-
readonly inTable?: {
|
|
54
|
-
readonly database?: string;
|
|
55
|
-
readonly schema?: string;
|
|
56
|
-
readonly table: string;
|
|
57
|
-
};
|
|
58
|
-
readonly inView?: {
|
|
59
|
-
readonly database?: string;
|
|
60
|
-
readonly schema?: string;
|
|
61
|
-
readonly view: string;
|
|
62
|
-
};
|
|
63
|
-
readonly inSchema?: {
|
|
64
|
-
readonly database: string;
|
|
65
|
-
readonly schema: string;
|
|
66
|
-
};
|
|
67
|
-
readonly inDatabase?: string;
|
|
68
|
-
}
|
|
69
|
-
declare function showColumns(client: SnowflakeClient, options?: ShowColumnsOptions): Promise<CatalogResult>;
|
|
70
|
-
declare function showWarehouses(client: SnowflakeClient, options?: ShowOptions): Promise<CatalogResult>;
|
|
71
|
-
declare function showRoles(client: SnowflakeClient, options?: ShowOptions): Promise<CatalogResult>;
|
|
72
|
-
declare function showUsers(client: SnowflakeClient, options?: ShowOptions): Promise<CatalogResult>;
|
|
73
|
-
declare function showStages(client: SnowflakeClient, options?: ShowScopedOptions): Promise<CatalogResult>;
|
|
74
|
-
declare function showPipes(client: SnowflakeClient, options?: ShowScopedOptions): Promise<CatalogResult>;
|
|
75
|
-
declare function showTasks(client: SnowflakeClient, options?: ShowScopedOptions & {
|
|
76
|
-
readonly terse?: boolean;
|
|
77
|
-
}): Promise<CatalogResult>;
|
|
78
|
-
declare function showStreams(client: SnowflakeClient, options?: ShowScopedOptions): Promise<CatalogResult>;
|
|
79
|
-
declare function showShares(client: SnowflakeClient, options?: ShowOptions): Promise<CatalogResult>;
|
|
80
|
-
declare function showFunctions(client: SnowflakeClient, options?: ShowScopedOptions): Promise<CatalogResult>;
|
|
81
|
-
declare function showProcedures(client: SnowflakeClient, options?: ShowScopedOptions): Promise<CatalogResult>;
|
|
82
|
-
declare function showFileFormats(client: SnowflakeClient, options?: ShowScopedOptions): Promise<CatalogResult>;
|
|
83
|
-
interface ShowGrantsOptions extends ShowOptions {
|
|
84
|
-
/** `SHOW GRANTS ON <object>`. Object keyword is caller-provided (TABLE, DATABASE, etc.). */
|
|
85
|
-
readonly on?: {
|
|
86
|
-
readonly objectType: string;
|
|
87
|
-
readonly name: string;
|
|
88
|
-
readonly schema?: string;
|
|
89
|
-
readonly database?: string;
|
|
90
|
-
};
|
|
91
|
-
/** `SHOW GRANTS TO {ROLE | USER | SHARE} <name>`. */
|
|
92
|
-
readonly toRole?: string;
|
|
93
|
-
readonly toUser?: string;
|
|
94
|
-
readonly toShare?: string;
|
|
95
|
-
/** `SHOW GRANTS OF ROLE <name>`. */
|
|
96
|
-
readonly ofRole?: string;
|
|
97
|
-
readonly ofShare?: string;
|
|
98
|
-
}
|
|
99
|
-
declare function showGrants(client: SnowflakeClient, options?: ShowGrantsOptions): Promise<CatalogResult>;
|
|
100
|
-
interface DescribeTableOptions extends Pick<ShowOptions, 'warehouse' | 'role'> {
|
|
101
|
-
readonly database?: string;
|
|
102
|
-
readonly schema?: string;
|
|
103
|
-
readonly table: string;
|
|
104
|
-
/** `DESCRIBE TABLE X TYPE = STAGE | COLUMNS` (default COLUMNS). */
|
|
105
|
-
readonly type?: 'COLUMNS' | 'STAGE';
|
|
106
|
-
}
|
|
107
|
-
declare function describeTable(client: SnowflakeClient, options: DescribeTableOptions): Promise<CatalogResult>;
|
|
108
|
-
interface ExploreColumnsOptions extends Pick<ShowOptions, 'warehouse' | 'role'> {
|
|
109
|
-
readonly database?: string;
|
|
110
|
-
readonly schema?: string;
|
|
111
|
-
readonly table: string;
|
|
112
|
-
/** Restrict to these columns; when empty, all columns are sampled. */
|
|
113
|
-
readonly columns?: readonly string[];
|
|
114
|
-
/** Distinct-value sample cap per column (default 100). */
|
|
115
|
-
readonly limit?: number;
|
|
116
|
-
}
|
|
117
|
-
interface ExploreColumnsResult {
|
|
118
|
-
readonly table: string;
|
|
119
|
-
readonly samples: readonly {
|
|
120
|
-
readonly column: string;
|
|
121
|
-
readonly distinctValues: readonly unknown[];
|
|
122
|
-
}[];
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Composio `SNOWFLAKE_BASIC_EXPLORE_COLUMNS` parity — pull a small distinct
|
|
126
|
-
* sample from each requested column to help LLMs disambiguate column
|
|
127
|
-
* semantics.
|
|
128
|
-
*/
|
|
129
|
-
declare function exploreColumns(client: SnowflakeClient, options: ExploreColumnsOptions): Promise<ExploreColumnsResult>;
|
|
130
|
-
interface FindDatabasesOptions extends ShowOptions {
|
|
131
|
-
/** Optional case-insensitive substring match applied client-side. */
|
|
132
|
-
readonly nameContains?: string;
|
|
133
|
-
}
|
|
134
|
-
declare function findDatabases(client: SnowflakeClient, options?: FindDatabasesOptions): Promise<CatalogResult>;
|
|
135
|
-
interface FindSchemasOptions extends ShowSchemasOptions {
|
|
136
|
-
readonly nameContains?: string;
|
|
137
|
-
}
|
|
138
|
-
declare function findSchemas(client: SnowflakeClient, options?: FindSchemasOptions): Promise<CatalogResult>;
|
|
139
|
-
interface FindTablesOptions extends ShowTablesOptions {
|
|
140
|
-
readonly nameContains?: string;
|
|
141
|
-
}
|
|
142
|
-
declare function findTables(client: SnowflakeClient, options?: FindTablesOptions): Promise<CatalogResult>;
|
|
143
|
-
//#endregion
|
|
144
|
-
export { CatalogResult, DescribeTableOptions, ExploreColumnsOptions, ExploreColumnsResult, FindDatabasesOptions, FindSchemasOptions, FindTablesOptions, ShowColumnsOptions, ShowDatabasesOptions, ShowGrantsOptions, ShowMaterializedViewsOptions, ShowOptions, ShowSchemasOptions, ShowScopedOptions, ShowTablesOptions, ShowViewsOptions, describeTable, exploreColumns, findDatabases, findSchemas, findTables, showColumns, showDatabases, showFileFormats, showFunctions, showGrants, showMaterializedViews, showPipes, showProcedures, showRoles, showSchemas, showShares, showStages, showStreams, showTables, showTasks, showUsers, showViews, showWarehouses };
|