@aiqadam/qadam-snowflake 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/LICENSE +22 -0
  2. package/NOTICE +6 -0
  3. package/README.md +5 -0
  4. package/package.json +23 -0
  5. package/src/i18n/de.json +120 -0
  6. package/src/i18n/es.json +120 -0
  7. package/src/i18n/fr.json +120 -0
  8. package/src/i18n/ja.json +120 -0
  9. package/src/i18n/nl.json +120 -0
  10. package/src/i18n/pt.json +120 -0
  11. package/src/i18n/ru.json +16 -0
  12. package/src/i18n/translation.json +120 -0
  13. package/src/i18n/vi.json +14 -0
  14. package/src/i18n/zh.json +120 -0
  15. package/src/index.d.ts +11 -0
  16. package/src/index.d.ts.map +1 -0
  17. package/src/index.js +63 -0
  18. package/src/index.js.map +1 -0
  19. package/src/lib/actions/create-dynamic-table.d.ts +45 -0
  20. package/src/lib/actions/create-dynamic-table.d.ts.map +1 -0
  21. package/src/lib/actions/create-dynamic-table.js +82 -0
  22. package/src/lib/actions/create-dynamic-table.js.map +1 -0
  23. package/src/lib/actions/delete-row.d.ts +43 -0
  24. package/src/lib/actions/delete-row.d.ts.map +1 -0
  25. package/src/lib/actions/delete-row.js +50 -0
  26. package/src/lib/actions/delete-row.js.map +1 -0
  27. package/src/lib/actions/execute-stored-procedure.d.ts +43 -0
  28. package/src/lib/actions/execute-stored-procedure.d.ts.map +1 -0
  29. package/src/lib/actions/execute-stored-procedure.js +97 -0
  30. package/src/lib/actions/execute-stored-procedure.js.map +1 -0
  31. package/src/lib/actions/get-row-by-id.d.ts +53 -0
  32. package/src/lib/actions/get-row-by-id.d.ts.map +1 -0
  33. package/src/lib/actions/get-row-by-id.js +72 -0
  34. package/src/lib/actions/get-row-by-id.js.map +1 -0
  35. package/src/lib/actions/get-table-schema.d.ts +42 -0
  36. package/src/lib/actions/get-table-schema.d.ts.map +1 -0
  37. package/src/lib/actions/get-table-schema.js +54 -0
  38. package/src/lib/actions/get-table-schema.js.map +1 -0
  39. package/src/lib/actions/insert-multiple-rows.d.ts +43 -0
  40. package/src/lib/actions/insert-multiple-rows.d.ts.map +1 -0
  41. package/src/lib/actions/insert-multiple-rows.js +86 -0
  42. package/src/lib/actions/insert-multiple-rows.js.map +1 -0
  43. package/src/lib/actions/insert-row.d.ts +52 -0
  44. package/src/lib/actions/insert-row.d.ts.map +1 -0
  45. package/src/lib/actions/insert-row.js +41 -0
  46. package/src/lib/actions/insert-row.js.map +1 -0
  47. package/src/lib/actions/list-tables.d.ts +32 -0
  48. package/src/lib/actions/list-tables.d.ts.map +1 -0
  49. package/src/lib/actions/list-tables.js +52 -0
  50. package/src/lib/actions/list-tables.js.map +1 -0
  51. package/src/lib/actions/load-data-from-stage.d.ts +48 -0
  52. package/src/lib/actions/load-data-from-stage.d.ts.map +1 -0
  53. package/src/lib/actions/load-data-from-stage.js +124 -0
  54. package/src/lib/actions/load-data-from-stage.js.map +1 -0
  55. package/src/lib/actions/run-multiple-queries.d.ts +17 -0
  56. package/src/lib/actions/run-multiple-queries.d.ts.map +1 -0
  57. package/src/lib/actions/run-multiple-queries.js +147 -0
  58. package/src/lib/actions/run-multiple-queries.js.map +1 -0
  59. package/src/lib/actions/run-query.d.ts +16 -0
  60. package/src/lib/actions/run-query.d.ts.map +1 -0
  61. package/src/lib/actions/run-query.js +58 -0
  62. package/src/lib/actions/run-query.js.map +1 -0
  63. package/src/lib/actions/search-rows.d.ts +45 -0
  64. package/src/lib/actions/search-rows.d.ts.map +1 -0
  65. package/src/lib/actions/search-rows.js +63 -0
  66. package/src/lib/actions/search-rows.js.map +1 -0
  67. package/src/lib/actions/update-row.d.ts +53 -0
  68. package/src/lib/actions/update-row.d.ts.map +1 -0
  69. package/src/lib/actions/update-row.js +59 -0
  70. package/src/lib/actions/update-row.js.map +1 -0
  71. package/src/lib/actions/upsert-row.d.ts +62 -0
  72. package/src/lib/actions/upsert-row.d.ts.map +1 -0
  73. package/src/lib/actions/upsert-row.js +98 -0
  74. package/src/lib/actions/upsert-row.js.map +1 -0
  75. package/src/lib/auth.d.ts +22 -0
  76. package/src/lib/auth.d.ts.map +1 -0
  77. package/src/lib/auth.js +246 -0
  78. package/src/lib/auth.js.map +1 -0
  79. package/src/lib/common/index.d.ts +93 -0
  80. package/src/lib/common/index.d.ts.map +1 -0
  81. package/src/lib/common/index.js +319 -0
  82. package/src/lib/common/index.js.map +1 -0
  83. package/src/lib/triggers/new-column.d.ts +163 -0
  84. package/src/lib/triggers/new-column.d.ts.map +1 -0
  85. package/src/lib/triggers/new-column.js +94 -0
  86. package/src/lib/triggers/new-column.js.map +1 -0
  87. package/src/lib/triggers/new-or-updated-row.d.ts +203 -0
  88. package/src/lib/triggers/new-or-updated-row.d.ts.map +1 -0
  89. package/src/lib/triggers/new-or-updated-row.js +108 -0
  90. package/src/lib/triggers/new-or-updated-row.js.map +1 -0
  91. package/src/lib/triggers/new-row.d.ts +203 -0
  92. package/src/lib/triggers/new-row.d.ts.map +1 -0
  93. package/src/lib/triggers/new-row.js +107 -0
  94. package/src/lib/triggers/new-row.js.map +1 -0
  95. package/src/lib/triggers/new-table.d.ts +123 -0
  96. package/src/lib/triggers/new-table.d.ts.map +1 -0
  97. package/src/lib/triggers/new-table.js +94 -0
  98. package/src/lib/triggers/new-table.js.map +1 -0
  99. package/src/lib/triggers/new-view.d.ts +123 -0
  100. package/src/lib/triggers/new-view.d.ts.map +1 -0
  101. package/src/lib/triggers/new-view.js +94 -0
  102. package/src/lib/triggers/new-view.js.map +1 -0
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeStoredProcedureAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const qadams_framework_1 = require("@aiqadam/qadams-framework");
6
+ const auth_1 = require("../auth");
7
+ const common_1 = require("../common");
8
+ exports.executeStoredProcedureAction = (0, qadams_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
+ audience: 'both',
13
+ aiMetadata: {
14
+ description: 'Calls a named stored procedure in a Snowflake database/schema with optional positional arguments and returns its result (CALL). Use to invoke server-side procedural logic rather than ad-hoc SQL. Idempotency depends on what the procedure does internally; assume not idempotent since a procedure may mutate data or have side effects on each call.',
15
+ idempotent: false,
16
+ },
17
+ auth: auth_1.snowflakeAuth,
18
+ props: {
19
+ database: common_1.snowflakeCommonProps.database,
20
+ schema: common_1.snowflakeCommonProps.schema,
21
+ procedure_name: qadams_framework_1.Property.Dropdown({
22
+ auth: auth_1.snowflakeAuth,
23
+ displayName: 'Stored Procedure',
24
+ description: 'Select the stored procedure to call.',
25
+ refreshers: ['database', 'schema'],
26
+ required: true,
27
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, database, schema }) {
28
+ if (!auth) {
29
+ return {
30
+ disabled: true,
31
+ options: [],
32
+ placeholder: 'Please connect your account first',
33
+ };
34
+ }
35
+ if (!database || !schema) {
36
+ return {
37
+ disabled: true,
38
+ options: [],
39
+ placeholder: 'Please select a database and schema first',
40
+ };
41
+ }
42
+ const connection = (0, common_1.configureConnection)(auth);
43
+ yield (0, common_1.connect)(connection);
44
+ let result;
45
+ try {
46
+ result = yield (0, common_1.execute)(connection, `SHOW PROCEDURES IN SCHEMA ${database}.${schema}`, []);
47
+ }
48
+ finally {
49
+ yield (0, common_1.destroy)(connection);
50
+ }
51
+ return {
52
+ disabled: false,
53
+ options: result
54
+ ? result.map((proc) => {
55
+ var _a, _b, _c, _d;
56
+ return ({
57
+ label: String((_b = (_a = proc['arguments']) !== null && _a !== void 0 ? _a : proc['name']) !== null && _b !== void 0 ? _b : ''),
58
+ value: String((_d = (_c = proc['arguments']) !== null && _c !== void 0 ? _c : proc['name']) !== null && _d !== void 0 ? _d : ''),
59
+ });
60
+ })
61
+ : [],
62
+ };
63
+ }),
64
+ }),
65
+ arguments: qadams_framework_1.Property.Array({
66
+ displayName: 'Arguments',
67
+ description: 'Positional arguments to pass to the stored procedure in order. ' +
68
+ 'Leave empty if the procedure takes no arguments.',
69
+ required: false,
70
+ }),
71
+ },
72
+ run(context) {
73
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
74
+ const { database, schema, procedure_name, arguments: args, } = context.propsValue;
75
+ // procedure_name is the full signature string (e.g. "MY_PROC(NUMBER) RETURN VARCHAR")
76
+ // Extract just the bare name before the first '('
77
+ const bareName = procedure_name.includes('(')
78
+ ? procedure_name.substring(0, procedure_name.indexOf('(')).trim()
79
+ : procedure_name.trim();
80
+ const argPlaceholders = args && args.length > 0
81
+ ? args.map(() => '?').join(', ')
82
+ : '';
83
+ const sql = `CALL ${database}.${schema}.${bareName}(${argPlaceholders})`;
84
+ const binds = args && args.length > 0 ? args : [];
85
+ const connection = (0, common_1.configureConnection)(context.auth);
86
+ yield (0, common_1.connect)(connection);
87
+ try {
88
+ const result = yield (0, common_1.execute)(connection, sql, binds);
89
+ return { result: result !== null && result !== void 0 ? result : null };
90
+ }
91
+ finally {
92
+ yield (0, common_1.destroy)(connection);
93
+ }
94
+ });
95
+ },
96
+ });
97
+ //# 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,gEAAmE;AACnE,kCAAwC;AACxC,sCAOmB;AAEN,QAAA,4BAA4B,GAAG,IAAA,+BAAY,EAAC;IACvD,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,6DAA6D;IAC1E,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EACT,0VAA0V;QAC5V,UAAU,EAAE,KAAK;KAClB;IACD,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE;QACL,QAAQ,EAAE,6BAAoB,CAAC,QAAQ;QACvC,MAAM,EAAE,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AAO,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("@aiqadam/qadams-framework").IAction<(import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
2
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
3
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
4
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
5
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
6
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
7
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
8
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
9
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
10
+ }>)[], {
11
+ database: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
12
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
13
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
14
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
15
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
16
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
17
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
18
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
19
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
20
+ }>)[]>;
21
+ schema: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
22
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
23
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
24
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
25
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
26
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
27
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
28
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
29
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
30
+ }>)[]>;
31
+ table: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
32
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
33
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
34
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
35
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
36
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
37
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
38
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
39
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
40
+ }>)[]>;
41
+ id_column: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
42
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
43
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
44
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
45
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
46
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
47
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
48
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
49
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
50
+ }>)[]>;
51
+ id_value: import("@aiqadam/qadams-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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoE3B,CAAC"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRowByIdAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const qadams_framework_1 = require("@aiqadam/qadams-framework");
6
+ const auth_1 = require("../auth");
7
+ const common_1 = require("../common");
8
+ exports.getRowByIdAction = (0, qadams_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
+ audience: 'both',
13
+ aiMetadata: {
14
+ description: 'Looks up and returns a single row from a Snowflake table where the chosen ID column equals a given value (the first match, LIMIT 1). Use for a targeted point lookup by primary key or unique identifier; for multi-row or condition-based queries use Search Rows. Read-only and idempotent.',
15
+ idempotent: true,
16
+ },
17
+ auth: auth_1.snowflakeAuth,
18
+ props: {
19
+ database: common_1.snowflakeCommonProps.database,
20
+ schema: common_1.snowflakeCommonProps.schema,
21
+ table: common_1.snowflakeCommonProps.table,
22
+ id_column: qadams_framework_1.Property.Dropdown({
23
+ auth: auth_1.snowflakeAuth,
24
+ displayName: 'ID Column',
25
+ description: 'The column to search in (e.g. the primary key or unique identifier column).',
26
+ refreshers: ['table'],
27
+ required: true,
28
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, table }) {
29
+ if (!auth) {
30
+ return {
31
+ disabled: true,
32
+ options: [],
33
+ placeholder: 'Please connect your account first',
34
+ };
35
+ }
36
+ if (!table) {
37
+ return {
38
+ disabled: true,
39
+ options: [],
40
+ placeholder: 'Please select a table first',
41
+ };
42
+ }
43
+ return (0, common_1.getTableColumnOptions)(auth, table);
44
+ }),
45
+ }),
46
+ id_value: qadams_framework_1.Property.ShortText({
47
+ displayName: 'ID Value',
48
+ description: 'The value to look up in the ID column.',
49
+ required: true,
50
+ }),
51
+ },
52
+ run(context) {
53
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
54
+ const { table, id_column, id_value } = context.propsValue;
55
+ const sql = `SELECT * FROM ${table} WHERE ${id_column} = ? LIMIT 1`;
56
+ const connection = (0, common_1.configureConnection)(context.auth);
57
+ yield (0, common_1.connect)(connection);
58
+ try {
59
+ const result = yield (0, common_1.execute)(connection, sql, [id_value]);
60
+ if (!result || result.length === 0) {
61
+ return { found: false };
62
+ }
63
+ const row = result[0];
64
+ return Object.assign({ found: true }, row);
65
+ }
66
+ finally {
67
+ yield (0, common_1.destroy)(connection);
68
+ }
69
+ });
70
+ },
71
+ });
72
+ //# 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":";;;;AA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;YACf,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE1D,MAAM,GAAG,GAAG,iBAAiB,KAAK,UAAU,SAAS,cAAc,CAAC;YAEpE,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,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC1D,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBACnC,OAAO,EAAE,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("@aiqadam/qadams-framework").IAction<(import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
2
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
3
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
4
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
5
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
6
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
7
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
8
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
9
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
10
+ }>)[], {
11
+ database: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
12
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
13
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
14
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
15
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
16
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
17
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
18
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
19
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
20
+ }>)[]>;
21
+ schema: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
22
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
23
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
24
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
25
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
26
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
27
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
28
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
29
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
30
+ }>)[]>;
31
+ table: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
32
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
33
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
34
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
35
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
36
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
37
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
38
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
39
+ warehouse: import("@aiqadam/qadams-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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2C/B,CAAC"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTableSchemaAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const qadams_framework_1 = require("@aiqadam/qadams-framework");
6
+ const auth_1 = require("../auth");
7
+ const common_1 = require("../common");
8
+ exports.getTableSchemaAction = (0, qadams_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
+ audience: 'both',
13
+ aiMetadata: {
14
+ description: "Describes a Snowflake table, returning its column definitions (name, data type, nullability, default, key flags, comment) via DESCRIBE TABLE. Use to discover a table's structure before building inserts, updates, or queries against it. Read-only and idempotent.",
15
+ idempotent: true,
16
+ },
17
+ auth: auth_1.snowflakeAuth,
18
+ props: {
19
+ database: common_1.snowflakeCommonProps.database,
20
+ schema: common_1.snowflakeCommonProps.schema,
21
+ table: common_1.snowflakeCommonProps.table,
22
+ },
23
+ run(context) {
24
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
25
+ const { table } = context.propsValue;
26
+ const connection = (0, common_1.configureConnection)(context.auth);
27
+ yield (0, common_1.connect)(connection);
28
+ try {
29
+ const result = yield (0, common_1.execute)(connection, `DESCRIBE TABLE ${table}`, []);
30
+ if (!result)
31
+ return { columns: [] };
32
+ const columns = result.map((col) => {
33
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
34
+ return ({
35
+ column_name: (_a = col['name']) !== null && _a !== void 0 ? _a : null,
36
+ data_type: (_b = col['type']) !== null && _b !== void 0 ? _b : null,
37
+ nullable: (_c = col['null?']) !== null && _c !== void 0 ? _c : null,
38
+ default_value: (_d = col['default']) !== null && _d !== void 0 ? _d : null,
39
+ primary_key: (_e = col['primary key']) !== null && _e !== void 0 ? _e : null,
40
+ unique_key: (_f = col['unique key']) !== null && _f !== void 0 ? _f : null,
41
+ check: (_g = col['check']) !== null && _g !== void 0 ? _g : null,
42
+ expression: (_h = col['expression']) !== null && _h !== void 0 ? _h : null,
43
+ comment: (_j = col['comment']) !== null && _j !== void 0 ? _j : null,
44
+ });
45
+ });
46
+ return { table, columns };
47
+ }
48
+ finally {
49
+ yield (0, common_1.destroy)(connection);
50
+ }
51
+ });
52
+ },
53
+ });
54
+ //# 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,gEAAyD;AACzD,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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EACT,sQAAsQ;QACxQ,UAAU,EAAE,IAAI;KACjB;IACD,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE;QACL,QAAQ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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("@aiqadam/qadams-framework").IAction<(import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
2
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
3
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
4
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
5
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
6
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
7
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
8
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
9
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
10
+ }>)[], {
11
+ database: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
12
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
13
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
14
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
15
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
16
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
17
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
18
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
19
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
20
+ }>)[]>;
21
+ schema: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
22
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
23
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
24
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
25
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
26
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
27
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
28
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
29
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
30
+ }>)[]>;
31
+ table: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
32
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
33
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
34
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
35
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
36
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
37
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
38
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
39
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
40
+ }>)[]>;
41
+ rows: import("@aiqadam/qadams-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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0FnC,CAAC"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertMultipleRowsAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const qadams_framework_1 = require("@aiqadam/qadams-framework");
6
+ const auth_1 = require("../auth");
7
+ const common_1 = require("../common");
8
+ exports.insertMultipleRowsAction = (0, qadams_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
+ audience: 'both',
13
+ aiMetadata: {
14
+ description: 'Bulk-inserts an array of rows into a Snowflake table in one INSERT statement. Use when adding several records at once (e.g. mapping an array from a previous step); for a single record use Insert Row. Every row object must share the same set of column keys as the first row. Not idempotent: each call appends the rows again, duplicating them unless the table enforces uniqueness.',
15
+ idempotent: false,
16
+ },
17
+ auth: auth_1.snowflakeAuth,
18
+ props: {
19
+ database: common_1.snowflakeCommonProps.database,
20
+ schema: common_1.snowflakeCommonProps.schema,
21
+ table: common_1.snowflakeCommonProps.table,
22
+ rows: qadams_framework_1.Property.Array({
23
+ displayName: 'Rows',
24
+ description: 'One item per row. Each item must be a JSON object with column names as keys. ' +
25
+ 'Example: `{"name": "Alice", "age": 30}`. ' +
26
+ 'When mapping from a previous step, pass the entire array directly.',
27
+ required: true,
28
+ }),
29
+ },
30
+ run(context) {
31
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
+ var _a, _b;
33
+ const { table, rows } = context.propsValue;
34
+ if (!Array.isArray(rows) || rows.length === 0) {
35
+ throw new Error('Rows must be a non-empty array.');
36
+ }
37
+ const parsedRows = rows.map((item) => {
38
+ if (typeof item === 'string') {
39
+ try {
40
+ return JSON.parse(item);
41
+ }
42
+ catch (_a) {
43
+ throw new Error(`Invalid JSON in row: ${item}`);
44
+ }
45
+ }
46
+ return item;
47
+ });
48
+ const columns = Object.keys(parsedRows[0]);
49
+ if (columns.length === 0) {
50
+ throw new Error('Each row object must have at least one key (column name).');
51
+ }
52
+ const columnSet = new Set(columns);
53
+ parsedRows.forEach((row, i) => {
54
+ const rowKeys = Object.keys(row);
55
+ const missing = columns.filter((col) => !(col in row));
56
+ const extra = rowKeys.filter((k) => !columnSet.has(k));
57
+ if (missing.length > 0 || extra.length > 0) {
58
+ throw new Error(`Row ${i + 1} has a different column set than the first row.` +
59
+ (missing.length > 0 ? ` Missing: ${missing.join(', ')}.` : '') +
60
+ (extra.length > 0 ? ` Extra: ${extra.join(', ')}.` : ''));
61
+ }
62
+ });
63
+ const rowPlaceholders = parsedRows
64
+ .map(() => `(${columns.map(() => '?').join(', ')})`)
65
+ .join(', ');
66
+ const binds = parsedRows.flatMap((row) => columns.map((col) => row[col]));
67
+ const quotedColumns = columns
68
+ .map((col) => `"${col.replace(/"/g, '""')}"`)
69
+ .join(', ');
70
+ const sql = `INSERT INTO ${table} (${quotedColumns}) VALUES ${rowPlaceholders}`;
71
+ const connection = (0, common_1.configureConnection)(context.auth);
72
+ yield (0, common_1.connect)(connection);
73
+ try {
74
+ const result = yield (0, common_1.execute)(connection, sql, binds);
75
+ return {
76
+ success: true,
77
+ 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,
78
+ };
79
+ }
80
+ finally {
81
+ yield (0, common_1.destroy)(connection);
82
+ }
83
+ });
84
+ },
85
+ });
86
+ //# 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,gEAAmE;AACnE,kCAAwC;AACxC,sCAOmB;AAEN,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW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AO,CAAC,CAAC,GAAG,EAAE,EAAE,CACvC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CACnB,CAAC;YAEd,MAAM,aAAa,GAAG,OAAO;iBAC1B,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;iBAC5C,IAAI,CAAC,IAAI,CAAC,CAAC;YACd,MAAM,GAAG,GAAG,eAAe,KAAK,KAAK,aAAa,YAAY,eAAe,EAAE,CAAC;YAEhF,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;oBACL,OAAO,EAAE,IAAI;oBACb,aAAa,EACX,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,CAAC,CAAC,0CAAG,yBAAyB,CAAC,mCAAI,UAAU,CAAC,MAAM;iBAChE,CAAC;YACJ,CAAC;oBAAS,CAAC;gBACT,MAAM,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,52 @@
1
+ export declare const insertRowAction: import("@aiqadam/qadams-framework").IAction<(import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
2
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
3
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
4
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
5
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
6
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
7
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
8
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
9
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
10
+ }>)[], {
11
+ database: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
12
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
13
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
14
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
15
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
16
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
17
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
18
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
19
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
20
+ }>)[]>;
21
+ schema: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
22
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
23
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
24
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
25
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
26
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
27
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
28
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
29
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
30
+ }>)[]>;
31
+ table: import("@aiqadam/qadams-framework").DropdownProperty<string, true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
32
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
33
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
34
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
35
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
36
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
37
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
38
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
39
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
40
+ }>)[]>;
41
+ table_column_values: import("@aiqadam/qadams-framework").DynamicProperties<true, (import("@aiqadam/qadams-framework").OAuth2Property<import("@aiqadam/qadams-framework").OAuth2Props> | import("@aiqadam/qadams-framework").CustomAuthProperty<{
42
+ account: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
43
+ username: import("@aiqadam/qadams-framework").ShortTextProperty<true>;
44
+ password: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
45
+ privateKey: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
46
+ privateKeyPassphrase: import("@aiqadam/qadams-framework").SecretTextProperty<false>;
47
+ database: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
48
+ role: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
49
+ warehouse: import("@aiqadam/qadams-framework").ShortTextProperty<false>;
50
+ }>)[]>;
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuC1B,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertRowAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const qadams_framework_1 = require("@aiqadam/qadams-framework");
6
+ const auth_1 = require("../auth");
7
+ const common_1 = require("../common");
8
+ exports.insertRowAction = (0, qadams_framework_1.createAction)({
9
+ name: 'insert-row',
10
+ displayName: 'Insert Row',
11
+ description: 'Insert a row into a table.',
12
+ audience: 'both',
13
+ aiMetadata: {
14
+ description: 'Inserts a single new row into a specified Snowflake table (database, schema, table, and a map of column values). Use when adding one record; for many rows at once use Insert Multiple Rows. Not idempotent: each call issues an INSERT, so repeating it appends a duplicate row unless the table enforces uniqueness.',
15
+ idempotent: false,
16
+ },
17
+ auth: auth_1.snowflakeAuth,
18
+ props: {
19
+ database: common_1.snowflakeCommonProps.database,
20
+ schema: common_1.snowflakeCommonProps.schema,
21
+ table: common_1.snowflakeCommonProps.table,
22
+ table_column_values: common_1.snowflakeCommonProps.table_column_values,
23
+ },
24
+ run(context) {
25
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
+ const tableName = context.propsValue.table;
27
+ const tableColumnValues = context.propsValue.table_column_values;
28
+ const columns = Object.keys(tableColumnValues).join(',');
29
+ const valuePlaceholders = Object.keys(tableColumnValues)
30
+ .map(() => '?')
31
+ .join(', ');
32
+ const statement = `INSERT INTO ${tableName}(${columns}) VALUES(${valuePlaceholders})`;
33
+ const connection = (0, common_1.configureConnection)(context.auth);
34
+ yield (0, common_1.connect)(connection);
35
+ const response = yield (0, common_1.execute)(connection, statement, Object.values(tableColumnValues));
36
+ yield (0, common_1.destroy)(connection);
37
+ return response;
38
+ });
39
+ },
40
+ });
41
+ //# sourceMappingURL=insert-row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert-row.js","sourceRoot":"","sources":["../../../../src/lib/actions/insert-row.ts"],"names":[],"mappings":";;;;AAAA,gEAAyD;A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