@pipelab/plugin-core 1.0.0-beta.22 → 1.0.0-beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +42 -11
- package/dist/index.d.cts +13 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +13 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +40 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -39,9 +39,9 @@ let os = require("os");
|
|
|
39
39
|
let path = require("path");
|
|
40
40
|
let util = require("util");
|
|
41
41
|
let _pipelab_core_node = require("@pipelab/core-node");
|
|
42
|
-
let node_fs = require("node:fs");
|
|
43
|
-
let node_fs_promises = require("node:fs/promises");
|
|
44
42
|
let node_path = require("node:path");
|
|
43
|
+
let node_fs_promises = require("node:fs/promises");
|
|
44
|
+
let node_fs = require("node:fs");
|
|
45
45
|
let tar = require("tar");
|
|
46
46
|
tar = __toESM(tar);
|
|
47
47
|
let yauzl = require("yauzl");
|
|
@@ -64863,16 +64863,16 @@ const foo = "bar";
|
|
|
64863
64863
|
const transformUrl = (url) => {
|
|
64864
64864
|
if (url && typeof url === "string") {
|
|
64865
64865
|
const getHost = () => {
|
|
64866
|
-
if (typeof window !== "undefined") if (
|
|
64866
|
+
if (typeof window !== "undefined") if (process.env.NODE_ENV === "development") return `http://${window.location.hostname}:33753`;
|
|
64867
64867
|
else return `${window.location.protocol}//${window.location.host}`;
|
|
64868
64868
|
return "http://localhost:33753";
|
|
64869
64869
|
};
|
|
64870
64870
|
if (url.startsWith("file://")) {
|
|
64871
|
-
const filePath = url.substring(7);
|
|
64871
|
+
const filePath = decodeURIComponent(url.substring(7));
|
|
64872
64872
|
return `${getHost()}/media-file/${encodeURIComponent(filePath)}`;
|
|
64873
64873
|
}
|
|
64874
64874
|
if (url.startsWith("media://")) {
|
|
64875
|
-
const filePath = url.replace(/^media:\/\/+/, "/");
|
|
64875
|
+
const filePath = decodeURIComponent(url.replace(/^media:\/\/+/, "/"));
|
|
64876
64876
|
return `${getHost()}/media-file/${encodeURIComponent(filePath)}`;
|
|
64877
64877
|
}
|
|
64878
64878
|
}
|
|
@@ -64957,6 +64957,39 @@ const fileExists = async (path) => {
|
|
|
64957
64957
|
}
|
|
64958
64958
|
};
|
|
64959
64959
|
//#endregion
|
|
64960
|
+
//#region src/fs-utils.ts
|
|
64961
|
+
/**
|
|
64962
|
+
* Asserts that a directory is safe to be deleted/cleaned up.
|
|
64963
|
+
* Throws an error if the directory is protected or is not empty and lacks the Pipelab folder marker.
|
|
64964
|
+
*/
|
|
64965
|
+
async function assertSafeDirectoryCleanup(directoryPath) {
|
|
64966
|
+
if (!directoryPath) return;
|
|
64967
|
+
const resolvedPath = (0, node_path.resolve)(directoryPath);
|
|
64968
|
+
if ((0, _pipelab_core_node.isPathBlacklisted)(resolvedPath)) throw new Error(`Cannot cleanup/delete protected system or user directory: ${resolvedPath}`);
|
|
64969
|
+
try {
|
|
64970
|
+
if ((await (0, node_fs_promises.stat)(resolvedPath)).isDirectory()) {
|
|
64971
|
+
const files = await (0, node_fs_promises.readdir)(resolvedPath);
|
|
64972
|
+
if (files.length > 0) {
|
|
64973
|
+
if (!files.includes(".pipelab")) throw new Error(`Directory is not empty and was not created by Pipelab: ${resolvedPath}. Aborting to prevent data loss.`);
|
|
64974
|
+
}
|
|
64975
|
+
}
|
|
64976
|
+
} catch (e) {
|
|
64977
|
+
if (e.code !== "ENOENT") throw e;
|
|
64978
|
+
}
|
|
64979
|
+
}
|
|
64980
|
+
/**
|
|
64981
|
+
* Creates a hidden Pipelab marker directory with metadata.json at the specified destination path.
|
|
64982
|
+
*/
|
|
64983
|
+
async function writePipelabFolderMarker(directoryPath, generator = "unknown") {
|
|
64984
|
+
if (!directoryPath) return;
|
|
64985
|
+
const markerDir = (0, node_path.join)(directoryPath, ".pipelab");
|
|
64986
|
+
await (0, node_fs_promises.mkdir)(markerDir, { recursive: true });
|
|
64987
|
+
await (0, node_fs_promises.writeFile)((0, node_path.join)(markerDir, "metadata.json"), JSON.stringify({
|
|
64988
|
+
createdBy: generator,
|
|
64989
|
+
timestamp: Date.now()
|
|
64990
|
+
}, null, 2), "utf-8");
|
|
64991
|
+
}
|
|
64992
|
+
//#endregion
|
|
64960
64993
|
//#region src/archive-utils.ts
|
|
64961
64994
|
/**
|
|
64962
64995
|
* Extracts a .tar.gz archive.
|
|
@@ -65116,6 +65149,7 @@ exports.WebSocketError = WebSocketError;
|
|
|
65116
65149
|
exports.WebSocketTimeoutError = WebSocketTimeoutError;
|
|
65117
65150
|
exports.__toCommonJS = __toCommonJS;
|
|
65118
65151
|
exports.appSettingsMigrator = appSettingsMigrator;
|
|
65152
|
+
exports.assertSafeDirectoryCleanup = assertSafeDirectoryCleanup;
|
|
65119
65153
|
exports.configRegistry = configRegistry;
|
|
65120
65154
|
exports.connectionsMigrator = connectionsMigrator;
|
|
65121
65155
|
exports.createAction = createAction;
|
|
@@ -65162,12 +65196,7 @@ Object.defineProperty(exports, "en_US", {
|
|
|
65162
65196
|
return en_US_default;
|
|
65163
65197
|
}
|
|
65164
65198
|
});
|
|
65165
|
-
|
|
65166
|
-
enumerable: true,
|
|
65167
|
-
get: function() {
|
|
65168
|
-
return _pipelab_core_node.ensure;
|
|
65169
|
-
}
|
|
65170
|
-
});
|
|
65199
|
+
exports.ensure = _pipelab_core_node.ensure;
|
|
65171
65200
|
Object.defineProperty(exports, "es_ES", {
|
|
65172
65201
|
enumerable: true,
|
|
65173
65202
|
get: function() {
|
|
@@ -65211,6 +65240,7 @@ Object.defineProperty(exports, "fr_FR", {
|
|
|
65211
65240
|
}
|
|
65212
65241
|
});
|
|
65213
65242
|
exports.getSubscriptionErrorMessage = getSubscriptionErrorMessage;
|
|
65243
|
+
exports.isPathBlacklisted = _pipelab_core_node.isPathBlacklisted;
|
|
65214
65244
|
exports.isRenderer = isRenderer;
|
|
65215
65245
|
exports.isRequired = isRequired;
|
|
65216
65246
|
exports.isSubscriptionError = isSubscriptionError;
|
|
@@ -65253,6 +65283,7 @@ exports.transformUrl = transformUrl;
|
|
|
65253
65283
|
exports.useLogger = useLogger;
|
|
65254
65284
|
exports.usePlugins = usePlugins;
|
|
65255
65285
|
exports.variableToFormattedVariable = variableToFormattedVariable;
|
|
65286
|
+
exports.writePipelabFolderMarker = writePipelabFolderMarker;
|
|
65256
65287
|
Object.defineProperty(exports, "zh_CN", {
|
|
65257
65288
|
enumerable: true,
|
|
65258
65289
|
get: function() {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionRunner, ActionRunnerData, DownloadHooks as Hooks, EventRunner, ExpressionRunner, PipelabContext, Runner, RunnerCallbackFnArgument, downloadFile, ensure, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, runPnpm, runWithLiveLogs } from "@pipelab/core-node";
|
|
1
|
+
import { ActionRunner, ActionRunnerData, DownloadHooks as Hooks, EventRunner, ExpressionRunner, PipelabContext, Runner, RunnerCallbackFnArgument, downloadFile, ensure, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, isPathBlacklisted, runPnpm, runWithLiveLogs } from "@pipelab/core-node";
|
|
2
2
|
import { z as schema } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/pipelab.d.ts
|
|
@@ -47,6 +47,17 @@ declare const createPlugin: (plugin: Plugin) => Plugin;
|
|
|
47
47
|
//#region src/utils.d.ts
|
|
48
48
|
declare const fileExists: (path: string) => Promise<boolean>;
|
|
49
49
|
//#endregion
|
|
50
|
+
//#region src/fs-utils.d.ts
|
|
51
|
+
/**
|
|
52
|
+
* Asserts that a directory is safe to be deleted/cleaned up.
|
|
53
|
+
* Throws an error if the directory is protected or is not empty and lacks the Pipelab folder marker.
|
|
54
|
+
*/
|
|
55
|
+
declare function assertSafeDirectoryCleanup(directoryPath: string): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a hidden Pipelab marker directory with metadata.json at the specified destination path.
|
|
58
|
+
*/
|
|
59
|
+
declare function writePipelabFolderMarker(directoryPath: string, generator?: string): Promise<void>;
|
|
60
|
+
//#endregion
|
|
50
61
|
//#region src/archive-utils.d.ts
|
|
51
62
|
/**
|
|
52
63
|
* Extracts a .tar.gz archive.
|
|
@@ -81,5 +92,5 @@ declare const detectRuntime: (appFolder: string | undefined) => Promise<OutputRu
|
|
|
81
92
|
//#region src/index.d.ts
|
|
82
93
|
type NoData = { [index in string]?: unknown };
|
|
83
94
|
//#endregion
|
|
84
|
-
export { type ActionRunner, type ActionRunnerData, type EventRunner, type ExpressionRunner, ExternalCommandError, type Hooks, NoData, OutputRuntimes, PipelabContext, Plugin, type Runner, type RunnerCallbackFnArgument, createActionRunner, createEventRunner, createExpressionRunner, createPlugin, detectRuntime, downloadFile, ensure, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, fileExists, runPnpm, runWithLiveLogs, schema, sleep, zipFolder };
|
|
95
|
+
export { type ActionRunner, type ActionRunnerData, type EventRunner, type ExpressionRunner, ExternalCommandError, type Hooks, NoData, OutputRuntimes, PipelabContext, Plugin, type Runner, type RunnerCallbackFnArgument, assertSafeDirectoryCleanup, createActionRunner, createEventRunner, createExpressionRunner, createPlugin, detectRuntime, downloadFile, ensure, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, fileExists, isPathBlacklisted, runPnpm, runWithLiveLogs, schema, sleep, writePipelabFolderMarker, zipFolder };
|
|
85
96
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/pipelab.ts","../src/create-plugin.ts","../src/utils.ts","../src/archive-utils.ts","../src/custom-errors.ts","../src/node-utils.ts","../src/index.ts"],"mappings":";;;;cAiCa,kBAAA,kBAAqC,MAAA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;;;KC5D1B,MAAA;EACV,KAAA,EAAO,MAAA;EACP,OAAA,QAAe,OAAA;AAAA;AAAA,cAGJ,YAAA,GAAgB,MAAA,EAAQ,MAAA,KAAM,MAAA;;;cCY9B,UAAA,GAAoB,IAAA,aAAe,OAAA
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/pipelab.ts","../src/create-plugin.ts","../src/utils.ts","../src/fs-utils.ts","../src/archive-utils.ts","../src/custom-errors.ts","../src/node-utils.ts","../src/index.ts"],"mappings":";;;;cAiCa,kBAAA,kBAAqC,MAAA,EAChD,MAAA,GAAS,IAAA,EAAM,gBAAA,CAAiB,MAAA,MAAY,OAAA,YAAa,IAAA,EAA1C,gBAAA,CAAiB,MAAA,MAAY,OAAA;AAAA,cAGjC,sBAAA,sBAA6C,UAAA,EACxD,MAAA,GAAS,IAAA;EACP,GAAA,SAAY,OAAA,CAAQ,GAAA;EACpB,SAAA,EAAW,qBAAA,CAAsB,UAAA;EACjC,MAAA,EAAQ,2BAAA,CAA4B,UAAA;EACpC,OAAA,GAAU,QAAA,GAAW,IAAA,EAAM,UAAA,aAAuB,UAAA;EAClD,IAAA,EAAM,UAAA;EACN,GAAA;EACA,OAAA,EAAS,cAAA;AAAA,MACL,OAAA,cAAe,IAAA;EAPnB,GAAA,SAAY,OAAA,CAAQ,GAAA;EACpB,SAAA,EAAW,qBAAA,CAAsB,UAAA;EACjC,MAAA,EAAQ,2BAAA,CAA4B,UAAA;EACpC,OAAA,GAAU,QAAA,GAAW,IAAA,EAAM,UAAA,aAAuB,UAAA;EAClD,IAAA,EAAM,UAAA;EACN,GAAA;EACA,OAAA,EAAS,cAAA;AAAA,MACL,OAAA;AAAA,cAGK,iBAAA,iBAAmC,KAAA,EAC9C,MAAA,GAAS,IAAA;EACP,GAAA,SAAY,OAAA,CAAQ,GAAA;EACpB,MAAA,EAAQ,sBAAA,CAAuB,KAAA;EAC/B,OAAA,GAAU,QAAA,GAAW,IAAA,EAAM,KAAA,aAAkB,KAAA;EAC7C,IAAA,EAAM,KAAA;EACN,GAAA;EACA,OAAA,EAAS,cAAA;AAAA,MACL,OAAA,YAAa,IAAA;EANjB,GAAA,SAAY,OAAA,CAAQ,GAAA;EACpB,MAAA,EAAQ,sBAAA,CAAuB,KAAA;EAC/B,OAAA,GAAU,QAAA,GAAW,IAAA,EAAM,KAAA,aAAkB,KAAA;EAC7C,IAAA,EAAM,KAAA;EACN,GAAA;EACA,OAAA,EAAS,cAAA;AAAA,MACL,OAAA;AAAA,cAGK,KAAA,GAAS,QAAA,aAAgB,OAAA;;;KC5D1B,MAAA;EACV,KAAA,EAAO,MAAA;EACP,OAAA,QAAe,OAAA;AAAA;AAAA,cAGJ,YAAA,GAAgB,MAAA,EAAQ,MAAA,KAAM,MAAA;;;cCY9B,UAAA,GAAoB,IAAA,aAAe,OAAA;;;;;AFgBhD;;iBGtBsB,0BAAA,CAA2B,aAAA,WAAwB,OAAA;;;;iBA+BnD,wBAAA,CACpB,aAAA,UACA,SAAA,YACC,OAAA;;;;;;;AHZH;;iBInBsB,YAAA,CAAa,WAAA,UAAqB,cAAA,WAAyB,OAAA;;;;;;;iBAoB3D,UAAA,CAAW,WAAA,UAAqB,cAAA,WAAyB,OAAA;AAAA,cAuDlE,SAAA,GAAmB,IAAA,UAAc,EAAA,UAAY,GAAA,SAAY,OAAA,CAAQ,GAAA,KAAG,OAAA;;;cCzFpE,oBAAA,SAA6B,KAAA;EACxC,IAAA;cAEY,OAAA,UAAiB,IAAA;AAAA;;;KCAnB,cAAA;;;;AN8BZ;cMfa,aAAA,GACX,SAAA,yBACC,OAAA,CAAQ,cAAA;;;KCXC,MAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionRunner, ActionRunnerData, DownloadHooks as Hooks, EventRunner, ExpressionRunner, PipelabContext, Runner, RunnerCallbackFnArgument, downloadFile, ensure, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, runPnpm, runWithLiveLogs } from "@pipelab/core-node";
|
|
1
|
+
import { ActionRunner, ActionRunnerData, DownloadHooks as Hooks, EventRunner, ExpressionRunner, PipelabContext, Runner, RunnerCallbackFnArgument, downloadFile, ensure, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, isPathBlacklisted, runPnpm, runWithLiveLogs } from "@pipelab/core-node";
|
|
2
2
|
import { z as schema } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/pipelab.d.ts
|
|
@@ -47,6 +47,17 @@ declare const createPlugin: (plugin: Plugin) => Plugin;
|
|
|
47
47
|
//#region src/utils.d.ts
|
|
48
48
|
declare const fileExists: (path: string) => Promise<boolean>;
|
|
49
49
|
//#endregion
|
|
50
|
+
//#region src/fs-utils.d.ts
|
|
51
|
+
/**
|
|
52
|
+
* Asserts that a directory is safe to be deleted/cleaned up.
|
|
53
|
+
* Throws an error if the directory is protected or is not empty and lacks the Pipelab folder marker.
|
|
54
|
+
*/
|
|
55
|
+
declare function assertSafeDirectoryCleanup(directoryPath: string): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a hidden Pipelab marker directory with metadata.json at the specified destination path.
|
|
58
|
+
*/
|
|
59
|
+
declare function writePipelabFolderMarker(directoryPath: string, generator?: string): Promise<void>;
|
|
60
|
+
//#endregion
|
|
50
61
|
//#region src/archive-utils.d.ts
|
|
51
62
|
/**
|
|
52
63
|
* Extracts a .tar.gz archive.
|
|
@@ -81,5 +92,5 @@ declare const detectRuntime: (appFolder: string | undefined) => Promise<OutputRu
|
|
|
81
92
|
//#region src/index.d.ts
|
|
82
93
|
type NoData = { [index in string]?: unknown };
|
|
83
94
|
//#endregion
|
|
84
|
-
export { type ActionRunner, type ActionRunnerData, type EventRunner, type ExpressionRunner, ExternalCommandError, type Hooks, NoData, OutputRuntimes, PipelabContext, Plugin, type Runner, type RunnerCallbackFnArgument, createActionRunner, createEventRunner, createExpressionRunner, createPlugin, detectRuntime, downloadFile, ensure, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, fileExists, runPnpm, runWithLiveLogs, schema, sleep, zipFolder };
|
|
95
|
+
export { type ActionRunner, type ActionRunnerData, type EventRunner, type ExpressionRunner, ExternalCommandError, type Hooks, NoData, OutputRuntimes, PipelabContext, Plugin, type Runner, type RunnerCallbackFnArgument, assertSafeDirectoryCleanup, createActionRunner, createEventRunner, createExpressionRunner, createPlugin, detectRuntime, downloadFile, ensure, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, fileExists, isPathBlacklisted, runPnpm, runWithLiveLogs, schema, sleep, writePipelabFolderMarker, zipFolder };
|
|
85
96
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/pipelab.ts","../src/create-plugin.ts","../src/utils.ts","../src/archive-utils.ts","../src/custom-errors.ts","../src/node-utils.ts","../src/index.ts"],"mappings":";;;;cAiCa,kBAAA,kBAAqC,MAAA,EAChD,MAAA,GAAS,IAAA,EAAM,gBAAA,CAAiB,MAAA,MAAY,OAAA,YAAa,IAAA,EAA1C,gBAAA,CAAiB,MAAA,MAAY,OAAA;AAAA,cAGjC,sBAAA,sBAA6C,UAAA,EACxD,MAAA,GAAS,IAAA;EACP,GAAA,SAAY,OAAA,CAAQ,GAAA;EACpB,SAAA,EAAW,qBAAA,CAAsB,UAAA;EACjC,MAAA,EAAQ,2BAAA,CAA4B,UAAA;EACpC,OAAA,GAAU,QAAA,GAAW,IAAA,EAAM,UAAA,aAAuB,UAAA;EAClD,IAAA,EAAM,UAAA;EACN,GAAA;EACA,OAAA,EAAS,cAAA;AAAA,MACL,OAAA,cAAe,IAAA;EAPnB,GAAA,SAAY,OAAA,CAAQ,GAAA;EACpB,SAAA,EAAW,qBAAA,CAAsB,UAAA;EACjC,MAAA,EAAQ,2BAAA,CAA4B,UAAA;EACpC,OAAA,GAAU,QAAA,GAAW,IAAA,EAAM,UAAA,aAAuB,UAAA;EAClD,IAAA,EAAM,UAAA;EACN,GAAA;EACA,OAAA,EAAS,cAAA;AAAA,MACL,OAAA;AAAA,cAGK,iBAAA,iBAAmC,KAAA,EAC9C,MAAA,GAAS,IAAA;EACP,GAAA,SAAY,OAAA,CAAQ,GAAA;EACpB,MAAA,EAAQ,sBAAA,CAAuB,KAAA;EAC/B,OAAA,GAAU,QAAA,GAAW,IAAA,EAAM,KAAA,aAAkB,KAAA;EAC7C,IAAA,EAAM,KAAA;EACN,GAAA;EACA,OAAA,EAAS,cAAA;AAAA,MACL,OAAA,YAAa,IAAA;EANjB,GAAA,SAAY,OAAA,CAAQ,GAAA;EACpB,MAAA,EAAQ,sBAAA,CAAuB,KAAA;EAC/B,OAAA,GAAU,QAAA,GAAW,IAAA,EAAM,KAAA,aAAkB,KAAA;EAC7C,IAAA,EAAM,KAAA;EACN,GAAA;EACA,OAAA,EAAS,cAAA;AAAA,MACL,OAAA;AAAA,cAGK,KAAA,GAAS,QAAA,aAAgB,OAAA;;;KC5D1B,MAAA;EACV,KAAA,EAAO,MAAA;EACP,OAAA,QAAe,OAAA;AAAA;AAAA,cAGJ,YAAA,GAAgB,MAAA,EAAQ,MAAA,KAAM,MAAA;;;cCY9B,UAAA,GAAoB,IAAA,aAAe,OAAA
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/pipelab.ts","../src/create-plugin.ts","../src/utils.ts","../src/fs-utils.ts","../src/archive-utils.ts","../src/custom-errors.ts","../src/node-utils.ts","../src/index.ts"],"mappings":";;;;cAiCa,kBAAA,kBAAqC,MAAA,EAChD,MAAA,GAAS,IAAA,EAAM,gBAAA,CAAiB,MAAA,MAAY,OAAA,YAAa,IAAA,EAA1C,gBAAA,CAAiB,MAAA,MAAY,OAAA;AAAA,cAGjC,sBAAA,sBAA6C,UAAA,EACxD,MAAA,GAAS,IAAA;EACP,GAA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iBGtBsB,0BAAA,CAA2B,aAAA,WAAwB,OAAA;;;;iBA+BnD,wBAAA,CACpB,aAAA,UACA,SAAA,YACC,OAAA;;;;;;;AHZH;;iBInBsB,YAAA,CAAa,WAAA,UAAqB,cAAA,WAAyB,OAAA;;;;;;;iBAoB3D,UAAA,CAAW,WAAA,UAAqB,cAAA,WAAyB,OAAA;AAAA,cAuDlE,SAAA,GAAmB,IAAA,UAAc,EAAA,UAAY,GAAA,SAAY,OAAA,CAAQ,GAAA,KAAG,OAAA;;;cCzFpE,oBAAA,SAA6B,KAAA;EACxC,IAAA;cAEY,OAAA,UAAiB,IAAA;AAAA;;;KCAnB,cAAA;;;;AN8BZ;cMfa,aAAA,GACX,SAAA,yBACC,OAAA,CAAQ,cAAA;;;KCXC,MAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -2,10 +2,10 @@ import { o as debugLog, t as QuickJSEmscriptenModuleError } from "./chunk-JTKJZQ
|
|
|
2
2
|
import { hostname } from "os";
|
|
3
3
|
import { normalize } from "path";
|
|
4
4
|
import { formatWithOptions, types } from "util";
|
|
5
|
-
import { PipelabContext, downloadFile, ensure, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, runPnpm, runWithLiveLogs } from "@pipelab/core-node";
|
|
5
|
+
import { PipelabContext, downloadFile, ensure, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, isPathBlacklisted, runPnpm, runWithLiveLogs } from "@pipelab/core-node";
|
|
6
|
+
import { dirname, join, resolve } from "node:path";
|
|
7
|
+
import { access, mkdir, readdir, stat, writeFile } from "node:fs/promises";
|
|
6
8
|
import { createWriteStream } from "node:fs";
|
|
7
|
-
import { access, mkdir } from "node:fs/promises";
|
|
8
|
-
import { dirname, join } from "node:path";
|
|
9
9
|
import tar from "tar";
|
|
10
10
|
import yauzl from "yauzl";
|
|
11
11
|
import archiver from "archiver";
|
|
@@ -64859,16 +64859,16 @@ const foo = "bar";
|
|
|
64859
64859
|
const transformUrl = (url) => {
|
|
64860
64860
|
if (url && typeof url === "string") {
|
|
64861
64861
|
const getHost = () => {
|
|
64862
|
-
if (typeof window !== "undefined") if (
|
|
64862
|
+
if (typeof window !== "undefined") if (process.env.NODE_ENV === "development") return `http://${window.location.hostname}:33753`;
|
|
64863
64863
|
else return `${window.location.protocol}//${window.location.host}`;
|
|
64864
64864
|
return "http://localhost:33753";
|
|
64865
64865
|
};
|
|
64866
64866
|
if (url.startsWith("file://")) {
|
|
64867
|
-
const filePath = url.substring(7);
|
|
64867
|
+
const filePath = decodeURIComponent(url.substring(7));
|
|
64868
64868
|
return `${getHost()}/media-file/${encodeURIComponent(filePath)}`;
|
|
64869
64869
|
}
|
|
64870
64870
|
if (url.startsWith("media://")) {
|
|
64871
|
-
const filePath = url.replace(/^media:\/\/+/, "/");
|
|
64871
|
+
const filePath = decodeURIComponent(url.replace(/^media:\/\/+/, "/"));
|
|
64872
64872
|
return `${getHost()}/media-file/${encodeURIComponent(filePath)}`;
|
|
64873
64873
|
}
|
|
64874
64874
|
}
|
|
@@ -64953,6 +64953,39 @@ const fileExists = async (path) => {
|
|
|
64953
64953
|
}
|
|
64954
64954
|
};
|
|
64955
64955
|
//#endregion
|
|
64956
|
+
//#region src/fs-utils.ts
|
|
64957
|
+
/**
|
|
64958
|
+
* Asserts that a directory is safe to be deleted/cleaned up.
|
|
64959
|
+
* Throws an error if the directory is protected or is not empty and lacks the Pipelab folder marker.
|
|
64960
|
+
*/
|
|
64961
|
+
async function assertSafeDirectoryCleanup(directoryPath) {
|
|
64962
|
+
if (!directoryPath) return;
|
|
64963
|
+
const resolvedPath = resolve(directoryPath);
|
|
64964
|
+
if (isPathBlacklisted(resolvedPath)) throw new Error(`Cannot cleanup/delete protected system or user directory: ${resolvedPath}`);
|
|
64965
|
+
try {
|
|
64966
|
+
if ((await stat(resolvedPath)).isDirectory()) {
|
|
64967
|
+
const files = await readdir(resolvedPath);
|
|
64968
|
+
if (files.length > 0) {
|
|
64969
|
+
if (!files.includes(".pipelab")) throw new Error(`Directory is not empty and was not created by Pipelab: ${resolvedPath}. Aborting to prevent data loss.`);
|
|
64970
|
+
}
|
|
64971
|
+
}
|
|
64972
|
+
} catch (e) {
|
|
64973
|
+
if (e.code !== "ENOENT") throw e;
|
|
64974
|
+
}
|
|
64975
|
+
}
|
|
64976
|
+
/**
|
|
64977
|
+
* Creates a hidden Pipelab marker directory with metadata.json at the specified destination path.
|
|
64978
|
+
*/
|
|
64979
|
+
async function writePipelabFolderMarker(directoryPath, generator = "unknown") {
|
|
64980
|
+
if (!directoryPath) return;
|
|
64981
|
+
const markerDir = join(directoryPath, ".pipelab");
|
|
64982
|
+
await mkdir(markerDir, { recursive: true });
|
|
64983
|
+
await writeFile(join(markerDir, "metadata.json"), JSON.stringify({
|
|
64984
|
+
createdBy: generator,
|
|
64985
|
+
timestamp: Date.now()
|
|
64986
|
+
}, null, 2), "utf-8");
|
|
64987
|
+
}
|
|
64988
|
+
//#endregion
|
|
64956
64989
|
//#region src/archive-utils.ts
|
|
64957
64990
|
/**
|
|
64958
64991
|
* Extracts a .tar.gz archive.
|
|
@@ -65066,6 +65099,6 @@ const detectRuntime = async (appFolder) => {
|
|
|
65066
65099
|
return detectedRuntime;
|
|
65067
65100
|
};
|
|
65068
65101
|
//#endregion
|
|
65069
|
-
export { AppSettingsValidator, AppSettingsValidatorV1, AppSettingsValidatorV2, AppSettingsValidatorV3, AppSettingsValidatorV4, AppSettingsValidatorV5, AppSettingsValidatorV6, AppSettingsValidatorV7, BenefitNotFoundError, ConnectionValidator, ConnectionsValidator, ConnectionsValidatorV1, EditorParamValidatorV3, ExternalCommandError, FileRepoProjectValidatorV2, FileRepoValidator, FileRepoValidatorV1, FileRepoValidatorV2, FileRepoValidatorV3, OriginValidator, PipelabContext, src_default as RELEASE_SYNC, SaveLocationExternalValidator, SaveLocationInternalValidator, SaveLocationPipelabCloudValidator, SaveLocationValidator, SavedFileDefaultValidatorV4, SavedFileDefaultValidatorV5, SavedFileSimpleValidatorV4, SavedFileSimpleValidatorV5, SavedFileValidator, SavedFileValidatorV1, SavedFileValidatorV2, SavedFileValidatorV3, SavedFileValidatorV4, SavedFileValidatorV5, ShellChannels, SubscriptionExpiredError, SubscriptionRequiredError, UnauthorizedError, VariableValidatorV1, WebSocketConnectionError, WebSocketError, WebSocketTimeoutError, appSettingsMigrator, configRegistry, connectionsMigrator, createAction, createActionRunner, createArray, createBooleanParam, createColorPicker, createDefinition, createEvent, createEventRunner, createExpression, createExpressionRunner, createNetlifySiteParam, createNodeDefinition, createNumberParam, createPasswordParam, createPathParam, createPlugin, createQuickJs, createQuickJsFromVariant, createRawParam, createStringParam, createSubscriptionError, createVersionSchema, de_DE_default as de_DE, defaultAppSettings, defaultConnections, defaultFileRepo, detectRuntime, downloadFile, en_US_default as en_US, ensure, es_ES_default as es_ES, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, fileExists, fileRepoMigrations, fmt, foo, fr_FR_default as fr_FR, getSubscriptionErrorMessage, isRenderer, isRequired, isSubscriptionError, isSupabaseAvailable, isWebSocketErrorMessage, isWebSocketRequestMessage, isWebSocketResponseMessage, makeResolvedParams, newVariant, normalizePipelineConfig, processGraph, pt_BR_default as pt_BR, runPnpm, runWithLiveLogs, savedFileMigrator, schema, sleep, supabase, transformUrl, useLogger, usePlugins, variableToFormattedVariable, zh_CN_default as zh_CN, zipFolder };
|
|
65102
|
+
export { AppSettingsValidator, AppSettingsValidatorV1, AppSettingsValidatorV2, AppSettingsValidatorV3, AppSettingsValidatorV4, AppSettingsValidatorV5, AppSettingsValidatorV6, AppSettingsValidatorV7, BenefitNotFoundError, ConnectionValidator, ConnectionsValidator, ConnectionsValidatorV1, EditorParamValidatorV3, ExternalCommandError, FileRepoProjectValidatorV2, FileRepoValidator, FileRepoValidatorV1, FileRepoValidatorV2, FileRepoValidatorV3, OriginValidator, PipelabContext, src_default as RELEASE_SYNC, SaveLocationExternalValidator, SaveLocationInternalValidator, SaveLocationPipelabCloudValidator, SaveLocationValidator, SavedFileDefaultValidatorV4, SavedFileDefaultValidatorV5, SavedFileSimpleValidatorV4, SavedFileSimpleValidatorV5, SavedFileValidator, SavedFileValidatorV1, SavedFileValidatorV2, SavedFileValidatorV3, SavedFileValidatorV4, SavedFileValidatorV5, ShellChannels, SubscriptionExpiredError, SubscriptionRequiredError, UnauthorizedError, VariableValidatorV1, WebSocketConnectionError, WebSocketError, WebSocketTimeoutError, appSettingsMigrator, assertSafeDirectoryCleanup, configRegistry, connectionsMigrator, createAction, createActionRunner, createArray, createBooleanParam, createColorPicker, createDefinition, createEvent, createEventRunner, createExpression, createExpressionRunner, createNetlifySiteParam, createNodeDefinition, createNumberParam, createPasswordParam, createPathParam, createPlugin, createQuickJs, createQuickJsFromVariant, createRawParam, createStringParam, createSubscriptionError, createVersionSchema, de_DE_default as de_DE, defaultAppSettings, defaultConnections, defaultFileRepo, detectRuntime, downloadFile, en_US_default as en_US, ensure, es_ES_default as es_ES, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, fileExists, fileRepoMigrations, fmt, foo, fr_FR_default as fr_FR, getSubscriptionErrorMessage, isPathBlacklisted, isRenderer, isRequired, isSubscriptionError, isSupabaseAvailable, isWebSocketErrorMessage, isWebSocketRequestMessage, isWebSocketResponseMessage, makeResolvedParams, newVariant, normalizePipelineConfig, processGraph, pt_BR_default as pt_BR, runPnpm, runWithLiveLogs, savedFileMigrator, schema, sleep, supabase, transformUrl, useLogger, usePlugins, variableToFormattedVariable, writePipelabFolderMarker, zh_CN_default as zh_CN, zipFolder };
|
|
65070
65103
|
|
|
65071
65104
|
//# sourceMappingURL=index.mjs.map
|