@activepieces/piece-snowflake 0.1.4 → 0.2.0
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/package.json +4 -4
- package/src/i18n/de.json +37 -0
- package/src/i18n/es.json +37 -0
- package/src/i18n/fr.json +37 -0
- package/src/i18n/ja.json +37 -0
- package/src/i18n/nl.json +37 -0
- package/src/i18n/pt.json +37 -0
- package/src/i18n/ru.json +36 -0
- package/src/i18n/translation.json +37 -0
- package/src/i18n/vi.json +36 -0
- package/src/i18n/zh.json +37 -0
- package/src/index.d.ts +4 -2
- package/src/index.d.ts.map +1 -0
- package/src/index.js +33 -2
- package/src/index.js.map +1 -1
- package/src/lib/actions/create-dynamic-table.d.ts +36 -0
- package/src/lib/actions/create-dynamic-table.d.ts.map +1 -0
- package/src/lib/actions/create-dynamic-table.js +81 -0
- package/src/lib/actions/create-dynamic-table.js.map +1 -0
- package/src/lib/actions/delete-row.d.ts +43 -0
- package/src/lib/actions/delete-row.d.ts.map +1 -0
- package/src/lib/actions/delete-row.js +45 -0
- package/src/lib/actions/delete-row.js.map +1 -0
- package/src/lib/actions/execute-stored-procedure.d.ts +43 -0
- package/src/lib/actions/execute-stored-procedure.d.ts.map +1 -0
- package/src/lib/actions/execute-stored-procedure.js +92 -0
- package/src/lib/actions/execute-stored-procedure.js.map +1 -0
- package/src/lib/actions/get-row-by-id.d.ts +53 -0
- package/src/lib/actions/get-row-by-id.d.ts.map +1 -0
- package/src/lib/actions/get-row-by-id.js +67 -0
- package/src/lib/actions/get-row-by-id.js.map +1 -0
- package/src/lib/actions/get-table-schema.d.ts +42 -0
- package/src/lib/actions/get-table-schema.d.ts.map +1 -0
- package/src/lib/actions/get-table-schema.js +49 -0
- package/src/lib/actions/get-table-schema.js.map +1 -0
- package/src/lib/actions/insert-multiple-rows.d.ts +43 -0
- package/src/lib/actions/insert-multiple-rows.d.ts.map +1 -0
- package/src/lib/actions/insert-multiple-rows.js +81 -0
- package/src/lib/actions/insert-multiple-rows.js.map +1 -0
- package/src/lib/actions/insert-row.d.ts +16 -10
- package/src/lib/actions/insert-row.d.ts.map +1 -0
- package/src/lib/actions/insert-row.js +1 -1
- package/src/lib/actions/insert-row.js.map +1 -1
- package/src/lib/actions/list-tables.d.ts +32 -0
- package/src/lib/actions/list-tables.d.ts.map +1 -0
- package/src/lib/actions/list-tables.js +47 -0
- package/src/lib/actions/list-tables.js.map +1 -0
- package/src/lib/actions/load-data-from-stage.d.ts +48 -0
- package/src/lib/actions/load-data-from-stage.d.ts.map +1 -0
- package/src/lib/actions/load-data-from-stage.js +117 -0
- package/src/lib/actions/load-data-from-stage.js.map +1 -0
- package/src/lib/actions/run-multiple-queries.d.ts +4 -2
- package/src/lib/actions/run-multiple-queries.d.ts.map +1 -0
- package/src/lib/actions/run-multiple-queries.js +1 -1
- package/src/lib/actions/run-multiple-queries.js.map +1 -1
- package/src/lib/actions/run-query.d.ts +4 -2
- package/src/lib/actions/run-query.d.ts.map +1 -0
- package/src/lib/actions/run-query.js +1 -1
- package/src/lib/actions/run-query.js.map +1 -1
- package/src/lib/actions/search-rows.d.ts +45 -0
- package/src/lib/actions/search-rows.d.ts.map +1 -0
- package/src/lib/actions/search-rows.js +58 -0
- package/src/lib/actions/search-rows.js.map +1 -0
- package/src/lib/actions/update-row.d.ts +53 -0
- package/src/lib/actions/update-row.d.ts.map +1 -0
- package/src/lib/actions/update-row.js +54 -0
- package/src/lib/actions/update-row.js.map +1 -0
- package/src/lib/actions/upsert-row.d.ts +62 -0
- package/src/lib/actions/upsert-row.d.ts.map +1 -0
- package/src/lib/actions/upsert-row.js +93 -0
- package/src/lib/actions/upsert-row.js.map +1 -0
- package/src/lib/auth.d.ts +14 -1
- package/src/lib/auth.d.ts.map +1 -0
- package/src/lib/auth.js +203 -17
- package/src/lib/auth.js.map +1 -1
- package/src/lib/common/index.d.ts +49 -11
- package/src/lib/common/index.d.ts.map +1 -0
- package/src/lib/common/index.js +88 -36
- package/src/lib/common/index.js.map +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDynamicTableAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../auth");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.createDynamicTableAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'create_dynamic_table',
|
|
10
|
+
displayName: 'Create / Refresh Dynamic Table',
|
|
11
|
+
description: 'Create or replace a Snowflake Dynamic Table that automatically refreshes based on a query. ' +
|
|
12
|
+
'Dynamic Tables are a declarative way to define a table whose content is derived from a query, updated on a schedule.',
|
|
13
|
+
auth: auth_1.snowflakeAuth,
|
|
14
|
+
props: {
|
|
15
|
+
database: common_1.snowflakeCommonProps.database,
|
|
16
|
+
schema: common_1.snowflakeCommonProps.schema,
|
|
17
|
+
table_name: pieces_framework_1.Property.ShortText({
|
|
18
|
+
displayName: 'Dynamic Table Name',
|
|
19
|
+
description: 'The name for the new dynamic table (e.g. `DAILY_SALES_SUMMARY`).',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
target_lag: pieces_framework_1.Property.ShortText({
|
|
23
|
+
displayName: 'Target Lag',
|
|
24
|
+
description: 'How fresh the dynamic table data should be. Accepts time expressions like `1 minute`, `5 minutes`, `1 hour`, or `DOWNSTREAM` to refresh when downstream objects are refreshed.',
|
|
25
|
+
required: true,
|
|
26
|
+
defaultValue: '1 hour',
|
|
27
|
+
}),
|
|
28
|
+
warehouse: pieces_framework_1.Property.ShortText({
|
|
29
|
+
displayName: 'Warehouse',
|
|
30
|
+
description: 'The name of the virtual warehouse to use when refreshing the dynamic table. Uses the auth warehouse if left empty.',
|
|
31
|
+
required: false,
|
|
32
|
+
}),
|
|
33
|
+
query: pieces_framework_1.Property.LongText({
|
|
34
|
+
displayName: 'Source Query',
|
|
35
|
+
description: 'The SELECT statement that defines the dynamic table content. ' +
|
|
36
|
+
'Example: `SELECT user_id, SUM(amount) AS total FROM orders GROUP BY user_id`',
|
|
37
|
+
required: true,
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
run(context) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
var _a;
|
|
43
|
+
const { database, schema, table_name, target_lag, warehouse, query } = context.propsValue;
|
|
44
|
+
const identifierRegex = /^[A-Za-z_][A-Za-z0-9_$]*$/;
|
|
45
|
+
if (!identifierRegex.test(table_name)) {
|
|
46
|
+
throw new Error('Invalid table name: only letters, digits, underscores, and $ are allowed.');
|
|
47
|
+
}
|
|
48
|
+
if (target_lag.includes("'")) {
|
|
49
|
+
throw new Error("Invalid target_lag value: single quotes are not allowed.");
|
|
50
|
+
}
|
|
51
|
+
const effectiveWarehouse = warehouse || ((_a = context.auth.props) === null || _a === void 0 ? void 0 : _a.warehouse);
|
|
52
|
+
if (!effectiveWarehouse) {
|
|
53
|
+
throw new Error('A warehouse is required. Provide it in the action props or set a default in your connection.');
|
|
54
|
+
}
|
|
55
|
+
if (!identifierRegex.test(effectiveWarehouse)) {
|
|
56
|
+
throw new Error('Invalid warehouse name: only letters, digits, underscores, and $ are allowed.');
|
|
57
|
+
}
|
|
58
|
+
const sql = `
|
|
59
|
+
CREATE OR REPLACE DYNAMIC TABLE ${database}.${schema}.${table_name}
|
|
60
|
+
TARGET_LAG = '${target_lag}'
|
|
61
|
+
WAREHOUSE = ${effectiveWarehouse}
|
|
62
|
+
AS ${query}
|
|
63
|
+
`.trim();
|
|
64
|
+
const connection = (0, common_1.configureConnection)(context.auth);
|
|
65
|
+
yield (0, common_1.connect)(connection);
|
|
66
|
+
try {
|
|
67
|
+
yield (0, common_1.execute)(connection, sql, []);
|
|
68
|
+
return {
|
|
69
|
+
success: true,
|
|
70
|
+
table: `${database}.${schema}.${table_name}`,
|
|
71
|
+
target_lag,
|
|
72
|
+
warehouse: effectiveWarehouse,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
yield (0, common_1.destroy)(connection);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=create-dynamic-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-dynamic-table.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-dynamic-table.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAAwC;AACxC,sCAOmB;AAEN,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,gCAAgC;IAC7C,WAAW,EACT,6FAA6F;QAC7F,sHAAsH;IACxH,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE;QACL,QAAQ,EAAE,6BAAoB,CAAC,QAAQ;QACvC,MAAM,EAAE,6BAAoB,CAAC,MAAM;QACnC,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,oBAAoB;YACjC,WAAW,EACT,kEAAkE;YACpE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EACT,gLAAgL;YAClL,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,QAAQ;SACvB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,WAAW,EACT,oHAAoH;YACtH,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACvB,WAAW,EAAE,cAAc;YAC3B,WAAW,EACT,+DAA+D;gBAC/D,8EAA8E;YAChF,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK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;oBACV,SAAS,EAAE,kBAAkB;iBAC9B,CAAC;YACJ,CAAC;oBAAS,CAAC;gBACT,MAAM,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const deleteRowAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
5
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
6
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
7
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
}>)[], {
|
|
11
|
+
database: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
14
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
15
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
16
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
17
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
19
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
20
|
+
}>)[]>;
|
|
21
|
+
schema: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
22
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
23
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
24
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
25
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
26
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
27
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
28
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
29
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
30
|
+
}>)[]>;
|
|
31
|
+
table: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
32
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
33
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
34
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
35
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
36
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
37
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
38
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
39
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
40
|
+
}>)[]>;
|
|
41
|
+
where_clause: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
42
|
+
}>;
|
|
43
|
+
//# sourceMappingURL=delete-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-row.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/delete-row.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoC1B,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteRowAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../auth");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.deleteRowAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'delete_row',
|
|
10
|
+
displayName: 'Delete Row',
|
|
11
|
+
description: 'Delete one or more rows from a Snowflake table that match a WHERE condition.',
|
|
12
|
+
auth: auth_1.snowflakeAuth,
|
|
13
|
+
props: {
|
|
14
|
+
database: common_1.snowflakeCommonProps.database,
|
|
15
|
+
schema: common_1.snowflakeCommonProps.schema,
|
|
16
|
+
table: common_1.snowflakeCommonProps.table,
|
|
17
|
+
where_clause: pieces_framework_1.Property.ShortText({
|
|
18
|
+
displayName: 'WHERE Condition',
|
|
19
|
+
description: "A SQL condition to filter which rows to delete (e.g. `id = 42` or `status = 'archived'`). " +
|
|
20
|
+
'This field is required to prevent accidental deletion of all rows. ' +
|
|
21
|
+
'**Security note:** this value is embedded directly in SQL. Only use static values or data from trusted, internal steps — never pass unvalidated end-user input here.',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
run(context) {
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const { table, where_clause } = context.propsValue;
|
|
29
|
+
const sql = `DELETE FROM ${table} WHERE ${where_clause}`;
|
|
30
|
+
const connection = (0, common_1.configureConnection)(context.auth);
|
|
31
|
+
yield (0, common_1.connect)(connection);
|
|
32
|
+
try {
|
|
33
|
+
const result = yield (0, common_1.execute)(connection, sql, []);
|
|
34
|
+
return {
|
|
35
|
+
success: true,
|
|
36
|
+
rows_deleted: (_b = (_a = result === null || result === void 0 ? void 0 : result[0]) === null || _a === void 0 ? void 0 : _a['number of rows deleted']) !== null && _b !== void 0 ? _b : null,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
yield (0, common_1.destroy)(connection);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=delete-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-row.js","sourceRoot":"","sources":["../../../../src/lib/actions/delete-row.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAAwC;AACxC,sCAOmB;AAEN,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EACT,8EAA8E;IAChF,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE;QACL,QAAQ,EAAE,6BAAoB,CAAC,QAAQ;QACvC,MAAM,EAAE,6BAAoB,CAAC,MAAM;QACnC,KAAK,EAAE,6BAAoB,CAAC,KAAK;QACjC,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EACT,4FAA4F;gBAC5F,qEAAqE;gBACrE,sKAAsK;YACxK,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEnD,MAAM,GAAG,GAAG,eAAe,KAAK,UAAU,YAAY,EAAE,CAAC;YAEzD,MAAM,UAAU,GAAG,IAAA,4BAAmB,EAAC,OAAO,CAAC,IAA0B,CAAC,CAAC;YAC3E,MAAM,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC;YAC1B,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAA,gBAAO,EAAC,UAAU,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;gBAClD,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,YAAY,EAAE,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,CAAC,CAAC,0CAAG,wBAAwB,CAAC,mCAAI,IAAI;iBAC9D,CAAC;YACJ,CAAC;oBAAS,CAAC;gBACT,MAAM,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const executeStoredProcedureAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
5
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
6
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
7
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
}>)[], {
|
|
11
|
+
database: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
14
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
15
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
16
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
17
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
19
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
20
|
+
}>)[]>;
|
|
21
|
+
schema: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
22
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
23
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
24
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
25
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
26
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
27
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
28
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
29
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
30
|
+
}>)[]>;
|
|
31
|
+
procedure_name: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
32
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
33
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
34
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
35
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
36
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
37
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
38
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
39
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
40
|
+
}>)[]>;
|
|
41
|
+
arguments: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
42
|
+
}>;
|
|
43
|
+
//# sourceMappingURL=execute-stored-procedure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-stored-procedure.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/execute-stored-procedure.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FvC,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeStoredProcedureAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../auth");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.executeStoredProcedureAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'execute_stored_procedure',
|
|
10
|
+
displayName: 'Execute Stored Procedure',
|
|
11
|
+
description: 'Call a stored procedure in Snowflake and return its result.',
|
|
12
|
+
auth: auth_1.snowflakeAuth,
|
|
13
|
+
props: {
|
|
14
|
+
database: common_1.snowflakeCommonProps.database,
|
|
15
|
+
schema: common_1.snowflakeCommonProps.schema,
|
|
16
|
+
procedure_name: pieces_framework_1.Property.Dropdown({
|
|
17
|
+
auth: auth_1.snowflakeAuth,
|
|
18
|
+
displayName: 'Stored Procedure',
|
|
19
|
+
description: 'Select the stored procedure to call.',
|
|
20
|
+
refreshers: ['database', 'schema'],
|
|
21
|
+
required: true,
|
|
22
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, database, schema }) {
|
|
23
|
+
if (!auth) {
|
|
24
|
+
return {
|
|
25
|
+
disabled: true,
|
|
26
|
+
options: [],
|
|
27
|
+
placeholder: 'Please connect your account first',
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (!database || !schema) {
|
|
31
|
+
return {
|
|
32
|
+
disabled: true,
|
|
33
|
+
options: [],
|
|
34
|
+
placeholder: 'Please select a database and schema first',
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const connection = (0, common_1.configureConnection)(auth);
|
|
38
|
+
yield (0, common_1.connect)(connection);
|
|
39
|
+
let result;
|
|
40
|
+
try {
|
|
41
|
+
result = yield (0, common_1.execute)(connection, `SHOW PROCEDURES IN SCHEMA ${database}.${schema}`, []);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
yield (0, common_1.destroy)(connection);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
disabled: false,
|
|
48
|
+
options: result
|
|
49
|
+
? result.map((proc) => {
|
|
50
|
+
var _a, _b, _c, _d;
|
|
51
|
+
return ({
|
|
52
|
+
label: String((_b = (_a = proc['arguments']) !== null && _a !== void 0 ? _a : proc['name']) !== null && _b !== void 0 ? _b : ''),
|
|
53
|
+
value: String((_d = (_c = proc['arguments']) !== null && _c !== void 0 ? _c : proc['name']) !== null && _d !== void 0 ? _d : ''),
|
|
54
|
+
});
|
|
55
|
+
})
|
|
56
|
+
: [],
|
|
57
|
+
};
|
|
58
|
+
}),
|
|
59
|
+
}),
|
|
60
|
+
arguments: pieces_framework_1.Property.Array({
|
|
61
|
+
displayName: 'Arguments',
|
|
62
|
+
description: 'Positional arguments to pass to the stored procedure in order. ' +
|
|
63
|
+
'Leave empty if the procedure takes no arguments.',
|
|
64
|
+
required: false,
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
run(context) {
|
|
68
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const { database, schema, procedure_name, arguments: args, } = context.propsValue;
|
|
70
|
+
// procedure_name is the full signature string (e.g. "MY_PROC(NUMBER) RETURN VARCHAR")
|
|
71
|
+
// Extract just the bare name before the first '('
|
|
72
|
+
const bareName = procedure_name.includes('(')
|
|
73
|
+
? procedure_name.substring(0, procedure_name.indexOf('(')).trim()
|
|
74
|
+
: procedure_name.trim();
|
|
75
|
+
const argPlaceholders = args && args.length > 0
|
|
76
|
+
? args.map(() => '?').join(', ')
|
|
77
|
+
: '';
|
|
78
|
+
const sql = `CALL ${database}.${schema}.${bareName}(${argPlaceholders})`;
|
|
79
|
+
const binds = args && args.length > 0 ? args : [];
|
|
80
|
+
const connection = (0, common_1.configureConnection)(context.auth);
|
|
81
|
+
yield (0, common_1.connect)(connection);
|
|
82
|
+
try {
|
|
83
|
+
const result = yield (0, common_1.execute)(connection, sql, binds);
|
|
84
|
+
return { result: result !== null && result !== void 0 ? result : null };
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
yield (0, common_1.destroy)(connection);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=execute-stored-procedure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-stored-procedure.js","sourceRoot":"","sources":["../../../../src/lib/actions/execute-stored-procedure.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAAwC;AACxC,sCAOmB;AAEN,QAAA,4BAA4B,GAAG,IAAA,+BAAY,EAAC;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,GAAG,CAAC;YACzE,MAAM,KAAK,GAAG,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAE,IAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;YAEhE,MAAM,UAAU,GAAG,IAAA,4BAAmB,EAAC,OAAO,CAAC,IAA0B,CAAC,CAAC;YAC3E,MAAM,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC;YAC1B,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAA,gBAAO,EAAC,UAAU,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;gBACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,EAAE,CAAC;YACpC,CAAC;oBAAS,CAAC;gBACT,MAAM,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const getRowByIdAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
5
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
6
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
7
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
}>)[], {
|
|
11
|
+
database: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
14
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
15
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
16
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
17
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
19
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
20
|
+
}>)[]>;
|
|
21
|
+
schema: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
22
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
23
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
24
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
25
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
26
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
27
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
28
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
29
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
30
|
+
}>)[]>;
|
|
31
|
+
table: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
32
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
33
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
34
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
35
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
36
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
37
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
38
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
39
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
40
|
+
}>)[]>;
|
|
41
|
+
id_column: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
42
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
43
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
44
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
45
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
46
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
47
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
48
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
49
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
50
|
+
}>)[]>;
|
|
51
|
+
id_value: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
52
|
+
}>;
|
|
53
|
+
//# sourceMappingURL=get-row-by-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-row-by-id.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-row-by-id.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8D3B,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRowByIdAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../auth");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.getRowByIdAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'get_row_by_id',
|
|
10
|
+
displayName: 'Get Row by ID',
|
|
11
|
+
description: 'Retrieve a single row from a Snowflake table by matching a column value.',
|
|
12
|
+
auth: auth_1.snowflakeAuth,
|
|
13
|
+
props: {
|
|
14
|
+
database: common_1.snowflakeCommonProps.database,
|
|
15
|
+
schema: common_1.snowflakeCommonProps.schema,
|
|
16
|
+
table: common_1.snowflakeCommonProps.table,
|
|
17
|
+
id_column: pieces_framework_1.Property.Dropdown({
|
|
18
|
+
auth: auth_1.snowflakeAuth,
|
|
19
|
+
displayName: 'ID Column',
|
|
20
|
+
description: 'The column to search in (e.g. the primary key or unique identifier column).',
|
|
21
|
+
refreshers: ['table'],
|
|
22
|
+
required: true,
|
|
23
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, table }) {
|
|
24
|
+
if (!auth) {
|
|
25
|
+
return {
|
|
26
|
+
disabled: true,
|
|
27
|
+
options: [],
|
|
28
|
+
placeholder: 'Please connect your account first',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (!table) {
|
|
32
|
+
return {
|
|
33
|
+
disabled: true,
|
|
34
|
+
options: [],
|
|
35
|
+
placeholder: 'Please select a table first',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return (0, common_1.getTableColumnOptions)(auth, table);
|
|
39
|
+
}),
|
|
40
|
+
}),
|
|
41
|
+
id_value: pieces_framework_1.Property.ShortText({
|
|
42
|
+
displayName: 'ID Value',
|
|
43
|
+
description: 'The value to look up in the ID column.',
|
|
44
|
+
required: true,
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
run(context) {
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const { table, id_column, id_value } = context.propsValue;
|
|
50
|
+
const sql = `SELECT * FROM ${table} WHERE ${id_column} = ? LIMIT 1`;
|
|
51
|
+
const connection = (0, common_1.configureConnection)(context.auth);
|
|
52
|
+
yield (0, common_1.connect)(connection);
|
|
53
|
+
try {
|
|
54
|
+
const result = yield (0, common_1.execute)(connection, sql, [id_value]);
|
|
55
|
+
if (!result || result.length === 0) {
|
|
56
|
+
return { found: false };
|
|
57
|
+
}
|
|
58
|
+
const row = result[0];
|
|
59
|
+
return Object.assign({ found: true }, row);
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
yield (0, common_1.destroy)(connection);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=get-row-by-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-row-by-id.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-row-by-id.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAAwC;AACxC,sCAQmB;AAEN,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EACT,0EAA0E;IAC5E,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE;QACL,QAAQ,EAAE,6BAAoB,CAAC,QAAQ;QACvC,MAAM,EAAE,6BAAoB,CAAC,MAAM;QACnC,KAAK,EAAE,6BAAoB,CAAC,KAAK;QACjC,SAAS,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC3B,IAAI,EAAE,oBAA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AAE,KAAK,EAAE,KAAK,EAAE,CAAC;gBAC1B,CAAC;gBACD,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAA4B,CAAC;gBACjD,uBAAS,KAAK,EAAE,IAAI,IAAK,GAAG,EAAG;YACjC,CAAC;oBAAS,CAAC;gBACT,MAAM,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const getTableSchemaAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
5
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
6
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
7
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
}>)[], {
|
|
11
|
+
database: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
14
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
15
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
16
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
17
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
19
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
20
|
+
}>)[]>;
|
|
21
|
+
schema: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
22
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
23
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
24
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
25
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
26
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
27
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
28
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
29
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
30
|
+
}>)[]>;
|
|
31
|
+
table: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
32
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
33
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
34
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
35
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
36
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
37
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
38
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
39
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
40
|
+
}>)[]>;
|
|
41
|
+
}>;
|
|
42
|
+
//# sourceMappingURL=get-table-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-table-schema.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-table-schema.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqC/B,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTableSchemaAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../auth");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.getTableSchemaAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'get_table_schema',
|
|
10
|
+
displayName: 'Get Table Schema',
|
|
11
|
+
description: 'Retrieve the column definitions (name, data type, nullability, default) for a Snowflake table.',
|
|
12
|
+
auth: auth_1.snowflakeAuth,
|
|
13
|
+
props: {
|
|
14
|
+
database: common_1.snowflakeCommonProps.database,
|
|
15
|
+
schema: common_1.snowflakeCommonProps.schema,
|
|
16
|
+
table: common_1.snowflakeCommonProps.table,
|
|
17
|
+
},
|
|
18
|
+
run(context) {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const { table } = context.propsValue;
|
|
21
|
+
const connection = (0, common_1.configureConnection)(context.auth);
|
|
22
|
+
yield (0, common_1.connect)(connection);
|
|
23
|
+
try {
|
|
24
|
+
const result = yield (0, common_1.execute)(connection, `DESCRIBE TABLE ${table}`, []);
|
|
25
|
+
if (!result)
|
|
26
|
+
return { columns: [] };
|
|
27
|
+
const columns = result.map((col) => {
|
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
29
|
+
return ({
|
|
30
|
+
column_name: (_a = col['name']) !== null && _a !== void 0 ? _a : null,
|
|
31
|
+
data_type: (_b = col['type']) !== null && _b !== void 0 ? _b : null,
|
|
32
|
+
nullable: (_c = col['null?']) !== null && _c !== void 0 ? _c : null,
|
|
33
|
+
default_value: (_d = col['default']) !== null && _d !== void 0 ? _d : null,
|
|
34
|
+
primary_key: (_e = col['primary key']) !== null && _e !== void 0 ? _e : null,
|
|
35
|
+
unique_key: (_f = col['unique key']) !== null && _f !== void 0 ? _f : null,
|
|
36
|
+
check: (_g = col['check']) !== null && _g !== void 0 ? _g : null,
|
|
37
|
+
expression: (_h = col['expression']) !== null && _h !== void 0 ? _h : null,
|
|
38
|
+
comment: (_j = col['comment']) !== null && _j !== void 0 ? _j : null,
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
return { table, columns };
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
yield (0, common_1.destroy)(connection);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=get-table-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-table-schema.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-table-schema.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,kCAAwC;AACxC,sCAOmB;AAEN,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,gGAAgG;IAClG,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE;QACL,QAAQ,EAAE,6BAAoB,CAAC,QAAQ;QACvC,MAAM,EAAE,6BAAoB,CAAC,MAAM;QACnC,KAAK,EAAE,6BAAoB,CAAC,KAAK;KAClC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,CAAC;YAC5B,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const insertMultipleRowsAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
5
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
6
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
7
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
}>)[], {
|
|
11
|
+
database: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
14
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
15
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
16
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
17
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
19
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
20
|
+
}>)[]>;
|
|
21
|
+
schema: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
22
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
23
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
24
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
25
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
26
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
27
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
28
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
29
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
30
|
+
}>)[]>;
|
|
31
|
+
table: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
32
|
+
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
33
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
34
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
35
|
+
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
36
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
37
|
+
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
38
|
+
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
39
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
40
|
+
}>)[]>;
|
|
41
|
+
rows: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
42
|
+
}>;
|
|
43
|
+
//# sourceMappingURL=insert-multiple-rows.d.ts.map
|