@uipath/flow-tool 1.204.0 → 1.205.0-preview.258

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/README.md +9 -9
  2. package/dist/THIRD-PARTY-NOTICES.md +39 -15
  3. package/dist/{authoring-bppe07p0.js → authoring-e1k40hyw.js} +6 -5
  4. package/dist/{binding-service-xwgsn35p.js → binding-service-pdtxvvt8.js} +38 -30
  5. package/dist/{connector-service-r0w8ztas.js → connector-service-pm9hfmsv.js} +224 -47
  6. package/dist/de-UZI7FJDO-awjpqfz0.js +200 -0
  7. package/dist/{de-MUJPA4EB-dpg7t2rw.js → de-UZI7FJDO-mwvc4cxe.js} +29 -2
  8. package/dist/{de-FGHEJRCI-rv513mfh.js → de-WLW6KWOJ-2qnsqdtw.js} +238 -31
  9. package/dist/debug-conversation-trigger-xsm3ycqx.js +30 -0
  10. package/dist/{debug-http-client-p4kf38yt.js → debug-http-client-yqjzsnhw.js} +5 -4
  11. package/dist/{debug-service-893erynq.js → debug-service-nra3n02y.js} +6 -5
  12. package/dist/{edge-service-yzsfw4bs.js → edge-service-mddnjwb0.js} +16 -12
  13. package/dist/{embedded-file-reader-v8c2yj2a.js → embedded-file-reader-r66242ey.js} +2 -2
  14. package/dist/en-EJCBA3LK-0wb3b1xy.js +146 -0
  15. package/dist/{en-FBPVNKFN-dqt573xn.js → en-EJCBA3LK-dtpdghgj.js} +12 -4
  16. package/dist/{en-BWGKA5OE-1qkvb9rn.js → en-M7GQYBV2-5nfmpnfz.js} +88 -6
  17. package/dist/{es-7SE7HX2X-8yh1aj2y.js → es-4UBUTCQA-m1ytpyx2.js} +29 -2
  18. package/dist/es-4UBUTCQA-t7hsackg.js +200 -0
  19. package/dist/{es-KR3ZSNMP-84zphx0x.js → es-5THCNRFN-tqwyrdgy.js} +235 -28
  20. package/dist/{es-MX-2MYFZU7X-3rek4r73.js → es-MX-5RELIXKI-9jhqtddc.js} +29 -2
  21. package/dist/es-MX-5RELIXKI-jtjbcxbb.js +200 -0
  22. package/dist/{es-MX-XXZJGC4R-2mr8jtgm.js → es-MX-TWZBRAXK-gqd9swzw.js} +237 -30
  23. package/dist/filter-engine-7ep90g7f.js +11 -0
  24. package/dist/{flow-api-kjvpsxhw.js → flow-api-sat010z1.js} +16 -10
  25. package/dist/{flow-debug-service-dd10rg08.js → flow-debug-service-dw0d9cv7.js} +96 -58
  26. package/dist/{flow-eval-node-target-2ekp77s6.js → flow-eval-node-target-wttmdm4v.js} +17 -17
  27. package/dist/flow-eval-run-api-xdygjzfv.js +13 -0
  28. package/dist/{flow-eval-run-service-twzbmeq6.js → flow-eval-run-service-g09w4m9m.js} +73 -80
  29. package/dist/{flow-eval-service-ckwx7d5z.js → flow-eval-service-jfkz0tae.js} +167 -415
  30. package/dist/{flow-init-sdk-source-z9qx1zkt.js → flow-init-sdk-source-xvdvkq7d.js} +6 -5
  31. package/dist/{flow-init-service-m6swzk43.js → flow-init-service-5v6zwhas.js} +19 -15
  32. package/dist/{flow-io-tnrc53z6.js → flow-io-64tmj8n7.js} +15 -11
  33. package/dist/{flow-migrate-service-625gppk0.js → flow-migrate-service-bjxs35ac.js} +16 -12
  34. package/dist/{flow-pack-service-qdpvrmme.js → flow-pack-service-s75qhtn5.js} +47 -38
  35. package/dist/flow-validate-service-rbvgesrb.js +70 -0
  36. package/dist/{fr-Y6NPVODW-8vr1ja4b.js → fr-CERONSRC-edpxhbmb.js} +237 -30
  37. package/dist/{fr-MDFKNZ4C-h4a122k9.js → fr-VBM5WRC2-63z7w4mh.js} +29 -2
  38. package/dist/fr-VBM5WRC2-707ha692.js +200 -0
  39. package/dist/{governance-fetcher-zq8zmfjb.js → governance-fetcher-tw83p74c.js} +7 -6
  40. package/dist/{hitl-service-r19zvqsz.js → hitl-service-hgg9tr5j.js} +15 -11
  41. package/dist/{index-b8n7hv68.js → index-09mfatmh.js} +6 -5
  42. package/dist/{index-aaq9rwfv.js → index-1b2je9n2.js} +1088 -233
  43. package/dist/index-d090f35d.js +66 -0
  44. package/dist/{index-yj4xk2aw.js → index-dgdnbb2g.js} +7 -5
  45. package/dist/{index-ng2f77my.js → index-fyc0k5dd.js} +985 -617
  46. package/dist/{index-vrhcbxnk.js → index-nsn889vf.js} +6 -5
  47. package/dist/{index-2s8rmmw6.js → index-sqhbn7ew.js} +4 -4
  48. package/dist/{index-tnz5ks4t.js → index-wycgq0ff.js} +65 -2230
  49. package/dist/index.js +17 -14
  50. package/dist/init.js +19 -15
  51. package/dist/inline-entity-resolver-2qqf1635.js +45 -0
  52. package/dist/input-reader-n7kzdrev.js +12 -0
  53. package/dist/{ja-UTQEAP34-8e0q6swp.js → ja-43QL7CGO-c3q8gre9.js} +29 -2
  54. package/dist/ja-43QL7CGO-h6qfxfay.js +200 -0
  55. package/dist/{ja-Q5PXKJ2V-p4msxzjd.js → ja-U2MCNHGT-gz0ap1jk.js} +235 -28
  56. package/dist/{known-types-q6fcyq2e.js → known-types-3025scz1.js} +5 -5
  57. package/dist/ko-TLL6Z6CD-ag6gjynr.js +200 -0
  58. package/dist/{ko-AXCHW2OK-askct7f6.js → ko-TLL6Z6CD-wrt3n8a9.js} +29 -2
  59. package/dist/{ko-AYBDSRZG-41mdmsg1.js → ko-XAUYQWDR-zp81gjp4.js} +237 -30
  60. package/dist/{maestro-automate-entry-qak46eg0.js → maestro-automate-entry-6f9act3w.js} +2 -2
  61. package/dist/{node-ccwecksf.js → node-1wzjq3jb.js} +29 -15
  62. package/dist/{node-service-w8gsy23p.js → node-service-0hxtt2x6.js} +41 -30
  63. package/dist/{node-strategy-fdnkvq4a.js → node-strategy-1dmmhvf3.js} +1 -1
  64. package/dist/node-sync-service-n7r4ma3a.js +61 -0
  65. package/dist/{packager-tool-s4etvs59.js → packager-tool-0j8v36qh.js} +1 -1
  66. package/dist/packager-tool-10vc8pq4.js +2 -0
  67. package/dist/{packager-tool-pw6j69m5.js → packager-tool-445qgxdk.js} +1802 -378
  68. package/dist/packager-tool-4kr6g0zw.js +16 -0
  69. package/dist/packager-tool-4x7tzvv0.js +1176 -0
  70. package/dist/{packager-tool-86rhxbf1.js → packager-tool-5regytfc.js} +6 -4
  71. package/dist/{packager-tool-d88rqwk8.js → packager-tool-6z1hsm2h.js} +13 -5
  72. package/dist/{packager-tool-jaa5gcbv.js → packager-tool-71gqkgg6.js} +6 -6
  73. package/dist/packager-tool-7hw344bt.js +107 -0
  74. package/dist/{packager-tool-m8xtf5ej.js → packager-tool-8g5931fz.js} +7 -4
  75. package/dist/{packager-tool-h9tzz0qd.js → packager-tool-961vsbsc.js} +15 -10
  76. package/dist/{packager-tool-zzc2yp2h.js → packager-tool-99gban46.js} +172 -71
  77. package/dist/packager-tool-9era57c0.js +28 -0
  78. package/dist/packager-tool-9jxzgsxc.js +14 -0
  79. package/dist/{packager-tool-zxp4hya4.js → packager-tool-a5afh1dc.js} +34 -13
  80. package/dist/{packager-tool-02f63a08.js → packager-tool-apawc11t.js} +88 -762
  81. package/dist/{packager-tool-tf3d2y8z.js → packager-tool-aw9v0raw.js} +2 -2
  82. package/dist/{packager-tool-6y0f9qg5.js → packager-tool-b3k0mkke.js} +463 -327
  83. package/dist/packager-tool-cqtsj6yh.js +2 -0
  84. package/dist/{packager-tool-5nqhxb9e.js → packager-tool-dwd6cc01.js} +16110 -13031
  85. package/dist/{packager-tool-t605qewm.js → packager-tool-dxgrhfq5.js} +2 -2
  86. package/dist/{packager-tool-awkq26v0.js → packager-tool-e7kvq8hf.js} +5 -3
  87. package/dist/packager-tool-fc1xdt3y.js +35 -0
  88. package/dist/{packager-tool-3dc9gz35.js → packager-tool-frjt46rb.js} +1 -1
  89. package/dist/{packager-tool-cn7e7cx2.js → packager-tool-gcap41av.js} +668 -57
  90. package/dist/packager-tool-hj5x3p8g.js +23 -0
  91. package/dist/{packager-tool-k91rd9nx.js → packager-tool-hvgn6t66.js} +6 -24
  92. package/dist/{packager-tool-w5a1hhyj.js → packager-tool-hxyjn885.js} +13 -2
  93. package/dist/{packager-tool-hhy1gr2k.js → packager-tool-jgfzfqjm.js} +1 -1
  94. package/dist/{packager-tool-6h69pd2a.js → packager-tool-kn86394c.js} +127 -61
  95. package/dist/packager-tool-mgcz986r.js +143 -0
  96. package/dist/{packager-tool-3h2ktz6q.js → packager-tool-myhbp761.js} +11 -1
  97. package/dist/{packager-tool-hp5vnk8p.js → packager-tool-ndev7vbj.js} +13 -13
  98. package/dist/{packager-tool-dynm8fz9.js → packager-tool-nj4vcnq9.js} +20 -8
  99. package/dist/{packager-tool-ayc9nhpa.js → packager-tool-nk16zaz3.js} +519 -437
  100. package/dist/{packager-tool-vzbttaje.js → packager-tool-nts5rrch.js} +5 -6
  101. package/dist/{packager-tool-vbfz8k7w.js → packager-tool-p8gab24q.js} +52 -32
  102. package/dist/{packager-tool-stq8800d.js → packager-tool-pacrqxv2.js} +17 -4
  103. package/dist/{packager-tool-7q6z6npd.js → packager-tool-pcvhcn2k.js} +93 -11
  104. package/dist/packager-tool-phw8ydjx.js +331 -0
  105. package/dist/packager-tool-qcqb9hf8.js +26 -0
  106. package/dist/{packager-tool-n89vrpex.js → packager-tool-skcjythd.js} +10907 -25608
  107. package/dist/{packager-tool-1ca047de.js → packager-tool-sqpesv2e.js} +12 -56
  108. package/dist/packager-tool-t7ahhaer.js +877 -0
  109. package/dist/{packager-tool-peawy22c.js → packager-tool-tqjfdpda.js} +53 -8
  110. package/dist/{packager-tool-y8egb0fa.js → packager-tool-wds3myef.js} +2573 -535
  111. package/dist/{packager-tool-5tjzg56t.js → packager-tool-wh660fny.js} +1 -1
  112. package/dist/{packager-tool-tyg399d6.js → packager-tool-wze74wyk.js} +74 -47
  113. package/dist/packager-tool-xj0agqpk.js +11 -0
  114. package/dist/packager-tool-xk78j7dz.js +1256 -0
  115. package/dist/{packager-tool-py93409h.js → packager-tool-ymma2s85.js} +2 -2
  116. package/dist/packager-tool-z0yxfhdj.js +40 -0
  117. package/dist/packager-tool.js +13 -10
  118. package/dist/{pt-BR-TKHNHMET-sn91xyq0.js → pt-BR-GNQNAAZ2-xadharv4.js} +237 -30
  119. package/dist/{pt-BR-Y6K6XHXK-mp3hwhw1.js → pt-BR-USP2T7GD-pedn77m1.js} +29 -2
  120. package/dist/pt-BR-USP2T7GD-rppy42ym.js +200 -0
  121. package/dist/{pt-3DIO5QWG-59b3f4bc.js → pt-RMIAKZB4-67enhx3m.js} +29 -2
  122. package/dist/pt-RMIAKZB4-t80exmp7.js +200 -0
  123. package/dist/{pt-ROXU257Y-2f6bxev4.js → pt-TO2DARY2-ftcce1bv.js} +237 -30
  124. package/dist/ro-GHOBYW2S-4zevc9dy.js +200 -0
  125. package/dist/{ro-BWR3ONRR-vzx3hy8a.js → ro-GHOBYW2S-mhnqsgaa.js} +29 -2
  126. package/dist/{ro-AVAWPKOO-b89pw79r.js → ro-WUYJV6OW-a8d9qy1n.js} +235 -28
  127. package/dist/ru-WBLQ5B2U-dpqvtfwr.js +10 -0
  128. package/dist/services/connector-request-buckets.d.ts +1 -0
  129. package/dist/services/flow-eval-file-store.d.ts +1 -11
  130. package/dist/services/flow-eval-utils.d.ts +1 -32
  131. package/dist/services/flow-validate-service.d.ts +51 -0
  132. package/dist/services/inline-entity-resolver.d.ts +22 -0
  133. package/dist/services/node-service.d.ts +21 -1
  134. package/dist/services/packaging-utils.d.ts +15 -2
  135. package/dist/{shared-utils-pnbvyyb2.js → shared-utils-tqnx96mg.js} +4 -3
  136. package/dist/solution-auth-8qz5pw7z.js +14 -0
  137. package/dist/solution-discovery-vqravtkh.js +44 -0
  138. package/dist/{tidy-service-4fd4mjpb.js → tidy-service-fdctmeww.js} +143 -39
  139. package/dist/tool.js +17 -14
  140. package/dist/{tr-5IIHSFW5-hw4cewew.js → tr-GDTLECMM-k5fhmq13.js} +29 -2
  141. package/dist/tr-GDTLECMM-kngksm3r.js +200 -0
  142. package/dist/{tr-JMIP7ZSL-c39b6pe4.js → tr-M3F5A6AU-bb0tg39m.js} +235 -28
  143. package/dist/utils/flow-io.d.ts +2 -1
  144. package/dist/validation.js +39 -33
  145. package/dist/{variable-service-xgyaf3xy.js → variable-service-9xfk31pm.js} +16 -12
  146. package/dist/{wait-for-flow-job-d8m6mqb4.js → wait-for-flow-job-b0vj8828.js} +15 -12
  147. package/dist/{zh-CN-IFFXSEJS-9wm9gmrv.js → zh-CN-C5G4PC7C-ds9gkptg.js} +235 -28
  148. package/dist/zh-CN-I5D7WHBD-ge92tbx9.js +200 -0
  149. package/dist/{zh-CN-R2KU4U5L-tc1hat59.js → zh-CN-I5D7WHBD-sr5h0a98.js} +29 -2
  150. package/dist/{zh-TW-GNKMELBF-j674515r.js → zh-TW-2AVLM723-288pkc1z.js} +29 -2
  151. package/dist/zh-TW-2AVLM723-xsmap3gk.js +200 -0
  152. package/dist/{zh-TW-IYBNYAMG-8727c7v2.js → zh-TW-62HZIG6O-787kdwex.js} +234 -27
  153. package/package.json +2 -2
  154. package/dist/debug-conversation-trigger-8fgas95p.js +0 -44
  155. package/dist/flow-eval-run-api-byx3cacw.js +0 -13
  156. package/dist/flow-validate-service-ss9nt15j.js +0 -64
  157. package/dist/input-reader-vhar4g0k.js +0 -11
  158. package/dist/node-sync-service-42dpmp60.js +0 -40
  159. package/dist/packager-tool-a5xfcqqr.js +0 -15
  160. package/dist/packager-tool-epkg5s7f.js +0 -454
  161. package/dist/packager-tool-pz5nqg0s.js +0 -64
  162. package/dist/packager-tool-t3ysatjd.js +0 -521
  163. package/dist/packager-tool-vd6jt4n8.js +0 -208
  164. package/dist/packager-tool-wv3qf487.js +0 -265
  165. package/dist/services/flow-debug-service.d.ts +0 -320
  166. package/dist/services/flow-eval-schema/deterministic-evaluators.d.ts +0 -110
  167. package/dist/services/flow-eval-schema/evaluator-fields.d.ts +0 -66
  168. package/dist/services/flow-eval-schema/helpers.d.ts +0 -9
  169. package/dist/services/flow-eval-schema/index.d.ts +0 -4
  170. package/dist/services/flow-eval-schema/llm-judge-evaluators.d.ts +0 -174
  171. package/dist/services/flow-eval-schema/prompts.d.ts +0 -2
  172. package/dist/services/flow-eval-schema/registry.d.ts +0 -375
  173. package/dist/services/flow-eval-schema/tool-call-evaluators.d.ts +0 -93
  174. package/dist/services/flow-eval-schema/types.d.ts +0 -95
  175. package/dist/services/flow-eval-types.d.ts +0 -6
  176. package/dist/utils/write-resolved-flow.d.ts +0 -7
  177. /package/dist/{headless-45dypanh.js → headless-fw8pwyzm.js} +0 -0
  178. /package/dist/{localization-xecwjpe2.js → localization-d6gjmrsw.js} +0 -0
@@ -0,0 +1,1176 @@
1
+ import {
2
+ ProjectTool,
3
+ ToolResult
4
+ } from "./packager-tool-pacrqxv2.js";
5
+ import {
6
+ MAX_MULTILINE_MAX_FIELDS,
7
+ catchError,
8
+ findInvalidFieldConstraints,
9
+ findReservedNameError,
10
+ validateNameFormat
11
+ } from "./packager-tool-t7ahhaer.js";
12
+
13
+ // ../packager/packager-tool-datafabric/src/missing-path.ts
14
+ function isMissingPathError(error) {
15
+ if (!(error instanceof Error) || !("code" in error))
16
+ return false;
17
+ const { code } = error;
18
+ return code === "ENOENT" || code === "ENOTDIR" || code === "PathNotFound";
19
+ }
20
+ function isFilesystemError(error) {
21
+ const code = error?.code;
22
+ return typeof code === "string" && /^E[A-Z]+$/.test(code);
23
+ }
24
+ function isUnreadablePathError(error) {
25
+ return isFilesystemError(error) && !isMissingPathError(error);
26
+ }
27
+
28
+ // ../packager/packager-tool-datafabric/src/pack/constants.ts
29
+ var ENTITY_EXTENSION_CONST = ".entity";
30
+ var ENTITY_VALIDATION_FAILED = "ENTITY_VALIDATION_FAILED";
31
+ var PACK_DIAGNOSTIC_CODES = {
32
+ misplacedMainFile: "MISPLACED_MAIN_FILE",
33
+ noParentSolution: "NO_PARENT_SOLUTION",
34
+ solutionRootUnreadable: "SOLUTION_ROOT_UNREADABLE"
35
+ };
36
+
37
+ // ../packager/packager-tool-datafabric/src/schema/solution-entity-names.ts
38
+ function withoutOneOccurrence(names, name) {
39
+ const siblings = [...names];
40
+ const self = siblings.indexOf(name);
41
+ if (self >= 0) {
42
+ siblings.splice(self, 1);
43
+ }
44
+ return siblings;
45
+ }
46
+ function isMissingPath(error) {
47
+ return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "PathNotFound");
48
+ }
49
+ async function collectSolutionEntityNames(solutionDir, fs) {
50
+ const names = [];
51
+ let topLevel = [];
52
+ try {
53
+ topLevel = await fs.readdir(solutionDir);
54
+ } catch (error) {
55
+ if (!isMissingPath(error)) {
56
+ throw error;
57
+ }
58
+ return names;
59
+ }
60
+ for (const entry of topLevel) {
61
+ if (entry === "resources" || entry.startsWith(".")) {
62
+ continue;
63
+ }
64
+ const dir = fs.path.join(solutionDir, entry);
65
+ try {
66
+ const stat = await fs.stat(dir);
67
+ if (!stat?.isDirectory()) {
68
+ continue;
69
+ }
70
+ for (const file of await fs.readdir(dir)) {
71
+ if (file.endsWith(ENTITY_EXTENSION_CONST)) {
72
+ names.push(fs.path.basename(file, ENTITY_EXTENSION_CONST));
73
+ }
74
+ }
75
+ } catch (error) {
76
+ if (!isMissingPath(error)) {
77
+ throw error;
78
+ }
79
+ }
80
+ }
81
+ return names;
82
+ }
83
+
84
+ // ../../node_modules/@uipath/entity-modeler/dist/chunk-7VKIHCI7.js
85
+ var SqlTypeName = {
86
+ UNIQUEIDENTIFIER: "UNIQUEIDENTIFIER",
87
+ NVARCHAR: "NVARCHAR",
88
+ INT: "INT",
89
+ DATETIME2: "DATETIME2",
90
+ DATETIMEOFFSET: "DATETIMEOFFSET",
91
+ FLOAT: "FLOAT",
92
+ REAL: "REAL",
93
+ BIGINT: "BIGINT",
94
+ DATE: "DATE",
95
+ BIT: "BIT",
96
+ DECIMAL: "DECIMAL",
97
+ MULTILINE: "MULTILINE",
98
+ MULTILINE_MAX: "MULTILINE_MAX",
99
+ UNKNOWN: "UNKNOWN"
100
+ };
101
+ var FieldDisplayType = {
102
+ Basic: "Basic",
103
+ Relationship: "Relationship",
104
+ File: "File",
105
+ ChoiceSetSingle: "ChoiceSetSingle",
106
+ ChoiceSetMultiple: "ChoiceSetMultiple",
107
+ AutoNumber: "AutoNumber",
108
+ MultiLineText: "MultiLineText"
109
+ };
110
+ var DEFAULT_REFERENCE_TYPE = "ManyToOne";
111
+ var CSHARP_RESERVED_WORDS = [
112
+ "__arglist",
113
+ "__makeref",
114
+ "__reftype",
115
+ "__refvalue",
116
+ "abstract",
117
+ "as",
118
+ "base",
119
+ "bool",
120
+ "break",
121
+ "byte",
122
+ "case",
123
+ "catch",
124
+ "char",
125
+ "checked",
126
+ "class",
127
+ "const",
128
+ "continue",
129
+ "decimal",
130
+ "default",
131
+ "delegate",
132
+ "do",
133
+ "double",
134
+ "else",
135
+ "enum",
136
+ "event",
137
+ "explicit",
138
+ "extern",
139
+ "false",
140
+ "finally",
141
+ "fixed",
142
+ "float",
143
+ "for",
144
+ "foreach",
145
+ "goto",
146
+ "if",
147
+ "implicit",
148
+ "in",
149
+ "int",
150
+ "interface",
151
+ "internal",
152
+ "is",
153
+ "lock",
154
+ "long",
155
+ "namespace",
156
+ "new",
157
+ "null",
158
+ "object",
159
+ "operator",
160
+ "out",
161
+ "override",
162
+ "params",
163
+ "partial",
164
+ "private",
165
+ "protected",
166
+ "public",
167
+ "readonly",
168
+ "ref",
169
+ "return",
170
+ "sbyte",
171
+ "sealed",
172
+ "short",
173
+ "sizeof",
174
+ "stackalloc",
175
+ "static",
176
+ "string",
177
+ "struct",
178
+ "switch",
179
+ "this",
180
+ "throw",
181
+ "true",
182
+ "try",
183
+ "typeof",
184
+ "uint",
185
+ "ulong",
186
+ "unchecked",
187
+ "unsafe",
188
+ "ushort",
189
+ "using",
190
+ "virtual",
191
+ "void",
192
+ "volatile",
193
+ "where",
194
+ "while",
195
+ "yield"
196
+ ];
197
+ var VB_RESERVED_WORDS = [
198
+ "addhandler",
199
+ "addressof",
200
+ "alias",
201
+ "and",
202
+ "andalso",
203
+ "ansi",
204
+ "as",
205
+ "assembly",
206
+ "auto",
207
+ "boolean",
208
+ "byref",
209
+ "byte",
210
+ "byval",
211
+ "call",
212
+ "case",
213
+ "catch",
214
+ "cbool",
215
+ "cbyte",
216
+ "cchar",
217
+ "cdate",
218
+ "cdbl",
219
+ "cdec",
220
+ "char",
221
+ "cint",
222
+ "class",
223
+ "class_finalize",
224
+ "class_initialize",
225
+ "clng",
226
+ "cobj",
227
+ "const",
228
+ "continue",
229
+ "csbyte",
230
+ "cshort",
231
+ "csng",
232
+ "cstr",
233
+ "ctype",
234
+ "cuint",
235
+ "culng",
236
+ "cushort",
237
+ "date",
238
+ "decimal",
239
+ "declare",
240
+ "default",
241
+ "delegate",
242
+ "dim",
243
+ "directcast",
244
+ "do",
245
+ "double",
246
+ "each",
247
+ "else",
248
+ "elseif",
249
+ "end",
250
+ "endif",
251
+ "enum",
252
+ "erase",
253
+ "error",
254
+ "event",
255
+ "exit",
256
+ "false",
257
+ "finally",
258
+ "for",
259
+ "friend",
260
+ "function",
261
+ "get",
262
+ "gettype",
263
+ "global",
264
+ "gosub",
265
+ "goto",
266
+ "handles",
267
+ "if",
268
+ "implements",
269
+ "imports",
270
+ "in",
271
+ "inherits",
272
+ "integer",
273
+ "interface",
274
+ "is",
275
+ "isnot",
276
+ "let",
277
+ "lib",
278
+ "like",
279
+ "long",
280
+ "loop",
281
+ "me",
282
+ "mod",
283
+ "module",
284
+ "mustinherit",
285
+ "mustoverride",
286
+ "mybase",
287
+ "myclass",
288
+ "namespace",
289
+ "narrowing",
290
+ "new",
291
+ "next",
292
+ "not",
293
+ "nothing",
294
+ "notinheritable",
295
+ "notoverridable",
296
+ "object",
297
+ "of",
298
+ "on",
299
+ "operator",
300
+ "option",
301
+ "optional",
302
+ "or",
303
+ "orelse",
304
+ "overloads",
305
+ "overridable",
306
+ "overrides",
307
+ "paramarray",
308
+ "partial",
309
+ "preserve",
310
+ "private",
311
+ "property",
312
+ "protected",
313
+ "public",
314
+ "raiseevent",
315
+ "readonly",
316
+ "redim",
317
+ "rem",
318
+ "removehandler",
319
+ "resume",
320
+ "return",
321
+ "sbyte",
322
+ "select",
323
+ "set",
324
+ "shadows",
325
+ "shared",
326
+ "short",
327
+ "single",
328
+ "static",
329
+ "step",
330
+ "stop",
331
+ "string",
332
+ "structure",
333
+ "sub",
334
+ "synclock",
335
+ "then",
336
+ "throw",
337
+ "to",
338
+ "true",
339
+ "try",
340
+ "trycast",
341
+ "typeof",
342
+ "uinteger",
343
+ "ulong",
344
+ "unicode",
345
+ "until",
346
+ "ushort",
347
+ "using",
348
+ "variant",
349
+ "wend",
350
+ "when",
351
+ "while",
352
+ "widening",
353
+ "with",
354
+ "withevents",
355
+ "writeonly",
356
+ "xor"
357
+ ];
358
+ var CSHARP_RESERVED = new Set(CSHARP_RESERVED_WORDS);
359
+ var VB_RESERVED = new Set(VB_RESERVED_WORDS);
360
+ var GA_TYPE_PAIRS = [
361
+ [FieldDisplayType.Basic, SqlTypeName.NVARCHAR],
362
+ [FieldDisplayType.Basic, SqlTypeName.DECIMAL],
363
+ [FieldDisplayType.Basic, SqlTypeName.FLOAT],
364
+ [FieldDisplayType.Basic, SqlTypeName.BIT],
365
+ [FieldDisplayType.Basic, SqlTypeName.DATE],
366
+ [FieldDisplayType.Basic, SqlTypeName.DATETIMEOFFSET],
367
+ [FieldDisplayType.Basic, SqlTypeName.UNIQUEIDENTIFIER],
368
+ [FieldDisplayType.AutoNumber, SqlTypeName.DECIMAL],
369
+ [FieldDisplayType.Basic, SqlTypeName.MULTILINE],
370
+ [FieldDisplayType.Basic, SqlTypeName.MULTILINE_MAX],
371
+ [FieldDisplayType.File, SqlTypeName.UNIQUEIDENTIFIER]
372
+ ];
373
+ var ALLOWED_TYPE_PAIRS = new Set(GA_TYPE_PAIRS.map(([display, sql]) => `${display}:${sql}`));
374
+ // ../packager/packager-tool-datafabric/src/sort-names.ts
375
+ function byName(a, b) {
376
+ return a.localeCompare(b, "en");
377
+ }
378
+
379
+ // ../packager/packager-tool-datafabric/src/schema/author-field.ts
380
+ var TYPE_MAP = {
381
+ STRING: [FieldDisplayType.Basic, SqlTypeName.NVARCHAR],
382
+ DECIMAL: [FieldDisplayType.Basic, SqlTypeName.DECIMAL],
383
+ BOOLEAN: [FieldDisplayType.Basic, SqlTypeName.BIT],
384
+ DATE: [FieldDisplayType.Basic, SqlTypeName.DATE],
385
+ DATETIME_WITH_TZ: [FieldDisplayType.Basic, SqlTypeName.DATETIMEOFFSET],
386
+ MULTILINE_TEXT: [FieldDisplayType.Basic, SqlTypeName.MULTILINE],
387
+ MULTILINE_MAX: [FieldDisplayType.Basic, SqlTypeName.MULTILINE_MAX],
388
+ AUTO_NUMBER: [FieldDisplayType.AutoNumber, SqlTypeName.DECIMAL],
389
+ FILE: [FieldDisplayType.File, SqlTypeName.UNIQUEIDENTIFIER]
390
+ };
391
+ var AUTHORABLE_FIELD_TYPES = Object.freeze(Object.keys(TYPE_MAP).sort(byName));
392
+ var UNAUTHORABLE_TYPES = {
393
+ CHOICE_SET_SINGLE: "choice-set fields are not authorable locally — add the field in Data Fabric",
394
+ CHOICE_SET_MULTIPLE: "choice-set fields are not authorable locally — add the field in Data Fabric",
395
+ RELATIONSHIP: "relationship fields are not authorable locally — add the field in Data Fabric",
396
+ INTEGER: "use DECIMAL with decimalPrecision: 0",
397
+ BIG_INTEGER: "use DECIMAL with decimalPrecision: 0",
398
+ FLOAT: "use DECIMAL with a decimalPrecision",
399
+ DOUBLE: "use DECIMAL with a decimalPrecision",
400
+ UUID: "use STRING",
401
+ DATETIME: "use DATETIME_WITH_TZ"
402
+ };
403
+
404
+ class AuthoredFieldError extends Error {
405
+ instructions;
406
+ constructor(message, instructions) {
407
+ super(message);
408
+ this.instructions = instructions;
409
+ this.name = "AuthoredFieldError";
410
+ }
411
+ }
412
+ function buildSqlType(name, spec) {
413
+ const sqlType = { Name: name };
414
+ if (spec.lengthLimit != null)
415
+ sqlType.LengthLimit = spec.lengthLimit;
416
+ if (spec.decimalPrecision != null)
417
+ sqlType.DecimalPrecision = spec.decimalPrecision;
418
+ if (spec.maxValue != null)
419
+ sqlType.MaxValue = spec.maxValue;
420
+ if (spec.minValue != null)
421
+ sqlType.MinValue = spec.minValue;
422
+ return sqlType;
423
+ }
424
+ var DEFAULT_VALUE_SHAPES = {
425
+ BOOLEAN: '"true" or "false"',
426
+ DECIMAL: 'a number in quotes, e.g. "0"',
427
+ AUTO_NUMBER: 'a number in quotes, e.g. "0"'
428
+ };
429
+ function assertDefaultValue(spec, checkContent) {
430
+ const value = spec.defaultValue;
431
+ if (value === undefined || value === null) {
432
+ return;
433
+ }
434
+ if (!checkContent) {
435
+ return;
436
+ }
437
+ if (typeof value !== "string") {
438
+ const shape = DEFAULT_VALUE_SHAPES[spec.type] ?? "a string";
439
+ throw new AuthoredFieldError(`Field '${spec.name}': 'defaultValue' must be a string or null`, `Received ${JSON.stringify(value)}. Entity documents store every default as text, whatever the field type — for ${spec.type} pass ${shape}, or null to clear it.`);
440
+ }
441
+ if (spec.type === "BOOLEAN" && value.toLowerCase() !== "true" && value.toLowerCase() !== "false") {
442
+ throw new AuthoredFieldError(`Field '${spec.name}': 'defaultValue' ${JSON.stringify(value)} is not a boolean`, 'A BOOLEAN default is the text "true" or "false".');
443
+ }
444
+ if ((spec.type === "DECIMAL" || spec.type === "AUTO_NUMBER") && (value.trim() === "" || !Number.isFinite(Number(value)))) {
445
+ throw new AuthoredFieldError(`Field '${spec.name}': 'defaultValue' ${JSON.stringify(value)} is not a number`, `A ${spec.type} default is a number written as text, e.g. "0".`);
446
+ }
447
+ }
448
+ function authorField(spec, options = {}) {
449
+ const pair = TYPE_MAP[spec.type];
450
+ if (pair === undefined) {
451
+ const redirect = UNAUTHORABLE_TYPES[spec.type];
452
+ throw new AuthoredFieldError(`Field '${spec.name}' has unsupported type '${spec.type}'`, redirect === undefined ? `Supported types: ${AUTHORABLE_FIELD_TYPES.join(", ")}.` : `${redirect}. Supported types: ${AUTHORABLE_FIELD_TYPES.join(", ")}.`);
453
+ }
454
+ const [fieldDisplayType, sqlTypeName] = pair;
455
+ const pairKey = `${fieldDisplayType}:${sqlTypeName}`;
456
+ if (!ALLOWED_TYPE_PAIRS.has(pairKey)) {
457
+ throw new AuthoredFieldError(`Internal: type '${spec.type}' maps to ${pairKey}, which is not an allowed pair`, "This is a defect in author-field.ts — the type map has drifted from GA_TYPE_PAIRS.");
458
+ }
459
+ for (const [key, value] of [
460
+ ["isRequired", spec.isRequired],
461
+ ["isUnique", spec.isUnique]
462
+ ]) {
463
+ if (value !== undefined && typeof value !== "boolean") {
464
+ throw new AuthoredFieldError(`Field '${spec.name}': '${key}' must be true or false`, `Received ${JSON.stringify(value)}. Use a JSON boolean, not a string.`);
465
+ }
466
+ }
467
+ for (const [key, value] of [
468
+ ["displayName", spec.displayName],
469
+ ["description", spec.description]
470
+ ]) {
471
+ if (value !== undefined && typeof value !== "string") {
472
+ throw new AuthoredFieldError(`Field '${spec.name}': '${key}' must be a string`, `Received ${JSON.stringify(value)}.`);
473
+ }
474
+ }
475
+ assertDefaultValue(spec, options.defaultValueFromCaller !== false);
476
+ const constraintError = findInvalidFieldConstraints([
477
+ {
478
+ name: spec.name,
479
+ type: spec.type,
480
+ ...spec.lengthLimit != null && {
481
+ lengthLimit: spec.lengthLimit
482
+ },
483
+ ...spec.decimalPrecision != null && {
484
+ decimalPrecision: spec.decimalPrecision
485
+ },
486
+ ...spec.maxValue != null && { maxValue: spec.maxValue },
487
+ ...spec.minValue != null && { minValue: spec.minValue }
488
+ }
489
+ ]);
490
+ if (constraintError) {
491
+ throw new AuthoredFieldError(constraintError.message, constraintError.instructions);
492
+ }
493
+ return {
494
+ Name: spec.name,
495
+ DisplayName: spec.displayName ?? spec.name,
496
+ SqlType: buildSqlType(sqlTypeName, spec),
497
+ IsRequired: spec.isRequired ?? false,
498
+ IsUnique: spec.isUnique ?? false,
499
+ IsPrimaryKey: false,
500
+ IsForeignKey: false,
501
+ IsExternalField: false,
502
+ IsHiddenField: false,
503
+ FieldCategoryId: 0,
504
+ ReferenceType: DEFAULT_REFERENCE_TYPE,
505
+ Transformation: null,
506
+ IsEncrypted: false,
507
+ Description: spec.description ?? "",
508
+ IsSystemField: false,
509
+ FieldDisplayType: fieldDisplayType,
510
+ DefaultValue: spec.defaultValue ?? null,
511
+ IsAttachment: false,
512
+ IsRbacEnabled: false,
513
+ IsModelReserved: false,
514
+ ReferenceChoiceSet: null,
515
+ ReferenceEntity: null,
516
+ ReferenceField: null,
517
+ ReferenceName: null
518
+ };
519
+ }
520
+
521
+ // ../packager/packager-tool-datafabric/src/schema/create-entity-skeleton.ts
522
+ var UNASSIGNED_FOLDER_ID = "99999999-9999-9999-9999-999999999999";
523
+ function isLocallyAuthored(entity) {
524
+ return entity.FolderId === UNASSIGNED_FOLDER_ID;
525
+ }
526
+ var SYSTEM_FIELD_DEFAULTS = {
527
+ IsPrimaryKey: false,
528
+ IsForeignKey: false,
529
+ IsExternalField: false,
530
+ IsHiddenField: true,
531
+ FieldCategoryId: 0,
532
+ IsUnique: false,
533
+ ReferenceType: "ManyToOne",
534
+ Transformation: null,
535
+ IsRequired: false,
536
+ IsEncrypted: false,
537
+ Description: "",
538
+ IsSystemField: true,
539
+ FieldDisplayType: FieldDisplayType.Basic,
540
+ IsAttachment: false,
541
+ IsRbacEnabled: false,
542
+ IsModelReserved: false
543
+ };
544
+ var SYSTEM_FIELD_TEMPLATES = [
545
+ {
546
+ ...SYSTEM_FIELD_DEFAULTS,
547
+ Name: "Id",
548
+ DisplayName: "Id",
549
+ IsPrimaryKey: true,
550
+ SqlType: { Name: SqlTypeName.UNIQUEIDENTIFIER }
551
+ },
552
+ {
553
+ ...SYSTEM_FIELD_DEFAULTS,
554
+ Name: "CreateTime",
555
+ DisplayName: "CreateTime",
556
+ SqlType: { Name: SqlTypeName.DATETIMEOFFSET }
557
+ },
558
+ {
559
+ ...SYSTEM_FIELD_DEFAULTS,
560
+ Name: "CreatedBy",
561
+ DisplayName: "CreatedBy",
562
+ FieldDisplayType: FieldDisplayType.Relationship,
563
+ SqlType: { Name: SqlTypeName.UNIQUEIDENTIFIER }
564
+ },
565
+ {
566
+ ...SYSTEM_FIELD_DEFAULTS,
567
+ Name: "UpdateTime",
568
+ DisplayName: "UpdateTime",
569
+ SqlType: { Name: SqlTypeName.DATETIMEOFFSET }
570
+ },
571
+ {
572
+ ...SYSTEM_FIELD_DEFAULTS,
573
+ Name: "UpdatedBy",
574
+ DisplayName: "UpdatedBy",
575
+ FieldDisplayType: FieldDisplayType.Relationship,
576
+ SqlType: { Name: SqlTypeName.UNIQUEIDENTIFIER }
577
+ }
578
+ ];
579
+ function createEntitySkeleton(name) {
580
+ return {
581
+ Id: globalThis.crypto.randomUUID(),
582
+ Name: name,
583
+ DisplayName: name,
584
+ EntityTypeId: 0,
585
+ EntityType: "Entity",
586
+ Description: "",
587
+ FolderId: UNASSIGNED_FOLDER_ID,
588
+ Fields: SYSTEM_FIELD_TEMPLATES.map((template) => ({
589
+ ...template,
590
+ SqlType: { ...template.SqlType }
591
+ })),
592
+ Data: null,
593
+ ExternalFields: null,
594
+ SourceJoinCriterias: null,
595
+ RecordCount: 0,
596
+ StorageSizeInMB: null,
597
+ UsedStorageSizeInMB: null,
598
+ AttachmentSizeInByte: null,
599
+ IsRbacEnabled: false,
600
+ InvalidIdentifiers: [],
601
+ IsModelReserved: false,
602
+ CategoryId: null
603
+ };
604
+ }
605
+
606
+ // ../packager/packager-tool-datafabric/src/schema/validate-entity.ts
607
+ var DIAGNOSTIC_CODES = {
608
+ entityNameInvalid: "ENTITY_NAME_INVALID",
609
+ entityNameNotUnique: "ENTITY_NAME_NOT_UNIQUE",
610
+ fieldNameInvalid: "FIELD_NAME_INVALID",
611
+ duplicateFieldName: "DUPLICATE_FIELD_NAME",
612
+ fieldTypeNotAllowed: "FIELD_TYPE_NOT_ALLOWED",
613
+ nameReserved: "NAME_RESERVED",
614
+ systemFieldMissing: "SYSTEM_FIELD_MISSING",
615
+ systemFieldModified: "SYSTEM_FIELD_MODIFIED",
616
+ fieldsMalformed: "FIELDS_MALFORMED",
617
+ tooManyMultilineMax: "TOO_MANY_MULTILINE_MAX",
618
+ propertyTypeInvalid: "PROPERTY_TYPE_INVALID"
619
+ };
620
+ function validateEntity(entity, ctx) {
621
+ const diagnostics = [];
622
+ if (typeof entity?.Name !== "string") {
623
+ return [
624
+ {
625
+ code: DIAGNOSTIC_CODES.entityNameInvalid,
626
+ message: "The entity document has no 'Name'. The resource is malformed.",
627
+ severity: "error"
628
+ }
629
+ ];
630
+ }
631
+ const entityNameFormat = validateNameFormat(entity.Name, "entity");
632
+ if (entityNameFormat) {
633
+ diagnostics.push({
634
+ code: DIAGNOSTIC_CODES.entityNameInvalid,
635
+ message: `${entityNameFormat.message}. ${entityNameFormat.instructions}`,
636
+ severity: "error"
637
+ });
638
+ }
639
+ const reservedEntityName = findReservedNameError(entity.Name, "entity");
640
+ if (reservedEntityName) {
641
+ diagnostics.push({
642
+ code: DIAGNOSTIC_CODES.nameReserved,
643
+ message: `${reservedEntityName.message}. ${reservedEntityName.instructions}`,
644
+ severity: "error"
645
+ });
646
+ }
647
+ const entityNameLower = entity.Name.toLowerCase();
648
+ if (ctx.siblingNames.some((sibling) => sibling.toLowerCase() === entityNameLower)) {
649
+ diagnostics.push({
650
+ code: DIAGNOSTIC_CODES.entityNameNotUnique,
651
+ message: `An entity named '${entity.Name}' already exists in this solution. Entity names are solution-wide unique.`,
652
+ severity: "error"
653
+ });
654
+ }
655
+ diagnostics.push(...typeProblems(entity, ENTITY_SCALARS).map((problem) => propertyTypeDiagnostic(`Entity '${entity.Name}'`, problem)));
656
+ if (!Array.isArray(entity.Fields)) {
657
+ diagnostics.push({
658
+ code: DIAGNOSTIC_CODES.fieldsMalformed,
659
+ message: "The entity document has no usable 'Fields' array. The resource is malformed.",
660
+ severity: "error"
661
+ });
662
+ return diagnostics;
663
+ }
664
+ const seenFieldNames = new Map;
665
+ for (const field of entity.Fields) {
666
+ if (typeof field?.Name !== "string") {
667
+ diagnostics.push({
668
+ code: DIAGNOSTIC_CODES.fieldNameInvalid,
669
+ message: "A field has no 'Name'. Every field needs one, system or custom.",
670
+ severity: "error"
671
+ });
672
+ continue;
673
+ }
674
+ const isSystem = isSystemField(field);
675
+ if (!SYSTEM_FIELD_NAMES.has(field.Name)) {
676
+ diagnostics.push(...fieldTypeDiagnostics(field));
677
+ }
678
+ const fieldNameFormat = isSystem ? null : validateNameFormat(field.Name, "field");
679
+ if (fieldNameFormat) {
680
+ diagnostics.push({
681
+ code: DIAGNOSTIC_CODES.fieldNameInvalid,
682
+ message: `${fieldNameFormat.message}. ${fieldNameFormat.instructions}`,
683
+ severity: "error",
684
+ fieldName: field.Name
685
+ });
686
+ }
687
+ if (!isSystem) {
688
+ const reservedFieldName = findReservedNameError(field.Name, "field");
689
+ if (reservedFieldName) {
690
+ diagnostics.push({
691
+ code: DIAGNOSTIC_CODES.nameReserved,
692
+ message: `${reservedFieldName.message}. ${reservedFieldName.instructions}`,
693
+ severity: "error",
694
+ fieldName: field.Name
695
+ });
696
+ }
697
+ }
698
+ const fieldNameLower = field.Name.toLowerCase();
699
+ if (!isSystem && typeof entity.Name === "string" && fieldNameLower === entity.Name.toLowerCase()) {
700
+ diagnostics.push({
701
+ code: DIAGNOSTIC_CODES.fieldNameInvalid,
702
+ message: `Field name '${field.Name}' cannot match entity name '${entity.Name}' (names are compared case-insensitively).`,
703
+ severity: "error",
704
+ fieldName: field.Name
705
+ });
706
+ }
707
+ const firstWithName = seenFieldNames.get(fieldNameLower);
708
+ if (firstWithName !== undefined) {
709
+ diagnostics.push({
710
+ code: DIAGNOSTIC_CODES.duplicateFieldName,
711
+ message: `Duplicate field name '${field.Name}' (names are case-insensitive; first defined as '${firstWithName}').`,
712
+ severity: "error",
713
+ fieldName: field.Name
714
+ });
715
+ } else {
716
+ seenFieldNames.set(fieldNameLower, field.Name);
717
+ }
718
+ if (!isSystem && !ALLOWED_TYPE_PAIRS.has(`${field.FieldDisplayType}:${field.SqlType?.Name}`)) {
719
+ diagnostics.push({
720
+ code: DIAGNOSTIC_CODES.fieldTypeNotAllowed,
721
+ message: `Field '${field.Name}' uses an unsupported type combination ` + `(${field.FieldDisplayType} / ${field.SqlType?.Name}).`,
722
+ severity: "error",
723
+ fieldName: field.Name
724
+ });
725
+ }
726
+ }
727
+ const usableFields = entity.Fields.filter((field) => typeof field === "object" && field !== null);
728
+ const multilineMax = usableFields.filter((field) => field.SqlType?.Name === SqlTypeName.MULTILINE_MAX);
729
+ if (multilineMax.length > MAX_MULTILINE_MAX_FIELDS) {
730
+ diagnostics.push({
731
+ code: DIAGNOSTIC_CODES.tooManyMultilineMax,
732
+ message: `Entity '${entity.Name}' defines ${multilineMax.length} MULTILINE_MAX fields; ` + `the maximum is ${MAX_MULTILINE_MAX_FIELDS}. Remove some, or use MULTILINE_TEXT where the content fits.`,
733
+ severity: "error"
734
+ });
735
+ }
736
+ diagnostics.push(...validateSystemFields(entity, usableFields));
737
+ return diagnostics;
738
+ }
739
+ var SERVER_ASSIGNED_FIELD_PROPS = new Set([
740
+ "Id",
741
+ "CreateTime",
742
+ "CreatedBy",
743
+ "UpdateTime",
744
+ "UpdatedBy"
745
+ ]);
746
+ function isUnmodifiedSystemField(template, actual) {
747
+ const equal = (left, right) => JSON.stringify(left ?? null) === JSON.stringify(right ?? null);
748
+ for (const key of Object.keys(template)) {
749
+ if (!equal(template[key], actual[key])) {
750
+ return false;
751
+ }
752
+ }
753
+ return Object.keys(actual).every((key) => (key in template) || SERVER_ASSIGNED_FIELD_PROPS.has(key));
754
+ }
755
+ function validateSystemFields(entity, usableFields) {
756
+ const diagnostics = [];
757
+ for (const template of SYSTEM_FIELD_TEMPLATES) {
758
+ const actual = usableFields.find((field) => field.Name === template.Name);
759
+ if (!actual) {
760
+ diagnostics.push({
761
+ code: DIAGNOSTIC_CODES.systemFieldMissing,
762
+ message: `System field '${template.Name}' is missing. System fields cannot be removed.`,
763
+ severity: "error",
764
+ fieldName: template.Name
765
+ });
766
+ continue;
767
+ }
768
+ if (!isUnmodifiedSystemField(template, actual)) {
769
+ diagnostics.push({
770
+ code: DIAGNOSTIC_CODES.systemFieldModified,
771
+ message: `System field '${template.Name}' was modified. System fields are read-only.`,
772
+ severity: "error",
773
+ fieldName: template.Name
774
+ });
775
+ }
776
+ }
777
+ return diagnostics;
778
+ }
779
+ function isSystemField(field) {
780
+ const { IsSystemField: flag, Name: name } = field ?? {};
781
+ return flag === true || typeof name === "string" && SYSTEM_FIELD_NAMES.has(name);
782
+ }
783
+ var SYSTEM_FIELD_NAMES = new Set(SYSTEM_FIELD_TEMPLATES.map((template) => template.Name));
784
+ var ENTITY_SCALARS = [
785
+ { key: "DisplayName", kind: "string" },
786
+ { key: "Description", kind: "string" },
787
+ { key: "EntityTypeId", kind: "integer" },
788
+ { key: "RecordCount", kind: "integer" },
789
+ { key: "IsRbacEnabled", kind: "boolean" },
790
+ { key: "IsModelReserved", kind: "boolean" }
791
+ ];
792
+ var FIELD_SCALARS = [
793
+ { key: "DisplayName", kind: "string" },
794
+ { key: "Description", kind: "string" },
795
+ { key: "ReferenceType", kind: "string" },
796
+ { key: "FieldCategoryId", kind: "integer" },
797
+ { key: "IsRequired", kind: "boolean" },
798
+ { key: "IsUnique", kind: "boolean" },
799
+ { key: "IsPrimaryKey", kind: "boolean" },
800
+ { key: "IsForeignKey", kind: "boolean" },
801
+ { key: "IsSystemField", kind: "boolean" },
802
+ { key: "IsExternalField", kind: "boolean" },
803
+ { key: "IsHiddenField", kind: "boolean" },
804
+ { key: "IsEncrypted", kind: "boolean" },
805
+ { key: "IsAttachment", kind: "boolean" },
806
+ { key: "IsRbacEnabled", kind: "boolean" },
807
+ { key: "IsModelReserved", kind: "boolean" }
808
+ ];
809
+ var SQL_TYPE_SCALARS = [
810
+ { key: "LengthLimit", kind: "integer", nullable: true },
811
+ { key: "DecimalPrecision", kind: "integer", nullable: true },
812
+ { key: "MaxValue", kind: "number", nullable: true },
813
+ { key: "MinValue", kind: "number", nullable: true }
814
+ ];
815
+ function typeProblems(record, rules, prefix = "") {
816
+ const values = record;
817
+ return rules.filter(({ key, kind, nullable }) => {
818
+ const value = values[key];
819
+ if (value === undefined)
820
+ return false;
821
+ if (value === null)
822
+ return !nullable;
823
+ if (kind === "integer")
824
+ return !Number.isInteger(value);
825
+ return kind === "number" ? !(typeof value === "number" && Number.isFinite(value)) : typeof value !== kind;
826
+ }).map(({ key, kind, nullable }) => `'${prefix}${key}' must be ${kind === "integer" ? "an" : "a"} ${kind}${nullable ? " or null" : ""}`);
827
+ }
828
+ function propertyTypeDiagnostic(subject, problem, fieldName) {
829
+ return {
830
+ code: DIAGNOSTIC_CODES.propertyTypeInvalid,
831
+ message: `${subject}: ${problem}. The resource was edited by hand or is malformed.`,
832
+ severity: "error",
833
+ ...fieldName !== undefined && { fieldName }
834
+ };
835
+ }
836
+ function fieldTypeDiagnostics(field) {
837
+ const problems = typeProblems(field, FIELD_SCALARS);
838
+ if (typeof field.SqlType === "object" && field.SqlType !== null) {
839
+ problems.push(...typeProblems(field.SqlType, SQL_TYPE_SCALARS, "SqlType."));
840
+ }
841
+ const defaultValue = field.DefaultValue;
842
+ const isYesNo = field.SqlType?.Name === SqlTypeName.BIT;
843
+ if (defaultValue != null && typeof defaultValue !== "string" && !(isYesNo && typeof defaultValue === "boolean")) {
844
+ problems.push(isYesNo ? "'DefaultValue' must be a boolean, a string or null" : "'DefaultValue' must be a string or null");
845
+ }
846
+ return problems.map((problem) => propertyTypeDiagnostic(`Field '${field.Name}'`, problem, field.Name));
847
+ }
848
+
849
+ // ../packager/packager-tool-datafabric/src/resource/unified-resource-file.ts
850
+ var ENTITY_RESOURCE_KIND = "entity";
851
+ var ENTITY_RESOURCE_TYPE = "native";
852
+ var ENTITY_RESOURCE_API_VERSION = "dataservice.uipath.com/v2";
853
+ var ENTITY_RESOURCE_DOC_VERSION = "1.0.0";
854
+ var SOLUTION_FOLDER = "solution_folder";
855
+ var ENTITY_RESOURCE_DIR = `${ENTITY_RESOURCE_KIND}/${ENTITY_RESOURCE_TYPE}`;
856
+ function entityResourcePath(entityName) {
857
+ return `resources/${SOLUTION_FOLDER}/${ENTITY_RESOURCE_DIR}/${entityName}.json`;
858
+ }
859
+
860
+ // ../packager/packager-tool-datafabric/src/resource/resource-io.ts
861
+ function serialize(value) {
862
+ return `${JSON.stringify(value, null, 2)}
863
+ `;
864
+ }
865
+ function serializeEntityJson(entity) {
866
+ return JSON.stringify(entity);
867
+ }
868
+
869
+ class EntityResourceError extends Error {
870
+ failure;
871
+ constructor(failure, message) {
872
+ super(message);
873
+ this.failure = failure;
874
+ this.name = "EntityResourceError";
875
+ }
876
+ }
877
+ function wrapEntityJson(entity) {
878
+ return {
879
+ docVersion: ENTITY_RESOURCE_DOC_VERSION,
880
+ resource: {
881
+ name: entity.Name,
882
+ kind: ENTITY_RESOURCE_KIND,
883
+ type: ENTITY_RESOURCE_TYPE,
884
+ apiVersion: ENTITY_RESOURCE_API_VERSION,
885
+ isOverridable: true,
886
+ dependencies: [],
887
+ runtimeDependencies: [],
888
+ folders: [{ fullyQualifiedName: SOLUTION_FOLDER }],
889
+ spec: {
890
+ resourceJson: serializeEntityJson(entity),
891
+ name: entity.Name,
892
+ displayName: entity.DisplayName,
893
+ description: entity.Description
894
+ },
895
+ locks: [],
896
+ key: entity.Id,
897
+ files: []
898
+ }
899
+ };
900
+ }
901
+ function unwrapResource(file) {
902
+ if (typeof file !== "object" || file === null || Array.isArray(file)) {
903
+ throw new EntityResourceError("NotAnObject", "Resource file is not a JSON object.");
904
+ }
905
+ const resource = file.resource;
906
+ if (typeof resource !== "object" || resource === null) {
907
+ throw new EntityResourceError("MissingResource", "Resource file has no 'resource' object.");
908
+ }
909
+ if (resource.kind !== ENTITY_RESOURCE_KIND) {
910
+ throw new EntityResourceError("NotAnEntityResource", `Resource kind is '${String(resource.kind)}', expected '${ENTITY_RESOURCE_KIND}'.`);
911
+ }
912
+ const spec = resource.spec;
913
+ if (typeof spec !== "object" || spec === null || typeof spec.resourceJson !== "string") {
914
+ throw new EntityResourceError("MissingSpec", "Resource file has no 'spec.resourceJson' string.");
915
+ }
916
+ try {
917
+ return JSON.parse(spec.resourceJson);
918
+ } catch {
919
+ throw new EntityResourceError("ResourceJsonUnparsable", "'spec.resourceJson' is not valid JSON.");
920
+ }
921
+ }
922
+ function updateResourceSchema(file, entity) {
923
+ return {
924
+ ...file,
925
+ resource: {
926
+ ...file.resource,
927
+ name: entity.Name,
928
+ spec: {
929
+ ...file.resource.spec,
930
+ resourceJson: serializeEntityJson(entity),
931
+ name: entity.Name,
932
+ displayName: entity.DisplayName,
933
+ description: entity.Description
934
+ }
935
+ }
936
+ };
937
+ }
938
+
939
+ // ../packager/packager-tool-datafabric/src/pack/verify-pair.ts
940
+ async function verifyPair(stubFile, solutionDir, fs) {
941
+ const parsedStub = await readStub(stubFile, fs);
942
+ if ("failure" in parsedStub) {
943
+ return { ok: false, failure: parsedStub.failure };
944
+ }
945
+ const stub = parsedStub.stub;
946
+ const baseName = fs.path.basename(stubFile, ENTITY_EXTENSION_CONST);
947
+ if (baseName !== stub.name) {
948
+ return fail("StubFileNameMismatch", `Stub file '${baseName}${ENTITY_EXTENSION_CONST}' names entity '${stub.name}' — the filename and the entity name must match.`);
949
+ }
950
+ const solutionRoot = fs.path.resolve(solutionDir);
951
+ const resourceFile = fs.path.resolve(solutionRoot, ...stub.resourcePath.split("/"));
952
+ const boundary = resourceFile.charAt(solutionRoot.length);
953
+ if (!resourceFile.startsWith(solutionRoot) || boundary !== "/" && boundary !== "\\") {
954
+ return fail("ResourcePathEscapes", `'${stub.name}': resourcePath '${stub.resourcePath}' points outside the solution.`);
955
+ }
956
+ const parsedResource = await readResource(resourceFile, stub.name, stub.resourcePath, fs);
957
+ if ("failure" in parsedResource) {
958
+ return { ok: false, failure: parsedResource.failure };
959
+ }
960
+ const resourceRaw = parsedResource.raw;
961
+ let entity;
962
+ try {
963
+ entity = unwrapResource(resourceRaw);
964
+ } catch (error) {
965
+ const detail = error instanceof EntityResourceError ? ` (${error.failure})` : "";
966
+ return fail("ResourceInvalid", `'${stub.name}': resource '${stub.resourcePath}' is not a valid entity resource${detail}.`);
967
+ }
968
+ if (entity.Name !== stub.name) {
969
+ return fail("NameCoupling", `Stub '${stub.name}' points at a resource defining entity '${entity.Name}' — the names must match.`);
970
+ }
971
+ return { ok: true, entityName: stub.name, resourceFile, entity };
972
+ }
973
+ function fail(code, message) {
974
+ return { ok: false, failure: { code, message } };
975
+ }
976
+ async function readStub(stubFile, fs) {
977
+ let parsed;
978
+ try {
979
+ const raw = await fs.readFile(stubFile);
980
+ if (raw === null) {
981
+ return failure("StubUnparsable", `'${stubFile}' could not be read.`);
982
+ }
983
+ parsed = JSON.parse(decode(raw));
984
+ } catch {
985
+ return failure("StubUnparsable", `'${stubFile}' is not valid JSON.`);
986
+ }
987
+ if (typeof parsed !== "object" || parsed === null || typeof parsed.name !== "string" || typeof parsed.resourcePath !== "string") {
988
+ return failure("StubUnparsable", `'${stubFile}' must be an object with string 'name' and 'resourcePath'.`);
989
+ }
990
+ return { stub: { name: parsed.name, resourcePath: parsed.resourcePath } };
991
+ }
992
+ async function readResource(resourceFile, entityName, resourcePath, fs) {
993
+ const missing = failure("ResourceMissing", `'${entityName}': definition resource '${resourcePath}' is missing. Restore it (check trash/backup) or delete the entity.`);
994
+ try {
995
+ const raw = await fs.readFile(resourceFile);
996
+ if (raw === null) {
997
+ return missing;
998
+ }
999
+ return { raw: JSON.parse(decode(raw)) };
1000
+ } catch (error) {
1001
+ if (error instanceof SyntaxError) {
1002
+ return failure("ResourceInvalid", `'${entityName}': resource '${resourcePath}' is not valid JSON.`);
1003
+ }
1004
+ return missing;
1005
+ }
1006
+ }
1007
+ function decode(raw) {
1008
+ return typeof raw === "string" ? raw : new TextDecoder().decode(raw);
1009
+ }
1010
+ function failure(code, message) {
1011
+ return { failure: { code, message } };
1012
+ }
1013
+ async function findSolutionRoot(startDir, fs) {
1014
+ let dir = fs.path.resolve(startDir);
1015
+ let unreadable;
1016
+ for (;; ) {
1017
+ const [error, entries] = await catchError(fs.readdir(dir));
1018
+ if (error && isUnreadablePathError(error)) {
1019
+ unreadable ??= error;
1020
+ }
1021
+ if (entries?.some((name) => name.endsWith(".uipx"))) {
1022
+ if (unreadable) {
1023
+ throw Object.assign(new Error(`Could not locate the solution from '${startDir}': ${unreadable.message}. A directory between here and the nearest .uipx cannot be read, and it may be the solution itself — fix read access and retry.`, { cause: unreadable }), { code: unreadable.code });
1024
+ }
1025
+ return dir;
1026
+ }
1027
+ const parent = fs.path.dirname(dir);
1028
+ if (parent === dir) {
1029
+ return;
1030
+ }
1031
+ dir = parent;
1032
+ }
1033
+ }
1034
+
1035
+ // ../packager/packager-tool-datafabric/src/pack/entity-project-tool.ts
1036
+ class EntityProjectTool extends ProjectTool {
1037
+ async validateAsync(options, _cancellationToken) {
1038
+ return this.checkProjectAsync(options.projectPath);
1039
+ }
1040
+ async packAsync(options, _cancellationToken) {
1041
+ const result = await this.checkProjectAsync(options.projectPath);
1042
+ if (result.isSuccess) {
1043
+ this.logger.info("Entity project is valid — no package emitted; the entity resources are the deployable payload.");
1044
+ }
1045
+ return result;
1046
+ }
1047
+ async checkProjectAsync(projectPath) {
1048
+ const fs = this.fileSystem;
1049
+ const diagnostics = [];
1050
+ let entries = [];
1051
+ try {
1052
+ entries = await fs.readdir(projectPath);
1053
+ } catch {
1054
+ return new ToolResult(ENTITY_VALIDATION_FAILED, `Entity project directory '${projectPath}' could not be read.`, [], "Check that the project path in the solution manifest points at an existing directory.");
1055
+ }
1056
+ const stubs = sorted(entries.filter((name) => name.endsWith(ENTITY_EXTENSION_CONST)));
1057
+ for (const foreign of sorted(entries.filter((name) => name.endsWith(".flow")))) {
1058
+ diagnostics.push({
1059
+ file: fs.path.join(projectPath, foreign),
1060
+ code: PACK_DIAGNOSTIC_CODES.misplacedMainFile,
1061
+ message: `'${foreign}' is a Flow main file inside an Entity project — move it to a Flow project.`
1062
+ });
1063
+ }
1064
+ const [rootError, solutionDir] = await catchError(findSolutionRoot(projectPath, fs));
1065
+ if (rootError) {
1066
+ if (stubs.length > 0) {
1067
+ diagnostics.push({
1068
+ file: projectPath,
1069
+ code: PACK_DIAGNOSTIC_CODES.solutionRootUnreadable,
1070
+ message: rootError.message
1071
+ });
1072
+ }
1073
+ } else if (solutionDir === undefined) {
1074
+ if (stubs.length > 0) {
1075
+ diagnostics.push({
1076
+ file: projectPath,
1077
+ code: PACK_DIAGNOSTIC_CODES.noParentSolution,
1078
+ message: "Entity project has no parent solution (.uipx not found) — the stubs' solution-relative resource pointers cannot resolve."
1079
+ });
1080
+ }
1081
+ } else {
1082
+ diagnostics.push(...await this.checkStubsAsync(projectPath, solutionDir, stubs));
1083
+ }
1084
+ if (diagnostics.length === 0) {
1085
+ return ToolResult.success();
1086
+ }
1087
+ const result = new ToolResult(ENTITY_VALIDATION_FAILED, `Entity validation failed with ${diagnostics.length} issue(s). First: ${diagnostics[0]?.message}`, [], "Fix the listed entities (open them in the entity editor, or restore missing resources) and pack again.");
1088
+ result.details = { diagnostics };
1089
+ return result;
1090
+ }
1091
+ async checkStubsAsync(projectPath, solutionDir, stubs) {
1092
+ const fs = this.fileSystem;
1093
+ const diagnostics = [];
1094
+ const allEntityNames = await collectSolutionEntityNames(solutionDir, fs);
1095
+ for (const stubName of stubs) {
1096
+ const stubFile = fs.path.join(projectPath, stubName);
1097
+ const pair = await verifyPair(stubFile, solutionDir, fs);
1098
+ if (!pair.ok) {
1099
+ diagnostics.push({
1100
+ file: stubFile,
1101
+ code: pair.failure.code,
1102
+ message: pair.failure.message
1103
+ });
1104
+ continue;
1105
+ }
1106
+ for (const diagnostic of validateEntity(pair.entity, {
1107
+ siblingNames: withoutOneOccurrence(allEntityNames, pair.entityName)
1108
+ })) {
1109
+ diagnostics.push({
1110
+ file: pair.resourceFile,
1111
+ code: diagnostic.code,
1112
+ message: diagnostic.message,
1113
+ fieldName: diagnostic.fieldName
1114
+ });
1115
+ }
1116
+ }
1117
+ return diagnostics;
1118
+ }
1119
+ }
1120
+ function sorted(names) {
1121
+ return [...names].sort(compareCodeUnits);
1122
+ }
1123
+ function compareCodeUnits(left, right) {
1124
+ if (left < right) {
1125
+ return -1;
1126
+ }
1127
+ return left > right ? 1 : 0;
1128
+ }
1129
+ // ../packager/packager-tool-datafabric/src/pack/entity-tool-factory.ts
1130
+ class EntityToolFactory {
1131
+ supportedTypes = ["Entity"];
1132
+ async createAsync(logger, fileSystem) {
1133
+ return new EntityProjectTool(fileSystem, logger);
1134
+ }
1135
+ }
1136
+ // ../packager/packager-tool-datafabric/src/resource/local-entities.ts
1137
+ async function readSolutionInlineEntities(fs, flowFilePath) {
1138
+ const found = new Map;
1139
+ const solutionDir = await findSolutionRoot(fs.path.dirname(fs.path.resolve(flowFilePath)), fs);
1140
+ if (solutionDir === undefined) {
1141
+ return found;
1142
+ }
1143
+ const dir = fs.path.join(solutionDir, "resources", SOLUTION_FOLDER, ...ENTITY_RESOURCE_DIR.split("/"));
1144
+ let files = [];
1145
+ try {
1146
+ files = await fs.readdir(dir);
1147
+ } catch {
1148
+ return found;
1149
+ }
1150
+ for (const file of files) {
1151
+ if (!file.endsWith(".json")) {
1152
+ continue;
1153
+ }
1154
+ try {
1155
+ const raw = await fs.readFile(fs.path.join(dir, file), "utf-8");
1156
+ if (raw === null) {
1157
+ continue;
1158
+ }
1159
+ const parsed = JSON.parse(raw);
1160
+ const entity = unwrapResource(parsed);
1161
+ if (!isLocallyAuthored(entity)) {
1162
+ continue;
1163
+ }
1164
+ const resourceKey = typeof parsed.resource?.key === "string" && parsed.resource.key !== "" ? parsed.resource.key : entity.Id;
1165
+ found.set(entity.Name.toLowerCase(), {
1166
+ name: entity.Name,
1167
+ resourceKey,
1168
+ folderId: entity.FolderId
1169
+ });
1170
+ } catch {}
1171
+ }
1172
+ return found;
1173
+ }
1174
+ export { ENTITY_VALIDATION_FAILED, AUTHORABLE_FIELD_TYPES, AuthoredFieldError, authorField, UNASSIGNED_FOLDER_ID, isLocallyAuthored, SYSTEM_FIELD_TEMPLATES, createEntitySkeleton, DIAGNOSTIC_CODES, validateEntity, ENTITY_RESOURCE_KIND, ENTITY_RESOURCE_TYPE, ENTITY_RESOURCE_API_VERSION, ENTITY_RESOURCE_DOC_VERSION, SOLUTION_FOLDER, ENTITY_RESOURCE_DIR, entityResourcePath, serialize, serializeEntityJson, EntityResourceError, wrapEntityJson, unwrapResource, updateResourceSchema, verifyPair, findSolutionRoot, EntityProjectTool, EntityToolFactory, readSolutionInlineEntities };
1175
+
1176
+ //# debugId=6D66F13B2955B04964756E2164756E21