@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
@@ -1,56 +0,0 @@
1
- import { SnowflakeClient } from "../client/index.mjs";
2
- import { d as HydratedRow } from "../statements-DJL0qVNA.mjs";
3
- import { CatalogResult, ShowOptions, showShares } from "../catalog/index.mjs";
4
-
5
- //#region src/shares/index.d.ts
6
- interface ShareContext {
7
- readonly warehouse?: string;
8
- readonly role?: string;
9
- }
10
- interface CreateShareOptions extends ShareContext {
11
- readonly name: string;
12
- readonly orReplace?: boolean;
13
- readonly ifNotExists?: boolean;
14
- readonly comment?: string;
15
- }
16
- declare function createShare(client: SnowflakeClient, options: CreateShareOptions): Promise<void>;
17
- interface AlterShareOptions extends ShareContext {
18
- readonly name: string;
19
- readonly ifExists?: boolean;
20
- /** Replace the full account list via `SET ACCOUNTS = (...)`. */
21
- readonly setAccounts?: readonly string[];
22
- /** `ADD ACCOUNTS = (...)`. */
23
- readonly addAccounts?: readonly string[];
24
- /** `REMOVE ACCOUNTS = (...)`. */
25
- readonly removeAccounts?: readonly string[];
26
- /** `SET COMMENT = '...'`. */
27
- readonly comment?: string;
28
- /** `UNSET COMMENT`. */
29
- readonly unsetComment?: boolean;
30
- }
31
- declare function alterShare(client: SnowflakeClient, options: AlterShareOptions): Promise<void>;
32
- interface DropShareOptions extends ShareContext {
33
- readonly name: string;
34
- readonly ifExists?: boolean;
35
- }
36
- declare function dropShare(client: SnowflakeClient, options: DropShareOptions): Promise<void>;
37
- interface DescribeShareOptions extends ShareContext {
38
- readonly name: string;
39
- }
40
- declare function describeShare(client: SnowflakeClient, options: DescribeShareOptions): Promise<readonly HydratedRow[]>;
41
- interface AddAccountsToShareOptions extends ShareContext {
42
- readonly name: string;
43
- readonly accounts: readonly string[];
44
- readonly ifExists?: boolean;
45
- /** Optional `SHARE_RESTRICTIONS = TRUE|FALSE` appended to ADD ACCOUNTS. */
46
- readonly shareRestrictions?: boolean;
47
- }
48
- declare function addAccountsToShare(client: SnowflakeClient, options: AddAccountsToShareOptions): Promise<void>;
49
- interface RemoveAccountsFromShareOptions extends ShareContext {
50
- readonly name: string;
51
- readonly accounts: readonly string[];
52
- readonly ifExists?: boolean;
53
- }
54
- declare function removeAccountsFromShare(client: SnowflakeClient, options: RemoveAccountsFromShareOptions): Promise<void>;
55
- //#endregion
56
- export { AddAccountsToShareOptions, AlterShareOptions, type CatalogResult, CreateShareOptions, DescribeShareOptions, DropShareOptions, RemoveAccountsFromShareOptions, ShareContext, type ShowOptions, addAccountsToShare, alterShare, createShare, describeShare, dropShare, removeAccountsFromShare, showShares };
@@ -1,77 +0,0 @@
1
- import { executeSql } from "../sql/index.mjs";
2
- import { a as quoteLiteral, i as quoteIdentifier } from "../sql-safety-BZpAPsq6.mjs";
3
- import { showShares } from "../catalog/index.mjs";
4
-
5
- //#region src/shares/index.ts
6
- async function createShare(client, options) {
7
- const prefix = `CREATE${options.orReplace ? " OR REPLACE" : ""} SHARE${options.ifNotExists ? " IF NOT EXISTS" : ""}`;
8
- const comment = options.comment ? ` COMMENT = ${quoteLiteral(options.comment)}` : "";
9
- await executeSql(client, {
10
- statement: `${prefix} ${quoteIdentifier(options.name)}${comment}`,
11
- warehouse: options.warehouse,
12
- role: options.role
13
- });
14
- }
15
- /**
16
- * Snowflake account identifiers for shares take the form
17
- * `<orgName>.<accountName>` (unquoted). We validate the shape lightly
18
- * and pass it through without quoting because Snowflake treats quoted
19
- * identifiers here as case-sensitive names which would not match the
20
- * real account.
21
- */
22
- const ACCOUNT_ID_RE = /^[A-Za-z0-9_]+\.[A-Za-z0-9_]+$/u;
23
- function renderAccountList(accounts) {
24
- if (accounts.length === 0) throw new Error("accounts must be a non-empty list");
25
- for (const a of accounts) if (!ACCOUNT_ID_RE.test(a)) throw new Error(`Invalid account identifier "${a}" — expected "<orgName>.<accountName>" (letters, digits, underscore)`);
26
- return accounts.join(", ");
27
- }
28
- async function alterShare(client, options) {
29
- let tail;
30
- if (options.addAccounts) tail = `ADD ACCOUNTS = (${renderAccountList(options.addAccounts)})`;
31
- else if (options.removeAccounts) tail = `REMOVE ACCOUNTS = (${renderAccountList(options.removeAccounts)})`;
32
- else if (options.setAccounts) tail = `SET ACCOUNTS = (${renderAccountList(options.setAccounts)})`;
33
- else if (options.comment !== void 0) tail = `SET COMMENT = ${quoteLiteral(options.comment)}`;
34
- else if (options.unsetComment) tail = "UNSET COMMENT";
35
- else throw new Error("alterShare requires one of: setAccounts / addAccounts / removeAccounts / comment / unsetComment");
36
- await executeSql(client, {
37
- statement: `ALTER SHARE${options.ifExists ? " IF EXISTS" : ""} ${quoteIdentifier(options.name)} ${tail}`,
38
- warehouse: options.warehouse,
39
- role: options.role
40
- });
41
- }
42
- async function dropShare(client, options) {
43
- await executeSql(client, {
44
- statement: `DROP SHARE${options.ifExists ? " IF EXISTS" : ""} ${quoteIdentifier(options.name)}`,
45
- warehouse: options.warehouse,
46
- role: options.role
47
- });
48
- }
49
- async function describeShare(client, options) {
50
- return (await executeSql(client, {
51
- statement: `DESCRIBE SHARE ${quoteIdentifier(options.name)}`,
52
- warehouse: options.warehouse,
53
- role: options.role
54
- })).rows;
55
- }
56
- async function addAccountsToShare(client, options) {
57
- const ifExists = options.ifExists ? " IF EXISTS" : "";
58
- const accounts = renderAccountList(options.accounts);
59
- const restrictions = options.shareRestrictions !== void 0 ? ` SHARE_RESTRICTIONS = ${options.shareRestrictions ? "TRUE" : "FALSE"}` : "";
60
- await executeSql(client, {
61
- statement: `ALTER SHARE${ifExists} ${quoteIdentifier(options.name)} ADD ACCOUNTS = (${accounts})${restrictions}`,
62
- warehouse: options.warehouse,
63
- role: options.role
64
- });
65
- }
66
- async function removeAccountsFromShare(client, options) {
67
- const ifExists = options.ifExists ? " IF EXISTS" : "";
68
- const accounts = renderAccountList(options.accounts);
69
- await executeSql(client, {
70
- statement: `ALTER SHARE${ifExists} ${quoteIdentifier(options.name)} REMOVE ACCOUNTS = (${accounts})`,
71
- warehouse: options.warehouse,
72
- role: options.role
73
- });
74
- }
75
-
76
- //#endregion
77
- export { addAccountsToShare, alterShare, createShare, describeShare, dropShare, removeAccountsFromShare, showShares };
@@ -1,50 +0,0 @@
1
- import { CredentialSet } from "@keystrokehq/core";
2
- import { z } from "zod";
3
- import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
- import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
5
-
6
- //#region src/credential-sets/snowflake-azure-eventgrid-webhook.credential-set.d.ts
7
- declare const snowflakeAzureEventGridWebhookCredentialSet: CredentialSet<"snowflake-azure-eventgrid-webhook", z.ZodObject<{
8
- sharedSecret: z.ZodOptional<z.ZodString>;
9
- sharedSecretHeader: z.ZodOptional<z.ZodDefault<z.ZodString>>;
10
- expectedTopicArn: z.ZodOptional<z.ZodString>;
11
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
12
- sharedSecret: z.ZodOptional<z.ZodString>;
13
- sharedSecretHeader: z.ZodOptional<z.ZodDefault<z.ZodString>>;
14
- expectedTopicArn: z.ZodOptional<z.ZodString>;
15
- }, z.core.$strip>>[] | undefined>;
16
- type SnowflakeAzureEventGridWebhookCredentials = InferCredentialSetAuth<typeof snowflakeAzureEventGridWebhookCredentialSet>;
17
- //#endregion
18
- //#region src/credential-sets/snowflake-gcs-pubsub-webhook.credential-set.d.ts
19
- declare const snowflakeGcsPubSubWebhookCredentialSet: CredentialSet<"snowflake-gcs-pubsub-webhook", z.ZodObject<{
20
- expectedAudience: z.ZodString;
21
- expectedServiceAccount: z.ZodString;
22
- jwksUri: z.ZodOptional<z.ZodDefault<z.ZodString>>;
23
- issuer: z.ZodOptional<z.ZodDefault<z.ZodString>>;
24
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
25
- expectedAudience: z.ZodString;
26
- expectedServiceAccount: z.ZodString;
27
- jwksUri: z.ZodOptional<z.ZodDefault<z.ZodString>>;
28
- issuer: z.ZodOptional<z.ZodDefault<z.ZodString>>;
29
- }, z.core.$strip>>[] | undefined>;
30
- type SnowflakeGcsPubSubWebhookCredentials = InferCredentialSetAuth<typeof snowflakeGcsPubSubWebhookCredentialSet>;
31
- //#endregion
32
- //#region src/credential-sets/snowflake-s3-sns-webhook.credential-set.d.ts
33
- declare const snowflakeS3SnsWebhookCredentialSet: CredentialSet<"snowflake-s3-sns-webhook", z.ZodObject<{
34
- expectedTopicArn: z.ZodOptional<z.ZodString>;
35
- allowedSigningCertHostPattern: z.ZodOptional<z.ZodDefault<z.ZodString>>;
36
- autoConfirmSubscriptions: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
37
- true: "true";
38
- false: "false";
39
- }>>>;
40
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
41
- expectedTopicArn: z.ZodOptional<z.ZodString>;
42
- allowedSigningCertHostPattern: z.ZodOptional<z.ZodDefault<z.ZodString>>;
43
- autoConfirmSubscriptions: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
44
- true: "true";
45
- false: "false";
46
- }>>>;
47
- }, z.core.$strip>>[] | undefined>;
48
- type SnowflakeS3SnsWebhookCredentials = InferCredentialSetAuth<typeof snowflakeS3SnsWebhookCredentialSet>;
49
- //#endregion
50
- export { SnowflakeAzureEventGridWebhookCredentials as a, snowflakeGcsPubSubWebhookCredentialSet as i, snowflakeS3SnsWebhookCredentialSet as n, snowflakeAzureEventGridWebhookCredentialSet as o, SnowflakeGcsPubSubWebhookCredentials as r, SnowflakeS3SnsWebhookCredentials as t };
@@ -1,44 +0,0 @@
1
- import { CredentialSet } from "@keystrokehq/core";
2
- import { z } from "zod";
3
-
4
- //#region src/credential-sets/snowflake-azure-eventgrid-webhook.credential-set.ts
5
- const snowflakeAzureEventGridWebhookCredentialSet = new CredentialSet({
6
- id: "snowflake-azure-eventgrid-webhook",
7
- exposure: "platform-only",
8
- name: "Snowflake Auto-Ingest — Azure Event Grid",
9
- auth: z.object({
10
- sharedSecret: z.string().optional(),
11
- sharedSecretHeader: z.string().default("aeg-subscription-secret").optional(),
12
- expectedTopicArn: z.string().optional()
13
- })
14
- });
15
-
16
- //#endregion
17
- //#region src/credential-sets/snowflake-gcs-pubsub-webhook.credential-set.ts
18
- const snowflakeGcsPubSubWebhookCredentialSet = new CredentialSet({
19
- id: "snowflake-gcs-pubsub-webhook",
20
- exposure: "platform-only",
21
- name: "Snowflake Auto-Ingest — GCS Pub/Sub",
22
- auth: z.object({
23
- expectedAudience: z.string().min(1),
24
- expectedServiceAccount: z.string().min(1),
25
- jwksUri: z.string().default("https://www.googleapis.com/oauth2/v3/certs").optional(),
26
- issuer: z.string().default("https://accounts.google.com").optional()
27
- })
28
- });
29
-
30
- //#endregion
31
- //#region src/credential-sets/snowflake-s3-sns-webhook.credential-set.ts
32
- const snowflakeS3SnsWebhookCredentialSet = new CredentialSet({
33
- id: "snowflake-s3-sns-webhook",
34
- exposure: "platform-only",
35
- name: "Snowflake Auto-Ingest — AWS SNS",
36
- auth: z.object({
37
- expectedTopicArn: z.string().optional(),
38
- allowedSigningCertHostPattern: z.string().default("^sns\\.[a-z0-9-]+\\.amazonaws\\.com(\\.cn)?$").optional(),
39
- autoConfirmSubscriptions: z.enum(["true", "false"]).default("false").optional()
40
- })
41
- });
42
-
43
- //#endregion
44
- export { snowflakeGcsPubSubWebhookCredentialSet as n, snowflakeAzureEventGridWebhookCredentialSet as r, snowflakeS3SnsWebhookCredentialSet as t };
@@ -1,114 +0,0 @@
1
- import { CredentialSet } from "@keystrokehq/core";
2
- import { z } from "zod";
3
- import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
4
-
5
- //#region src/credential-sets/snowflake.credential-set.d.ts
6
- /**
7
- * Public auth schema for Snowflake connections.
8
- *
9
- * Modeled as a discriminated union on `mode`. `connection.kind` is `manual`
10
- * because Keystroke does not run an interactive Snowflake OAuth dance — OAuth
11
- * mode accepts a bearer token provided by the caller (external IdP /
12
- * Snowflake-hosted OAuth).
13
- */
14
- declare const snowflakeAuthModeSchema: z.ZodEnum<{
15
- keypair: "keypair";
16
- oauth: "oauth";
17
- pat: "pat";
18
- basic: "basic";
19
- }>;
20
- type SnowflakeAuthMode = z.infer<typeof snowflakeAuthModeSchema>;
21
- declare const snowflakeAuthSchema: z.ZodObject<{
22
- mode: z.ZodEnum<{
23
- keypair: "keypair";
24
- oauth: "oauth";
25
- pat: "pat";
26
- basic: "basic";
27
- }>;
28
- SNOWFLAKE_ACCOUNT: z.ZodString;
29
- SNOWFLAKE_USER: z.ZodOptional<z.ZodString>;
30
- SNOWFLAKE_PRIVATE_KEY: z.ZodOptional<z.ZodString>;
31
- SNOWFLAKE_PRIVATE_KEY_PASSPHRASE: z.ZodOptional<z.ZodString>;
32
- SNOWFLAKE_PAT: z.ZodOptional<z.ZodString>;
33
- SNOWFLAKE_PASSWORD: z.ZodOptional<z.ZodString>;
34
- SNOWFLAKE_OAUTH_ACCESS_TOKEN: z.ZodOptional<z.ZodString>;
35
- SNOWFLAKE_OAUTH_REFRESH_TOKEN: z.ZodOptional<z.ZodString>;
36
- SNOWFLAKE_OAUTH_CLIENT_ID: z.ZodOptional<z.ZodString>;
37
- SNOWFLAKE_OAUTH_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
38
- SNOWFLAKE_OAUTH_TOKEN_URL: z.ZodOptional<z.ZodString>;
39
- SNOWFLAKE_OAUTH_SCOPES: z.ZodOptional<z.ZodString>;
40
- SNOWFLAKE_ROLE: z.ZodOptional<z.ZodString>;
41
- SNOWFLAKE_WAREHOUSE: z.ZodOptional<z.ZodString>;
42
- SNOWFLAKE_DATABASE: z.ZodOptional<z.ZodString>;
43
- SNOWFLAKE_SCHEMA: z.ZodOptional<z.ZodString>;
44
- SNOWFLAKE_HOST: z.ZodOptional<z.ZodString>;
45
- SNOWFLAKE_REGION: z.ZodOptional<z.ZodString>;
46
- SNOWFLAKE_PUBLIC_KEY_FP: z.ZodOptional<z.ZodString>;
47
- }, z.core.$strip>;
48
- declare const snowflakeCredentialSet: CredentialSet<"snowflake", z.ZodObject<{
49
- mode: z.ZodEnum<{
50
- keypair: "keypair";
51
- oauth: "oauth";
52
- pat: "pat";
53
- basic: "basic";
54
- }>;
55
- SNOWFLAKE_ACCOUNT: z.ZodString;
56
- SNOWFLAKE_USER: z.ZodOptional<z.ZodString>;
57
- SNOWFLAKE_PRIVATE_KEY: z.ZodOptional<z.ZodString>;
58
- SNOWFLAKE_PRIVATE_KEY_PASSPHRASE: z.ZodOptional<z.ZodString>;
59
- SNOWFLAKE_PAT: z.ZodOptional<z.ZodString>;
60
- SNOWFLAKE_PASSWORD: z.ZodOptional<z.ZodString>;
61
- SNOWFLAKE_OAUTH_ACCESS_TOKEN: z.ZodOptional<z.ZodString>;
62
- SNOWFLAKE_OAUTH_REFRESH_TOKEN: z.ZodOptional<z.ZodString>;
63
- SNOWFLAKE_OAUTH_CLIENT_ID: z.ZodOptional<z.ZodString>;
64
- SNOWFLAKE_OAUTH_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
65
- SNOWFLAKE_OAUTH_TOKEN_URL: z.ZodOptional<z.ZodString>;
66
- SNOWFLAKE_OAUTH_SCOPES: z.ZodOptional<z.ZodString>;
67
- SNOWFLAKE_ROLE: z.ZodOptional<z.ZodString>;
68
- SNOWFLAKE_WAREHOUSE: z.ZodOptional<z.ZodString>;
69
- SNOWFLAKE_DATABASE: z.ZodOptional<z.ZodString>;
70
- SNOWFLAKE_SCHEMA: z.ZodOptional<z.ZodString>;
71
- SNOWFLAKE_HOST: z.ZodOptional<z.ZodString>;
72
- SNOWFLAKE_REGION: z.ZodOptional<z.ZodString>;
73
- SNOWFLAKE_PUBLIC_KEY_FP: z.ZodOptional<z.ZodString>;
74
- }, z.core.$strip>, {
75
- id: string;
76
- kind: "manual";
77
- label: string;
78
- input: z.ZodObject<{
79
- mode: z.ZodEnum<{
80
- keypair: "keypair";
81
- oauth: "oauth";
82
- pat: "pat";
83
- basic: "basic";
84
- }>;
85
- SNOWFLAKE_ACCOUNT: z.ZodString;
86
- SNOWFLAKE_USER: z.ZodOptional<z.ZodString>;
87
- SNOWFLAKE_PRIVATE_KEY: z.ZodOptional<z.ZodString>;
88
- SNOWFLAKE_PRIVATE_KEY_PASSPHRASE: z.ZodOptional<z.ZodString>;
89
- SNOWFLAKE_PAT: z.ZodOptional<z.ZodString>;
90
- SNOWFLAKE_PASSWORD: z.ZodOptional<z.ZodString>;
91
- SNOWFLAKE_OAUTH_ACCESS_TOKEN: z.ZodOptional<z.ZodString>;
92
- SNOWFLAKE_OAUTH_REFRESH_TOKEN: z.ZodOptional<z.ZodString>;
93
- SNOWFLAKE_OAUTH_CLIENT_ID: z.ZodOptional<z.ZodString>;
94
- SNOWFLAKE_OAUTH_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
95
- SNOWFLAKE_OAUTH_TOKEN_URL: z.ZodOptional<z.ZodString>;
96
- SNOWFLAKE_OAUTH_SCOPES: z.ZodOptional<z.ZodString>;
97
- SNOWFLAKE_ROLE: z.ZodOptional<z.ZodString>;
98
- SNOWFLAKE_WAREHOUSE: z.ZodOptional<z.ZodString>;
99
- SNOWFLAKE_DATABASE: z.ZodOptional<z.ZodString>;
100
- SNOWFLAKE_SCHEMA: z.ZodOptional<z.ZodString>;
101
- SNOWFLAKE_HOST: z.ZodOptional<z.ZodString>;
102
- SNOWFLAKE_REGION: z.ZodOptional<z.ZodString>;
103
- SNOWFLAKE_PUBLIC_KEY_FP: z.ZodOptional<z.ZodString>;
104
- }, z.core.$strip>;
105
- }[]>;
106
- type SnowflakeCredentials = InferCredentialSetAuth<typeof snowflakeCredentialSet>;
107
- /**
108
- * Parse raw credential values through the full refinement pipeline. Callers
109
- * (client, operations) should use this instead of the raw object schema so
110
- * mode-specific invariants are enforced.
111
- */
112
- declare function parseSnowflakeCredentials(input: unknown): SnowflakeCredentials;
113
- //#endregion
114
- export { snowflakeAuthSchema as a, snowflakeAuthModeSchema as i, SnowflakeCredentials as n, snowflakeCredentialSet as o, parseSnowflakeCredentials as r, SnowflakeAuthMode as t };
@@ -1,106 +0,0 @@
1
- import { CredentialSet } from "@keystrokehq/core";
2
- import { z } from "zod";
3
-
4
- //#region src/credential-sets/snowflake.credential-set.ts
5
- /**
6
- * Public auth schema for Snowflake connections.
7
- *
8
- * Modeled as a discriminated union on `mode`. `connection.kind` is `manual`
9
- * because Keystroke does not run an interactive Snowflake OAuth dance — OAuth
10
- * mode accepts a bearer token provided by the caller (external IdP /
11
- * Snowflake-hosted OAuth).
12
- */
13
- const snowflakeAuthModeSchema = z.enum([
14
- "keypair",
15
- "oauth",
16
- "pat",
17
- "basic"
18
- ]);
19
- const baseSnowflakeAuthShape = {
20
- mode: snowflakeAuthModeSchema,
21
- SNOWFLAKE_ACCOUNT: z.string().min(1),
22
- SNOWFLAKE_USER: z.string().min(1).optional(),
23
- SNOWFLAKE_PRIVATE_KEY: z.string().min(1).optional(),
24
- SNOWFLAKE_PRIVATE_KEY_PASSPHRASE: z.string().optional(),
25
- SNOWFLAKE_PAT: z.string().min(1).optional(),
26
- SNOWFLAKE_PASSWORD: z.string().min(1).optional(),
27
- SNOWFLAKE_OAUTH_ACCESS_TOKEN: z.string().min(1).optional(),
28
- SNOWFLAKE_OAUTH_REFRESH_TOKEN: z.string().optional(),
29
- SNOWFLAKE_OAUTH_CLIENT_ID: z.string().optional(),
30
- SNOWFLAKE_OAUTH_CLIENT_SECRET: z.string().optional(),
31
- SNOWFLAKE_OAUTH_TOKEN_URL: z.string().url().optional(),
32
- SNOWFLAKE_OAUTH_SCOPES: z.string().optional(),
33
- SNOWFLAKE_ROLE: z.string().optional(),
34
- SNOWFLAKE_WAREHOUSE: z.string().optional(),
35
- SNOWFLAKE_DATABASE: z.string().optional(),
36
- SNOWFLAKE_SCHEMA: z.string().optional(),
37
- SNOWFLAKE_HOST: z.string().optional(),
38
- SNOWFLAKE_REGION: z.string().optional(),
39
- SNOWFLAKE_PUBLIC_KEY_FP: z.string().optional()
40
- };
41
- const snowflakeAuthSchema = z.object(baseSnowflakeAuthShape).superRefine((value, ctx) => {
42
- if (value.mode === "keypair") {
43
- if (!value.SNOWFLAKE_USER) ctx.addIssue({
44
- code: z.ZodIssueCode.custom,
45
- path: ["SNOWFLAKE_USER"],
46
- message: "SNOWFLAKE_USER is required when mode = \"keypair\""
47
- });
48
- if (!value.SNOWFLAKE_PRIVATE_KEY) ctx.addIssue({
49
- code: z.ZodIssueCode.custom,
50
- path: ["SNOWFLAKE_PRIVATE_KEY"],
51
- message: "SNOWFLAKE_PRIVATE_KEY is required when mode = \"keypair\""
52
- });
53
- } else if (value.mode === "oauth") {
54
- if (!value.SNOWFLAKE_OAUTH_ACCESS_TOKEN) ctx.addIssue({
55
- code: z.ZodIssueCode.custom,
56
- path: ["SNOWFLAKE_OAUTH_ACCESS_TOKEN"],
57
- message: "SNOWFLAKE_OAUTH_ACCESS_TOKEN is required when mode = \"oauth\""
58
- });
59
- } else if (value.mode === "pat") {
60
- if (!value.SNOWFLAKE_USER) ctx.addIssue({
61
- code: z.ZodIssueCode.custom,
62
- path: ["SNOWFLAKE_USER"],
63
- message: "SNOWFLAKE_USER is required when mode = \"pat\""
64
- });
65
- if (!value.SNOWFLAKE_PAT) ctx.addIssue({
66
- code: z.ZodIssueCode.custom,
67
- path: ["SNOWFLAKE_PAT"],
68
- message: "SNOWFLAKE_PAT is required when mode = \"pat\""
69
- });
70
- } else if (value.mode === "basic") {
71
- if (!value.SNOWFLAKE_USER) ctx.addIssue({
72
- code: z.ZodIssueCode.custom,
73
- path: ["SNOWFLAKE_USER"],
74
- message: "SNOWFLAKE_USER is required when mode = \"basic\""
75
- });
76
- if (!value.SNOWFLAKE_PASSWORD) ctx.addIssue({
77
- code: z.ZodIssueCode.custom,
78
- path: ["SNOWFLAKE_PASSWORD"],
79
- message: "SNOWFLAKE_PASSWORD is required when mode = \"basic\""
80
- });
81
- }
82
- });
83
- const snowflakeAuthObjectSchema = z.object(baseSnowflakeAuthShape);
84
- const snowflakeCredentialSet = new CredentialSet({
85
- id: "snowflake",
86
- name: "Snowflake",
87
- description: "Snowflake data cloud: SQL API v2, Snowpipe (file + streaming), warehouses, roles, users, grants, shares, streams, tasks, and administration for Keystroke workflows.",
88
- auth: snowflakeAuthObjectSchema,
89
- connections: [{
90
- id: "manual",
91
- kind: "manual",
92
- label: "Snowflake credentials",
93
- input: snowflakeAuthObjectSchema
94
- }]
95
- });
96
- /**
97
- * Parse raw credential values through the full refinement pipeline. Callers
98
- * (client, operations) should use this instead of the raw object schema so
99
- * mode-specific invariants are enforced.
100
- */
101
- function parseSnowflakeCredentials(input) {
102
- return snowflakeAuthSchema.parse(input);
103
- }
104
-
105
- //#endregion
106
- export { snowflakeCredentialSet as i, snowflakeAuthModeSchema as n, snowflakeAuthSchema as r, parseSnowflakeCredentials as t };
@@ -1,84 +0,0 @@
1
- import { SnowflakeClient } from "../client/index.mjs";
2
- import { a as SubmitStatementInput, d as HydratedRow, f as PartitionResponse, m as ColumnMeta, n as StatementResponse } from "../statements-DJL0qVNA.mjs";
3
- //#region src/sql/index.d.ts
4
- interface SubmitOptions {
5
- readonly async?: boolean;
6
- readonly requestId?: string;
7
- }
8
- interface SubmitResult {
9
- readonly response: StatementResponse;
10
- readonly status: 'done' | 'failed' | 'pending' | 'cancelled';
11
- readonly httpStatus: number;
12
- }
13
- /**
14
- * Submit a statement. When `async: true` (or the server chooses async) we
15
- * return the inflated response envelope along with the `pending` status so
16
- * callers can poll via {@link getStatement} / {@link waitForStatement}.
17
- *
18
- * The SQL API itself keys idempotency on the `requestId` query param which
19
- * {@link SnowflakeClient} auto-populates — callers can override it per
20
- * request when they need deterministic retries.
21
- */
22
- declare function submitStatement(client: SnowflakeClient, input: SubmitStatementInput, options?: SubmitOptions): Promise<SubmitResult>;
23
- /**
24
- * Fetch the current status of a previously submitted async statement. Returns
25
- * both the envelope and the derived `status` bucket.
26
- */
27
- declare function getStatement(client: SnowflakeClient, handle: string, options?: {
28
- readonly partition?: number;
29
- }): Promise<SubmitResult>;
30
- /**
31
- * POST `/cancel`. Snowflake responds with `code: 333335` on success — we
32
- * normalise anything else into a {@link SnowflakeApiError}.
33
- */
34
- declare function cancelStatement(client: SnowflakeClient, handle: string): Promise<void>;
35
- interface ExecuteSqlOptions extends SubmitOptions {
36
- readonly pollIntervalMs?: number;
37
- readonly maxWaitMs?: number;
38
- readonly hydrate?: boolean;
39
- readonly now?: () => number;
40
- readonly sleep?: (ms: number) => Promise<void>;
41
- }
42
- interface ExecuteSqlResult<TRow = HydratedRow> {
43
- readonly handle: string;
44
- readonly columns: readonly ColumnMeta[];
45
- readonly rows: readonly TRow[];
46
- readonly envelope: StatementResponse;
47
- readonly partitions: number;
48
- }
49
- /**
50
- * Submit + wait + fetch all partitions in one go. The returned rows are
51
- * hydrated into objects keyed by column name by default; pass
52
- * `hydrate: false` to get the raw tuple form.
53
- */
54
- declare function executeSql(client: SnowflakeClient, input: SubmitStatementInput, options?: ExecuteSqlOptions): Promise<ExecuteSqlResult<HydratedRow | readonly unknown[]>>;
55
- /**
56
- * Composio `SNOWFLAKE_BASIC_RUN_QUERY` parity — requires an explicit
57
- * database + schema to match the published BASIC shape.
58
- */
59
- declare function runQuery(client: SnowflakeClient, input: {
60
- readonly statement: string;
61
- readonly database: string;
62
- readonly schema_name: string;
63
- readonly warehouse?: string;
64
- readonly role?: string;
65
- }, options?: ExecuteSqlOptions): Promise<ExecuteSqlResult<HydratedRow | readonly unknown[]>>;
66
- /**
67
- * Fetch a single partition for a known handle.
68
- */
69
- declare function getStatementResultPartition(client: SnowflakeClient, handle: string, partition: number): Promise<PartitionResponse>;
70
- /**
71
- * Async iterator over every partition for a handle. Useful for streaming
72
- * large result sets into downstream pipelines.
73
- */
74
- declare function iterateStatementResult(client: SnowflakeClient, handle: string, options?: {
75
- readonly maxPartitions?: number;
76
- }): AsyncGenerator<PartitionResponse, void, void>;
77
- /**
78
- * Blocking helper: polls `getStatement` until the statement reaches a
79
- * terminal status or the `maxWaitMs` budget elapses. Returns the terminal
80
- * envelope (throws for `failed` / `cancelled`).
81
- */
82
- declare function waitForStatement(client: SnowflakeClient, handle: string, options?: ExecuteSqlOptions): Promise<StatementResponse>;
83
- //#endregion
84
- export { ExecuteSqlOptions, ExecuteSqlResult, SubmitOptions, SubmitResult, cancelStatement, executeSql, getStatement, getStatementResultPartition, iterateStatementResult, runQuery, submitStatement, waitForStatement };