@keystrokehq/snowflake 0.0.7 → 0.0.9
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/dist/_official/index.d.mts +1 -1
- package/dist/_official/index.mjs +1 -1
- package/dist/client.d.mts +1 -1
- package/dist/client.mjs +1 -1
- package/dist/connection.d.mts +1 -1
- package/dist/connection.mjs +1 -1
- package/dist/{integration-CQNVr6NY.d.mts → integration-86b6WaJF.d.mts} +4 -4
- package/dist/{integration-BVS1DWxb.mjs → integration-DNMbfXEy.mjs} +46 -2
- package/dist/triggers.d.mts +6 -4
- package/dist/triggers.mjs +53 -4
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as snowflakeOfficialIntegration, i as snowflake, s as snowflakeBundle } from "../integration-
|
|
1
|
+
import { c as snowflakeOfficialIntegration, i as snowflake, s as snowflakeBundle } from "../integration-86b6WaJF.mjs";
|
|
2
2
|
export { snowflake, snowflakeBundle, snowflakeOfficialIntegration };
|
package/dist/_official/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as snowflakeBundle, n as snowflake, o as snowflakeOfficialIntegration } from "../integration-
|
|
1
|
+
import { a as snowflakeBundle, n as snowflake, o as snowflakeOfficialIntegration } from "../integration-DNMbfXEy.mjs";
|
|
2
2
|
|
|
3
3
|
export { snowflake, snowflakeBundle, snowflakeOfficialIntegration };
|
package/dist/client.d.mts
CHANGED
package/dist/client.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as parseSnowflakeCredentials } from "./integration-
|
|
1
|
+
import { t as parseSnowflakeCredentials } from "./integration-DNMbfXEy.mjs";
|
|
2
2
|
import { a as extractSnowflakeMessage, c as parseRetryAfterHeader, i as extractSnowflakeCode, n as SnowflakeSqlError, o as extractSnowflakeSqlState, r as classifySnowflakeHttpStatus, s as extractSnowflakeStatementHandle, t as SnowflakeApiError } from "./errors-DKnc9o_a.mjs";
|
|
3
3
|
import { a as createSnowflakeJwt, i as shouldRetry, n as computeBackoffMs, r as defaultSleep, t as DEFAULT_RETRY_POLICY } from "./retry-0hMfb8cC.mjs";
|
|
4
4
|
|
package/dist/connection.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as snowflakeAuthModeSchema, c as snowflakeOfficialIntegration, i as snowflake, n as SnowflakeCredentials, o as snowflakeAuthSchema, r as parseSnowflakeCredentials, s as snowflakeBundle, t as SnowflakeAuthMode } from "./integration-
|
|
1
|
+
import { a as snowflakeAuthModeSchema, c as snowflakeOfficialIntegration, i as snowflake, n as SnowflakeCredentials, o as snowflakeAuthSchema, r as parseSnowflakeCredentials, s as snowflakeBundle, t as SnowflakeAuthMode } from "./integration-86b6WaJF.mjs";
|
|
2
2
|
export { type SnowflakeAuthMode, type SnowflakeCredentials, parseSnowflakeCredentials, snowflake, snowflakeAuthModeSchema, snowflakeAuthSchema, snowflakeBundle, snowflakeOfficialIntegration };
|
package/dist/connection.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as snowflakeBundle, i as snowflakeAuthSchema, n as snowflake, o as snowflakeOfficialIntegration, r as snowflakeAuthModeSchema, t as parseSnowflakeCredentials } from "./integration-
|
|
1
|
+
import { a as snowflakeBundle, i as snowflakeAuthSchema, n as snowflake, o as snowflakeOfficialIntegration, r as snowflakeAuthModeSchema, t as parseSnowflakeCredentials } from "./integration-DNMbfXEy.mjs";
|
|
2
2
|
|
|
3
3
|
export { parseSnowflakeCredentials, snowflake, snowflakeAuthModeSchema, snowflakeAuthSchema, snowflakeBundle, snowflakeOfficialIntegration };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as _keystrokehq_integration_authoring_official0 from "@keystrokehq/integration-authoring/official";
|
|
2
|
-
import { z } from "zod";
|
|
3
1
|
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
2
|
+
import { CredentialSet } from "@keystrokehq/core";
|
|
3
|
+
import { z } from "zod";
|
|
4
4
|
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
5
5
|
import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
|
|
6
6
|
|
|
@@ -79,7 +79,7 @@ declare const snowflakeOfficialIntegration: {
|
|
|
79
79
|
SNOWFLAKE_PUBLIC_KEY_FP: z.ZodOptional<z.ZodString>;
|
|
80
80
|
}, z.core.$strip>;
|
|
81
81
|
};
|
|
82
|
-
declare const snowflakeBundle:
|
|
82
|
+
declare const snowflakeBundle: undefined<"snowflake", z.ZodObject<{
|
|
83
83
|
mode: z.ZodEnum<{
|
|
84
84
|
keypair: "keypair";
|
|
85
85
|
oauth: "oauth";
|
|
@@ -106,7 +106,7 @@ declare const snowflakeBundle: _keystrokehq_integration_authoring_official0.Offi
|
|
|
106
106
|
SNOWFLAKE_REGION: z.ZodOptional<z.ZodString>;
|
|
107
107
|
SNOWFLAKE_PUBLIC_KEY_FP: z.ZodOptional<z.ZodString>;
|
|
108
108
|
}, z.core.$strip>>;
|
|
109
|
-
declare const snowflake: _keystrokehq_core0.CredentialSet<"
|
|
109
|
+
declare const snowflake: _keystrokehq_core0.CredentialSet<"snowflake", z.ZodObject<{
|
|
110
110
|
mode: z.ZodEnum<{
|
|
111
111
|
keypair: "keypair";
|
|
112
112
|
oauth: "oauth";
|
|
@@ -1,7 +1,51 @@
|
|
|
1
|
-
import { defineOfficialIntegration, officialCredentialSetId } from "@keystrokehq/integration-authoring/official";
|
|
2
|
-
import { z } from "zod";
|
|
3
1
|
import { CredentialSet } from "@keystrokehq/core";
|
|
2
|
+
import { z } from "zod";
|
|
4
3
|
|
|
4
|
+
//#region ../../packages/integration-authoring/dist/official/index.mjs
|
|
5
|
+
const OFFICIAL_CREDENTIAL_SET_ID_PREFIX = "keystroke:";
|
|
6
|
+
function officialCredentialSetId(id) {
|
|
7
|
+
return `${OFFICIAL_CREDENTIAL_SET_ID_PREFIX}${id}`;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates an official integration bundle from a single config object.
|
|
11
|
+
*
|
|
12
|
+
* - Creates the public `CredentialSet` internally.
|
|
13
|
+
* - Accepts optional `internal` fields for Keystroke-owned platform credentials.
|
|
14
|
+
*/
|
|
15
|
+
function defineOfficialIntegration(config) {
|
|
16
|
+
const internalCredentialSets = config.internal ?? {};
|
|
17
|
+
const allInternalCredentialSets = [
|
|
18
|
+
...internalCredentialSets.providerApp ? [internalCredentialSets.providerApp] : [],
|
|
19
|
+
...internalCredentialSets.providerAppVariants ?? [],
|
|
20
|
+
...internalCredentialSets.webhookVerification ? [internalCredentialSets.webhookVerification] : [],
|
|
21
|
+
...internalCredentialSets.other ?? []
|
|
22
|
+
];
|
|
23
|
+
const credentialSet = new CredentialSet({
|
|
24
|
+
id: config.id,
|
|
25
|
+
name: config.name,
|
|
26
|
+
description: config.description,
|
|
27
|
+
auth: config.auth,
|
|
28
|
+
...config.connections ? { connections: config.connections } : {},
|
|
29
|
+
...config.proxy ? { proxy: config.proxy } : {},
|
|
30
|
+
...config.needsRawSecret === true ? { needsRawSecret: true } : {}
|
|
31
|
+
});
|
|
32
|
+
return Object.freeze({
|
|
33
|
+
integration: {
|
|
34
|
+
id: config.id,
|
|
35
|
+
name: config.name,
|
|
36
|
+
...config.description !== void 0 ? { description: config.description } : {},
|
|
37
|
+
auth: config.auth,
|
|
38
|
+
...config.proxy ? { proxy: config.proxy } : {},
|
|
39
|
+
...config.needsRawSecret === true ? { needsRawSecret: true } : {},
|
|
40
|
+
...config.connections ? { connections: config.connections } : {}
|
|
41
|
+
},
|
|
42
|
+
credentialSet,
|
|
43
|
+
internalCredentialSets,
|
|
44
|
+
allInternalCredentialSets
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
5
49
|
//#region src/webhook-credentials.ts
|
|
6
50
|
/**
|
|
7
51
|
* Webhook credential sets for the Snowflake auto-ingest triggers.
|
package/dist/triggers.d.mts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { i as snowflake } from "./integration-
|
|
1
|
+
import { i as snowflake } from "./integration-86b6WaJF.mjs";
|
|
2
2
|
import { scheduledDeltaEventSchema, scheduledSqlEventSchema, streamAppendOnlyEventSchema, streamHasDataEventSchema } from "./events.mjs";
|
|
3
3
|
import { RowValue } from "./rows.mjs";
|
|
4
4
|
import { StatusPageOptions } from "./status-page.mjs";
|
|
5
|
-
import { z } from "zod";
|
|
6
5
|
import { BoundTrigger } from "@keystrokehq/core";
|
|
7
|
-
import {
|
|
6
|
+
import { z } from "zod";
|
|
8
7
|
import { PollingTriggerManifest } from "@keystrokehq/core/trigger";
|
|
9
8
|
|
|
9
|
+
//#region ../../packages/integration-authoring/dist/index.d.mts
|
|
10
|
+
declare function createPollingTriggerBindingFactory(config: any): (options: any) => any;
|
|
11
|
+
//#endregion
|
|
10
12
|
//#region src/triggers.d.ts
|
|
11
13
|
type Schedule = Parameters<typeof createPollingTriggerBindingFactory>[0]['schedule'];
|
|
12
14
|
type SnowflakeCredentialSets = readonly [typeof snowflake];
|
|
@@ -347,7 +349,7 @@ declare const statusPageComponentChangeBatchSchema: z.ZodObject<{
|
|
|
347
349
|
* Status-page pollers don't need Snowflake credentials, but they still
|
|
348
350
|
* flow through the Snowflake binding factory so they show up in the
|
|
349
351
|
* polling manifest alongside the rest. Credentials are declared but
|
|
350
|
-
* unused — the poll callback ignores `ctx.credentials['
|
|
352
|
+
* unused — the poll callback ignores `ctx.credentials['snowflake']`.
|
|
351
353
|
*/
|
|
352
354
|
declare function statusPageIncident<TOutput = z.output<typeof statusPageIncidentBatchSchema>>(input?: StatusPagePollingParams & SnowflakePollingBindingOptions<typeof statusPageIncidentBatchSchema, TOutput>): SnowflakePollingBoundTrigger<typeof statusPageIncidentBatchSchema, TOutput>;
|
|
353
355
|
declare function statusPageComponentChanged<TOutput = z.output<typeof statusPageComponentChangeBatchSchema>>(input?: StatusPagePollingParams & SnowflakePollingBindingOptions<typeof statusPageComponentChangeBatchSchema, TOutput>): SnowflakePollingBoundTrigger<typeof statusPageComponentChangeBatchSchema, TOutput>;
|
package/dist/triggers.mjs
CHANGED
|
@@ -1,13 +1,62 @@
|
|
|
1
|
-
import { n as snowflake } from "./integration-
|
|
1
|
+
import { n as snowflake } from "./integration-DNMbfXEy.mjs";
|
|
2
2
|
import { createSnowflakeClient } from "./client.mjs";
|
|
3
3
|
import { grantChangedEventSchema, pipeLoadEventSchema, scheduledDeltaEventSchema, scheduledSqlEventSchema, shareChangedEventSchema, snowflakeDiffSnapshotEntrySchema, snowflakeObjectLifecycleEventSchema, statementCompletedEventSchema, statusPageComponentChangeEventSchema, statusPageIncidentEventSchema, streamAppendOnlyEventSchema, streamHasDataEventSchema, taskRunEventSchema, warehouseCreditsEventSchema, warehouseQueueEventSchema } from "./events.mjs";
|
|
4
4
|
import { executeSql } from "./sql.mjs";
|
|
5
5
|
import { a as quoteLiteral, i as quoteIdentifier, t as buildFqn } from "./sql-safety-CywdR3EP.mjs";
|
|
6
6
|
import { BindingBuilder } from "./rows.mjs";
|
|
7
7
|
import { getStatusSummary, getUnresolvedIncidents } from "./status-page.mjs";
|
|
8
|
+
import "@keystrokehq/core";
|
|
8
9
|
import { z } from "zod";
|
|
9
|
-
import {
|
|
10
|
+
import { pollingTrigger } from "@keystrokehq/core/trigger";
|
|
10
11
|
|
|
12
|
+
//#region ../../packages/integration-authoring/dist/index.mjs
|
|
13
|
+
const IntegrationConfigSchema = z.object({
|
|
14
|
+
id: z.string().min(1),
|
|
15
|
+
name: z.string().min(1),
|
|
16
|
+
description: z.string().optional()
|
|
17
|
+
});
|
|
18
|
+
function resolveMetadata(metadata, defaults) {
|
|
19
|
+
return {
|
|
20
|
+
id: metadata?.id ?? defaults.defaultId,
|
|
21
|
+
description: metadata?.description ?? defaults.defaultDescription
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function resolveAuthorPayload(payload, mapPayload) {
|
|
25
|
+
if (!mapPayload) return payload;
|
|
26
|
+
return mapPayload(payload);
|
|
27
|
+
}
|
|
28
|
+
function createIntegrationTriggerBindingFactory(config) {
|
|
29
|
+
const bind = (options) => {
|
|
30
|
+
const resolvedMetadata = resolveMetadata(options, config);
|
|
31
|
+
const baseTrigger = config.createBaseTrigger(resolvedMetadata);
|
|
32
|
+
const userTransform = options?.transform;
|
|
33
|
+
return baseTrigger({ transform: userTransform || config.mapPayload ? (runtimePayload, request) => {
|
|
34
|
+
const authorPayload = resolveAuthorPayload(runtimePayload, config.mapPayload);
|
|
35
|
+
if (authorPayload === null) throw new Error(`Trigger "${resolvedMetadata.id}" mapPayload returned null after the trigger filter passed; tighten the trigger filter schema.`);
|
|
36
|
+
if (!userTransform) return authorPayload;
|
|
37
|
+
return userTransform(authorPayload, request);
|
|
38
|
+
} : void 0 });
|
|
39
|
+
};
|
|
40
|
+
return Object.freeze(bind);
|
|
41
|
+
}
|
|
42
|
+
function createPollingTriggerBindingFactory(config) {
|
|
43
|
+
return createIntegrationTriggerBindingFactory({
|
|
44
|
+
defaultId: config.defaultId,
|
|
45
|
+
defaultDescription: config.defaultDescription,
|
|
46
|
+
mapPayload: config.mapPayload,
|
|
47
|
+
createBaseTrigger: (metadata) => pollingTrigger({
|
|
48
|
+
id: metadata.id,
|
|
49
|
+
description: metadata.description,
|
|
50
|
+
schedule: config.schedule,
|
|
51
|
+
response: config.response,
|
|
52
|
+
poll: config.poll,
|
|
53
|
+
...config.credentialSets ? { credentialSets: config.credentialSets } : {},
|
|
54
|
+
...config.filter ? { filter: config.filter } : {}
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
11
60
|
//#region src/triggers.ts
|
|
12
61
|
function defineSnowflakePollingTrigger(definition) {
|
|
13
62
|
return definition;
|
|
@@ -35,7 +84,7 @@ function createSnowflakePollingBindingFactory(definition, params, schedule) {
|
|
|
35
84
|
response: definition.responseSchema,
|
|
36
85
|
poll: (ctx) => {
|
|
37
86
|
const snowflakeCtx = ctx;
|
|
38
|
-
return definition.poll(params, snowflakeCtx.credentials["
|
|
87
|
+
return definition.poll(params, snowflakeCtx.credentials["snowflake"], snowflakeCtx);
|
|
39
88
|
}
|
|
40
89
|
});
|
|
41
90
|
}
|
|
@@ -1015,7 +1064,7 @@ const statusPageComponentChangeDefinition = {
|
|
|
1015
1064
|
* Status-page pollers don't need Snowflake credentials, but they still
|
|
1016
1065
|
* flow through the Snowflake binding factory so they show up in the
|
|
1017
1066
|
* polling manifest alongside the rest. Credentials are declared but
|
|
1018
|
-
* unused — the poll callback ignores `ctx.credentials['
|
|
1067
|
+
* unused — the poll callback ignores `ctx.credentials['snowflake']`.
|
|
1019
1068
|
*/
|
|
1020
1069
|
function statusPageIncident(input) {
|
|
1021
1070
|
return bindSnowflakePollingTrigger(statusPageIncidentDefinition, input ?? {}, input);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keystrokehq/snowflake",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -148,7 +148,6 @@
|
|
|
148
148
|
"LICENSE"
|
|
149
149
|
],
|
|
150
150
|
"dependencies": {
|
|
151
|
-
"@keystrokehq/integration-authoring": "^0.0.7",
|
|
152
151
|
"zod": "^4.3.6"
|
|
153
152
|
},
|
|
154
153
|
"peerDependencies": {
|
|
@@ -159,9 +158,10 @@
|
|
|
159
158
|
"tsdown": "^0.20.3",
|
|
160
159
|
"typescript": "^5.9.3",
|
|
161
160
|
"vitest": "^4.0.18",
|
|
162
|
-
"@keystrokehq/core": "^0.0.
|
|
161
|
+
"@keystrokehq/core": "^0.0.12",
|
|
163
162
|
"@keystrokehq/test-utils": "0.0.0",
|
|
164
|
-
"@keystrokehq/typescript-config": "0.0.0"
|
|
163
|
+
"@keystrokehq/typescript-config": "0.0.0",
|
|
164
|
+
"@keystrokehq/integration-authoring": "0.0.9"
|
|
165
165
|
},
|
|
166
166
|
"keywords": [
|
|
167
167
|
"snowflake",
|