@pipelab/shared 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipelab/shared",
3
- "version": "1.0.0-beta.13",
3
+ "version": "1.0.0-beta.15",
4
4
  "private": false,
5
5
  "description": "Shared logic and types for the Pipelab ecosystem",
6
6
  "license": "FSL-1.1-MIT",
@@ -37,15 +37,15 @@
37
37
  "tslog": "4.9.3",
38
38
  "type-fest": "4.26.1",
39
39
  "valibot": "0.42.1",
40
- "@pipelab/constants": "1.0.0-beta.15",
41
- "@pipelab/migration": "1.0.0-beta.13"
40
+ "@pipelab/constants": "1.0.0-beta.17",
41
+ "@pipelab/migration": "1.0.0-beta.15"
42
42
  },
43
43
  "devDependencies": {
44
44
  "esbuild-plugin-wasm": "1.1.0",
45
45
  "tsdown": "0.21.2",
46
46
  "typescript": "5.9.3",
47
47
  "vitest": "3.1.4",
48
- "@pipelab/tsconfig": "1.0.0-beta.13"
48
+ "@pipelab/tsconfig": "1.0.0-beta.15"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsdown",
package/src/apis.ts CHANGED
@@ -1,16 +1,11 @@
1
1
  import { RendererPluginDefinition } from "./plugins/definitions";
2
2
  import { User, UserResponse } from "@supabase/supabase-js";
3
3
  import type { Tagged } from "type-fest";
4
- import { PresetResult, Steps } from "./model";
5
- import { AppConfig } from "./config.schema";
4
+ import { PresetResult, Steps, SavedFile } from "./model";
5
+ import { AppConfig, ConnectionsConfig } from "./config.schema";
6
+ import { FileRepo } from "./config/projects-definition";
6
7
  import { Agent } from "./websocket.types";
7
- import {
8
- BuildHistoryEntry,
9
- BuildHistoryQuery,
10
- BuildHistoryResponse,
11
- BuildHistoryConfig,
12
- RetentionPolicy,
13
- } from "./build-history";
8
+ import { BuildHistoryEntry, BuildHistoryQuery, BuildHistoryResponse } from "./build-history";
14
9
 
15
10
  type Event<TYPE extends string, DATA> =
16
11
  | { type: TYPE; data: DATA }
@@ -31,6 +26,58 @@ type EndEvent<DATA> = {
31
26
 
32
27
  export type Presets = Record<string, PresetResult>;
33
28
 
29
+ export type StableDataReport = {
30
+ sourceChannel: "Stable" | "Beta";
31
+ targetChannel: "Stable" | "Beta";
32
+
33
+ // Settings
34
+ settingsExists: boolean;
35
+ settingsVersion: string | null;
36
+ settingsVersionTarget: string | null;
37
+ settingsMtimeSource: number;
38
+ settingsMtimeTarget: number;
39
+ settingsImportable: boolean;
40
+
41
+ // Connections
42
+ connectionsExists: boolean;
43
+ connectionsCount: number;
44
+ connectionsVersion: string | null;
45
+ connectionsVersionTarget: string | null;
46
+ connectionsMtimeSource: number;
47
+ connectionsMtimeTarget: number;
48
+ connectionsImportable: boolean;
49
+
50
+ // Projects
51
+ projectsExists: boolean;
52
+ projectsVersion: string | null;
53
+ projectsVersionTarget: string | null;
54
+ projectsMtimeSource: number;
55
+ projectsMtimeTarget: number;
56
+ projectsImportable: boolean;
57
+
58
+ projects: Array<{
59
+ id: string;
60
+ name: string;
61
+ description: string;
62
+ pipelines: Array<{
63
+ id: string;
64
+ name: string;
65
+ description: string;
66
+ type: "internal" | "external" | "pipelab-cloud";
67
+ lastModifiedStable?: string;
68
+ lastModifiedBeta?: string;
69
+ existsInBeta: boolean;
70
+ }>;
71
+ }>;
72
+ };
73
+
74
+ export type MigrationOptions = {
75
+ migrateSettings: boolean;
76
+ migrateConnections: boolean;
77
+ selectedProjects: string[];
78
+ selectedPipelines: string[];
79
+ };
80
+
34
81
  export type IpcDefinition = {
35
82
  "fs:read": [
36
83
  // input
@@ -101,10 +148,24 @@ export type IpcDefinition = {
101
148
 
102
149
  "constants:get": [void, EndEvent<{ result: { userData: string } }>];
103
150
 
104
- "config:load": [{ config: string }, EndEvent<{ result: any }>];
105
- "config:save": [{ data: any; config: string }, EndEvent<{ result: "ok" }>];
106
- "config:reset": [{ config: string; key: string }, EndEvent<{ result: "ok" }>];
107
- "config:delete": [{ config: string }, EndEvent<{ result: "ok" }>];
151
+ "settings:load": [void, EndEvent<AppConfig>];
152
+ "settings:save": [{ data: AppConfig }, EndEvent<"ok">];
153
+ "settings:reset": [{ key: string }, EndEvent<"ok">];
154
+
155
+ "connections:load": [void, EndEvent<ConnectionsConfig>];
156
+ "connections:save": [{ data: ConnectionsConfig }, EndEvent<"ok">];
157
+ "connections:reset": [{ key: string }, EndEvent<"ok">];
158
+
159
+ "projects:load": [void, EndEvent<FileRepo>];
160
+ "projects:save": [{ data: FileRepo }, EndEvent<"ok">];
161
+ "projects:reset": [{ key: string }, EndEvent<"ok">];
162
+
163
+ "pipeline:load-by-name": [{ name: string }, EndEvent<SavedFile>];
164
+ "pipeline:load-by-path": [{ path: string }, EndEvent<SavedFile>];
165
+ "pipeline:save-by-name": [{ name: string; data: string }, EndEvent<"ok">];
166
+ "pipeline:save-by-path": [{ path: string; data: string }, EndEvent<"ok">];
167
+ "pipeline:delete-by-name": [{ name: string }, EndEvent<"ok">];
168
+ "pipeline:delete-by-path": [{ path: string }, EndEvent<"ok">];
108
169
  "action:cancel": [void, EndEvent<{ result: "ok" | "ko" }>];
109
170
 
110
171
  // Build History APIs
@@ -130,10 +191,6 @@ export type IpcDefinition = {
130
191
  newestEntry?: number;
131
192
  }>,
132
193
  ];
133
- "build-history:configure": [
134
- { config: Partial<BuildHistoryConfig> },
135
- EndEvent<{ result: "ok" | "ko" }>,
136
- ];
137
194
  "agents:get": [void, EndEvent<{ agents: Agent[] }>];
138
195
  "graph:execute": [
139
196
  {
@@ -161,7 +218,10 @@ export type IpcDefinition = {
161
218
  EndEvent<{ data: any | null; error: any | null }>,
162
219
  ];
163
220
  "agent:version:get": [void, EndEvent<{ version: string }>];
164
- "startup:progress": [void, { type: "progress"; data: { message: string } } | { type: "ready" } | { type: "done" }];
221
+ "startup:progress": [
222
+ void,
223
+ { type: "progress"; data: { message: string } } | { type: "ready" } | { type: "done" },
224
+ ];
165
225
  "plugin:loaded": [void, { plugin: RendererPluginDefinition }];
166
226
  "plugin:search": [
167
227
  { query: string },
@@ -200,6 +260,8 @@ export type IpcDefinition = {
200
260
  { plugins: Record<string, string> },
201
261
  EndEvent<{ loaded: string[]; failed: string[] }>,
202
262
  ];
263
+ "migration:scan-stable": [void, EndEvent<StableDataReport>];
264
+ "migration:perform": [MigrationOptions, EndEvent<{ result: "ok" }>];
203
265
  };
204
266
 
205
267
  export type Channels = keyof IpcDefinition;
@@ -34,6 +34,7 @@ export interface BuildHistoryEntry {
34
34
  pipelineId: string;
35
35
  projectName: string;
36
36
  projectPath: string;
37
+ cachePath?: string;
37
38
  status: "running" | "completed" | "failed" | "cancelled";
38
39
  startTime: number;
39
40
  endTime?: number;
@@ -78,11 +79,6 @@ export interface IBuildHistoryStorage {
78
79
  newestEntry?: number;
79
80
  numberOfPipelines: number;
80
81
  userDataPath: string;
81
- retentionPolicy: {
82
- enabled: boolean;
83
- maxEntries: number;
84
- maxAge: number;
85
- };
86
82
  disk: {
87
83
  total: number;
88
84
  free: number;
@@ -92,24 +88,6 @@ export interface IBuildHistoryStorage {
92
88
  }>;
93
89
  }
94
90
 
95
- // Retention policy configuration
96
- export interface RetentionPolicy {
97
- enabled: boolean;
98
- maxEntries: number;
99
- maxAge: number; // in milliseconds
100
- maxSize: number; // in bytes
101
- keepFailedBuilds: boolean;
102
- keepSuccessfulBuilds: boolean;
103
- }
104
-
105
- // Storage configuration
106
- export interface BuildHistoryConfig {
107
- storagePath: string;
108
- indexFileName: string;
109
- entryFilePrefix: string;
110
- retentionPolicy: RetentionPolicy;
111
- }
112
-
113
91
  // Authorization and subscription types
114
92
  export interface SubscriptionBenefit {
115
93
  id: string;
@@ -16,12 +16,11 @@ import {
16
16
  AppConfigV5,
17
17
  AppConfigV6,
18
18
  AppConfigV7,
19
- AppConfigV8,
20
19
  ConnectionsConfig,
21
20
  ConnectionsConfigV1,
22
21
  } from "../config.schema";
23
22
 
24
- const DEFAULT_PLUGINS: AppConfigV8["plugins"] = [
23
+ const DEFAULT_PLUGINS: AppConfig["plugins"] = [
25
24
  {
26
25
  name: "@pipelab/plugin-construct",
27
26
  enabled: true,
@@ -39,7 +38,7 @@ const DEFAULT_PLUGINS: AppConfigV8["plugins"] = [
39
38
  { name: "@pipelab/plugin-minify", enabled: true, description: "Asset minification" },
40
39
  { name: "@pipelab/plugin-netlify", enabled: true, description: "Netlify deployment" },
41
40
  ];
42
- import { FileRepoV1, FileRepoV2, FileRepo } from "./projects-types";
41
+ import { FileRepoV1, FileRepoV2, FileRepoV3, FileRepo } from "./projects-types";
43
42
  import {
44
43
  SavedFileV1,
45
44
  SavedFileV2,
@@ -73,7 +72,7 @@ const settingsMigratorInternal = createMigrator<AppConfigV1, AppConfig>();
73
72
  export const defaultAppSettings = settingsMigratorInternal.createDefault({
74
73
  locale: "en-US",
75
74
  theme: "light",
76
- version: "8.0.0",
75
+ version: "7.0.0",
77
76
  autosave: true,
78
77
  agents: [],
79
78
  tours: {
@@ -86,15 +85,7 @@ export const defaultAppSettings = settingsMigratorInternal.createDefault({
86
85
  completed: false,
87
86
  },
88
87
  },
89
- buildHistory: {
90
- retentionPolicy: {
91
- enabled: false,
92
- maxEntries: 50,
93
- maxAge: 30,
94
- },
95
- },
96
88
  plugins: DEFAULT_PLUGINS,
97
- isInternalMigrationBannerClosed: false,
98
89
  });
99
90
 
100
91
  export const appSettingsMigrator = settingsMigratorInternal.createMigrations({
@@ -143,27 +134,20 @@ export const appSettingsMigrator = settingsMigratorInternal.createMigrations({
143
134
  autosave: true,
144
135
  }),
145
136
  }),
146
- createMigration<AppConfigV6, AppConfigV8>({
137
+ createMigration<AppConfigV6, AppConfigV7>({
147
138
  version: "6.0.0" as SemVer,
148
139
  up: (state) => {
149
- const { cacheFolder: _, clearTemporaryFoldersOnPipelineEnd: __, ...rest } = state;
140
+ const { cacheFolder, clearTemporaryFoldersOnPipelineEnd: __, ...rest } = state;
150
141
  return {
151
142
  ...rest,
143
+ cacheFolder,
152
144
  agents: [],
153
- buildHistory: {
154
- retentionPolicy: {
155
- enabled: false,
156
- maxEntries: 50,
157
- maxAge: 30,
158
- },
159
- },
160
145
  plugins: DEFAULT_PLUGINS,
161
- isInternalMigrationBannerClosed: false,
162
146
  };
163
147
  },
164
148
  }),
165
- createMigration<AppConfigV8, never>({
166
- version: "8.0.0" as SemVer,
149
+ createMigration<AppConfigV7, never>({
150
+ version: "7.0.0" as SemVer,
167
151
  up: finalVersion,
168
152
  }),
169
153
  ],
@@ -193,7 +177,7 @@ export const connectionsMigrator = connectionsMigratorInternal.createMigrations(
193
177
  const fileRepoMigratorInternal = createMigrator<FileRepoV1, FileRepo>();
194
178
 
195
179
  export const defaultFileRepo = fileRepoMigratorInternal.createDefault({
196
- version: "2.0.0",
180
+ version: "3.0.0",
197
181
  projects: [
198
182
  {
199
183
  id: "main",
@@ -232,8 +216,16 @@ export const fileRepoMigrations = fileRepoMigratorInternal.createMigrations({
232
216
  };
233
217
  },
234
218
  }),
235
- createMigration<FileRepoV2, never>({
219
+ createMigration<FileRepoV2, FileRepoV3>({
236
220
  version: "2.0.0",
221
+ up: (state) => {
222
+ return {
223
+ ...state,
224
+ };
225
+ },
226
+ }),
227
+ createMigration<FileRepoV3, never>({
228
+ version: "3.0.0",
237
229
  up: finalVersion,
238
230
  }),
239
231
  ],
@@ -424,7 +416,7 @@ export const normalizePipelineConfig = (state: any): boolean => {
424
416
 
425
417
  // Normalise plugin IDs in block and trigger origins (pluginId field only;
426
418
  // version strings don't need normalisation)
427
- if (state.type === "default" && state.canvas) {
419
+ if (state.canvas) {
428
420
  if (Array.isArray(state.canvas.blocks)) {
429
421
  for (const block of state.canvas.blocks) {
430
422
  if (normalizeBlockPluginId(block)) changed = true;
@@ -18,8 +18,15 @@ export const FileRepoValidatorV2 = object({
18
18
  pipelines: optional(array(SaveLocationValidator), []),
19
19
  });
20
20
 
21
+ export const FileRepoValidatorV3 = object({
22
+ version: literal("3.0.0"),
23
+ projects: array(FileRepoProjectValidatorV2),
24
+ pipelines: optional(array(SaveLocationValidator), []),
25
+ });
26
+
21
27
  export type FileRepoV1 = InferInput<typeof FileRepoValidatorV1>;
22
28
  export type FileRepoV2 = InferInput<typeof FileRepoValidatorV2>;
29
+ export type FileRepoV3 = InferInput<typeof FileRepoValidatorV3>;
23
30
 
24
- export const FileRepoValidator = FileRepoValidatorV2;
31
+ export const FileRepoValidator = FileRepoValidatorV3;
25
32
  export type FileRepo = InferInput<typeof FileRepoValidator>;
@@ -1,25 +1 @@
1
- import { SaveLocationValidator } from "../save-location";
2
- import { object, string, optional, record, InferInput, literal, array } from "valibot";
3
-
4
- export const FileRepoValidatorV1 = object({
5
- version: literal("1.0.0"),
6
- data: optional(record(string(), SaveLocationValidator), {}),
7
- });
8
-
9
- export const FileRepoProjectValidatorV2 = object({
10
- id: string(),
11
- name: string(),
12
- description: string(),
13
- });
14
-
15
- export const FileRepoValidatorV2 = object({
16
- version: literal("2.0.0"),
17
- projects: array(FileRepoProjectValidatorV2),
18
- pipelines: optional(array(SaveLocationValidator), []),
19
- });
20
-
21
- export type FileRepoV1 = InferInput<typeof FileRepoValidatorV1>;
22
- export type FileRepoV2 = InferInput<typeof FileRepoValidatorV2>;
23
-
24
- export const FileRepoValidator = FileRepoValidatorV2;
25
- export type FileRepo = InferInput<typeof FileRepoValidator>;
1
+ export * from "./projects-definition";
@@ -7,7 +7,6 @@ import type {
7
7
  AppConfigV5,
8
8
  AppConfigV6,
9
9
  AppConfigV7,
10
- AppConfigV8,
11
10
  } from "../config.schema";
12
11
 
13
12
  export type {
@@ -19,5 +18,4 @@ export type {
19
18
  AppConfigV5,
20
19
  AppConfigV6,
21
20
  AppConfigV7,
22
- AppConfigV8,
23
21
  };
@@ -128,51 +128,6 @@ export const AppSettingsValidatorV7 = object({
128
128
  url: string(),
129
129
  }),
130
130
  ),
131
- buildHistory: object({
132
- retentionPolicy: object({
133
- enabled: boolean(),
134
- maxEntries: number(), // Maximum number of entries per pipeline
135
- maxAge: number(), // Maximum age of entries in days
136
- }),
137
- }),
138
- });
139
-
140
- export const AppSettingsValidatorV8 = object({
141
- theme: union([literal("light"), literal("dark")]),
142
- version: literal("8.0.0"),
143
- locale: union([
144
- literal("en-US"),
145
- literal("fr-FR"),
146
- literal("pt-BR"),
147
- literal("zh-CN"),
148
- literal("es-ES"),
149
- literal("de-DE"),
150
- ]),
151
- tours: object({
152
- dashboard: object({
153
- step: number(),
154
- completed: boolean(),
155
- }),
156
- editor: object({
157
- step: number(),
158
- completed: boolean(),
159
- }),
160
- }),
161
- autosave: boolean(),
162
- agents: array(
163
- object({
164
- id: string(),
165
- name: string(),
166
- url: string(),
167
- }),
168
- ),
169
- buildHistory: object({
170
- retentionPolicy: object({
171
- enabled: boolean(),
172
- maxEntries: number(), // Maximum number of entries per pipeline
173
- maxAge: number(), // Maximum age of entries in days
174
- }),
175
- }),
176
131
  // Metadata list of plugins the user has enabled (official + community).
177
132
  // No binaries are stored here — versions are resolved JIT at node-add time.
178
133
  plugins: array(
@@ -182,7 +137,8 @@ export const AppSettingsValidatorV8 = object({
182
137
  description: string(),
183
138
  }),
184
139
  ),
185
- isInternalMigrationBannerClosed: optional(boolean(), false),
140
+ cacheFolder: optional(string()),
141
+ tempFolder: optional(string()),
186
142
  });
187
143
 
188
144
  export const ConnectionValidator = looseObject({
@@ -210,7 +166,6 @@ export type AppConfigV4 = InferInput<typeof AppSettingsValidatorV4>;
210
166
  export type AppConfigV5 = InferInput<typeof AppSettingsValidatorV5>;
211
167
  export type AppConfigV6 = InferInput<typeof AppSettingsValidatorV6>;
212
168
  export type AppConfigV7 = InferInput<typeof AppSettingsValidatorV7>;
213
- export type AppConfigV8 = InferInput<typeof AppSettingsValidatorV8>;
214
169
 
215
- export type AppConfig = AppConfigV8;
216
- export const AppSettingsValidator = AppSettingsValidatorV8;
170
+ export type AppConfig = AppConfigV7;
171
+ export const AppSettingsValidator = AppSettingsValidatorV7;