@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 +217 -110
- package/dist/index.mjs +192 -86
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -5
package/dist/index.mjs
CHANGED
|
@@ -4,11 +4,11 @@ import { basename, join, normalize } from "path";
|
|
|
4
4
|
import { formatWithOptions, types } from "util";
|
|
5
5
|
import path$1, { basename as basename$1, delimiter, dirname, join as join$1, sep } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { constants
|
|
7
|
+
import { constants } from "node:os";
|
|
8
8
|
import { appendFileSync, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { access, chmod, cp, mkdir, readFile, readdir, rename, rm, writeFile } 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, readdir, realpath, rename, rm, writeFile } 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, formatWithOptions as formatWithOptions$1, inspect, promisify, stripVTControlCharacters } from "node:util";
|
|
@@ -21,6 +21,7 @@ import { serialize } from "node:v8";
|
|
|
21
21
|
import { finished, pipeline } from "node:stream/promises";
|
|
22
22
|
import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
|
|
23
23
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
24
|
+
import dns from "node:dns/promises";
|
|
24
25
|
import { cp as cp$1 } from "fs/promises";
|
|
25
26
|
//#region ../../packages/migration/src/models/createMigration.ts
|
|
26
27
|
function createMigration$1(migration) {
|
|
@@ -1597,6 +1598,56 @@ function literal(literal_, message) {
|
|
|
1597
1598
|
}
|
|
1598
1599
|
};
|
|
1599
1600
|
}
|
|
1601
|
+
function looseObject(entries, message) {
|
|
1602
|
+
return {
|
|
1603
|
+
kind: "schema",
|
|
1604
|
+
type: "loose_object",
|
|
1605
|
+
reference: looseObject,
|
|
1606
|
+
expects: "Object",
|
|
1607
|
+
async: false,
|
|
1608
|
+
entries,
|
|
1609
|
+
message,
|
|
1610
|
+
_run(dataset, config2) {
|
|
1611
|
+
const input = dataset.value;
|
|
1612
|
+
if (input && typeof input === "object") {
|
|
1613
|
+
dataset.typed = true;
|
|
1614
|
+
dataset.value = {};
|
|
1615
|
+
for (const key in this.entries) {
|
|
1616
|
+
const value2 = input[key];
|
|
1617
|
+
const valueDataset = this.entries[key]._run({
|
|
1618
|
+
typed: false,
|
|
1619
|
+
value: value2
|
|
1620
|
+
}, config2);
|
|
1621
|
+
if (valueDataset.issues) {
|
|
1622
|
+
const pathItem = {
|
|
1623
|
+
type: "object",
|
|
1624
|
+
origin: "value",
|
|
1625
|
+
input,
|
|
1626
|
+
key,
|
|
1627
|
+
value: value2
|
|
1628
|
+
};
|
|
1629
|
+
for (const issue of valueDataset.issues) {
|
|
1630
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
1631
|
+
else issue.path = [pathItem];
|
|
1632
|
+
dataset.issues?.push(issue);
|
|
1633
|
+
}
|
|
1634
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
1635
|
+
if (config2.abortEarly) {
|
|
1636
|
+
dataset.typed = false;
|
|
1637
|
+
break;
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
1641
|
+
if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
|
|
1642
|
+
}
|
|
1643
|
+
if (!dataset.issues || !config2.abortEarly) {
|
|
1644
|
+
for (const key in input) if (_isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
|
|
1645
|
+
}
|
|
1646
|
+
} else _addIssue(this, "type", dataset, config2);
|
|
1647
|
+
return dataset;
|
|
1648
|
+
}
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1600
1651
|
function number(message) {
|
|
1601
1652
|
return {
|
|
1602
1653
|
kind: "schema",
|
|
@@ -2134,6 +2185,18 @@ settingsMigratorInternal.createMigrations({
|
|
|
2134
2185
|
})
|
|
2135
2186
|
]
|
|
2136
2187
|
});
|
|
2188
|
+
const connectionsMigratorInternal = createMigrator();
|
|
2189
|
+
const defaultConnections = connectionsMigratorInternal.createDefault({
|
|
2190
|
+
version: "1.0.0",
|
|
2191
|
+
connections: []
|
|
2192
|
+
});
|
|
2193
|
+
connectionsMigratorInternal.createMigrations({
|
|
2194
|
+
defaultValue: defaultConnections,
|
|
2195
|
+
migrations: [createMigration({
|
|
2196
|
+
version: "1.0.0",
|
|
2197
|
+
up: finalVersion
|
|
2198
|
+
})]
|
|
2199
|
+
});
|
|
2137
2200
|
const fileRepoMigratorInternal = createMigrator();
|
|
2138
2201
|
const defaultFileRepo = fileRepoMigratorInternal.createDefault({
|
|
2139
2202
|
version: "2.0.0",
|
|
@@ -2295,11 +2358,51 @@ const LEGACY_ID_MAP = {
|
|
|
2295
2358
|
};
|
|
2296
2359
|
const getStrictPluginId = (pluginId) => {
|
|
2297
2360
|
if (!pluginId) return pluginId;
|
|
2298
|
-
|
|
2299
|
-
if (pluginId.startsWith("@") || pluginId.includes("/") || pluginId.startsWith("pipelab-plugin-")) return pluginId;
|
|
2300
|
-
const prefixed = `@pipelab/plugin-${pluginId}`;
|
|
2301
|
-
return LEGACY_ID_MAP[prefixed] || prefixed;
|
|
2361
|
+
return LEGACY_ID_MAP[pluginId] || pluginId;
|
|
2302
2362
|
};
|
|
2363
|
+
//#endregion
|
|
2364
|
+
//#region ../../packages/shared/src/save-location.ts
|
|
2365
|
+
const SaveLocationInternalValidator = object({
|
|
2366
|
+
id: string(),
|
|
2367
|
+
project: string(),
|
|
2368
|
+
lastModified: string(),
|
|
2369
|
+
type: literal("internal"),
|
|
2370
|
+
configName: string()
|
|
2371
|
+
});
|
|
2372
|
+
const SaveLocationValidator = union([
|
|
2373
|
+
object({
|
|
2374
|
+
id: string(),
|
|
2375
|
+
project: string(),
|
|
2376
|
+
path: string(),
|
|
2377
|
+
lastModified: string(),
|
|
2378
|
+
type: literal("external"),
|
|
2379
|
+
summary: object({
|
|
2380
|
+
plugins: array(string()),
|
|
2381
|
+
name: string(),
|
|
2382
|
+
description: string()
|
|
2383
|
+
})
|
|
2384
|
+
}),
|
|
2385
|
+
SaveLocationInternalValidator,
|
|
2386
|
+
object({
|
|
2387
|
+
id: string(),
|
|
2388
|
+
project: string(),
|
|
2389
|
+
type: literal("pipelab-cloud")
|
|
2390
|
+
})
|
|
2391
|
+
]);
|
|
2392
|
+
object({
|
|
2393
|
+
version: literal("1.0.0"),
|
|
2394
|
+
data: optional(record(string(), SaveLocationValidator), {})
|
|
2395
|
+
});
|
|
2396
|
+
const FileRepoProjectValidatorV2$1 = object({
|
|
2397
|
+
id: string(),
|
|
2398
|
+
name: string(),
|
|
2399
|
+
description: string()
|
|
2400
|
+
});
|
|
2401
|
+
object({
|
|
2402
|
+
version: literal("2.0.0"),
|
|
2403
|
+
projects: array(FileRepoProjectValidatorV2$1),
|
|
2404
|
+
pipelines: optional(array(SaveLocationValidator), [])
|
|
2405
|
+
});
|
|
2303
2406
|
object({
|
|
2304
2407
|
cacheFolder: string(),
|
|
2305
2408
|
theme: union([literal("light"), literal("dark")]),
|
|
@@ -2451,6 +2554,17 @@ object({
|
|
|
2451
2554
|
})),
|
|
2452
2555
|
isInternalMigrationBannerClosed: optional(boolean(), false)
|
|
2453
2556
|
});
|
|
2557
|
+
const ConnectionValidator = looseObject({
|
|
2558
|
+
id: string(),
|
|
2559
|
+
pluginName: string(),
|
|
2560
|
+
name: string(),
|
|
2561
|
+
createdAt: string(),
|
|
2562
|
+
isDefault: boolean()
|
|
2563
|
+
});
|
|
2564
|
+
object({
|
|
2565
|
+
version: literal("1.0.0"),
|
|
2566
|
+
connections: array(ConnectionValidator)
|
|
2567
|
+
});
|
|
2454
2568
|
//#endregion
|
|
2455
2569
|
//#region ../../node_modules/tslog/dist/esm/prettyLogStyles.js
|
|
2456
2570
|
const prettyLogStyles = {
|
|
@@ -2971,7 +3085,7 @@ const useLogger = () => {
|
|
|
2971
3085
|
const OriginValidator = object({
|
|
2972
3086
|
pluginId: string(),
|
|
2973
3087
|
nodeId: string(),
|
|
2974
|
-
version: pipe(
|
|
3088
|
+
version: optional(pipe(string(), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent.")))
|
|
2975
3089
|
});
|
|
2976
3090
|
const BlockActionValidatorV1 = object({
|
|
2977
3091
|
type: literal("action"),
|
|
@@ -2984,7 +3098,7 @@ const EditorParamValidatorV3 = union([literal("simple"), literal("editor")]);
|
|
|
2984
3098
|
const BlockActionValidatorV3 = object({
|
|
2985
3099
|
type: literal("action"),
|
|
2986
3100
|
uid: string(),
|
|
2987
|
-
name: pipe(
|
|
3101
|
+
name: optional(pipe(string(), description("A custom name provided by the user"))),
|
|
2988
3102
|
disabled: optional(boolean()),
|
|
2989
3103
|
params: record(string(), object({
|
|
2990
3104
|
editor: EditorParamValidatorV3,
|
|
@@ -45284,35 +45398,6 @@ const createPathParam = (value, definition) => {
|
|
|
45284
45398
|
};
|
|
45285
45399
|
};
|
|
45286
45400
|
//#endregion
|
|
45287
|
-
//#region ../../packages/shared/src/save-location.ts
|
|
45288
|
-
const SaveLocationInternalValidator = object({
|
|
45289
|
-
id: string(),
|
|
45290
|
-
project: string(),
|
|
45291
|
-
lastModified: string(),
|
|
45292
|
-
type: literal("internal"),
|
|
45293
|
-
configName: string()
|
|
45294
|
-
});
|
|
45295
|
-
const SaveLocationValidator = union([
|
|
45296
|
-
object({
|
|
45297
|
-
id: string(),
|
|
45298
|
-
project: string(),
|
|
45299
|
-
path: string(),
|
|
45300
|
-
lastModified: string(),
|
|
45301
|
-
type: literal("external"),
|
|
45302
|
-
summary: object({
|
|
45303
|
-
plugins: array(string()),
|
|
45304
|
-
name: string(),
|
|
45305
|
-
description: string()
|
|
45306
|
-
})
|
|
45307
|
-
}),
|
|
45308
|
-
SaveLocationInternalValidator,
|
|
45309
|
-
object({
|
|
45310
|
-
id: string(),
|
|
45311
|
-
project: string(),
|
|
45312
|
-
type: literal("pipelab-cloud")
|
|
45313
|
-
})
|
|
45314
|
-
]);
|
|
45315
|
-
//#endregion
|
|
45316
45401
|
//#region ../../packages/shared/src/websocket.types.ts
|
|
45317
45402
|
var WebSocketError = class extends Error {
|
|
45318
45403
|
constructor(message, code, requestId) {
|
|
@@ -45329,20 +45414,6 @@ object({
|
|
|
45329
45414
|
version: literal("1.0.0"),
|
|
45330
45415
|
data: optional(record(string(), SaveLocationValidator), {})
|
|
45331
45416
|
});
|
|
45332
|
-
const FileRepoProjectValidatorV2$1 = object({
|
|
45333
|
-
id: string(),
|
|
45334
|
-
name: string(),
|
|
45335
|
-
description: string()
|
|
45336
|
-
});
|
|
45337
|
-
object({
|
|
45338
|
-
version: literal("2.0.0"),
|
|
45339
|
-
projects: array(FileRepoProjectValidatorV2$1),
|
|
45340
|
-
pipelines: optional(array(SaveLocationValidator), [])
|
|
45341
|
-
});
|
|
45342
|
-
object({
|
|
45343
|
-
version: literal("1.0.0"),
|
|
45344
|
-
data: optional(record(string(), SaveLocationValidator), {})
|
|
45345
|
-
});
|
|
45346
45417
|
const FileRepoProjectValidatorV2 = object({
|
|
45347
45418
|
id: string(),
|
|
45348
45419
|
name: string(),
|
|
@@ -45362,9 +45433,15 @@ var init_esm_shims = __esmMin((() => {
|
|
|
45362
45433
|
__dirname = /* @__PURE__ */ getDirname();
|
|
45363
45434
|
}));
|
|
45364
45435
|
//#endregion
|
|
45365
|
-
//#region ../../packages/
|
|
45436
|
+
//#region ../../packages/constants/src/index.ts
|
|
45366
45437
|
init_esm_shims();
|
|
45367
|
-
const
|
|
45438
|
+
const websocketPort = 33753;
|
|
45439
|
+
const DEFAULT_NODE_VERSION = "24.14.1";
|
|
45440
|
+
const DEFAULT_PNPM_VERSION = "10.12.0";
|
|
45441
|
+
//#endregion
|
|
45442
|
+
//#region ../../packages/core-node/src/context.ts
|
|
45443
|
+
const metaUrl = typeof import.meta !== "undefined" ? import.meta.url : void 0;
|
|
45444
|
+
const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? dirname(fileURLToPath(metaUrl)) : process.cwd();
|
|
45368
45445
|
const isDev = process.env.NODE_ENV === "development";
|
|
45369
45446
|
/**
|
|
45370
45447
|
* Finds the monorepo root by looking for pnpm-workspace.yaml.
|
|
@@ -48936,9 +49013,6 @@ const useAPI = () => {
|
|
|
48936
49013
|
};
|
|
48937
49014
|
};
|
|
48938
49015
|
//#endregion
|
|
48939
|
-
//#region ../../packages/constants/src/index.ts
|
|
48940
|
-
const websocketPort = 33753;
|
|
48941
|
-
//#endregion
|
|
48942
49016
|
//#region ../../packages/core-node/src/websocket-server.ts
|
|
48943
49017
|
var WebSocketServer = class {
|
|
48944
49018
|
wss = null;
|
|
@@ -89343,14 +89417,6 @@ var import_tar = /* @__PURE__ */ __toESM(require_tar$1(), 1);
|
|
|
89343
89417
|
var import_yauzl = /* @__PURE__ */ __toESM(require_yauzl(), 1);
|
|
89344
89418
|
require_archiver();
|
|
89345
89419
|
/**
|
|
89346
|
-
* Generates a unique temporary folder.
|
|
89347
|
-
*/
|
|
89348
|
-
const generateTempFolder = async (base) => {
|
|
89349
|
-
const targetBase = base || tmpdir();
|
|
89350
|
-
await mkdir(targetBase, { recursive: true });
|
|
89351
|
-
return await mkdtemp(join$1(await realpath(targetBase), "pipelab-"));
|
|
89352
|
-
};
|
|
89353
|
-
/**
|
|
89354
89420
|
* Extracts a .tar.gz archive.
|
|
89355
89421
|
*/
|
|
89356
89422
|
async function extractTarGz(archivePath, destinationDir) {
|
|
@@ -100901,11 +100967,11 @@ var require_cp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
100901
100967
|
var require_with_temp_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
100902
100968
|
const { join: join$6, sep: sep$2 } = __require("path");
|
|
100903
100969
|
const getOptions = require_get_options();
|
|
100904
|
-
const { mkdir: mkdir$4, mkdtemp
|
|
100970
|
+
const { mkdir: mkdir$4, mkdtemp, rm: rm$5 } = __require("fs/promises");
|
|
100905
100971
|
const withTempDir = async (root, fn, opts) => {
|
|
100906
100972
|
const options = getOptions(opts, { copy: ["tmpPrefix"] });
|
|
100907
100973
|
await mkdir$4(root, { recursive: true });
|
|
100908
|
-
const target = await mkdtemp
|
|
100974
|
+
const target = await mkdtemp(join$6(`${root}${sep$2}`, options.tmpPrefix || ""));
|
|
100909
100975
|
let err;
|
|
100910
100976
|
let result;
|
|
100911
100977
|
try {
|
|
@@ -123757,7 +123823,7 @@ var require_auth = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
123757
123823
|
//#endregion
|
|
123758
123824
|
//#region ../../node_modules/make-fetch-happen/lib/options.js
|
|
123759
123825
|
var require_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
123760
|
-
const dns$
|
|
123826
|
+
const dns$3 = __require("dns");
|
|
123761
123827
|
const conditionalHeaders = [
|
|
123762
123828
|
"if-modified-since",
|
|
123763
123829
|
"if-none-match",
|
|
@@ -123782,7 +123848,7 @@ var require_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
123782
123848
|
};
|
|
123783
123849
|
options.dns = {
|
|
123784
123850
|
ttl: 300 * 1e3,
|
|
123785
|
-
lookup: dns$
|
|
123851
|
+
lookup: dns$3.lookup,
|
|
123786
123852
|
...options.dns
|
|
123787
123853
|
};
|
|
123788
123854
|
options.cache = options.cache || "default";
|
|
@@ -125199,9 +125265,9 @@ var require_key$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
125199
125265
|
//#region ../../node_modules/@npmcli/agent/lib/dns.js
|
|
125200
125266
|
var require_dns = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
125201
125267
|
const { LRUCache } = require_index_min$5();
|
|
125202
|
-
const dns$
|
|
125268
|
+
const dns$2 = __require("dns");
|
|
125203
125269
|
const cache = new LRUCache({ max: 50 });
|
|
125204
|
-
const getOptions = ({ family = 0, hints = dns$
|
|
125270
|
+
const getOptions = ({ family = 0, hints = dns$2.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$2.lookup }) => ({
|
|
125205
125271
|
hints,
|
|
125206
125272
|
lookup: (hostname, ...args) => {
|
|
125207
125273
|
const callback = args.pop();
|
|
@@ -130240,7 +130306,7 @@ var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
130240
130306
|
const socks_1 = require_build$1();
|
|
130241
130307
|
const agent_base_1 = require_dist$12();
|
|
130242
130308
|
const debug_1 = __importDefault(require_src$1());
|
|
130243
|
-
const dns = __importStar(__require("dns"));
|
|
130309
|
+
const dns$1 = __importStar(__require("dns"));
|
|
130244
130310
|
const net$1 = __importStar(__require("net"));
|
|
130245
130311
|
const tls$1 = __importStar(__require("tls"));
|
|
130246
130312
|
const url_1$1 = __require("url");
|
|
@@ -130312,7 +130378,7 @@ var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
130312
130378
|
const { shouldLookup, proxy, timeout } = this;
|
|
130313
130379
|
if (!opts.host) throw new Error("No `host` defined!");
|
|
130314
130380
|
let { host } = opts;
|
|
130315
|
-
const { port, lookup: lookupFn = dns.lookup } = opts;
|
|
130381
|
+
const { port, lookup: lookupFn = dns$1.lookup } = opts;
|
|
130316
130382
|
if (shouldLookup) host = await new Promise((resolve, reject) => {
|
|
130317
130383
|
lookupFn(host, {}, (err, res) => {
|
|
130318
130384
|
if (err) reject(err);
|
|
@@ -150579,7 +150645,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
150579
150645
|
const { promisify: promisify$1 } = __require("util");
|
|
150580
150646
|
const path = __require("path");
|
|
150581
150647
|
const { createHash } = __require("crypto");
|
|
150582
|
-
const { realpath
|
|
150648
|
+
const { realpath, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
|
|
150583
150649
|
const url = __require("url");
|
|
150584
150650
|
const slasher = require_glob_slash();
|
|
150585
150651
|
const minimatch = require_minimatch();
|
|
@@ -150902,7 +150968,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
150902
150968
|
};
|
|
150903
150969
|
const getHandlers = (methods) => Object.assign({
|
|
150904
150970
|
lstat: promisify$1(lstat),
|
|
150905
|
-
realpath: promisify$1(realpath
|
|
150971
|
+
realpath: promisify$1(realpath),
|
|
150906
150972
|
createReadStream: createReadStream$1,
|
|
150907
150973
|
readdir: promisify$1(readdir$1),
|
|
150908
150974
|
sendError
|
|
@@ -151041,8 +151107,6 @@ const sendStartupProgress = (message) => {
|
|
|
151041
151107
|
};
|
|
151042
151108
|
//#endregion
|
|
151043
151109
|
//#region ../../packages/core-node/src/utils/remote.ts
|
|
151044
|
-
const DEFAULT_NODE_VERSION = "24.14.1";
|
|
151045
|
-
const DEFAULT_PNPM_VERSION = "10.12.0";
|
|
151046
151110
|
function isPackageComplete(packageDir) {
|
|
151047
151111
|
return existsSync(join$1(packageDir, "package.json"));
|
|
151048
151112
|
}
|
|
@@ -151083,6 +151147,20 @@ async function withLock(key, fn) {
|
|
|
151083
151147
|
activeOperations.set(key, promise);
|
|
151084
151148
|
return promise;
|
|
151085
151149
|
}
|
|
151150
|
+
let isOnlineCached = null;
|
|
151151
|
+
let lastCheckTime = 0;
|
|
151152
|
+
async function isOnline() {
|
|
151153
|
+
const now = Date.now();
|
|
151154
|
+
if (isOnlineCached !== null && now - lastCheckTime < 1e4) return isOnlineCached;
|
|
151155
|
+
try {
|
|
151156
|
+
await Promise.race([dns.lookup("registry.npmjs.org"), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("timeout")), 1500))]);
|
|
151157
|
+
isOnlineCached = true;
|
|
151158
|
+
} catch {
|
|
151159
|
+
isOnlineCached = false;
|
|
151160
|
+
}
|
|
151161
|
+
lastCheckTime = now;
|
|
151162
|
+
return isOnlineCached;
|
|
151163
|
+
}
|
|
151086
151164
|
/**
|
|
151087
151165
|
* Robust utility to fetch, cache, and resolve an NPM package.
|
|
151088
151166
|
* Centralized in core-node to avoid circular dependencies.
|
|
@@ -151109,7 +151187,15 @@ async function fetchPackage(packageName, versionOrRange, options) {
|
|
|
151109
151187
|
if (resolvedVersionOrRange === "local") resolvedVersionOrRange = "latest";
|
|
151110
151188
|
console.log(`[Fetcher] Resolving ${packageName}@${resolvedVersionOrRange || "latest"}...`);
|
|
151111
151189
|
const resolveStart = Date.now();
|
|
151112
|
-
|
|
151190
|
+
if (!await isOnline()) {
|
|
151191
|
+
console.warn(`[Fetcher] ${packageName}: offline mode detected (${Date.now() - resolveStart}ms), trying local fallback...`);
|
|
151192
|
+
const fallbackStart = Date.now();
|
|
151193
|
+
const fallbackVersion = await tryLocalFallback(resolvedVersionOrRange, /* @__PURE__ */ new Error("Offline"), baseDir, packageName);
|
|
151194
|
+
if (fallbackVersion) {
|
|
151195
|
+
resolvedVersion = fallbackVersion;
|
|
151196
|
+
console.log(`[Fetcher] ${packageName}: Resolved to local fallback ${resolvedVersion} (${Date.now() - fallbackStart}ms)`);
|
|
151197
|
+
} else throw new Error(`Offline and no local fallback version available for ${packageName}`);
|
|
151198
|
+
} else try {
|
|
151113
151199
|
const cachePath = join$1(ctx.userDataPath, "cache", "pacote");
|
|
151114
151200
|
let packumentPromise = packumentRequests.get(packageName);
|
|
151115
151201
|
if (!packumentPromise) {
|
|
@@ -151119,7 +151205,16 @@ async function fetchPackage(packageName, versionOrRange, options) {
|
|
|
151119
151205
|
const packument = await packumentPromise;
|
|
151120
151206
|
const versions = Object.keys(packument.versions);
|
|
151121
151207
|
const range = resolvedVersionOrRange || "latest";
|
|
151122
|
-
|
|
151208
|
+
let foundVersion = packument["dist-tags"]?.[range] || import_semver.default.maxSatisfying(versions, range);
|
|
151209
|
+
if (range === "latest" && ctx.releaseTag && ctx.releaseTag !== "latest") {
|
|
151210
|
+
const releaseTagVersion = packument["dist-tags"]?.[ctx.releaseTag];
|
|
151211
|
+
if (releaseTagVersion && import_semver.default.valid(releaseTagVersion)) {
|
|
151212
|
+
if (!foundVersion || import_semver.default.valid(foundVersion) && import_semver.default.gte(releaseTagVersion, foundVersion)) {
|
|
151213
|
+
console.log(`[Fetcher] Using release tag "${ctx.releaseTag}" (${releaseTagVersion}) instead of "latest" (${foundVersion || "none"}) for ${packageName}`);
|
|
151214
|
+
foundVersion = releaseTagVersion;
|
|
151215
|
+
} else if (foundVersion) console.warn(`[Fetcher] Tag "${ctx.releaseTag}" (${releaseTagVersion}) is older than "latest" (${foundVersion}) for ${packageName}, keeping "latest"`);
|
|
151216
|
+
}
|
|
151217
|
+
}
|
|
151123
151218
|
if (!foundVersion) throw new Error(`Package ${packageName}@${range} not found on npm (available tags: ${Object.keys(packument["dist-tags"] || {}).join(", ")})`);
|
|
151124
151219
|
resolvedVersion = foundVersion;
|
|
151125
151220
|
console.log(`[Fetcher] ${packageName}: Resolved to v${resolvedVersion} via npm (${Date.now() - resolveStart}ms)`);
|
|
@@ -151234,7 +151329,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
|
|
|
151234
151329
|
const extension = isWindows ? "zip" : "tar.gz";
|
|
151235
151330
|
const fileName = `node-v${version}-${platform === "osx" ? "darwin" : platform}-${arch}.${extension}`;
|
|
151236
151331
|
const downloadUrl = `https://nodejs.org/dist/v${version}/${fileName}`;
|
|
151237
|
-
const tempDir = await
|
|
151332
|
+
const tempDir = await context.createTempFolder("node-download-");
|
|
151238
151333
|
const archivePath = join$1(tempDir, fileName);
|
|
151239
151334
|
sendStartupProgress(`Downloading Node.js v${version}...`);
|
|
151240
151335
|
console.log(`Downloading Node.js from ${downloadUrl}...`);
|
|
@@ -152743,13 +152838,24 @@ const packageV2Runner = createActionRunner(async ({ inputs, cwd, paths, log, set
|
|
|
152743
152838
|
});
|
|
152744
152839
|
//#endregion
|
|
152745
152840
|
//#region src/index.ts
|
|
152746
|
-
var src_default = createNodeDefinition({
|
|
152747
|
-
|
|
152748
|
-
|
|
152749
|
-
|
|
152750
|
-
|
|
152751
|
-
|
|
152752
|
-
|
|
152841
|
+
var src_default = createNodeDefinition({
|
|
152842
|
+
nodes: [{
|
|
152843
|
+
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),
|
|
152844
|
+
runner: packageV2Runner
|
|
152845
|
+
}, {
|
|
152846
|
+
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')}`"),
|
|
152847
|
+
runner: previewRunner
|
|
152848
|
+
}],
|
|
152849
|
+
integrations: [{
|
|
152850
|
+
name: "Discord Connection",
|
|
152851
|
+
fields: [{
|
|
152852
|
+
key: "apiKey",
|
|
152853
|
+
label: "Webhook URL",
|
|
152854
|
+
type: "text",
|
|
152855
|
+
placeholder: "https://discord.com/api/webhooks/..."
|
|
152856
|
+
}]
|
|
152857
|
+
}]
|
|
152858
|
+
});
|
|
152753
152859
|
//#endregion
|
|
152754
152860
|
export { src_default as default };
|
|
152755
152861
|
|