windmill-components 1.700.1 → 1.700.3
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/dist/appPolicy/myFunction.es.js +1337 -0
- package/dist/sharedUtils/common.d.ts +2 -5
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/select.d.ts +0 -2
- package/dist/sharedUtils/components/apps/components/display/dbtable/utils.d.ts +3 -14
- package/dist/sharedUtils/components/apps/editor/appPolicy.d.ts +1 -1
- package/dist/sharedUtils/components/apps/editor/appUtilsS3.d.ts +1 -12
- package/dist/sharedUtils/components/apps/editor/component/components.d.ts +2 -68
- package/dist/sharedUtils/components/apps/inputType.d.ts +2 -4
- package/dist/sharedUtils/components/apps/sharedTypes.d.ts +0 -2
- package/dist/sharedUtils/components/dbTypes.d.ts +0 -3
- package/dist/sharedUtils/components/raw_apps/rawAppPolicy.d.ts +1 -1
- package/dist/sharedUtils/components/raw_apps/utils.d.ts +1 -1
- package/dist/sharedUtils/components/triggers/utils.d.ts +3 -2
- package/dist/sharedUtils/gen/schemas.gen.d.ts +71 -915
- package/dist/sharedUtils/gen/services.gen.d.ts +23 -329
- package/dist/sharedUtils/gen/types.gen.d.ts +141 -1870
- package/dist/sharedUtils/hub.d.ts +0 -1
- package/dist/sharedUtils/jsr.json +5 -5
- package/dist/sharedUtils/lib.d.ts +1 -1
- package/dist/sharedUtils/lib.es.js +79 -241
- package/dist/sharedUtils/package.json +11 -11
- package/dist/sharedUtils/stores.d.ts +0 -1
- package/dist/sharedUtils/svelte5Utils.svelte.d.ts +1 -32
- package/dist/sharedUtils/utils.d.ts +4 -19
- package/package/components/DisplayResultControlBar.svelte +26 -11
- package/package/components/JobArgs.svelte +43 -24
- package/package/components/ShareModal.svelte.d.ts +1 -1
- package/package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +0 -3
- package/package/components/copilot/CustomAIPrompts.svelte +3 -2
- package/package/components/copilot/chat/AIChatInput.svelte +2 -0
- package/package/components/copilot/chat/AIChatManager.svelte.js +52 -14
- package/package/components/copilot/chat/CreatedResourceActionDrawers.svelte +15 -0
- package/package/components/copilot/chat/ToolMessageActions.svelte +4 -2
- package/package/components/copilot/chat/app/core.js +2 -30
- package/package/components/copilot/chat/flow/core.js +13 -351
- package/package/components/copilot/chat/flow/editableFlowJson.d.ts +52 -0
- package/package/components/copilot/chat/flow/editableFlowJson.js +328 -0
- package/package/components/copilot/chat/flow/inlineScriptsUtils.js +2 -2
- package/package/components/copilot/chat/global/core.d.ts +5 -0
- package/package/components/copilot/chat/global/core.js +1739 -0
- package/package/components/copilot/chat/global/core.test.d.ts +1 -0
- package/package/components/copilot/chat/global/core.test.js +123 -0
- package/package/components/copilot/chat/global/deployRequests.d.ts +7 -0
- package/package/components/copilot/chat/global/deployRequests.js +76 -0
- package/package/components/copilot/chat/global/deployRequests.test.d.ts +1 -0
- package/package/components/copilot/chat/global/deployRequests.test.js +142 -0
- package/package/components/copilot/chat/global/draftStore.svelte.d.ts +55 -0
- package/package/components/copilot/chat/global/draftStore.svelte.js +78 -0
- package/package/components/copilot/chat/global/draftStore.test.d.ts +1 -0
- package/package/components/copilot/chat/global/draftStore.test.js +44 -0
- package/package/components/copilot/chat/global/gate.d.ts +1 -0
- package/package/components/copilot/chat/global/gate.js +27 -0
- package/package/components/copilot/chat/shared.d.ts +16 -2
- package/package/components/copilot/chat/shared.js +40 -0
- package/package/components/copilot/chat/workspaceToolsZod.gen.d.ts +28 -9
- package/package/components/copilot/chat/workspaceToolsZod.gen.js +19 -0
- package/package/components/raw_apps/templates.d.ts +77 -0
- package/package/components/raw_apps/templates.js +618 -0
- package/package/components/runs/runsFilter.d.ts +1 -1
- package/package/components/settings/AIPromptsModal.svelte +5 -2
- package/package/components/triggers/azure/AzureTriggerEditorConfigSection.svelte.d.ts +1 -1
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/schemas.gen.d.ts +37 -355
- package/package/gen/schemas.gen.js +39 -359
- package/package/gen/services.gen.d.ts +4 -280
- package/package/gen/services.gen.js +7 -565
- package/package/gen/types.gen.d.ts +77 -1135
- package/package/system_prompts/index.d.ts +2 -0
- package/package/system_prompts/index.js +8 -0
- package/package/system_prompts/prompts.d.ts +2 -0
- package/package/system_prompts/prompts.js +381 -0
- package/package/utils/downloadFile.d.ts +6 -4
- package/package/utils/downloadFile.js +9 -15
- package/package/utils_deployable.d.ts +5 -318
- package/package.json +1 -1
- package/dist/sharedUtils/components/assets/lib.d.ts +0 -25
- package/dist/sharedUtils/components/icons/index.d.ts +0 -101
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
2
|
+
"name": "@windmill-labs/shared-utils",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"exports": "./lib.es.js"
|
|
6
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { updatePolicy } from './components/apps/editor/appPolicy';
|
|
2
2
|
export { genWmillTs } from './components/raw_apps/utils';
|
|
3
3
|
export { updateRawAppPolicy } from './components/raw_apps/rawAppPolicy';
|
|
4
|
-
export * as wmillTsRaw from
|
|
4
|
+
export * as wmillTsRaw from "./rawAppWmillTs?raw";
|
|
5
5
|
export declare function capitalize(word: string): string;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __hasOwnProp = Object.prototype.hasOwnProperty, __esmMin = (c, L) => () => (c && (L = c(c = 0)), L), __commonJSMin = (c, L) => () => (L || c((L = { exports: {} }).exports, L), L.exports), __export = (
|
|
2
|
-
let
|
|
3
|
-
for (var
|
|
4
|
-
get:
|
|
1
|
+
var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __esmMin = (c, L) => () => (c && (L = c(c = 0)), L), __commonJSMin = (c, L) => () => (L || c((L = { exports: {} }).exports, L), L.exports), __export = (c) => {
|
|
2
|
+
let R = {};
|
|
3
|
+
for (var z in c) __defProp(R, z, {
|
|
4
|
+
get: c[z],
|
|
5
5
|
enumerable: !0
|
|
6
6
|
});
|
|
7
|
-
return R
|
|
8
|
-
}, __copyProps = (
|
|
9
|
-
if (
|
|
10
|
-
get: ((c) =>
|
|
11
|
-
enumerable: !(U = __getOwnPropDesc(
|
|
7
|
+
return R;
|
|
8
|
+
}, __copyProps = (c, B, H, U) => {
|
|
9
|
+
if (B && typeof B == "object" || typeof B == "function") for (var W = __getOwnPropNames(B), G = 0, K = W.length, q; G < K; G++) q = W[G], !__hasOwnProp.call(c, q) && q !== H && __defProp(c, q, {
|
|
10
|
+
get: ((c) => B[c]).bind(null, q),
|
|
11
|
+
enumerable: !(U = __getOwnPropDesc(B, q)) || U.enumerable
|
|
12
12
|
});
|
|
13
|
-
return
|
|
14
|
-
},
|
|
13
|
+
return c;
|
|
14
|
+
}, __toESM = (R, z, V) => (V = R == null ? {} : __create(__getProtoOf(R)), __copyProps(z || !R || !R.__esModule ? __defProp(V, "default", {
|
|
15
|
+
value: R,
|
|
16
|
+
enumerable: !0
|
|
17
|
+
}) : V, R)), __toCommonJS = (c) => __copyProps(__defProp({}, "__esModule", { value: !0 }), c), tslib_es6_exports = /* @__PURE__ */ __export({
|
|
15
18
|
__assign: () => __assign,
|
|
16
19
|
__asyncDelegator: () => __asyncDelegator,
|
|
17
20
|
__asyncGenerator: () => __asyncGenerator,
|
|
@@ -35,7 +38,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
35
38
|
__spread: () => __spread,
|
|
36
39
|
__spreadArrays: () => __spreadArrays,
|
|
37
40
|
__values: () => __values
|
|
38
|
-
}
|
|
41
|
+
});
|
|
39
42
|
function __extends(c, L) {
|
|
40
43
|
extendStatics(c, L);
|
|
41
44
|
function R() {
|
|
@@ -320,7 +323,7 @@ var extendStatics, __assign, init_tslib_es6 = __esmMin((() => {
|
|
|
320
323
|
}, __assign.apply(this, arguments);
|
|
321
324
|
};
|
|
322
325
|
})), require_constants = /* @__PURE__ */ __commonJSMin(((c) => {
|
|
323
|
-
Object.defineProperty(c, "__esModule", { value: !0 }), c.
|
|
326
|
+
Object.defineProperty(c, "__esModule", { value: !0 }), c.BLOCK_SIZE = 64, c.DIGEST_LENGTH = 32, c.KEY = new Uint32Array([
|
|
324
327
|
1116352408,
|
|
325
328
|
1899447441,
|
|
326
329
|
3049323471,
|
|
@@ -396,7 +399,7 @@ var extendStatics, __assign, init_tslib_es6 = __esmMin((() => {
|
|
|
396
399
|
1541459225
|
|
397
400
|
], c.MAX_HASHABLE_LENGTH = 2 ** 53 - 1;
|
|
398
401
|
})), require_RawSha256 = /* @__PURE__ */ __commonJSMin(((c) => {
|
|
399
|
-
Object.defineProperty(c, "__esModule", { value: !0 })
|
|
402
|
+
Object.defineProperty(c, "__esModule", { value: !0 });
|
|
400
403
|
var L = require_constants();
|
|
401
404
|
c.RawSha256 = function() {
|
|
402
405
|
function c() {
|
|
@@ -477,10 +480,10 @@ function toUtf8$1(c) {
|
|
|
477
480
|
var init_whatwgEncodingApi = __esmMin((() => {})), dist_es_exports = /* @__PURE__ */ __export({
|
|
478
481
|
fromUtf8: () => fromUtf8$3,
|
|
479
482
|
toUtf8: () => toUtf8$2
|
|
480
|
-
}
|
|
483
|
+
}), fromUtf8$3, toUtf8$2, init_dist_es = __esmMin((() => {
|
|
481
484
|
init_pureJs(), init_whatwgEncodingApi(), fromUtf8$3 = (c) => typeof TextEncoder == "function" ? fromUtf8$2(c) : fromUtf8$1(c), toUtf8$2 = (c) => typeof TextDecoder == "function" ? toUtf8$1(c) : toUtf8(c);
|
|
482
485
|
})), require_convertToBuffer = /* @__PURE__ */ __commonJSMin(((c) => {
|
|
483
|
-
Object.defineProperty(c, "__esModule", { value: !0 })
|
|
486
|
+
Object.defineProperty(c, "__esModule", { value: !0 });
|
|
484
487
|
var L = (init_dist_es(), __toCommonJS(dist_es_exports)), R = typeof Buffer < "u" && Buffer.from ? function(c) {
|
|
485
488
|
return Buffer.from(c, "utf8");
|
|
486
489
|
} : L.fromUtf8;
|
|
@@ -489,13 +492,13 @@ var init_whatwgEncodingApi = __esmMin((() => {})), dist_es_exports = /* @__PURE_
|
|
|
489
492
|
}
|
|
490
493
|
c.convertToBuffer = z;
|
|
491
494
|
})), require_isEmptyData = /* @__PURE__ */ __commonJSMin(((c) => {
|
|
492
|
-
Object.defineProperty(c, "__esModule", { value: !0 })
|
|
495
|
+
Object.defineProperty(c, "__esModule", { value: !0 });
|
|
493
496
|
function L(c) {
|
|
494
497
|
return typeof c == "string" ? c.length === 0 : c.byteLength === 0;
|
|
495
498
|
}
|
|
496
499
|
c.isEmptyData = L;
|
|
497
500
|
})), require_numToUint8 = /* @__PURE__ */ __commonJSMin(((c) => {
|
|
498
|
-
Object.defineProperty(c, "__esModule", { value: !0 })
|
|
501
|
+
Object.defineProperty(c, "__esModule", { value: !0 });
|
|
499
502
|
function L(c) {
|
|
500
503
|
return new Uint8Array([
|
|
501
504
|
(c & 4278190080) >> 24,
|
|
@@ -506,7 +509,7 @@ var init_whatwgEncodingApi = __esmMin((() => {})), dist_es_exports = /* @__PURE_
|
|
|
506
509
|
}
|
|
507
510
|
c.numToUint8 = L;
|
|
508
511
|
})), require_uint32ArrayFrom = /* @__PURE__ */ __commonJSMin(((c) => {
|
|
509
|
-
Object.defineProperty(c, "__esModule", { value: !0 })
|
|
512
|
+
Object.defineProperty(c, "__esModule", { value: !0 });
|
|
510
513
|
function L(c) {
|
|
511
514
|
if (!Uint32Array.from) {
|
|
512
515
|
for (var L = new Uint32Array(c.length), R = 0; R < c.length;) L[R] = c[R], R += 1;
|
|
@@ -546,7 +549,7 @@ var init_whatwgEncodingApi = __esmMin((() => {})), dist_es_exports = /* @__PURE_
|
|
|
546
549
|
}
|
|
547
550
|
});
|
|
548
551
|
})), require_jsSha256 = /* @__PURE__ */ __commonJSMin(((c) => {
|
|
549
|
-
Object.defineProperty(c, "__esModule", { value: !0 })
|
|
552
|
+
Object.defineProperty(c, "__esModule", { value: !0 });
|
|
550
553
|
var L = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)), R = require_constants(), z = require_RawSha256(), B = require_build$1();
|
|
551
554
|
c.Sha256 = function() {
|
|
552
555
|
function c(c) {
|
|
@@ -589,7 +592,7 @@ var init_whatwgEncodingApi = __esmMin((() => {})), dist_es_exports = /* @__PURE_
|
|
|
589
592
|
}
|
|
590
593
|
})), require_build = /* @__PURE__ */ __commonJSMin(((c) => {
|
|
591
594
|
Object.defineProperty(c, "__esModule", { value: !0 }), (init_tslib_es6(), __toCommonJS(tslib_es6_exports)).__exportStar(require_jsSha256(), c);
|
|
592
|
-
})), import_build$1 = require_build();
|
|
595
|
+
})), import_build$1 = /* @__PURE__ */ __toESM(require_build());
|
|
593
596
|
function wrapDucklakeQuery(c, L) {
|
|
594
597
|
let R = `ATTACH 'ducklake://${L}' AS dl;USE dl;\n`;
|
|
595
598
|
return c.replace(/^(--.*\n)*/, (c) => c + R);
|
|
@@ -719,129 +722,25 @@ function getIntrospectionQuery(c) {
|
|
|
719
722
|
let ColumnIdentity = /* @__PURE__ */ function(c) {
|
|
720
723
|
return c.ByDefault = "By Default", c.Always = "Always", c.No = "No", c;
|
|
721
724
|
}({});
|
|
722
|
-
|
|
723
|
-
postgresql: {
|
|
724
|
-
code: "SELECT table_name, column_name, udt_name, column_default, is_nullable, table_schema FROM information_schema.columns WHERE table_schema != 'pg_catalog' AND table_schema != 'information_schema'",
|
|
725
|
-
processingFn: (c) => {
|
|
726
|
-
let L = c.reduce((c, L) => {
|
|
727
|
-
let R = L.table_schema;
|
|
728
|
-
return delete L.table_schema, c[R] = c[R] || [], (L.table_name || L.column_name) && c[R].push(L), c;
|
|
729
|
-
}, {}), R = {};
|
|
730
|
-
for (let c in L) R[c] = L[c].reduce((c, L) => {
|
|
731
|
-
let R = L.table_name;
|
|
732
|
-
delete L.table_name, c[R] = c[R] || {};
|
|
733
|
-
let z = {
|
|
734
|
-
type: L.udt_name,
|
|
735
|
-
required: L.is_nullable === "NO"
|
|
736
|
-
};
|
|
737
|
-
return L.column_default && (z.default = L.column_default), c[R][L.column_name] = z, c;
|
|
738
|
-
}, {});
|
|
739
|
-
return R;
|
|
740
|
-
},
|
|
741
|
-
lang: "postgresql",
|
|
742
|
-
argName: "database"
|
|
743
|
-
},
|
|
744
|
-
mysql: {
|
|
745
|
-
code: "SELECT DATABASE() AS default_db_name, TABLE_SCHEMA, TABLE_NAME, DATA_TYPE, COLUMN_NAME, COLUMN_DEFAULT FROM information_schema.columns WHERE table_schema = DATABASE() OR table_schema NOT IN ('information_schema', 'mysql', 'performance_schema', 'sys', '_vt');",
|
|
746
|
-
processingFn: (c) => {
|
|
747
|
-
let L = c.reduce((c, L) => {
|
|
748
|
-
let R = L.TABLE_SCHEMA;
|
|
749
|
-
return delete L.TABLE_SCHEMA, c[R] = c[R] || [], c[R].push(L), c;
|
|
750
|
-
}, {}), R = {};
|
|
751
|
-
for (let c in L) R[c] = L[c].reduce((c, L) => {
|
|
752
|
-
let R = L.TABLE_NAME;
|
|
753
|
-
delete L.TABLE_NAME, c[R] = c[R] || {};
|
|
754
|
-
let z = {
|
|
755
|
-
type: L.DATA_TYPE,
|
|
756
|
-
required: L.is_nullable === "NO"
|
|
757
|
-
};
|
|
758
|
-
return L.column_default && (z.default = L.COLUMN_DEFAULT), c[R][L.COLUMN_NAME] = z, c;
|
|
759
|
-
}, {});
|
|
760
|
-
return R;
|
|
761
|
-
},
|
|
762
|
-
lang: "mysql",
|
|
763
|
-
argName: "database"
|
|
764
|
-
},
|
|
765
|
-
graphql: {
|
|
766
|
-
code: getIntrospectionQuery(),
|
|
767
|
-
lang: "graphql",
|
|
768
|
-
argName: "api"
|
|
769
|
-
},
|
|
770
|
-
bigquery: {
|
|
771
|
-
code: "import { BigQuery } from '@google-cloud/bigquery@7.5.0';\nexport async function main(args: bigquery) {\nconst bq = new BigQuery({\n credentials: args\n})\nconst [datasets] = await bq.getDatasets();\nconst schema = {}\nfor (const dataset of datasets) {\n schema[dataset.id] = {}\n const query = \"SELECT table_name, ARRAY_AGG(STRUCT(if(is_nullable = 'YES', true, false) AS required, column_name AS name, data_type AS type, if(column_default = 'NULL', null, column_default) AS `default`) ORDER BY ordinal_position) AS schema FROM `{dataset.id}`.INFORMATION_SCHEMA.COLUMNS GROUP BY table_name\".replace('{dataset.id}', dataset.id)\n const [rows] = await bq.query(query)\n for (const row of rows) {\n schema[dataset.id][row.table_name] = {}\n for (const col of row.schema) {\n const colName = col.name\n delete col.name\n if (col.default === null) {\n delete col.default\n }\n schema[dataset.id][row.table_name][colName] = col\n }\n }\n}\nreturn schema\n}",
|
|
772
|
-
lang: "bun",
|
|
773
|
-
argName: "args"
|
|
774
|
-
},
|
|
775
|
-
snowflake: {
|
|
776
|
-
code: "select TABLE_SCHEMA, TABLE_NAME, DATA_TYPE, COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE from information_schema.columns where table_schema != 'INFORMATION_SCHEMA'",
|
|
777
|
-
lang: "snowflake",
|
|
778
|
-
processingFn: (c) => {
|
|
779
|
-
let L = {};
|
|
780
|
-
for (let R of c) R.TABLE_SCHEMA in L || (L[R.TABLE_SCHEMA] = {}), R.TABLE_NAME in L[R.TABLE_SCHEMA] || (L[R.TABLE_SCHEMA][R.TABLE_NAME] = {}), L[R.TABLE_SCHEMA][R.TABLE_NAME][R.COLUMN_NAME] = {
|
|
781
|
-
type: R.DATA_TYPE,
|
|
782
|
-
required: R.IS_NULLABLE === "YES"
|
|
783
|
-
}, R.COLUMN_DEFAULT !== null && (L[R.TABLE_SCHEMA][R.TABLE_NAME][R.COLUMN_NAME].default = R.COLUMN_DEFAULT);
|
|
784
|
-
return L;
|
|
785
|
-
},
|
|
786
|
-
argName: "database"
|
|
787
|
-
},
|
|
788
|
-
snowflake_oauth: {
|
|
789
|
-
code: "select TABLE_SCHEMA, TABLE_NAME, DATA_TYPE, COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE from information_schema.columns where table_schema != 'INFORMATION_SCHEMA'",
|
|
790
|
-
lang: "snowflake",
|
|
791
|
-
processingFn: (c) => {
|
|
792
|
-
let L = {};
|
|
793
|
-
for (let R of c) R.TABLE_SCHEMA in L || (L[R.TABLE_SCHEMA] = {}), R.TABLE_NAME in L[R.TABLE_SCHEMA] || (L[R.TABLE_SCHEMA][R.TABLE_NAME] = {}), L[R.TABLE_SCHEMA][R.TABLE_NAME][R.COLUMN_NAME] = {
|
|
794
|
-
type: R.DATA_TYPE,
|
|
795
|
-
required: R.IS_NULLABLE === "YES"
|
|
796
|
-
}, R.COLUMN_DEFAULT !== null && (L[R.TABLE_SCHEMA][R.TABLE_NAME][R.COLUMN_NAME].default = R.COLUMN_DEFAULT);
|
|
797
|
-
return L;
|
|
798
|
-
},
|
|
799
|
-
argName: "database"
|
|
800
|
-
},
|
|
801
|
-
mssql: {
|
|
802
|
-
argName: "database",
|
|
803
|
-
code: "select TABLE_SCHEMA, TABLE_NAME, DATA_TYPE, COLUMN_NAME, COLUMN_DEFAULT from information_schema.columns where table_schema != 'sys'",
|
|
804
|
-
lang: "mssql",
|
|
805
|
-
processingFn: (c) => {
|
|
806
|
-
if (!c || c.length === 0) return {};
|
|
807
|
-
let L = c.reduce((c, L) => {
|
|
808
|
-
let R = L.TABLE_SCHEMA;
|
|
809
|
-
return delete L.TABLE_SCHEMA, c[R] = c[R] || [], c[R].push(L), c;
|
|
810
|
-
}, {}), R = {};
|
|
811
|
-
for (let c in L) R[c] = L[c].reduce((c, L) => {
|
|
812
|
-
let R = L.TABLE_NAME;
|
|
813
|
-
delete L.TABLE_NAME, c[R] = c[R] || {};
|
|
814
|
-
let z = {
|
|
815
|
-
type: L.DATA_TYPE,
|
|
816
|
-
required: L.is_nullable === "NO"
|
|
817
|
-
};
|
|
818
|
-
return L.column_default && (z.default = L.COLUMN_DEFAULT), c[R][L.COLUMN_NAME] = z, c;
|
|
819
|
-
}, {});
|
|
820
|
-
return R;
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
};
|
|
824
|
-
({ ...legacyScripts }), { ...legacyScripts.postgresql };
|
|
725
|
+
getIntrospectionQuery();
|
|
825
726
|
function buildVisibleFieldList(c, L) {
|
|
826
|
-
return c.filter((c) => c && c.ignored !== !0).map((c) =>
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
727
|
+
return c.filter((c) => c && c.ignored !== !0).map((c) => {
|
|
728
|
+
switch (L) {
|
|
729
|
+
case "postgresql": return `"${c?.field}"`;
|
|
730
|
+
case "ms_sql_server": return `[${c?.field}]`;
|
|
731
|
+
case "mysql": return `\`${c?.field}\``;
|
|
732
|
+
case "snowflake": return `"${c?.field}"`;
|
|
733
|
+
case "bigquery": return `\`${c?.field}\``;
|
|
734
|
+
case "duckdb": return `"${c?.field}"`;
|
|
735
|
+
default: throw Error("Unsupported database type: " + L);
|
|
736
|
+
}
|
|
737
|
+
});
|
|
838
738
|
}
|
|
839
739
|
function getLanguageByResourceType(c) {
|
|
840
740
|
return {
|
|
841
741
|
postgresql: "postgresql",
|
|
842
742
|
mysql: "mysql",
|
|
843
743
|
ms_sql_server: "mssql",
|
|
844
|
-
mssql: "mssql",
|
|
845
744
|
snowflake: "snowflake",
|
|
846
745
|
snowflake_oauth: "snowflake",
|
|
847
746
|
bigquery: "bigquery",
|
|
@@ -916,7 +815,7 @@ function getCountInput(c, L, R, z) {
|
|
|
916
815
|
return c.type === "ducklake" && (V = wrapDucklakeQuery(V, c.ducklake)), {
|
|
917
816
|
runnable: {
|
|
918
817
|
name: "AppDbExplorer",
|
|
919
|
-
type: "
|
|
818
|
+
type: "runnableByName",
|
|
920
819
|
inlineScript: {
|
|
921
820
|
content: V,
|
|
922
821
|
language: getLanguageByResourceType(B),
|
|
@@ -978,7 +877,7 @@ function getDeleteInput(c, L, R) {
|
|
|
978
877
|
return c.type === "ducklake" && (B = wrapDucklakeQuery(B, c.ducklake)), {
|
|
979
878
|
runnable: {
|
|
980
879
|
name: "AppDbExplorer",
|
|
981
|
-
type: "
|
|
880
|
+
type: "runnableByName",
|
|
982
881
|
inlineScript: {
|
|
983
882
|
content: B,
|
|
984
883
|
language: getLanguageByResourceType(z),
|
|
@@ -1037,15 +936,15 @@ function makeInsertQuery(c, L, R) {
|
|
|
1037
936
|
if (!c) throw Error("Table name is required");
|
|
1038
937
|
let z = L.filter((c) => !c.hideInsert && !(R == "postgresql" && c.defaultvalue?.startsWith("nextval("))), B = L.filter((c) => !shouldOmitColumnInInsert(c)), V = z.concat(B), H = buildParameters(z, R);
|
|
1039
938
|
H += "\n";
|
|
1040
|
-
let U = B.length > 0, W = formatColumnNames(V), G = formatInsertValues(z, R), K = formatDefaultValues(B)
|
|
1041
|
-
return
|
|
939
|
+
let U = B.length > 0, W = formatColumnNames(V), G = formatInsertValues(z, R), K = formatDefaultValues(B);
|
|
940
|
+
return H += `INSERT INTO ${c} (${W}) VALUES (${G}${U ? ", " : ""}${K})`, H;
|
|
1042
941
|
}
|
|
1043
942
|
function getInsertInput(c, L, R) {
|
|
1044
943
|
let z = c.type === "ducklake" ? "duckdb" : c.resourceType, B = makeInsertQuery(L, R, z);
|
|
1045
944
|
return c.type === "ducklake" && (B = wrapDucklakeQuery(B, c.ducklake)), {
|
|
1046
945
|
runnable: {
|
|
1047
946
|
name: "AppDbExplorer",
|
|
1048
|
-
type: "
|
|
947
|
+
type: "runnableByName",
|
|
1049
948
|
inlineScript: {
|
|
1050
949
|
content: B,
|
|
1051
950
|
language: getLanguageByResourceType(z),
|
|
@@ -1096,9 +995,9 @@ function makeSnowflakeSelectQuery(c, L, R, z) {
|
|
|
1096
995
|
CASE WHEN ? = '${c.field}' AND ? = TRUE THEN "${c.field}" END DESC`));
|
|
1097
996
|
return U += ` ORDER BY ${q.join(",\n")}`, U += ` LIMIT ${B} OFFSET ${V}`, U = buildParameters(H, "snowflake") + "\n" + U, U;
|
|
1098
997
|
}
|
|
1099
|
-
function makeSelectQuery(c, L, R, z, B
|
|
998
|
+
function makeSelectQuery(c, L, R, z, B) {
|
|
1100
999
|
if (!c) throw Error("Table name is required");
|
|
1101
|
-
let
|
|
1000
|
+
let V = "", H = buildParameters([
|
|
1102
1001
|
{
|
|
1103
1002
|
field: "limit",
|
|
1104
1003
|
datatype: z === "bigquery" ? "integer" : "int"
|
|
@@ -1120,73 +1019,30 @@ function makeSelectQuery(c, L, R, z, B, V) {
|
|
|
1120
1019
|
datatype: z === "bigquery" ? "bool" : "boolean"
|
|
1121
1020
|
}
|
|
1122
1021
|
], z);
|
|
1123
|
-
|
|
1124
|
-
let
|
|
1022
|
+
H += "\n";
|
|
1023
|
+
let U = buildVisibleFieldList(L, z), W = U.join(", ");
|
|
1125
1024
|
switch (z) {
|
|
1126
1025
|
case "mysql": {
|
|
1127
1026
|
let z = L.map((c) => `
|
|
1128
1027
|
CASE WHEN :order_by = '${c.field}' AND :is_desc IS false THEN \`${c.field}\` END,
|
|
1129
1028
|
CASE WHEN :order_by = '${c.field}' AND :is_desc IS true THEN \`${c.field}\` END DESC`).join(",\n");
|
|
1130
|
-
|
|
1029
|
+
V = ` (:quicksearch = '' OR CONCAT_WS(' ', ${U.join(", ")}) LIKE CONCAT('%', :quicksearch, '%'))`, H += `SELECT ${W} FROM ${c}`, H += ` WHERE ${R ? `${R} AND` : ""} ${V}`, H += ` ORDER BY ${z}`, H += " LIMIT :limit OFFSET :offset";
|
|
1131
1030
|
break;
|
|
1132
1031
|
}
|
|
1133
1032
|
case "postgresql": {
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
${z({
|
|
1140
|
-
field: c.field,
|
|
1141
|
-
is_desc: !1,
|
|
1142
|
-
text_cast: !0,
|
|
1143
|
-
check_is_number: !1
|
|
1144
|
-
})},
|
|
1145
|
-
${z({
|
|
1146
|
-
field: c.field,
|
|
1147
|
-
is_desc: !1,
|
|
1148
|
-
text_cast: !1,
|
|
1149
|
-
check_is_number: !0
|
|
1150
|
-
})},
|
|
1151
|
-
${z({
|
|
1152
|
-
field: c.field,
|
|
1153
|
-
is_desc: !0,
|
|
1154
|
-
text_cast: !0,
|
|
1155
|
-
check_is_number: !1
|
|
1156
|
-
})},
|
|
1157
|
-
${z({
|
|
1158
|
-
field: c.field,
|
|
1159
|
-
is_desc: !0,
|
|
1160
|
-
text_cast: !1,
|
|
1161
|
-
check_is_number: !0
|
|
1162
|
-
})}` : `
|
|
1163
|
-
${z({
|
|
1164
|
-
field: c.field,
|
|
1165
|
-
is_desc: !1,
|
|
1166
|
-
text_cast: !0
|
|
1167
|
-
})},
|
|
1168
|
-
${z({
|
|
1169
|
-
field: c.field,
|
|
1170
|
-
is_desc: !0,
|
|
1171
|
-
text_cast: !0
|
|
1172
|
-
})}`).join(",\n")}`;
|
|
1173
|
-
H = `($3 = '' OR CONCAT(${W.join(", ")}) ILIKE '%' || $3 || '%')`, U += `SELECT ${W.map((c) => `${c}::text`).join(", ")} FROM ${c}\n`, U += ` WHERE ${R ? `${R} AND` : ""} ${H}\n`, U += ` ORDER BY ${B}\n`, U += " LIMIT $1::INT OFFSET $2::INT";
|
|
1033
|
+
let z = `
|
|
1034
|
+
${L.map((c) => `
|
|
1035
|
+
(CASE WHEN $4 = '${c.field}' AND $5 IS false THEN "${c.field}"::text END),
|
|
1036
|
+
(CASE WHEN $4 = '${c.field}' AND $5 IS true THEN "${c.field}"::text END) DESC`).join(",\n")}`;
|
|
1037
|
+
V = `($3 = '' OR CONCAT(${U.join(", ")}) ILIKE '%' || $3 || '%')`, H += `SELECT ${U.map((c) => `${c}::text`).join(", ")} FROM ${c}\n`, H += ` WHERE ${R ? `${R} AND` : ""} ${V}\n`, H += ` ORDER BY ${z}\n`, H += " LIMIT $1::INT OFFSET $2::INT";
|
|
1174
1038
|
break;
|
|
1175
1039
|
}
|
|
1176
|
-
case "ms_sql_server":
|
|
1177
|
-
let z =
|
|
1178
|
-
"text",
|
|
1179
|
-
"ntext",
|
|
1180
|
-
"image"
|
|
1181
|
-
], B = L.filter((c) => !z.includes(c.datatype.toLowerCase())).map((c) => `
|
|
1040
|
+
case "ms_sql_server":
|
|
1041
|
+
let z = L.map((c) => `
|
|
1182
1042
|
(CASE WHEN @p4 = '${c.field}' AND @p5 = 0 THEN ${c.field} END) ASC,
|
|
1183
|
-
(CASE WHEN @p4 = '${c.field}' AND @p5 = 1 THEN ${c.field} END) DESC`).join(",\n")
|
|
1184
|
-
|
|
1185
|
-
return !z.includes(B?.datatype.toLowerCase() ?? "");
|
|
1186
|
-
}).join(", ");
|
|
1187
|
-
H = V ? ` (@p3 = '' OR CONCAT(${V}) LIKE '%' + @p3 + '%')` : " (@p3 = '')", U += `SELECT ${G} FROM ${c}`, U += ` WHERE ${R ? `${R} AND` : ""} ${H}`, U += ` ORDER BY ${B}`, U += " OFFSET @p2 ROWS FETCH NEXT @p1 ROWS ONLY";
|
|
1043
|
+
(CASE WHEN @p4 = '${c.field}' AND @p5 = 1 THEN ${c.field} END) DESC`).join(",\n");
|
|
1044
|
+
V = ` (@p3 = '' OR CONCAT(${W}) LIKE '%' + @p3 + '%')`, H += `SELECT ${W} FROM ${c}`, H += ` WHERE ${R ? `${R} AND` : ""} ${V}`, H += ` ORDER BY ${z}`, H += " OFFSET @p2 ROWS FETCH NEXT @p1 ROWS ONLY";
|
|
1188
1045
|
break;
|
|
1189
|
-
}
|
|
1190
1046
|
case "snowflake": return makeSnowflakeSelectQuery(c, L, R, B);
|
|
1191
1047
|
case "bigquery": {
|
|
1192
1048
|
let z = L.map((c) => c.datatype === "JSON" || c.datatype.startsWith("STRUCT") || c.datatype.startsWith("ARRAY") || c.datatype === "GEOGRAPHY" ? `
|
|
@@ -1194,10 +1050,10 @@ CASE WHEN :order_by = '${c.field}' AND :is_desc IS true THEN \`${c.field}\` END
|
|
|
1194
1050
|
(CASE WHEN @order_by = '${c.field}' AND @is_desc = true THEN TO_JSON_STRING(${c.field}) END) DESC` : `
|
|
1195
1051
|
(CASE WHEN @order_by = '${c.field}' AND @is_desc = false THEN ${c.field} END) ASC,
|
|
1196
1052
|
(CASE WHEN @order_by = '${c.field}' AND @is_desc = true THEN ${c.field} END) DESC`).join(",\n");
|
|
1197
|
-
|
|
1053
|
+
V = ` (@quicksearch = '' OR REGEXP_CONTAINS(CONCAT(${U.map((c) => {
|
|
1198
1054
|
let R = L.find((L) => L.field === c.slice(1, -1));
|
|
1199
1055
|
return R?.datatype === "JSON" || R?.datatype.startsWith("STRUCT") || R?.datatype.startsWith("ARRAY") || R?.datatype === "GEOGRAPHY" ? `TO_JSON_STRING(${c})` : `CAST(${c} AS STRING)`;
|
|
1200
|
-
}).join(",")}), '(?i)' || @quicksearch))`,
|
|
1056
|
+
}).join(",")}), '(?i)' || @quicksearch))`, H += `SELECT ${W} FROM ${c}`, H += ` WHERE ${R ? `${R} AND` : ""} ${V}`, H += ` ORDER BY ${z}`, H += " LIMIT @limit OFFSET @offset";
|
|
1201
1057
|
break;
|
|
1202
1058
|
}
|
|
1203
1059
|
case "duckdb": {
|
|
@@ -1205,12 +1061,12 @@ CASE WHEN :order_by = '${c.field}' AND :is_desc IS true THEN \`${c.field}\` END
|
|
|
1205
1061
|
${L.map((c) => `
|
|
1206
1062
|
(CASE WHEN $order_by = '${c.field}' AND $is_desc IS false THEN "${c.field}"::text END),
|
|
1207
1063
|
(CASE WHEN $order_by = '${c.field}' AND $is_desc IS true THEN "${c.field}"::text END) DESC`).join(",\n")}`;
|
|
1208
|
-
|
|
1064
|
+
V = `($quicksearch = '' OR CONCAT(${U.join(", ")}) ILIKE '%' || $quicksearch || '%')`, H += `SELECT ${U.join(", ")} FROM ${c}\n`, H += ` WHERE ${R ? `${R} AND` : ""} ${V}\n`, H += ` ORDER BY ${z}\n`, H += " LIMIT $limit::INT OFFSET $offset::INT";
|
|
1209
1065
|
break;
|
|
1210
1066
|
}
|
|
1211
1067
|
default: throw Error("Unsupported database type");
|
|
1212
1068
|
}
|
|
1213
|
-
return
|
|
1069
|
+
return H;
|
|
1214
1070
|
}
|
|
1215
1071
|
function coerceToNumber(c) {
|
|
1216
1072
|
return typeof c == "number" ? c : typeof c == "string" ? parseInt(c, 10) : 0;
|
|
@@ -1221,7 +1077,7 @@ function getSelectInput(c, L, R, z, B) {
|
|
|
1221
1077
|
return c.type === "ducklake" && (H = wrapDucklakeQuery(H, c.ducklake)), {
|
|
1222
1078
|
runnable: {
|
|
1223
1079
|
name: "AppDbExplorer",
|
|
1224
|
-
type: "
|
|
1080
|
+
type: "runnableByName",
|
|
1225
1081
|
inlineScript: {
|
|
1226
1082
|
content: H,
|
|
1227
1083
|
language: getLanguageByResourceType(V)
|
|
@@ -1277,7 +1133,7 @@ function getUpdateInput(c, L, R, z) {
|
|
|
1277
1133
|
return c.type === "ducklake" && (V = wrapDucklakeQuery(V, c.ducklake)), {
|
|
1278
1134
|
runnable: {
|
|
1279
1135
|
name: "AppDbExplorer",
|
|
1280
|
-
type: "
|
|
1136
|
+
type: "runnableByName",
|
|
1281
1137
|
inlineScript: {
|
|
1282
1138
|
content: V,
|
|
1283
1139
|
language: getLanguageByResourceType(B),
|
|
@@ -1299,12 +1155,6 @@ function getUpdateInput(c, L, R, z) {
|
|
|
1299
1155
|
fieldType: "object"
|
|
1300
1156
|
};
|
|
1301
1157
|
}
|
|
1302
|
-
function isRunnableByPath(c) {
|
|
1303
|
-
return c?.type == "runnableByPath" || c?.type == "path";
|
|
1304
|
-
}
|
|
1305
|
-
function isRunnableByName(c) {
|
|
1306
|
-
return c?.type == "runnableByName" || c?.type == "inline";
|
|
1307
|
-
}
|
|
1308
1158
|
function findGridItemById(c, L, R) {
|
|
1309
1159
|
for (let z of allItems(c, L)) if (z.id === R) return z;
|
|
1310
1160
|
}
|
|
@@ -1368,7 +1218,7 @@ function computeS3FileInputPolicy(c, L) {
|
|
|
1368
1218
|
function isPartialS3Object(c) {
|
|
1369
1219
|
return typeof c == "object" && !!c && typeof c.s3 == "string";
|
|
1370
1220
|
}
|
|
1371
|
-
function
|
|
1221
|
+
function computeS3ImageViewerPolicy(c) {
|
|
1372
1222
|
if (c.source.type === "uploadS3" && isPartialS3Object(c.source.value)) return {
|
|
1373
1223
|
s3_path: c.source.value.s3,
|
|
1374
1224
|
storage: c.source.value.storage
|
|
@@ -1390,7 +1240,7 @@ async function hash(c) {
|
|
|
1390
1240
|
return L.update(c ?? ""), Array.from(await L.digest()).map((c) => c.toString(16).padStart(2, "0")).join("");
|
|
1391
1241
|
}
|
|
1392
1242
|
}
|
|
1393
|
-
var import_build = require_build();
|
|
1243
|
+
var import_build = /* @__PURE__ */ __toESM(require_build());
|
|
1394
1244
|
async function updatePolicy(c, L) {
|
|
1395
1245
|
let R = allItems(c.grid, c.subgrids), z = await Promise.all(R.flatMap((L) => {
|
|
1396
1246
|
let R = L.data, z = [{
|
|
@@ -1453,13 +1303,13 @@ async function updatePolicy(c, L) {
|
|
|
1453
1303
|
R.findIndex((c) => {
|
|
1454
1304
|
let L = c.data;
|
|
1455
1305
|
if (L.type === "schemaformcomponent" || L.type === "formbuttoncomponent" || L.type === "formcomponent") {
|
|
1456
|
-
let c = L.type === "schemaformcomponent" ? L.componentInput?.value?.properties :
|
|
1306
|
+
let c = L.type === "schemaformcomponent" ? L.componentInput?.value?.properties : L.componentInput?.runnable?.type === "runnableByName" ? L.componentInput?.runnable?.inlineScript?.schema?.properties : L.componentInput?.runnable?.schema?.properties;
|
|
1457
1307
|
return Object.values(c ?? {}).findIndex((c) => c?.type === "object" && c?.format === "resource-s3_object" || c?.type === "array" && (c?.items?.resourceType === "s3object" || c?.items?.resourceType === "s3_object")) !== -1;
|
|
1458
1308
|
} else return !1;
|
|
1459
1309
|
}) !== -1 && V.push(computeWorkspaceS3FileInputPolicy());
|
|
1460
|
-
let H = R.filter((c) => c.data.type === "imagecomponent"
|
|
1310
|
+
let H = R.filter((c) => c.data.type === "imagecomponent").map((c) => {
|
|
1461
1311
|
let L = c.data.configuration;
|
|
1462
|
-
return
|
|
1312
|
+
return computeS3ImageViewerPolicy(L);
|
|
1463
1313
|
}).filter(Boolean);
|
|
1464
1314
|
return {
|
|
1465
1315
|
...L ?? {},
|
|
@@ -1470,14 +1320,14 @@ async function updatePolicy(c, L) {
|
|
|
1470
1320
|
}
|
|
1471
1321
|
async function processRunnable$1(c, L, R, z) {
|
|
1472
1322
|
let B = collectStaticFields(R), V = collectOneOfFields(R, z), H = Object.entries(R).map(([c, L]) => L.allowUserResources ? c : void 0).filter(Boolean);
|
|
1473
|
-
if (
|
|
1323
|
+
if (L?.type == "runnableByName") {
|
|
1474
1324
|
let R = await hash$1(L.inlineScript?.content);
|
|
1475
1325
|
return console.debug("hex", R, c), [`${c}:rawscript/${R}`, {
|
|
1476
1326
|
static_inputs: B,
|
|
1477
1327
|
one_of_inputs: V,
|
|
1478
1328
|
allow_user_resources: H
|
|
1479
1329
|
}];
|
|
1480
|
-
} else if (
|
|
1330
|
+
} else if (L?.type == "runnableByPath") return [`${c}:${L.runType === "hubscript" ? "script" : L.runType}/${L.path}`, {
|
|
1481
1331
|
static_inputs: B,
|
|
1482
1332
|
one_of_inputs: V,
|
|
1483
1333
|
allow_user_resources: H
|
|
@@ -1507,18 +1357,20 @@ function removeStaticFields(c, L) {
|
|
|
1507
1357
|
};
|
|
1508
1358
|
}
|
|
1509
1359
|
function hiddenRunnableToTsType(c) {
|
|
1510
|
-
return
|
|
1360
|
+
return c?.type == "runnableByName" ? c?.inlineScript?.schema ? schemaToTsType(removeStaticFields(c?.inlineScript?.schema, c?.fields ?? {})) : "{}" : c?.type == "runnableByPath" ? schemaToTsType(removeStaticFields(c?.schema, c?.fields ?? {})) : "{}";
|
|
1511
1361
|
}
|
|
1512
1362
|
function genWmillTs(c) {
|
|
1513
1363
|
return `// THIS FILE IS READ-ONLY
|
|
1514
1364
|
// AND GENERATED AUTOMATICALLY FROM YOUR RUNNABLES
|
|
1515
1365
|
|
|
1516
|
-
export
|
|
1517
|
-
|
|
1366
|
+
${Object.entries(c).map(([c, L]) => `export type RunBg${capitalize(c)} = ${hiddenRunnableToTsType(L)};`).join("\n\n")}
|
|
1367
|
+
|
|
1368
|
+
export declare const runBg: {
|
|
1369
|
+
${Object.keys(c).map((c) => ` ${c}: (data: RunBg${capitalize(c)}) => Promise<any>;`).join("\n")}
|
|
1518
1370
|
};
|
|
1519
1371
|
|
|
1520
|
-
export declare const
|
|
1521
|
-
${Object.
|
|
1372
|
+
export declare const runBgAsync: {
|
|
1373
|
+
${Object.keys(c).map((c) => ` ${c}: (data: RunBg${capitalize(c)}) => Promise<string>;`).join("\n")}
|
|
1522
1374
|
};
|
|
1523
1375
|
|
|
1524
1376
|
export type Job = {
|
|
@@ -1543,24 +1395,10 @@ export declare function waitJob(id: string): Promise<Job>;
|
|
|
1543
1395
|
* @param id
|
|
1544
1396
|
*/
|
|
1545
1397
|
export declare function getJob(id: string): Promise<Job>;
|
|
1546
|
-
|
|
1547
|
-
export type StreamUpdate = {
|
|
1548
|
-
new_result_stream?: string;
|
|
1549
|
-
stream_offset?: number;
|
|
1550
|
-
};
|
|
1551
|
-
|
|
1552
|
-
/**
|
|
1553
|
-
* Stream job results using SSE. Calls onUpdate for each stream update,
|
|
1554
|
-
* and resolves with the final result when the job completes.
|
|
1555
|
-
* @param id - The job ID to stream
|
|
1556
|
-
* @param onUpdate - Optional callback for stream updates with new_result_stream data
|
|
1557
|
-
* @returns Promise that resolves with the final job result
|
|
1558
|
-
*/
|
|
1559
|
-
export declare function streamJob(id: string, onUpdate?: (data: StreamUpdate) => void): Promise<any>;
|
|
1560
1398
|
`;
|
|
1561
1399
|
}
|
|
1562
1400
|
async function updateRawAppPolicy(c, L) {
|
|
1563
|
-
let R = Object.fromEntries(await Promise.all(Object.
|
|
1401
|
+
let R = Object.fromEntries(await Promise.all(Object.values(c).map(async (c) => await processRunnable(c?.name ?? "", c, c?.fields ?? {}))));
|
|
1564
1402
|
return {
|
|
1565
1403
|
...L,
|
|
1566
1404
|
triggerables_v2: R
|
|
@@ -1568,20 +1406,20 @@ async function updateRawAppPolicy(c, L) {
|
|
|
1568
1406
|
}
|
|
1569
1407
|
async function processRunnable(c, L, R) {
|
|
1570
1408
|
let z = collectStaticFields(R), B = Object.entries(R).map(([c, L]) => L.allowUserResources ? c : void 0).filter(Boolean);
|
|
1571
|
-
if (
|
|
1409
|
+
if (L?.type == "runnableByName") {
|
|
1572
1410
|
let R = await hash(L.inlineScript?.content);
|
|
1573
1411
|
return console.log("hex", R, c), [`${c}:rawscript/${R}`, {
|
|
1574
1412
|
static_inputs: z,
|
|
1575
1413
|
one_of_inputs: {},
|
|
1576
1414
|
allow_user_resources: B
|
|
1577
1415
|
}];
|
|
1578
|
-
} else if (
|
|
1416
|
+
} else if (L?.type == "runnableByPath") return [`${c}:${L.runType === "hubscript" ? "script" : L.runType}/${L.path}`, {
|
|
1579
1417
|
static_inputs: z,
|
|
1580
1418
|
one_of_inputs: {},
|
|
1581
1419
|
allow_user_resources: B
|
|
1582
1420
|
}];
|
|
1583
1421
|
}
|
|
1584
|
-
var rawAppWmillTs_exports = /* @__PURE__ */ __export({ default: () => rawAppWmillTs_default }
|
|
1422
|
+
var rawAppWmillTs_exports = /* @__PURE__ */ __export({ default: () => rawAppWmillTs_default }), rawAppWmillTs_default = "let reqs: Record<string, any> = {}\n\nfunction doRequest(type: string, o: object) {\n return new Promise((resolve, reject) => {\n const reqId = Math.random().toString(36)\n reqs[reqId] = { resolve, reject }\n parent.postMessage({ ...o, type, reqId }, '*')\n })\n}\n\nexport const runBg = new Proxy(\n {},\n {\n get(_, runnable_id: string) {\n return (v: any) => {\n return doRequest('runBg', { runnable_id, v })\n }\n }\n })\n\nexport const runBgAsync = new Proxy(\n {},\n {\n get(_, runnable_id: string) {\n return (v: any) => {\n return doRequest('runBgAsync', { runnable_id, v })\n }\n }\n })\n\nexport function waitJob(jobId: string) {\n return doRequest('waitJob', { jobId })\n}\n\nexport function getJob(jobId: string) {\n return doRequest('getJob', { jobId })\n}\n\n\nwindow.addEventListener('message', (e) => {\n if (e.data.type == 'runBgRes' || e.data.type == 'runBgAsyncRes') {\n console.log('Message from parent runBg', e.data)\n let job = reqs[e.data.reqId]\n if (job) {\n const result = e.data.result\n if (e.data.error) {\n job.reject(new Error(result.stack ?? result.message))\n } else {\n job.resolve(result)\n }\n } else {\n console.error('No job found for', e.data.reqId)\n }\n }\n})";
|
|
1585
1423
|
function capitalize(c) {
|
|
1586
1424
|
return c ? c.charAt(0).toUpperCase() + c.slice(1) : "";
|
|
1587
1425
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
2
|
+
"name": "@windmill-labs/shared-utils",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "./lib.es.js",
|
|
7
|
+
"module": "./lib.es.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./lib.es.js"
|
|
10
|
+
},
|
|
11
|
+
"types": "./lib.d.ts"
|
|
12
|
+
}
|
|
@@ -27,7 +27,6 @@ export interface UserWorkspace {
|
|
|
27
27
|
export declare function getWorkspaceFromStorage(): string | undefined;
|
|
28
28
|
export declare function clearWorkspaceFromStorage(): void;
|
|
29
29
|
export declare const tutorialsToDo: import("svelte/store").Writable<number[]>;
|
|
30
|
-
export declare const skippedAll: import("svelte/store").Writable<boolean>;
|
|
31
30
|
export declare const globalEmailInvite: import("svelte/store").Writable<string>;
|
|
32
31
|
export declare const awarenessStore: import("svelte/store").Writable<Record<string, string>>;
|
|
33
32
|
export declare const enterpriseLicense: import("svelte/store").Writable<string | undefined>;
|