@activepieces/piece-snowflake 0.1.3 → 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 +10 -15
- package/src/index.d.ts +4 -11
- package/src/index.d.ts.map +1 -0
- package/src/index.js +36 -56
- 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 +3 -3
- 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 +3 -3
- 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 +11 -26
- 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 +22 -0
- package/src/lib/auth.d.ts.map +1 -0
- package/src/lib/auth.js +243 -0
- package/src/lib/auth.js.map +1 -0
- 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 +93 -41
- package/src/lib/common/index.js.map +1 -1
- package/README.md +0 -1
|
@@ -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,oBAAa;YACnB,WAAW,EAAE,WAAW;YACxB,WAAW,EACT,6EAA6E;YAC/E,UAAU,EAAE,CAAC,OAAO,CAAC;YACrB,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,KAAwB,EAAE,oDAAnB,EAAE,IAAI,EAAE,KAAK,EAAE;gBAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,OAAO;wBACL,QAAQ,EAAE,IAAI;w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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;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAErC,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,kBAAkB,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;gBACxE,IAAI,CAAC,MAAM;oBAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;gBAEpC,MAAM,OAAO,GAAI,MAAoC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;;oBAAC,OAAA,CAAC;wBAClE,WAAW,EAAE,MAAA,GAAG,CAAC,MAAM,CAAC,mCAAI,IAAI;wBAChC,SAAS,EAAE,MAAA,GAAG,CAAC,MAAM,CAAC,mCAAI,IAAI;wBAC9B,QAAQ,EAAE,MAAA,GAAG,CAAC,OAAO,CAAC,mCAAI,IAAI;wBAC9B,aAAa,EAAE,MAAA,GAAG,CAAC,SAAS,CAAC,mCAAI,IAAI;wBACrC,WAAW,EAAE,MAAA,GAAG,CAAC,aAAa,CAAC,mCAAI,IAAI;wBACvC,UAAU,EAAE,MAAA,GAAG,CAAC,YAAY,CAAC,mCAAI,IAAI;wBACrC,KAAK,EAAE,MAAA,GAAG,CAAC,OAAO,CAAC,mCAAI,IAAI;wBAC3B,UAAU,EAAE,MAAA,GAAG,CAAC,YAAY,CAAC,mCAAI,IAAI;wBACrC,OAAO,EAAE,MAAA,GAAG,CAAC,SAAS,CAAC,mCAAI,IAAI;qBAChC,CAAC,CAAA;iBAAA,CAAC,CAAC;gBAEJ,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;YAC5B,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 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-multiple-rows.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/insert-multiple-rows.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoFnC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.insertMultipleRowsAction = 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.insertMultipleRowsAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'insert_multiple_rows',
|
|
10
|
+
displayName: 'Insert Multiple Rows',
|
|
11
|
+
description: 'Insert multiple rows into a Snowflake table in a single operation.',
|
|
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
|
+
rows: pieces_framework_1.Property.Array({
|
|
18
|
+
displayName: 'Rows',
|
|
19
|
+
description: 'One item per row. Each item must be a JSON object with column names as keys. ' +
|
|
20
|
+
'Example: `{"name": "Alice", "age": 30}`. ' +
|
|
21
|
+
'When mapping from a previous step, pass the entire array directly.',
|
|
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, rows } = context.propsValue;
|
|
29
|
+
if (!Array.isArray(rows) || rows.length === 0) {
|
|
30
|
+
throw new Error('Rows must be a non-empty array.');
|
|
31
|
+
}
|
|
32
|
+
const parsedRows = rows.map((item) => {
|
|
33
|
+
if (typeof item === 'string') {
|
|
34
|
+
try {
|
|
35
|
+
return JSON.parse(item);
|
|
36
|
+
}
|
|
37
|
+
catch (_a) {
|
|
38
|
+
throw new Error(`Invalid JSON in row: ${item}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return item;
|
|
42
|
+
});
|
|
43
|
+
const columns = Object.keys(parsedRows[0]);
|
|
44
|
+
if (columns.length === 0) {
|
|
45
|
+
throw new Error('Each row object must have at least one key (column name).');
|
|
46
|
+
}
|
|
47
|
+
const columnSet = new Set(columns);
|
|
48
|
+
parsedRows.forEach((row, i) => {
|
|
49
|
+
const rowKeys = Object.keys(row);
|
|
50
|
+
const missing = columns.filter((col) => !(col in row));
|
|
51
|
+
const extra = rowKeys.filter((k) => !columnSet.has(k));
|
|
52
|
+
if (missing.length > 0 || extra.length > 0) {
|
|
53
|
+
throw new Error(`Row ${i + 1} has a different column set than the first row.` +
|
|
54
|
+
(missing.length > 0 ? ` Missing: ${missing.join(', ')}.` : '') +
|
|
55
|
+
(extra.length > 0 ? ` Extra: ${extra.join(', ')}.` : ''));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const rowPlaceholders = parsedRows
|
|
59
|
+
.map(() => `(${columns.map(() => '?').join(', ')})`)
|
|
60
|
+
.join(', ');
|
|
61
|
+
const binds = parsedRows.flatMap((row) => columns.map((col) => row[col]));
|
|
62
|
+
const quotedColumns = columns
|
|
63
|
+
.map((col) => `"${col.replace(/"/g, '""')}"`)
|
|
64
|
+
.join(', ');
|
|
65
|
+
const sql = `INSERT INTO ${table} (${quotedColumns}) VALUES ${rowPlaceholders}`;
|
|
66
|
+
const connection = (0, common_1.configureConnection)(context.auth);
|
|
67
|
+
yield (0, common_1.connect)(connection);
|
|
68
|
+
try {
|
|
69
|
+
const result = yield (0, common_1.execute)(connection, sql, binds);
|
|
70
|
+
return {
|
|
71
|
+
success: true,
|
|
72
|
+
rows_inserted: (_b = (_a = result === null || result === void 0 ? void 0 : result[0]) === null || _a === void 0 ? void 0 : _a['number of rows inserted']) !== null && _b !== void 0 ? _b : parsedRows.length,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
yield (0, common_1.destroy)(connection);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=insert-multiple-rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-multiple-rows.js","sourceRoot":"","sources":["../../../../src/lib/actions/insert-multiple-rows.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAAwC;AACxC,sCAOmB;AAEN,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EACT,oEAAoE;IACtE,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,IAAI,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACnB,WAAW,EAAE,MAAM;YACnB,WAAW,EACT,+EAA+E;gBAC/E,2CAA2C;gBAC3C,oEAAoE;YACtE,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE3C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC9C,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;YACrD,CAAC;YAED,MAAM,UAAU,GAAI,IAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBAClD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC7B,IAAI,CAAC;wBACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAA4B,CAAC;oBACrD,CAAC;oBAAC,WAAM,CAAC;wBACP,MAAM,IAAI,KAAK,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAC;oBAClD,CAAC;gBACH,CAAC;gBACD,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Property<{
|
|
1
|
+
export declare const insertRowAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
2
|
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
4
|
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
5
5
|
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
6
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
6
7
|
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
8
|
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
9
|
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
-
}
|
|
10
|
-
database: import("@activepieces/pieces-framework").DropdownProperty<
|
|
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<{
|
|
11
12
|
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
13
|
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
14
|
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
14
15
|
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
16
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
15
17
|
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
16
18
|
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
17
19
|
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
-
}
|
|
19
|
-
schema: import("@activepieces/pieces-framework").DropdownProperty<
|
|
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<{
|
|
20
22
|
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
21
23
|
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
22
24
|
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
23
25
|
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
26
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
24
27
|
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
25
28
|
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
26
29
|
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
27
|
-
}
|
|
28
|
-
table: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
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<{
|
|
29
32
|
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
30
33
|
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
31
34
|
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
32
35
|
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
36
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
33
37
|
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
34
38
|
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
35
39
|
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
36
|
-
}
|
|
37
|
-
table_column_values: import("@activepieces/pieces-framework").DynamicProperties<true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
40
|
+
}>)[]>;
|
|
41
|
+
table_column_values: import("@activepieces/pieces-framework").DynamicProperties<true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
38
42
|
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
39
43
|
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
40
44
|
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
41
45
|
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
46
|
+
privateKeyPassphrase: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
42
47
|
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
43
48
|
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
44
49
|
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
45
|
-
}
|
|
50
|
+
}>)[]>;
|
|
46
51
|
}>;
|
|
52
|
+
//# sourceMappingURL=insert-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-row.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/insert-row.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiC1B,CAAC"}
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.insertRowAction = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const
|
|
6
|
+
const auth_1 = require("../auth");
|
|
7
7
|
const common_1 = require("../common");
|
|
8
8
|
exports.insertRowAction = (0, pieces_framework_1.createAction)({
|
|
9
9
|
name: 'insert-row',
|
|
10
10
|
displayName: 'Insert Row',
|
|
11
11
|
description: 'Insert a row into a table.',
|
|
12
|
-
auth:
|
|
12
|
+
auth: auth_1.snowflakeAuth,
|
|
13
13
|
props: {
|
|
14
14
|
database: common_1.snowflakeCommonProps.database,
|
|
15
15
|
schema: common_1.snowflakeCommonProps.schema,
|
|
@@ -25,7 +25,7 @@ exports.insertRowAction = (0, pieces_framework_1.createAction)({
|
|
|
25
25
|
.map(() => '?')
|
|
26
26
|
.join(', ');
|
|
27
27
|
const statement = `INSERT INTO ${tableName}(${columns}) VALUES(${valuePlaceholders})`;
|
|
28
|
-
const connection = (0, common_1.configureConnection)(context.auth
|
|
28
|
+
const connection = (0, common_1.configureConnection)(context.auth);
|
|
29
29
|
yield (0, common_1.connect)(connection);
|
|
30
30
|
const response = yield (0, common_1.execute)(connection, statement, Object.values(tableColumnValues));
|
|
31
31
|
yield (0, common_1.destroy)(connection);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert-row.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"insert-row.js","sourceRoot":"","sources":["../../../../src/lib/actions/insert-row.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,kCAAwC;AACxC,sCAOmB;AAEN,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,4BAA4B;IACzC,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,mBAAmB,EAAE,6BAAoB,CAAC,mBAAmB;KAC9D;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC;YAC3C,MAAM,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC;YAEjE,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzD,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC;iBACrD,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC;iBACd,IAAI,CAAC,IAAI,CAAC,CAAC;YACd,MAAM,SAAS,GAAG,eAAe,SAAS,IAAI,OAAO,YAAY,iBAAiB,GAAG,CAAC;YAEtF,MAAM,UAAU,GAAG,IAAA,4BAAmB,EAAC,OAAO,CAAC,IAA0B,CAAC,CAAC;YAC3E,MAAM,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC;YAE1B,MAAM,QAAQ,GAAG,MAAM,IAAA,gBAAO,EAC5B,UAAU,EACV,SAAS,EACT,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CACjC,CAAC;YACF,MAAM,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC;YAE1B,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const listTablesAction: 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
|
+
}>;
|
|
32
|
+
//# sourceMappingURL=list-tables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-tables.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-tables.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqC3B,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listTablesAction = 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.listTablesAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'list_tables',
|
|
10
|
+
displayName: 'List Tables',
|
|
11
|
+
description: 'List all tables in a Snowflake schema.',
|
|
12
|
+
auth: auth_1.snowflakeAuth,
|
|
13
|
+
props: {
|
|
14
|
+
database: common_1.snowflakeCommonProps.database,
|
|
15
|
+
schema: common_1.snowflakeCommonProps.schema,
|
|
16
|
+
},
|
|
17
|
+
run(context) {
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const { database, schema } = context.propsValue;
|
|
20
|
+
const connection = (0, common_1.configureConnection)(context.auth);
|
|
21
|
+
yield (0, common_1.connect)(connection);
|
|
22
|
+
try {
|
|
23
|
+
const result = yield (0, common_1.execute)(connection, `SHOW TABLES IN SCHEMA ${database}.${schema}`, []);
|
|
24
|
+
if (!result)
|
|
25
|
+
return [];
|
|
26
|
+
return result.map((t) => {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
28
|
+
return ({
|
|
29
|
+
table_name: (_a = t['name']) !== null && _a !== void 0 ? _a : null,
|
|
30
|
+
database_name: (_b = t['database_name']) !== null && _b !== void 0 ? _b : null,
|
|
31
|
+
schema_name: (_c = t['schema_name']) !== null && _c !== void 0 ? _c : null,
|
|
32
|
+
kind: (_d = t['kind']) !== null && _d !== void 0 ? _d : null,
|
|
33
|
+
rows: (_e = t['rows']) !== null && _e !== void 0 ? _e : null,
|
|
34
|
+
bytes: (_f = t['bytes']) !== null && _f !== void 0 ? _f : null,
|
|
35
|
+
owner: (_g = t['owner']) !== null && _g !== void 0 ? _g : null,
|
|
36
|
+
comment: (_h = t['comment']) !== null && _h !== void 0 ? _h : null,
|
|
37
|
+
created_on: (_j = t['created_on']) !== null && _j !== void 0 ? _j : null,
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
yield (0, common_1.destroy)(connection);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=list-tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-tables.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-tables.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,kCAAwC;AACxC,sCAOmB;AAEN,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,wCAAwC;IACrD,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE;QACL,QAAQ,EAAE,6BAAoB,CAAC,QAAQ;QACvC,MAAM,EAAE,6BAAoB,CAAC,MAAM;KACpC;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEhD,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,EAC1B,UAAU,EACV,yBAAyB,QAAQ,IAAI,MAAM,EAAE,EAC7C,EAAE,CACH,CAAC;gBACF,IAAI,CAAC,MAAM;oBAAE,OAAO,EAAE,CAAC;gBAEvB,OAAQ,MAAoC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;;oBAAC,OAAA,CAAC;wBACvD,UAAU,EAAE,MAAA,CAAC,CAAC,MAAM,CAAC,mCAAI,IAAI;wBAC7B,aAAa,EAAE,MAAA,CAAC,CAAC,eAAe,CAAC,mCAAI,IAAI;wBACzC,WAAW,EAAE,MAAA,CAAC,CAAC,aAAa,CAAC,mCAAI,IAAI;wBACrC,IAAI,EAAE,MAAA,CAAC,CAAC,MAAM,CAAC,mCAAI,IAAI;wBACvB,IAAI,EAAE,MAAA,CAAC,CAAC,MAAM,CAAC,mCAAI,IAAI;wBACvB,KAAK,EAAE,MAAA,CAAC,CAAC,OAAO,CAAC,mCAAI,IAAI;wBACzB,KAAK,EAAE,MAAA,CAAC,CAAC,OAAO,CAAC,mCAAI,IAAI;wBACzB,OAAO,EAAE,MAAA,CAAC,CAAC,SAAS,CAAC,mCAAI,IAAI;wBAC7B,UAAU,EAAE,MAAA,CAAC,CAAC,YAAY,CAAC,mCAAI,IAAI;qBACpC,CAAC,CAAA;iBAAA,CAAC,CAAC;YACN,CAAC;oBAAS,CAAC;gBACT,MAAM,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const loadDataFromStageAction: 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
|
+
stage_path: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
42
|
+
file_format_type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
43
|
+
file_pattern: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
44
|
+
skip_header: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
45
|
+
error_on_column_count_mismatch: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
46
|
+
on_error: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
47
|
+
}>;
|
|
48
|
+
//# sourceMappingURL=load-data-from-stage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-data-from-stage.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/load-data-from-stage.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwHlC,CAAC"}
|