@pipelab/shared 1.0.0-beta.1 → 1.0.0-beta.2

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
@@ -1,4 +1,4 @@
1
- import { createMigration, createMigrator, finalVersion, initialVersion } from "@pipelab/migration";
1
+ import { createMigration, createMigrator, finalVersion } from "@pipelab/migration";
2
2
  import { any, array, boolean, custom, description, lazy, literal, number, object, optional, pipe, record, string, union, unknown, variant } from "valibot";
3
3
  import { Logger } from "tslog";
4
4
  import { RELEASE_SYNC, newQuickJSWASMModuleFromVariant, newVariant } from "quickjs-emscripten";
@@ -39,10 +39,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
39
39
  }) : target, mod));
40
40
  //#endregion
41
41
  //#region src/config/migrators.ts
42
+ const createMigration$1 = (config) => createMigration(config);
42
43
  const settingsMigratorInternal = createMigrator();
43
44
  const defaultAppSettings$1 = settingsMigratorInternal.createDefault({
44
- cacheFolder: "",
45
- clearTemporaryFoldersOnPipelineEnd: false,
46
45
  locale: "en-US",
47
46
  theme: "light",
48
47
  version: "7.0.0",
@@ -57,40 +56,37 @@ const defaultAppSettings$1 = settingsMigratorInternal.createDefault({
57
56
  step: 0,
58
57
  completed: false
59
58
  }
60
- }
59
+ },
60
+ buildHistory: { retentionPolicy: {
61
+ enabled: false,
62
+ maxEntries: 50,
63
+ maxAge: 30
64
+ } }
61
65
  });
62
66
  const appSettingsMigrator$1 = settingsMigratorInternal.createMigrations({
63
67
  defaultValue: defaultAppSettings$1,
64
68
  migrations: [
65
- createMigration({
69
+ createMigration$1({
66
70
  version: "1.0.0",
67
- up: (state) => state,
68
- down: initialVersion
71
+ up: (state) => state
69
72
  }),
70
- createMigration({
73
+ createMigration$1({
71
74
  version: "2.0.0",
72
75
  up: (state) => {
73
76
  return {
74
77
  ...state,
75
78
  clearTemporaryFoldersOnPipelineEnd: false
76
79
  };
77
- },
78
- down: () => {
79
- throw new Error("Can't migrate down from 2.0.0");
80
80
  }
81
81
  }),
82
- createMigration({
82
+ createMigration$1({
83
83
  version: "3.0.0",
84
84
  up: (state) => ({
85
85
  ...state,
86
86
  locale: "en-US"
87
- }),
88
- down: (state) => {
89
- const { locale, ...rest } = state;
90
- return rest;
91
- }
87
+ })
92
88
  }),
93
- createMigration({
89
+ createMigration$1({
94
90
  version: "4.0.0",
95
91
  up: (state) => ({
96
92
  ...state,
@@ -104,40 +100,32 @@ const appSettingsMigrator$1 = settingsMigratorInternal.createMigrations({
104
100
  completed: false
105
101
  }
106
102
  }
107
- }),
108
- down: (state) => {
109
- const { tours, ...rest } = state;
110
- return rest;
111
- }
103
+ })
112
104
  }),
113
- createMigration({
105
+ createMigration$1({
114
106
  version: "5.0.0",
115
107
  up: (state) => ({
116
108
  ...state,
117
109
  autosave: true
118
- }),
119
- down: (state) => {
120
- const { autosave, ...rest } = state;
121
- return rest;
122
- }
110
+ })
123
111
  }),
124
- createMigration({
112
+ createMigration$1({
125
113
  version: "6.0.0",
126
- up: (state) => ({
127
- ...state,
128
- agents: []
129
- }),
130
- down: (state) => {
131
- const { agents, ...rest } = state;
132
- return rest;
114
+ up: (state) => {
115
+ return {
116
+ ...state,
117
+ agents: [],
118
+ buildHistory: { retentionPolicy: {
119
+ enabled: false,
120
+ maxEntries: 50,
121
+ maxAge: 30
122
+ } }
123
+ };
133
124
  }
134
125
  }),
135
- createMigration({
126
+ createMigration$1({
136
127
  version: "7.0.0",
137
- up: finalVersion,
138
- down: () => {
139
- throw new Error("Can't migrate down from 7.0.0");
140
- }
128
+ up: finalVersion
141
129
  })
142
130
  ]
143
131
  });
@@ -149,38 +137,33 @@ const defaultFileRepo$1 = fileRepoMigratorInternal.createDefault({
149
137
  name: "Default project",
150
138
  description: "The initial default project"
151
139
  }],
152
- pipelines: [],
153
- proxies: []
140
+ pipelines: []
154
141
  });
155
142
  const fileRepoMigrations$1 = fileRepoMigratorInternal.createMigrations({
156
143
  defaultValue: defaultFileRepo$1,
157
- migrations: [createMigration({
144
+ migrations: [createMigration$1({
158
145
  version: "1.0.0",
159
146
  up: (state) => {
147
+ const pipelines = Object.entries(state.data || {}).map(([id, file]) => {
148
+ return {
149
+ ...file,
150
+ id,
151
+ project: "main"
152
+ };
153
+ });
160
154
  return {
161
- version: "2.0.0",
155
+ ...state,
162
156
  projects: [{
163
157
  id: "main",
164
158
  name: "Default project",
165
159
  description: "The initial default project"
166
160
  }],
167
- pipelines: Object.entries(state.data || {}).map(([id, file]) => {
168
- return {
169
- ...file,
170
- id,
171
- project: "main"
172
- };
173
- }),
174
- proxies: []
161
+ pipelines
175
162
  };
176
- },
177
- down: initialVersion
178
- }), createMigration({
179
- version: "2.0.0",
180
- up: finalVersion,
181
- down: (state) => {
182
- throw new Error("Cannot downgrade to version 1.0.0");
183
163
  }
164
+ }), createMigration$1({
165
+ version: "2.0.0",
166
+ up: finalVersion
184
167
  })]
185
168
  });
186
169
  const savedFileMigratorInternal = createMigrator();
@@ -198,7 +181,7 @@ const savedFileDefaultValue = savedFileMigratorInternal.createDefault({
198
181
  const savedFileMigrator$1 = savedFileMigratorInternal.createMigrations({
199
182
  defaultValue: savedFileDefaultValue,
200
183
  migrations: [
201
- createMigration({
184
+ createMigration$1({
202
185
  version: "1.0.0",
203
186
  up: (state) => {
204
187
  const blocks = state.canvas.blocks;
@@ -207,21 +190,19 @@ const savedFileMigrator$1 = savedFileMigratorInternal.createMigrations({
207
190
  for (const block of blocks) if (block.type === "event") triggers.push(block);
208
191
  else newBlocks.push(block);
209
192
  return {
193
+ ...state,
210
194
  canvas: {
195
+ ...state.canvas,
211
196
  blocks: newBlocks,
212
197
  triggers
213
- },
214
- description: state.description,
215
- name: state.name,
216
- variables: state.variables
198
+ }
217
199
  };
218
- },
219
- down: initialVersion
200
+ }
220
201
  }),
221
- createMigration({
202
+ createMigration$1({
222
203
  version: "2.0.0",
223
204
  up: (state) => {
224
- const { canvas, ...rest } = state;
205
+ const { canvas } = state;
225
206
  const { blocks, triggers } = canvas;
226
207
  const newBlocks = [];
227
208
  for (const block of blocks) {
@@ -240,35 +221,25 @@ const savedFileMigrator$1 = savedFileMigratorInternal.createMigrations({
240
221
  });
241
222
  }
242
223
  return {
243
- ...rest,
224
+ ...state,
244
225
  canvas: {
226
+ ...canvas,
245
227
  triggers,
246
228
  blocks: newBlocks
247
229
  }
248
230
  };
249
- },
250
- down: () => {
251
- throw new Error("Migration down not implemented");
252
231
  }
253
232
  }),
254
- createMigration({
233
+ createMigration$1({
255
234
  version: "3.0.0",
256
- up: (state) => {
257
- return {
258
- ...state,
259
- type: "default"
260
- };
261
- },
262
- down: () => {
263
- throw new Error("Migration down not implemented");
264
- }
235
+ up: (state) => ({
236
+ ...state,
237
+ type: "default"
238
+ })
265
239
  }),
266
- createMigration({
240
+ createMigration$1({
267
241
  version: "4.0.0",
268
- up: finalVersion,
269
- down: () => {
270
- throw new Error("Migration down not implemented");
271
- }
242
+ up: finalVersion
272
243
  })
273
244
  ]
274
245
  });