@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.
Files changed (100) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -233
  3. package/dist/actions/index.cjs +18 -0
  4. package/dist/actions/index.d.cts +2 -0
  5. package/dist/actions/index.d.mts +2 -0
  6. package/dist/actions/index.mjs +2 -0
  7. package/dist/actions-BGkaZb6a.cjs +801 -0
  8. package/dist/actions-BGkaZb6a.cjs.map +1 -0
  9. package/dist/actions-BR_JWhT_.mjs +700 -0
  10. package/dist/actions-BR_JWhT_.mjs.map +1 -0
  11. package/dist/index-DUGCZPGQ.d.cts +443 -0
  12. package/dist/index-DUGCZPGQ.d.cts.map +1 -0
  13. package/dist/index-RhOmpRxD.d.mts +445 -0
  14. package/dist/index-RhOmpRxD.d.mts.map +1 -0
  15. package/dist/index.cjs +34 -0
  16. package/dist/index.cjs.map +1 -0
  17. package/dist/index.d.cts +19 -0
  18. package/dist/index.d.cts.map +1 -0
  19. package/dist/index.d.mts +19 -4
  20. package/dist/index.d.mts.map +1 -0
  21. package/dist/index.mjs +15 -5
  22. package/dist/index.mjs.map +1 -0
  23. package/package.json +39 -171
  24. package/dist/accounts/index.d.mts +0 -40
  25. package/dist/accounts/index.mjs +0 -51
  26. package/dist/bulk/index.d.mts +0 -71
  27. package/dist/bulk/index.mjs +0 -65
  28. package/dist/catalog/index.d.mts +0 -144
  29. package/dist/catalog/index.mjs +0 -158
  30. package/dist/client/index.d.mts +0 -44
  31. package/dist/client/index.mjs +0 -273
  32. package/dist/common-DfpCwJx5.mjs +0 -92
  33. package/dist/credential-sets/index.d.mts +0 -3
  34. package/dist/credential-sets/index.mjs +0 -4
  35. package/dist/databases/index.d.mts +0 -2
  36. package/dist/databases/index.mjs +0 -3
  37. package/dist/errors-60AsF7Su.mjs +0 -95
  38. package/dist/events/index.d.mts +0 -382
  39. package/dist/events/index.mjs +0 -291
  40. package/dist/file-formats/index.d.mts +0 -39
  41. package/dist/file-formats/index.mjs +0 -48
  42. package/dist/functions/index.d.mts +0 -53
  43. package/dist/functions/index.mjs +0 -56
  44. package/dist/grants/index.d.mts +0 -93
  45. package/dist/grants/index.mjs +0 -102
  46. package/dist/operations/index.d.mts +0 -1
  47. package/dist/operations/index.mjs +0 -1
  48. package/dist/org-admin/index.d.mts +0 -80
  49. package/dist/org-admin/index.mjs +0 -79
  50. package/dist/pipes/index.d.mts +0 -119
  51. package/dist/pipes/index.mjs +0 -106
  52. package/dist/procedures/index.d.mts +0 -61
  53. package/dist/procedures/index.mjs +0 -79
  54. package/dist/results/index.d.mts +0 -16
  55. package/dist/results/index.mjs +0 -64
  56. package/dist/retry-B4-9MZIp.mjs +0 -164
  57. package/dist/retry-w7cTp1QL.d.mts +0 -10
  58. package/dist/roles/index.d.mts +0 -60
  59. package/dist/roles/index.mjs +0 -74
  60. package/dist/rows/index.d.mts +0 -106
  61. package/dist/rows/index.mjs +0 -223
  62. package/dist/schemas/index.d.mts +0 -2
  63. package/dist/schemas/index.mjs +0 -4
  64. package/dist/schemas-catalog/index.d.mts +0 -2
  65. package/dist/schemas-catalog/index.mjs +0 -3
  66. package/dist/shares/index.d.mts +0 -56
  67. package/dist/shares/index.mjs +0 -77
  68. package/dist/snowflake-s3-sns-webhook.credential-set-D6bLAWy5.d.mts +0 -50
  69. package/dist/snowflake-s3-sns-webhook.credential-set-DzR7oWNK.mjs +0 -44
  70. package/dist/snowflake.credential-set-BxT7Gf3A.d.mts +0 -114
  71. package/dist/snowflake.credential-set-DE3gXf-a.mjs +0 -106
  72. package/dist/sql/index.d.mts +0 -84
  73. package/dist/sql/index.mjs +0 -209
  74. package/dist/sql-options-2k5xQ-oS.d.mts +0 -32
  75. package/dist/sql-options-D6GEa21F.mjs +0 -79
  76. package/dist/sql-safety-BZpAPsq6.mjs +0 -56
  77. package/dist/stages/index.d.mts +0 -64
  78. package/dist/stages/index.mjs +0 -81
  79. package/dist/statements-BumhMhN4.mjs +0 -81
  80. package/dist/statements-DJL0qVNA.d.mts +0 -238
  81. package/dist/status-page/index.d.mts +0 -510
  82. package/dist/status-page/index.mjs +0 -261
  83. package/dist/streaming/index.d.mts +0 -70
  84. package/dist/streaming/index.mjs +0 -56
  85. package/dist/streams/index.d.mts +0 -71
  86. package/dist/streams/index.mjs +0 -78
  87. package/dist/tables/index.d.mts +0 -2
  88. package/dist/tables/index.mjs +0 -3
  89. package/dist/tasks/index.d.mts +0 -79
  90. package/dist/tasks/index.mjs +0 -104
  91. package/dist/triggers/index.d.mts +0 -381
  92. package/dist/triggers/index.mjs +0 -1100
  93. package/dist/users/index.d.mts +0 -61
  94. package/dist/users/index.mjs +0 -67
  95. package/dist/verification/index.d.mts +0 -201
  96. package/dist/verification/index.mjs +0 -512
  97. package/dist/views/index.d.mts +0 -2
  98. package/dist/views/index.mjs +0 -3
  99. package/dist/warehouses/index.d.mts +0 -68
  100. 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
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_actions = require("../actions-BGkaZb6a.cjs");
3
+ exports.snowflakeCancelStatementExecution = require_actions.snowflakeCancelStatementExecution;
4
+ exports.snowflakeCheckStatementStatus = require_actions.snowflakeCheckStatementStatus;
5
+ exports.snowflakeDropWarehouse = require_actions.snowflakeDropWarehouse;
6
+ exports.snowflakeExecuteSql = require_actions.snowflakeExecuteSql;
7
+ exports.snowflakeFetchCatalogIntegration = require_actions.snowflakeFetchCatalogIntegration;
8
+ exports.snowflakeGetActiveScheduledMaintenances = require_actions.snowflakeGetActiveScheduledMaintenances;
9
+ exports.snowflakeGetAllScheduledMaintenances = require_actions.snowflakeGetAllScheduledMaintenances;
10
+ exports.snowflakeGetComponentStatus = require_actions.snowflakeGetComponentStatus;
11
+ exports.snowflakeGetStatusRollup = require_actions.snowflakeGetStatusRollup;
12
+ exports.snowflakeGetStatusSummary = require_actions.snowflakeGetStatusSummary;
13
+ exports.snowflakeGetUnresolvedIncidents = require_actions.snowflakeGetUnresolvedIncidents;
14
+ exports.snowflakeGetUpcomingScheduledMaintenances = require_actions.snowflakeGetUpcomingScheduledMaintenances;
15
+ exports.snowflakeShowDatabases = require_actions.snowflakeShowDatabases;
16
+ exports.snowflakeShowSchemas = require_actions.snowflakeShowSchemas;
17
+ exports.snowflakeShowTables = require_actions.snowflakeShowTables;
18
+ exports.snowflakeValidateCredential = require_actions.snowflakeValidateCredential;
@@ -0,0 +1,2 @@
1
+ import { a as snowflakeGetUpcomingScheduledMaintenances, c as snowflakeGetStatusRollup, d as snowflakeGetActiveScheduledMaintenances, f as snowflakeFetchCatalogIntegration, g as snowflakeCancelStatementExecution, h as snowflakeCheckStatementStatus, i as snowflakeShowDatabases, l as snowflakeGetComponentStatus, m as snowflakeDropWarehouse, n as snowflakeShowTables, o as snowflakeGetUnresolvedIncidents, p as snowflakeExecuteSql, r as snowflakeShowSchemas, s as snowflakeGetStatusSummary, t as snowflakeValidateCredential, u as snowflakeGetAllScheduledMaintenances } from "../index-DUGCZPGQ.cjs";
2
+ export { snowflakeCancelStatementExecution, snowflakeCheckStatementStatus, snowflakeDropWarehouse, snowflakeExecuteSql, snowflakeFetchCatalogIntegration, snowflakeGetActiveScheduledMaintenances, snowflakeGetAllScheduledMaintenances, snowflakeGetComponentStatus, snowflakeGetStatusRollup, snowflakeGetStatusSummary, snowflakeGetUnresolvedIncidents, snowflakeGetUpcomingScheduledMaintenances, snowflakeShowDatabases, snowflakeShowSchemas, snowflakeShowTables, snowflakeValidateCredential };
@@ -0,0 +1,2 @@
1
+ import { a as snowflakeGetUpcomingScheduledMaintenances, c as snowflakeGetStatusRollup, d as snowflakeGetActiveScheduledMaintenances, f as snowflakeFetchCatalogIntegration, g as snowflakeCancelStatementExecution, h as snowflakeCheckStatementStatus, i as snowflakeShowDatabases, l as snowflakeGetComponentStatus, m as snowflakeDropWarehouse, n as snowflakeShowTables, o as snowflakeGetUnresolvedIncidents, p as snowflakeExecuteSql, r as snowflakeShowSchemas, s as snowflakeGetStatusSummary, t as snowflakeValidateCredential, u as snowflakeGetAllScheduledMaintenances } from "../index-RhOmpRxD.mjs";
2
+ export { snowflakeCancelStatementExecution, snowflakeCheckStatementStatus, snowflakeDropWarehouse, snowflakeExecuteSql, snowflakeFetchCatalogIntegration, snowflakeGetActiveScheduledMaintenances, snowflakeGetAllScheduledMaintenances, snowflakeGetComponentStatus, snowflakeGetStatusRollup, snowflakeGetStatusSummary, snowflakeGetUnresolvedIncidents, snowflakeGetUpcomingScheduledMaintenances, snowflakeShowDatabases, snowflakeShowSchemas, snowflakeShowTables, snowflakeValidateCredential };
@@ -0,0 +1,2 @@
1
+ import { a as snowflakeGetUpcomingScheduledMaintenances, c as snowflakeGetStatusRollup, d as snowflakeGetActiveScheduledMaintenances, f as snowflakeFetchCatalogIntegration, g as snowflakeCancelStatementExecution, h as snowflakeCheckStatementStatus, i as snowflakeShowDatabases, l as snowflakeGetComponentStatus, m as snowflakeDropWarehouse, n as snowflakeShowTables, o as snowflakeGetUnresolvedIncidents, p as snowflakeExecuteSql, r as snowflakeShowSchemas, s as snowflakeGetStatusSummary, t as snowflakeValidateCredential, u as snowflakeGetAllScheduledMaintenances } from "../actions-BR_JWhT_.mjs";
2
+ export { snowflakeCancelStatementExecution, snowflakeCheckStatementStatus, snowflakeDropWarehouse, snowflakeExecuteSql, snowflakeFetchCatalogIntegration, snowflakeGetActiveScheduledMaintenances, snowflakeGetAllScheduledMaintenances, snowflakeGetComponentStatus, snowflakeGetStatusRollup, snowflakeGetStatusSummary, snowflakeGetUnresolvedIncidents, snowflakeGetUpcomingScheduledMaintenances, snowflakeShowDatabases, snowflakeShowSchemas, snowflakeShowTables, snowflakeValidateCredential };