@pipelab/plugin-construct 1.0.0-beta.14 → 1.0.0-beta.15

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.mjs CHANGED
@@ -5,11 +5,11 @@ import { normalize } from "path";
5
5
  import { formatWithOptions, types } from "util";
6
6
  import path, { delimiter, dirname, join } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
- import { constants, homedir, tmpdir } from "node:os";
8
+ import { constants, homedir } from "node:os";
9
9
  import { appendFileSync, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
10
+ import { chmod, cp, mkdir, readFile, readdir, rename, rm } from "node:fs/promises";
10
11
  import http from "node:http";
11
12
  import { webcrypto } from "node:crypto";
12
- import { chmod, cp, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm } from "node:fs/promises";
13
13
  import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
14
14
  import { StringDecoder } from "node:string_decoder";
15
15
  import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
@@ -1596,6 +1596,56 @@ function literal(literal_, message) {
1596
1596
  }
1597
1597
  };
1598
1598
  }
1599
+ function looseObject(entries, message) {
1600
+ return {
1601
+ kind: "schema",
1602
+ type: "loose_object",
1603
+ reference: looseObject,
1604
+ expects: "Object",
1605
+ async: false,
1606
+ entries,
1607
+ message,
1608
+ _run(dataset, config2) {
1609
+ const input = dataset.value;
1610
+ if (input && typeof input === "object") {
1611
+ dataset.typed = true;
1612
+ dataset.value = {};
1613
+ for (const key in this.entries) {
1614
+ const value2 = input[key];
1615
+ const valueDataset = this.entries[key]._run({
1616
+ typed: false,
1617
+ value: value2
1618
+ }, config2);
1619
+ if (valueDataset.issues) {
1620
+ const pathItem = {
1621
+ type: "object",
1622
+ origin: "value",
1623
+ input,
1624
+ key,
1625
+ value: value2
1626
+ };
1627
+ for (const issue of valueDataset.issues) {
1628
+ if (issue.path) issue.path.unshift(pathItem);
1629
+ else issue.path = [pathItem];
1630
+ dataset.issues?.push(issue);
1631
+ }
1632
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1633
+ if (config2.abortEarly) {
1634
+ dataset.typed = false;
1635
+ break;
1636
+ }
1637
+ }
1638
+ if (!valueDataset.typed) dataset.typed = false;
1639
+ if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
1640
+ }
1641
+ if (!dataset.issues || !config2.abortEarly) {
1642
+ for (const key in input) if (_isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
1643
+ }
1644
+ } else _addIssue(this, "type", dataset, config2);
1645
+ return dataset;
1646
+ }
1647
+ };
1648
+ }
1599
1649
  function number(message) {
1600
1650
  return {
1601
1651
  kind: "schema",
@@ -2133,6 +2183,18 @@ settingsMigratorInternal.createMigrations({
2133
2183
  })
2134
2184
  ]
2135
2185
  });
2186
+ const connectionsMigratorInternal = createMigrator();
2187
+ const defaultConnections = connectionsMigratorInternal.createDefault({
2188
+ version: "1.0.0",
2189
+ connections: []
2190
+ });
2191
+ connectionsMigratorInternal.createMigrations({
2192
+ defaultValue: defaultConnections,
2193
+ migrations: [createMigration({
2194
+ version: "1.0.0",
2195
+ up: finalVersion
2196
+ })]
2197
+ });
2136
2198
  const fileRepoMigratorInternal = createMigrator();
2137
2199
  const defaultFileRepo = fileRepoMigratorInternal.createDefault({
2138
2200
  version: "2.0.0",
@@ -2294,11 +2356,51 @@ const LEGACY_ID_MAP = {
2294
2356
  };
2295
2357
  const getStrictPluginId = (pluginId) => {
2296
2358
  if (!pluginId) return pluginId;
2297
- if (LEGACY_ID_MAP[pluginId]) return LEGACY_ID_MAP[pluginId];
2298
- if (pluginId.startsWith("@") || pluginId.includes("/") || pluginId.startsWith("pipelab-plugin-")) return pluginId;
2299
- const prefixed = `@pipelab/plugin-${pluginId}`;
2300
- return LEGACY_ID_MAP[prefixed] || prefixed;
2359
+ return LEGACY_ID_MAP[pluginId] || pluginId;
2301
2360
  };
2361
+ //#endregion
2362
+ //#region ../../packages/shared/src/save-location.ts
2363
+ const SaveLocationInternalValidator = object({
2364
+ id: string(),
2365
+ project: string(),
2366
+ lastModified: string(),
2367
+ type: literal("internal"),
2368
+ configName: string()
2369
+ });
2370
+ const SaveLocationValidator = union([
2371
+ object({
2372
+ id: string(),
2373
+ project: string(),
2374
+ path: string(),
2375
+ lastModified: string(),
2376
+ type: literal("external"),
2377
+ summary: object({
2378
+ plugins: array(string()),
2379
+ name: string(),
2380
+ description: string()
2381
+ })
2382
+ }),
2383
+ SaveLocationInternalValidator,
2384
+ object({
2385
+ id: string(),
2386
+ project: string(),
2387
+ type: literal("pipelab-cloud")
2388
+ })
2389
+ ]);
2390
+ object({
2391
+ version: literal("1.0.0"),
2392
+ data: optional(record(string(), SaveLocationValidator), {})
2393
+ });
2394
+ const FileRepoProjectValidatorV2$1 = object({
2395
+ id: string(),
2396
+ name: string(),
2397
+ description: string()
2398
+ });
2399
+ object({
2400
+ version: literal("2.0.0"),
2401
+ projects: array(FileRepoProjectValidatorV2$1),
2402
+ pipelines: optional(array(SaveLocationValidator), [])
2403
+ });
2302
2404
  object({
2303
2405
  cacheFolder: string(),
2304
2406
  theme: union([literal("light"), literal("dark")]),
@@ -2450,6 +2552,17 @@ object({
2450
2552
  })),
2451
2553
  isInternalMigrationBannerClosed: optional(boolean(), false)
2452
2554
  });
2555
+ const ConnectionValidator = looseObject({
2556
+ id: string(),
2557
+ pluginName: string(),
2558
+ name: string(),
2559
+ createdAt: string(),
2560
+ isDefault: boolean()
2561
+ });
2562
+ object({
2563
+ version: literal("1.0.0"),
2564
+ connections: array(ConnectionValidator)
2565
+ });
2453
2566
  //#endregion
2454
2567
  //#region ../../node_modules/tslog/dist/esm/prettyLogStyles.js
2455
2568
  const prettyLogStyles = {
@@ -2970,7 +3083,7 @@ const useLogger = () => {
2970
3083
  const OriginValidator = object({
2971
3084
  pluginId: string(),
2972
3085
  nodeId: string(),
2973
- version: pipe(optional(string()), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent."))
3086
+ version: optional(pipe(string(), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent.")))
2974
3087
  });
2975
3088
  const BlockActionValidatorV1 = object({
2976
3089
  type: literal("action"),
@@ -2983,7 +3096,7 @@ const EditorParamValidatorV3 = union([literal("simple"), literal("editor")]);
2983
3096
  const BlockActionValidatorV3 = object({
2984
3097
  type: literal("action"),
2985
3098
  uid: string(),
2986
- name: pipe(optional(string()), description("A custom name provided by the user")),
3099
+ name: optional(pipe(string(), description("A custom name provided by the user"))),
2987
3100
  disabled: optional(boolean()),
2988
3101
  params: record(string(), object({
2989
3102
  editor: EditorParamValidatorV3,
@@ -45306,35 +45419,6 @@ const createNumberParam = (value, definition) => {
45306
45419
  };
45307
45420
  };
45308
45421
  //#endregion
45309
- //#region ../../packages/shared/src/save-location.ts
45310
- const SaveLocationInternalValidator = object({
45311
- id: string(),
45312
- project: string(),
45313
- lastModified: string(),
45314
- type: literal("internal"),
45315
- configName: string()
45316
- });
45317
- const SaveLocationValidator = union([
45318
- object({
45319
- id: string(),
45320
- project: string(),
45321
- path: string(),
45322
- lastModified: string(),
45323
- type: literal("external"),
45324
- summary: object({
45325
- plugins: array(string()),
45326
- name: string(),
45327
- description: string()
45328
- })
45329
- }),
45330
- SaveLocationInternalValidator,
45331
- object({
45332
- id: string(),
45333
- project: string(),
45334
- type: literal("pipelab-cloud")
45335
- })
45336
- ]);
45337
- //#endregion
45338
45422
  //#region ../../packages/shared/src/websocket.types.ts
45339
45423
  var WebSocketError = class extends Error {
45340
45424
  constructor(message, code, requestId) {
@@ -45351,20 +45435,6 @@ object({
45351
45435
  version: literal("1.0.0"),
45352
45436
  data: optional(record(string(), SaveLocationValidator), {})
45353
45437
  });
45354
- const FileRepoProjectValidatorV2$1 = object({
45355
- id: string(),
45356
- name: string(),
45357
- description: string()
45358
- });
45359
- object({
45360
- version: literal("2.0.0"),
45361
- projects: array(FileRepoProjectValidatorV2$1),
45362
- pipelines: optional(array(SaveLocationValidator), [])
45363
- });
45364
- object({
45365
- version: literal("1.0.0"),
45366
- data: optional(record(string(), SaveLocationValidator), {})
45367
- });
45368
45438
  const FileRepoProjectValidatorV2 = object({
45369
45439
  id: string(),
45370
45440
  name: string(),
@@ -45384,9 +45454,15 @@ var init_esm_shims = __esmMin((() => {
45384
45454
  __dirname = /* @__PURE__ */ getDirname();
45385
45455
  }));
45386
45456
  //#endregion
45387
- //#region ../../packages/core-node/src/context.ts
45457
+ //#region ../../packages/constants/src/index.ts
45388
45458
  init_esm_shims();
45389
- const _dirname = typeof __dirname !== "undefined" ? __dirname : typeof import.meta !== "undefined" && import.meta.url ? dirname(fileURLToPath(import.meta.url)) : process.cwd();
45459
+ const websocketPort = 33753;
45460
+ const DEFAULT_NODE_VERSION = "24.14.1";
45461
+ const DEFAULT_PNPM_VERSION = "10.12.0";
45462
+ //#endregion
45463
+ //#region ../../packages/core-node/src/context.ts
45464
+ const metaUrl = typeof import.meta !== "undefined" ? import.meta.url : void 0;
45465
+ const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? dirname(fileURLToPath(metaUrl)) : process.cwd();
45390
45466
  const isDev = process.env.NODE_ENV === "development";
45391
45467
  /**
45392
45468
  * Finds the monorepo root by looking for pnpm-workspace.yaml.
@@ -48958,9 +49034,6 @@ const useAPI = () => {
48958
49034
  };
48959
49035
  };
48960
49036
  //#endregion
48961
- //#region ../../packages/constants/src/index.ts
48962
- const websocketPort = 33753;
48963
- //#endregion
48964
49037
  //#region ../../packages/core-node/src/websocket-server.ts
48965
49038
  var WebSocketServer = class {
48966
49039
  wss = null;
@@ -89365,14 +89438,6 @@ var import_tar = /* @__PURE__ */ __toESM(require_tar$1(), 1);
89365
89438
  var import_yauzl = /* @__PURE__ */ __toESM(require_yauzl(), 1);
89366
89439
  var import_archiver = /* @__PURE__ */ __toESM(require_archiver(), 1);
89367
89440
  /**
89368
- * Generates a unique temporary folder.
89369
- */
89370
- const generateTempFolder = async (base) => {
89371
- const targetBase = base || tmpdir();
89372
- await mkdir(targetBase, { recursive: true });
89373
- return await mkdtemp(join(await realpath(targetBase), "pipelab-"));
89374
- };
89375
- /**
89376
89441
  * Extracts a .tar.gz archive.
89377
89442
  */
89378
89443
  async function extractTarGz(archivePath, destinationDir) {
@@ -100953,11 +101018,11 @@ var require_cp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100953
101018
  var require_with_temp_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100954
101019
  const { join: join$5, sep: sep$1 } = __require("path");
100955
101020
  const getOptions = require_get_options();
100956
- const { mkdir: mkdir$4, mkdtemp: mkdtemp$1, rm: rm$5 } = __require("fs/promises");
101021
+ const { mkdir: mkdir$4, mkdtemp, rm: rm$5 } = __require("fs/promises");
100957
101022
  const withTempDir = async (root, fn, opts) => {
100958
101023
  const options = getOptions(opts, { copy: ["tmpPrefix"] });
100959
101024
  await mkdir$4(root, { recursive: true });
100960
- const target = await mkdtemp$1(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
101025
+ const target = await mkdtemp(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
100961
101026
  let err;
100962
101027
  let result;
100963
101028
  try {
@@ -110556,9 +110621,9 @@ var require_protected = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110556
110621
  //#region ../../node_modules/pacote/lib/util/cache-dir.js
110557
110622
  var require_cache_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110558
110623
  const { resolve: resolve$6 } = __require("node:path");
110559
- const { tmpdir: tmpdir$1, homedir: homedir$1 } = __require("node:os");
110624
+ const { tmpdir, homedir: homedir$1 } = __require("node:os");
110560
110625
  module.exports = (fakePlatform = false) => {
110561
- const temp = tmpdir$1();
110626
+ const temp = tmpdir();
110562
110627
  const uidOrPid = process.getuid ? process.getuid() : process.pid;
110563
110628
  const home = homedir$1() || resolve$6(temp, "npm-" + uidOrPid);
110564
110629
  const platform = fakePlatform || process.platform;
@@ -150631,7 +150696,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150631
150696
  const { promisify: promisify$1 } = __require("util");
150632
150697
  const path$1 = __require("path");
150633
150698
  const { createHash } = __require("crypto");
150634
- const { realpath: realpath$1, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
150699
+ const { realpath, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
150635
150700
  const url = __require("url");
150636
150701
  const slasher = require_glob_slash();
150637
150702
  const minimatch = require_minimatch();
@@ -150954,7 +151019,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150954
151019
  };
150955
151020
  const getHandlers = (methods) => Object.assign({
150956
151021
  lstat: promisify$1(lstat),
150957
- realpath: promisify$1(realpath$1),
151022
+ realpath: promisify$1(realpath),
150958
151023
  createReadStream: createReadStream$1,
150959
151024
  readdir: promisify$1(readdir$1),
150960
151025
  sendError
@@ -151093,8 +151158,6 @@ const sendStartupProgress = (message) => {
151093
151158
  };
151094
151159
  //#endregion
151095
151160
  //#region ../../packages/core-node/src/utils/remote.ts
151096
- const DEFAULT_NODE_VERSION = "24.14.1";
151097
- const DEFAULT_PNPM_VERSION = "10.12.0";
151098
151161
  function isPackageComplete(packageDir) {
151099
151162
  return existsSync(join(packageDir, "package.json"));
151100
151163
  }
@@ -151286,7 +151349,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
151286
151349
  const extension = isWindows ? "zip" : "tar.gz";
151287
151350
  const fileName = `node-v${version}-${platform === "osx" ? "darwin" : platform}-${arch}.${extension}`;
151288
151351
  const downloadUrl = `https://nodejs.org/dist/v${version}/${fileName}`;
151289
- const tempDir = await generateTempFolder(tmpdir());
151352
+ const tempDir = await context.createTempFolder("node-download-");
151290
151353
  const archivePath = join(tempDir, fileName);
151291
151354
  sendStartupProgress(`Downloading Node.js v${version}...`);
151292
151355
  console.log(`Downloading Node.js from ${downloadUrl}...`);
@@ -151954,7 +152017,16 @@ var src_default = createNodeDefinition({
151954
152017
  node: exportProjectAction,
151955
152018
  runner: ExportProjectActionRunner
151956
152019
  }],
151957
- validators: []
152020
+ validators: [],
152021
+ integrations: [{
152022
+ name: "Browser Executable Link",
152023
+ fields: [{
152024
+ key: "path",
152025
+ label: "Browser Executable Path",
152026
+ type: "file",
152027
+ placeholder: "e.g., /usr/bin/google-chrome"
152028
+ }]
152029
+ }]
151958
152030
  });
151959
152031
  //#endregion
151960
152032
  export { src_default as default };