@keystrokehq/snowflake 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -233
  3. package/package.json +39 -171
  4. package/dist/accounts/index.d.mts +0 -40
  5. package/dist/accounts/index.mjs +0 -51
  6. package/dist/bulk/index.d.mts +0 -71
  7. package/dist/bulk/index.mjs +0 -65
  8. package/dist/catalog/index.d.mts +0 -144
  9. package/dist/catalog/index.mjs +0 -158
  10. package/dist/client/index.d.mts +0 -44
  11. package/dist/client/index.mjs +0 -273
  12. package/dist/common-DfpCwJx5.mjs +0 -92
  13. package/dist/credential-sets/index.d.mts +0 -3
  14. package/dist/credential-sets/index.mjs +0 -4
  15. package/dist/databases/index.d.mts +0 -2
  16. package/dist/databases/index.mjs +0 -3
  17. package/dist/errors-60AsF7Su.mjs +0 -95
  18. package/dist/events/index.d.mts +0 -382
  19. package/dist/events/index.mjs +0 -291
  20. package/dist/file-formats/index.d.mts +0 -39
  21. package/dist/file-formats/index.mjs +0 -48
  22. package/dist/functions/index.d.mts +0 -53
  23. package/dist/functions/index.mjs +0 -56
  24. package/dist/grants/index.d.mts +0 -93
  25. package/dist/grants/index.mjs +0 -102
  26. package/dist/index.d.mts +0 -4
  27. package/dist/index.mjs +0 -6
  28. package/dist/operations/index.d.mts +0 -1
  29. package/dist/operations/index.mjs +0 -1
  30. package/dist/org-admin/index.d.mts +0 -80
  31. package/dist/org-admin/index.mjs +0 -79
  32. package/dist/pipes/index.d.mts +0 -119
  33. package/dist/pipes/index.mjs +0 -106
  34. package/dist/procedures/index.d.mts +0 -61
  35. package/dist/procedures/index.mjs +0 -79
  36. package/dist/results/index.d.mts +0 -16
  37. package/dist/results/index.mjs +0 -64
  38. package/dist/retry-B4-9MZIp.mjs +0 -164
  39. package/dist/retry-w7cTp1QL.d.mts +0 -10
  40. package/dist/roles/index.d.mts +0 -60
  41. package/dist/roles/index.mjs +0 -74
  42. package/dist/rows/index.d.mts +0 -106
  43. package/dist/rows/index.mjs +0 -223
  44. package/dist/schemas/index.d.mts +0 -2
  45. package/dist/schemas/index.mjs +0 -4
  46. package/dist/schemas-catalog/index.d.mts +0 -2
  47. package/dist/schemas-catalog/index.mjs +0 -3
  48. package/dist/shares/index.d.mts +0 -56
  49. package/dist/shares/index.mjs +0 -77
  50. package/dist/snowflake-s3-sns-webhook.credential-set-D6bLAWy5.d.mts +0 -50
  51. package/dist/snowflake-s3-sns-webhook.credential-set-DzR7oWNK.mjs +0 -44
  52. package/dist/snowflake.credential-set-BxT7Gf3A.d.mts +0 -114
  53. package/dist/snowflake.credential-set-DE3gXf-a.mjs +0 -106
  54. package/dist/sql/index.d.mts +0 -84
  55. package/dist/sql/index.mjs +0 -209
  56. package/dist/sql-options-2k5xQ-oS.d.mts +0 -32
  57. package/dist/sql-options-D6GEa21F.mjs +0 -79
  58. package/dist/sql-safety-BZpAPsq6.mjs +0 -56
  59. package/dist/stages/index.d.mts +0 -64
  60. package/dist/stages/index.mjs +0 -81
  61. package/dist/statements-BumhMhN4.mjs +0 -81
  62. package/dist/statements-DJL0qVNA.d.mts +0 -238
  63. package/dist/status-page/index.d.mts +0 -510
  64. package/dist/status-page/index.mjs +0 -261
  65. package/dist/streaming/index.d.mts +0 -70
  66. package/dist/streaming/index.mjs +0 -56
  67. package/dist/streams/index.d.mts +0 -71
  68. package/dist/streams/index.mjs +0 -78
  69. package/dist/tables/index.d.mts +0 -2
  70. package/dist/tables/index.mjs +0 -3
  71. package/dist/tasks/index.d.mts +0 -79
  72. package/dist/tasks/index.mjs +0 -104
  73. package/dist/triggers/index.d.mts +0 -381
  74. package/dist/triggers/index.mjs +0 -1100
  75. package/dist/users/index.d.mts +0 -61
  76. package/dist/users/index.mjs +0 -67
  77. package/dist/verification/index.d.mts +0 -201
  78. package/dist/verification/index.mjs +0 -512
  79. package/dist/views/index.d.mts +0 -2
  80. package/dist/views/index.mjs +0 -3
  81. package/dist/warehouses/index.d.mts +0 -68
  82. package/dist/warehouses/index.mjs +0 -101
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Buster
3
+ Copyright (c) 2026 Dallin
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,241 +1,17 @@
1
1
  # @keystrokehq/snowflake
2
2
 
3
- Official Keystroke integration for the Snowflake Data Cloud. One package wraps the Snowflake SQL API v2, Snowpipe file REST, Snowpipe Streaming, Streams, Tasks, Warehouses, Roles, Users, Grants, Shares, account admin, and the public Snowflake status page behind a typed, `fetch`-based HTTPS client — plus 22 polling triggers and 3 auto-ingest webhook triggers.
3
+ Keystroke-managed integration.
4
4
 
5
- No Node-native dependencies. The runtime is built on `fetch` + `SubtleCrypto`, so it runs in Cloudflare Workers and other isolate tiers without any shim.
6
-
7
- See `PLAN.md` for the full action/trigger enumeration and `IMPLEMENTATION_NOTES.md` for the decisions that shipped with this build.
8
-
9
- ## Install
10
-
11
- ```bash
12
- pnpm add @keystrokehq/snowflake
13
- ```
14
-
15
- ## Credentials
16
-
17
- The public `snowflake` connection accepts four auth modes via a discriminated union on `mode`:
18
-
19
- | Mode | When to use |
20
- |------|-------------|
21
- | `keypair` | Service accounts with an RSA key pair registered on the Snowflake user (recommended). |
22
- | `oauth` | External IdP or Snowflake-hosted OAuth — supply a bearer access token, optionally refreshable. |
23
- | `pat` | Programmatic Access Token (Snowflake preview). |
24
- | `basic` | Legacy username + password. Emits a deprecation warning at client creation time. |
25
-
26
- Shared required fields: `SNOWFLAKE_ACCOUNT`, plus `SNOWFLAKE_USER` for any non-OAuth mode. Optional session fields — `SNOWFLAKE_ROLE`, `SNOWFLAKE_WAREHOUSE`, `SNOWFLAKE_DATABASE`, `SNOWFLAKE_SCHEMA`, `SNOWFLAKE_HOST`, `SNOWFLAKE_REGION` — are honored by every operation when the input does not provide an override.
27
-
28
- Example vault values for key-pair mode:
29
-
30
- ```ts
31
- import type { SnowflakeCredentials } from '@keystrokehq/snowflake/credential-sets';
32
-
33
- const credentials: SnowflakeCredentials = {
34
- mode: 'keypair',
35
- SNOWFLAKE_ACCOUNT: 'my-org-my-account',
36
- SNOWFLAKE_USER: 'KEYSTROKE_SVC',
37
- SNOWFLAKE_PRIVATE_KEY: '-----BEGIN PRIVATE KEY-----\n...',
38
- SNOWFLAKE_ROLE: 'KEYSTROKE_ROLE',
39
- SNOWFLAKE_WAREHOUSE: 'KEYSTROKE_WH',
40
- };
41
- ```
42
-
43
- ## Client
44
-
45
- All domain functions accept a `SnowflakeClient` produced by `createSnowflakeClient(credentials)`. The client is stateless other than an internal OAuth/keypair JWT cache; reuse a single client across many operations.
46
-
47
- ```ts
48
- import { createSnowflakeClient } from '@keystrokehq/snowflake/client';
49
-
50
- const client = createSnowflakeClient(credentials);
51
- ```
52
-
53
- ## Quickstart
54
-
55
- ### Execute a statement
5
+ **App:** `snowflake`
6
+ **Version:** `20260615_00`
7
+ **Actions:** 16
56
8
 
57
9
  ```ts
58
- import { executeSql } from '@keystrokehq/snowflake/sql';
10
+ import { defineAgent } from "@keystrokehq/keystroke/agent";
11
+ import { snowflakeCancelStatementExecution } from "@keystrokehq/snowflake/actions";
59
12
 
60
- const result = await executeSql(client, {
61
- statement: 'SELECT 1 AS ping',
62
- timeout: 60,
13
+ export default defineAgent({
14
+ key: "snowflake-agent",
15
+ tools: [snowflakeCancelStatementExecution],
63
16
  });
64
-
65
- for (const row of result.rows) {
66
- console.log(row);
67
- }
68
17
  ```
69
-
70
- ### Find rows with parameter binding
71
-
72
- ```ts
73
- import { findRows } from '@keystrokehq/snowflake/rows';
74
-
75
- const rows = await findRows(client, {
76
- database: 'ANALYTICS',
77
- schema: 'PUBLIC',
78
- table: 'ORDERS',
79
- where: { STATUS: 'OPEN' },
80
- orderBy: [{ column: 'CREATED_AT', direction: 'DESC' }],
81
- limit: 100,
82
- });
83
- ```
84
-
85
- ### Show tables in a schema
86
-
87
- ```ts
88
- import { showTables } from '@keystrokehq/snowflake/catalog';
89
-
90
- const tables = await showTables(client, {
91
- database: 'ANALYTICS',
92
- schema: 'PUBLIC',
93
- });
94
- ```
95
-
96
- ### Run a task on demand
97
-
98
- ```ts
99
- import { executeTask } from '@keystrokehq/snowflake/tasks';
100
-
101
- await executeTask(client, {
102
- database: 'ANALYTICS',
103
- schema: 'PUBLIC',
104
- name: 'REFRESH_FACTS',
105
- });
106
- ```
107
-
108
- ### Refresh a pipe + insert files over Snowpipe REST
109
-
110
- ```ts
111
- import { insertFiles, refreshPipe } from '@keystrokehq/snowflake/pipes';
112
-
113
- await refreshPipe(client, {
114
- database: 'ANALYTICS',
115
- schema: 'RAW',
116
- name: 'ORDERS_PIPE',
117
- });
118
-
119
- await insertFiles(client, {
120
- database: 'ANALYTICS',
121
- schema: 'RAW',
122
- name: 'ORDERS_PIPE',
123
- files: [{ path: 'orders/2026/04/20.parquet' }],
124
- });
125
- ```
126
-
127
- ## Triggers
128
-
129
- ### Polling trigger — new rows on a stream
130
-
131
- ```ts
132
- import { polling } from '@keystrokehq/snowflake/triggers';
133
-
134
- const bound = polling.streamHasNewRows({
135
- streamName: 'ANALYTICS.PUBLIC.ORDERS_STREAM',
136
- schedule: '*/5 * * * *',
137
- name: 'Orders stream has new rows',
138
- transform: (event) => ({
139
- streamName: event.streamName,
140
- checkedAt: event.checkedAt,
141
- }),
142
- });
143
- ```
144
-
145
- ### Polling trigger — signature-diff on `SHOW GRANTS`
146
-
147
- ```ts
148
- import { polling } from '@keystrokehq/snowflake/triggers';
149
-
150
- const grants = polling.grantsChanged({
151
- grantee: { role: 'KEYSTROKE_ROLE' },
152
- schedule: '15m',
153
- });
154
- ```
155
-
156
- ### Auto-ingest webhook — AWS SNS
157
-
158
- ```ts
159
- import { webhooks } from '@keystrokehq/snowflake/triggers';
160
-
161
- const s3Sns = webhooks.autoIngestS3Sns({
162
- name: 'Snowpipe via SNS',
163
- transform: (batch) => ({
164
- bucket: batch.events[0]?.bucket,
165
- objects: batch.events.length,
166
- }),
167
- });
168
- ```
169
-
170
- ### Auto-ingest webhook — GCS Pub/Sub push
171
-
172
- ```ts
173
- import { webhooks } from '@keystrokehq/snowflake/triggers';
174
-
175
- const gcs = webhooks.autoIngestGcsPubSub({
176
- transform: (batch) => ({ objects: batch.events.length }),
177
- });
178
- ```
179
-
180
- ### Auto-ingest webhook — Azure Event Grid
181
-
182
- ```ts
183
- import { webhooks } from '@keystrokehq/snowflake/triggers';
184
-
185
- const eg = webhooks.autoIngestAzureEventGrid({
186
- transform: (batch) => ({ objects: batch.events.length }),
187
- });
188
- ```
189
-
190
- ## Verification helpers
191
-
192
- Every auto-ingest webhook verifies itself through the `verify` callback wired by the trigger factory. The underlying helpers are also exported for direct use — for example, from an edge proxy that wants to reject unsigned requests before the payload reaches a workflow.
193
-
194
- ```ts
195
- import {
196
- SnowflakeWebhookVerificationError,
197
- verifyEventGridRequest,
198
- verifyPubSubPushAuthorization,
199
- verifySnsMessage,
200
- } from '@keystrokehq/snowflake/verification';
201
-
202
- try {
203
- await verifySnsMessage(rawBody, {
204
- expectedTopicArn: 'arn:aws:sns:us-east-1:123456789012:snowpipe-orders',
205
- });
206
- } catch (err) {
207
- if (err instanceof SnowflakeWebhookVerificationError) {
208
- // err.reason ∈ 'invalid-json' | 'schema' | 'topic-arn' | 'signing-cert-host' | 'signature' | ...
209
- }
210
- }
211
- ```
212
-
213
- ## Public surface
214
-
215
- - `@keystrokehq/snowflake/credential-sets` — `snowflakeCredentialSet`, platform-only auto-ingest webhook credential sets, auth schemas, and credential types.
216
- - `@keystrokehq/snowflake/operations` — catalog operation barrel (empty today; trigger-only package).
217
- - `@keystrokehq/snowflake/client` — `createSnowflakeClient(credentials, options?)` for direct SQL API access.
218
- - `@keystrokehq/snowflake/schemas` — shared Zod schemas (statements, results, pipes, catalog, and more).
219
- - `@keystrokehq/snowflake/events` — curated Zod event contracts emitted by each trigger.
220
- - `@keystrokehq/snowflake/triggers` — `polling`, `webhooks`, and `autoIngest` direct-binding helpers.
221
- - `@keystrokehq/snowflake/verification` — auto-ingest cloud-event verification (SNS, Pub/Sub, Event Grid).
222
-
223
- ### Operation domains
224
-
225
- - `sql` — `submitStatement`, `getStatement`, `cancelStatement`, `executeSql`, `runQuery`, `getStatementResultPartition`, `iterateStatementResult`, `waitForStatement`.
226
- - `results` — partition iteration + row hydration helpers.
227
- - `catalog` — `SHOW`/`DESCRIBE` across databases, schemas, tables, views, columns, warehouses, roles, users, stages, pipes, tasks, streams, shares, functions, procedures, file formats, grants; plus Relay-style `findDatabases`/`findSchemas`/`findTables` and BASIC-parity `describeTable`/`exploreColumns`.
228
- - `rows` — `findRow`, `findRows`, `insertRow`, `batchInsert`, `updateRow`, `deleteRow`, `upsertRow`, `mergeRows`.
229
- - `databases`, `schemas-catalog`, `tables`, `views`, `stages`, `file-formats`, `streams`, `tasks`, `warehouses`, `roles`, `users`, `grants`, `shares`, `functions`, `procedures`, `accounts`, `org-admin` — DDL + admin.
230
- - `pipes`, `streaming`, `bulk` — Snowpipe file REST, Snowpipe Streaming channels, stage-oriented bulk helpers.
231
- - `status-page` — Composio-parity Snowflake status page endpoints.
232
-
233
- ## Safety
234
-
235
- - Destructive DDL operations (`dropTable`, `dropDatabase`, `dropSchema`, `dropUser`, `dropRole`, `dropWarehouse`, `dropShare`, etc.) require an explicit `confirm: true` input and are marked `needsApproval: true` where surfaced through the operation factory.
236
- - The package never streams file bytes directly through the SQL API. File-oriented helpers (`putFile`, `getFile`) orchestrate `PUT @stage` / `GET @stage` SQL statements and return the result; binary payloads must be supplied through an external stage with its own cloud credentials.
237
- - `basic` auth emits `console.warn` at client creation time; Snowflake has deprecated password-only programmatic access.
238
-
239
- ## License
240
-
241
- MIT
package/package.json CHANGED
@@ -1,188 +1,56 @@
1
1
  {
2
2
  "name": "@keystrokehq/snowflake",
3
- "version": "0.0.16",
4
- "private": false,
5
- "sideEffects": false,
3
+ "version": "0.0.18",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/keystrokehq/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
- "default": "./dist/index.mjs"
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
- "./tasks": {
93
- "types": "./dist/tasks.d.mts",
94
- "default": "./dist/tasks.mjs"
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
- "files": [
142
- "dist",
143
- "README.md",
144
- "LICENSE"
145
- ],
146
- "dependencies": {
147
- "zod": "^4.3.6"
28
+ "publishConfig": {
29
+ "access": "public",
30
+ "registry": "https://registry.npmjs.org"
148
31
  },
149
- "peerDependencies": {
150
- "@keystrokehq/core": ">=0.0.8 <0.1.0"
32
+ "dependencies": {
33
+ "zod": "^4.4.3",
34
+ "@keystrokehq/keystroke": "0.1.0"
151
35
  },
152
36
  "devDependencies": {
153
- "@types/node": "^22.19.11",
154
- "tsdown": "^0.20.3",
155
- "typescript": "^5.9.3",
156
- "vitest": "^4.0.18",
157
- "@keystrokehq/core": "^0.0.12",
158
- "@keystrokehq/test-utils": "0.0.0",
159
- "@keystrokehq/typescript-config": "0.0.0",
160
- "@keystrokehq/integration-authoring": "0.0.9"
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/oxlint-config": "0.0.4",
43
+ "@keystrokehq/tsconfig": "0.0.3",
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
- "lint": "biome check .",
184
- "test:unit": "vitest run --passWithNoTests --project unit",
185
- "test:int": "vitest run --passWithNoTests --project int",
186
- "lint:fix": "biome check --write ."
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 };
@@ -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 };
@@ -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 };