New:Socket for Asana Is Now Available.Learn more
Get Started

@uipath/case-tool

Package Overview
Dependencies
Maintainers
24
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uipath/case-tool - npm Package Compare versions

Comparing version
1.201.0-preview.125
to
1.201.0-preview.127
+119
dist/case-pack-service-5pcxvy1j.js
import {
NugetPackager,
ensureProjectId
} from "./packager-tool-wvqz81mx.js";
import {
VALID_PACKAGE_NAME_REGEX,
loadCaseSchemaAsync
} from "./packager-tool-gmjhxwzy.js";
import"./packager-tool-we1phz71.js";
import"./packager-tool-zqa5k9f7.js";
import {
catchError,
logger,
mapPackageMetadataOptions
} from "./packager-tool-zx48pq4v.js";
import"./packager-tool-cqrsre00.js";
import"./packager-tool-sc961w0q.js";
import"./packager-tool-1yy9x4vk.js";
import"./packager-tool-c23zrhj8.js";
import"./packager-tool-b098y4a2.js";
import"./packager-tool-9qecd4wb.js";
import"./packager-tool-qa9gftnj.js";
import {
getFileSystem
} from "./packager-tool-1cb0d5e0.js";
import"./packager-tool-5arsyj36.js";
import"./packager-tool-wckvcay0.js";
// src/services/case-pack-service.ts
class CasePackService {
fs;
constructor() {
this.fs = getFileSystem();
}
async execute(projectPath, options) {
const absoluteProjectPath = this.fs.path.resolve(projectPath);
const absoluteOutputPath = this.fs.path.resolve(options.output);
const packageName = options.name || this.fs.path.basename(projectPath);
if (!VALID_PACKAGE_NAME_REGEX.test(packageName)) {
throw new Error(`Invalid package name "${packageName}". Package name can only contain letters, numbers, dots (.), underscores (_), and hyphens (-).`);
}
logger.info(`
Packing Case project...
`);
logger.info("Details:");
logger.info(` Project: ${absoluteProjectPath}`);
logger.info(` Package: ${packageName}@${options.version}`);
logger.info(` Output: ${absoluteOutputPath}`);
logger.info("");
await this.validate(absoluteProjectPath);
await this.convertCaseToBpmnIfNeeded(absoluteProjectPath);
await ensureProjectId(absoluteProjectPath, this.fs);
await this.fs.mkdir(absoluteOutputPath);
let tempDir;
try {
tempDir = await this.fs.getTempDir();
const stagingDir = this.fs.path.join(tempDir, "case-pack-staging");
await this.fs.mkdir(stagingDir);
await this.fs.copyDirectory(absoluteProjectPath, this.fs.path.join(stagingDir, "content"));
const packageId = `${packageName}.case.Case`;
const version = options.version || "1.0.0";
const nupkgPath = this.fs.path.join(absoluteOutputPath, `${packageId}.${version}.nupkg`);
const packager = new NugetPackager(this.fs);
const result = await packager.packAsync(stagingDir, {
id: packageId,
version,
tags: "Case",
...mapPackageMetadataOptions(options)
}, nupkgPath);
return {
packageName: `${packageName}@${options.version}`,
outputPath: result.outputPath
};
} finally {
if (tempDir) {
await catchError((async () => {
if (await this.fs.exists(tempDir)) {
await this.fs.rm(tempDir);
}
})());
}
}
}
async convertCaseToBpmnIfNeeded(projectPath) {
const caseFilePath = this.fs.path.join(projectPath, "caseplan.json");
if (!await this.fs.exists(caseFilePath)) {
return;
}
logger.info("Converting case JSON to BPMN...");
const caseContent = String(await this.fs.readFile(caseFilePath, "utf-8"));
const { serializeCaseDiskJsonToBpmnAndRulesJson } = await loadCaseSchemaAsync();
const { bpmnXml: bpmn } = await serializeCaseDiskJsonToBpmnAndRulesJson(caseContent);
const bpmnFilePath = this.fs.path.join(projectPath, "caseplan.json.bpmn");
await this.fs.writeFile(bpmnFilePath, bpmn);
logger.info(`BPMN file written to ${bpmnFilePath}`);
}
async validate(projectPath) {
if (!await this.fs.exists(projectPath)) {
throw new Error(`Project path does not exist: ${projectPath}`);
}
const stats = await this.fs.stat(projectPath);
if (!stats?.isDirectory()) {
throw new Error(`Project path must be a directory: ${projectPath}`);
}
const descriptorPath = this.fs.path.join(projectPath, "package-descriptor.json");
if (!await this.fs.exists(descriptorPath)) {
throw new Error(`Missing package-descriptor.json in: ${projectPath}`);
}
const operatePath = this.fs.path.join(projectPath, "operate.json");
if (!await this.fs.exists(operatePath)) {
throw new Error(`Missing operate.json in: ${projectPath}`);
}
}
}
export {
CasePackService
};
//# debugId=3F3DF77D1086226264756E2164756E21

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

+2
-2

@@ -5,4 +5,4 @@ #!/usr/bin/env node

registerCommands
} from "./packager-tool-29b2v928.js";
import"./packager-tool-qvctzpgj.js";
} from "./packager-tool-snx42ckx.js";
import"./packager-tool-gmjhxwzy.js";
import"./packager-tool-we1phz71.js";

@@ -9,0 +9,0 @@ import"./packager-tool-w3h8xrnv.js";

import {
metadata,
registerCommands
} from "./packager-tool-29b2v928.js";
import"./packager-tool-qvctzpgj.js";
} from "./packager-tool-snx42ckx.js";
import"./packager-tool-gmjhxwzy.js";
import"./packager-tool-we1phz71.js";

@@ -7,0 +7,0 @@ import"./packager-tool-w3h8xrnv.js";

{
"name": "@uipath/case-tool",
"license": "MIT",
"version": "1.201.0-preview.125",
"version": "1.201.0-preview.127",
"description": "Manage Case Management instances, processes, and incidents.",

@@ -30,3 +30,3 @@ "private": false,

],
"gitHead": "3429b3f8c5a137ace2fa1d6d4916a7168cc632fa"
"gitHead": "a6c7f4f0ea04813ce939f31efc41bd9990d46e20"
}
import {
NugetPackager,
ensureProjectId
} from "./packager-tool-wvqz81mx.js";
import {
VALID_PACKAGE_NAME_REGEX,
loadCaseSchemaAsync
} from "./packager-tool-qvctzpgj.js";
import"./packager-tool-we1phz71.js";
import"./packager-tool-zqa5k9f7.js";
import {
catchError,
logger,
mapPackageMetadataOptions
} from "./packager-tool-zx48pq4v.js";
import"./packager-tool-cqrsre00.js";
import"./packager-tool-sc961w0q.js";
import"./packager-tool-1yy9x4vk.js";
import"./packager-tool-c23zrhj8.js";
import"./packager-tool-b098y4a2.js";
import"./packager-tool-9qecd4wb.js";
import"./packager-tool-qa9gftnj.js";
import {
getFileSystem
} from "./packager-tool-1cb0d5e0.js";
import"./packager-tool-5arsyj36.js";
import"./packager-tool-wckvcay0.js";
// src/services/case-pack-service.ts
class CasePackService {
fs;
constructor() {
this.fs = getFileSystem();
}
async execute(projectPath, options) {
const absoluteProjectPath = this.fs.path.resolve(projectPath);
const absoluteOutputPath = this.fs.path.resolve(options.output);
const packageName = options.name || this.fs.path.basename(projectPath);
if (!VALID_PACKAGE_NAME_REGEX.test(packageName)) {
throw new Error(`Invalid package name "${packageName}". Package name can only contain letters, numbers, dots (.), underscores (_), and hyphens (-).`);
}
logger.info(`
Packing Case project...
`);
logger.info("Details:");
logger.info(` Project: ${absoluteProjectPath}`);
logger.info(` Package: ${packageName}@${options.version}`);
logger.info(` Output: ${absoluteOutputPath}`);
logger.info("");
await this.validate(absoluteProjectPath);
await this.convertCaseToBpmnIfNeeded(absoluteProjectPath);
await ensureProjectId(absoluteProjectPath, this.fs);
await this.fs.mkdir(absoluteOutputPath);
let tempDir;
try {
tempDir = await this.fs.getTempDir();
const stagingDir = this.fs.path.join(tempDir, "case-pack-staging");
await this.fs.mkdir(stagingDir);
await this.fs.copyDirectory(absoluteProjectPath, this.fs.path.join(stagingDir, "content"));
const packageId = `${packageName}.case.Case`;
const version = options.version || "1.0.0";
const nupkgPath = this.fs.path.join(absoluteOutputPath, `${packageId}.${version}.nupkg`);
const packager = new NugetPackager(this.fs);
const result = await packager.packAsync(stagingDir, {
id: packageId,
version,
tags: "Case",
...mapPackageMetadataOptions(options)
}, nupkgPath);
return {
packageName: `${packageName}@${options.version}`,
outputPath: result.outputPath
};
} finally {
if (tempDir) {
await catchError((async () => {
if (await this.fs.exists(tempDir)) {
await this.fs.rm(tempDir);
}
})());
}
}
}
async convertCaseToBpmnIfNeeded(projectPath) {
const caseFilePath = this.fs.path.join(projectPath, "caseplan.json");
if (!await this.fs.exists(caseFilePath)) {
return;
}
logger.info("Converting case JSON to BPMN...");
const caseContent = String(await this.fs.readFile(caseFilePath, "utf-8"));
const { serializeCaseDiskJsonToBpmnAndRulesJson } = await loadCaseSchemaAsync();
const { bpmnXml: bpmn } = await serializeCaseDiskJsonToBpmnAndRulesJson(caseContent);
const bpmnFilePath = this.fs.path.join(projectPath, "caseplan.json.bpmn");
await this.fs.writeFile(bpmnFilePath, bpmn);
logger.info(`BPMN file written to ${bpmnFilePath}`);
}
async validate(projectPath) {
if (!await this.fs.exists(projectPath)) {
throw new Error(`Project path does not exist: ${projectPath}`);
}
const stats = await this.fs.stat(projectPath);
if (!stats?.isDirectory()) {
throw new Error(`Project path must be a directory: ${projectPath}`);
}
const descriptorPath = this.fs.path.join(projectPath, "package-descriptor.json");
if (!await this.fs.exists(descriptorPath)) {
throw new Error(`Missing package-descriptor.json in: ${projectPath}`);
}
const operatePath = this.fs.path.join(projectPath, "operate.json");
if (!await this.fs.exists(operatePath)) {
throw new Error(`Missing operate.json in: ${projectPath}`);
}
}
}
export {
CasePackService
};
//# debugId=3F3DF77D1086226264756E2164756E21

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display