@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
package/package.json
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-snowflake",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"main": "./src/index.js",
|
|
5
|
+
"types": "./src/index.d.ts",
|
|
4
6
|
"dependencies": {
|
|
5
|
-
"@
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"nanoid": "3.3.8",
|
|
9
|
-
"semver": "7.6.0",
|
|
7
|
+
"@activepieces/pieces-common": "0.12.0",
|
|
8
|
+
"@activepieces/pieces-framework": "0.26.0",
|
|
9
|
+
"@activepieces/shared": "0.46.0",
|
|
10
10
|
"snowflake-sdk": "2.3.4",
|
|
11
|
-
"socket.io-client": "4.8.1",
|
|
12
|
-
"@activepieces/pieces-framework": "0.25.4",
|
|
13
|
-
"@activepieces/shared": "0.37.0",
|
|
14
11
|
"tslib": "2.6.2"
|
|
15
12
|
},
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"main": "./src/index.js",
|
|
21
|
-
"type": "commonjs"
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
15
|
+
"lint": "eslint 'src/**/*.ts'"
|
|
16
|
+
}
|
|
22
17
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const snowflake: import("@activepieces/pieces-framework").Piece<(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
|
-
|
|
11
|
-
account: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
14
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
15
|
-
database: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
16
|
-
role: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
17
|
-
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
-
}>>;
|
|
10
|
+
}>)[]>;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,SAAS;;;;;;;;;MA+BpB,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -1,72 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.snowflake =
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
3
|
+
exports.snowflake = void 0;
|
|
5
4
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
5
|
const run_multiple_queries_1 = require("./lib/actions/run-multiple-queries");
|
|
7
6
|
const run_query_1 = require("./lib/actions/run-query");
|
|
8
7
|
const shared_1 = require("@activepieces/shared");
|
|
9
8
|
const insert_row_1 = require("./lib/actions/insert-row");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
password: pieces_framework_1.PieceAuth.SecretText({
|
|
23
|
-
displayName: 'Password',
|
|
24
|
-
description: 'Password for the user.',
|
|
25
|
-
required: false,
|
|
26
|
-
}),
|
|
27
|
-
privateKey: pieces_framework_1.PieceAuth.SecretText({
|
|
28
|
-
displayName: 'Private Key',
|
|
29
|
-
description: 'The private key to authenticate with. Either this or password is required',
|
|
30
|
-
required: false,
|
|
31
|
-
}),
|
|
32
|
-
database: pieces_framework_1.Property.ShortText({
|
|
33
|
-
displayName: 'Database',
|
|
34
|
-
description: 'The default database to use for the session after connecting.',
|
|
35
|
-
required: false,
|
|
36
|
-
}),
|
|
37
|
-
role: pieces_framework_1.Property.ShortText({
|
|
38
|
-
displayName: 'Role',
|
|
39
|
-
description: 'The default security role to use for the session after connecting.',
|
|
40
|
-
required: false,
|
|
41
|
-
}),
|
|
42
|
-
warehouse: pieces_framework_1.Property.ShortText({
|
|
43
|
-
displayName: 'Warehouse',
|
|
44
|
-
description: 'The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.',
|
|
45
|
-
required: false,
|
|
46
|
-
}),
|
|
47
|
-
},
|
|
48
|
-
required: true,
|
|
49
|
-
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
50
|
-
if (!auth.password && !auth.privateKey) {
|
|
51
|
-
return {
|
|
52
|
-
valid: false,
|
|
53
|
-
error: 'Either password or private key must be provided for authentication.',
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
valid: true,
|
|
58
|
-
};
|
|
59
|
-
}),
|
|
60
|
-
});
|
|
9
|
+
const update_row_1 = require("./lib/actions/update-row");
|
|
10
|
+
const delete_row_1 = require("./lib/actions/delete-row");
|
|
11
|
+
const upsert_row_1 = require("./lib/actions/upsert-row");
|
|
12
|
+
const insert_multiple_rows_1 = require("./lib/actions/insert-multiple-rows");
|
|
13
|
+
const get_row_by_id_1 = require("./lib/actions/get-row-by-id");
|
|
14
|
+
const search_rows_1 = require("./lib/actions/search-rows");
|
|
15
|
+
const get_table_schema_1 = require("./lib/actions/get-table-schema");
|
|
16
|
+
const list_tables_1 = require("./lib/actions/list-tables");
|
|
17
|
+
const execute_stored_procedure_1 = require("./lib/actions/execute-stored-procedure");
|
|
18
|
+
const create_dynamic_table_1 = require("./lib/actions/create-dynamic-table");
|
|
19
|
+
const load_data_from_stage_1 = require("./lib/actions/load-data-from-stage");
|
|
20
|
+
const auth_1 = require("./lib/auth");
|
|
61
21
|
exports.snowflake = (0, pieces_framework_1.createPiece)({
|
|
62
22
|
displayName: 'Snowflake',
|
|
63
23
|
description: 'Data warehouse built for the cloud',
|
|
64
|
-
auth:
|
|
24
|
+
auth: auth_1.snowflakeAuth,
|
|
65
25
|
minimumSupportedRelease: '0.27.1',
|
|
66
26
|
logoUrl: 'https://cdn.activepieces.com/pieces/snowflake.png',
|
|
67
27
|
categories: [shared_1.PieceCategory.DEVELOPER_TOOLS],
|
|
68
|
-
authors: [
|
|
69
|
-
|
|
28
|
+
authors: [
|
|
29
|
+
'AdamSelene',
|
|
30
|
+
'abuaboud',
|
|
31
|
+
'valentin-mourtialon',
|
|
32
|
+
'onyedikachi-david',
|
|
33
|
+
],
|
|
34
|
+
actions: [
|
|
35
|
+
run_query_1.runQuery,
|
|
36
|
+
run_multiple_queries_1.runMultipleQueries,
|
|
37
|
+
insert_row_1.insertRowAction,
|
|
38
|
+
update_row_1.updateRowAction,
|
|
39
|
+
delete_row_1.deleteRowAction,
|
|
40
|
+
upsert_row_1.upsertRowAction,
|
|
41
|
+
insert_multiple_rows_1.insertMultipleRowsAction,
|
|
42
|
+
get_row_by_id_1.getRowByIdAction,
|
|
43
|
+
search_rows_1.searchRowsAction,
|
|
44
|
+
get_table_schema_1.getTableSchemaAction,
|
|
45
|
+
list_tables_1.listTablesAction,
|
|
46
|
+
execute_stored_procedure_1.executeStoredProcedureAction,
|
|
47
|
+
create_dynamic_table_1.createDynamicTableAction,
|
|
48
|
+
load_data_from_stage_1.loadDataFromStageAction,
|
|
49
|
+
],
|
|
70
50
|
triggers: [],
|
|
71
51
|
});
|
|
72
52
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,qEAIwC;AACxC,6EAAwE;AACxE,uDAAmD;AACnD,iDAAqD;AACrD,yDAA2D;AAC3D,yDAA2D;AAC3D,yDAA2D;AAC3D,yDAA2D;AAC3D,6EAA8E;AAC9E,+DAA+D;AAC/D,2DAA6D;AAC7D,qEAAsE;AACtE,2DAA6D;AAC7D,qFAAsF;AACtF,6EAA8E;AAC9E,6EAA6E;AAC7E,qCAA2C;AAE9B,QAAA,SAAS,GAAG,IAAA,8BAAW,EAAC;IACnC,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,oCAAoC;IAEjD,IAAI,EAAE,oBAAa;IACnB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,mDAAmD;IAC5D,UAAU,EAAE,CAAC,sBAAa,CAAC,eAAe,CAAC;IAC3C,OAAO,EAAE;QACP,YAAY;QACZ,UAAU;QACV,qBAAqB;QACrB,mBAAmB;KACpB;IACD,OAAO,EAAE;QACP,oBAAQ;QACR,yCAAkB;QAClB,4BAAe;QACf,4BAAe;QACf,4BAAe;QACf,4BAAe;QACf,+CAAwB;QACxB,gCAAgB;QAChB,8BAAgB;QAChB,uCAAoB;QACpB,8BAAgB;QAChB,uDAA4B;QAC5B,+CAAwB;QACxB,8CAAuB;KACxB;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const createDynamicTableAction: 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_name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
32
|
+
target_lag: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
33
|
+
warehouse: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
34
|
+
query: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
35
|
+
}>;
|
|
36
|
+
//# sourceMappingURL=create-dynamic-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-dynamic-table.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-dynamic-table.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqFnC,CAAC"}
|
|
@@ -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;QA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AS,CAAA,CAAC;YACrE,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CACb,8FAA8F,CAC/F,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC;gBAC9C,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;YACJ,CAAC;YAED,MAAM,GAAG,GAAG;kCACkB,QAAQ,IAAI,MAAM,IAAI,UAAU;kBAChD,UAAU;gBACZ,kBAAkB;OAC3B,KAAK;KACP,CAAC,IAAI,EAAE,CAAC;YAET,MAAM,UAAU,GAAG,IAAA,4BAAmB,EAAC,OAAO,CAAC,IAA0B,CAAC,CAAC;YAC3E,MAAM,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC;YAC1B,IAAI,CAAC;gBACH,MAAM,IAAA,gBAAO,EAAC,UAAU,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;gBACnC,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,GAAG,QAAQ,IAAI,MAAM,IAAI,UAAU,EAAE;oBAC5C,UAAU;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
|
+
//# sourceMapp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AO,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;IACvD,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,6DAA6D;IAC1E,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE;QACL,QAAQ,EAAE,6BAAoB,CAAC,QAAQ;QACvC,MAAM,EAAE,6BAAoB,CAAC,MAAM;QACnC,cAAc,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAChC,IAAI,EAAE,oBAAa;YACnB,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EAAE,sCAAsC;YACnD,UAAU,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;YAClC,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,KAAmC,EAAE,oDAA9B,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE;gBACxC,IAAI,CAAC,IAAI,EAAE,CAAC;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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"}
|