@uipath/codedapp-convert-sdk 0.1.0-beta.1 → 0.1.0-beta.2
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/index.js
CHANGED
|
@@ -35,9 +35,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
35
|
mod
|
|
36
36
|
));
|
|
37
37
|
|
|
38
|
-
//
|
|
38
|
+
// ../../node_modules/adm-zip/util/constants.js
|
|
39
39
|
var require_constants = __commonJS({
|
|
40
|
-
"
|
|
40
|
+
"../../node_modules/adm-zip/util/constants.js"(exports, module) {
|
|
41
41
|
module.exports = {
|
|
42
42
|
/* The local file header */
|
|
43
43
|
LOCHDR: 30,
|
|
@@ -254,9 +254,9 @@ var require_constants = __commonJS({
|
|
|
254
254
|
}
|
|
255
255
|
});
|
|
256
256
|
|
|
257
|
-
//
|
|
257
|
+
// ../../node_modules/adm-zip/util/errors.js
|
|
258
258
|
var require_errors = __commonJS({
|
|
259
|
-
"
|
|
259
|
+
"../../node_modules/adm-zip/util/errors.js"(exports) {
|
|
260
260
|
var errors = {
|
|
261
261
|
/* Header error messages */
|
|
262
262
|
INVALID_LOC: "Invalid LOC header (bad signature)",
|
|
@@ -314,9 +314,9 @@ var require_errors = __commonJS({
|
|
|
314
314
|
}
|
|
315
315
|
});
|
|
316
316
|
|
|
317
|
-
//
|
|
317
|
+
// ../../node_modules/adm-zip/util/utils.js
|
|
318
318
|
var require_utils = __commonJS({
|
|
319
|
-
"
|
|
319
|
+
"../../node_modules/adm-zip/util/utils.js"(exports, module) {
|
|
320
320
|
var fsystem = __require("fs");
|
|
321
321
|
var pth = __require("path");
|
|
322
322
|
var Constants = require_constants();
|
|
@@ -582,9 +582,9 @@ var require_utils = __commonJS({
|
|
|
582
582
|
}
|
|
583
583
|
});
|
|
584
584
|
|
|
585
|
-
//
|
|
585
|
+
// ../../node_modules/adm-zip/util/fattr.js
|
|
586
586
|
var require_fattr = __commonJS({
|
|
587
|
-
"
|
|
587
|
+
"../../node_modules/adm-zip/util/fattr.js"(exports, module) {
|
|
588
588
|
var pth = __require("path");
|
|
589
589
|
module.exports = function(path, { fs }) {
|
|
590
590
|
var _path = path || "", _obj = newAttr(), _stat = null;
|
|
@@ -651,9 +651,9 @@ var require_fattr = __commonJS({
|
|
|
651
651
|
}
|
|
652
652
|
});
|
|
653
653
|
|
|
654
|
-
//
|
|
654
|
+
// ../../node_modules/adm-zip/util/decoder.js
|
|
655
655
|
var require_decoder = __commonJS({
|
|
656
|
-
"
|
|
656
|
+
"../../node_modules/adm-zip/util/decoder.js"(exports, module) {
|
|
657
657
|
module.exports = {
|
|
658
658
|
efs: true,
|
|
659
659
|
encode: (data) => Buffer.from(data, "utf8"),
|
|
@@ -662,9 +662,9 @@ var require_decoder = __commonJS({
|
|
|
662
662
|
}
|
|
663
663
|
});
|
|
664
664
|
|
|
665
|
-
//
|
|
665
|
+
// ../../node_modules/adm-zip/util/index.js
|
|
666
666
|
var require_util = __commonJS({
|
|
667
|
-
"
|
|
667
|
+
"../../node_modules/adm-zip/util/index.js"(exports, module) {
|
|
668
668
|
module.exports = require_utils();
|
|
669
669
|
module.exports.Constants = require_constants();
|
|
670
670
|
module.exports.Errors = require_errors();
|
|
@@ -673,9 +673,9 @@ var require_util = __commonJS({
|
|
|
673
673
|
}
|
|
674
674
|
});
|
|
675
675
|
|
|
676
|
-
//
|
|
676
|
+
// ../../node_modules/adm-zip/headers/entryHeader.js
|
|
677
677
|
var require_entryHeader = __commonJS({
|
|
678
|
-
"
|
|
678
|
+
"../../node_modules/adm-zip/headers/entryHeader.js"(exports, module) {
|
|
679
679
|
var Utils = require_util();
|
|
680
680
|
var Constants = Utils.Constants;
|
|
681
681
|
module.exports = function() {
|
|
@@ -944,9 +944,9 @@ var require_entryHeader = __commonJS({
|
|
|
944
944
|
}
|
|
945
945
|
});
|
|
946
946
|
|
|
947
|
-
//
|
|
947
|
+
// ../../node_modules/adm-zip/headers/mainHeader.js
|
|
948
948
|
var require_mainHeader = __commonJS({
|
|
949
|
-
"
|
|
949
|
+
"../../node_modules/adm-zip/headers/mainHeader.js"(exports, module) {
|
|
950
950
|
var Utils = require_util();
|
|
951
951
|
var Constants = Utils.Constants;
|
|
952
952
|
module.exports = function() {
|
|
@@ -1068,17 +1068,17 @@ var require_mainHeader = __commonJS({
|
|
|
1068
1068
|
}
|
|
1069
1069
|
});
|
|
1070
1070
|
|
|
1071
|
-
//
|
|
1071
|
+
// ../../node_modules/adm-zip/headers/index.js
|
|
1072
1072
|
var require_headers = __commonJS({
|
|
1073
|
-
"
|
|
1073
|
+
"../../node_modules/adm-zip/headers/index.js"(exports) {
|
|
1074
1074
|
exports.EntryHeader = require_entryHeader();
|
|
1075
1075
|
exports.MainHeader = require_mainHeader();
|
|
1076
1076
|
}
|
|
1077
1077
|
});
|
|
1078
1078
|
|
|
1079
|
-
//
|
|
1079
|
+
// ../../node_modules/adm-zip/methods/deflater.js
|
|
1080
1080
|
var require_deflater = __commonJS({
|
|
1081
|
-
"
|
|
1081
|
+
"../../node_modules/adm-zip/methods/deflater.js"(exports, module) {
|
|
1082
1082
|
module.exports = function(inbuf) {
|
|
1083
1083
|
var zlib = __require("zlib");
|
|
1084
1084
|
var opts = { chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024 };
|
|
@@ -1109,9 +1109,9 @@ var require_deflater = __commonJS({
|
|
|
1109
1109
|
}
|
|
1110
1110
|
});
|
|
1111
1111
|
|
|
1112
|
-
//
|
|
1112
|
+
// ../../node_modules/adm-zip/methods/inflater.js
|
|
1113
1113
|
var require_inflater = __commonJS({
|
|
1114
|
-
"
|
|
1114
|
+
"../../node_modules/adm-zip/methods/inflater.js"(exports, module) {
|
|
1115
1115
|
var version = +(process?.versions?.node ?? "").split(".")[0] || 0;
|
|
1116
1116
|
module.exports = function(inbuf, expectedLength) {
|
|
1117
1117
|
var zlib = __require("zlib");
|
|
@@ -1143,9 +1143,9 @@ var require_inflater = __commonJS({
|
|
|
1143
1143
|
}
|
|
1144
1144
|
});
|
|
1145
1145
|
|
|
1146
|
-
//
|
|
1146
|
+
// ../../node_modules/adm-zip/methods/zipcrypto.js
|
|
1147
1147
|
var require_zipcrypto = __commonJS({
|
|
1148
|
-
"
|
|
1148
|
+
"../../node_modules/adm-zip/methods/zipcrypto.js"(exports, module) {
|
|
1149
1149
|
"use strict";
|
|
1150
1150
|
var { randomFillSync } = __require("crypto");
|
|
1151
1151
|
var Errors = require_errors();
|
|
@@ -1259,18 +1259,18 @@ var require_zipcrypto = __commonJS({
|
|
|
1259
1259
|
}
|
|
1260
1260
|
});
|
|
1261
1261
|
|
|
1262
|
-
//
|
|
1262
|
+
// ../../node_modules/adm-zip/methods/index.js
|
|
1263
1263
|
var require_methods = __commonJS({
|
|
1264
|
-
"
|
|
1264
|
+
"../../node_modules/adm-zip/methods/index.js"(exports) {
|
|
1265
1265
|
exports.Deflater = require_deflater();
|
|
1266
1266
|
exports.Inflater = require_inflater();
|
|
1267
1267
|
exports.ZipCrypto = require_zipcrypto();
|
|
1268
1268
|
}
|
|
1269
1269
|
});
|
|
1270
1270
|
|
|
1271
|
-
//
|
|
1271
|
+
// ../../node_modules/adm-zip/zipEntry.js
|
|
1272
1272
|
var require_zipEntry = __commonJS({
|
|
1273
|
-
"
|
|
1273
|
+
"../../node_modules/adm-zip/zipEntry.js"(exports, module) {
|
|
1274
1274
|
var Utils = require_util();
|
|
1275
1275
|
var Headers = require_headers();
|
|
1276
1276
|
var Constants = Utils.Constants;
|
|
@@ -1599,9 +1599,9 @@ var require_zipEntry = __commonJS({
|
|
|
1599
1599
|
}
|
|
1600
1600
|
});
|
|
1601
1601
|
|
|
1602
|
-
//
|
|
1602
|
+
// ../../node_modules/adm-zip/zipFile.js
|
|
1603
1603
|
var require_zipFile = __commonJS({
|
|
1604
|
-
"
|
|
1604
|
+
"../../node_modules/adm-zip/zipFile.js"(exports, module) {
|
|
1605
1605
|
var ZipEntry = require_zipEntry();
|
|
1606
1606
|
var Headers = require_headers();
|
|
1607
1607
|
var Utils = require_util();
|
|
@@ -1945,9 +1945,9 @@ var require_zipFile = __commonJS({
|
|
|
1945
1945
|
}
|
|
1946
1946
|
});
|
|
1947
1947
|
|
|
1948
|
-
//
|
|
1948
|
+
// ../../node_modules/adm-zip/adm-zip.js
|
|
1949
1949
|
var require_adm_zip = __commonJS({
|
|
1950
|
-
"
|
|
1950
|
+
"../../node_modules/adm-zip/adm-zip.js"(exports, module) {
|
|
1951
1951
|
var Utils = require_util();
|
|
1952
1952
|
var pth = __require("path");
|
|
1953
1953
|
var ZipEntry = require_zipEntry();
|
|
@@ -2736,13 +2736,13 @@ var require_adm_zip = __commonJS({
|
|
|
2736
2736
|
}
|
|
2737
2737
|
});
|
|
2738
2738
|
|
|
2739
|
-
//
|
|
2739
|
+
// ../cli/src/convert-file.ts
|
|
2740
2740
|
import { copyFileSync, existsSync as existsSync3, mkdirSync as mkdirSync4 } from "node:fs";
|
|
2741
2741
|
import { spawnSync } from "node:child_process";
|
|
2742
2742
|
import { dirname as dirname4, join as join4, resolve } from "node:path";
|
|
2743
|
-
import { fileURLToPath } from "node:url";
|
|
2743
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
2744
2744
|
|
|
2745
|
-
//
|
|
2745
|
+
// ../conversion-logging/src/logger.ts
|
|
2746
2746
|
var sinks = /* @__PURE__ */ new Set();
|
|
2747
2747
|
function registerSink(sink) {
|
|
2748
2748
|
sinks.add(sink);
|
|
@@ -2786,7 +2786,7 @@ function createLogger(context, options2 = {}) {
|
|
|
2786
2786
|
};
|
|
2787
2787
|
}
|
|
2788
2788
|
|
|
2789
|
-
//
|
|
2789
|
+
// ../conversion-logging/src/sinks/console.ts
|
|
2790
2790
|
var LEVEL_RANK = { info: 0, warning: 1, error: 2 };
|
|
2791
2791
|
function where(event) {
|
|
2792
2792
|
const l = event.location;
|
|
@@ -2810,7 +2810,7 @@ var ConsoleSink = class {
|
|
|
2810
2810
|
}
|
|
2811
2811
|
};
|
|
2812
2812
|
|
|
2813
|
-
//
|
|
2813
|
+
// ../conversion-logging/src/sinks/file.ts
|
|
2814
2814
|
import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2815
2815
|
import { dirname } from "node:path";
|
|
2816
2816
|
var FileSink = class {
|
|
@@ -2825,7 +2825,7 @@ var FileSink = class {
|
|
|
2825
2825
|
}
|
|
2826
2826
|
};
|
|
2827
2827
|
|
|
2828
|
-
//
|
|
2828
|
+
// ../conversion-logging/src/sinks/memory.ts
|
|
2829
2829
|
var MemorySink = class {
|
|
2830
2830
|
events = [];
|
|
2831
2831
|
handle(event) {
|
|
@@ -2837,7 +2837,7 @@ var MemorySink = class {
|
|
|
2837
2837
|
}
|
|
2838
2838
|
};
|
|
2839
2839
|
|
|
2840
|
-
//
|
|
2840
|
+
// ../ui-model/src/view-ir.ts
|
|
2841
2841
|
var CONTAINER_ROLES = /* @__PURE__ */ new Set([
|
|
2842
2842
|
"panel",
|
|
2843
2843
|
"stackPanel",
|
|
@@ -2865,7 +2865,7 @@ var FIELD_FRAME_ROLES = /* @__PURE__ */ new Set([
|
|
|
2865
2865
|
"datePicker"
|
|
2866
2866
|
]);
|
|
2867
2867
|
|
|
2868
|
-
//
|
|
2868
|
+
// ../ui-model/src/styles/value-converters.ts
|
|
2869
2869
|
function unit(value, u) {
|
|
2870
2870
|
const unitName = typeof u === "string" ? u : "";
|
|
2871
2871
|
if (unitName === "auto") return "auto";
|
|
@@ -2953,7 +2953,7 @@ function absolutePosition(v) {
|
|
|
2953
2953
|
return out;
|
|
2954
2954
|
}
|
|
2955
2955
|
|
|
2956
|
-
//
|
|
2956
|
+
// ../ui-model/src/styles/property-to-css.ts
|
|
2957
2957
|
var DIRECT = {
|
|
2958
2958
|
display: "display",
|
|
2959
2959
|
flexDirection: "flex-direction",
|
|
@@ -3103,8 +3103,8 @@ var NOT_STYLING = /* @__PURE__ */ new Set([
|
|
|
3103
3103
|
"allowedFileTypes",
|
|
3104
3104
|
"helperText",
|
|
3105
3105
|
"fileUploadingState",
|
|
3106
|
-
//
|
|
3107
|
-
//
|
|
3106
|
+
// A custom-HTML control's code DOCUMENTS (HTML/CSS/JS) — content, read into
|
|
3107
|
+
// `customHtmlCode` and rendered in a sandboxed frame, never described in CSS.
|
|
3108
3108
|
"code",
|
|
3109
3109
|
// The two-way value binding, and validation state. Both are behaviour.
|
|
3110
3110
|
// `selectedObject` is the same thing on a list control — the runtime writes the
|
|
@@ -3153,7 +3153,7 @@ var NOT_STYLING = /* @__PURE__ */ new Set([
|
|
|
3153
3153
|
"gridRowSpan"
|
|
3154
3154
|
]);
|
|
3155
3155
|
|
|
3156
|
-
//
|
|
3156
|
+
// ../ui-model/src/styles/resolve-styles.ts
|
|
3157
3157
|
function alignment(props, role) {
|
|
3158
3158
|
const h = alignValue(props.horizontalAlignment?.value);
|
|
3159
3159
|
const v = alignValue(props.verticalAlignment?.value);
|
|
@@ -3434,7 +3434,7 @@ function renderDeclarations(declarations, indent = " ") {
|
|
|
3434
3434
|
return [...seen.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([p, v]) => `${indent}${p}: ${v};`).join("\n");
|
|
3435
3435
|
}
|
|
3436
3436
|
|
|
3437
|
-
//
|
|
3437
|
+
// ../ui-model/src/generated/controls.ts
|
|
3438
3438
|
var CONTROL_CATALOG = {
|
|
3439
3439
|
"form-button": {
|
|
3440
3440
|
inRuntimeRegistry: true,
|
|
@@ -4012,7 +4012,7 @@ var CONTROL_CATALOG = {
|
|
|
4012
4012
|
};
|
|
4013
4013
|
var ALL_CONTROL_KINDS = Object.keys(CONTROL_CATALOG);
|
|
4014
4014
|
|
|
4015
|
-
//
|
|
4015
|
+
// ../ui-model/src/build/roles.ts
|
|
4016
4016
|
var ROLES = {
|
|
4017
4017
|
// containers
|
|
4018
4018
|
"form-vb-panel": "panel",
|
|
@@ -4074,7 +4074,7 @@ var ROLES = {
|
|
|
4074
4074
|
"form-rich-text-editor": "richText"
|
|
4075
4075
|
};
|
|
4076
4076
|
|
|
4077
|
-
//
|
|
4077
|
+
// ../ui-model/src/generated/apollo-tokens.ts
|
|
4078
4078
|
var APOLLO_COLOUR_TOKENS = {
|
|
4079
4079
|
"#000000": "color-black",
|
|
4080
4080
|
"#00000099": "color-background-edit-dark",
|
|
@@ -4339,7 +4339,7 @@ function apolloTokenFor(value) {
|
|
|
4339
4339
|
return APOLLO_COLOUR_TOKENS[value.toLowerCase()];
|
|
4340
4340
|
}
|
|
4341
4341
|
|
|
4342
|
-
//
|
|
4342
|
+
// ../ui-model/src/build/design-tokens.ts
|
|
4343
4343
|
var TOKENISED = /* @__PURE__ */ new Set([
|
|
4344
4344
|
"color",
|
|
4345
4345
|
"background-color",
|
|
@@ -4384,7 +4384,7 @@ function collectTokens(models, brandTokens = {}) {
|
|
|
4384
4384
|
return { values, byValue };
|
|
4385
4385
|
}
|
|
4386
4386
|
|
|
4387
|
-
//
|
|
4387
|
+
// ../ui-model/src/build/content-props.ts
|
|
4388
4388
|
var CONTENT_PROPS = /* @__PURE__ */ new Set([
|
|
4389
4389
|
"text",
|
|
4390
4390
|
"url",
|
|
@@ -4655,8 +4655,30 @@ function events(raw) {
|
|
|
4655
4655
|
}
|
|
4656
4656
|
return out;
|
|
4657
4657
|
}
|
|
4658
|
-
|
|
4659
|
-
|
|
4658
|
+
function customHtmlCode(c) {
|
|
4659
|
+
if (c.component !== "form-custom-html") return {};
|
|
4660
|
+
const code = c.properties?.["code"];
|
|
4661
|
+
if (code?.valueType !== "editable-documents") return {};
|
|
4662
|
+
const value = code.value ?? {};
|
|
4663
|
+
const doc = (kind) => {
|
|
4664
|
+
const id2 = value.documentReferences?.[kind]?.documentId;
|
|
4665
|
+
return typeof id2 === "string" && id2 !== "" ? id2 : void 0;
|
|
4666
|
+
};
|
|
4667
|
+
const urls = (list) => (Array.isArray(list) ? list : []).map((f5) => typeof f5 === "string" ? f5 : f5?.url ?? f5?.src ?? f5?.value).filter((u) => typeof u === "string" && u !== "");
|
|
4668
|
+
const html = doc("html"), css = doc("css"), js = doc("js");
|
|
4669
|
+
const cssExternal = urls(value.customData?.cssExternalFiles);
|
|
4670
|
+
const jsExternal = urls(value.customData?.jsExternalFiles);
|
|
4671
|
+
if (!html && !css && !js && !cssExternal.length && !jsExternal.length) return {};
|
|
4672
|
+
return { customHtmlCode: {
|
|
4673
|
+
...html ? { html } : {},
|
|
4674
|
+
...css ? { css } : {},
|
|
4675
|
+
...js ? { js } : {},
|
|
4676
|
+
cssExternal,
|
|
4677
|
+
jsExternal
|
|
4678
|
+
} };
|
|
4679
|
+
}
|
|
4680
|
+
|
|
4681
|
+
// ../ui-model/src/build/payload-types.ts
|
|
4660
4682
|
function collectResourceFolders(models) {
|
|
4661
4683
|
const out = [];
|
|
4662
4684
|
for (const m of models) {
|
|
@@ -4691,7 +4713,7 @@ function collectResourceFolders(models) {
|
|
|
4691
4713
|
return out.sort((a, b) => a.resource.localeCompare(b.resource));
|
|
4692
4714
|
}
|
|
4693
4715
|
|
|
4694
|
-
//
|
|
4716
|
+
// ../ui-model/src/build/build-view.ts
|
|
4695
4717
|
function buildView(models, meta, options2 = {}) {
|
|
4696
4718
|
const gaps = [];
|
|
4697
4719
|
const tokens = collectTokens(models, options2.brandTokens);
|
|
@@ -4950,6 +4972,7 @@ function buildNode(id2, c, pageTitle, tokenFor, gaps, hasExpr) {
|
|
|
4950
4972
|
...sourceBinding(c, hasExpr),
|
|
4951
4973
|
...displayColumn(c, hasExpr),
|
|
4952
4974
|
...gridColumns(c, hasExpr),
|
|
4975
|
+
...customHtmlCode(c),
|
|
4953
4976
|
events: events(c.events),
|
|
4954
4977
|
...ruleNames(c),
|
|
4955
4978
|
...role === "pageContainer" && c.config?.formBinding?.expressionId && hasExpr(c.config.formBinding.expressionId) ? { embeddedPageExpressionId: c.config.formBinding.expressionId } : {},
|
|
@@ -4961,7 +4984,7 @@ function walkNodes(node, visit, depth = 0) {
|
|
|
4961
4984
|
for (const child of node.children) walkNodes(child, visit, depth + 1);
|
|
4962
4985
|
}
|
|
4963
4986
|
|
|
4964
|
-
//
|
|
4987
|
+
// ../ui-model/src/bindable-properties.ts
|
|
4965
4988
|
function wireType(p, generic) {
|
|
4966
4989
|
if (p.usesGenericType) return generic ?? "Object";
|
|
4967
4990
|
if (p.type === GENERIC) return generic ?? "Object";
|
|
@@ -5082,7 +5105,7 @@ function normaliseGenericType(t) {
|
|
|
5082
5105
|
}
|
|
5083
5106
|
}
|
|
5084
5107
|
|
|
5085
|
-
//
|
|
5108
|
+
// ../ui-model/src/fidelity.ts
|
|
5086
5109
|
var NOT_APPLICABLE = {
|
|
5087
5110
|
coordinates: "This is the position where the control was dragged on the designer canvas. Neither the Apps runtime nor the converted app uses it: both lay controls out one after another in the authored order. Nothing is lost.",
|
|
5088
5111
|
name: "The control name identifies the control; it is not something that renders. Nothing to compare.",
|
|
@@ -5292,7 +5315,7 @@ function fidelityOf(role, property) {
|
|
|
5292
5315
|
return { status: "unverified" };
|
|
5293
5316
|
}
|
|
5294
5317
|
|
|
5295
|
-
//
|
|
5318
|
+
// ../ui-model/src/generated/authored-properties.ts
|
|
5296
5319
|
var AUTHORED_PROPERTIES = [
|
|
5297
5320
|
{ name: "absolutePosition", valueType: "box" },
|
|
5298
5321
|
{ name: "accent", valueType: "string" },
|
|
@@ -5539,13 +5562,13 @@ var CONTROL_EVENTS = {
|
|
|
5539
5562
|
"form-vb-panel": ["click"]
|
|
5540
5563
|
};
|
|
5541
5564
|
|
|
5542
|
-
//
|
|
5565
|
+
// ../expressions/src/refusal-policy.ts
|
|
5543
5566
|
import ts4 from "typescript";
|
|
5544
5567
|
|
|
5545
|
-
//
|
|
5568
|
+
// ../expressions/src/rule-registry.ts
|
|
5546
5569
|
import ts2 from "typescript";
|
|
5547
5570
|
|
|
5548
|
-
//
|
|
5571
|
+
// ../expressions/src/null-handling.ts
|
|
5549
5572
|
import ts from "typescript";
|
|
5550
5573
|
var f = ts.factory;
|
|
5551
5574
|
function isNonNullish(e) {
|
|
@@ -5689,7 +5712,7 @@ function asDateValue(e, markDateMin) {
|
|
|
5689
5712
|
);
|
|
5690
5713
|
}
|
|
5691
5714
|
|
|
5692
|
-
//
|
|
5715
|
+
// ../expressions/src/accessor-names.ts
|
|
5693
5716
|
var REACT_ACCESSORS = {
|
|
5694
5717
|
appVar: { reactive: "useAppVar", imperative: "getAppVar" },
|
|
5695
5718
|
processOutput: { reactive: "useProcessOutput", imperative: "processOutput" },
|
|
@@ -5729,7 +5752,7 @@ function accessorIdentifiers(a) {
|
|
|
5729
5752
|
];
|
|
5730
5753
|
}
|
|
5731
5754
|
|
|
5732
|
-
//
|
|
5755
|
+
// ../expressions/src/rule-registry.ts
|
|
5733
5756
|
var UnsupportedConstruct = class extends Error {
|
|
5734
5757
|
constructor(node, message) {
|
|
5735
5758
|
super(message);
|
|
@@ -5850,7 +5873,7 @@ function defineMemberMappings(containingType, mappings) {
|
|
|
5850
5873
|
}
|
|
5851
5874
|
}
|
|
5852
5875
|
|
|
5853
|
-
//
|
|
5876
|
+
// ../expressions/src/ast-facts.ts
|
|
5854
5877
|
import ts3 from "typescript";
|
|
5855
5878
|
function hasAwait(nodes) {
|
|
5856
5879
|
let found = false;
|
|
@@ -5867,7 +5890,7 @@ function hasAwait(nodes) {
|
|
|
5867
5890
|
return found;
|
|
5868
5891
|
}
|
|
5869
5892
|
|
|
5870
|
-
//
|
|
5893
|
+
// ../expressions/src/refusal-policy.ts
|
|
5871
5894
|
function mergeRuleCompatUsage(usage) {
|
|
5872
5895
|
const helpers = ruleCompatHelpers();
|
|
5873
5896
|
for (const h of helpers) usage.mark(h);
|
|
@@ -5922,7 +5945,7 @@ function emitAsyncRead(root, id2, originalVb, usage, accessors = REACT_ACCESSORS
|
|
|
5922
5945
|
return `${accessors.asyncRead}(${JSON.stringify(id2)}, async () => ${code}, [${deps.join(", ")}])`;
|
|
5923
5946
|
}
|
|
5924
5947
|
|
|
5925
|
-
//
|
|
5948
|
+
// ../expressions/src/assignment-targets.ts
|
|
5926
5949
|
import ts5 from "typescript";
|
|
5927
5950
|
var f2 = ts5.factory;
|
|
5928
5951
|
var REACT_SETTERS = {
|
|
@@ -6041,7 +6064,7 @@ function emitReset(target, setters = REACT_SETTERS) {
|
|
|
6041
6064
|
);
|
|
6042
6065
|
}
|
|
6043
6066
|
|
|
6044
|
-
//
|
|
6067
|
+
// ../expressions/src/compat/catalog.ts
|
|
6045
6068
|
var THROWING_HELPERS = [
|
|
6046
6069
|
// .NET's String.Contains throws on a Nothing needle, and an authored expression that
|
|
6047
6070
|
// relies on that failing is why a dropdown showed the first row instead of nothing.
|
|
@@ -6096,7 +6119,7 @@ var CompatUsage = class {
|
|
|
6096
6119
|
}
|
|
6097
6120
|
};
|
|
6098
6121
|
|
|
6099
|
-
//
|
|
6122
|
+
// ../expressions/src/compat/sources/dates.ts
|
|
6100
6123
|
var DATES_SOURCES = {
|
|
6101
6124
|
dateMin: `
|
|
6102
6125
|
/** .NET's \`DateTime.MinValue\` \u2014 0001-01-01. */
|
|
@@ -6346,7 +6369,7 @@ export function dateDiff(interval: unknown, date1: unknown, date2: unknown): num
|
|
|
6346
6369
|
}`
|
|
6347
6370
|
};
|
|
6348
6371
|
|
|
6349
|
-
//
|
|
6372
|
+
// ../expressions/src/compat/sources/decimal.ts
|
|
6350
6373
|
var DECIMAL_SOURCES = {
|
|
6351
6374
|
dec: `
|
|
6352
6375
|
/** Coerce to an exact decimal. */
|
|
@@ -6398,7 +6421,7 @@ export function decRound(value: unknown, digits = 0): Decimal {
|
|
|
6398
6421
|
}`
|
|
6399
6422
|
};
|
|
6400
6423
|
|
|
6401
|
-
//
|
|
6424
|
+
// ../expressions/src/compat/sources/json.ts
|
|
6402
6425
|
var JSON_SOURCES = {
|
|
6403
6426
|
jsonParse: `
|
|
6404
6427
|
/**
|
|
@@ -6515,7 +6538,7 @@ export function jsonOne(token: unknown): any[] {
|
|
|
6515
6538
|
`
|
|
6516
6539
|
};
|
|
6517
6540
|
|
|
6518
|
-
//
|
|
6541
|
+
// ../expressions/src/compat/sources/linq.ts
|
|
6519
6542
|
var LINQ_SOURCES = {
|
|
6520
6543
|
orderBy: `
|
|
6521
6544
|
/**
|
|
@@ -6855,7 +6878,7 @@ export function chunk<T>(seq: readonly T[] | undefined, size: number): T[][] {
|
|
|
6855
6878
|
}`
|
|
6856
6879
|
};
|
|
6857
6880
|
|
|
6858
|
-
//
|
|
6881
|
+
// ../expressions/src/compat/sources/markers.ts
|
|
6859
6882
|
var MARKERS_SOURCES = {
|
|
6860
6883
|
notConverted: `
|
|
6861
6884
|
/** A marker for an expression the converter REFUSED to translate. */
|
|
@@ -6908,7 +6931,7 @@ export function attempt<T>(evaluate: () => T): T | undefined {
|
|
|
6908
6931
|
}`
|
|
6909
6932
|
};
|
|
6910
6933
|
|
|
6911
|
-
//
|
|
6934
|
+
// ../expressions/src/compat/sources/operators.ts
|
|
6912
6935
|
var MISC_SOURCES = {
|
|
6913
6936
|
lifted: `
|
|
6914
6937
|
/** VB's LIFTED arithmetic \u2014 Nothing in, Nothing out. */
|
|
@@ -7041,7 +7064,7 @@ export function typeNameOf(value: unknown): string {
|
|
|
7041
7064
|
`
|
|
7042
7065
|
};
|
|
7043
7066
|
|
|
7044
|
-
//
|
|
7067
|
+
// ../expressions/src/compat/sources/numbers.ts
|
|
7045
7068
|
var NUMBERS_SOURCES = {
|
|
7046
7069
|
roundHalfEven: `
|
|
7047
7070
|
/**
|
|
@@ -7191,7 +7214,7 @@ export function roundHalfAway(value: unknown, digits = 0): number {
|
|
|
7191
7214
|
}`
|
|
7192
7215
|
};
|
|
7193
7216
|
|
|
7194
|
-
//
|
|
7217
|
+
// ../expressions/src/compat/sources/strings.ts
|
|
7195
7218
|
var STRINGS_SOURCES = {
|
|
7196
7219
|
textContains: `
|
|
7197
7220
|
/**
|
|
@@ -7366,7 +7389,7 @@ export function toBool(value: unknown): boolean {
|
|
|
7366
7389
|
}`
|
|
7367
7390
|
};
|
|
7368
7391
|
|
|
7369
|
-
//
|
|
7392
|
+
// ../expressions/src/compat/sources.ts
|
|
7370
7393
|
var SOURCES = {
|
|
7371
7394
|
...DATES_SOURCES,
|
|
7372
7395
|
...DECIMAL_SOURCES,
|
|
@@ -7379,7 +7402,7 @@ var SOURCES = {
|
|
|
7379
7402
|
};
|
|
7380
7403
|
COMPAT_HELPERS.push(...Object.keys(SOURCES).sort());
|
|
7381
7404
|
|
|
7382
|
-
//
|
|
7405
|
+
// ../expressions/src/compat/render.ts
|
|
7383
7406
|
function renderCompatModule(usage) {
|
|
7384
7407
|
if (usage.isEmpty) return null;
|
|
7385
7408
|
const helpers = usage.helpers;
|
|
@@ -7397,7 +7420,7 @@ function renderCompatModule(usage) {
|
|
|
7397
7420
|
return header + imports + helpers.sort().map((h) => SOURCES[h]).join("\n") + "\n";
|
|
7398
7421
|
}
|
|
7399
7422
|
|
|
7400
|
-
//
|
|
7423
|
+
// ../expressions/src/compat/impls/dates.ts
|
|
7401
7424
|
var dates_exports = {};
|
|
7402
7425
|
__export(dates_exports, {
|
|
7403
7426
|
canParseDate: () => canParseDate,
|
|
@@ -7661,7 +7684,7 @@ function dateDiff(interval, date1, date2) {
|
|
|
7661
7684
|
}
|
|
7662
7685
|
}
|
|
7663
7686
|
|
|
7664
|
-
//
|
|
7687
|
+
// ../expressions/src/compat/impls/decimal.ts
|
|
7665
7688
|
var decimal_exports = {};
|
|
7666
7689
|
__export(decimal_exports, {
|
|
7667
7690
|
dec: () => dec,
|
|
@@ -7689,7 +7712,7 @@ var decCmp = (a, b) => dec(a).comparedTo(dec(b));
|
|
|
7689
7712
|
var decEq = (a, b) => dec(a).equals(dec(b));
|
|
7690
7713
|
var decRound = (value, digits = 0) => dec(value).toDecimalPlaces(digits, Decimal.ROUND_HALF_EVEN);
|
|
7691
7714
|
|
|
7692
|
-
//
|
|
7715
|
+
// ../expressions/src/compat/impls/json.ts
|
|
7693
7716
|
var json_exports = {};
|
|
7694
7717
|
__export(json_exports, {
|
|
7695
7718
|
jsonChildren: () => jsonChildren,
|
|
@@ -7742,7 +7765,7 @@ function jsonHasKey(token, key) {
|
|
|
7742
7765
|
return Object.prototype.hasOwnProperty.call(token, String(key));
|
|
7743
7766
|
}
|
|
7744
7767
|
|
|
7745
|
-
//
|
|
7768
|
+
// ../expressions/src/compat/impls/linq.ts
|
|
7746
7769
|
var linq_exports = {};
|
|
7747
7770
|
__export(linq_exports, {
|
|
7748
7771
|
average: () => average,
|
|
@@ -7983,7 +8006,7 @@ function chunk(seq, size2) {
|
|
|
7983
8006
|
return out;
|
|
7984
8007
|
}
|
|
7985
8008
|
|
|
7986
|
-
//
|
|
8009
|
+
// ../expressions/src/compat/impls/markers.ts
|
|
7987
8010
|
var markers_exports = {};
|
|
7988
8011
|
__export(markers_exports, {
|
|
7989
8012
|
attempt: () => attempt,
|
|
@@ -8024,7 +8047,7 @@ function notConvertedInput(originalExpression) {
|
|
|
8024
8047
|
return void 0;
|
|
8025
8048
|
}
|
|
8026
8049
|
|
|
8027
|
-
//
|
|
8050
|
+
// ../expressions/src/compat/impls/operators.ts
|
|
8028
8051
|
var operators_exports = {};
|
|
8029
8052
|
__export(operators_exports, {
|
|
8030
8053
|
dayOfYear: () => dayOfYear,
|
|
@@ -8115,7 +8138,7 @@ function typeNameOf(value) {
|
|
|
8115
8138
|
return "Object";
|
|
8116
8139
|
}
|
|
8117
8140
|
|
|
8118
|
-
//
|
|
8141
|
+
// ../expressions/src/compat/impls/numbers.ts
|
|
8119
8142
|
var numbers_exports = {};
|
|
8120
8143
|
__export(numbers_exports, {
|
|
8121
8144
|
formatNumber: () => formatNumber,
|
|
@@ -8222,7 +8245,7 @@ function roundHalfAway(value, digits = 0) {
|
|
|
8222
8245
|
return x < 0 ? -rounded : rounded;
|
|
8223
8246
|
}
|
|
8224
8247
|
|
|
8225
|
-
//
|
|
8248
|
+
// ../expressions/src/compat/impls/strings.ts
|
|
8226
8249
|
var strings_exports = {};
|
|
8227
8250
|
__export(strings_exports, {
|
|
8228
8251
|
addDays: () => addDays,
|
|
@@ -8338,10 +8361,10 @@ function textContains(haystack, needle) {
|
|
|
8338
8361
|
return String(haystack ?? "").includes(String(needle));
|
|
8339
8362
|
}
|
|
8340
8363
|
|
|
8341
|
-
//
|
|
8364
|
+
// ../expressions/src/compat/impls.ts
|
|
8342
8365
|
var ALL = { ...dates_exports, ...decimal_exports, ...json_exports, ...linq_exports, ...markers_exports, ...operators_exports, ...numbers_exports, ...strings_exports };
|
|
8343
8366
|
|
|
8344
|
-
//
|
|
8367
|
+
// ../expressions/src/expression-resolver.ts
|
|
8345
8368
|
function createResolver(input) {
|
|
8346
8369
|
const { nodeById, bindReason, vbById, compat } = input;
|
|
8347
8370
|
const ACCESSORS = input.accessors ?? REACT_ACCESSORS;
|
|
@@ -8470,7 +8493,7 @@ function createResolver(input) {
|
|
|
8470
8493
|
return { resolver, stats, gaps: gapReasons, details };
|
|
8471
8494
|
}
|
|
8472
8495
|
|
|
8473
|
-
//
|
|
8496
|
+
// ../expressions/src/bridge/scaffold-request.ts
|
|
8474
8497
|
var KNOWN_RAW_TYPES = {
|
|
8475
8498
|
ChoiceSet: "ChoiceSet",
|
|
8476
8499
|
"System.Data.DataTable": "DataTable",
|
|
@@ -8767,7 +8790,7 @@ function undeclaredEntityTypes(request) {
|
|
|
8767
8790
|
return [...missing].sort();
|
|
8768
8791
|
}
|
|
8769
8792
|
|
|
8770
|
-
//
|
|
8793
|
+
// ../expressions/src/bridge/roslyn-client.ts
|
|
8771
8794
|
import { execFileSync } from "node:child_process";
|
|
8772
8795
|
import { createHash } from "node:crypto";
|
|
8773
8796
|
import { tmpdir } from "node:os";
|
|
@@ -8781,11 +8804,15 @@ import {
|
|
|
8781
8804
|
writeFileSync as writeFileSync2,
|
|
8782
8805
|
statSync
|
|
8783
8806
|
} from "node:fs";
|
|
8784
|
-
import { dirname as dirname2, join } from "node:path";
|
|
8807
|
+
import { basename, dirname as dirname2, join } from "node:path";
|
|
8808
|
+
import { fileURLToPath } from "node:url";
|
|
8809
|
+
function bridgePathFrom(moduleUrl, rel, options2) {
|
|
8810
|
+
return fileURLToPath(new URL(rel, moduleUrl), options2);
|
|
8811
|
+
}
|
|
8785
8812
|
var BRIDGE = (() => {
|
|
8786
8813
|
const explicit = process.env.UIAPP_CONVERT_BRIDGE;
|
|
8787
8814
|
if (explicit) return explicit;
|
|
8788
|
-
const here = (rel) =>
|
|
8815
|
+
const here = (rel) => bridgePathFrom(import.meta.url, rel);
|
|
8789
8816
|
const built = ["Release", "Debug"].map((c) => here(`../../../roslyn-bridge/bin/${c}/net10.0/roslyn-bridge.dll`)).filter((p) => existsSync(p)).sort((a, b) => statSync(b).mtimeMs - statSync(a).mtimeMs);
|
|
8790
8817
|
if (built[0]) return built[0];
|
|
8791
8818
|
const bundled = here("./roslyn-bridge/roslyn-bridge.dll");
|
|
@@ -8807,7 +8834,7 @@ function bind(request, options2) {
|
|
|
8807
8834
|
const outDir = options2.cacheDir;
|
|
8808
8835
|
const requestJson = JSON.stringify(request);
|
|
8809
8836
|
if (options2.dumpRequest) {
|
|
8810
|
-
writeFileSync2("
|
|
8837
|
+
writeFileSync2(join(tmpdir(), "uiapp-bridge-request.json"), requestJson);
|
|
8811
8838
|
console.log(`request: ${(requestJson.length / 1024).toFixed(0)} KB -> /tmp/uiapp-bridge-request.json`);
|
|
8812
8839
|
}
|
|
8813
8840
|
const bridgeStamp = (() => {
|
|
@@ -8822,7 +8849,7 @@ function bind(request, options2) {
|
|
|
8822
8849
|
const cacheFile = join(outDir, "..", `.bridge-cache-${cacheKey}.json`);
|
|
8823
8850
|
let bound;
|
|
8824
8851
|
if (!options2.noCache && existsSync(cacheFile)) {
|
|
8825
|
-
console.log(`reusing cached bind for ${ids.length} expressions (${cacheFile
|
|
8852
|
+
console.log(`reusing cached bind for ${ids.length} expressions (${basename(cacheFile)})`);
|
|
8826
8853
|
bound = JSON.parse(readFileSync(cacheFile, "utf8"));
|
|
8827
8854
|
} else {
|
|
8828
8855
|
console.log(`binding ${ids.length} expressions\u2026`);
|
|
@@ -8857,7 +8884,7 @@ function bind(request, options2) {
|
|
|
8857
8884
|
return { nodeById, bindReason };
|
|
8858
8885
|
}
|
|
8859
8886
|
|
|
8860
|
-
//
|
|
8887
|
+
// ../expressions/src/bridge/collect-expression-ids.ts
|
|
8861
8888
|
function collectExpressionIds(app) {
|
|
8862
8889
|
const referenced = /* @__PURE__ */ new Set();
|
|
8863
8890
|
const rowTypeById = /* @__PURE__ */ new Map();
|
|
@@ -8906,15 +8933,15 @@ function collectExpressionIds(app) {
|
|
|
8906
8933
|
return { referenced, rowTypeById };
|
|
8907
8934
|
}
|
|
8908
8935
|
|
|
8909
|
-
//
|
|
8936
|
+
// ../expressions/src/rules/shared/ast-builders.ts
|
|
8910
8937
|
import ts6 from "typescript";
|
|
8911
8938
|
|
|
8912
|
-
//
|
|
8939
|
+
// ../expressions/src/rules/shared/compat-usage.ts
|
|
8913
8940
|
var compatUsage = new CompatUsage();
|
|
8914
8941
|
registerRuleCompatUsage(compatUsage);
|
|
8915
8942
|
registerCompatMarker((h) => compatUsage.mark(h));
|
|
8916
8943
|
|
|
8917
|
-
//
|
|
8944
|
+
// ../expressions/src/rules/shared/ast-builders.ts
|
|
8918
8945
|
var f3 = ts6.factory;
|
|
8919
8946
|
var str = (e) => f3.createCallExpression(f3.createIdentifier("String"), void 0, [orEmptyString(e)]);
|
|
8920
8947
|
var num = (v) => v < 0 ? f3.createPrefixUnaryExpression(ts6.SyntaxKind.MinusToken, f3.createNumericLiteral(-v)) : f3.createNumericLiteral(v);
|
|
@@ -8937,10 +8964,10 @@ function filterValueOf(e) {
|
|
|
8937
8964
|
return decCall("filterValue", [e]);
|
|
8938
8965
|
}
|
|
8939
8966
|
|
|
8940
|
-
//
|
|
8967
|
+
// ../expressions/src/rules/shared/bound-node-helpers.ts
|
|
8941
8968
|
import ts8 from "typescript";
|
|
8942
8969
|
|
|
8943
|
-
//
|
|
8970
|
+
// ../expressions/src/rules/shared/vb-types.ts
|
|
8944
8971
|
var SPECIAL_BY_NAME = {
|
|
8945
8972
|
"System.String": "String",
|
|
8946
8973
|
"System.Boolean": "Boolean",
|
|
@@ -8986,7 +9013,7 @@ function entityOfListSource(typeName2) {
|
|
|
8986
9013
|
return m ? m[1] : null;
|
|
8987
9014
|
}
|
|
8988
9015
|
|
|
8989
|
-
//
|
|
9016
|
+
// ../expressions/src/rules/shared/lookup-tables.ts
|
|
8990
9017
|
import ts7 from "typescript";
|
|
8991
9018
|
var RELATIONAL = {
|
|
8992
9019
|
LessThan: ts7.SyntaxKind.LessThanToken,
|
|
@@ -9154,7 +9181,7 @@ var PLAIN_TOSTRING = /* @__PURE__ */ new Set([
|
|
|
9154
9181
|
"System.Char"
|
|
9155
9182
|
]);
|
|
9156
9183
|
|
|
9157
|
-
//
|
|
9184
|
+
// ../expressions/src/rules/shared/bound-node-helpers.ts
|
|
9158
9185
|
var decLit = (v) => ({ kind: "Literal", type: T_DEC, value: v });
|
|
9159
9186
|
var eitherDecimal = (n) => n.kind === "Binary" && (isDecimal(n.left.type) || isDecimal(n.right.type));
|
|
9160
9187
|
function concatOperand(x, ctx) {
|
|
@@ -9247,7 +9274,7 @@ function comparable(node, ctx) {
|
|
|
9247
9274
|
var isNullLiteral2 = (n) => n.kind === "Literal" && (n.value === null || n.value === void 0);
|
|
9248
9275
|
var isNothing = (n) => n.kind === "Literal" && (n.value === null || n.value === void 0) || n.kind === "Conversion" && isNothing(n.operand);
|
|
9249
9276
|
|
|
9250
|
-
//
|
|
9277
|
+
// ../expressions/src/rules/shared/store-reads.ts
|
|
9251
9278
|
import ts9 from "typescript";
|
|
9252
9279
|
function vbDefault(t) {
|
|
9253
9280
|
if (!t) return null;
|
|
@@ -9306,7 +9333,7 @@ function storeRead(name, args, t) {
|
|
|
9306
9333
|
return dflt ? f3.createBinaryExpression(call5, ts9.SyntaxKind.QuestionQuestionToken, dflt) : call5;
|
|
9307
9334
|
}
|
|
9308
9335
|
|
|
9309
|
-
//
|
|
9336
|
+
// ../expressions/src/rules/shared/pagination.ts
|
|
9310
9337
|
function paginationProps(node, ctx) {
|
|
9311
9338
|
if (!node || isNothing(node)) return null;
|
|
9312
9339
|
const inv = node.kind === "Invocation" ? node : null;
|
|
@@ -9330,7 +9357,7 @@ function paginationProps(node, ctx) {
|
|
|
9330
9357
|
return out;
|
|
9331
9358
|
}
|
|
9332
9359
|
|
|
9333
|
-
//
|
|
9360
|
+
// ../expressions/src/rules/app-references.ts
|
|
9334
9361
|
defineRule({
|
|
9335
9362
|
id: "member.controlProp",
|
|
9336
9363
|
match: (n) => n.kind === "Member" && n.symbol.kind === "controlProp",
|
|
@@ -9742,7 +9769,7 @@ defineRule({
|
|
|
9742
9769
|
]
|
|
9743
9770
|
});
|
|
9744
9771
|
|
|
9745
|
-
//
|
|
9772
|
+
// ../expressions/src/rules/newtonsoft.ts
|
|
9746
9773
|
import ts10 from "typescript";
|
|
9747
9774
|
var NS = "Newtonsoft.Json.Linq.";
|
|
9748
9775
|
var call = (helper3, args) => f3.createCallExpression(f3.createIdentifier(compatUsage.mark(helper3)), void 0, args);
|
|
@@ -10866,7 +10893,7 @@ defineRule({
|
|
|
10866
10893
|
]
|
|
10867
10894
|
});
|
|
10868
10895
|
|
|
10869
|
-
//
|
|
10896
|
+
// ../expressions/src/rules/conversions.ts
|
|
10870
10897
|
defineRule({
|
|
10871
10898
|
id: "conversion.arrayToSequence",
|
|
10872
10899
|
match: (n) => n.kind === "Conversion" && SEQUENCE_TYPE.test(n.type.name ?? "") && isSequenceish(n.operand.type.name),
|
|
@@ -11006,7 +11033,7 @@ defineRule({
|
|
|
11006
11033
|
]
|
|
11007
11034
|
});
|
|
11008
11035
|
|
|
11009
|
-
//
|
|
11036
|
+
// ../expressions/src/rules/datatable.ts
|
|
11010
11037
|
import ts11 from "typescript";
|
|
11011
11038
|
defineRule({
|
|
11012
11039
|
id: "invocation.dataTable.copyTo",
|
|
@@ -11712,7 +11739,7 @@ defineRule({
|
|
|
11712
11739
|
}]
|
|
11713
11740
|
});
|
|
11714
11741
|
|
|
11715
|
-
//
|
|
11742
|
+
// ../expressions/src/rules/dates.ts
|
|
11716
11743
|
import ts12 from "typescript";
|
|
11717
11744
|
defineRule({
|
|
11718
11745
|
id: "invocation.dateTime.default",
|
|
@@ -12442,7 +12469,7 @@ defineRule({
|
|
|
12442
12469
|
}]
|
|
12443
12470
|
});
|
|
12444
12471
|
|
|
12445
|
-
//
|
|
12472
|
+
// ../expressions/src/rules/entity.ts
|
|
12446
12473
|
import ts13 from "typescript";
|
|
12447
12474
|
defineRule({
|
|
12448
12475
|
id: "member.entityField",
|
|
@@ -12936,7 +12963,7 @@ defineRule({
|
|
|
12936
12963
|
]
|
|
12937
12964
|
});
|
|
12938
12965
|
|
|
12939
|
-
//
|
|
12966
|
+
// ../expressions/src/rules/apps-file.ts
|
|
12940
12967
|
defineRule({
|
|
12941
12968
|
id: "member.appsFile.property",
|
|
12942
12969
|
match: (n) => (n.kind === "Member" || n.kind === "Invocation") && n.symbol.kind === "member" && n.symbol.containingType === "AppsFile" && (n.kind === "Member" || n.args.length === 0),
|
|
@@ -13004,7 +13031,7 @@ defineRule({
|
|
|
13004
13031
|
]
|
|
13005
13032
|
});
|
|
13006
13033
|
|
|
13007
|
-
//
|
|
13034
|
+
// ../expressions/src/rules/guid.ts
|
|
13008
13035
|
import ts14 from "typescript";
|
|
13009
13036
|
defineRule({
|
|
13010
13037
|
id: "guid.default",
|
|
@@ -13180,7 +13207,7 @@ defineRule({
|
|
|
13180
13207
|
}]
|
|
13181
13208
|
});
|
|
13182
13209
|
|
|
13183
|
-
//
|
|
13210
|
+
// ../expressions/src/rules/linq.ts
|
|
13184
13211
|
import ts15 from "typescript";
|
|
13185
13212
|
function defaultOf(type) {
|
|
13186
13213
|
if (type.nullable) return f3.createNull();
|
|
@@ -14018,7 +14045,7 @@ defineRule({
|
|
|
14018
14045
|
]
|
|
14019
14046
|
});
|
|
14020
14047
|
|
|
14021
|
-
//
|
|
14048
|
+
// ../expressions/src/rules/linq-more.ts
|
|
14022
14049
|
import ts16 from "typescript";
|
|
14023
14050
|
var ENUM = "System.Linq.Enumerable";
|
|
14024
14051
|
var linq = (n, names, arities) => n.kind === "Invocation" && n.symbol.kind === "member" && n.symbol.containingType === ENUM && names.includes(n.symbol.name) && arities.includes(n.args.length);
|
|
@@ -14555,7 +14582,7 @@ defineRule({
|
|
|
14555
14582
|
]
|
|
14556
14583
|
});
|
|
14557
14584
|
|
|
14558
|
-
//
|
|
14585
|
+
// ../expressions/src/rules/vb-functions.ts
|
|
14559
14586
|
import ts17 from "typescript";
|
|
14560
14587
|
var VBS = "Microsoft.VisualBasic.Strings";
|
|
14561
14588
|
var is = (n, containing, names, arities) => n.kind === "Invocation" && n.symbol.kind === "member" && n.symbol.containingType === containing && names.includes(n.symbol.name) && arities.includes(n.args.length);
|
|
@@ -14991,7 +15018,7 @@ defineRule({
|
|
|
14991
15018
|
]
|
|
14992
15019
|
});
|
|
14993
15020
|
|
|
14994
|
-
//
|
|
15021
|
+
// ../expressions/src/rules/literals-and-identifiers.ts
|
|
14995
15022
|
import ts18 from "typescript";
|
|
14996
15023
|
defineRule({
|
|
14997
15024
|
id: "literal",
|
|
@@ -15187,7 +15214,7 @@ defineRule({
|
|
|
15187
15214
|
]
|
|
15188
15215
|
});
|
|
15189
15216
|
|
|
15190
|
-
//
|
|
15217
|
+
// ../expressions/src/rules/nullable.ts
|
|
15191
15218
|
import ts19 from "typescript";
|
|
15192
15219
|
defineRule({
|
|
15193
15220
|
id: "invocation.vb.isNothing",
|
|
@@ -15441,7 +15468,7 @@ defineRule({
|
|
|
15441
15468
|
]
|
|
15442
15469
|
});
|
|
15443
15470
|
|
|
15444
|
-
//
|
|
15471
|
+
// ../expressions/src/rules/numbers.ts
|
|
15445
15472
|
import ts20 from "typescript";
|
|
15446
15473
|
import { Decimal as Decimal2 } from "decimal.js";
|
|
15447
15474
|
defineRule({
|
|
@@ -15861,7 +15888,7 @@ defineRule({
|
|
|
15861
15888
|
]
|
|
15862
15889
|
});
|
|
15863
15890
|
|
|
15864
|
-
//
|
|
15891
|
+
// ../expressions/src/rules/operators.ts
|
|
15865
15892
|
import ts21 from "typescript";
|
|
15866
15893
|
defineRule({
|
|
15867
15894
|
id: "binary.relational",
|
|
@@ -16170,7 +16197,7 @@ defineRule({
|
|
|
16170
16197
|
}]
|
|
16171
16198
|
});
|
|
16172
16199
|
|
|
16173
|
-
//
|
|
16200
|
+
// ../expressions/src/rules/strings.ts
|
|
16174
16201
|
import ts22 from "typescript";
|
|
16175
16202
|
defineMemberMappings("System.String", {
|
|
16176
16203
|
Trim: { js: "trim", proof: [[[" x "], "x"]] },
|
|
@@ -16852,7 +16879,7 @@ defineRule({
|
|
|
16852
16879
|
]
|
|
16853
16880
|
});
|
|
16854
16881
|
|
|
16855
|
-
//
|
|
16882
|
+
// ../expressions/src/rules/comparison.ts
|
|
16856
16883
|
import ts23 from "typescript";
|
|
16857
16884
|
defineRule({
|
|
16858
16885
|
id: "peephole.compareString.equality",
|
|
@@ -17115,7 +17142,7 @@ defineRule({
|
|
|
17115
17142
|
]
|
|
17116
17143
|
});
|
|
17117
17144
|
|
|
17118
|
-
//
|
|
17145
|
+
// ../expressions/src/rules/formatting.ts
|
|
17119
17146
|
defineRule({
|
|
17120
17147
|
id: "invocation.string.format",
|
|
17121
17148
|
match: (n) => n.kind === "Invocation" && n.symbol.kind === "member" && n.symbol.containingType === "System.String" && n.symbol.name === "Format" && n.args.length >= 2,
|
|
@@ -17311,7 +17338,7 @@ defineRule({
|
|
|
17311
17338
|
]
|
|
17312
17339
|
});
|
|
17313
17340
|
|
|
17314
|
-
//
|
|
17341
|
+
// ../expressions/src/rules/time-spans.ts
|
|
17315
17342
|
import ts24 from "typescript";
|
|
17316
17343
|
defineRule({
|
|
17317
17344
|
id: "invocation.timeSpan.toString",
|
|
@@ -17483,7 +17510,7 @@ defineRule({
|
|
|
17483
17510
|
]
|
|
17484
17511
|
});
|
|
17485
17512
|
|
|
17486
|
-
//
|
|
17513
|
+
// ../expressions/src/rules/list-sources.ts
|
|
17487
17514
|
defineRule({
|
|
17488
17515
|
id: "member.listSource.rows",
|
|
17489
17516
|
match: (n) => (n.kind === "Member" || n.kind === "Invocation") && n.symbol.kind === "member" && n.symbol.containingType.startsWith("ListSource") && (n.symbol.name === "data" || n.symbol.name === "totalRecords") && (n.kind === "Member" || n.args.length === 0),
|
|
@@ -17783,7 +17810,7 @@ defineRule({
|
|
|
17783
17810
|
]
|
|
17784
17811
|
});
|
|
17785
17812
|
|
|
17786
|
-
//
|
|
17813
|
+
// ../expressions/src/rules/date-parse-and-format.ts
|
|
17787
17814
|
import ts25 from "typescript";
|
|
17788
17815
|
defineRule({
|
|
17789
17816
|
id: "invocation.datetime.parse",
|
|
@@ -18055,7 +18082,7 @@ defineRule({
|
|
|
18055
18082
|
]
|
|
18056
18083
|
});
|
|
18057
18084
|
|
|
18058
|
-
//
|
|
18085
|
+
// ../expressions/src/expression-root-policy.ts
|
|
18059
18086
|
var EXPRESSION_ROOT_POLICY = {
|
|
18060
18087
|
// ── declared: the scaffold teaches Roslyn these ─────────────────────────────
|
|
18061
18088
|
action: {
|
|
@@ -18107,7 +18134,7 @@ function mentionsUndeclaredRoot(reason) {
|
|
|
18107
18134
|
}
|
|
18108
18135
|
var HOST_LIBRARY_ROOTS = ["Newtonsoft", "System", "Microsoft"];
|
|
18109
18136
|
|
|
18110
|
-
//
|
|
18137
|
+
// ../codegen-react/src/generated/e2e-ids.ts
|
|
18111
18138
|
var E2E_BY_DIR = {
|
|
18112
18139
|
"button": "forms-host-button-control",
|
|
18113
18140
|
"check-box": "forms-host-checkbox-control",
|
|
@@ -18140,7 +18167,7 @@ var E2E_BY_DIR = {
|
|
|
18140
18167
|
"text-area": "forms-host-textarea-control"
|
|
18141
18168
|
};
|
|
18142
18169
|
|
|
18143
|
-
//
|
|
18170
|
+
// ../codegen-react/src/component-registry.ts
|
|
18144
18171
|
var E2E_DIR_FOR_ROLE = {
|
|
18145
18172
|
panel: "panel",
|
|
18146
18173
|
stackPanel: "stack-panel",
|
|
@@ -18430,7 +18457,7 @@ function widgetsFor(roles) {
|
|
|
18430
18457
|
return [...seen.values()].sort((a, b) => a.package.localeCompare(b.package));
|
|
18431
18458
|
}
|
|
18432
18459
|
|
|
18433
|
-
//
|
|
18460
|
+
// ../executors/src/generated/executors.ts
|
|
18434
18461
|
var EXECUTOR_CATALOG = {
|
|
18435
18462
|
"start-automation": {
|
|
18436
18463
|
integration: null,
|
|
@@ -18547,7 +18574,7 @@ function nestedSlots(executorMethod) {
|
|
|
18547
18574
|
return EXECUTOR_CATALOG[executorMethod]?.nestedIn ?? [];
|
|
18548
18575
|
}
|
|
18549
18576
|
|
|
18550
|
-
//
|
|
18577
|
+
// ../executors/src/build-rule-tree.ts
|
|
18551
18578
|
function buildRules(raw, ruleNames2 = {}) {
|
|
18552
18579
|
let malformed = 0;
|
|
18553
18580
|
const walk = (list, depth) => {
|
|
@@ -18583,7 +18610,7 @@ function buildRules(raw, ruleNames2 = {}) {
|
|
|
18583
18610
|
return { rules: walk(raw, 0), malformed };
|
|
18584
18611
|
}
|
|
18585
18612
|
|
|
18586
|
-
//
|
|
18613
|
+
// ../executors/src/executor-policy.ts
|
|
18587
18614
|
var RULE_POLICY = {
|
|
18588
18615
|
// ── client-only: no backend, no auth, no tenant ──
|
|
18589
18616
|
"vb-set-value": { disposition: "implement" },
|
|
@@ -18637,7 +18664,7 @@ function policyFor(executorMethod) {
|
|
|
18637
18664
|
};
|
|
18638
18665
|
}
|
|
18639
18666
|
|
|
18640
|
-
//
|
|
18667
|
+
// ../executors/src/emit/config-slots.ts
|
|
18641
18668
|
import ts26 from "typescript";
|
|
18642
18669
|
var f4 = ts26.factory;
|
|
18643
18670
|
var call4 = (name, args) => f4.createExpressionStatement(f4.createCallExpression(f4.createIdentifier(name), void 0, args));
|
|
@@ -18815,7 +18842,7 @@ function inputOverrides(node, ctx) {
|
|
|
18815
18842
|
return f4.createObjectLiteralExpression(assignments, assignments.length > 1);
|
|
18816
18843
|
}
|
|
18817
18844
|
|
|
18818
|
-
//
|
|
18845
|
+
// ../executors/src/emit/client-rules.ts
|
|
18819
18846
|
import ts27 from "typescript";
|
|
18820
18847
|
function setValue(node, ctx) {
|
|
18821
18848
|
const id2 = exprId(node.config, "binding");
|
|
@@ -18951,7 +18978,7 @@ function logMessage(node, ctx) {
|
|
|
18951
18978
|
return [call4(ctx.runtime.logMessage, [level, message])];
|
|
18952
18979
|
}
|
|
18953
18980
|
|
|
18954
|
-
//
|
|
18981
|
+
// ../executors/src/emit/backend-rules.ts
|
|
18955
18982
|
import ts28 from "typescript";
|
|
18956
18983
|
var APPS_FAILURES = {
|
|
18957
18984
|
createEntity: { title: "Entity Error", message: "Unable to create entity record. Please contact your administrator" },
|
|
@@ -19203,7 +19230,7 @@ function addToQueue(node, ctx) {
|
|
|
19203
19230
|
)];
|
|
19204
19231
|
}
|
|
19205
19232
|
|
|
19206
|
-
//
|
|
19233
|
+
// ../executors/src/emit/emit-rules.ts
|
|
19207
19234
|
function emitRules(nodes, ctx) {
|
|
19208
19235
|
return nodes.flatMap((n) => emitRule(n, ctx));
|
|
19209
19236
|
}
|
|
@@ -19255,7 +19282,7 @@ function emitRule(node, ctx) {
|
|
|
19255
19282
|
}
|
|
19256
19283
|
}
|
|
19257
19284
|
|
|
19258
|
-
//
|
|
19285
|
+
// ../executors/src/rule-tree.ts
|
|
19259
19286
|
var REACT_RULE_RUNTIME = {
|
|
19260
19287
|
openPage: "openPage",
|
|
19261
19288
|
openUrl: "openUrl",
|
|
@@ -19276,7 +19303,7 @@ var REACT_RULE_RUNTIME = {
|
|
|
19276
19303
|
watchQueueItem: "watchQueueItem"
|
|
19277
19304
|
};
|
|
19278
19305
|
|
|
19279
|
-
//
|
|
19306
|
+
// ../codegen-react/src/hoist-hook-reads.ts
|
|
19280
19307
|
import ts29 from "typescript";
|
|
19281
19308
|
var HOOK_NAME = /^use[A-Z]/;
|
|
19282
19309
|
var ReadHoister = class {
|
|
@@ -19350,7 +19377,7 @@ function readName(node) {
|
|
|
19350
19377
|
return joined || "read";
|
|
19351
19378
|
}
|
|
19352
19379
|
|
|
19353
|
-
//
|
|
19380
|
+
// ../codegen-react/src/page/identifiers.ts
|
|
19354
19381
|
var pascal = (s) => {
|
|
19355
19382
|
const joined = s.replace(/[^\p{L}\p{N}]+/gu, " ").trim().split(" ").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
|
|
19356
19383
|
return new RegExp("^\\p{Nd}", "u").test(joined) ? `X${joined}` : joined || "X";
|
|
@@ -19439,7 +19466,7 @@ function reactEvent(event) {
|
|
|
19439
19466
|
}
|
|
19440
19467
|
}
|
|
19441
19468
|
|
|
19442
|
-
//
|
|
19469
|
+
// ../codegen-react/src/components/generic-components.ts
|
|
19443
19470
|
function eventPropsFor(role) {
|
|
19444
19471
|
const out = /* @__PURE__ */ new Set();
|
|
19445
19472
|
for (const [component, events2] of Object.entries(CONTROL_EVENTS)) {
|
|
@@ -19830,7 +19857,7 @@ export function UiUnsupported(p: UiUnsupportedProps) {
|
|
|
19830
19857
|
}
|
|
19831
19858
|
`;
|
|
19832
19859
|
|
|
19833
|
-
//
|
|
19860
|
+
// ../codegen-react/src/components/base-component.ts
|
|
19834
19861
|
var BASE = `import { Component, createContext, useContext, useEffect, useRef, useState } from 'react';
|
|
19835
19862
|
import type { CSSProperties, MouseEvent, ReactNode } from 'react';
|
|
19836
19863
|
import { armChangeRules, fieldOf, fireChangeRule, setControlProp, setUnscopedProp, TOUCHED_PROP,
|
|
@@ -20478,7 +20505,7 @@ export function sanitizeHtml(html: string): string {
|
|
|
20478
20505
|
}
|
|
20479
20506
|
`;
|
|
20480
20507
|
|
|
20481
|
-
//
|
|
20508
|
+
// ../codegen-react/src/components/edit-grid.ts
|
|
20482
20509
|
function editGridComponent(spec) {
|
|
20483
20510
|
return `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20484
20511
|
import { AgGridReact } from 'ag-grid-react';
|
|
@@ -21250,7 +21277,7 @@ export function ${spec.component}(p: ${spec.component}Props) {
|
|
|
21250
21277
|
`;
|
|
21251
21278
|
}
|
|
21252
21279
|
|
|
21253
|
-
//
|
|
21280
|
+
// ../codegen-react/src/components/simple-table.ts
|
|
21254
21281
|
function tableComponent(spec) {
|
|
21255
21282
|
return `import { useContext, useState } from 'react';
|
|
21256
21283
|
import { baseAttrs, cellText, isHidden, PageScope, useOnLoad, type UiBaseProps } from './ui-base';
|
|
@@ -21437,7 +21464,7 @@ export function ${spec.component}(p: ${spec.component}Props) {
|
|
|
21437
21464
|
`;
|
|
21438
21465
|
}
|
|
21439
21466
|
|
|
21440
|
-
//
|
|
21467
|
+
// ../codegen-react/src/components/rich-text.ts
|
|
21441
21468
|
var richTextComponent = (_spec) => `import { Editor } from '@hugerte/hugerte-react';
|
|
21442
21469
|
import { useLayoutEffect, useRef, useState } from 'react';
|
|
21443
21470
|
/*
|
|
@@ -21621,7 +21648,7 @@ export function UiRichText(p: UiRichTextProps) {
|
|
|
21621
21648
|
}
|
|
21622
21649
|
`;
|
|
21623
21650
|
|
|
21624
|
-
//
|
|
21651
|
+
// ../codegen-react/src/components/button.ts
|
|
21625
21652
|
var buttonComponent = (spec) => `import { Button } from '${apolloImport(spec.apollo)}';
|
|
21626
21653
|
|
|
21627
21654
|
import { fireRule, baseAttrs, displayText, isHidden, useOnLoad, type UiBaseProps } from './ui-base';
|
|
@@ -21672,7 +21699,7 @@ export function UiButton(p: UiButtonProps) {
|
|
|
21672
21699
|
}
|
|
21673
21700
|
`;
|
|
21674
21701
|
|
|
21675
|
-
//
|
|
21702
|
+
// ../codegen-react/src/components/custom-list.ts
|
|
21676
21703
|
var customListComponent = () => `import { useCallback, useContext, useEffect, useMemo, useState, type ReactNode } from 'react';
|
|
21677
21704
|
import { RowScope, clearRowSlots, fieldOf, setControlProp } from '../../lib/runtime';
|
|
21678
21705
|
import { fireRule, baseAttrs, isHidden, PageScope, useOnLoad, type UiBaseProps } from './ui-base';
|
|
@@ -21761,7 +21788,7 @@ export function UiCustomList(p: UiCustomListProps) {
|
|
|
21761
21788
|
);
|
|
21762
21789
|
}`;
|
|
21763
21790
|
|
|
21764
|
-
//
|
|
21791
|
+
// ../codegen-react/src/components/display-controls.ts
|
|
21765
21792
|
var labelComponent = () => `import { baseAttrs, displayText, isHidden, useOnLoad, type UiBaseProps } from './ui-base';
|
|
21766
21793
|
|
|
21767
21794
|
export interface UiLabelProps extends UiBaseProps {
|
|
@@ -22356,7 +22383,447 @@ export function UiIframe(p: UiIframeProps) {
|
|
|
22356
22383
|
}
|
|
22357
22384
|
`;
|
|
22358
22385
|
var htmlTextComponent = () => htmlComponent("UiHtmlText");
|
|
22359
|
-
var customHtmlComponent = () =>
|
|
22386
|
+
var customHtmlComponent = () => `import { useLayoutEffect, useRef, useState } from 'react';
|
|
22387
|
+
import { baseAttrs, isHidden, useOnLoad, type UiBaseProps } from './ui-base';
|
|
22388
|
+
import { sanitizeHtml } from './sanitize';
|
|
22389
|
+
|
|
22390
|
+
/** What a page hands a Custom HTML control so its script can use \`App\` \u2014 see \`src/custom-html/bridge.ts\`. */
|
|
22391
|
+
export interface CustomHtmlBridge {
|
|
22392
|
+
/** The script that runs in the frame before the control's own code. */
|
|
22393
|
+
boot: string;
|
|
22394
|
+
/** This app's name, which keeps its controls' storage apart from other apps' on the same origin. */
|
|
22395
|
+
storageScope: string;
|
|
22396
|
+
has(name: string): boolean;
|
|
22397
|
+
get(name: string): unknown;
|
|
22398
|
+
set(name: string, value: unknown): void;
|
|
22399
|
+
subscribe(listener: () => void): () => void;
|
|
22400
|
+
}
|
|
22401
|
+
|
|
22402
|
+
/** A control's own code \u2014 the files under \`src/custom-html/\`. */
|
|
22403
|
+
export interface CustomHtmlCode {
|
|
22404
|
+
html?: string;
|
|
22405
|
+
css?: string;
|
|
22406
|
+
js?: string;
|
|
22407
|
+
cssExternal: string[];
|
|
22408
|
+
jsExternal: string[];
|
|
22409
|
+
bridge: CustomHtmlBridge;
|
|
22410
|
+
}
|
|
22411
|
+
|
|
22412
|
+
export interface UiCustomHtmlProps extends UiBaseProps {
|
|
22413
|
+
text?: string;
|
|
22414
|
+
/** Present when the control has its own HTML, CSS and JavaScript, rather than inline \`text\`. */
|
|
22415
|
+
code?: CustomHtmlCode;
|
|
22416
|
+
}
|
|
22417
|
+
|
|
22418
|
+
/**
|
|
22419
|
+
* Renders authored HTML.
|
|
22420
|
+
*
|
|
22421
|
+
* Inline \`text\` is sanitised and placed in the page \u2014 it can come from an expression, and
|
|
22422
|
+
* therefore from user-entered data. See \`sanitize.ts\`.
|
|
22423
|
+
*
|
|
22424
|
+
* A control's own HTML, CSS and JavaScript run as written, in a sandboxed frame, talking to
|
|
22425
|
+
* the app through \`App.getVariable\` / \`setVariable\` / \`onVariableChange\` / \`setHeight\`.
|
|
22426
|
+
*/
|
|
22427
|
+
export function UiCustomHtml(p: UiCustomHtmlProps) {
|
|
22428
|
+
useOnLoad(p);
|
|
22429
|
+
if (isHidden(p)) return null;
|
|
22430
|
+
if (p.code) return <CustomHtmlFrame {...p} code={p.code} />;
|
|
22431
|
+
return (
|
|
22432
|
+
<div
|
|
22433
|
+
{...baseAttrs(p)}
|
|
22434
|
+
dangerouslySetInnerHTML={{ __html: sanitizeHtml(p.text ?? '') }}
|
|
22435
|
+
/>
|
|
22436
|
+
);
|
|
22437
|
+
}
|
|
22438
|
+
|
|
22439
|
+
/**
|
|
22440
|
+
* The frame's document: the control's code as data, then the boot script that builds the
|
|
22441
|
+
* control from it. \`<\` is escaped inside the JSON so no document can close the script that
|
|
22442
|
+
* carries it. \`nonce\` lets the page tell this document from one the frame navigates to.
|
|
22443
|
+
*/
|
|
22444
|
+
function frameDocument(code: CustomHtmlCode, disabled: boolean, nonce: string): string {
|
|
22445
|
+
const payload = JSON.stringify({
|
|
22446
|
+
html: code.html ?? '', css: code.css ?? '', js: code.js ?? '',
|
|
22447
|
+
cssExternal: code.cssExternal, jsExternal: code.jsExternal, disabled, nonce,
|
|
22448
|
+
}).replace(/</g, '\\\\u003c').replace(/\\u2028/g, '\\\\u2028').replace(/\\u2029/g, '\\\\u2029');
|
|
22449
|
+
return '<!DOCTYPE html><html><head><meta charset="utf-8">'
|
|
22450
|
+
+ '<style>html,body{height:100%;margin:0}</style>'
|
|
22451
|
+
+ '<script>window.__uiappCustomHtml=' + payload + ';</script>'
|
|
22452
|
+
+ '<script>' + code.bridge.boot.replace(/<\\/script/gi, '<\\\\/script') + '</script>'
|
|
22453
|
+
+ '</head><body></body></html>';
|
|
22454
|
+
}
|
|
22455
|
+
|
|
22456
|
+
/** Sends a message carrying \`value\` as-is, or its JSON form when it cannot be cloned; false if neither. */
|
|
22457
|
+
function sendValue(port: MessagePort | null, build: (value: unknown) => object, value: unknown): boolean {
|
|
22458
|
+
if (!port) return false;
|
|
22459
|
+
try {
|
|
22460
|
+
port.postMessage(build(value));
|
|
22461
|
+
return true;
|
|
22462
|
+
} catch {
|
|
22463
|
+
try {
|
|
22464
|
+
port.postMessage(build(JSON.parse(JSON.stringify(value ?? null))));
|
|
22465
|
+
return true;
|
|
22466
|
+
} catch {
|
|
22467
|
+
return false;
|
|
22468
|
+
}
|
|
22469
|
+
}
|
|
22470
|
+
}
|
|
22471
|
+
|
|
22472
|
+
const UNSENDABLE = { error: 'The value cannot be sent to the control.' };
|
|
22473
|
+
|
|
22474
|
+
function randomNonce(): string {
|
|
22475
|
+
const bytes = crypto.getRandomValues(new Uint8Array(16));
|
|
22476
|
+
return Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
|
|
22477
|
+
}
|
|
22478
|
+
|
|
22479
|
+
/** A copy to compare later values against, so a value changed in place still counts as a change. */
|
|
22480
|
+
function copyOf(value: unknown): unknown {
|
|
22481
|
+
try {
|
|
22482
|
+
return structuredClone(value);
|
|
22483
|
+
} catch {
|
|
22484
|
+
return value;
|
|
22485
|
+
}
|
|
22486
|
+
}
|
|
22487
|
+
|
|
22488
|
+
/**
|
|
22489
|
+
* Deep equality, as Apps decides whether a variable changed: same primitives (NaN equal to
|
|
22490
|
+
* NaN), same dates, and arrays and objects with the same keys holding equal values \u2014 a key
|
|
22491
|
+
* holding \`undefined\` is not the same as a missing one. Cycles are followed once.
|
|
22492
|
+
*/
|
|
22493
|
+
function same(a: unknown, b: unknown, seen = new Map<object, object>()): boolean {
|
|
22494
|
+
if (a === b || (a !== a && b !== b)) return true;
|
|
22495
|
+
if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) return false;
|
|
22496
|
+
const isDate = (v: object): v is Date => Object.prototype.toString.call(v) === '[object Date]';
|
|
22497
|
+
if (isDate(a) || isDate(b)) return isDate(a) && isDate(b) && a.getTime() === b.getTime();
|
|
22498
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
22499
|
+
if (seen.get(a) === b) return true;
|
|
22500
|
+
seen.set(a, b);
|
|
22501
|
+
const x = a as Record<string, unknown>;
|
|
22502
|
+
const y = b as Record<string, unknown>;
|
|
22503
|
+
const keys = Object.keys(x);
|
|
22504
|
+
if (keys.length !== Object.keys(y).length) return false;
|
|
22505
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(y, k) && same(x[k], y[k], seen));
|
|
22506
|
+
}
|
|
22507
|
+
|
|
22508
|
+
/*
|
|
22509
|
+
* The controls' \`localStorage\`, \`sessionStorage\` and \`document.cookie\`. The frame cannot
|
|
22510
|
+
* use this app's own storage, so the page keeps the controls' entries under a prefix of its
|
|
22511
|
+
* own \u2014 \`uiapp-custom-html:<app>:<area>:<key>\` \u2014 and shares them between every Custom HTML
|
|
22512
|
+
* control in this app, and no other: \`local\` in localStorage, \`session\` and \`cookie\`
|
|
22513
|
+
* together in sessionStorage. Apps on one origin share the browser's quota, so the budget
|
|
22514
|
+
* counts every app's entries in a browser store, well under the browser's limit so that
|
|
22515
|
+
* the app's own storage always has room. The frame applies the same budget.
|
|
22516
|
+
*/
|
|
22517
|
+
type Area = 'local' | 'session' | 'cookie';
|
|
22518
|
+
const AREAS: readonly Area[] = ['local', 'session', 'cookie'];
|
|
22519
|
+
const PREFIX = 'uiapp-custom-html:';
|
|
22520
|
+
const BUDGET = 1_000_000;
|
|
22521
|
+
const MAX_KEYS = 10_000;
|
|
22522
|
+
const openFrames = new Set<MessagePort>();
|
|
22523
|
+
|
|
22524
|
+
function backing(area: Area): Storage | null {
|
|
22525
|
+
try {
|
|
22526
|
+
return area === 'local' ? window.localStorage : window.sessionStorage;
|
|
22527
|
+
} catch {
|
|
22528
|
+
return null;
|
|
22529
|
+
}
|
|
22530
|
+
}
|
|
22531
|
+
|
|
22532
|
+
/** Every prefixed entry in one browser store, by its full key. Rebuilt when another tab writes. */
|
|
22533
|
+
const ledgers = new Map<Storage, Map<string, string>>();
|
|
22534
|
+
if (typeof window !== 'undefined') window.addEventListener('storage', () => ledgers.clear());
|
|
22535
|
+
|
|
22536
|
+
function ledger(store: Storage): Map<string, string> {
|
|
22537
|
+
let entries = ledgers.get(store);
|
|
22538
|
+
if (!entries) {
|
|
22539
|
+
entries = new Map();
|
|
22540
|
+
for (let i = 0; i < store.length; i++) {
|
|
22541
|
+
const k = store.key(i);
|
|
22542
|
+
if (k?.startsWith(PREFIX)) entries.set(k, store.getItem(k) ?? '');
|
|
22543
|
+
}
|
|
22544
|
+
ledgers.set(store, entries);
|
|
22545
|
+
}
|
|
22546
|
+
return entries;
|
|
22547
|
+
}
|
|
22548
|
+
|
|
22549
|
+
/** The prefix of one app's entries in one area; the app's name is encoded so it holds no \`:\`. */
|
|
22550
|
+
function prefixOf(scope: string, area: Area): string {
|
|
22551
|
+
return PREFIX + encodeURIComponent(scope) + ':' + area + ':';
|
|
22552
|
+
}
|
|
22553
|
+
|
|
22554
|
+
interface Snapshot {
|
|
22555
|
+
scope: string;
|
|
22556
|
+
local: Record<string, string>;
|
|
22557
|
+
session: Record<string, string>;
|
|
22558
|
+
cookie: Record<string, string>;
|
|
22559
|
+
/** What other apps' entries already use of each browser store's budget. */
|
|
22560
|
+
reserved: { local: { chars: number; keys: number }; session: { chars: number; keys: number } };
|
|
22561
|
+
}
|
|
22562
|
+
|
|
22563
|
+
function snapshot(scope: string): Snapshot {
|
|
22564
|
+
// Null-prototype, so an entry named \`__proto__\` is kept like any other.
|
|
22565
|
+
const out: Snapshot = {
|
|
22566
|
+
scope: encodeURIComponent(scope),
|
|
22567
|
+
local: Object.create(null), session: Object.create(null), cookie: Object.create(null),
|
|
22568
|
+
reserved: { local: { chars: 0, keys: 0 }, session: { chars: 0, keys: 0 } },
|
|
22569
|
+
};
|
|
22570
|
+
const mine = PREFIX + encodeURIComponent(scope) + ':';
|
|
22571
|
+
for (const store of ['local', 'session'] as const) {
|
|
22572
|
+
const s = backing(store);
|
|
22573
|
+
if (!s) continue;
|
|
22574
|
+
ledger(s).forEach((v, k) => {
|
|
22575
|
+
if (!k.startsWith(mine)) {
|
|
22576
|
+
out.reserved[store].chars += k.length + v.length;
|
|
22577
|
+
out.reserved[store].keys++;
|
|
22578
|
+
}
|
|
22579
|
+
});
|
|
22580
|
+
}
|
|
22581
|
+
for (const area of AREAS) {
|
|
22582
|
+
const store = backing(area);
|
|
22583
|
+
if (!store) continue;
|
|
22584
|
+
const prefix = prefixOf(scope, area);
|
|
22585
|
+
ledger(store).forEach((v, k) => {
|
|
22586
|
+
if (k.startsWith(prefix)) out[area][k.slice(prefix.length)] = v;
|
|
22587
|
+
});
|
|
22588
|
+
}
|
|
22589
|
+
return out;
|
|
22590
|
+
}
|
|
22591
|
+
|
|
22592
|
+
/** What the page holds for one key, or null. */
|
|
22593
|
+
function stored(scope: string, area: Area, key: string): string | null {
|
|
22594
|
+
const store = backing(area);
|
|
22595
|
+
return store ? ledger(store).get(prefixOf(scope, area) + key) ?? null : null;
|
|
22596
|
+
}
|
|
22597
|
+
|
|
22598
|
+
/** Keeps one change; false when it is malformed, over the budget, or the browser refuses it. */
|
|
22599
|
+
function keep(scope: string, area: Area, key: unknown, value: unknown, clear: boolean): boolean {
|
|
22600
|
+
const store = backing(area);
|
|
22601
|
+
if (!store) return false;
|
|
22602
|
+
const prefix = prefixOf(scope, area);
|
|
22603
|
+
try {
|
|
22604
|
+
const entries = ledger(store);
|
|
22605
|
+
if (clear) {
|
|
22606
|
+
[...entries.keys()].filter((k) => k.startsWith(prefix)).forEach((k) => {
|
|
22607
|
+
store.removeItem(k);
|
|
22608
|
+
entries.delete(k);
|
|
22609
|
+
});
|
|
22610
|
+
return true;
|
|
22611
|
+
}
|
|
22612
|
+
if (typeof key !== 'string' || (value !== null && typeof value !== 'string')) return false;
|
|
22613
|
+
const full = prefix + key;
|
|
22614
|
+
if (value === null) {
|
|
22615
|
+
store.removeItem(full);
|
|
22616
|
+
entries.delete(full);
|
|
22617
|
+
return true;
|
|
22618
|
+
}
|
|
22619
|
+
let chars = full.length + value.length;
|
|
22620
|
+
entries.forEach((v, k) => {
|
|
22621
|
+
if (k !== full) chars += k.length + v.length;
|
|
22622
|
+
});
|
|
22623
|
+
if (chars > BUDGET || entries.size + (entries.has(full) ? 0 : 1) > MAX_KEYS) return false;
|
|
22624
|
+
store.setItem(full, value);
|
|
22625
|
+
entries.set(full, value);
|
|
22626
|
+
return true;
|
|
22627
|
+
} catch {
|
|
22628
|
+
return false;
|
|
22629
|
+
}
|
|
22630
|
+
}
|
|
22631
|
+
|
|
22632
|
+
const LOAD_ERROR = 'Failed to load the following external resources.';
|
|
22633
|
+
|
|
22634
|
+
/**
|
|
22635
|
+
* Sandboxed without \`allow-same-origin\`, so the control's script cannot reach this app's
|
|
22636
|
+
* page, session or storage; the channel below is the only way out.
|
|
22637
|
+
*/
|
|
22638
|
+
function CustomHtmlFrame(p: UiCustomHtmlProps & { code: CustomHtmlCode }) {
|
|
22639
|
+
const frame = useRef<HTMLIFrameElement>(null);
|
|
22640
|
+
const { code } = p;
|
|
22641
|
+
const disabled = p.disabled === true;
|
|
22642
|
+
// As in Apps, the frame is built once with the control's state at that moment; a later
|
|
22643
|
+
// change to \`disabled\` blocks or frees the control without rebuilding it.
|
|
22644
|
+
const initiallyDisabled = useRef(disabled).current;
|
|
22645
|
+
// A new secret only when the code itself changes, not on every render of the page.
|
|
22646
|
+
const source = JSON.stringify([code.html, code.css, code.js, code.cssExternal, code.jsExternal]);
|
|
22647
|
+
const secret = useRef<{ source: string; nonce: string } | null>(null);
|
|
22648
|
+
if (secret.current?.source !== source) secret.current = { source, nonce: randomNonce() };
|
|
22649
|
+
const nonce = secret.current.nonce;
|
|
22650
|
+
const doc = frameDocument(code, initiallyDisabled, nonce);
|
|
22651
|
+
const [loading, setLoading] = useState(true);
|
|
22652
|
+
const [failed, setFailed] = useState<string[]>([]);
|
|
22653
|
+
|
|
22654
|
+
// A layout effect, so the listener is in place before the frame can load and say ready.
|
|
22655
|
+
useLayoutEffect(() => {
|
|
22656
|
+
const iframe = frame.current;
|
|
22657
|
+
if (!iframe) return undefined;
|
|
22658
|
+
const bridge = code.bridge;
|
|
22659
|
+
let port: MessagePort | null = null;
|
|
22660
|
+
const watches = new Map<string, { last: unknown; stop: () => void }>();
|
|
22661
|
+
const invalid = { code: 'invalid-variable-name' };
|
|
22662
|
+
const reply = (id: unknown, ok: boolean, data: unknown) => {
|
|
22663
|
+
if (!sendValue(port, (d) => ({ type: 'reply', id, ok, data: d }), data)) {
|
|
22664
|
+
port?.postMessage({ type: 'reply', id, ok: false, data: UNSENDABLE });
|
|
22665
|
+
}
|
|
22666
|
+
};
|
|
22667
|
+
|
|
22668
|
+
const onPort = (e: MessageEvent) => {
|
|
22669
|
+
const m = (e.data ?? {}) as {
|
|
22670
|
+
type?: unknown; id?: unknown; name?: unknown; value?: unknown;
|
|
22671
|
+
area?: unknown; key?: unknown; clear?: unknown; url?: unknown;
|
|
22672
|
+
};
|
|
22673
|
+
const name = typeof m.name === 'string' ? m.name : '';
|
|
22674
|
+
switch (m.type) {
|
|
22675
|
+
case 'get':
|
|
22676
|
+
if (!bridge.has(name)) reply(m.id, false, invalid);
|
|
22677
|
+
else reply(m.id, true, bridge.get(name));
|
|
22678
|
+
return;
|
|
22679
|
+
case 'set':
|
|
22680
|
+
if (!bridge.has(name)) {
|
|
22681
|
+
reply(m.id, false, invalid);
|
|
22682
|
+
return;
|
|
22683
|
+
}
|
|
22684
|
+
bridge.set(name, m.value);
|
|
22685
|
+
reply(m.id, true, undefined);
|
|
22686
|
+
return;
|
|
22687
|
+
case 'watch': {
|
|
22688
|
+
if (!bridge.has(name)) {
|
|
22689
|
+
port?.postMessage({ type: 'error',
|
|
22690
|
+
data: 'onVariableChange registration failed. "' + name + '" is not a valid app variable name' });
|
|
22691
|
+
return;
|
|
22692
|
+
}
|
|
22693
|
+
if (watches.has(name)) return;
|
|
22694
|
+
// No initial value: a script reads one with getVariable.
|
|
22695
|
+
const w = { last: copyOf(bridge.get(name)), stop: () => {} };
|
|
22696
|
+
w.stop = bridge.subscribe(() => {
|
|
22697
|
+
const value = bridge.get(name);
|
|
22698
|
+
if (same(value, w.last)) return;
|
|
22699
|
+
w.last = copyOf(value);
|
|
22700
|
+
if (!sendValue(port, (v) => ({ type: 'change', name, value: v }), value)) {
|
|
22701
|
+
port?.postMessage({ type: 'error', data: 'onVariableChange: the new value of "' + name + '" cannot be sent to the control' });
|
|
22702
|
+
}
|
|
22703
|
+
});
|
|
22704
|
+
watches.set(name, w);
|
|
22705
|
+
return;
|
|
22706
|
+
}
|
|
22707
|
+
case 'unwatch':
|
|
22708
|
+
watches.get(name)?.stop();
|
|
22709
|
+
watches.delete(name);
|
|
22710
|
+
return;
|
|
22711
|
+
case 'height': {
|
|
22712
|
+
// The frame has already checked the value; checked again because the page does not
|
|
22713
|
+
// trust the frame.
|
|
22714
|
+
const h = String(m.value ?? '');
|
|
22715
|
+
if (h && CSS.supports('height', h)) iframe.style.height = h;
|
|
22716
|
+
return;
|
|
22717
|
+
}
|
|
22718
|
+
case 'storage': {
|
|
22719
|
+
const area = AREAS.find((a) => a === m.area);
|
|
22720
|
+
const clear = m.clear === true;
|
|
22721
|
+
if (!area) return;
|
|
22722
|
+
if (!keep(bridge.storageScope, area, m.key, m.value ?? null, clear)) {
|
|
22723
|
+
// Not kept \u2014 the app's own storage is full, say: put the frame back as it was,
|
|
22724
|
+
// so it does not go on reading a value a reload would lose.
|
|
22725
|
+
if (!clear && typeof m.key === 'string') {
|
|
22726
|
+
port?.postMessage({ type: 'storage-rejected', area, key: m.key, value: stored(bridge.storageScope, area, m.key) });
|
|
22727
|
+
}
|
|
22728
|
+
return;
|
|
22729
|
+
}
|
|
22730
|
+
const change = { type: 'storage', area, key: m.key, value: m.value ?? null, clear };
|
|
22731
|
+
openFrames.forEach((other) => {
|
|
22732
|
+
if (other !== port) other.postMessage(change);
|
|
22733
|
+
});
|
|
22734
|
+
return;
|
|
22735
|
+
}
|
|
22736
|
+
case 'resource-error':
|
|
22737
|
+
if (typeof m.url === 'string') {
|
|
22738
|
+
const url = m.url;
|
|
22739
|
+
setFailed((list) => (list.includes(url) ? list : [...list, url]));
|
|
22740
|
+
}
|
|
22741
|
+
return;
|
|
22742
|
+
case 'loaded':
|
|
22743
|
+
setLoading(false);
|
|
22744
|
+
return;
|
|
22745
|
+
default:
|
|
22746
|
+
}
|
|
22747
|
+
};
|
|
22748
|
+
|
|
22749
|
+
const disconnect = () => {
|
|
22750
|
+
watches.forEach((w) => w.stop());
|
|
22751
|
+
watches.clear();
|
|
22752
|
+
if (port) openFrames.delete(port);
|
|
22753
|
+
port?.close();
|
|
22754
|
+
port = null;
|
|
22755
|
+
};
|
|
22756
|
+
|
|
22757
|
+
// Only this frame, and only the document written here \u2014 which carries \`nonce\`; a page the
|
|
22758
|
+
// frame navigates to does not. The document may reload itself, and is then connected anew.
|
|
22759
|
+
const onWindow = (e: MessageEvent) => {
|
|
22760
|
+
if (e.source !== iframe.contentWindow || e.origin !== 'null') return;
|
|
22761
|
+
const ready = e.data as { type?: unknown; nonce?: unknown } | null;
|
|
22762
|
+
if (ready?.type !== 'uiapp-custom-html-ready' || ready.nonce !== nonce) return;
|
|
22763
|
+
disconnect();
|
|
22764
|
+
setLoading(true);
|
|
22765
|
+
setFailed([]);
|
|
22766
|
+
const channel = new MessageChannel();
|
|
22767
|
+
port = channel.port1;
|
|
22768
|
+
port.onmessage = onPort;
|
|
22769
|
+
openFrames.add(port);
|
|
22770
|
+
iframe.contentWindow?.postMessage({ type: 'uiapp-custom-html-port', storage: snapshot(bridge.storageScope) }, '*', [channel.port2]);
|
|
22771
|
+
};
|
|
22772
|
+
window.addEventListener('message', onWindow);
|
|
22773
|
+
return () => {
|
|
22774
|
+
window.removeEventListener('message', onWindow);
|
|
22775
|
+
disconnect();
|
|
22776
|
+
};
|
|
22777
|
+
}, [doc, nonce, code.bridge]);
|
|
22778
|
+
|
|
22779
|
+
const attrs = baseAttrs(p);
|
|
22780
|
+
const label = p.ariaLabel === undefined || p.ariaLabel === null || p.ariaLabel === '' ? p.ctl : String(p.ariaLabel);
|
|
22781
|
+
const error = failed.length ? LOAD_ERROR + '\\n' + failed.join('\\n') : '';
|
|
22782
|
+
return (
|
|
22783
|
+
<div {...attrs} style={disabled ? { ...attrs.style, pointerEvents: 'none' } : attrs.style}>
|
|
22784
|
+
<div style={{ position: 'relative', width: '100%', height: '100%' }}>
|
|
22785
|
+
<iframe
|
|
22786
|
+
ref={frame}
|
|
22787
|
+
title={label}
|
|
22788
|
+
srcDoc={doc}
|
|
22789
|
+
sandbox="allow-scripts allow-forms"
|
|
22790
|
+
referrerPolicy="no-referrer"
|
|
22791
|
+
tabIndex={disabled ? -1 : 0}
|
|
22792
|
+
style={{ display: 'block', width: '100%', height: '100%', border: 0 }}
|
|
22793
|
+
/>
|
|
22794
|
+
{loading && (
|
|
22795
|
+
<svg
|
|
22796
|
+
aria-hidden="true"
|
|
22797
|
+
width="32"
|
|
22798
|
+
height="32"
|
|
22799
|
+
viewBox="0 0 32 32"
|
|
22800
|
+
style={{ position: 'absolute', top: '50%', left: '50%', margin: '-16px 0 0 -16px', pointerEvents: 'none' }}
|
|
22801
|
+
>
|
|
22802
|
+
<circle cx="16" cy="16" r="13" fill="none" stroke="#0067df" strokeWidth="3" strokeLinecap="round" strokeDasharray="61 21">
|
|
22803
|
+
<animateTransform attributeName="transform" type="rotate" from="0 16 16" to="360 16 16" dur="0.9s" repeatCount="indefinite" />
|
|
22804
|
+
</circle>
|
|
22805
|
+
</svg>
|
|
22806
|
+
)}
|
|
22807
|
+
{error && (
|
|
22808
|
+
<svg
|
|
22809
|
+
role="img"
|
|
22810
|
+
aria-label={error}
|
|
22811
|
+
width="20"
|
|
22812
|
+
height="20"
|
|
22813
|
+
viewBox="0 0 20 20"
|
|
22814
|
+
style={{ position: 'absolute', top: 8, right: 8 }}
|
|
22815
|
+
>
|
|
22816
|
+
<title>{error}</title>
|
|
22817
|
+
<circle cx="10" cy="10" r="9" fill="#cc3d45" />
|
|
22818
|
+
<rect x="9" y="4.5" width="2" height="7" rx="1" fill="#fff" />
|
|
22819
|
+
<circle cx="10" cy="14.5" r="1.2" fill="#fff" />
|
|
22820
|
+
</svg>
|
|
22821
|
+
)}
|
|
22822
|
+
</div>
|
|
22823
|
+
</div>
|
|
22824
|
+
);
|
|
22825
|
+
}
|
|
22826
|
+
`;
|
|
22360
22827
|
function htmlComponent(name) {
|
|
22361
22828
|
return `import { baseAttrs, isHidden, useOnLoad, type UiBaseProps } from './ui-base';
|
|
22362
22829
|
import { sanitizeHtml } from './sanitize';
|
|
@@ -22382,7 +22849,7 @@ export function ${name}(p: ${name}Props) {
|
|
|
22382
22849
|
`;
|
|
22383
22850
|
}
|
|
22384
22851
|
|
|
22385
|
-
//
|
|
22852
|
+
// ../codegen-react/src/components/input-fields.ts
|
|
22386
22853
|
var radioGroupComponent = (spec) => `import { RadioGroup, RadioGroupItem } from '${apolloImport(spec.apollo)}';
|
|
22387
22854
|
|
|
22388
22855
|
import { setControlProp } from '../../lib/runtime';
|
|
@@ -22833,7 +23300,7 @@ export function UiDatePicker(p: UiDatePickerProps) {
|
|
|
22833
23300
|
}
|
|
22834
23301
|
`;
|
|
22835
23302
|
|
|
22836
|
-
//
|
|
23303
|
+
// ../codegen-react/src/components/file-controls.ts
|
|
22837
23304
|
var fileUploadComponent = () => `import { useContext, useRef, useState } from 'react';
|
|
22838
23305
|
import { setControlProp } from '../../lib/runtime';
|
|
22839
23306
|
import { baseAttrs, displayText, fileDisplayName, isHidden, labelAfter, PageScope,
|
|
@@ -23043,7 +23510,7 @@ export function UiFileDownload(p: UiFileDownloadProps) {
|
|
|
23043
23510
|
}
|
|
23044
23511
|
`;
|
|
23045
23512
|
|
|
23046
|
-
//
|
|
23513
|
+
// ../codegen-react/src/components/list-box.ts
|
|
23047
23514
|
function listBoxComponent(spec) {
|
|
23048
23515
|
return `import { useContext, useState } from 'react';
|
|
23049
23516
|
import { fieldOf, fireChangeRule, setControlProp } from '../../lib/runtime';
|
|
@@ -23106,7 +23573,7 @@ export function ${spec.component}(p: ${spec.component}Props) {
|
|
|
23106
23573
|
`;
|
|
23107
23574
|
}
|
|
23108
23575
|
|
|
23109
|
-
//
|
|
23576
|
+
// ../codegen-react/src/components/containers.ts
|
|
23110
23577
|
var tabsComponent = () => `import { useEffect, useRef, useState, useContext } from 'react';
|
|
23111
23578
|
import { fieldOf, fireChangeRule, setControlProp } from '../../lib/runtime';
|
|
23112
23579
|
import { baseAttrs, isHidden, PageScope, useOnLoad, type UiBaseProps } from './ui-base';
|
|
@@ -23295,7 +23762,7 @@ export function UiPageContainer(p: UiPageContainerProps) {
|
|
|
23295
23762
|
);
|
|
23296
23763
|
}`;
|
|
23297
23764
|
|
|
23298
|
-
//
|
|
23765
|
+
// ../codegen-react/src/components/hand-written.ts
|
|
23299
23766
|
var HAND_WRITTEN = {
|
|
23300
23767
|
button: buttonComponent,
|
|
23301
23768
|
customList: customListComponent,
|
|
@@ -23321,7 +23788,7 @@ var HAND_WRITTEN = {
|
|
|
23321
23788
|
unknown: void 0
|
|
23322
23789
|
};
|
|
23323
23790
|
|
|
23324
|
-
//
|
|
23791
|
+
// ../codegen-react/src/components/emit-components.ts
|
|
23325
23792
|
function withE2e(source, role) {
|
|
23326
23793
|
const id2 = e2eIdFor(role);
|
|
23327
23794
|
if (!id2) return source;
|
|
@@ -23402,7 +23869,7 @@ export { PageProvider } from './ui-base';
|
|
|
23402
23869
|
};
|
|
23403
23870
|
}
|
|
23404
23871
|
|
|
23405
|
-
//
|
|
23872
|
+
// ../codegen-react/src/components/declared-props.ts
|
|
23406
23873
|
function propsOf(source) {
|
|
23407
23874
|
const names = /* @__PURE__ */ new Set();
|
|
23408
23875
|
const header = /interface\s+\w*Props\b[^{]*\{/g;
|
|
@@ -23437,7 +23904,7 @@ function declaredProps(role) {
|
|
|
23437
23904
|
return names;
|
|
23438
23905
|
}
|
|
23439
23906
|
|
|
23440
|
-
//
|
|
23907
|
+
// ../codegen-react/src/page/code-facts.ts
|
|
23441
23908
|
import ts30 from "typescript";
|
|
23442
23909
|
function identifiersIn(text, kind) {
|
|
23443
23910
|
const sf = ts30.createSourceFile(
|
|
@@ -23474,7 +23941,7 @@ function referencesIdentifier(text, name, kind = "tsx") {
|
|
|
23474
23941
|
return identifiers.has(name);
|
|
23475
23942
|
}
|
|
23476
23943
|
|
|
23477
|
-
//
|
|
23944
|
+
// ../codegen-react/src/page/printer.ts
|
|
23478
23945
|
import ts31 from "typescript";
|
|
23479
23946
|
var jsxString = (v) => JSON.stringify(v);
|
|
23480
23947
|
var jsxAttrValue = (v) => {
|
|
@@ -23493,7 +23960,7 @@ var blankFile = ts31.createSourceFile("h.ts", "", ts31.ScriptTarget.Latest, fals
|
|
|
23493
23960
|
var printStatement = (s) => printer2.printNode(ts31.EmitHint.Unspecified, s, blankFile).split("\n").join("\n ");
|
|
23494
23961
|
var dedupe = (names) => [...new Set(names)].sort();
|
|
23495
23962
|
|
|
23496
|
-
//
|
|
23963
|
+
// ../codegen-react/src/page/jsx-attributes.ts
|
|
23497
23964
|
function propAttr(p, resolver, refuse, hoist) {
|
|
23498
23965
|
const name = attrName(p.name);
|
|
23499
23966
|
if (!name) return null;
|
|
@@ -23667,7 +24134,7 @@ var VALIDATION_PROPS = [
|
|
|
23667
24134
|
["inputControlDisableWeekends", "disableWeekends"]
|
|
23668
24135
|
];
|
|
23669
24136
|
|
|
23670
|
-
//
|
|
24137
|
+
// ../codegen-react/src/page/render-node.ts
|
|
23671
24138
|
var INPUT_KIND = {
|
|
23672
24139
|
textInput: "Text",
|
|
23673
24140
|
textArea: "Text",
|
|
@@ -24000,6 +24467,7 @@ export const ${hook} = () =>
|
|
|
24000
24467
|
attrs.push(`tabs={[${entries.join(", ")}]}`);
|
|
24001
24468
|
}
|
|
24002
24469
|
if (n.role === "tabs" && n.tabMode) attrs.push(`tabMode=${jsxString(n.tabMode)}`);
|
|
24470
|
+
if (n.role === "customHtml" && n.customHtmlCode) attrs.push(`code={${customHtmlCode2(ctx, n)}}`);
|
|
24003
24471
|
const byProp = /* @__PURE__ */ new Map();
|
|
24004
24472
|
for (const p of n.props) {
|
|
24005
24473
|
const prop2 = attrName(p.name);
|
|
@@ -24157,8 +24625,55 @@ ${pad}</${spec.component}>`;
|
|
|
24157
24625
|
${kids}
|
|
24158
24626
|
${pad}</${spec.component}>`;
|
|
24159
24627
|
}
|
|
24628
|
+
var CUSTOM_HTML_KINDS = [["html", "html"], ["css", "css"], ["js", "js"]];
|
|
24629
|
+
function customHtmlCode2(ctx, n) {
|
|
24630
|
+
const code = n.customHtmlCode;
|
|
24631
|
+
const stem = n.name.replace(/[^\p{L}\p{N}_-]+/gu, "_") || "CustomHtml";
|
|
24632
|
+
const identOf = (b) => `${/^[\p{L}_$]/u.test(b) ? "" : "_"}${b.replace(/-/g, "_")}`;
|
|
24633
|
+
let base = stem;
|
|
24634
|
+
for (let i = 2; ctx.customHtml.names.has(identOf(base).toLowerCase()); i++) base = `${stem}_${i}`;
|
|
24635
|
+
ctx.customHtml.names.add(identOf(base).toLowerCase());
|
|
24636
|
+
const ident = identOf(base);
|
|
24637
|
+
const fields = [];
|
|
24638
|
+
const files = [];
|
|
24639
|
+
for (const [kind, ext] of CUSTOM_HTML_KINDS) {
|
|
24640
|
+
const id2 = code[kind];
|
|
24641
|
+
if (!id2) continue;
|
|
24642
|
+
const text = ctx.documents[id2];
|
|
24643
|
+
if (text === void 0) {
|
|
24644
|
+
ctx.findings.push({
|
|
24645
|
+
code: "custom-html-document-missing",
|
|
24646
|
+
page: ctx.page.name,
|
|
24647
|
+
control: n.name,
|
|
24648
|
+
location: kind,
|
|
24649
|
+
detail: `the ${kind.toUpperCase()} document ${id2} the control references is not in the export`
|
|
24650
|
+
});
|
|
24651
|
+
continue;
|
|
24652
|
+
}
|
|
24653
|
+
const path = `src/custom-html/${ctx.file}/${base}.${ext}`;
|
|
24654
|
+
ctx.customHtml.files.push({ path, contents: text });
|
|
24655
|
+
ctx.customHtml.imports.push(`import ${ident}_${kind} from '../custom-html/${ctx.file}/${base}.${ext}?raw';`);
|
|
24656
|
+
fields.push(`${kind}: ${ident}_${kind}`);
|
|
24657
|
+
files.push(path);
|
|
24658
|
+
}
|
|
24659
|
+
fields.push(
|
|
24660
|
+
`cssExternal: ${JSON.stringify(code.cssExternal)}`,
|
|
24661
|
+
`jsExternal: ${JSON.stringify(code.jsExternal)}`,
|
|
24662
|
+
"bridge: customHtmlBridge"
|
|
24663
|
+
);
|
|
24664
|
+
const bridgeImport = "import { customHtmlBridge } from '../custom-html/bridge';";
|
|
24665
|
+
if (!ctx.customHtml.imports.includes(bridgeImport)) ctx.customHtml.imports.push(bridgeImport);
|
|
24666
|
+
ctx.findings.push({
|
|
24667
|
+
code: "custom-html-verbatim",
|
|
24668
|
+
page: ctx.page.name,
|
|
24669
|
+
control: n.name,
|
|
24670
|
+
location: "code",
|
|
24671
|
+
detail: files.length ? files.join(", ") : "no documents"
|
|
24672
|
+
});
|
|
24673
|
+
return `{ ${fields.join(", ")} }`;
|
|
24674
|
+
}
|
|
24160
24675
|
|
|
24161
|
-
//
|
|
24676
|
+
// ../codegen-react/src/page/emit-files.ts
|
|
24162
24677
|
var DATA_ACCESSORS = /* @__PURE__ */ new Set([
|
|
24163
24678
|
REACT_ACCESSORS.fetchEntityRecords,
|
|
24164
24679
|
REACT_ACCESSORS.getChoiceSet
|
|
@@ -24184,7 +24699,9 @@ function pageFile(ctx, tree) {
|
|
|
24184
24699
|
} = ctx;
|
|
24185
24700
|
const imports = [
|
|
24186
24701
|
`import s from './${file}.module.css';`,
|
|
24187
|
-
`import { ${["PageProvider", ...components].sort().join(", ")} } from '../components/ui'
|
|
24702
|
+
`import { ${["PageProvider", ...components].sort().join(", ")} } from '../components/ui';`,
|
|
24703
|
+
// A Custom HTML control's code, kept verbatim in its own files and read as text.
|
|
24704
|
+
...new Set(ctx.customHtml.imports)
|
|
24188
24705
|
];
|
|
24189
24706
|
const bindingImports = [...new Set(
|
|
24190
24707
|
// `\w` would stop at the first non-ASCII letter; an identifier may contain
|
|
@@ -24294,8 +24811,8 @@ ${bindingText}
|
|
|
24294
24811
|
return bindingsFile2;
|
|
24295
24812
|
}
|
|
24296
24813
|
|
|
24297
|
-
//
|
|
24298
|
-
function emitPage(page, resolver, identity, hasAction = false, entities = []) {
|
|
24814
|
+
// ../codegen-react/src/page/emit-page.ts
|
|
24815
|
+
function emitPage(page, resolver, identity, hasAction = false, entities = [], documents = {}) {
|
|
24299
24816
|
const { component, file } = identity ?? pageIdentity(page.name);
|
|
24300
24817
|
const names = localNames(page.root);
|
|
24301
24818
|
const components = /* @__PURE__ */ new Set();
|
|
@@ -24357,7 +24874,9 @@ function emitPage(page, resolver, identity, hasAction = false, entities = []) {
|
|
|
24357
24874
|
rulesAuthored,
|
|
24358
24875
|
claimed,
|
|
24359
24876
|
rowComponents: [],
|
|
24360
|
-
entities
|
|
24877
|
+
entities,
|
|
24878
|
+
documents,
|
|
24879
|
+
customHtml: { imports: [], files: [], names: /* @__PURE__ */ new Set() }
|
|
24361
24880
|
};
|
|
24362
24881
|
const tree = renderNode(ctx, page.root, 0);
|
|
24363
24882
|
{
|
|
@@ -24430,6 +24949,7 @@ ${bindingsText}`;
|
|
|
24430
24949
|
` + (cssRules.length ? cssRules.join("\n\n") + "\n" : "/* This page's controls carry no authored styles. */\n")
|
|
24431
24950
|
});
|
|
24432
24951
|
if (bindingsText) files.push({ path: `src/pages/${file}.bindings.ts`, contents: bindingsText });
|
|
24952
|
+
files.push(...ctx.customHtml.files);
|
|
24433
24953
|
return {
|
|
24434
24954
|
files,
|
|
24435
24955
|
components: [...components].sort(),
|
|
@@ -24453,10 +24973,10 @@ ${bindingsText}`;
|
|
|
24453
24973
|
};
|
|
24454
24974
|
}
|
|
24455
24975
|
|
|
24456
|
-
//
|
|
24976
|
+
// ../codegen-react/src/runtime/runtime-files.ts
|
|
24457
24977
|
import ts32 from "typescript";
|
|
24458
24978
|
|
|
24459
|
-
//
|
|
24979
|
+
// ../codegen-react/src/runtime/store.ts
|
|
24460
24980
|
var STORE = `/** App state. One Redux Toolkit slice, three concerns: */
|
|
24461
24981
|
import { configureStore, createSlice, type PayloadAction } from '@reduxjs/toolkit';
|
|
24462
24982
|
import { createContext, useContext } from 'react';
|
|
@@ -24855,7 +25375,7 @@ export function useControlSourceLoader(
|
|
|
24855
25375
|
export { store };
|
|
24856
25376
|
`;
|
|
24857
25377
|
|
|
24858
|
-
//
|
|
25378
|
+
// ../codegen-react/src/runtime/state-accessors.ts
|
|
24859
25379
|
var RUNTIME = `/** The accessors emitted expressions call. */
|
|
24860
25380
|
import { useEffect, useRef, useState } from 'react';
|
|
24861
25381
|
import { useAppSelector } from '../store/hooks';
|
|
@@ -25540,7 +26060,7 @@ export function useContainerValidity(
|
|
|
25540
26060
|
}
|
|
25541
26061
|
`;
|
|
25542
26062
|
|
|
25543
|
-
//
|
|
26063
|
+
// ../codegen-react/src/runtime/rules.ts
|
|
25544
26064
|
var RULES_RUNTIME = `/** The runtime behind the converted rules. */
|
|
25545
26065
|
import {
|
|
25546
26066
|
closeModalAction, dismissMessageAction, openModalAction, pushMessageAction,
|
|
@@ -25715,7 +26235,7 @@ export function answerConfirm(ok: boolean): void {
|
|
|
25715
26235
|
}
|
|
25716
26236
|
`;
|
|
25717
26237
|
|
|
25718
|
-
//
|
|
26238
|
+
// ../codegen-react/src/runtime/sdk.ts
|
|
25719
26239
|
var SDK = `/** UiPath SDK configuration. */
|
|
25720
26240
|
import { UiPath } from '@uipath/uipath-typescript';
|
|
25721
26241
|
import { setCurrentUser } from './runtime';
|
|
@@ -25894,7 +26414,7 @@ export function defaultFolderKey(): string | undefined {
|
|
|
25894
26414
|
var VITE_ENV = `/// <reference types="vite/client" />
|
|
25895
26415
|
`;
|
|
25896
26416
|
|
|
25897
|
-
//
|
|
26417
|
+
// ../codegen-react/src/runtime/data.ts
|
|
25898
26418
|
var DATA = `/** The backend operations behind the converted rules. */
|
|
25899
26419
|
import { JobService } from '@uipath/uipath-typescript/jobs';
|
|
25900
26420
|
|
|
@@ -26729,7 +27249,7 @@ export async function submitAction(
|
|
|
26729
27249
|
}
|
|
26730
27250
|
`;
|
|
26731
27251
|
|
|
26732
|
-
//
|
|
27252
|
+
// ../codegen-react/src/runtime/overlays.ts
|
|
26733
27253
|
var OVERLAYS = `import type { CSSProperties } from 'react';
|
|
26734
27254
|
import { Spinner } from '@uipath/apollo-wind/components/ui/spinner';
|
|
26735
27255
|
import { useAppSelector, useAppDispatch } from '../store/hooks';
|
|
@@ -26977,7 +27497,7 @@ export function AppOverlays() {
|
|
|
26977
27497
|
}
|
|
26978
27498
|
`;
|
|
26979
27499
|
|
|
26980
|
-
//
|
|
27500
|
+
// ../codegen-react/src/runtime/action.ts
|
|
26981
27501
|
var ACTION = `/**
|
|
26982
27502
|
* The ACTION this app was opened for: its task, its data, and its completion.
|
|
26983
27503
|
*
|
|
@@ -27099,7 +27619,7 @@ export function currentActionTask(): unknown {
|
|
|
27099
27619
|
}
|
|
27100
27620
|
`;
|
|
27101
27621
|
|
|
27102
|
-
//
|
|
27622
|
+
// ../codegen-react/src/runtime/runtime-files.ts
|
|
27103
27623
|
var RUNTIME_MODULES = [
|
|
27104
27624
|
{ path: "src/store/store.ts", contents: STORE, core: true },
|
|
27105
27625
|
{ path: "src/store/hooks.ts", contents: HOOKS, core: true },
|
|
@@ -27196,10 +27716,10 @@ function runtimeHasAction(files) {
|
|
|
27196
27716
|
return files.some((f5) => f5.path === "src/lib/action.ts");
|
|
27197
27717
|
}
|
|
27198
27718
|
|
|
27199
|
-
//
|
|
27719
|
+
// ../codegen-react/src/project/emit-project.ts
|
|
27200
27720
|
import ts33 from "typescript";
|
|
27201
27721
|
|
|
27202
|
-
//
|
|
27722
|
+
// ../codegen-react/src/project/styles.ts
|
|
27203
27723
|
function tokensCss(app) {
|
|
27204
27724
|
const rows = Object.entries(app.tokens.values).map(([name, value]) => ` --uiapp-${name}: ${value};`);
|
|
27205
27725
|
const fontToken = Object.keys(app.tokens.values).find((n) => n.includes("font-family"));
|
|
@@ -28229,7 +28749,7 @@ function webfontsFor(app) {
|
|
|
28229
28749
|
return [...used].sort();
|
|
28230
28750
|
}
|
|
28231
28751
|
|
|
28232
|
-
//
|
|
28752
|
+
// ../codegen-react/src/project/scaffold.ts
|
|
28233
28753
|
var packageSlug = (title) => title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "app";
|
|
28234
28754
|
var VERSIONS = {
|
|
28235
28755
|
react: "19.2.0",
|
|
@@ -28546,7 +29066,7 @@ the low-code original does in its own preview.
|
|
|
28546
29066
|
` : ""}`;
|
|
28547
29067
|
}
|
|
28548
29068
|
|
|
28549
|
-
//
|
|
29069
|
+
// ../codegen-react/src/project/shell.ts
|
|
28550
29070
|
function routesModule(app) {
|
|
28551
29071
|
const identities = pageIdentities(app.pages);
|
|
28552
29072
|
const id2 = (p) => identities.get(p.id);
|
|
@@ -28689,7 +29209,369 @@ export function App() {
|
|
|
28689
29209
|
`;
|
|
28690
29210
|
}
|
|
28691
29211
|
|
|
28692
|
-
//
|
|
29212
|
+
// ../codegen-react/src/project/custom-html-files.ts
|
|
29213
|
+
var CUSTOM_HTML_BOOT = `/*
|
|
29214
|
+
* Runs inside a Custom HTML control's sandboxed frame, before the control's own code.
|
|
29215
|
+
*
|
|
29216
|
+
* It provides the \`App\` object (getVariable, setVariable, onVariableChange, setHeight),
|
|
29217
|
+
* \`localStorage\`, \`sessionStorage\` and \`document.cookie\`, all served by the page through a
|
|
29218
|
+
* private channel, and then builds the control in the order Apps does: external
|
|
29219
|
+
* stylesheets, the CSS, the HTML, external scripts one after another, the HTML's own
|
|
29220
|
+
* scripts, the JavaScript, and finally a \`controlLoad\` event.
|
|
29221
|
+
*/
|
|
29222
|
+
(function () {
|
|
29223
|
+
var cfg = window.__uiappCustomHtml || {};
|
|
29224
|
+
delete window.__uiappCustomHtml;
|
|
29225
|
+
var port = null;
|
|
29226
|
+
var pending = {};
|
|
29227
|
+
var seq = 0;
|
|
29228
|
+
var listeners = {};
|
|
29229
|
+
var areas = {};
|
|
29230
|
+
var proxies = {};
|
|
29231
|
+
// The page keeps \`local\` in the app's localStorage and \`session\` and \`cookie\` together in
|
|
29232
|
+
// its sessionStorage, each entry under a prefix naming this app. The budget is per browser
|
|
29233
|
+
// store, counted as the page stores it \u2014 other apps' entries included, as the page reports
|
|
29234
|
+
// them \u2014 and kept well under the browser's own limit so that the app's own storage always
|
|
29235
|
+
// has room.
|
|
29236
|
+
var prefix = 'uiapp-custom-html:';
|
|
29237
|
+
var reserved = { local: { chars: 0, keys: 0 }, session: { chars: 0, keys: 0 } };
|
|
29238
|
+
var BUDGET = 1000000;
|
|
29239
|
+
var MAX_KEYS = 10000;
|
|
29240
|
+
var SHARES = { local: ['local'], session: ['session', 'cookie'], cookie: ['session', 'cookie'] };
|
|
29241
|
+
|
|
29242
|
+
function send(message) {
|
|
29243
|
+
port.postMessage(message);
|
|
29244
|
+
}
|
|
29245
|
+
|
|
29246
|
+
function request(type, name, value) {
|
|
29247
|
+
return new Promise(function (resolve, reject) {
|
|
29248
|
+
var id = ++seq;
|
|
29249
|
+
pending[id] = [resolve, reject];
|
|
29250
|
+
send({ id: id, type: type, name: name, value: value });
|
|
29251
|
+
});
|
|
29252
|
+
}
|
|
29253
|
+
|
|
29254
|
+
window.App = {
|
|
29255
|
+
getVariable: function (name) { return request('get', name); },
|
|
29256
|
+
setVariable: function (name, value) { return request('set', name, value); },
|
|
29257
|
+
onVariableChange: function (name, callback) {
|
|
29258
|
+
if (!callback) {
|
|
29259
|
+
console.error('onVariableChange callback function has not been provided');
|
|
29260
|
+
return undefined;
|
|
29261
|
+
}
|
|
29262
|
+
var list = listeners[name] || (listeners[name] = []);
|
|
29263
|
+
list.push(callback);
|
|
29264
|
+
if (list.length === 1) send({ type: 'watch', name: name });
|
|
29265
|
+
return function () {
|
|
29266
|
+
var i = list.indexOf(callback);
|
|
29267
|
+
if (i >= 0) list.splice(i, 1);
|
|
29268
|
+
if (!list.length) {
|
|
29269
|
+
delete listeners[name];
|
|
29270
|
+
send({ type: 'unwatch', name: name });
|
|
29271
|
+
}
|
|
29272
|
+
};
|
|
29273
|
+
},
|
|
29274
|
+
// A number, or a numeric string, is in px; anything else must be a valid CSS height.
|
|
29275
|
+
setHeight: function (height) {
|
|
29276
|
+
if (!height) {
|
|
29277
|
+
console.error('setHeight: height value parameter is required');
|
|
29278
|
+
return;
|
|
29279
|
+
}
|
|
29280
|
+
var h = String(height).trim();
|
|
29281
|
+
if (/^[0-9]+([.][0-9]+)?$/.test(h)) h += 'px';
|
|
29282
|
+
if (!(window.CSS && CSS.supports('height', h))) {
|
|
29283
|
+
console.error('setHeight: Invalid height value. Must be a valid CSS length (e.g., "300px", "50%", "20em", "50vh", "calc(100vh - 50px)", or number which will be converted to px).');
|
|
29284
|
+
return;
|
|
29285
|
+
}
|
|
29286
|
+
send({ type: 'height', value: h });
|
|
29287
|
+
},
|
|
29288
|
+
};
|
|
29289
|
+
|
|
29290
|
+
// Every Custom HTML control in this app shares one store per area. Writes are kept by the
|
|
29291
|
+
// page, so they outlast a reload (\`local\`) or the tab session (\`session\`, \`cookie\`).
|
|
29292
|
+
function usage(area, key, value) {
|
|
29293
|
+
var other = reserved[area === 'local' ? 'local' : 'session'];
|
|
29294
|
+
var chars = other.chars;
|
|
29295
|
+
var keys = other.keys;
|
|
29296
|
+
SHARES[area].forEach(function (a) {
|
|
29297
|
+
var items = areas[a];
|
|
29298
|
+
for (var k in items) {
|
|
29299
|
+
if (a === area && k === key) continue;
|
|
29300
|
+
chars += prefix.length + a.length + 1 + k.length + items[k].length;
|
|
29301
|
+
keys++;
|
|
29302
|
+
}
|
|
29303
|
+
});
|
|
29304
|
+
return { chars: chars + prefix.length + area.length + 1 + key.length + value.length, keys: keys + 1 };
|
|
29305
|
+
}
|
|
29306
|
+
|
|
29307
|
+
function write(area, key, value) {
|
|
29308
|
+
var items = areas[area];
|
|
29309
|
+
if (value === null) {
|
|
29310
|
+
if (!(key in items)) return;
|
|
29311
|
+
delete items[key];
|
|
29312
|
+
} else {
|
|
29313
|
+
var used = usage(area, key, value);
|
|
29314
|
+
if (used.chars > BUDGET || used.keys > MAX_KEYS) {
|
|
29315
|
+
throw new DOMException('The quota has been exceeded.', 'QuotaExceededError');
|
|
29316
|
+
}
|
|
29317
|
+
items[key] = value;
|
|
29318
|
+
}
|
|
29319
|
+
send({ type: 'storage', area: area, key: key, value: value });
|
|
29320
|
+
}
|
|
29321
|
+
|
|
29322
|
+
function needs(count, args, name) {
|
|
29323
|
+
if (args.length < count) {
|
|
29324
|
+
throw new TypeError("Failed to execute '" + name + "' on 'Storage': " + count + ' argument'
|
|
29325
|
+
+ (count > 1 ? 's' : '') + ' required, but only ' + args.length + ' present.');
|
|
29326
|
+
}
|
|
29327
|
+
}
|
|
29328
|
+
|
|
29329
|
+
// A Storage look-alike: the methods, \`length\`, and each item as a property, so
|
|
29330
|
+
// \`localStorage.theme\`, \`Object.keys(localStorage)\` and \`JSON.stringify(localStorage)\` work.
|
|
29331
|
+
function storage(area) {
|
|
29332
|
+
var api = {
|
|
29333
|
+
getItem: function (key) {
|
|
29334
|
+
needs(1, arguments, 'getItem');
|
|
29335
|
+
key = String(key);
|
|
29336
|
+
return key in areas[area] ? areas[area][key] : null;
|
|
29337
|
+
},
|
|
29338
|
+
setItem: function (key, value) {
|
|
29339
|
+
needs(2, arguments, 'setItem');
|
|
29340
|
+
write(area, String(key), String(value));
|
|
29341
|
+
},
|
|
29342
|
+
removeItem: function (key) {
|
|
29343
|
+
needs(1, arguments, 'removeItem');
|
|
29344
|
+
write(area, String(key), null);
|
|
29345
|
+
},
|
|
29346
|
+
clear: function () {
|
|
29347
|
+
areas[area] = Object.create(null);
|
|
29348
|
+
send({ type: 'storage', area: area, clear: true });
|
|
29349
|
+
},
|
|
29350
|
+
key: function (index) {
|
|
29351
|
+
needs(1, arguments, 'key');
|
|
29352
|
+
var keys = Object.keys(areas[area]);
|
|
29353
|
+
var i = Number(index) >>> 0;
|
|
29354
|
+
return i < keys.length ? keys[i] : null;
|
|
29355
|
+
},
|
|
29356
|
+
};
|
|
29357
|
+
var builtIn = function (prop) { return prop === 'length' || Object.prototype.hasOwnProperty.call(api, prop); };
|
|
29358
|
+
return new Proxy({}, {
|
|
29359
|
+
get: function (target, prop) {
|
|
29360
|
+
if (prop === 'length') return Object.keys(areas[area]).length;
|
|
29361
|
+
if (typeof prop !== 'string' || builtIn(prop)) return api[prop];
|
|
29362
|
+
return prop in areas[area] ? areas[area][prop] : undefined;
|
|
29363
|
+
},
|
|
29364
|
+
set: function (target, prop, value) {
|
|
29365
|
+
if (typeof prop === 'string' && !builtIn(prop)) write(area, prop, String(value));
|
|
29366
|
+
return true;
|
|
29367
|
+
},
|
|
29368
|
+
deleteProperty: function (target, prop) {
|
|
29369
|
+
if (typeof prop === 'string' && !builtIn(prop)) write(area, prop, null);
|
|
29370
|
+
return true;
|
|
29371
|
+
},
|
|
29372
|
+
has: function (target, prop) { return builtIn(prop) || prop in areas[area]; },
|
|
29373
|
+
ownKeys: function () { return Object.keys(areas[area]); },
|
|
29374
|
+
getOwnPropertyDescriptor: function (target, prop) {
|
|
29375
|
+
if (typeof prop !== 'string' || !(prop in areas[area])) return undefined;
|
|
29376
|
+
return { value: areas[area][prop], writable: true, enumerable: true, configurable: true };
|
|
29377
|
+
},
|
|
29378
|
+
});
|
|
29379
|
+
}
|
|
29380
|
+
|
|
29381
|
+
function cookie() {
|
|
29382
|
+
return {
|
|
29383
|
+
get: function () {
|
|
29384
|
+
var jar = areas.cookie;
|
|
29385
|
+
return Object.keys(jar).map(function (k) { return k === '' ? jar[k] : k + '=' + jar[k]; }).join('; ');
|
|
29386
|
+
},
|
|
29387
|
+
// As a browser: \`name=value\` or a bare \`value\`, then attributes; \`max-age\` of zero or
|
|
29388
|
+
// less, or a past \`expires\`, deletes it; one over 4 KB is ignored.
|
|
29389
|
+
set: function (text) {
|
|
29390
|
+
var parts = String(text).split(';');
|
|
29391
|
+
var pair = parts.shift();
|
|
29392
|
+
var eq = pair.indexOf('=');
|
|
29393
|
+
var name = eq < 0 ? '' : pair.slice(0, eq).trim();
|
|
29394
|
+
var value = (eq < 0 ? pair : pair.slice(eq + 1)).trim();
|
|
29395
|
+
if (name.length + value.length > 4096) return;
|
|
29396
|
+
var expired = parts.some(function (p) {
|
|
29397
|
+
var at = p.indexOf('=');
|
|
29398
|
+
var attr = (at < 0 ? p : p.slice(0, at)).trim().toLowerCase();
|
|
29399
|
+
var v = at < 0 ? '' : p.slice(at + 1).trim();
|
|
29400
|
+
return (attr === 'max-age' && v !== '' && Number(v) <= 0)
|
|
29401
|
+
|| (attr === 'expires' && Date.parse(v) <= Date.now());
|
|
29402
|
+
});
|
|
29403
|
+
try {
|
|
29404
|
+
write('cookie', name, expired ? null : value);
|
|
29405
|
+
} catch (err) {
|
|
29406
|
+
// A browser drops a cookie it has no room for; it does not throw.
|
|
29407
|
+
}
|
|
29408
|
+
},
|
|
29409
|
+
};
|
|
29410
|
+
}
|
|
29411
|
+
|
|
29412
|
+
function install(snapshot) {
|
|
29413
|
+
if (snapshot && typeof snapshot.scope === 'string') prefix = 'uiapp-custom-html:' + snapshot.scope + ':';
|
|
29414
|
+
if (snapshot && snapshot.reserved) reserved = snapshot.reserved;
|
|
29415
|
+
['local', 'session', 'cookie'].forEach(function (area) {
|
|
29416
|
+
var items = Object.create(null);
|
|
29417
|
+
var from = (snapshot && snapshot[area]) || {};
|
|
29418
|
+
for (var k in from) items[k] = String(from[k]);
|
|
29419
|
+
areas[area] = items;
|
|
29420
|
+
});
|
|
29421
|
+
proxies.local = storage('local');
|
|
29422
|
+
proxies.session = storage('session');
|
|
29423
|
+
Object.defineProperty(window, 'localStorage', { value: proxies.local, configurable: true });
|
|
29424
|
+
Object.defineProperty(window, 'sessionStorage', { value: proxies.session, configurable: true });
|
|
29425
|
+
Object.defineProperty(document, 'cookie', Object.assign({ configurable: true }, cookie()));
|
|
29426
|
+
}
|
|
29427
|
+
|
|
29428
|
+
// Another control changed a shared store: apply it, and raise \`storage\` as a browser does.
|
|
29429
|
+
function synced(m) {
|
|
29430
|
+
var items = areas[m.area];
|
|
29431
|
+
if (!items) return;
|
|
29432
|
+
var init;
|
|
29433
|
+
if (m.clear) {
|
|
29434
|
+
areas[m.area] = Object.create(null);
|
|
29435
|
+
init = { key: null, oldValue: null, newValue: null };
|
|
29436
|
+
} else {
|
|
29437
|
+
init = { key: m.key, oldValue: m.key in items ? items[m.key] : null, newValue: m.value };
|
|
29438
|
+
if (m.value === null) delete items[m.key];
|
|
29439
|
+
else items[m.key] = m.value;
|
|
29440
|
+
}
|
|
29441
|
+
if (m.area === 'cookie') return;
|
|
29442
|
+
var event = new StorageEvent('storage', init);
|
|
29443
|
+
Object.defineProperty(event, 'storageArea', { value: proxies[m.area] });
|
|
29444
|
+
window.dispatchEvent(event);
|
|
29445
|
+
}
|
|
29446
|
+
|
|
29447
|
+
// The page could not keep a write this frame already applied: undo it here and say so,
|
|
29448
|
+
// the nearest a deferred write can come to the browser's QuotaExceededError.
|
|
29449
|
+
function rejected(m) {
|
|
29450
|
+
var items = areas[m.area];
|
|
29451
|
+
if (!items) return;
|
|
29452
|
+
if (m.value === null) delete items[m.key];
|
|
29453
|
+
else items[m.key] = m.value;
|
|
29454
|
+
var where = m.area === 'local' ? 'localStorage' : m.area === 'session' ? 'sessionStorage' : 'document.cookie';
|
|
29455
|
+
console.error(new DOMException(where + ': "' + m.key + '" was not saved; the storage quota has been exceeded.', 'QuotaExceededError'));
|
|
29456
|
+
}
|
|
29457
|
+
|
|
29458
|
+
window.addEventListener('message', function (event) {
|
|
29459
|
+
var data = event.data || {};
|
|
29460
|
+
if (port || event.source !== window.parent || data.type !== 'uiapp-custom-html-port' || !event.ports[0]) return;
|
|
29461
|
+
port = event.ports[0];
|
|
29462
|
+
port.onmessage = function (e) {
|
|
29463
|
+
var m = e.data || {};
|
|
29464
|
+
if (m.type === 'reply' && pending[m.id]) {
|
|
29465
|
+
var settle = pending[m.id];
|
|
29466
|
+
delete pending[m.id];
|
|
29467
|
+
(m.ok ? settle[0] : settle[1])(m.data);
|
|
29468
|
+
} else if (m.type === 'change') {
|
|
29469
|
+
(listeners[m.name] || []).slice().forEach(function (cb) {
|
|
29470
|
+
try { cb(m.value); } catch (err) { console.error(err); }
|
|
29471
|
+
});
|
|
29472
|
+
} else if (m.type === 'storage') {
|
|
29473
|
+
synced(m);
|
|
29474
|
+
} else if (m.type === 'storage-rejected') {
|
|
29475
|
+
rejected(m);
|
|
29476
|
+
} else if (m.type === 'error') {
|
|
29477
|
+
console.error(m.data);
|
|
29478
|
+
}
|
|
29479
|
+
};
|
|
29480
|
+
install(data.storage);
|
|
29481
|
+
run();
|
|
29482
|
+
});
|
|
29483
|
+
window.parent.postMessage({ type: 'uiapp-custom-html-ready', nonce: cfg.nonce }, '*');
|
|
29484
|
+
|
|
29485
|
+
function failed(url) {
|
|
29486
|
+
send({ type: 'resource-error', url: url });
|
|
29487
|
+
}
|
|
29488
|
+
|
|
29489
|
+
function run() {
|
|
29490
|
+
var head = document.head;
|
|
29491
|
+
var body = document.body;
|
|
29492
|
+
(cfg.cssExternal || []).forEach(function (href) {
|
|
29493
|
+
if (!href) return;
|
|
29494
|
+
var link = document.createElement('link');
|
|
29495
|
+
link.rel = 'stylesheet';
|
|
29496
|
+
link.href = href;
|
|
29497
|
+
link.onerror = function () { failed(href); };
|
|
29498
|
+
head.appendChild(link);
|
|
29499
|
+
});
|
|
29500
|
+
if (cfg.css) {
|
|
29501
|
+
var style = document.createElement('style');
|
|
29502
|
+
style.textContent = cfg.css;
|
|
29503
|
+
head.appendChild(style);
|
|
29504
|
+
}
|
|
29505
|
+
if (cfg.html) body.insertAdjacentHTML('beforeend', cfg.html);
|
|
29506
|
+
if (cfg.disabled) {
|
|
29507
|
+
var overlay = document.createElement('div');
|
|
29508
|
+
overlay.className = 'disabled-overlay';
|
|
29509
|
+
overlay.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:9999;';
|
|
29510
|
+
body.appendChild(overlay);
|
|
29511
|
+
}
|
|
29512
|
+
|
|
29513
|
+
// Scripts placed by insertAdjacentHTML never run, so each is replaced by a fresh copy.
|
|
29514
|
+
// All of them run in order, each waiting for the one before it to load.
|
|
29515
|
+
var scripts = [];
|
|
29516
|
+
(cfg.jsExternal || []).forEach(function (src) {
|
|
29517
|
+
if (!src) return;
|
|
29518
|
+
var s = document.createElement('script');
|
|
29519
|
+
s.src = src;
|
|
29520
|
+
scripts.push(s);
|
|
29521
|
+
});
|
|
29522
|
+
Array.prototype.slice.call(body.querySelectorAll('script')).forEach(function (old) {
|
|
29523
|
+
var s = document.createElement('script');
|
|
29524
|
+
for (var i = 0; i < old.attributes.length; i++) s.setAttribute(old.attributes[i].name, old.attributes[i].value);
|
|
29525
|
+
s.text = old.text;
|
|
29526
|
+
old.parentNode.removeChild(old);
|
|
29527
|
+
scripts.push(s);
|
|
29528
|
+
});
|
|
29529
|
+
if (cfg.js) {
|
|
29530
|
+
var own = document.createElement('script');
|
|
29531
|
+
own.text = cfg.js;
|
|
29532
|
+
scripts.push(own);
|
|
29533
|
+
}
|
|
29534
|
+
scripts.reduce(function (chain, s) {
|
|
29535
|
+
return chain.then(function () {
|
|
29536
|
+
return new Promise(function (resolve) {
|
|
29537
|
+
if (s.src) {
|
|
29538
|
+
s.onload = function () { resolve(); };
|
|
29539
|
+
s.onerror = function () { failed(s.getAttribute('src')); resolve(); };
|
|
29540
|
+
}
|
|
29541
|
+
body.appendChild(s);
|
|
29542
|
+
if (!s.src) resolve();
|
|
29543
|
+
});
|
|
29544
|
+
});
|
|
29545
|
+
}, Promise.resolve()).then(function () {
|
|
29546
|
+
window.dispatchEvent(new Event('controlLoad'));
|
|
29547
|
+
send({ type: 'loaded' });
|
|
29548
|
+
});
|
|
29549
|
+
}
|
|
29550
|
+
})();
|
|
29551
|
+
`;
|
|
29552
|
+
function customHtmlBridgeModule(names, scope) {
|
|
29553
|
+
return `/**
|
|
29554
|
+
* What a Custom HTML control's \`App.getVariable\` / \`setVariable\` / \`onVariableChange\` reach:
|
|
29555
|
+
* this app's declared variables, and nothing else.
|
|
29556
|
+
*/
|
|
29557
|
+
import boot from './boot.js?raw';
|
|
29558
|
+
import { getAppVar, setAppVar } from '../lib/runtime';
|
|
29559
|
+
import { store } from '../store/store';
|
|
29560
|
+
|
|
29561
|
+
const APP_VARIABLES: ReadonlySet<string> = new Set(${JSON.stringify([...names].sort())});
|
|
29562
|
+
|
|
29563
|
+
export const customHtmlBridge = {
|
|
29564
|
+
boot,
|
|
29565
|
+
storageScope: ${JSON.stringify(scope)},
|
|
29566
|
+
has: (name: string): boolean => APP_VARIABLES.has(name),
|
|
29567
|
+
get: (name: string): unknown => getAppVar(name),
|
|
29568
|
+
set: (name: string, value: unknown): void => setAppVar(name, value),
|
|
29569
|
+
subscribe: (listener: () => void): (() => void) => store.subscribe(listener),
|
|
29570
|
+
};
|
|
29571
|
+
`;
|
|
29572
|
+
}
|
|
29573
|
+
|
|
29574
|
+
// ../codegen-react/src/project/app-data.ts
|
|
28693
29575
|
function resourceFoldersModule(app) {
|
|
28694
29576
|
const rows = app.resourceFolders.map((r) => ` ${JSON.stringify(r.resource)}: { kind: ${JSON.stringify(r.kind)}` + (r.path ? `, path: ${JSON.stringify(r.path)}` : "") + (r.key ? `, authoredKey: ${JSON.stringify(r.key)}` : "") + (r.folderId !== void 0 ? `, folderId: ${r.folderId}` : "") + (r.processKey ? `, processKey: ${JSON.stringify(r.processKey)}` : "") + (r.resourceId ? `, resourceId: ${JSON.stringify(r.resourceId)}` : "") + (r.name ? `, name: ${JSON.stringify(r.name)}` : "") + " },");
|
|
28695
29577
|
return `/** Folder scope per backend resource, as authored. */
|
|
@@ -28893,7 +29775,7 @@ function actionSchemaJson(action) {
|
|
|
28893
29775
|
`;
|
|
28894
29776
|
}
|
|
28895
29777
|
|
|
28896
|
-
//
|
|
29778
|
+
// ../codegen-react/src/project/emit-project.ts
|
|
28897
29779
|
function runtimeFor(files) {
|
|
28898
29780
|
return fixedRuntimeFiles(referencedIdentifiers(files));
|
|
28899
29781
|
}
|
|
@@ -28944,7 +29826,8 @@ function emitReactProject(app, options2) {
|
|
|
28944
29826
|
options2.resolver,
|
|
28945
29827
|
identities.get(page.id),
|
|
28946
29828
|
!!options2.action,
|
|
28947
|
-
options2.entities ?? []
|
|
29829
|
+
options2.entities ?? [],
|
|
29830
|
+
options2.documents ?? {}
|
|
28948
29831
|
);
|
|
28949
29832
|
files.push(...emitted.files);
|
|
28950
29833
|
refusals.push(...emitted.refusals.map((r) => `${page.name}: ${r}`));
|
|
@@ -29047,6 +29930,13 @@ ${hasData ? "\n# Your tenant and client id. Copy uipath.json.example and fill it
|
|
|
29047
29930
|
}
|
|
29048
29931
|
const compatSource = options2.compat ? renderCompatModule(options2.compat) : null;
|
|
29049
29932
|
if (compatSource) files.push({ path: "src/lib/compat.ts", contents: compatSource });
|
|
29933
|
+
if (findings.some((f5) => f5.code === "custom-html-verbatim")) {
|
|
29934
|
+
files.push({ path: "src/custom-html/boot.js", contents: CUSTOM_HTML_BOOT });
|
|
29935
|
+
files.push({
|
|
29936
|
+
path: "src/custom-html/bridge.ts",
|
|
29937
|
+
contents: customHtmlBridgeModule(options2.appVariables ?? [], app.systemName)
|
|
29938
|
+
});
|
|
29939
|
+
}
|
|
29050
29940
|
return {
|
|
29051
29941
|
files,
|
|
29052
29942
|
refusals,
|
|
@@ -29061,7 +29951,8 @@ ${hasData ? "\n# Your tenant and client id. Copy uipath.json.example and fill it
|
|
|
29061
29951
|
};
|
|
29062
29952
|
}
|
|
29063
29953
|
|
|
29064
|
-
//
|
|
29954
|
+
// ../cli/src/report/build.ts
|
|
29955
|
+
import { basename as basename2 } from "node:path";
|
|
29065
29956
|
var APP_BREAKAGE_DIAGNOSTICS = /* @__PURE__ */ new Set(["BC30456", "BC30451", "BC30201"]);
|
|
29066
29957
|
var ACTIONS = {
|
|
29067
29958
|
"converter": "fix in the converter",
|
|
@@ -29215,6 +30106,20 @@ function buildReport(input) {
|
|
|
29215
30106
|
`${f5.detail}`
|
|
29216
30107
|
));
|
|
29217
30108
|
break;
|
|
30109
|
+
case "custom-html-verbatim":
|
|
30110
|
+
issues.push(issue(
|
|
30111
|
+
f5.code,
|
|
30112
|
+
"by-design",
|
|
30113
|
+
"control",
|
|
30114
|
+
where2,
|
|
30115
|
+
f5.location,
|
|
30116
|
+
void 0,
|
|
30117
|
+
`the Custom HTML control's code runs as authored, in a sandboxed frame with the App bridge (${f5.detail}); it can be rewritten as React`
|
|
30118
|
+
));
|
|
30119
|
+
break;
|
|
30120
|
+
case "custom-html-document-missing":
|
|
30121
|
+
issues.push(issue(f5.code, "converter", "control", where2, f5.location, void 0, `${f5.detail}`));
|
|
30122
|
+
break;
|
|
29218
30123
|
}
|
|
29219
30124
|
}
|
|
29220
30125
|
const roleOf = /* @__PURE__ */ new Map();
|
|
@@ -29390,7 +30295,7 @@ function buildReport(input) {
|
|
|
29390
30295
|
for (const i of issues) summary[i.blame] += 1;
|
|
29391
30296
|
return {
|
|
29392
30297
|
app: app.title,
|
|
29393
|
-
generatedFrom: file.path
|
|
30298
|
+
generatedFrom: basename2(file.path),
|
|
29394
30299
|
...input.runId ? { runId: input.runId } : {},
|
|
29395
30300
|
pages: app.pages.length,
|
|
29396
30301
|
converted: { pages: app.pages.length, ...input.emit.coverage },
|
|
@@ -29428,7 +30333,7 @@ function trimReason(reason) {
|
|
|
29428
30333
|
return reason.replace(/^bind:\s*/, "").replace(/^BC\d{5}:\s*/, "").slice(0, 200);
|
|
29429
30334
|
}
|
|
29430
30335
|
|
|
29431
|
-
//
|
|
30336
|
+
// ../cli/src/report/notes.ts
|
|
29432
30337
|
var REPORT = { file: "packages/cli/src/report/build.ts", function: "buildReport" };
|
|
29433
30338
|
var STAGE_OF = {
|
|
29434
30339
|
expression: "resolve",
|
|
@@ -29473,7 +30378,7 @@ function speakReport(log, report) {
|
|
|
29473
30378
|
});
|
|
29474
30379
|
}
|
|
29475
30380
|
|
|
29476
|
-
//
|
|
30381
|
+
// ../cli/src/convert.ts
|
|
29477
30382
|
var MAIN = { file: "packages/cli/src/convert.ts", function: "convert" };
|
|
29478
30383
|
function convert(input, options2) {
|
|
29479
30384
|
const { app: file } = input;
|
|
@@ -29524,6 +30429,8 @@ function convert(input, options2) {
|
|
|
29524
30429
|
resolver,
|
|
29525
30430
|
compat,
|
|
29526
30431
|
media: file.media,
|
|
30432
|
+
documents: file.documents,
|
|
30433
|
+
appVariables: (file.facts.variables ?? []).map((v) => v.name),
|
|
29527
30434
|
entityIds: file.entityIds,
|
|
29528
30435
|
action: file.action,
|
|
29529
30436
|
entities: file.facts.entities
|
|
@@ -29573,7 +30480,7 @@ function convert(input, options2) {
|
|
|
29573
30480
|
};
|
|
29574
30481
|
}
|
|
29575
30482
|
|
|
29576
|
-
//
|
|
30483
|
+
// ../cli/src/intake/intake.ts
|
|
29577
30484
|
import { extname } from "node:path";
|
|
29578
30485
|
function detectAppKind(path) {
|
|
29579
30486
|
switch (extname(path).toLowerCase()) {
|
|
@@ -29593,7 +30500,7 @@ var ConversionInputError = class extends Error {
|
|
|
29593
30500
|
}
|
|
29594
30501
|
};
|
|
29595
30502
|
|
|
29596
|
-
//
|
|
30503
|
+
// ../payload/src/reader/read-uiapp-file.ts
|
|
29597
30504
|
var import_adm_zip = __toESM(require_adm_zip(), 1);
|
|
29598
30505
|
import { readFile } from "node:fs/promises";
|
|
29599
30506
|
var PACKAGE_DELIMITER = "[PACKAGESTART]";
|
|
@@ -29808,7 +30715,7 @@ function mimeToExt(mime) {
|
|
|
29808
30715
|
}
|
|
29809
30716
|
}
|
|
29810
30717
|
|
|
29811
|
-
//
|
|
30718
|
+
// ../payload/src/reader/diagnostics.ts
|
|
29812
30719
|
var DiagnosticsCollector = class {
|
|
29813
30720
|
entries = [];
|
|
29814
30721
|
info(message, location = {}, suggestion) {
|
|
@@ -29831,7 +30738,7 @@ var DiagnosticsCollector = class {
|
|
|
29831
30738
|
}
|
|
29832
30739
|
};
|
|
29833
30740
|
|
|
29834
|
-
//
|
|
30741
|
+
// ../payload/src/reader/app-variables.ts
|
|
29835
30742
|
function buildVariables(fields) {
|
|
29836
30743
|
if (!Array.isArray(fields)) return [];
|
|
29837
30744
|
return fields.map((f5) => buildVariable(f5)).filter((v) => v !== null);
|
|
@@ -29912,7 +30819,7 @@ function mapTypeFromName(dataType, fallbackType) {
|
|
|
29912
30819
|
return { kind: "unknown", rawDataType: dataType };
|
|
29913
30820
|
}
|
|
29914
30821
|
|
|
29915
|
-
//
|
|
30822
|
+
// ../payload/src/reader/entities.ts
|
|
29916
30823
|
var SQL_TYPES = {
|
|
29917
30824
|
NVARCHAR: { kind: "primitive", primitive: "string" },
|
|
29918
30825
|
VARCHAR: { kind: "primitive", primitive: "string" },
|
|
@@ -30088,7 +30995,7 @@ function collectFromType(t, out) {
|
|
|
30088
30995
|
}
|
|
30089
30996
|
}
|
|
30090
30997
|
|
|
30091
|
-
//
|
|
30998
|
+
// ../payload/src/reader/processes.ts
|
|
30092
30999
|
function processArgType(a) {
|
|
30093
31000
|
const scalar = vbScalar(a);
|
|
30094
31001
|
if (!a.isList && !a.collectionType) return scalar;
|
|
@@ -30230,7 +31137,7 @@ function buildProcesses(models, tenant) {
|
|
|
30230
31137
|
return [...merged.values()];
|
|
30231
31138
|
}
|
|
30232
31139
|
|
|
30233
|
-
//
|
|
31140
|
+
// ../payload/src/reader/media.ts
|
|
30234
31141
|
function buildMedia(extracted, forms) {
|
|
30235
31142
|
const refs = /* @__PURE__ */ new Map();
|
|
30236
31143
|
for (const form of forms) {
|
|
@@ -30267,7 +31174,7 @@ function buildMedia(extracted, forms) {
|
|
|
30267
31174
|
});
|
|
30268
31175
|
}
|
|
30269
31176
|
|
|
30270
|
-
//
|
|
31177
|
+
// ../payload/src/reader/source-errors.ts
|
|
30271
31178
|
var UNRESOLVED = "unresolved-external-binding";
|
|
30272
31179
|
function expressionIdFromJPath(jpath) {
|
|
30273
31180
|
const m = /\.expressions\.([^.[\]]+)$/.exec(jpath);
|
|
@@ -30301,7 +31208,7 @@ function buildSourceErrors(models) {
|
|
|
30301
31208
|
return { diagnostics, expressionIds };
|
|
30302
31209
|
}
|
|
30303
31210
|
|
|
30304
|
-
//
|
|
31211
|
+
// ../payload/src/reader/app-facts-types.ts
|
|
30305
31212
|
var EMPTY_TENANT_SCHEMAS = {
|
|
30306
31213
|
entities: /* @__PURE__ */ new Map(),
|
|
30307
31214
|
processes: /* @__PURE__ */ new Map(),
|
|
@@ -30309,7 +31216,7 @@ var EMPTY_TENANT_SCHEMAS = {
|
|
|
30309
31216
|
choiceSets: []
|
|
30310
31217
|
};
|
|
30311
31218
|
|
|
30312
|
-
//
|
|
31219
|
+
// ../payload/src/reader/app-facts.ts
|
|
30313
31220
|
function expressionTexts(forms) {
|
|
30314
31221
|
const out = [];
|
|
30315
31222
|
for (const form of forms) {
|
|
@@ -30351,7 +31258,18 @@ function buildAppFacts(file, schemas = EMPTY_TENANT_SCHEMAS) {
|
|
|
30351
31258
|
};
|
|
30352
31259
|
}
|
|
30353
31260
|
|
|
30354
|
-
//
|
|
31261
|
+
// ../payload/src/load.ts
|
|
31262
|
+
var TEXT_DOCUMENT = /^\s*(text\/(html|css|javascript)|application\/(x-)?javascript)\s*(;.*)?$/i;
|
|
31263
|
+
function textDocuments(media) {
|
|
31264
|
+
const out = {};
|
|
31265
|
+
for (const m of media) {
|
|
31266
|
+
if (!TEXT_DOCUMENT.test(m.mimeType ?? "")) continue;
|
|
31267
|
+
const text = Buffer.from(m.data).toString("utf8");
|
|
31268
|
+
if (m.entryName) out[m.entryName] = text;
|
|
31269
|
+
if (m.documentId && !(m.documentId in out)) out[m.documentId] = text;
|
|
31270
|
+
}
|
|
31271
|
+
return out;
|
|
31272
|
+
}
|
|
30355
31273
|
async function loadApp(path) {
|
|
30356
31274
|
const file = await load(path);
|
|
30357
31275
|
const models = file.raw.models ?? [];
|
|
@@ -30425,6 +31343,7 @@ async function loadApp(path) {
|
|
|
30425
31343
|
processes: facts.processes ?? [],
|
|
30426
31344
|
media,
|
|
30427
31345
|
mediaBytes: (file.media ?? []).filter((m) => m.title).map((m) => ({ file: suggestFilename(m), data: m.data })),
|
|
31346
|
+
documents: textDocuments(file.media ?? []),
|
|
30428
31347
|
entityIds,
|
|
30429
31348
|
...action ? { action } : {},
|
|
30430
31349
|
invalidInSource,
|
|
@@ -30497,7 +31416,7 @@ function dedupeExpressionIds(models) {
|
|
|
30497
31416
|
}
|
|
30498
31417
|
}
|
|
30499
31418
|
|
|
30500
|
-
//
|
|
31419
|
+
// ../cli/src/intake/standalone.ts
|
|
30501
31420
|
async function readStandalone(path) {
|
|
30502
31421
|
return {
|
|
30503
31422
|
source: "standalone",
|
|
@@ -30507,10 +31426,10 @@ async function readStandalone(path) {
|
|
|
30507
31426
|
};
|
|
30508
31427
|
}
|
|
30509
31428
|
|
|
30510
|
-
//
|
|
30511
|
-
import { basename, join as join2 } from "node:path";
|
|
31429
|
+
// ../cli/src/run-log.ts
|
|
31430
|
+
import { basename as basename3, join as join2 } from "node:path";
|
|
30512
31431
|
function startRunLog(input) {
|
|
30513
|
-
const app =
|
|
31432
|
+
const app = basename3(input.appPath).replace(/\.uiapp$/i, "");
|
|
30514
31433
|
const screen = new ConsoleSink({
|
|
30515
31434
|
minLevel: input.quiet ? "error" : input.verbose ? "info" : "warning"
|
|
30516
31435
|
});
|
|
@@ -30530,7 +31449,7 @@ function startRunLog(input) {
|
|
|
30530
31449
|
};
|
|
30531
31450
|
}
|
|
30532
31451
|
|
|
30533
|
-
//
|
|
31452
|
+
// ../cli/src/summary.ts
|
|
30534
31453
|
import ts34 from "typescript";
|
|
30535
31454
|
var MAIN2 = { file: "packages/cli/src/summary.ts", function: "syntaxProblems" };
|
|
30536
31455
|
function syntaxProblems(result, log) {
|
|
@@ -30583,7 +31502,7 @@ wrote ${result.files.length - extras.kept.length} files to ${outDir}`);
|
|
|
30583
31502
|
log(` diary : conversion-log.ndjson (${extras.diaryNotes} notes)`);
|
|
30584
31503
|
}
|
|
30585
31504
|
|
|
30586
|
-
//
|
|
31505
|
+
// ../cli/src/write-output.ts
|
|
30587
31506
|
import { chmodSync, existsSync as existsSync2, mkdirSync as mkdirSync3, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
|
30588
31507
|
import { dirname as dirname3, join as join3 } from "node:path";
|
|
30589
31508
|
var GENERATED = [
|
|
@@ -30630,7 +31549,7 @@ function writeOutput(result, outDir) {
|
|
|
30630
31549
|
return { kept, reportPath };
|
|
30631
31550
|
}
|
|
30632
31551
|
|
|
30633
|
-
//
|
|
31552
|
+
// ../cli/src/convert-file.ts
|
|
30634
31553
|
function checkPrerequisites() {
|
|
30635
31554
|
const probe = spawnSync("dotnet", ["--list-runtimes"], { encoding: "utf8" });
|
|
30636
31555
|
if (probe.error || probe.status !== 0) {
|
|
@@ -30650,7 +31569,7 @@ function checkPrerequisites() {
|
|
|
30650
31569
|
return { ok: true };
|
|
30651
31570
|
}
|
|
30652
31571
|
function locateSkill() {
|
|
30653
|
-
const here = dirname4(
|
|
31572
|
+
const here = dirname4(fileURLToPath2(import.meta.url));
|
|
30654
31573
|
const candidates = [
|
|
30655
31574
|
resolve(here, "../../../skills/fix-converted-app/SKILL.md"),
|
|
30656
31575
|
resolve(here, "skills/fix-converted-app/SKILL.md")
|