@pipelab/plugin-discord 1.0.0-beta.14 → 1.0.0-beta.16

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 CHANGED
@@ -8,11 +8,11 @@ let node_os = require("node:os");
8
8
  let node_url = require("node:url");
9
9
  let node_fs = require("node:fs");
10
10
  node_fs = require_chunk.__toESM(node_fs);
11
+ let node_fs_promises = require("node:fs/promises");
12
+ node_fs_promises = require_chunk.__toESM(node_fs_promises);
11
13
  let node_http = require("node:http");
12
14
  node_http = require_chunk.__toESM(node_http);
13
15
  let node_crypto = require("node:crypto");
14
- let node_fs_promises = require("node:fs/promises");
15
- node_fs_promises = require_chunk.__toESM(node_fs_promises);
16
16
  let node_child_process = require("node:child_process");
17
17
  let node_string_decoder = require("node:string_decoder");
18
18
  let node_util = require("node:util");
@@ -26,6 +26,8 @@ let node_v8 = require("node:v8");
26
26
  let node_stream_promises = require("node:stream/promises");
27
27
  let node_stream = require("node:stream");
28
28
  let node_buffer = require("node:buffer");
29
+ let node_dns_promises = require("node:dns/promises");
30
+ node_dns_promises = require_chunk.__toESM(node_dns_promises);
29
31
  let fs_promises = require("fs/promises");
30
32
  //#region ../../packages/migration/src/models/createMigration.ts
31
33
  function createMigration$1(migration) {
@@ -1605,6 +1607,56 @@ function literal(literal_, message) {
1605
1607
  }
1606
1608
  };
1607
1609
  }
1610
+ function looseObject(entries, message) {
1611
+ return {
1612
+ kind: "schema",
1613
+ type: "loose_object",
1614
+ reference: looseObject,
1615
+ expects: "Object",
1616
+ async: false,
1617
+ entries,
1618
+ message,
1619
+ _run(dataset, config2) {
1620
+ const input = dataset.value;
1621
+ if (input && typeof input === "object") {
1622
+ dataset.typed = true;
1623
+ dataset.value = {};
1624
+ for (const key in this.entries) {
1625
+ const value2 = input[key];
1626
+ const valueDataset = this.entries[key]._run({
1627
+ typed: false,
1628
+ value: value2
1629
+ }, config2);
1630
+ if (valueDataset.issues) {
1631
+ const pathItem = {
1632
+ type: "object",
1633
+ origin: "value",
1634
+ input,
1635
+ key,
1636
+ value: value2
1637
+ };
1638
+ for (const issue of valueDataset.issues) {
1639
+ if (issue.path) issue.path.unshift(pathItem);
1640
+ else issue.path = [pathItem];
1641
+ dataset.issues?.push(issue);
1642
+ }
1643
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1644
+ if (config2.abortEarly) {
1645
+ dataset.typed = false;
1646
+ break;
1647
+ }
1648
+ }
1649
+ if (!valueDataset.typed) dataset.typed = false;
1650
+ if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
1651
+ }
1652
+ if (!dataset.issues || !config2.abortEarly) {
1653
+ for (const key in input) if (_isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
1654
+ }
1655
+ } else _addIssue(this, "type", dataset, config2);
1656
+ return dataset;
1657
+ }
1658
+ };
1659
+ }
1608
1660
  function number(message) {
1609
1661
  return {
1610
1662
  kind: "schema",
@@ -2142,6 +2194,18 @@ settingsMigratorInternal.createMigrations({
2142
2194
  })
2143
2195
  ]
2144
2196
  });
2197
+ const connectionsMigratorInternal = createMigrator();
2198
+ const defaultConnections = connectionsMigratorInternal.createDefault({
2199
+ version: "1.0.0",
2200
+ connections: []
2201
+ });
2202
+ connectionsMigratorInternal.createMigrations({
2203
+ defaultValue: defaultConnections,
2204
+ migrations: [createMigration({
2205
+ version: "1.0.0",
2206
+ up: finalVersion
2207
+ })]
2208
+ });
2145
2209
  const fileRepoMigratorInternal = createMigrator();
2146
2210
  const defaultFileRepo = fileRepoMigratorInternal.createDefault({
2147
2211
  version: "2.0.0",
@@ -2303,11 +2367,51 @@ const LEGACY_ID_MAP = {
2303
2367
  };
2304
2368
  const getStrictPluginId = (pluginId) => {
2305
2369
  if (!pluginId) return pluginId;
2306
- if (LEGACY_ID_MAP[pluginId]) return LEGACY_ID_MAP[pluginId];
2307
- if (pluginId.startsWith("@") || pluginId.includes("/") || pluginId.startsWith("pipelab-plugin-")) return pluginId;
2308
- const prefixed = `@pipelab/plugin-${pluginId}`;
2309
- return LEGACY_ID_MAP[prefixed] || prefixed;
2370
+ return LEGACY_ID_MAP[pluginId] || pluginId;
2310
2371
  };
2372
+ //#endregion
2373
+ //#region ../../packages/shared/src/save-location.ts
2374
+ const SaveLocationInternalValidator = object({
2375
+ id: string(),
2376
+ project: string(),
2377
+ lastModified: string(),
2378
+ type: literal("internal"),
2379
+ configName: string()
2380
+ });
2381
+ const SaveLocationValidator = union([
2382
+ object({
2383
+ id: string(),
2384
+ project: string(),
2385
+ path: string(),
2386
+ lastModified: string(),
2387
+ type: literal("external"),
2388
+ summary: object({
2389
+ plugins: array(string()),
2390
+ name: string(),
2391
+ description: string()
2392
+ })
2393
+ }),
2394
+ SaveLocationInternalValidator,
2395
+ object({
2396
+ id: string(),
2397
+ project: string(),
2398
+ type: literal("pipelab-cloud")
2399
+ })
2400
+ ]);
2401
+ object({
2402
+ version: literal("1.0.0"),
2403
+ data: optional(record(string(), SaveLocationValidator), {})
2404
+ });
2405
+ const FileRepoProjectValidatorV2$1 = object({
2406
+ id: string(),
2407
+ name: string(),
2408
+ description: string()
2409
+ });
2410
+ object({
2411
+ version: literal("2.0.0"),
2412
+ projects: array(FileRepoProjectValidatorV2$1),
2413
+ pipelines: optional(array(SaveLocationValidator), [])
2414
+ });
2311
2415
  object({
2312
2416
  cacheFolder: string(),
2313
2417
  theme: union([literal("light"), literal("dark")]),
@@ -2459,6 +2563,17 @@ object({
2459
2563
  })),
2460
2564
  isInternalMigrationBannerClosed: optional(boolean(), false)
2461
2565
  });
2566
+ const ConnectionValidator = looseObject({
2567
+ id: string(),
2568
+ pluginName: string(),
2569
+ name: string(),
2570
+ createdAt: string(),
2571
+ isDefault: boolean()
2572
+ });
2573
+ object({
2574
+ version: literal("1.0.0"),
2575
+ connections: array(ConnectionValidator)
2576
+ });
2462
2577
  //#endregion
2463
2578
  //#region ../../node_modules/tslog/dist/esm/prettyLogStyles.js
2464
2579
  const prettyLogStyles = {
@@ -2979,7 +3094,7 @@ const useLogger = () => {
2979
3094
  const OriginValidator = object({
2980
3095
  pluginId: string(),
2981
3096
  nodeId: string(),
2982
- version: pipe(optional(string()), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent."))
3097
+ version: optional(pipe(string(), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent.")))
2983
3098
  });
2984
3099
  const BlockActionValidatorV1 = object({
2985
3100
  type: literal("action"),
@@ -2992,7 +3107,7 @@ const EditorParamValidatorV3 = union([literal("simple"), literal("editor")]);
2992
3107
  const BlockActionValidatorV3 = object({
2993
3108
  type: literal("action"),
2994
3109
  uid: string(),
2995
- name: pipe(optional(string()), description("A custom name provided by the user")),
3110
+ name: optional(pipe(string(), description("A custom name provided by the user"))),
2996
3111
  disabled: optional(boolean()),
2997
3112
  params: record(string(), object({
2998
3113
  editor: EditorParamValidatorV3,
@@ -45292,35 +45407,6 @@ const createPathParam = (value, definition) => {
45292
45407
  };
45293
45408
  };
45294
45409
  //#endregion
45295
- //#region ../../packages/shared/src/save-location.ts
45296
- const SaveLocationInternalValidator = object({
45297
- id: string(),
45298
- project: string(),
45299
- lastModified: string(),
45300
- type: literal("internal"),
45301
- configName: string()
45302
- });
45303
- const SaveLocationValidator = union([
45304
- object({
45305
- id: string(),
45306
- project: string(),
45307
- path: string(),
45308
- lastModified: string(),
45309
- type: literal("external"),
45310
- summary: object({
45311
- plugins: array(string()),
45312
- name: string(),
45313
- description: string()
45314
- })
45315
- }),
45316
- SaveLocationInternalValidator,
45317
- object({
45318
- id: string(),
45319
- project: string(),
45320
- type: literal("pipelab-cloud")
45321
- })
45322
- ]);
45323
- //#endregion
45324
45410
  //#region ../../packages/shared/src/websocket.types.ts
45325
45411
  var WebSocketError = class extends Error {
45326
45412
  constructor(message, code, requestId) {
@@ -45337,20 +45423,6 @@ object({
45337
45423
  version: literal("1.0.0"),
45338
45424
  data: optional(record(string(), SaveLocationValidator), {})
45339
45425
  });
45340
- const FileRepoProjectValidatorV2$1 = object({
45341
- id: string(),
45342
- name: string(),
45343
- description: string()
45344
- });
45345
- object({
45346
- version: literal("2.0.0"),
45347
- projects: array(FileRepoProjectValidatorV2$1),
45348
- pipelines: optional(array(SaveLocationValidator), [])
45349
- });
45350
- object({
45351
- version: literal("1.0.0"),
45352
- data: optional(record(string(), SaveLocationValidator), {})
45353
- });
45354
45426
  const FileRepoProjectValidatorV2 = object({
45355
45427
  id: string(),
45356
45428
  name: string(),
@@ -45362,8 +45434,14 @@ object({
45362
45434
  pipelines: optional(array(SaveLocationValidator), [])
45363
45435
  });
45364
45436
  //#endregion
45437
+ //#region ../../packages/constants/src/index.ts
45438
+ const websocketPort = 33753;
45439
+ const DEFAULT_NODE_VERSION = "24.14.1";
45440
+ const DEFAULT_PNPM_VERSION = "10.12.0";
45441
+ //#endregion
45365
45442
  //#region ../../packages/core-node/src/context.ts
45366
- const _dirname = typeof __dirname !== "undefined" ? __dirname : require("url").pathToFileURL(__filename).href ? (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href)) : process.cwd();
45443
+ const metaUrl = require("url").pathToFileURL(__filename).href;
45444
+ const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? (0, node_path.dirname)((0, node_url.fileURLToPath)(metaUrl)) : process.cwd();
45367
45445
  const isDev = process.env.NODE_ENV === "development";
45368
45446
  /**
45369
45447
  * Finds the monorepo root by looking for pnpm-workspace.yaml.
@@ -48935,9 +49013,6 @@ const useAPI = () => {
48935
49013
  };
48936
49014
  };
48937
49015
  //#endregion
48938
- //#region ../../packages/constants/src/index.ts
48939
- const websocketPort = 33753;
48940
- //#endregion
48941
49016
  //#region ../../packages/core-node/src/websocket-server.ts
48942
49017
  var WebSocketServer = class {
48943
49018
  wss = null;
@@ -59946,14 +60021,14 @@ var require_path_reservations = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
59946
60021
  const assert$1 = require("assert");
59947
60022
  const normalize = require_normalize_unicode();
59948
60023
  const stripSlashes = require_strip_trailing_slashes();
59949
- const { join: join$19 } = require("path");
60024
+ const { join: join$20 } = require("path");
59950
60025
  const isWindows = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
59951
60026
  module.exports = () => {
59952
60027
  const queues = /* @__PURE__ */ new Map();
59953
60028
  const reservations = /* @__PURE__ */ new Map();
59954
60029
  const getDirs = (path$62) => {
59955
60030
  return path$62.split("/").slice(0, -1).reduce((set, path$63) => {
59956
- if (set.length) path$63 = join$19(set[set.length - 1], path$63);
60031
+ if (set.length) path$63 = join$20(set[set.length - 1], path$63);
59957
60032
  set.push(path$63 || "/");
59958
60033
  return set;
59959
60034
  }, []);
@@ -60007,7 +60082,7 @@ var require_path_reservations = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
60007
60082
  };
60008
60083
  const reserve = (paths, fn) => {
60009
60084
  paths = isWindows ? ["win32 parallelization disabled"] : paths.map((p) => {
60010
- return stripSlashes(join$19(normalize(p))).toLowerCase();
60085
+ return stripSlashes(join$20(normalize(p))).toLowerCase();
60011
60086
  });
60012
60087
  const dirs = new Set(paths.map((path$67) => getDirs(path$67)).reduce((a, b) => a.concat(b)));
60013
60088
  reservations.set(fn, {
@@ -89345,14 +89420,6 @@ var import_tar = /* @__PURE__ */ require_chunk.__toESM(require_tar$1(), 1);
89345
89420
  var import_yauzl = /* @__PURE__ */ require_chunk.__toESM(require_yauzl(), 1);
89346
89421
  require_archiver();
89347
89422
  /**
89348
- * Generates a unique temporary folder.
89349
- */
89350
- const generateTempFolder = async (base) => {
89351
- const targetBase = base || (0, node_os.tmpdir)();
89352
- await (0, node_fs_promises.mkdir)(targetBase, { recursive: true });
89353
- return await (0, node_fs_promises.mkdtemp)((0, node_path.join)(await (0, node_fs_promises.realpath)(targetBase), "pipelab-"));
89354
- };
89355
- /**
89356
89423
  * Extracts a .tar.gz archive.
89357
89424
  */
89358
89425
  async function extractTarGz(archivePath, destinationDir) {
@@ -95822,7 +95889,7 @@ var require_index_min$3 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
95822
95889
  //#region ../../node_modules/@npmcli/promise-spawn/node_modules/which/lib/index.js
95823
95890
  var require_lib$27 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
95824
95891
  const { isexe, sync: isexeSync } = require_index_min$3();
95825
- const { join: join$16, delimiter: delimiter$3, sep: sep$5, posix: posix$1 } = require("path");
95892
+ const { join: join$17, delimiter: delimiter$3, sep: sep$5, posix: posix$1 } = require("path");
95826
95893
  const isWindows = process.platform === "win32";
95827
95894
  /* istanbul ignore next */
95828
95895
  const rSlash = new RegExp(`[${posix$1.sep}${sep$5 === posix$1.sep ? "" : sep$5}]`.replace(/(\\)/g, "\\$1"));
@@ -95852,7 +95919,7 @@ var require_lib$27 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
95852
95919
  };
95853
95920
  const getPathPart = (raw, cmd) => {
95854
95921
  const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
95855
- return (!pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "") + join$16(pathPart, cmd);
95922
+ return (!pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "") + join$17(pathPart, cmd);
95856
95923
  };
95857
95924
  const which = async (cmd, opt = {}) => {
95858
95925
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
@@ -96601,7 +96668,7 @@ var require_index_min$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
96601
96668
  //#region ../../node_modules/@npmcli/git/node_modules/which/lib/index.js
96602
96669
  var require_lib$24 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
96603
96670
  const { isexe, sync: isexeSync } = require_index_min$2();
96604
- const { join: join$15, delimiter: delimiter$2, sep: sep$4, posix } = require("path");
96671
+ const { join: join$16, delimiter: delimiter$2, sep: sep$4, posix } = require("path");
96605
96672
  const isWindows = process.platform === "win32";
96606
96673
  /* istanbul ignore next */
96607
96674
  const rSlash = new RegExp(`[${posix.sep}${sep$4 === posix.sep ? "" : sep$4}]`.replace(/(\\)/g, "\\$1"));
@@ -96631,7 +96698,7 @@ var require_lib$24 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
96631
96698
  };
96632
96699
  const getPathPart = (raw, cmd) => {
96633
96700
  const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
96634
- return (!pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "") + join$15(pathPart, cmd);
96701
+ return (!pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "") + join$16(pathPart, cmd);
96635
96702
  };
96636
96703
  const which = async (cmd, opt = {}) => {
96637
96704
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
@@ -98529,7 +98596,7 @@ var require_lib$22 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
98529
98596
  //#endregion
98530
98597
  //#region ../../node_modules/npm-normalize-package-bin/lib/index.js
98531
98598
  var require_lib$21 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
98532
- const { join: join$14, basename: basename$6 } = require("path");
98599
+ const { join: join$15, basename: basename$6 } = require("path");
98533
98600
  const normalize = (pkg) => !pkg.bin ? removeBin(pkg) : typeof pkg.bin === "string" ? normalizeString(pkg) : Array.isArray(pkg.bin) ? normalizeArray(pkg) : typeof pkg.bin === "object" ? normalizeObject(pkg) : removeBin(pkg);
98534
98601
  const normalizeString = (pkg) => {
98535
98602
  if (!pkg.name) return removeBin(pkg);
@@ -98552,9 +98619,9 @@ var require_lib$21 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
98552
98619
  const clean = {};
98553
98620
  let hasBins = false;
98554
98621
  Object.keys(orig).forEach((binKey) => {
98555
- const base = join$14("/", basename$6(binKey.replace(/\\|:/g, "/"))).slice(1);
98622
+ const base = join$15("/", basename$6(binKey.replace(/\\|:/g, "/"))).slice(1);
98556
98623
  if (typeof orig[binKey] !== "string" || !base) return;
98557
- const binTarget = join$14("/", orig[binKey].replace(/\\/g, "/")).replace(/\\/g, "/").slice(1);
98624
+ const binTarget = join$15("/", orig[binKey].replace(/\\/g, "/")).replace(/\\/g, "/").slice(1);
98558
98625
  if (!binTarget) return;
98559
98626
  clean[base] = binTarget;
98560
98627
  hasBins = true;
@@ -100627,7 +100694,7 @@ var require_polyfill = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
100627
100694
  const { ERR_FS_CP_DIR_TO_NON_DIR, ERR_FS_CP_EEXIST, ERR_FS_CP_EINVAL, ERR_FS_CP_FIFO_PIPE, ERR_FS_CP_NON_DIR_TO_DIR, ERR_FS_CP_SOCKET, ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY, ERR_FS_CP_UNKNOWN, ERR_FS_EISDIR, ERR_INVALID_ARG_TYPE } = require_errors$3();
100628
100695
  const { constants: { errno: { EEXIST, EISDIR, EINVAL, ENOTDIR } } } = require("os");
100629
100696
  const { chmod: chmod$2, copyFile, lstat: lstat$2, mkdir: mkdir$7, readdir: readdir$6, readlink, stat: stat$5, symlink, unlink, utimes } = require("fs/promises");
100630
- const { dirname: dirname$8, isAbsolute: isAbsolute$2, join: join$13, parse, resolve: resolve$10, sep: sep$3, toNamespacedPath } = require("path");
100697
+ const { dirname: dirname$8, isAbsolute: isAbsolute$2, join: join$14, parse, resolve: resolve$10, sep: sep$3, toNamespacedPath } = require("path");
100631
100698
  const { fileURLToPath } = require("url");
100632
100699
  const defaultOptions = {
100633
100700
  dereference: false,
@@ -100836,8 +100903,8 @@ var require_polyfill = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
100836
100903
  const dir = await readdir$6(src);
100837
100904
  for (let i = 0; i < dir.length; i++) {
100838
100905
  const item = dir[i];
100839
- const srcItem = join$13(src, item);
100840
- const destItem = join$13(dest, item);
100906
+ const srcItem = join$14(src, item);
100907
+ const destItem = join$14(dest, item);
100841
100908
  const { destStat } = await checkPaths(srcItem, destItem, opts);
100842
100909
  await startCopy(destStat, srcItem, destItem, opts);
100843
100910
  }
@@ -100901,13 +100968,13 @@ var require_cp = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module)
100901
100968
  //#endregion
100902
100969
  //#region ../../node_modules/cacache/node_modules/@npmcli/fs/lib/with-temp-dir.js
100903
100970
  var require_with_temp_dir = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
100904
- const { join: join$12, sep: sep$2 } = require("path");
100971
+ const { join: join$13, sep: sep$2 } = require("path");
100905
100972
  const getOptions = require_get_options();
100906
100973
  const { mkdir: mkdir$6, mkdtemp, rm: rm$7 } = require("fs/promises");
100907
100974
  const withTempDir = async (root, fn, opts) => {
100908
100975
  const options = getOptions(opts, { copy: ["tmpPrefix"] });
100909
100976
  await mkdir$6(root, { recursive: true });
100910
- const target = await mkdtemp(join$12(`${root}${sep$2}`, options.tmpPrefix || ""));
100977
+ const target = await mkdtemp(join$13(`${root}${sep$2}`, options.tmpPrefix || ""));
100911
100978
  let err;
100912
100979
  let result;
100913
100980
  try {
@@ -100930,10 +100997,10 @@ var require_with_temp_dir = /* @__PURE__ */ require_chunk.__commonJSMin(((export
100930
100997
  //#region ../../node_modules/cacache/node_modules/@npmcli/fs/lib/readdir-scoped.js
100931
100998
  var require_readdir_scoped = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
100932
100999
  const { readdir: readdir$5 } = require("fs/promises");
100933
- const { join: join$11 } = require("path");
101000
+ const { join: join$12 } = require("path");
100934
101001
  const readdirScoped = async (dir) => {
100935
101002
  const results = [];
100936
- for (const item of await readdir$5(dir)) if (item.startsWith("@")) for (const scopedItem of await readdir$5(join$11(dir, item))) results.push(join$11(item, scopedItem));
101003
+ for (const item of await readdir$5(dir)) if (item.startsWith("@")) for (const scopedItem of await readdir$5(join$12(dir, item))) results.push(join$12(item, scopedItem));
100937
101004
  else results.push(item);
100938
101005
  return results;
100939
101006
  };
@@ -100942,7 +101009,7 @@ var require_readdir_scoped = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
100942
101009
  //#endregion
100943
101010
  //#region ../../node_modules/cacache/node_modules/@npmcli/fs/lib/move-file.js
100944
101011
  var require_move_file = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
100945
- const { dirname: dirname$7, join: join$10, resolve: resolve$9, relative: relative$1, isAbsolute: isAbsolute$1 } = require("path");
101012
+ const { dirname: dirname$7, join: join$11, resolve: resolve$9, relative: relative$1, isAbsolute: isAbsolute$1 } = require("path");
100946
101013
  const fs$12 = require("fs/promises");
100947
101014
  const pathExists = async (path$54) => {
100948
101015
  try {
@@ -100967,7 +101034,7 @@ var require_move_file = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
100967
101034
  const sourceStat = await fs$12.lstat(source);
100968
101035
  if (sourceStat.isDirectory()) {
100969
101036
  const files = await fs$12.readdir(source);
100970
- await Promise.all(files.map((file) => moveFile(join$10(source, file), join$10(destination, file), options, false, symlinks)));
101037
+ await Promise.all(files.map((file) => moveFile(join$11(source, file), join$11(destination, file), options, false, symlinks)));
100971
101038
  } else if (sourceStat.isSymbolicLink()) symlinks.push({
100972
101039
  source,
100973
101040
  destination
@@ -110506,9 +110573,9 @@ var require_protected = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
110506
110573
  //#region ../../node_modules/pacote/lib/util/cache-dir.js
110507
110574
  var require_cache_dir = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
110508
110575
  const { resolve: resolve$7 } = require("node:path");
110509
- const { tmpdir: tmpdir$2, homedir } = require("node:os");
110576
+ const { tmpdir, homedir } = require("node:os");
110510
110577
  module.exports = (fakePlatform = false) => {
110511
- const temp = tmpdir$2();
110578
+ const temp = tmpdir();
110512
110579
  const uidOrPid = process.getuid ? process.getuid() : process.pid;
110513
110580
  const home = homedir() || resolve$7(temp, "npm-" + uidOrPid);
110514
110581
  const platform = fakePlatform || process.platform;
@@ -112330,7 +112397,7 @@ var require_lib$10 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
112330
112397
  var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
112331
112398
  const { Walker: IgnoreWalker } = require_lib$10();
112332
112399
  const { lstatSync: lstat$1, readFileSync: readFile$4 } = require("fs");
112333
- const { basename: basename$4, dirname: dirname$5, extname: extname$1, join: join$9, relative, resolve: resolve$6, sep: sep$1 } = require("path");
112400
+ const { basename: basename$4, dirname: dirname$5, extname: extname$1, join: join$10, relative, resolve: resolve$6, sep: sep$1 } = require("path");
112334
112401
  const { log } = require_lib$29();
112335
112402
  const defaultRules = Symbol("npm-packlist.rules.default");
112336
112403
  const strictRules = Symbol("npm-packlist.rules.strict");
@@ -112363,7 +112430,7 @@ var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
112363
112430
  const normalizePath = (path$46) => path$46.split("\\").join("/");
112364
112431
  const readOutOfTreeIgnoreFiles = (root, rel, result = []) => {
112365
112432
  for (const file of [".npmignore", ".gitignore"]) try {
112366
- const ignoreContent = readFile$4(join$9(root, file), { encoding: "utf8" });
112433
+ const ignoreContent = readFile$4(join$10(root, file), { encoding: "utf8" });
112367
112434
  result.push(ignoreContent);
112368
112435
  break;
112369
112436
  } catch (err) {
@@ -112372,8 +112439,8 @@ var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
112372
112439
  }
112373
112440
  if (!rel) return result;
112374
112441
  const firstRel = rel.split(sep$1, 1)[0];
112375
- const newRoot = join$9(root, firstRel);
112376
- return readOutOfTreeIgnoreFiles(newRoot, relative(newRoot, join$9(root, rel)), result);
112442
+ const newRoot = join$10(root, firstRel);
112443
+ return readOutOfTreeIgnoreFiles(newRoot, relative(newRoot, join$10(root, rel)), result);
112377
112444
  };
112378
112445
  var PackWalker = class PackWalker extends IgnoreWalker {
112379
112446
  constructor(tree, opts) {
@@ -112440,7 +112507,7 @@ var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
112440
112507
  let ignoreFiles = null;
112441
112508
  if (this.tree.workspaces) {
112442
112509
  const workspaceDirs = [...this.tree.workspaces.values()].map((dir) => dir.replace(/\\/g, "/"));
112443
- const entryPath = join$9(this.path, entry).replace(/\\/g, "/");
112510
+ const entryPath = join$10(this.path, entry).replace(/\\/g, "/");
112444
112511
  if (workspaceDirs.includes(entryPath)) ignoreFiles = [
112445
112512
  defaultRules,
112446
112513
  "package.json",
@@ -112500,7 +112567,7 @@ var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
112500
112567
  if (file.endsWith("/*")) file += "*";
112501
112568
  const inverse = `!${file}`;
112502
112569
  try {
112503
- const stat = lstat$1(join$9(this.path, file.replace(/^!+/, "")).replace(/\\/g, "/"));
112570
+ const stat = lstat$1(join$10(this.path, file.replace(/^!+/, "")).replace(/\\/g, "/"));
112504
112571
  if (stat.isFile()) {
112505
112572
  strict.unshift(inverse);
112506
112573
  this.requiredFiles.push(file.startsWith("/") ? file.slice(1) : file);
@@ -112557,7 +112624,7 @@ var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
112557
112624
  walker.start();
112558
112625
  });
112559
112626
  const relativeFrom = relative(this.root, walker.path);
112560
- for (const file of bundled) this.result.add(join$9(relativeFrom, file).replace(/\\/g, "/"));
112627
+ for (const file of bundled) this.result.add(join$10(relativeFrom, file).replace(/\\/g, "/"));
112561
112628
  }
112562
112629
  }
112563
112630
  };
@@ -123758,7 +123825,7 @@ var require_auth = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
123758
123825
  //#endregion
123759
123826
  //#region ../../node_modules/make-fetch-happen/lib/options.js
123760
123827
  var require_options$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
123761
- const dns$2 = require("dns");
123828
+ const dns$3 = require("dns");
123762
123829
  const conditionalHeaders = [
123763
123830
  "if-modified-since",
123764
123831
  "if-none-match",
@@ -123783,7 +123850,7 @@ var require_options$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
123783
123850
  };
123784
123851
  options.dns = {
123785
123852
  ttl: 300 * 1e3,
123786
- lookup: dns$2.lookup,
123853
+ lookup: dns$3.lookup,
123787
123854
  ...options.dns
123788
123855
  };
123789
123856
  options.cache = options.cache || "default";
@@ -125200,9 +125267,9 @@ var require_key$3 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
125200
125267
  //#region ../../node_modules/@npmcli/agent/lib/dns.js
125201
125268
  var require_dns = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
125202
125269
  const { LRUCache } = require_index_min$5();
125203
- const dns$1 = require("dns");
125270
+ const dns$2 = require("dns");
125204
125271
  const cache = new LRUCache({ max: 50 });
125205
- const getOptions = ({ family = 0, hints = dns$1.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$1.lookup }) => ({
125272
+ const getOptions = ({ family = 0, hints = dns$2.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$2.lookup }) => ({
125206
125273
  hints,
125207
125274
  lookup: (hostname, ...args) => {
125208
125275
  const callback = args.pop();
@@ -130241,7 +130308,7 @@ var require_dist$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
130241
130308
  const socks_1 = require_build$1();
130242
130309
  const agent_base_1 = require_dist$12();
130243
130310
  const debug_1 = __importDefault(require_src$1());
130244
- const dns = __importStar(require("dns"));
130311
+ const dns$1 = __importStar(require("dns"));
130245
130312
  const net$1 = __importStar(require("net"));
130246
130313
  const tls$1 = __importStar(require("tls"));
130247
130314
  const url_1$1 = require("url");
@@ -130313,7 +130380,7 @@ var require_dist$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
130313
130380
  const { shouldLookup, proxy, timeout } = this;
130314
130381
  if (!opts.host) throw new Error("No `host` defined!");
130315
130382
  let { host } = opts;
130316
- const { port, lookup: lookupFn = dns.lookup } = opts;
130383
+ const { port, lookup: lookupFn = dns$1.lookup } = opts;
130317
130384
  if (shouldLookup) host = await new Promise((resolve, reject) => {
130318
130385
  lookupFn(host, {}, (err, res) => {
130319
130386
  if (err) reject(err);
@@ -151042,8 +151109,6 @@ const sendStartupProgress = (message) => {
151042
151109
  };
151043
151110
  //#endregion
151044
151111
  //#region ../../packages/core-node/src/utils/remote.ts
151045
- const DEFAULT_NODE_VERSION = "24.14.1";
151046
- const DEFAULT_PNPM_VERSION = "10.12.0";
151047
151112
  function isPackageComplete(packageDir) {
151048
151113
  return (0, node_fs.existsSync)((0, node_path.join)(packageDir, "package.json"));
151049
151114
  }
@@ -151084,6 +151149,20 @@ async function withLock(key, fn) {
151084
151149
  activeOperations.set(key, promise);
151085
151150
  return promise;
151086
151151
  }
151152
+ let isOnlineCached = null;
151153
+ let lastCheckTime = 0;
151154
+ async function isOnline() {
151155
+ const now = Date.now();
151156
+ if (isOnlineCached !== null && now - lastCheckTime < 1e4) return isOnlineCached;
151157
+ try {
151158
+ await Promise.race([node_dns_promises.default.lookup("registry.npmjs.org"), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("timeout")), 1500))]);
151159
+ isOnlineCached = true;
151160
+ } catch {
151161
+ isOnlineCached = false;
151162
+ }
151163
+ lastCheckTime = now;
151164
+ return isOnlineCached;
151165
+ }
151087
151166
  /**
151088
151167
  * Robust utility to fetch, cache, and resolve an NPM package.
151089
151168
  * Centralized in core-node to avoid circular dependencies.
@@ -151110,7 +151189,15 @@ async function fetchPackage(packageName, versionOrRange, options) {
151110
151189
  if (resolvedVersionOrRange === "local") resolvedVersionOrRange = "latest";
151111
151190
  console.log(`[Fetcher] Resolving ${packageName}@${resolvedVersionOrRange || "latest"}...`);
151112
151191
  const resolveStart = Date.now();
151113
- try {
151192
+ if (!await isOnline()) {
151193
+ console.warn(`[Fetcher] ${packageName}: offline mode detected (${Date.now() - resolveStart}ms), trying local fallback...`);
151194
+ const fallbackStart = Date.now();
151195
+ const fallbackVersion = await tryLocalFallback(resolvedVersionOrRange, /* @__PURE__ */ new Error("Offline"), baseDir, packageName);
151196
+ if (fallbackVersion) {
151197
+ resolvedVersion = fallbackVersion;
151198
+ console.log(`[Fetcher] ${packageName}: Resolved to local fallback ${resolvedVersion} (${Date.now() - fallbackStart}ms)`);
151199
+ } else throw new Error(`Offline and no local fallback version available for ${packageName}`);
151200
+ } else try {
151114
151201
  const cachePath = (0, node_path.join)(ctx.userDataPath, "cache", "pacote");
151115
151202
  let packumentPromise = packumentRequests.get(packageName);
151116
151203
  if (!packumentPromise) {
@@ -151120,7 +151207,16 @@ async function fetchPackage(packageName, versionOrRange, options) {
151120
151207
  const packument = await packumentPromise;
151121
151208
  const versions = Object.keys(packument.versions);
151122
151209
  const range = resolvedVersionOrRange || "latest";
151123
- const foundVersion = packument["dist-tags"]?.[range] || import_semver.default.maxSatisfying(versions, range);
151210
+ let foundVersion = packument["dist-tags"]?.[range] || import_semver.default.maxSatisfying(versions, range);
151211
+ if (range === "latest" && ctx.releaseTag && ctx.releaseTag !== "latest") {
151212
+ const releaseTagVersion = packument["dist-tags"]?.[ctx.releaseTag];
151213
+ if (releaseTagVersion && import_semver.default.valid(releaseTagVersion)) {
151214
+ if (!foundVersion || import_semver.default.valid(foundVersion) && import_semver.default.gte(releaseTagVersion, foundVersion)) {
151215
+ console.log(`[Fetcher] Using release tag "${ctx.releaseTag}" (${releaseTagVersion}) instead of "latest" (${foundVersion || "none"}) for ${packageName}`);
151216
+ foundVersion = releaseTagVersion;
151217
+ } else if (foundVersion) console.warn(`[Fetcher] Tag "${ctx.releaseTag}" (${releaseTagVersion}) is older than "latest" (${foundVersion}) for ${packageName}, keeping "latest"`);
151218
+ }
151219
+ }
151124
151220
  if (!foundVersion) throw new Error(`Package ${packageName}@${range} not found on npm (available tags: ${Object.keys(packument["dist-tags"] || {}).join(", ")})`);
151125
151221
  resolvedVersion = foundVersion;
151126
151222
  console.log(`[Fetcher] ${packageName}: Resolved to v${resolvedVersion} via npm (${Date.now() - resolveStart}ms)`);
@@ -151235,7 +151331,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
151235
151331
  const extension = isWindows ? "zip" : "tar.gz";
151236
151332
  const fileName = `node-v${version}-${platform === "osx" ? "darwin" : platform}-${arch}.${extension}`;
151237
151333
  const downloadUrl = `https://nodejs.org/dist/v${version}/${fileName}`;
151238
- const tempDir = await generateTempFolder((0, node_os.tmpdir)());
151334
+ const tempDir = await context.createTempFolder("node-download-");
151239
151335
  const archivePath = (0, node_path.join)(tempDir, fileName);
151240
151336
  sendStartupProgress(`Downloading Node.js v${version}...`);
151241
151337
  console.log(`Downloading Node.js from ${downloadUrl}...`);
@@ -151445,7 +151541,7 @@ async function resolveEntryPoint(packageDir, packageName) {
151445
151541
  }
151446
151542
  //#endregion
151447
151543
  //#region ../../packages/core-node/src/handler-func.ts
151448
- const { join: join$7 } = node_path.default;
151544
+ const { join: join$8 } = node_path.default;
151449
151545
  //#endregion
151450
151546
  //#region ../../packages/core-node/src/handlers/plugins.ts
151451
151547
  const localPluginsMap = /* @__PURE__ */ new Map();
@@ -152744,12 +152840,23 @@ const packageV2Runner = createActionRunner(async ({ inputs, cwd, paths, log, set
152744
152840
  });
152745
152841
  //#endregion
152746
152842
  //#region src/index.ts
152747
- var src_default = createNodeDefinition({ nodes: [{
152748
- node: createPackageProps(IDPackage, "Package as Discord Activity", "Package your app as a Discord Activity", "", "`Package app from ${fmt.param(params['input-folder'], 'primary', 'Input folder not set')}`", false, false, void 0, false, false),
152749
- runner: packageV2Runner
152750
- }, {
152751
- node: createPreviewProps(IDPreview, "Preview Discord Acitivity app", "Package and preview your app as a Discord Activity", "", "`Preview app from ${fmt.param(params['input-folder'], 'primary', 'Input folder not set')}`"),
152752
- runner: previewRunner
152753
- }] });
152843
+ var src_default = createNodeDefinition({
152844
+ nodes: [{
152845
+ node: createPackageProps(IDPackage, "Package as Discord Activity", "Package your app as a Discord Activity", "", "`Package app from ${fmt.param(params['input-folder'], 'primary', 'Input folder not set')}`", false, false, void 0, false, false),
152846
+ runner: packageV2Runner
152847
+ }, {
152848
+ node: createPreviewProps(IDPreview, "Preview Discord Acitivity app", "Package and preview your app as a Discord Activity", "", "`Preview app from ${fmt.param(params['input-folder'], 'primary', 'Input folder not set')}`"),
152849
+ runner: previewRunner
152850
+ }],
152851
+ integrations: [{
152852
+ name: "Discord Connection",
152853
+ fields: [{
152854
+ key: "apiKey",
152855
+ label: "Webhook URL",
152856
+ type: "text",
152857
+ placeholder: "https://discord.com/api/webhooks/..."
152858
+ }]
152859
+ }]
152860
+ });
152754
152861
  //#endregion
152755
152862
  module.exports = src_default;