@pipelab/plugin-tauri 1.0.0-beta.13 → 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
@@ -4,11 +4,11 @@ import { normalize } from "path";
4
4
  import { formatWithOptions, types } from "util";
5
5
  import path, { basename, delimiter, dirname, join } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
- import { arch, constants, homedir, platform, tmpdir } from "node:os";
7
+ import { arch, constants, homedir, platform } from "node:os";
8
8
  import { appendFileSync, createReadStream, createWriteStream, existsSync, readFile, readFileSync, readdirSync, statSync, writeFile, writeFileSync } from "node:fs";
9
+ import { access, chmod, cp, mkdir, readFile as readFile$1, readdir, rename, rm, writeFile as writeFile$1 } from "node:fs/promises";
9
10
  import http from "node:http";
10
11
  import { webcrypto } from "node:crypto";
11
- import { access, chmod, cp, mkdir, mkdtemp, readFile as readFile$1, readdir, realpath, rename, rm, writeFile as writeFile$1 } from "node:fs/promises";
12
12
  import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
13
13
  import { StringDecoder } from "node:string_decoder";
14
14
  import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
@@ -1595,6 +1595,56 @@ function literal(literal_, message) {
1595
1595
  }
1596
1596
  };
1597
1597
  }
1598
+ function looseObject(entries, message) {
1599
+ return {
1600
+ kind: "schema",
1601
+ type: "loose_object",
1602
+ reference: looseObject,
1603
+ expects: "Object",
1604
+ async: false,
1605
+ entries,
1606
+ message,
1607
+ _run(dataset, config2) {
1608
+ const input = dataset.value;
1609
+ if (input && typeof input === "object") {
1610
+ dataset.typed = true;
1611
+ dataset.value = {};
1612
+ for (const key in this.entries) {
1613
+ const value2 = input[key];
1614
+ const valueDataset = this.entries[key]._run({
1615
+ typed: false,
1616
+ value: value2
1617
+ }, config2);
1618
+ if (valueDataset.issues) {
1619
+ const pathItem = {
1620
+ type: "object",
1621
+ origin: "value",
1622
+ input,
1623
+ key,
1624
+ value: value2
1625
+ };
1626
+ for (const issue of valueDataset.issues) {
1627
+ if (issue.path) issue.path.unshift(pathItem);
1628
+ else issue.path = [pathItem];
1629
+ dataset.issues?.push(issue);
1630
+ }
1631
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1632
+ if (config2.abortEarly) {
1633
+ dataset.typed = false;
1634
+ break;
1635
+ }
1636
+ }
1637
+ if (!valueDataset.typed) dataset.typed = false;
1638
+ if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
1639
+ }
1640
+ if (!dataset.issues || !config2.abortEarly) {
1641
+ for (const key in input) if (_isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
1642
+ }
1643
+ } else _addIssue(this, "type", dataset, config2);
1644
+ return dataset;
1645
+ }
1646
+ };
1647
+ }
1598
1648
  function number(message) {
1599
1649
  return {
1600
1650
  kind: "schema",
@@ -2132,6 +2182,18 @@ settingsMigratorInternal.createMigrations({
2132
2182
  })
2133
2183
  ]
2134
2184
  });
2185
+ const connectionsMigratorInternal = createMigrator();
2186
+ const defaultConnections = connectionsMigratorInternal.createDefault({
2187
+ version: "1.0.0",
2188
+ connections: []
2189
+ });
2190
+ connectionsMigratorInternal.createMigrations({
2191
+ defaultValue: defaultConnections,
2192
+ migrations: [createMigration({
2193
+ version: "1.0.0",
2194
+ up: finalVersion
2195
+ })]
2196
+ });
2135
2197
  const fileRepoMigratorInternal = createMigrator();
2136
2198
  const defaultFileRepo = fileRepoMigratorInternal.createDefault({
2137
2199
  version: "2.0.0",
@@ -2293,11 +2355,51 @@ const LEGACY_ID_MAP = {
2293
2355
  };
2294
2356
  const getStrictPluginId = (pluginId) => {
2295
2357
  if (!pluginId) return pluginId;
2296
- if (LEGACY_ID_MAP[pluginId]) return LEGACY_ID_MAP[pluginId];
2297
- if (pluginId.startsWith("@") || pluginId.includes("/") || pluginId.startsWith("pipelab-plugin-")) return pluginId;
2298
- const prefixed = `@pipelab/plugin-${pluginId}`;
2299
- return LEGACY_ID_MAP[prefixed] || prefixed;
2358
+ return LEGACY_ID_MAP[pluginId] || pluginId;
2300
2359
  };
2360
+ //#endregion
2361
+ //#region ../../packages/shared/src/save-location.ts
2362
+ const SaveLocationInternalValidator = object({
2363
+ id: string(),
2364
+ project: string(),
2365
+ lastModified: string(),
2366
+ type: literal("internal"),
2367
+ configName: string()
2368
+ });
2369
+ const SaveLocationValidator = union([
2370
+ object({
2371
+ id: string(),
2372
+ project: string(),
2373
+ path: string(),
2374
+ lastModified: string(),
2375
+ type: literal("external"),
2376
+ summary: object({
2377
+ plugins: array(string()),
2378
+ name: string(),
2379
+ description: string()
2380
+ })
2381
+ }),
2382
+ SaveLocationInternalValidator,
2383
+ object({
2384
+ id: string(),
2385
+ project: string(),
2386
+ type: literal("pipelab-cloud")
2387
+ })
2388
+ ]);
2389
+ object({
2390
+ version: literal("1.0.0"),
2391
+ data: optional(record(string(), SaveLocationValidator), {})
2392
+ });
2393
+ const FileRepoProjectValidatorV2$1 = object({
2394
+ id: string(),
2395
+ name: string(),
2396
+ description: string()
2397
+ });
2398
+ object({
2399
+ version: literal("2.0.0"),
2400
+ projects: array(FileRepoProjectValidatorV2$1),
2401
+ pipelines: optional(array(SaveLocationValidator), [])
2402
+ });
2301
2403
  object({
2302
2404
  cacheFolder: string(),
2303
2405
  theme: union([literal("light"), literal("dark")]),
@@ -2449,6 +2551,17 @@ object({
2449
2551
  })),
2450
2552
  isInternalMigrationBannerClosed: optional(boolean(), false)
2451
2553
  });
2554
+ const ConnectionValidator = looseObject({
2555
+ id: string(),
2556
+ pluginName: string(),
2557
+ name: string(),
2558
+ createdAt: string(),
2559
+ isDefault: boolean()
2560
+ });
2561
+ object({
2562
+ version: literal("1.0.0"),
2563
+ connections: array(ConnectionValidator)
2564
+ });
2452
2565
  //#endregion
2453
2566
  //#region ../../node_modules/tslog/dist/esm/prettyLogStyles.js
2454
2567
  const prettyLogStyles = {
@@ -2969,7 +3082,7 @@ const useLogger = () => {
2969
3082
  const OriginValidator = object({
2970
3083
  pluginId: string(),
2971
3084
  nodeId: string(),
2972
- version: pipe(optional(string()), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent."))
3085
+ version: optional(pipe(string(), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent.")))
2973
3086
  });
2974
3087
  const BlockActionValidatorV1 = object({
2975
3088
  type: literal("action"),
@@ -2982,7 +3095,7 @@ const EditorParamValidatorV3 = union([literal("simple"), literal("editor")]);
2982
3095
  const BlockActionValidatorV3 = object({
2983
3096
  type: literal("action"),
2984
3097
  uid: string(),
2985
- name: pipe(optional(string()), description("A custom name provided by the user")),
3098
+ name: optional(pipe(string(), description("A custom name provided by the user"))),
2986
3099
  disabled: optional(boolean()),
2987
3100
  params: record(string(), object({
2988
3101
  editor: EditorParamValidatorV3,
@@ -45305,35 +45418,6 @@ const createBooleanParam = (value, definition) => {
45305
45418
  };
45306
45419
  };
45307
45420
  //#endregion
45308
- //#region ../../packages/shared/src/save-location.ts
45309
- const SaveLocationInternalValidator = object({
45310
- id: string(),
45311
- project: string(),
45312
- lastModified: string(),
45313
- type: literal("internal"),
45314
- configName: string()
45315
- });
45316
- const SaveLocationValidator = union([
45317
- object({
45318
- id: string(),
45319
- project: string(),
45320
- path: string(),
45321
- lastModified: string(),
45322
- type: literal("external"),
45323
- summary: object({
45324
- plugins: array(string()),
45325
- name: string(),
45326
- description: string()
45327
- })
45328
- }),
45329
- SaveLocationInternalValidator,
45330
- object({
45331
- id: string(),
45332
- project: string(),
45333
- type: literal("pipelab-cloud")
45334
- })
45335
- ]);
45336
- //#endregion
45337
45421
  //#region ../../packages/shared/src/websocket.types.ts
45338
45422
  var WebSocketError = class extends Error {
45339
45423
  constructor(message, code, requestId) {
@@ -45350,20 +45434,6 @@ object({
45350
45434
  version: literal("1.0.0"),
45351
45435
  data: optional(record(string(), SaveLocationValidator), {})
45352
45436
  });
45353
- const FileRepoProjectValidatorV2$1 = object({
45354
- id: string(),
45355
- name: string(),
45356
- description: string()
45357
- });
45358
- object({
45359
- version: literal("2.0.0"),
45360
- projects: array(FileRepoProjectValidatorV2$1),
45361
- pipelines: optional(array(SaveLocationValidator), [])
45362
- });
45363
- object({
45364
- version: literal("1.0.0"),
45365
- data: optional(record(string(), SaveLocationValidator), {})
45366
- });
45367
45437
  const FileRepoProjectValidatorV2 = object({
45368
45438
  id: string(),
45369
45439
  name: string(),
@@ -45383,9 +45453,27 @@ var init_esm_shims = __esmMin((() => {
45383
45453
  __dirname = /* @__PURE__ */ getDirname();
45384
45454
  }));
45385
45455
  //#endregion
45386
- //#region ../../packages/core-node/src/context.ts
45456
+ //#region ../../packages/constants/src/index.ts
45387
45457
  init_esm_shims();
45388
- const _dirname = typeof __dirname !== "undefined" ? __dirname : typeof import.meta !== "undefined" && import.meta.url ? dirname(fileURLToPath(import.meta.url)) : process.cwd();
45458
+ /**
45459
+ * Get the binary name for a given platform
45460
+ * @param name
45461
+ * @param platform If not provided, it will try to use process.platform (Node.js only)
45462
+ * @returns
45463
+ */
45464
+ const getBinName = (name, platform) => {
45465
+ const p = platform || (typeof process !== "undefined" ? process.platform : "unknown");
45466
+ if (p === "win32") return `${name}.exe`;
45467
+ if (p === "darwin") return `${name}.app/Contents/MacOS/${name}`;
45468
+ return name;
45469
+ };
45470
+ const websocketPort = 33753;
45471
+ const DEFAULT_NODE_VERSION = "24.14.1";
45472
+ const DEFAULT_PNPM_VERSION = "10.12.0";
45473
+ //#endregion
45474
+ //#region ../../packages/core-node/src/context.ts
45475
+ const metaUrl = typeof import.meta !== "undefined" ? import.meta.url : void 0;
45476
+ const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? dirname(fileURLToPath(metaUrl)) : process.cwd();
45389
45477
  const isDev = process.env.NODE_ENV === "development";
45390
45478
  /**
45391
45479
  * Finds the monorepo root by looking for pnpm-workspace.yaml.
@@ -48957,21 +49045,6 @@ const useAPI = () => {
48957
49045
  };
48958
49046
  };
48959
49047
  //#endregion
48960
- //#region ../../packages/constants/src/index.ts
48961
- /**
48962
- * Get the binary name for a given platform
48963
- * @param name
48964
- * @param platform If not provided, it will try to use process.platform (Node.js only)
48965
- * @returns
48966
- */
48967
- const getBinName = (name, platform) => {
48968
- const p = platform || (typeof process !== "undefined" ? process.platform : "unknown");
48969
- if (p === "win32") return `${name}.exe`;
48970
- if (p === "darwin") return `${name}.app/Contents/MacOS/${name}`;
48971
- return name;
48972
- };
48973
- const websocketPort = 33753;
48974
- //#endregion
48975
49048
  //#region ../../packages/core-node/src/websocket-server.ts
48976
49049
  var WebSocketServer = class {
48977
49050
  wss = null;
@@ -89376,14 +89449,6 @@ var import_tar = /* @__PURE__ */ __toESM(require_tar$1(), 1);
89376
89449
  var import_yauzl = /* @__PURE__ */ __toESM(require_yauzl(), 1);
89377
89450
  require_archiver();
89378
89451
  /**
89379
- * Generates a unique temporary folder.
89380
- */
89381
- const generateTempFolder = async (base) => {
89382
- const targetBase = base || tmpdir();
89383
- await mkdir(targetBase, { recursive: true });
89384
- return await mkdtemp(join(await realpath(targetBase), "pipelab-"));
89385
- };
89386
- /**
89387
89452
  * Extracts a .tar.gz archive.
89388
89453
  */
89389
89454
  async function extractTarGz(archivePath, destinationDir) {
@@ -100964,11 +101029,11 @@ var require_cp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100964
101029
  var require_with_temp_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100965
101030
  const { join: join$5, sep: sep$1 } = __require("path");
100966
101031
  const getOptions = require_get_options();
100967
- const { mkdir: mkdir$4, mkdtemp: mkdtemp$1, rm: rm$5 } = __require("fs/promises");
101032
+ const { mkdir: mkdir$4, mkdtemp, rm: rm$5 } = __require("fs/promises");
100968
101033
  const withTempDir = async (root, fn, opts) => {
100969
101034
  const options = getOptions(opts, { copy: ["tmpPrefix"] });
100970
101035
  await mkdir$4(root, { recursive: true });
100971
- const target = await mkdtemp$1(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
101036
+ const target = await mkdtemp(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
100972
101037
  let err;
100973
101038
  let result;
100974
101039
  try {
@@ -110567,9 +110632,9 @@ var require_protected = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110567
110632
  //#region ../../node_modules/pacote/lib/util/cache-dir.js
110568
110633
  var require_cache_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110569
110634
  const { resolve: resolve$6 } = __require("node:path");
110570
- const { tmpdir: tmpdir$1, homedir: homedir$1 } = __require("node:os");
110635
+ const { tmpdir, homedir: homedir$1 } = __require("node:os");
110571
110636
  module.exports = (fakePlatform = false) => {
110572
- const temp = tmpdir$1();
110637
+ const temp = tmpdir();
110573
110638
  const uidOrPid = process.getuid ? process.getuid() : process.pid;
110574
110639
  const home = homedir$1() || resolve$6(temp, "npm-" + uidOrPid);
110575
110640
  const platform = fakePlatform || process.platform;
@@ -150642,7 +150707,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150642
150707
  const { promisify: promisify$1 } = __require("util");
150643
150708
  const path$1 = __require("path");
150644
150709
  const { createHash } = __require("crypto");
150645
- const { realpath: realpath$1, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
150710
+ const { realpath, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
150646
150711
  const url = __require("url");
150647
150712
  const slasher = require_glob_slash();
150648
150713
  const minimatch = require_minimatch();
@@ -150965,7 +151030,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150965
151030
  };
150966
151031
  const getHandlers = (methods) => Object.assign({
150967
151032
  lstat: promisify$1(lstat),
150968
- realpath: promisify$1(realpath$1),
151033
+ realpath: promisify$1(realpath),
150969
151034
  createReadStream: createReadStream$1,
150970
151035
  readdir: promisify$1(readdir$1),
150971
151036
  sendError
@@ -151104,8 +151169,6 @@ const sendStartupProgress = (message) => {
151104
151169
  };
151105
151170
  //#endregion
151106
151171
  //#region ../../packages/core-node/src/utils/remote.ts
151107
- const DEFAULT_NODE_VERSION = "24.14.1";
151108
- const DEFAULT_PNPM_VERSION = "10.12.0";
151109
151172
  function isPackageComplete(packageDir) {
151110
151173
  return existsSync(join(packageDir, "package.json"));
151111
151174
  }
@@ -151297,7 +151360,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
151297
151360
  const extension = isWindows ? "zip" : "tar.gz";
151298
151361
  const fileName = `node-v${version}-${platform === "osx" ? "darwin" : platform}-${arch}.${extension}`;
151299
151362
  const downloadUrl = `https://nodejs.org/dist/v${version}/${fileName}`;
151300
- const tempDir = await generateTempFolder(tmpdir());
151363
+ const tempDir = await context.createTempFolder("node-download-");
151301
151364
  const archivePath = join(tempDir, fileName);
151302
151365
  sendStartupProgress(`Downloading Node.js v${version}...`);
151303
151366
  console.log(`Downloading Node.js from ${downloadUrl}...`);