@uipath/rules-tool 1.204.0-preview.249 → 1.204.0-preview.250
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/DmnFactory-VWZOSZHH-jkpbxz3n.js +42 -0
- package/dist/DmnModelTypes-ATR7FVKZ-jp35cecy.js +18 -0
- package/dist/KieDmnMarshaller-6TTUU5B4-47q50gk4.js +20 -0
- package/dist/THIRD-PARTY-NOTICES.md +1054 -0
- package/dist/business-rules-bnr581tz.js +26 -0
- package/dist/{constants-za5vbzp8.js → constants-9pa118cj.js} +17 -10
- package/dist/{embedded-file-reader-wmsg31a8.js → embedded-file-reader-rf2g1kfj.js} +4 -1
- package/dist/first-party-service-sd8yaf73.js +27 -0
- package/dist/hitPolicyResult-4WDHTX4A-gk103w84.js +33 -0
- package/dist/index-2hzp9b97.js +116 -0
- package/dist/index-34pj9f36.js +48 -0
- package/dist/{index-zdwhfpt1.js → index-4c4exdzw.js} +370 -406
- package/dist/index-dqa169gp.js +25 -0
- package/dist/{index-we6zjs66.js → index-fs1nd5ap.js} +40 -4
- package/dist/{index-nzr4mx5p.js → index-sby22td6.js} +22 -2
- package/dist/{index-7wc0g78k.js → index-t4mx1a5e.js} +5 -2
- package/dist/index.js +9 -8
- package/dist/{jmespath-ab6tdc42.js → jmespath-231m3hyn.js} +1 -1
- package/dist/{js-yaml-a2bk27p6.js → js-yaml-88tdqrtd.js} +3 -1
- package/dist/rule-catalog-5gzpe93c.js +46 -0
- package/dist/rules-command-error-20gp2dv9.js +14 -0
- package/dist/{rules-debug-service-h1ahd6p3.js → rules-debug-service-cmgmbhyh.js} +36 -35
- package/dist/{rules-init-service-y678kjje.js → rules-init-service-b74thek5.js} +16 -12
- package/dist/{rules-refresh-service-btn64j8j.js → rules-refresh-service-jgk2kq9d.js} +14 -13
- package/dist/{rules-validate-service-sppr4x13.js → rules-validate-service-mr2fk58k.js} +13 -10
- package/dist/{tool-97x3zjcm.js → tool-19b4ect0.js} +158 -113
- package/dist/{tool-epsr41wx.js → tool-1de529jm.js} +3 -12
- package/dist/{tool-7xmarr97.js → tool-2cky8jwp.js} +2578 -1777
- package/dist/{tool-0bthsb3x.js → tool-4dfpdepw.js} +15 -15
- package/dist/tool-53w8skv5.js +262 -0
- package/dist/tool-7haj67tr.js +19 -0
- package/dist/{tool-e1mmqsjr.js → tool-8h4er38s.js} +411 -396
- package/dist/{tool-2trg1fpx.js → tool-8qy8pkp4.js} +8 -8
- package/dist/tool-av4mmsef.js +73 -0
- package/dist/{tool-8j9f6ns5.js → tool-eymjx05p.js} +11 -11
- package/dist/{tool-mm1x18d6.js → tool-gdtpsdn7.js} +28 -223
- package/dist/{tool-6sqt4zrx.js → tool-jxvk6306.js} +32 -29
- package/dist/tool-m41px07w.js +49 -0
- package/dist/{tool-k2s349kn.js → tool-mkn83w88.js} +17 -14
- package/dist/tool-pm3ewdxc.js +1115 -0
- package/dist/{tool-6rp0gx98.js → tool-tkcx6png.js} +107 -127
- package/dist/{tool-1dycs173.js → tool-wmh645tm.js} +202 -194
- package/dist/{tool-24mr6g8c.js → tool-x0z7hxqr.js} +9 -649
- package/dist/tool.js +8 -7
- package/package.json +2 -15
- package/dist/DmnFactory-SG3RP3T3-cr8e7mxz.js +0 -8
- package/dist/DmnFactory-VWZOSZHH-azx0zqcn.js +0 -8
- package/dist/DmnModelTypes-ATR7FVKZ-vkv7n0jn.js +0 -8
- package/dist/KieDmnMarshaller-6TTUU5B4-rsxhvw7a.js +0 -8
- package/dist/business-rules-d51977r1.js +0 -25
- package/dist/business-rules-dekge24t.js +0 -23
- package/dist/business-rules-ew76mbwg.js +0 -25
- package/dist/business-rules-jmwx05k2.js +0 -25
- package/dist/business-rules-zpzqxyce.js +0 -26
- package/dist/constants-4r8pfr16.js +0 -22
- package/dist/embedded-file-reader-0228j82a.js +0 -111
- package/dist/first-party-service-1qa6cp4d.js +0 -8
- package/dist/first-party-service-28dkctkz.js +0 -8
- package/dist/first-party-service-4fsz3cnj.js +0 -8
- package/dist/first-party-service-ahcc6xc6.js +0 -8
- package/dist/first-party-service-y1ccmsvp.js +0 -8
- package/dist/first-party-service-zpr1q3nd.js +0 -8
- package/dist/hitPolicyResult-4WDHTX4A-dbtkgpqp.js +0 -12
- package/dist/index-2zxy6zgp.js +0 -23
- package/dist/index-3nx77wfh.js +0 -23
- package/dist/index-43zg1wqe.js +0 -19621
- package/dist/index-47jera73.js +0 -23
- package/dist/index-70jn7cz1.js +0 -19631
- package/dist/index-8kb5kc5y.js +0 -24
- package/dist/index-97yad7ms.js +0 -8
- package/dist/index-dfn83hxf.js +0 -14
- package/dist/index-e301h23h.js +0 -24
- package/dist/index-frd259yv.js +0 -24
- package/dist/index-gc7cw2jh.js +0 -23
- package/dist/index-gya2v502.js +0 -8
- package/dist/index-hb3gk1wf.js +0 -24
- package/dist/index-nsnfdqd5.js +0 -24
- package/dist/index-vffktc0w.js +0 -166
- package/dist/index-xymrydfw.js +0 -3095
- package/dist/index-z2qk2qn6.js +0 -24
- package/dist/index-zecwgvg7.js +0 -23
- package/dist/rule-catalog-a5w86qns.js +0 -43
- package/dist/rule-catalog-etpf962f.js +0 -69
- package/dist/rule-catalog-q5cr17hf.js +0 -58
- package/dist/rule-catalog-vc98yg4n.js +0 -43
- package/dist/rule-catalog-z3h66kh5.js +0 -56
- package/dist/rules-command-error-10qmb5w7.js +0 -13
- package/dist/rules-command-error-5bdv4bcx.js +0 -13
- package/dist/rules-command-error-cmssf0w4.js +0 -13
- package/dist/rules-command-error-fsm3b1mv.js +0 -13
- package/dist/rules-debug-service-5rcdh3pj.js +0 -192
- package/dist/rules-debug-service-8q7mkd0r.js +0 -199
- package/dist/rules-debug-service-b9j29ejz.js +0 -192
- package/dist/rules-debug-service-v3jr3r1n.js +0 -192
- package/dist/rules-init-service-3c2yfa7p.js +0 -687
- package/dist/rules-init-service-3wgd9cqp.js +0 -100
- package/dist/rules-init-service-8fqytxq0.js +0 -685
- package/dist/rules-init-service-pspt7sje.js +0 -100
- package/dist/rules-init-service-sbtzw93j.js +0 -102
- package/dist/rules-init-service-x7paqa63.js +0 -687
- package/dist/rules-init-service-y7qzmxx0.js +0 -102
- package/dist/rules-refresh-service-4xxj6ex6.js +0 -65
- package/dist/rules-refresh-service-ba5jk1y9.js +0 -65
- package/dist/rules-refresh-service-qkmphj53.js +0 -65
- package/dist/rules-validate-service-dmgnfne7.js +0 -60
- package/dist/rules-validate-service-hk2d006t.js +0 -60
- package/dist/rules-validate-service-xp05n2d9.js +0 -60
- package/dist/tool-1pkqxwwd.js +0 -17472
- package/dist/tool-39fmkx2d.js +0 -611
- package/dist/tool-3e2q1x2y.js +0 -6578
- package/dist/tool-3j0747gg.js +0 -17077
- package/dist/tool-4z7zcq4z.js +0 -6058
- package/dist/tool-56smnjrh.js +0 -73
- package/dist/tool-5qygptrc.js +0 -6171
- package/dist/tool-5xx6x8pe.js +0 -6596
- package/dist/tool-7fkrd618.js +0 -1556
- package/dist/tool-89xzeteg.js +0 -361
- package/dist/tool-911s9czz.js +0 -570
- package/dist/tool-9bz2x04j.js +0 -40
- package/dist/tool-akh7nnqs.js +0 -704
- package/dist/tool-axfzew45.js +0 -1555
- package/dist/tool-b71jq9pt.js +0 -389
- package/dist/tool-bfj846v8.js +0 -141
- package/dist/tool-bvmc017m.js +0 -96
- package/dist/tool-bykz5ryf.js +0 -454
- package/dist/tool-c76qb8ap.js +0 -17052
- package/dist/tool-ca15515v.js +0 -570
- package/dist/tool-f9qs255w.js +0 -70
- package/dist/tool-ga79rety.js +0 -389
- package/dist/tool-gb547mcn.js +0 -141
- package/dist/tool-gta9rr4h.js +0 -68
- package/dist/tool-h2dfnxdq.js +0 -6486
- package/dist/tool-hg6vr5y9.js +0 -3769
- package/dist/tool-hgvnm4vh.js +0 -1843
- package/dist/tool-hjbf9aay.js +0 -571
- package/dist/tool-k5jm64n3.js +0 -5650
- package/dist/tool-ketztpgf.js +0 -73
- package/dist/tool-n1d88ryb.js +0 -6396
- package/dist/tool-nmqpwh9m.js +0 -6166
- package/dist/tool-pb80pswx.js +0 -73
- package/dist/tool-pcsgwpfw.js +0 -40
- package/dist/tool-q3c1bjyb.js +0 -454
- package/dist/tool-rwp1skmf.js +0 -40
- package/dist/tool-s3fbt22r.js +0 -454
- package/dist/tool-tmbst1r8.js +0 -68
- package/dist/tool-v6w109p0.js +0 -455
- package/dist/tool-w2js05qv.js +0 -389
- package/dist/tool-x67kek1m.js +0 -1838
- package/dist/tool-x89947ah.js +0 -17052
- package/dist/tool-xhksjdka.js +0 -4005
- package/dist/tool-yv3t4gg5.js +0 -108
- package/dist/tool-zbyb1ttx.js +0 -5650
- /package/dist/{tool-fbqnqf9k.js → tool-jd313s2x.js} +0 -0
- /package/dist/{tool-vyx8fpft.js → tool-qgqscsjc.js} +0 -0
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getFileSystem,
|
|
3
|
-
catchError
|
|
4
|
-
} from "./tool-3e2q1x2y.js";
|
|
5
|
-
import"./tool-x67kek1m.js";
|
|
6
|
-
import"./tool-pcsgwpfw.js";
|
|
7
|
-
import {
|
|
8
|
-
prepareProjectLocation,
|
|
9
|
-
tryRegisterProjectInParentSolution
|
|
10
|
-
} from "./tool-bykz5ryf.js";
|
|
11
|
-
import {
|
|
12
|
-
ENTRY_POINTS_FILE,
|
|
13
|
-
BINDINGS_FILE,
|
|
14
|
-
buildRuleEntryPointsAsync
|
|
15
|
-
} from "./tool-tmbst1r8.js";
|
|
16
|
-
|
|
17
|
-
// src/services/project-artifacts.ts
|
|
18
|
-
async function ensureProjectArtifacts(args) {
|
|
19
|
-
const { addProjectArtifactsToSolutionAsync } = await import("./index-47jera73.js");
|
|
20
|
-
return addProjectArtifactsToSolutionAsync(args);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// src/services/rules-init-service.ts
|
|
24
|
-
var VALID_PROJECT_NAME_REGEX = /^[a-zA-Z0-9_-]+$/;
|
|
25
|
-
var SEEDED_DMN_FILE = "Business rule.dmn";
|
|
26
|
-
var formatJson = (value) => `${JSON.stringify(value, null, 2)}
|
|
27
|
-
`;
|
|
28
|
-
async function createSeededRuleFilesAsync() {
|
|
29
|
-
const { createNewBusinessRuleDmn } = await import("./constants-za5vbzp8.js");
|
|
30
|
-
const dmn = createNewBusinessRuleDmn();
|
|
31
|
-
const packaging = await buildRuleEntryPointsAsync([
|
|
32
|
-
{ name: SEEDED_DMN_FILE, contents: dmn }
|
|
33
|
-
]);
|
|
34
|
-
return {
|
|
35
|
-
[SEEDED_DMN_FILE]: dmn,
|
|
36
|
-
[ENTRY_POINTS_FILE]: packaging.entryPointsContent,
|
|
37
|
-
[BINDINGS_FILE]: packaging.bindingContent
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
var safeMkdir = async (fs, dir) => {
|
|
41
|
-
const [err] = await catchError(fs.mkdir(dir));
|
|
42
|
-
if (err && !(("code" in err) && err.code === "EEXIST")) {
|
|
43
|
-
throw err;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
async function rulesInitAsync(name, options = {}) {
|
|
47
|
-
if (!VALID_PROJECT_NAME_REGEX.test(name)) {
|
|
48
|
-
throw new Error(`Invalid project name "${name}". Name can only contain letters, numbers, underscores (_), and hyphens (-).`);
|
|
49
|
-
}
|
|
50
|
-
const fs = getFileSystem();
|
|
51
|
-
const { projectDir, autoCreatedSolution } = await prepareProjectLocation(fs, fs.path.resolve(name), name, { skipRegistration: options.skipRegistration });
|
|
52
|
-
const [statError] = await catchError(fs.stat(projectDir));
|
|
53
|
-
const projectDirExists = !statError;
|
|
54
|
-
if (statError && !(("code" in statError) && (statError.code === "ENOENT" || statError.code === "PathNotFound"))) {
|
|
55
|
-
throw statError;
|
|
56
|
-
}
|
|
57
|
-
if (projectDirExists && !options.force) {
|
|
58
|
-
const existingEntries = await fs.readdir(projectDir);
|
|
59
|
-
if (existingEntries.length > 0) {
|
|
60
|
-
throw new Error(`Directory "${name}" already exists and is not empty. Use --force to overwrite.`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
await safeMkdir(fs, projectDir);
|
|
64
|
-
const ruleExists = (await fs.readdir(projectDir)).some((entry) => entry.toLowerCase().endsWith(".dmn"));
|
|
65
|
-
const projectFiles = {
|
|
66
|
-
"project.uiproj": formatJson({
|
|
67
|
-
Name: name,
|
|
68
|
-
ProjectType: "BusinessRules"
|
|
69
|
-
}),
|
|
70
|
-
...ruleExists ? {} : await createSeededRuleFilesAsync()
|
|
71
|
-
};
|
|
72
|
-
for (const [fileName, content] of Object.entries(projectFiles)) {
|
|
73
|
-
await fs.writeFile(fs.path.join(projectDir, fileName), content);
|
|
74
|
-
}
|
|
75
|
-
const registration = await tryRegisterProjectInParentSolution(fs, projectDir, { skipRegistration: options.skipRegistration });
|
|
76
|
-
const projectArtifacts = await maybeGenerateProjectArtifacts(registration, name);
|
|
77
|
-
return {
|
|
78
|
-
projectName: name,
|
|
79
|
-
projectDir,
|
|
80
|
-
registration,
|
|
81
|
-
autoCreatedSolution,
|
|
82
|
-
projectArtifacts,
|
|
83
|
-
ruleStatus: ruleExists ? "Preserved" : "Created"
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
async function maybeGenerateProjectArtifacts(registration, projectName) {
|
|
87
|
-
if (registration.Status !== "Registered" && registration.Status !== "AlreadyRegistered" || !registration.Solution || !registration.ProjectId) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const fs = getFileSystem();
|
|
91
|
-
return ensureProjectArtifacts({
|
|
92
|
-
solutionDir: fs.path.dirname(registration.Solution),
|
|
93
|
-
projectId: registration.ProjectId,
|
|
94
|
-
projectName,
|
|
95
|
-
projectType: "BusinessRules"
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
export {
|
|
99
|
-
rulesInitAsync
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
//# debugId=7FB550742BB433C564756E2164756E21
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getFileSystem,
|
|
3
|
-
catchError,
|
|
4
|
-
extractErrorMessageSync
|
|
5
|
-
} from "./tool-5qygptrc.js";
|
|
6
|
-
import {
|
|
7
|
-
RulesCommandError2
|
|
8
|
-
} from "./tool-9bz2x04j.js";
|
|
9
|
-
import {
|
|
10
|
-
ENTRY_POINTS_FILE,
|
|
11
|
-
BINDINGS_FILE,
|
|
12
|
-
readRuleProjectAsync,
|
|
13
|
-
buildRuleEntryPointsAsync
|
|
14
|
-
} from "./tool-gta9rr4h.js";
|
|
15
|
-
|
|
16
|
-
// src/services/rules-refresh-service.ts
|
|
17
|
-
async function refreshRuleProjectAsync(projectPath) {
|
|
18
|
-
const fs = getFileSystem();
|
|
19
|
-
const project = await readRuleProjectAsync(projectPath);
|
|
20
|
-
const packaging = await buildRuleEntryPointsAsync(project.dmnFiles, project.publishedEntryPoints);
|
|
21
|
-
if (packaging.unreadable.length > 0) {
|
|
22
|
-
const names = packaging.unreadable.map((rule) => rule.name).join(", ");
|
|
23
|
-
const reasons = packaging.unreadable.map((rule) => `${rule.name}: ${extractErrorMessageSync(rule.error)}`).join(" ");
|
|
24
|
-
throw new RulesCommandError2(`Could not read ${names}, so no package file was written. ${reasons}`, "invalid_argument", "Fix the .dmn file, or open the project in Studio Web to see what it rejects, then run 'uip rules refresh' again.");
|
|
25
|
-
}
|
|
26
|
-
const bindingsPath = fs.path.join(project.projectDir, BINDINGS_FILE);
|
|
27
|
-
const planned = [
|
|
28
|
-
{
|
|
29
|
-
name: ENTRY_POINTS_FILE,
|
|
30
|
-
content: packaging.entryPointsContent,
|
|
31
|
-
changed: packaging.entryPointsChanged
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: BINDINGS_FILE,
|
|
35
|
-
content: packaging.bindingContent,
|
|
36
|
-
changed: await fs.readFile(bindingsPath, "utf-8") !== packaging.bindingContent
|
|
37
|
-
}
|
|
38
|
-
];
|
|
39
|
-
await Promise.all(planned.filter((f) => f.changed).map((f) => writeFileAtomically(fs.path.join(project.projectDir, f.name), f.content)));
|
|
40
|
-
return {
|
|
41
|
-
projectDir: project.projectDir,
|
|
42
|
-
dmnFiles: project.dmnFiles.map((file) => file.name),
|
|
43
|
-
writtenFiles: planned.filter((f) => f.changed).map((f) => f.name),
|
|
44
|
-
unchangedFiles: planned.filter((f) => !f.changed).map((f) => f.name)
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
async function writeFileAtomically(path, content) {
|
|
48
|
-
const fs = getFileSystem();
|
|
49
|
-
const staging = `${path}.${crypto.randomUUID()}.tmp`;
|
|
50
|
-
const [error] = await catchError((async () => {
|
|
51
|
-
await fs.writeFile(staging, content);
|
|
52
|
-
await fs.rename(staging, path);
|
|
53
|
-
})());
|
|
54
|
-
if (error) {
|
|
55
|
-
await fs.rm(staging).catch(() => {
|
|
56
|
-
return;
|
|
57
|
-
});
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
refreshRuleProjectAsync
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
//# debugId=107272B94A5C074F64756E2164756E21
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getFileSystem,
|
|
3
|
-
catchError,
|
|
4
|
-
extractErrorMessageSync
|
|
5
|
-
} from "./tool-5xx6x8pe.js";
|
|
6
|
-
import {
|
|
7
|
-
RulesCommandError2
|
|
8
|
-
} from "./tool-2trg1fpx.js";
|
|
9
|
-
import {
|
|
10
|
-
ENTRY_POINTS_FILE,
|
|
11
|
-
BINDINGS_FILE,
|
|
12
|
-
readRuleProjectAsync,
|
|
13
|
-
buildRuleEntryPointsAsync
|
|
14
|
-
} from "./tool-yv3t4gg5.js";
|
|
15
|
-
|
|
16
|
-
// src/services/rules-refresh-service.ts
|
|
17
|
-
async function refreshRuleProjectAsync(projectPath) {
|
|
18
|
-
const fs = getFileSystem();
|
|
19
|
-
const project = await readRuleProjectAsync(projectPath);
|
|
20
|
-
const packaging = await buildRuleEntryPointsAsync(project.dmnFiles, project.publishedEntryPoints, project.ruleName);
|
|
21
|
-
if (packaging.unreadable.length > 0) {
|
|
22
|
-
const names = packaging.unreadable.map((rule) => rule.name).join(", ");
|
|
23
|
-
const reasons = packaging.unreadable.map((rule) => `${rule.name}: ${extractErrorMessageSync(rule.error)}`).join(" ");
|
|
24
|
-
throw new RulesCommandError2(`Could not read ${names}, so no package file was written. ${reasons}`, "invalid_argument", "Fix the .dmn file, or open the project in Studio Web to see what it rejects, then run 'uip rules refresh' again.");
|
|
25
|
-
}
|
|
26
|
-
const bindingsPath = fs.path.join(project.projectDir, BINDINGS_FILE);
|
|
27
|
-
const planned = [
|
|
28
|
-
{
|
|
29
|
-
name: ENTRY_POINTS_FILE,
|
|
30
|
-
content: packaging.entryPointsContent,
|
|
31
|
-
changed: packaging.entryPointsChanged
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: BINDINGS_FILE,
|
|
35
|
-
content: packaging.bindingContent,
|
|
36
|
-
changed: await fs.readFile(bindingsPath, "utf-8") !== packaging.bindingContent
|
|
37
|
-
}
|
|
38
|
-
];
|
|
39
|
-
await Promise.all(planned.filter((f) => f.changed).map((f) => writeFileAtomically(fs.path.join(project.projectDir, f.name), f.content)));
|
|
40
|
-
return {
|
|
41
|
-
projectDir: project.projectDir,
|
|
42
|
-
dmnFiles: project.dmnFiles.map((file) => file.name),
|
|
43
|
-
writtenFiles: planned.filter((f) => f.changed).map((f) => f.name),
|
|
44
|
-
unchangedFiles: planned.filter((f) => !f.changed).map((f) => f.name)
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
async function writeFileAtomically(path, content) {
|
|
48
|
-
const fs = getFileSystem();
|
|
49
|
-
const staging = `${path}.${crypto.randomUUID()}.tmp`;
|
|
50
|
-
const [error] = await catchError((async () => {
|
|
51
|
-
await fs.writeFile(staging, content);
|
|
52
|
-
await fs.rename(staging, path);
|
|
53
|
-
})());
|
|
54
|
-
if (error) {
|
|
55
|
-
await fs.rm(staging).catch(() => {
|
|
56
|
-
return;
|
|
57
|
-
});
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
refreshRuleProjectAsync
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
//# debugId=8C02B24DF8C203E864756E2164756E21
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getFileSystem,
|
|
3
|
-
catchError,
|
|
4
|
-
extractErrorMessageSync
|
|
5
|
-
} from "./tool-3e2q1x2y.js";
|
|
6
|
-
import {
|
|
7
|
-
RulesCommandError2
|
|
8
|
-
} from "./tool-pcsgwpfw.js";
|
|
9
|
-
import {
|
|
10
|
-
ENTRY_POINTS_FILE,
|
|
11
|
-
BINDINGS_FILE,
|
|
12
|
-
readRuleProjectAsync,
|
|
13
|
-
buildRuleEntryPointsAsync
|
|
14
|
-
} from "./tool-tmbst1r8.js";
|
|
15
|
-
|
|
16
|
-
// src/services/rules-refresh-service.ts
|
|
17
|
-
async function refreshRuleProjectAsync(projectPath) {
|
|
18
|
-
const fs = getFileSystem();
|
|
19
|
-
const project = await readRuleProjectAsync(projectPath);
|
|
20
|
-
const packaging = await buildRuleEntryPointsAsync(project.dmnFiles, project.publishedEntryPoints);
|
|
21
|
-
if (packaging.unreadable.length > 0) {
|
|
22
|
-
const names = packaging.unreadable.map((rule) => rule.name).join(", ");
|
|
23
|
-
const reasons = packaging.unreadable.map((rule) => `${rule.name}: ${extractErrorMessageSync(rule.error)}`).join(" ");
|
|
24
|
-
throw new RulesCommandError2(`Could not read ${names}, so no package file was written. ${reasons}`, "invalid_argument", "Fix the .dmn file, or open the project in Studio Web to see what it rejects, then run 'uip rules refresh' again.");
|
|
25
|
-
}
|
|
26
|
-
const bindingsPath = fs.path.join(project.projectDir, BINDINGS_FILE);
|
|
27
|
-
const planned = [
|
|
28
|
-
{
|
|
29
|
-
name: ENTRY_POINTS_FILE,
|
|
30
|
-
content: packaging.entryPointsContent,
|
|
31
|
-
changed: packaging.entryPointsChanged
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: BINDINGS_FILE,
|
|
35
|
-
content: packaging.bindingContent,
|
|
36
|
-
changed: await fs.readFile(bindingsPath, "utf-8") !== packaging.bindingContent
|
|
37
|
-
}
|
|
38
|
-
];
|
|
39
|
-
await Promise.all(planned.filter((f) => f.changed).map((f) => writeFileAtomically(fs.path.join(project.projectDir, f.name), f.content)));
|
|
40
|
-
return {
|
|
41
|
-
projectDir: project.projectDir,
|
|
42
|
-
dmnFiles: project.dmnFiles.map((file) => file.name),
|
|
43
|
-
writtenFiles: planned.filter((f) => f.changed).map((f) => f.name),
|
|
44
|
-
unchangedFiles: planned.filter((f) => !f.changed).map((f) => f.name)
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
async function writeFileAtomically(path, content) {
|
|
48
|
-
const fs = getFileSystem();
|
|
49
|
-
const staging = `${path}.${crypto.randomUUID()}.tmp`;
|
|
50
|
-
const [error] = await catchError((async () => {
|
|
51
|
-
await fs.writeFile(staging, content);
|
|
52
|
-
await fs.rename(staging, path);
|
|
53
|
-
})());
|
|
54
|
-
if (error) {
|
|
55
|
-
await fs.rm(staging).catch(() => {
|
|
56
|
-
return;
|
|
57
|
-
});
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
refreshRuleProjectAsync
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
//# debugId=107272B94A5C074F64756E2164756E21
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import"./tool-6rp0gx98.js";
|
|
2
|
-
import"./tool-rwp1skmf.js";
|
|
3
|
-
import {
|
|
4
|
-
ENTRY_POINTS_FILE,
|
|
5
|
-
readRuleProjectAsync,
|
|
6
|
-
buildRuleEntryPointsAsync
|
|
7
|
-
} from "./tool-k2s349kn.js";
|
|
8
|
-
|
|
9
|
-
// src/services/rules-validate-service.ts
|
|
10
|
-
async function validateRuleProjectAsync(projectPath) {
|
|
11
|
-
const project = await readRuleProjectAsync(projectPath);
|
|
12
|
-
const diagnostics = [];
|
|
13
|
-
for (const file of project.dmnFiles) {
|
|
14
|
-
diagnostics.push(...await validateDmnFileAsync(file));
|
|
15
|
-
}
|
|
16
|
-
const packaging = await buildRuleEntryPointsAsync(project.dmnFiles, project.publishedEntryPoints, project.ruleName);
|
|
17
|
-
if (packaging.unreadable.length === 0 && packaging.entryPointsChanged) {
|
|
18
|
-
diagnostics.push({
|
|
19
|
-
file: ENTRY_POINTS_FILE,
|
|
20
|
-
code: "RULES_ENTRY_POINTS_STALE",
|
|
21
|
-
severity: "error",
|
|
22
|
-
message: `${ENTRY_POINTS_FILE} does not match the rule's .dmn.`,
|
|
23
|
-
instructions: `Run 'uip rules refresh "${project.projectDir}"'; each published uniqueId is kept.`,
|
|
24
|
-
target: { kind: "document" }
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
projectDir: project.projectDir,
|
|
29
|
-
dmnFiles: project.dmnFiles.map((file) => file.name),
|
|
30
|
-
diagnostics
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
async function validateDmnFileAsync(file) {
|
|
34
|
-
const [
|
|
35
|
-
{ validateDmnDocument },
|
|
36
|
-
{ translateDmnDiagnostic },
|
|
37
|
-
{ importDmnDocument },
|
|
38
|
-
{ UnreadableDmnError }
|
|
39
|
-
] = await Promise.all([
|
|
40
|
-
import("./index-zdwhfpt1.js"),
|
|
41
|
-
import("./index-7wc0g78k.js"),
|
|
42
|
-
import("./index-gya2v502.js"),
|
|
43
|
-
import("./index-we6zjs66.js")
|
|
44
|
-
]);
|
|
45
|
-
const diagnostics = await validateDmnDocument(file.contents);
|
|
46
|
-
const imported = diagnostics.some((d) => d.code === "DMN_DOCUMENT_UNREADABLE") ? await importDmnDocument(file.contents) : undefined;
|
|
47
|
-
const reason = imported?.status === "error" ? new UnreadableDmnError(imported.reason).message : undefined;
|
|
48
|
-
return diagnostics.map((diagnostic) => ({
|
|
49
|
-
file: file.name,
|
|
50
|
-
code: diagnostic.code,
|
|
51
|
-
severity: diagnostic.severity,
|
|
52
|
-
message: diagnostic.code === "DMN_DOCUMENT_UNREADABLE" && reason ? `${translateDmnDiagnostic(diagnostic)}: ${reason}` : translateDmnDiagnostic(diagnostic),
|
|
53
|
-
target: diagnostic.target
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
export {
|
|
57
|
-
validateRuleProjectAsync
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
//# debugId=4E55FD726F10B69064756E2164756E21
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import"./tool-3e2q1x2y.js";
|
|
2
|
-
import"./tool-pcsgwpfw.js";
|
|
3
|
-
import {
|
|
4
|
-
ENTRY_POINTS_FILE,
|
|
5
|
-
readRuleProjectAsync,
|
|
6
|
-
buildRuleEntryPointsAsync
|
|
7
|
-
} from "./tool-tmbst1r8.js";
|
|
8
|
-
|
|
9
|
-
// src/services/rules-validate-service.ts
|
|
10
|
-
async function validateRuleProjectAsync(projectPath) {
|
|
11
|
-
const project = await readRuleProjectAsync(projectPath);
|
|
12
|
-
const diagnostics = [];
|
|
13
|
-
for (const file of project.dmnFiles) {
|
|
14
|
-
diagnostics.push(...await validateDmnFileAsync(file));
|
|
15
|
-
}
|
|
16
|
-
const packaging = await buildRuleEntryPointsAsync(project.dmnFiles, project.publishedEntryPoints);
|
|
17
|
-
if (packaging.unreadable.length === 0 && packaging.entryPointsChanged) {
|
|
18
|
-
diagnostics.push({
|
|
19
|
-
file: ENTRY_POINTS_FILE,
|
|
20
|
-
code: "RULES_ENTRY_POINTS_STALE",
|
|
21
|
-
severity: "error",
|
|
22
|
-
message: `${ENTRY_POINTS_FILE} does not match the rule's .dmn.`,
|
|
23
|
-
instructions: `Run 'uip rules refresh "${project.projectDir}"'; each published uniqueId is kept.`,
|
|
24
|
-
target: { kind: "document" }
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
projectDir: project.projectDir,
|
|
29
|
-
dmnFiles: project.dmnFiles.map((file) => file.name),
|
|
30
|
-
diagnostics
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
async function validateDmnFileAsync(file) {
|
|
34
|
-
const [
|
|
35
|
-
{ validateDmnDocument },
|
|
36
|
-
{ translateDmnDiagnostic },
|
|
37
|
-
{ importDmnDocument },
|
|
38
|
-
{ UnreadableDmnError }
|
|
39
|
-
] = await Promise.all([
|
|
40
|
-
import("./index-zdwhfpt1.js"),
|
|
41
|
-
import("./index-7wc0g78k.js"),
|
|
42
|
-
import("./index-gya2v502.js"),
|
|
43
|
-
import("./index-we6zjs66.js")
|
|
44
|
-
]);
|
|
45
|
-
const diagnostics = await validateDmnDocument(file.contents);
|
|
46
|
-
const imported = diagnostics.some((d) => d.code === "DMN_DOCUMENT_UNREADABLE") ? await importDmnDocument(file.contents) : undefined;
|
|
47
|
-
const reason = imported?.status === "error" ? new UnreadableDmnError(imported.reason).message : undefined;
|
|
48
|
-
return diagnostics.map((diagnostic) => ({
|
|
49
|
-
file: file.name,
|
|
50
|
-
code: diagnostic.code,
|
|
51
|
-
severity: diagnostic.severity,
|
|
52
|
-
message: diagnostic.code === "DMN_DOCUMENT_UNREADABLE" && reason ? `${translateDmnDiagnostic(diagnostic)}: ${reason}` : translateDmnDiagnostic(diagnostic),
|
|
53
|
-
target: diagnostic.target
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
export {
|
|
57
|
-
validateRuleProjectAsync
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
//# debugId=4B3685C31F5CEF0B64756E2164756E21
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import"./tool-5qygptrc.js";
|
|
2
|
-
import"./tool-9bz2x04j.js";
|
|
3
|
-
import {
|
|
4
|
-
ENTRY_POINTS_FILE,
|
|
5
|
-
readRuleProjectAsync,
|
|
6
|
-
buildRuleEntryPointsAsync
|
|
7
|
-
} from "./tool-gta9rr4h.js";
|
|
8
|
-
|
|
9
|
-
// src/services/rules-validate-service.ts
|
|
10
|
-
async function validateRuleProjectAsync(projectPath) {
|
|
11
|
-
const project = await readRuleProjectAsync(projectPath);
|
|
12
|
-
const diagnostics = [];
|
|
13
|
-
for (const file of project.dmnFiles) {
|
|
14
|
-
diagnostics.push(...await validateDmnFileAsync(file));
|
|
15
|
-
}
|
|
16
|
-
const packaging = await buildRuleEntryPointsAsync(project.dmnFiles, project.publishedEntryPoints);
|
|
17
|
-
if (packaging.unreadable.length === 0 && packaging.entryPointsChanged) {
|
|
18
|
-
diagnostics.push({
|
|
19
|
-
file: ENTRY_POINTS_FILE,
|
|
20
|
-
code: "RULES_ENTRY_POINTS_STALE",
|
|
21
|
-
severity: "error",
|
|
22
|
-
message: `${ENTRY_POINTS_FILE} does not match the rule's .dmn.`,
|
|
23
|
-
instructions: `Run 'uip rules refresh "${project.projectDir}"'; each published uniqueId is kept.`,
|
|
24
|
-
target: { kind: "document" }
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
projectDir: project.projectDir,
|
|
29
|
-
dmnFiles: project.dmnFiles.map((file) => file.name),
|
|
30
|
-
diagnostics
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
async function validateDmnFileAsync(file) {
|
|
34
|
-
const [
|
|
35
|
-
{ validateDmnDocument },
|
|
36
|
-
{ translateDmnDiagnostic },
|
|
37
|
-
{ importDmnDocument },
|
|
38
|
-
{ UnreadableDmnError }
|
|
39
|
-
] = await Promise.all([
|
|
40
|
-
import("./index-xymrydfw.js"),
|
|
41
|
-
import("./index-dfn83hxf.js"),
|
|
42
|
-
import("./index-97yad7ms.js"),
|
|
43
|
-
import("./index-vffktc0w.js")
|
|
44
|
-
]);
|
|
45
|
-
const diagnostics = await validateDmnDocument(file.contents);
|
|
46
|
-
const imported = diagnostics.some((d) => d.code === "DMN_DOCUMENT_UNREADABLE") ? await importDmnDocument(file.contents) : undefined;
|
|
47
|
-
const reason = imported?.status === "error" ? new UnreadableDmnError(imported.reason).message : undefined;
|
|
48
|
-
return diagnostics.map((diagnostic) => ({
|
|
49
|
-
file: file.name,
|
|
50
|
-
code: diagnostic.code,
|
|
51
|
-
severity: diagnostic.severity,
|
|
52
|
-
message: diagnostic.code === "DMN_DOCUMENT_UNREADABLE" && reason ? `${translateDmnDiagnostic(diagnostic)}: ${reason}` : translateDmnDiagnostic(diagnostic),
|
|
53
|
-
target: diagnostic.target
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
export {
|
|
57
|
-
validateRuleProjectAsync
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
//# debugId=4B3685C31F5CEF0B64756E2164756E21
|