@pipelab/plugin-core 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
@@ -2,11 +2,10 @@ import { o as debugLog, t as QuickJSEmscriptenModuleError } from "./chunk-JTKJZQ
2
2
  import { hostname } from "os";
3
3
  import { normalize } from "path";
4
4
  import { formatWithOptions, types } from "util";
5
- import { PipelabContext, downloadFile, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, runPnpm, runWithLiveLogs } from "@pipelab/core-node";
6
- import { access, mkdir, mkdtemp, realpath, writeFile } from "node:fs/promises";
7
- import { dirname, join } from "node:path";
8
- import { tmpdir } from "node:os";
5
+ import { PipelabContext, downloadFile, ensure, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, runPnpm, runWithLiveLogs } from "@pipelab/core-node";
9
6
  import { createWriteStream } from "node:fs";
7
+ import { access, mkdir } from "node:fs/promises";
8
+ import { dirname, join } from "node:path";
10
9
  import tar from "tar";
11
10
  import yauzl from "yauzl";
12
11
  import archiver from "archiver";
@@ -1621,6 +1620,56 @@ function literal(literal_, message) {
1621
1620
  }
1622
1621
  };
1623
1622
  }
1623
+ function looseObject(entries, message) {
1624
+ return {
1625
+ kind: "schema",
1626
+ type: "loose_object",
1627
+ reference: looseObject,
1628
+ expects: "Object",
1629
+ async: false,
1630
+ entries,
1631
+ message,
1632
+ _run(dataset, config2) {
1633
+ const input = dataset.value;
1634
+ if (input && typeof input === "object") {
1635
+ dataset.typed = true;
1636
+ dataset.value = {};
1637
+ for (const key in this.entries) {
1638
+ const value2 = input[key];
1639
+ const valueDataset = this.entries[key]._run({
1640
+ typed: false,
1641
+ value: value2
1642
+ }, config2);
1643
+ if (valueDataset.issues) {
1644
+ const pathItem = {
1645
+ type: "object",
1646
+ origin: "value",
1647
+ input,
1648
+ key,
1649
+ value: value2
1650
+ };
1651
+ for (const issue of valueDataset.issues) {
1652
+ if (issue.path) issue.path.unshift(pathItem);
1653
+ else issue.path = [pathItem];
1654
+ dataset.issues?.push(issue);
1655
+ }
1656
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1657
+ if (config2.abortEarly) {
1658
+ dataset.typed = false;
1659
+ break;
1660
+ }
1661
+ }
1662
+ if (!valueDataset.typed) dataset.typed = false;
1663
+ if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
1664
+ }
1665
+ if (!dataset.issues || !config2.abortEarly) {
1666
+ for (const key in input) if (_isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
1667
+ }
1668
+ } else _addIssue(this, "type", dataset, config2);
1669
+ return dataset;
1670
+ }
1671
+ };
1672
+ }
1624
1673
  function number(message) {
1625
1674
  return {
1626
1675
  kind: "schema",
@@ -2158,6 +2207,18 @@ const appSettingsMigrator$1 = settingsMigratorInternal.createMigrations({
2158
2207
  })
2159
2208
  ]
2160
2209
  });
2210
+ const connectionsMigratorInternal = createMigrator();
2211
+ const defaultConnections$1 = connectionsMigratorInternal.createDefault({
2212
+ version: "1.0.0",
2213
+ connections: []
2214
+ });
2215
+ const connectionsMigrator$1 = connectionsMigratorInternal.createMigrations({
2216
+ defaultValue: defaultConnections$1,
2217
+ migrations: [createMigration({
2218
+ version: "1.0.0",
2219
+ up: finalVersion
2220
+ })]
2221
+ });
2161
2222
  const fileRepoMigratorInternal = createMigrator();
2162
2223
  const defaultFileRepo$1 = fileRepoMigratorInternal.createDefault({
2163
2224
  version: "2.0.0",
@@ -2319,10 +2380,7 @@ const LEGACY_ID_MAP = {
2319
2380
  };
2320
2381
  const getStrictPluginId = (pluginId) => {
2321
2382
  if (!pluginId) return pluginId;
2322
- if (LEGACY_ID_MAP[pluginId]) return LEGACY_ID_MAP[pluginId];
2323
- if (pluginId.startsWith("@") || pluginId.includes("/") || pluginId.startsWith("pipelab-plugin-")) return pluginId;
2324
- const prefixed = `@pipelab/plugin-${pluginId}`;
2325
- return LEGACY_ID_MAP[prefixed] || prefixed;
2383
+ return LEGACY_ID_MAP[pluginId] || pluginId;
2326
2384
  };
2327
2385
  const normalizeBlockPluginId = (block) => {
2328
2386
  if (!block) return false;
@@ -2352,9 +2410,59 @@ const normalizePipelineConfig$1 = (state) => {
2352
2410
  const configRegistry$1 = {
2353
2411
  settings: appSettingsMigrator$1,
2354
2412
  projects: fileRepoMigrations$1,
2355
- pipeline: savedFileMigrator$1
2413
+ pipeline: savedFileMigrator$1,
2414
+ connections: connectionsMigrator$1
2356
2415
  };
2357
2416
  //#endregion
2417
+ //#region ../../packages/shared/src/save-location.ts
2418
+ const SaveLocationInternalValidator = object({
2419
+ id: string(),
2420
+ project: string(),
2421
+ lastModified: string(),
2422
+ type: literal("internal"),
2423
+ configName: string()
2424
+ });
2425
+ /** @deprecated External pipeline files are deprecated and will be removed in future versions. */
2426
+ const SaveLocationExternalValidator = object({
2427
+ id: string(),
2428
+ project: string(),
2429
+ path: string(),
2430
+ lastModified: string(),
2431
+ type: literal("external"),
2432
+ summary: object({
2433
+ plugins: array(string()),
2434
+ name: string(),
2435
+ description: string()
2436
+ })
2437
+ });
2438
+ const SaveLocationPipelabCloudValidator = object({
2439
+ id: string(),
2440
+ project: string(),
2441
+ type: literal("pipelab-cloud")
2442
+ });
2443
+ const SaveLocationValidator = union([
2444
+ SaveLocationExternalValidator,
2445
+ SaveLocationInternalValidator,
2446
+ SaveLocationPipelabCloudValidator
2447
+ ]);
2448
+ //#endregion
2449
+ //#region ../../packages/shared/src/config/projects-definition.ts
2450
+ const FileRepoValidatorV1 = object({
2451
+ version: literal("1.0.0"),
2452
+ data: optional(record(string(), SaveLocationValidator), {})
2453
+ });
2454
+ const FileRepoProjectValidatorV2 = object({
2455
+ id: string(),
2456
+ name: string(),
2457
+ description: string()
2458
+ });
2459
+ const FileRepoValidatorV2 = object({
2460
+ version: literal("2.0.0"),
2461
+ projects: array(FileRepoProjectValidatorV2),
2462
+ pipelines: optional(array(SaveLocationValidator), [])
2463
+ });
2464
+ const FileRepoValidator = FileRepoValidatorV2;
2465
+ //#endregion
2358
2466
  //#region ../../packages/shared/src/apis.ts
2359
2467
  const ShellChannels = ["dialog:showOpenDialog", "dialog:showSaveDialog"];
2360
2468
  //#endregion
@@ -2511,6 +2619,18 @@ const AppSettingsValidatorV8 = object({
2511
2619
  })),
2512
2620
  isInternalMigrationBannerClosed: optional(boolean(), false)
2513
2621
  });
2622
+ const ConnectionValidator = looseObject({
2623
+ id: string(),
2624
+ pluginName: string(),
2625
+ name: string(),
2626
+ createdAt: string(),
2627
+ isDefault: boolean()
2628
+ });
2629
+ const ConnectionsValidatorV1 = object({
2630
+ version: literal("1.0.0"),
2631
+ connections: array(ConnectionValidator)
2632
+ });
2633
+ const ConnectionsValidator = ConnectionsValidatorV1;
2514
2634
  const AppSettingsValidator = AppSettingsValidatorV8;
2515
2635
  //#endregion
2516
2636
  //#region ../../node_modules/tslog/dist/esm/prettyLogStyles.js
@@ -4215,7 +4335,8 @@ var en_US_default = {
4215
4335
  "billing": "Billing",
4216
4336
  "plugins": "Plugins",
4217
4337
  "core-plugins": "Core Plugins",
4218
- "community-plugins": "Community Plugins"
4338
+ "community-plugins": "Community Plugins",
4339
+ "versions": "Versions"
4219
4340
  },
4220
4341
  "pipeline-cache-folder": "Pipeline Cache Folder:",
4221
4342
  "enter-or-browse-for-a-folder": "Enter or browse for a folder",
@@ -4383,7 +4504,8 @@ var fr_FR_default = {
4383
4504
  "billing": "Facturation",
4384
4505
  "plugins": "Plugins",
4385
4506
  "core-plugins": "Plugins de base",
4386
- "community-plugins": "Plugins de la communauté"
4507
+ "community-plugins": "Plugins de la communauté",
4508
+ "versions": "Versions"
4387
4509
  },
4388
4510
  "clearTempFolders": "Nettoyer automatiquement les fichiers temporaires",
4389
4511
  "clearTempFoldersDescription": "Lorsque cette option est activée, tous les fichiers temporaires créés lors de l'exécution du pipeline seront automatiquement supprimés une fois le pipeline terminé. Cela permet d'économiser de l'espace disque, mais vous devrez peut-être copier vous-même des artefacts pour les préserver.",
@@ -4475,7 +4597,8 @@ var pt_BR_default = {
4475
4597
  "billing": "Pagamento",
4476
4598
  "plugins": "Plugins",
4477
4599
  "core-plugins": "Plugins nativos",
4478
- "community-plugins": "Plugins da comunidade"
4600
+ "community-plugins": "Plugins da comunidade",
4601
+ "versions": "Versões"
4479
4602
  },
4480
4603
  "clearTempFolders": "Automatically clean up temporary files",
4481
4604
  "clearTempFoldersDescription": "When enabled, all temporary files created during pipeline execution will be automatically deleted after the pipeline completes. This helps save disk space but you may need to copy artifacts yourself to preserve them.",
@@ -4564,7 +4687,8 @@ var zh_CN_default = {
4564
4687
  "billing": "Billing",
4565
4688
  "plugins": "Plugins",
4566
4689
  "core-plugins": "核心插件",
4567
- "community-plugins": "社区插件"
4690
+ "community-plugins": "社区插件",
4691
+ "versions": "版本"
4568
4692
  },
4569
4693
  "clearTempFolders": "Automatically clean up temporary files",
4570
4694
  "clearTempFoldersDescription": "When enabled, all temporary files created during pipeline execution will be automatically deleted after the pipeline completes. This helps save disk space but you may need to copy artifacts yourself to preserve them.",
@@ -4653,7 +4777,8 @@ var es_ES_default = {
4653
4777
  "billing": "Billing",
4654
4778
  "plugins": "Plugins",
4655
4779
  "core-plugins": "Complementos principales",
4656
- "community-plugins": "Complementos de la comunidad"
4780
+ "community-plugins": "Complementos de la comunidad",
4781
+ "versions": "Versiones"
4657
4782
  },
4658
4783
  "clearTempFolders": "Automatically clean up temporary files",
4659
4784
  "clearTempFoldersDescription": "Cuando está habilitado, todos los archivos temporales creados durante la ejecución del pipeline se eliminarán automáticamente después de que el pipeline se complete. Esto ayuda a ahorrar espacio en el disco, pero puede que necesite copiar los artefactos usted mismo para preservarlos.",
@@ -4742,7 +4867,8 @@ var de_DE_default = {
4742
4867
  "billing": "Billing",
4743
4868
  "plugins": "Plugins",
4744
4869
  "core-plugins": "Core-Plugins",
4745
- "community-plugins": "Community-Plugins"
4870
+ "community-plugins": "Community-Plugins",
4871
+ "versions": "Versionen"
4746
4872
  },
4747
4873
  "clearTempFolders": "Automatically clean up temporary files",
4748
4874
  "clearTempFoldersDescription": "Wenn aktiviert, werden alle temporären Dateien, die während der Pipeline-Ausführung erstellt wurden, automatisch gelöscht, nachdem die Pipeline abgeschlossen ist. Dies hilft, Speicherplatz auf der Festplatte zu sparen, aber möglicherweise müssen Sie selbst Artefakte kopieren, um sie zu bewahren.",
@@ -4814,7 +4940,7 @@ var de_DE_default = {
4814
4940
  const OriginValidator = object({
4815
4941
  pluginId: string(),
4816
4942
  nodeId: string(),
4817
- version: pipe(optional(string()), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent."))
4943
+ version: optional(pipe(string(), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent.")))
4818
4944
  });
4819
4945
  const BlockActionValidatorV1 = object({
4820
4946
  type: literal("action"),
@@ -4827,7 +4953,7 @@ const EditorParamValidatorV3 = union([literal("simple"), literal("editor")]);
4827
4953
  const BlockActionValidatorV3 = object({
4828
4954
  type: literal("action"),
4829
4955
  uid: string(),
4830
- name: pipe(optional(string()), description("A custom name provided by the user")),
4956
+ name: optional(pipe(string(), description("A custom name provided by the user"))),
4831
4957
  disabled: optional(boolean()),
4832
4958
  params: record(string(), object({
4833
4959
  editor: EditorParamValidatorV3,
@@ -47226,38 +47352,6 @@ const createEvent = (event) => {
47226
47352
  };
47227
47353
  };
47228
47354
  //#endregion
47229
- //#region ../../packages/shared/src/save-location.ts
47230
- const SaveLocationInternalValidator = object({
47231
- id: string(),
47232
- project: string(),
47233
- lastModified: string(),
47234
- type: literal("internal"),
47235
- configName: string()
47236
- });
47237
- /** @deprecated External pipeline files are deprecated and will be removed in future versions. */
47238
- const SaveLocationExternalValidator = object({
47239
- id: string(),
47240
- project: string(),
47241
- path: string(),
47242
- lastModified: string(),
47243
- type: literal("external"),
47244
- summary: object({
47245
- plugins: array(string()),
47246
- name: string(),
47247
- description: string()
47248
- })
47249
- });
47250
- const SaveLocationPipelabCloudValidator = object({
47251
- id: string(),
47252
- project: string(),
47253
- type: literal("pipelab-cloud")
47254
- });
47255
- const SaveLocationValidator = union([
47256
- SaveLocationExternalValidator,
47257
- SaveLocationInternalValidator,
47258
- SaveLocationPipelabCloudValidator
47259
- ]);
47260
- //#endregion
47261
47355
  //#region ../../packages/shared/src/subscription-errors.ts
47262
47356
  var SubscriptionRequiredError = class extends Error {
47263
47357
  code = "SUBSCRIPTION_REQUIRED";
@@ -64457,20 +64551,6 @@ object({
64457
64551
  projects: array(FileRepoProjectValidatorV2$1),
64458
64552
  pipelines: optional(array(SaveLocationValidator), [])
64459
64553
  });
64460
- object({
64461
- version: literal("1.0.0"),
64462
- data: optional(record(string(), SaveLocationValidator), {})
64463
- });
64464
- const FileRepoProjectValidatorV2 = object({
64465
- id: string(),
64466
- name: string(),
64467
- description: string()
64468
- });
64469
- object({
64470
- version: literal("2.0.0"),
64471
- projects: array(FileRepoProjectValidatorV2),
64472
- pipelines: optional(array(SaveLocationValidator), [])
64473
- });
64474
64554
  //#endregion
64475
64555
  //#region ../../packages/shared/src/index.ts
64476
64556
  const appSettingsMigrator = appSettingsMigrator$1;
@@ -64480,6 +64560,8 @@ const defaultFileRepo = defaultFileRepo$1;
64480
64560
  const savedFileMigrator = savedFileMigrator$1;
64481
64561
  const configRegistry = configRegistry$1;
64482
64562
  const normalizePipelineConfig = normalizePipelineConfig$1;
64563
+ const connectionsMigrator = connectionsMigrator$1;
64564
+ const defaultConnections = defaultConnections$1;
64483
64565
  //#endregion
64484
64566
  //#region src/pipelab.ts
64485
64567
  const createActionRunner = (runner) => runner;
@@ -64505,23 +64587,6 @@ const fileExists = async (path) => {
64505
64587
  }
64506
64588
  };
64507
64589
  //#endregion
64508
- //#region src/fs-utils.ts
64509
- const ensure = async (filesPath, defaultContent = "{}") => {
64510
- await mkdir(dirname(filesPath), { recursive: true });
64511
- try {
64512
- await access(filesPath);
64513
- } catch {
64514
- await writeFile(filesPath, defaultContent);
64515
- }
64516
- };
64517
- const generateTempFolder = async (base) => {
64518
- const targetBase = base || tmpdir();
64519
- await mkdir(targetBase, { recursive: true });
64520
- const realPath = await realpath(targetBase);
64521
- console.log("join", join(realPath, "pipelab-"));
64522
- return await mkdtemp(join(realPath, "pipelab-"));
64523
- };
64524
- //#endregion
64525
64590
  //#region src/archive-utils.ts
64526
64591
  /**
64527
64592
  * Extracts a .tar.gz archive.
@@ -64635,6 +64700,6 @@ const detectRuntime = async (appFolder) => {
64635
64700
  return detectedRuntime;
64636
64701
  };
64637
64702
  //#endregion
64638
- export { AppSettingsValidator, AppSettingsValidatorV1, AppSettingsValidatorV2, AppSettingsValidatorV3, AppSettingsValidatorV4, AppSettingsValidatorV5, AppSettingsValidatorV6, AppSettingsValidatorV7, AppSettingsValidatorV8, BenefitNotFoundError, EditorParamValidatorV3, ExternalCommandError, OriginValidator, PipelabContext, src_default as RELEASE_SYNC, SaveLocationExternalValidator, SaveLocationInternalValidator, SaveLocationPipelabCloudValidator, SaveLocationValidator, SavedFileDefaultValidatorV4, SavedFileDefaultValidatorV5, SavedFileSimpleValidatorV4, SavedFileSimpleValidatorV5, SavedFileValidator, SavedFileValidatorV1, SavedFileValidatorV2, SavedFileValidatorV3, SavedFileValidatorV4, SavedFileValidatorV5, ShellChannels, SubscriptionExpiredError, SubscriptionRequiredError, UnauthorizedError, VariableValidatorV1, WebSocketConnectionError, WebSocketError, WebSocketTimeoutError, appSettingsMigrator, configRegistry, createAction, createActionRunner, createArray, createBooleanParam, createColorPicker, createDefinition, createEvent, createEventRunner, createExpression, createExpressionRunner, createNetlifySiteParam, createNodeDefinition, createNumberParam, createPasswordParam, createPathParam, createPlugin, createQuickJs, createQuickJsFromVariant, createRawParam, createStringParam, createSubscriptionError, createVersionSchema, de_DE_default as de_DE, defaultAppSettings, defaultFileRepo, detectRuntime, downloadFile, en_US_default as en_US, ensure, es_ES_default as es_ES, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, fileExists, fileRepoMigrations, fmt, foo, fr_FR_default as fr_FR, generateTempFolder, getSubscriptionErrorMessage, isRenderer, isRequired, isSubscriptionError, isSupabaseAvailable, isWebSocketErrorMessage, isWebSocketRequestMessage, isWebSocketResponseMessage, makeResolvedParams, newVariant, normalizePipelineConfig, processGraph, pt_BR_default as pt_BR, runPnpm, runWithLiveLogs, savedFileMigrator, schema, sleep, supabase, transformUrl, useLogger, usePlugins, variableToFormattedVariable, zh_CN_default as zh_CN, zipFolder };
64703
+ export { AppSettingsValidator, AppSettingsValidatorV1, AppSettingsValidatorV2, AppSettingsValidatorV3, AppSettingsValidatorV4, AppSettingsValidatorV5, AppSettingsValidatorV6, AppSettingsValidatorV7, AppSettingsValidatorV8, BenefitNotFoundError, ConnectionValidator, ConnectionsValidator, ConnectionsValidatorV1, EditorParamValidatorV3, ExternalCommandError, FileRepoProjectValidatorV2, FileRepoValidator, FileRepoValidatorV1, FileRepoValidatorV2, OriginValidator, PipelabContext, src_default as RELEASE_SYNC, SaveLocationExternalValidator, SaveLocationInternalValidator, SaveLocationPipelabCloudValidator, SaveLocationValidator, SavedFileDefaultValidatorV4, SavedFileDefaultValidatorV5, SavedFileSimpleValidatorV4, SavedFileSimpleValidatorV5, SavedFileValidator, SavedFileValidatorV1, SavedFileValidatorV2, SavedFileValidatorV3, SavedFileValidatorV4, SavedFileValidatorV5, ShellChannels, SubscriptionExpiredError, SubscriptionRequiredError, UnauthorizedError, VariableValidatorV1, WebSocketConnectionError, WebSocketError, WebSocketTimeoutError, appSettingsMigrator, configRegistry, connectionsMigrator, createAction, createActionRunner, createArray, createBooleanParam, createColorPicker, createDefinition, createEvent, createEventRunner, createExpression, createExpressionRunner, createNetlifySiteParam, createNodeDefinition, createNumberParam, createPasswordParam, createPathParam, createPlugin, createQuickJs, createQuickJsFromVariant, createRawParam, createStringParam, createSubscriptionError, createVersionSchema, de_DE_default as de_DE, defaultAppSettings, defaultConnections, defaultFileRepo, detectRuntime, downloadFile, en_US_default as en_US, ensure, es_ES_default as es_ES, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, fileExists, fileRepoMigrations, fmt, foo, fr_FR_default as fr_FR, getSubscriptionErrorMessage, isRenderer, isRequired, isSubscriptionError, isSupabaseAvailable, isWebSocketErrorMessage, isWebSocketRequestMessage, isWebSocketResponseMessage, makeResolvedParams, newVariant, normalizePipelineConfig, processGraph, pt_BR_default as pt_BR, runPnpm, runWithLiveLogs, savedFileMigrator, schema, sleep, supabase, transformUrl, useLogger, usePlugins, variableToFormattedVariable, zh_CN_default as zh_CN, zipFolder };
64639
64704
 
64640
64705
  //# sourceMappingURL=index.mjs.map