@keystrokehq/snowflake 0.0.1

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 (81) hide show
  1. package/README.md +247 -0
  2. package/dist/_official/index.d.mts +2 -0
  3. package/dist/_official/index.mjs +3 -0
  4. package/dist/_runtime/index.d.mts +1 -0
  5. package/dist/_runtime/index.mjs +1 -0
  6. package/dist/accounts.d.mts +40 -0
  7. package/dist/accounts.mjs +51 -0
  8. package/dist/bulk.d.mts +71 -0
  9. package/dist/bulk.mjs +65 -0
  10. package/dist/catalog.d.mts +144 -0
  11. package/dist/catalog.mjs +158 -0
  12. package/dist/client.d.mts +44 -0
  13. package/dist/client.mjs +273 -0
  14. package/dist/common-BnKTPQXc.mjs +92 -0
  15. package/dist/connection.d.mts +2 -0
  16. package/dist/connection.mjs +3 -0
  17. package/dist/databases.d.mts +2 -0
  18. package/dist/databases.mjs +3 -0
  19. package/dist/errors-DKnc9o_a.mjs +95 -0
  20. package/dist/events.d.mts +382 -0
  21. package/dist/events.mjs +291 -0
  22. package/dist/file-formats.d.mts +39 -0
  23. package/dist/file-formats.mjs +48 -0
  24. package/dist/functions.d.mts +53 -0
  25. package/dist/functions.mjs +56 -0
  26. package/dist/grants.d.mts +93 -0
  27. package/dist/grants.mjs +102 -0
  28. package/dist/index.d.mts +1 -0
  29. package/dist/index.mjs +1 -0
  30. package/dist/integration-CCWMSTlO.d.mts +170 -0
  31. package/dist/integration-Dptv8L0L.mjs +207 -0
  32. package/dist/org-admin.d.mts +80 -0
  33. package/dist/org-admin.mjs +79 -0
  34. package/dist/pipes.d.mts +119 -0
  35. package/dist/pipes.mjs +106 -0
  36. package/dist/procedures.d.mts +61 -0
  37. package/dist/procedures.mjs +79 -0
  38. package/dist/results.d.mts +16 -0
  39. package/dist/results.mjs +64 -0
  40. package/dist/retry-0hMfb8cC.mjs +164 -0
  41. package/dist/retry-w7cTp1QL.d.mts +10 -0
  42. package/dist/roles.d.mts +60 -0
  43. package/dist/roles.mjs +74 -0
  44. package/dist/rows.d.mts +106 -0
  45. package/dist/rows.mjs +223 -0
  46. package/dist/schemas/index.d.mts +2 -0
  47. package/dist/schemas/index.mjs +4 -0
  48. package/dist/schemas-catalog.d.mts +2 -0
  49. package/dist/schemas-catalog.mjs +3 -0
  50. package/dist/shares.d.mts +56 -0
  51. package/dist/shares.mjs +77 -0
  52. package/dist/sql-options-2k5xQ-oS.d.mts +32 -0
  53. package/dist/sql-options-DI-OmLU6.mjs +79 -0
  54. package/dist/sql-safety-CywdR3EP.mjs +56 -0
  55. package/dist/sql.d.mts +84 -0
  56. package/dist/sql.mjs +209 -0
  57. package/dist/stages.d.mts +64 -0
  58. package/dist/stages.mjs +81 -0
  59. package/dist/statements-B2ThF_4b.mjs +81 -0
  60. package/dist/statements-DJL0qVNA.d.mts +238 -0
  61. package/dist/status-page.d.mts +510 -0
  62. package/dist/status-page.mjs +261 -0
  63. package/dist/streaming.d.mts +70 -0
  64. package/dist/streaming.mjs +56 -0
  65. package/dist/streams.d.mts +71 -0
  66. package/dist/streams.mjs +78 -0
  67. package/dist/tables.d.mts +2 -0
  68. package/dist/tables.mjs +3 -0
  69. package/dist/tasks.d.mts +79 -0
  70. package/dist/tasks.mjs +104 -0
  71. package/dist/triggers.d.mts +578 -0
  72. package/dist/triggers.mjs +1363 -0
  73. package/dist/users.d.mts +61 -0
  74. package/dist/users.mjs +67 -0
  75. package/dist/verification.d.mts +201 -0
  76. package/dist/verification.mjs +512 -0
  77. package/dist/views.d.mts +2 -0
  78. package/dist/views.mjs +3 -0
  79. package/dist/warehouses.d.mts +68 -0
  80. package/dist/warehouses.mjs +101 -0
  81. package/package.json +190 -0
@@ -0,0 +1,382 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/events.d.ts
4
+ /**
5
+ * Row batch shape used by the SQL-emitting polling triggers.
6
+ *
7
+ * `rows` is the hydrated row list (column-name keyed record) straight
8
+ * from `executeSql`. `columns` preserves the `resultSetMetaData.rowType`
9
+ * entries so downstream workflows can introspect nullability / type
10
+ * without a round-trip. `fetchedAt` is the ISO-8601 timestamp we
11
+ * captured the result at.
12
+ */
13
+ declare const snowflakeRowBatchSchema: z.ZodObject<{
14
+ rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
15
+ columns: z.ZodArray<z.ZodObject<{
16
+ name: z.ZodString;
17
+ type: z.ZodString;
18
+ nullable: z.ZodOptional<z.ZodBoolean>;
19
+ length: z.ZodOptional<z.ZodNumber>;
20
+ precision: z.ZodOptional<z.ZodNumber>;
21
+ scale: z.ZodOptional<z.ZodNumber>;
22
+ byteLength: z.ZodOptional<z.ZodNumber>;
23
+ collation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ database: z.ZodOptional<z.ZodString>;
25
+ schema: z.ZodOptional<z.ZodString>;
26
+ table: z.ZodOptional<z.ZodString>;
27
+ }, z.core.$catchall<z.ZodUnknown>>>;
28
+ rowCount: z.ZodNumber;
29
+ fetchedAt: z.ZodString;
30
+ }, z.core.$catchall<z.ZodUnknown>>;
31
+ type SnowflakeRowBatch = z.infer<typeof snowflakeRowBatchSchema>;
32
+ declare const streamHasDataEventSchema: z.ZodObject<{
33
+ streamName: z.ZodString;
34
+ hasData: z.ZodBoolean;
35
+ checkedAt: z.ZodString;
36
+ }, z.core.$catchall<z.ZodUnknown>>;
37
+ type StreamHasDataEvent = z.infer<typeof streamHasDataEventSchema>;
38
+ declare const streamAppendOnlyEventSchema: z.ZodObject<{
39
+ rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
40
+ columns: z.ZodArray<z.ZodObject<{
41
+ name: z.ZodString;
42
+ type: z.ZodString;
43
+ nullable: z.ZodOptional<z.ZodBoolean>;
44
+ length: z.ZodOptional<z.ZodNumber>;
45
+ precision: z.ZodOptional<z.ZodNumber>;
46
+ scale: z.ZodOptional<z.ZodNumber>;
47
+ byteLength: z.ZodOptional<z.ZodNumber>;
48
+ collation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ database: z.ZodOptional<z.ZodString>;
50
+ schema: z.ZodOptional<z.ZodString>;
51
+ table: z.ZodOptional<z.ZodString>;
52
+ }, z.core.$catchall<z.ZodUnknown>>>;
53
+ rowCount: z.ZodNumber;
54
+ fetchedAt: z.ZodString;
55
+ streamName: z.ZodString;
56
+ }, z.core.$catchall<z.ZodUnknown>>;
57
+ type StreamAppendOnlyEvent = z.infer<typeof streamAppendOnlyEventSchema>;
58
+ declare const scheduledSqlEventSchema: z.ZodObject<{
59
+ rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
60
+ columns: z.ZodArray<z.ZodObject<{
61
+ name: z.ZodString;
62
+ type: z.ZodString;
63
+ nullable: z.ZodOptional<z.ZodBoolean>;
64
+ length: z.ZodOptional<z.ZodNumber>;
65
+ precision: z.ZodOptional<z.ZodNumber>;
66
+ scale: z.ZodOptional<z.ZodNumber>;
67
+ byteLength: z.ZodOptional<z.ZodNumber>;
68
+ collation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
+ database: z.ZodOptional<z.ZodString>;
70
+ schema: z.ZodOptional<z.ZodString>;
71
+ table: z.ZodOptional<z.ZodString>;
72
+ }, z.core.$catchall<z.ZodUnknown>>>;
73
+ rowCount: z.ZodNumber;
74
+ fetchedAt: z.ZodString;
75
+ statementDigest: z.ZodString;
76
+ }, z.core.$catchall<z.ZodUnknown>>;
77
+ type ScheduledSqlEvent = z.infer<typeof scheduledSqlEventSchema>;
78
+ declare const scheduledDeltaEventSchema: z.ZodObject<{
79
+ rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
80
+ columns: z.ZodArray<z.ZodObject<{
81
+ name: z.ZodString;
82
+ type: z.ZodString;
83
+ nullable: z.ZodOptional<z.ZodBoolean>;
84
+ length: z.ZodOptional<z.ZodNumber>;
85
+ precision: z.ZodOptional<z.ZodNumber>;
86
+ scale: z.ZodOptional<z.ZodNumber>;
87
+ byteLength: z.ZodOptional<z.ZodNumber>;
88
+ collation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
+ database: z.ZodOptional<z.ZodString>;
90
+ schema: z.ZodOptional<z.ZodString>;
91
+ table: z.ZodOptional<z.ZodString>;
92
+ }, z.core.$catchall<z.ZodUnknown>>>;
93
+ rowCount: z.ZodNumber;
94
+ fetchedAt: z.ZodString;
95
+ table: z.ZodString;
96
+ cursorColumn: z.ZodString;
97
+ highWaterValue: z.ZodNullable<z.ZodString>;
98
+ }, z.core.$catchall<z.ZodUnknown>>;
99
+ type ScheduledDeltaEvent = z.infer<typeof scheduledDeltaEventSchema>;
100
+ declare const taskRunEventSchema: z.ZodObject<{
101
+ name: z.ZodString;
102
+ databaseName: z.ZodOptional<z.ZodString>;
103
+ schemaName: z.ZodOptional<z.ZodString>;
104
+ state: z.ZodString;
105
+ queryId: z.ZodOptional<z.ZodString>;
106
+ scheduledTime: z.ZodOptional<z.ZodString>;
107
+ completedTime: z.ZodOptional<z.ZodString>;
108
+ errorCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
109
+ errorMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
110
+ attemptNumber: z.ZodOptional<z.ZodNumber>;
111
+ runId: z.ZodOptional<z.ZodString>;
112
+ row: z.ZodRecord<z.ZodString, z.ZodUnknown>;
113
+ }, z.core.$catchall<z.ZodUnknown>>;
114
+ type TaskRunEvent = z.infer<typeof taskRunEventSchema>;
115
+ declare const statementCompletedEventSchema: z.ZodObject<{
116
+ queryId: z.ZodString;
117
+ executionStatus: z.ZodString;
118
+ queryText: z.ZodOptional<z.ZodString>;
119
+ errorCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
120
+ errorMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
121
+ startTime: z.ZodOptional<z.ZodString>;
122
+ endTime: z.ZodOptional<z.ZodString>;
123
+ warehouseName: z.ZodOptional<z.ZodString>;
124
+ databaseName: z.ZodOptional<z.ZodString>;
125
+ schemaName: z.ZodOptional<z.ZodString>;
126
+ userName: z.ZodOptional<z.ZodString>;
127
+ roleName: z.ZodOptional<z.ZodString>;
128
+ totalElapsedTimeMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
129
+ row: z.ZodRecord<z.ZodString, z.ZodUnknown>;
130
+ }, z.core.$catchall<z.ZodUnknown>>;
131
+ type StatementCompletedEvent = z.infer<typeof statementCompletedEventSchema>;
132
+ declare const pipeLoadEventSchema: z.ZodObject<{
133
+ pipeName: z.ZodString;
134
+ filePath: z.ZodString;
135
+ status: z.ZodString;
136
+ loadTime: z.ZodOptional<z.ZodString>;
137
+ rowCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
138
+ rowParsed: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
139
+ errorLimit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
140
+ errorsSeen: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
141
+ firstErrorMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
142
+ firstErrorLineNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
143
+ firstErrorColumnName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
144
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
145
+ stageLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
146
+ row: z.ZodRecord<z.ZodString, z.ZodUnknown>;
147
+ }, z.core.$catchall<z.ZodUnknown>>;
148
+ type PipeLoadEvent = z.infer<typeof pipeLoadEventSchema>;
149
+ /**
150
+ * Kinds of Snowflake objects the SHOW-diff polling triggers can surface.
151
+ * Kept open-ended (`z.string()`) via the enum's `catch` so new kinds can
152
+ * be added without bumping the schema — callers rarely want to pattern
153
+ * match on the kind, they just want the row.
154
+ */
155
+ declare const snowflakeObjectKindSchema: z.ZodEnum<{
156
+ USER: "USER";
157
+ ROLE: "ROLE";
158
+ DATABASE: "DATABASE";
159
+ SCHEMA: "SCHEMA";
160
+ TABLE: "TABLE";
161
+ VIEW: "VIEW";
162
+ STAGE: "STAGE";
163
+ PIPE: "PIPE";
164
+ TASK: "TASK";
165
+ STREAM: "STREAM";
166
+ SHARE: "SHARE";
167
+ WAREHOUSE: "WAREHOUSE";
168
+ FUNCTION: "FUNCTION";
169
+ PROCEDURE: "PROCEDURE";
170
+ FILE_FORMAT: "FILE_FORMAT";
171
+ }>;
172
+ type SnowflakeObjectKind = z.infer<typeof snowflakeObjectKindSchema>;
173
+ declare const snowflakeObjectLifecycleEventSchema: z.ZodObject<{
174
+ kind: z.ZodString;
175
+ name: z.ZodString;
176
+ change: z.ZodEnum<{
177
+ created: "created";
178
+ dropped: "dropped";
179
+ }>;
180
+ identity: z.ZodString;
181
+ owner: z.ZodOptional<z.ZodString>;
182
+ createdOn: z.ZodOptional<z.ZodString>;
183
+ detectedAt: z.ZodString;
184
+ row: z.ZodRecord<z.ZodString, z.ZodUnknown>;
185
+ }, z.core.$catchall<z.ZodUnknown>>;
186
+ type SnowflakeObjectLifecycleEvent = z.infer<typeof snowflakeObjectLifecycleEventSchema>;
187
+ declare const shareChangedEventSchema: z.ZodObject<{
188
+ name: z.ZodString;
189
+ kind: z.ZodOptional<z.ZodString>;
190
+ change: z.ZodEnum<{
191
+ created: "created";
192
+ dropped: "dropped";
193
+ modified: "modified";
194
+ }>;
195
+ identity: z.ZodString;
196
+ detectedAt: z.ZodString;
197
+ previousRow: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
198
+ currentRow: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
199
+ }, z.core.$catchall<z.ZodUnknown>>;
200
+ type ShareChangedEvent = z.infer<typeof shareChangedEventSchema>;
201
+ declare const grantChangedEventSchema: z.ZodObject<{
202
+ privilege: z.ZodString;
203
+ grantedOn: z.ZodString;
204
+ objectName: z.ZodString;
205
+ granteeName: z.ZodString;
206
+ granteeType: z.ZodOptional<z.ZodString>;
207
+ change: z.ZodEnum<{
208
+ granted: "granted";
209
+ revoked: "revoked";
210
+ }>;
211
+ identity: z.ZodString;
212
+ detectedAt: z.ZodString;
213
+ row: z.ZodRecord<z.ZodString, z.ZodUnknown>;
214
+ }, z.core.$catchall<z.ZodUnknown>>;
215
+ type GrantChangedEvent = z.infer<typeof grantChangedEventSchema>;
216
+ declare const warehouseCreditsEventSchema: z.ZodObject<{
217
+ warehouseName: z.ZodString;
218
+ startTime: z.ZodOptional<z.ZodString>;
219
+ endTime: z.ZodOptional<z.ZodString>;
220
+ creditsUsed: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
221
+ creditsUsedCompute: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
222
+ creditsUsedCloudServices: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
223
+ row: z.ZodRecord<z.ZodString, z.ZodUnknown>;
224
+ }, z.core.$catchall<z.ZodUnknown>>;
225
+ type WarehouseCreditsEvent = z.infer<typeof warehouseCreditsEventSchema>;
226
+ declare const warehouseQueueEventSchema: z.ZodObject<{
227
+ warehouseName: z.ZodString;
228
+ startTime: z.ZodOptional<z.ZodString>;
229
+ endTime: z.ZodOptional<z.ZodString>;
230
+ avgRunning: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
231
+ avgQueuedLoad: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
232
+ avgQueuedProvisioning: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
233
+ avgBlocked: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
234
+ row: z.ZodRecord<z.ZodString, z.ZodUnknown>;
235
+ }, z.core.$catchall<z.ZodUnknown>>;
236
+ type WarehouseQueueEvent = z.infer<typeof warehouseQueueEventSchema>;
237
+ declare const statusPageIncidentEventSchema: z.ZodObject<{
238
+ id: z.ZodString;
239
+ name: z.ZodString;
240
+ status: z.ZodString;
241
+ impact: z.ZodOptional<z.ZodString>;
242
+ createdAt: z.ZodOptional<z.ZodString>;
243
+ updatedAt: z.ZodOptional<z.ZodString>;
244
+ resolvedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
245
+ shortlink: z.ZodOptional<z.ZodString>;
246
+ detectedAt: z.ZodString;
247
+ raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
248
+ }, z.core.$catchall<z.ZodUnknown>>;
249
+ type StatusPageIncidentEvent = z.infer<typeof statusPageIncidentEventSchema>;
250
+ declare const statusPageComponentChangeEventSchema: z.ZodObject<{
251
+ id: z.ZodString;
252
+ name: z.ZodString;
253
+ previousStatus: z.ZodNullable<z.ZodString>;
254
+ currentStatus: z.ZodString;
255
+ description: z.ZodOptional<z.ZodString>;
256
+ changedAt: z.ZodString;
257
+ detectedAt: z.ZodString;
258
+ raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
259
+ }, z.core.$catchall<z.ZodUnknown>>;
260
+ type StatusPageComponentChangeEvent = z.infer<typeof statusPageComponentChangeEventSchema>;
261
+ declare const snowflakeDiffSnapshotEntrySchema: z.ZodObject<{
262
+ identity: z.ZodString;
263
+ signature: z.ZodOptional<z.ZodString>;
264
+ }, z.core.$catchall<z.ZodUnknown>>;
265
+ type SnowflakeDiffSnapshotEntry = z.infer<typeof snowflakeDiffSnapshotEntrySchema>;
266
+ /**
267
+ * Canonical object-storage event shape emitted by the three auto-ingest
268
+ * webhook triggers. Each cloud's native payload is normalised to this
269
+ * shape; the raw envelope is preserved under `raw` for callers that
270
+ * need provider-specific fields (etag, metageneration, blob tier, ...).
271
+ */
272
+ declare const snowpipeObjectEventSchema: z.ZodObject<{
273
+ provider: z.ZodEnum<{
274
+ "aws-s3": "aws-s3";
275
+ "gcp-gcs": "gcp-gcs";
276
+ "azure-blob": "azure-blob";
277
+ }>;
278
+ eventType: z.ZodString;
279
+ eventTime: z.ZodString;
280
+ bucket: z.ZodString;
281
+ key: z.ZodString;
282
+ size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
283
+ etag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
284
+ region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
285
+ sourceIp: z.ZodOptional<z.ZodNullable<z.ZodString>>;
286
+ messageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
287
+ receivedAt: z.ZodString;
288
+ raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
289
+ }, z.core.$catchall<z.ZodUnknown>>;
290
+ type SnowpipeObjectEvent = z.infer<typeof snowpipeObjectEventSchema>;
291
+ /**
292
+ * Batch envelope used by auto-ingest webhook triggers — a single SNS
293
+ * notification, Pub/Sub push, or Event Grid batch can carry multiple
294
+ * object events, so the trigger emits `{ events, receivedAt, messageId }`.
295
+ */
296
+ declare const snowpipeObjectBatchSchema: z.ZodObject<{
297
+ events: z.ZodArray<z.ZodObject<{
298
+ provider: z.ZodEnum<{
299
+ "aws-s3": "aws-s3";
300
+ "gcp-gcs": "gcp-gcs";
301
+ "azure-blob": "azure-blob";
302
+ }>;
303
+ eventType: z.ZodString;
304
+ eventTime: z.ZodString;
305
+ bucket: z.ZodString;
306
+ key: z.ZodString;
307
+ size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
308
+ etag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
309
+ region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
310
+ sourceIp: z.ZodOptional<z.ZodNullable<z.ZodString>>;
311
+ messageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
312
+ receivedAt: z.ZodString;
313
+ raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
314
+ }, z.core.$catchall<z.ZodUnknown>>>;
315
+ provider: z.ZodEnum<{
316
+ "aws-s3": "aws-s3";
317
+ "gcp-gcs": "gcp-gcs";
318
+ "azure-blob": "azure-blob";
319
+ }>;
320
+ receivedAt: z.ZodString;
321
+ messageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
322
+ topic: z.ZodOptional<z.ZodNullable<z.ZodString>>;
323
+ raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
324
+ }, z.core.$catchall<z.ZodUnknown>>;
325
+ type SnowpipeObjectBatch = z.infer<typeof snowpipeObjectBatchSchema>;
326
+ /**
327
+ * Raw SNS "Notification" envelope. The outer webhook payload we accept
328
+ * from `autoIngestS3Sns` matches this shape — fields per the AWS SNS
329
+ * HTTP(S) delivery spec.
330
+ */
331
+ declare const snsNotificationSchema: z.ZodObject<{
332
+ Type: z.ZodEnum<{
333
+ Notification: "Notification";
334
+ SubscriptionConfirmation: "SubscriptionConfirmation";
335
+ UnsubscribeConfirmation: "UnsubscribeConfirmation";
336
+ }>;
337
+ MessageId: z.ZodString;
338
+ TopicArn: z.ZodString;
339
+ Message: z.ZodString;
340
+ Timestamp: z.ZodString;
341
+ SignatureVersion: z.ZodString;
342
+ Signature: z.ZodString;
343
+ SigningCertURL: z.ZodString;
344
+ Subject: z.ZodOptional<z.ZodString>;
345
+ Token: z.ZodOptional<z.ZodString>;
346
+ SubscribeURL: z.ZodOptional<z.ZodString>;
347
+ UnsubscribeURL: z.ZodOptional<z.ZodString>;
348
+ }, z.core.$catchall<z.ZodUnknown>>;
349
+ type SnsNotification = z.infer<typeof snsNotificationSchema>;
350
+ /**
351
+ * GCP Pub/Sub push envelope. The push subscription wraps the Pub/Sub
352
+ * message in `{message, subscription}`; `message.data` is base64 and
353
+ * decodes to the GCS object-change notification.
354
+ */
355
+ declare const gcsPubSubPushSchema: z.ZodObject<{
356
+ message: z.ZodObject<{
357
+ messageId: z.ZodOptional<z.ZodString>;
358
+ publishTime: z.ZodOptional<z.ZodString>;
359
+ data: z.ZodOptional<z.ZodString>;
360
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
361
+ }, z.core.$catchall<z.ZodUnknown>>;
362
+ subscription: z.ZodOptional<z.ZodString>;
363
+ }, z.core.$catchall<z.ZodUnknown>>;
364
+ type GcsPubSubPush = z.infer<typeof gcsPubSubPushSchema>;
365
+ /**
366
+ * Azure Event Grid event (Event Grid schema v1.0). The wire format is
367
+ * always a JSON array; we schema-validate a single envelope and the
368
+ * trigger unwraps the array at the boundary.
369
+ */
370
+ declare const azureEventGridEventSchema: z.ZodObject<{
371
+ id: z.ZodString;
372
+ eventType: z.ZodString;
373
+ subject: z.ZodString;
374
+ eventTime: z.ZodString;
375
+ dataVersion: z.ZodOptional<z.ZodString>;
376
+ metadataVersion: z.ZodOptional<z.ZodString>;
377
+ topic: z.ZodOptional<z.ZodString>;
378
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
379
+ }, z.core.$catchall<z.ZodUnknown>>;
380
+ type AzureEventGridEvent = z.infer<typeof azureEventGridEventSchema>;
381
+ //#endregion
382
+ export { AzureEventGridEvent, GcsPubSubPush, GrantChangedEvent, PipeLoadEvent, ScheduledDeltaEvent, ScheduledSqlEvent, ShareChangedEvent, SnowflakeDiffSnapshotEntry, SnowflakeObjectKind, SnowflakeObjectLifecycleEvent, SnowflakeRowBatch, SnowpipeObjectBatch, SnowpipeObjectEvent, SnsNotification, StatementCompletedEvent, StatusPageComponentChangeEvent, StatusPageIncidentEvent, StreamAppendOnlyEvent, StreamHasDataEvent, TaskRunEvent, WarehouseCreditsEvent, WarehouseQueueEvent, azureEventGridEventSchema, gcsPubSubPushSchema, grantChangedEventSchema, pipeLoadEventSchema, scheduledDeltaEventSchema, scheduledSqlEventSchema, shareChangedEventSchema, snowflakeDiffSnapshotEntrySchema, snowflakeObjectKindSchema, snowflakeObjectLifecycleEventSchema, snowflakeRowBatchSchema, snowpipeObjectBatchSchema, snowpipeObjectEventSchema, snsNotificationSchema, statementCompletedEventSchema, statusPageComponentChangeEventSchema, statusPageIncidentEventSchema, streamAppendOnlyEventSchema, streamHasDataEventSchema, taskRunEventSchema, warehouseCreditsEventSchema, warehouseQueueEventSchema };
@@ -0,0 +1,291 @@
1
+ import { o as snowflakeObjectRowSchema, t as columnMetaSchema } from "./common-BnKTPQXc.mjs";
2
+ import { z } from "zod";
3
+
4
+ //#region src/events.ts
5
+ /**
6
+ * Trigger event contracts — Zod schemas for the payload shapes that
7
+ * `src/triggers.ts` emits. Every polling trigger returns exactly one of
8
+ * these events per poll; webhook triggers return the mapped payload
9
+ * shapes defined alongside them.
10
+ *
11
+ * Design notes:
12
+ * - Events are flat, serialisable objects — no class instances, no
13
+ * dates (ISO-8601 strings instead), no BigInts.
14
+ * - Row lists are returned verbatim as `HydratedRow` / column metadata
15
+ * pairs so downstream workflows can pick columns dynamically without
16
+ * the schema needing to know the shape ahead of time.
17
+ * - `.catchall(unknown)` on object-history events — Snowflake adds
18
+ * columns over time (e.g., `ACTIVITY_NAME` → `FIRST_ERROR_CODE`) and
19
+ * we never want a new column to hard-fail an in-flight workflow.
20
+ */
21
+ /**
22
+ * Row batch shape used by the SQL-emitting polling triggers.
23
+ *
24
+ * `rows` is the hydrated row list (column-name keyed record) straight
25
+ * from `executeSql`. `columns` preserves the `resultSetMetaData.rowType`
26
+ * entries so downstream workflows can introspect nullability / type
27
+ * without a round-trip. `fetchedAt` is the ISO-8601 timestamp we
28
+ * captured the result at.
29
+ */
30
+ const snowflakeRowBatchSchema = z.object({
31
+ rows: z.array(snowflakeObjectRowSchema),
32
+ columns: z.array(columnMetaSchema),
33
+ rowCount: z.number().int().nonnegative(),
34
+ fetchedAt: z.string()
35
+ }).catchall(z.unknown());
36
+ const streamHasDataEventSchema = z.object({
37
+ streamName: z.string(),
38
+ hasData: z.boolean(),
39
+ checkedAt: z.string()
40
+ }).catchall(z.unknown());
41
+ const streamAppendOnlyEventSchema = snowflakeRowBatchSchema.extend({ streamName: z.string() });
42
+ const scheduledSqlEventSchema = snowflakeRowBatchSchema.extend({ statementDigest: z.string() });
43
+ const scheduledDeltaEventSchema = snowflakeRowBatchSchema.extend({
44
+ table: z.string(),
45
+ cursorColumn: z.string(),
46
+ highWaterValue: z.string().nullable()
47
+ });
48
+ const taskRunEventSchema = z.object({
49
+ name: z.string(),
50
+ databaseName: z.string().optional(),
51
+ schemaName: z.string().optional(),
52
+ state: z.string(),
53
+ queryId: z.string().optional(),
54
+ scheduledTime: z.string().optional(),
55
+ completedTime: z.string().optional(),
56
+ errorCode: z.string().nullable().optional(),
57
+ errorMessage: z.string().nullable().optional(),
58
+ attemptNumber: z.number().int().optional(),
59
+ runId: z.string().optional(),
60
+ row: snowflakeObjectRowSchema
61
+ }).catchall(z.unknown());
62
+ const statementCompletedEventSchema = z.object({
63
+ queryId: z.string(),
64
+ executionStatus: z.string(),
65
+ queryText: z.string().optional(),
66
+ errorCode: z.string().nullable().optional(),
67
+ errorMessage: z.string().nullable().optional(),
68
+ startTime: z.string().optional(),
69
+ endTime: z.string().optional(),
70
+ warehouseName: z.string().optional(),
71
+ databaseName: z.string().optional(),
72
+ schemaName: z.string().optional(),
73
+ userName: z.string().optional(),
74
+ roleName: z.string().optional(),
75
+ totalElapsedTimeMs: z.number().nullable().optional(),
76
+ row: snowflakeObjectRowSchema
77
+ }).catchall(z.unknown());
78
+ const pipeLoadEventSchema = z.object({
79
+ pipeName: z.string(),
80
+ filePath: z.string(),
81
+ status: z.string(),
82
+ loadTime: z.string().optional(),
83
+ rowCount: z.number().int().nullable().optional(),
84
+ rowParsed: z.number().int().nullable().optional(),
85
+ errorLimit: z.number().int().nullable().optional(),
86
+ errorsSeen: z.number().int().nullable().optional(),
87
+ firstErrorMessage: z.string().nullable().optional(),
88
+ firstErrorLineNumber: z.number().int().nullable().optional(),
89
+ firstErrorColumnName: z.string().nullable().optional(),
90
+ fileSize: z.number().int().nullable().optional(),
91
+ stageLocation: z.string().nullable().optional(),
92
+ row: snowflakeObjectRowSchema
93
+ }).catchall(z.unknown());
94
+ /**
95
+ * Kinds of Snowflake objects the SHOW-diff polling triggers can surface.
96
+ * Kept open-ended (`z.string()`) via the enum's `catch` so new kinds can
97
+ * be added without bumping the schema — callers rarely want to pattern
98
+ * match on the kind, they just want the row.
99
+ */
100
+ const snowflakeObjectKindSchema = z.enum([
101
+ "USER",
102
+ "ROLE",
103
+ "DATABASE",
104
+ "SCHEMA",
105
+ "TABLE",
106
+ "VIEW",
107
+ "STAGE",
108
+ "PIPE",
109
+ "TASK",
110
+ "STREAM",
111
+ "SHARE",
112
+ "WAREHOUSE",
113
+ "FUNCTION",
114
+ "PROCEDURE",
115
+ "FILE_FORMAT"
116
+ ]);
117
+ const snowflakeObjectLifecycleEventSchema = z.object({
118
+ kind: z.string(),
119
+ name: z.string(),
120
+ change: z.enum(["created", "dropped"]),
121
+ identity: z.string(),
122
+ owner: z.string().optional(),
123
+ createdOn: z.string().optional(),
124
+ detectedAt: z.string(),
125
+ row: snowflakeObjectRowSchema
126
+ }).catchall(z.unknown());
127
+ const shareChangedEventSchema = z.object({
128
+ name: z.string(),
129
+ kind: z.string().optional(),
130
+ change: z.enum([
131
+ "created",
132
+ "dropped",
133
+ "modified"
134
+ ]),
135
+ identity: z.string(),
136
+ detectedAt: z.string(),
137
+ previousRow: snowflakeObjectRowSchema.optional(),
138
+ currentRow: snowflakeObjectRowSchema.optional()
139
+ }).catchall(z.unknown());
140
+ const grantChangedEventSchema = z.object({
141
+ privilege: z.string(),
142
+ grantedOn: z.string(),
143
+ objectName: z.string(),
144
+ granteeName: z.string(),
145
+ granteeType: z.string().optional(),
146
+ change: z.enum(["granted", "revoked"]),
147
+ identity: z.string(),
148
+ detectedAt: z.string(),
149
+ row: snowflakeObjectRowSchema
150
+ }).catchall(z.unknown());
151
+ const warehouseCreditsEventSchema = z.object({
152
+ warehouseName: z.string(),
153
+ startTime: z.string().optional(),
154
+ endTime: z.string().optional(),
155
+ creditsUsed: z.number().nullable().optional(),
156
+ creditsUsedCompute: z.number().nullable().optional(),
157
+ creditsUsedCloudServices: z.number().nullable().optional(),
158
+ row: snowflakeObjectRowSchema
159
+ }).catchall(z.unknown());
160
+ const warehouseQueueEventSchema = z.object({
161
+ warehouseName: z.string(),
162
+ startTime: z.string().optional(),
163
+ endTime: z.string().optional(),
164
+ avgRunning: z.number().nullable().optional(),
165
+ avgQueuedLoad: z.number().nullable().optional(),
166
+ avgQueuedProvisioning: z.number().nullable().optional(),
167
+ avgBlocked: z.number().nullable().optional(),
168
+ row: snowflakeObjectRowSchema
169
+ }).catchall(z.unknown());
170
+ const statusPageIncidentEventSchema = z.object({
171
+ id: z.string(),
172
+ name: z.string(),
173
+ status: z.string(),
174
+ impact: z.string().optional(),
175
+ createdAt: z.string().optional(),
176
+ updatedAt: z.string().optional(),
177
+ resolvedAt: z.string().nullable().optional(),
178
+ shortlink: z.string().optional(),
179
+ detectedAt: z.string(),
180
+ raw: z.record(z.string(), z.unknown())
181
+ }).catchall(z.unknown());
182
+ const statusPageComponentChangeEventSchema = z.object({
183
+ id: z.string(),
184
+ name: z.string(),
185
+ previousStatus: z.string().nullable(),
186
+ currentStatus: z.string(),
187
+ description: z.string().optional(),
188
+ changedAt: z.string(),
189
+ detectedAt: z.string(),
190
+ raw: z.record(z.string(), z.unknown())
191
+ }).catchall(z.unknown());
192
+ const snowflakeDiffSnapshotEntrySchema = z.object({
193
+ identity: z.string(),
194
+ signature: z.string().optional()
195
+ }).catchall(z.unknown());
196
+ /**
197
+ * Canonical object-storage event shape emitted by the three auto-ingest
198
+ * webhook triggers. Each cloud's native payload is normalised to this
199
+ * shape; the raw envelope is preserved under `raw` for callers that
200
+ * need provider-specific fields (etag, metageneration, blob tier, ...).
201
+ */
202
+ const snowpipeObjectEventSchema = z.object({
203
+ provider: z.enum([
204
+ "aws-s3",
205
+ "gcp-gcs",
206
+ "azure-blob"
207
+ ]),
208
+ eventType: z.string(),
209
+ eventTime: z.string(),
210
+ bucket: z.string(),
211
+ key: z.string(),
212
+ size: z.number().int().nonnegative().nullable().optional(),
213
+ etag: z.string().nullable().optional(),
214
+ region: z.string().nullable().optional(),
215
+ sourceIp: z.string().nullable().optional(),
216
+ messageId: z.string().nullable().optional(),
217
+ receivedAt: z.string(),
218
+ raw: z.record(z.string(), z.unknown())
219
+ }).catchall(z.unknown());
220
+ /**
221
+ * Batch envelope used by auto-ingest webhook triggers — a single SNS
222
+ * notification, Pub/Sub push, or Event Grid batch can carry multiple
223
+ * object events, so the trigger emits `{ events, receivedAt, messageId }`.
224
+ */
225
+ const snowpipeObjectBatchSchema = z.object({
226
+ events: z.array(snowpipeObjectEventSchema),
227
+ provider: z.enum([
228
+ "aws-s3",
229
+ "gcp-gcs",
230
+ "azure-blob"
231
+ ]),
232
+ receivedAt: z.string(),
233
+ messageId: z.string().nullable().optional(),
234
+ topic: z.string().nullable().optional(),
235
+ raw: z.record(z.string(), z.unknown())
236
+ }).catchall(z.unknown());
237
+ /**
238
+ * Raw SNS "Notification" envelope. The outer webhook payload we accept
239
+ * from `autoIngestS3Sns` matches this shape — fields per the AWS SNS
240
+ * HTTP(S) delivery spec.
241
+ */
242
+ const snsNotificationSchema = z.object({
243
+ Type: z.enum([
244
+ "Notification",
245
+ "SubscriptionConfirmation",
246
+ "UnsubscribeConfirmation"
247
+ ]),
248
+ MessageId: z.string(),
249
+ TopicArn: z.string(),
250
+ Message: z.string(),
251
+ Timestamp: z.string(),
252
+ SignatureVersion: z.string(),
253
+ Signature: z.string(),
254
+ SigningCertURL: z.string(),
255
+ Subject: z.string().optional(),
256
+ Token: z.string().optional(),
257
+ SubscribeURL: z.string().optional(),
258
+ UnsubscribeURL: z.string().optional()
259
+ }).catchall(z.unknown());
260
+ /**
261
+ * GCP Pub/Sub push envelope. The push subscription wraps the Pub/Sub
262
+ * message in `{message, subscription}`; `message.data` is base64 and
263
+ * decodes to the GCS object-change notification.
264
+ */
265
+ const gcsPubSubPushSchema = z.object({
266
+ message: z.object({
267
+ messageId: z.string().optional(),
268
+ publishTime: z.string().optional(),
269
+ data: z.string().optional(),
270
+ attributes: z.record(z.string(), z.string()).optional()
271
+ }).catchall(z.unknown()),
272
+ subscription: z.string().optional()
273
+ }).catchall(z.unknown());
274
+ /**
275
+ * Azure Event Grid event (Event Grid schema v1.0). The wire format is
276
+ * always a JSON array; we schema-validate a single envelope and the
277
+ * trigger unwraps the array at the boundary.
278
+ */
279
+ const azureEventGridEventSchema = z.object({
280
+ id: z.string(),
281
+ eventType: z.string(),
282
+ subject: z.string(),
283
+ eventTime: z.string(),
284
+ dataVersion: z.string().optional(),
285
+ metadataVersion: z.string().optional(),
286
+ topic: z.string().optional(),
287
+ data: z.record(z.string(), z.unknown())
288
+ }).catchall(z.unknown());
289
+
290
+ //#endregion
291
+ export { azureEventGridEventSchema, gcsPubSubPushSchema, grantChangedEventSchema, pipeLoadEventSchema, scheduledDeltaEventSchema, scheduledSqlEventSchema, shareChangedEventSchema, snowflakeDiffSnapshotEntrySchema, snowflakeObjectKindSchema, snowflakeObjectLifecycleEventSchema, snowflakeRowBatchSchema, snowpipeObjectBatchSchema, snowpipeObjectEventSchema, snsNotificationSchema, statementCompletedEventSchema, statusPageComponentChangeEventSchema, statusPageIncidentEventSchema, streamAppendOnlyEventSchema, streamHasDataEventSchema, taskRunEventSchema, warehouseCreditsEventSchema, warehouseQueueEventSchema };