@pipelab/plugin-core 1.0.0-beta.1 → 1.0.0-beta.10
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 +53 -91
- package/dist/index.mjs +53 -91
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -5
- package/CHANGELOG.md +0 -19
- package/src/archive-utils.ts +0 -127
- package/src/create-plugin.ts +0 -8
- package/src/custom-errors.ts +0 -11
- package/src/fs-utils.ts +0 -31
- package/src/node-utils.ts +0 -52
- package/src/pipelab.ts +0 -95
- package/src/utils.ts +0 -26
- package/tsconfig.json +0 -9
- package/tsdown.config.ts +0 -15
package/dist/index.cjs
CHANGED
|
@@ -51,24 +51,16 @@ let archiver = require("archiver");
|
|
|
51
51
|
archiver = __toESM(archiver);
|
|
52
52
|
let zod = require("zod");
|
|
53
53
|
//#region ../../packages/migration/src/models/createMigration.ts
|
|
54
|
-
function createMigration(migration) {
|
|
54
|
+
function createMigration$1(migration) {
|
|
55
55
|
return {
|
|
56
56
|
version: migration.version,
|
|
57
57
|
up: async (state, nextVersion) => {
|
|
58
|
-
const newState = await migration.up(state, nextVersion);
|
|
59
|
-
newState.version = nextVersion;
|
|
60
|
-
return newState;
|
|
61
|
-
},
|
|
62
|
-
down: async (state, nextVersion) => {
|
|
63
|
-
const newState = await migration.down(state, nextVersion);
|
|
58
|
+
const newState = migration.up ? await migration.up(state, nextVersion) : state;
|
|
64
59
|
newState.version = nextVersion;
|
|
65
60
|
return newState;
|
|
66
61
|
}
|
|
67
62
|
};
|
|
68
63
|
}
|
|
69
|
-
const initialVersion = () => {
|
|
70
|
-
throw new Error("Unable to go down on the initial version!");
|
|
71
|
-
};
|
|
72
64
|
const finalVersion = () => {
|
|
73
65
|
throw new Error("Unable to go up on the final version!");
|
|
74
66
|
};
|
|
@@ -1987,20 +1979,19 @@ var Migrator = class {
|
|
|
1987
1979
|
if (currentIndex === -1) throw new Error(`Current version "${currentVersion}" not found in migrations`);
|
|
1988
1980
|
if (targetIndex === -1) throw new Error(`Target version "${targetVersion}" not found in migrations`);
|
|
1989
1981
|
if (currentIndex === targetIndex) return finalState;
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
const direction = isUpgrade ? "up" : "down";
|
|
1993
|
-
for (let i = currentIndex; isUpgrade ? i < targetIndex : i > targetIndex; i += increment) {
|
|
1982
|
+
if (!(currentIndex < targetIndex)) return finalState;
|
|
1983
|
+
for (let i = currentIndex; i < targetIndex; i++) {
|
|
1994
1984
|
const currentVersion = versions[i];
|
|
1995
|
-
const nextVersion = versions[i +
|
|
1985
|
+
const nextVersion = versions[i + 1];
|
|
1996
1986
|
if (options?.debug) console.log(" Migrating to version:", nextVersion);
|
|
1997
1987
|
const migrationVersion = currentVersion;
|
|
1998
1988
|
const migration = this.migrations[migrationVersion];
|
|
1999
1989
|
const { version: _, ...stateWithoutVersion } = finalState;
|
|
2000
1990
|
finalState = {
|
|
2001
|
-
...await migration
|
|
1991
|
+
...await migration.up(stateWithoutVersion, currentVersion),
|
|
2002
1992
|
version: nextVersion
|
|
2003
1993
|
};
|
|
1994
|
+
if (options?.onStep) await options.onStep(finalState, nextVersion);
|
|
2004
1995
|
if (options?.debug) console.log(" Migrated state:", finalState);
|
|
2005
1996
|
}
|
|
2006
1997
|
return finalState;
|
|
@@ -2027,10 +2018,9 @@ const createMigrator = () => {
|
|
|
2027
2018
|
};
|
|
2028
2019
|
//#endregion
|
|
2029
2020
|
//#region ../../packages/shared/src/config/migrators.ts
|
|
2021
|
+
const createMigration = (config) => createMigration$1(config);
|
|
2030
2022
|
const settingsMigratorInternal = createMigrator();
|
|
2031
2023
|
const defaultAppSettings$1 = settingsMigratorInternal.createDefault({
|
|
2032
|
-
cacheFolder: "",
|
|
2033
|
-
clearTemporaryFoldersOnPipelineEnd: false,
|
|
2034
2024
|
locale: "en-US",
|
|
2035
2025
|
theme: "light",
|
|
2036
2026
|
version: "7.0.0",
|
|
@@ -2045,15 +2035,19 @@ const defaultAppSettings$1 = settingsMigratorInternal.createDefault({
|
|
|
2045
2035
|
step: 0,
|
|
2046
2036
|
completed: false
|
|
2047
2037
|
}
|
|
2048
|
-
}
|
|
2038
|
+
},
|
|
2039
|
+
buildHistory: { retentionPolicy: {
|
|
2040
|
+
enabled: false,
|
|
2041
|
+
maxEntries: 50,
|
|
2042
|
+
maxAge: 30
|
|
2043
|
+
} }
|
|
2049
2044
|
});
|
|
2050
2045
|
const appSettingsMigrator$1 = settingsMigratorInternal.createMigrations({
|
|
2051
2046
|
defaultValue: defaultAppSettings$1,
|
|
2052
2047
|
migrations: [
|
|
2053
2048
|
createMigration({
|
|
2054
2049
|
version: "1.0.0",
|
|
2055
|
-
up: (state) => state
|
|
2056
|
-
down: initialVersion
|
|
2050
|
+
up: (state) => state
|
|
2057
2051
|
}),
|
|
2058
2052
|
createMigration({
|
|
2059
2053
|
version: "2.0.0",
|
|
@@ -2062,9 +2056,6 @@ const appSettingsMigrator$1 = settingsMigratorInternal.createMigrations({
|
|
|
2062
2056
|
...state,
|
|
2063
2057
|
clearTemporaryFoldersOnPipelineEnd: false
|
|
2064
2058
|
};
|
|
2065
|
-
},
|
|
2066
|
-
down: () => {
|
|
2067
|
-
throw new Error("Can't migrate down from 2.0.0");
|
|
2068
2059
|
}
|
|
2069
2060
|
}),
|
|
2070
2061
|
createMigration({
|
|
@@ -2072,11 +2063,7 @@ const appSettingsMigrator$1 = settingsMigratorInternal.createMigrations({
|
|
|
2072
2063
|
up: (state) => ({
|
|
2073
2064
|
...state,
|
|
2074
2065
|
locale: "en-US"
|
|
2075
|
-
})
|
|
2076
|
-
down: (state) => {
|
|
2077
|
-
const { locale, ...rest } = state;
|
|
2078
|
-
return rest;
|
|
2079
|
-
}
|
|
2066
|
+
})
|
|
2080
2067
|
}),
|
|
2081
2068
|
createMigration({
|
|
2082
2069
|
version: "4.0.0",
|
|
@@ -2092,40 +2079,32 @@ const appSettingsMigrator$1 = settingsMigratorInternal.createMigrations({
|
|
|
2092
2079
|
completed: false
|
|
2093
2080
|
}
|
|
2094
2081
|
}
|
|
2095
|
-
})
|
|
2096
|
-
down: (state) => {
|
|
2097
|
-
const { tours, ...rest } = state;
|
|
2098
|
-
return rest;
|
|
2099
|
-
}
|
|
2082
|
+
})
|
|
2100
2083
|
}),
|
|
2101
2084
|
createMigration({
|
|
2102
2085
|
version: "5.0.0",
|
|
2103
2086
|
up: (state) => ({
|
|
2104
2087
|
...state,
|
|
2105
2088
|
autosave: true
|
|
2106
|
-
})
|
|
2107
|
-
down: (state) => {
|
|
2108
|
-
const { autosave, ...rest } = state;
|
|
2109
|
-
return rest;
|
|
2110
|
-
}
|
|
2089
|
+
})
|
|
2111
2090
|
}),
|
|
2112
2091
|
createMigration({
|
|
2113
2092
|
version: "6.0.0",
|
|
2114
|
-
up: (state) =>
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2093
|
+
up: (state) => {
|
|
2094
|
+
return {
|
|
2095
|
+
...state,
|
|
2096
|
+
agents: [],
|
|
2097
|
+
buildHistory: { retentionPolicy: {
|
|
2098
|
+
enabled: false,
|
|
2099
|
+
maxEntries: 50,
|
|
2100
|
+
maxAge: 30
|
|
2101
|
+
} }
|
|
2102
|
+
};
|
|
2121
2103
|
}
|
|
2122
2104
|
}),
|
|
2123
2105
|
createMigration({
|
|
2124
2106
|
version: "7.0.0",
|
|
2125
|
-
up: finalVersion
|
|
2126
|
-
down: () => {
|
|
2127
|
-
throw new Error("Can't migrate down from 7.0.0");
|
|
2128
|
-
}
|
|
2107
|
+
up: finalVersion
|
|
2129
2108
|
})
|
|
2130
2109
|
]
|
|
2131
2110
|
});
|
|
@@ -2137,38 +2116,33 @@ const defaultFileRepo$1 = fileRepoMigratorInternal.createDefault({
|
|
|
2137
2116
|
name: "Default project",
|
|
2138
2117
|
description: "The initial default project"
|
|
2139
2118
|
}],
|
|
2140
|
-
pipelines: []
|
|
2141
|
-
proxies: []
|
|
2119
|
+
pipelines: []
|
|
2142
2120
|
});
|
|
2143
2121
|
const fileRepoMigrations$1 = fileRepoMigratorInternal.createMigrations({
|
|
2144
2122
|
defaultValue: defaultFileRepo$1,
|
|
2145
2123
|
migrations: [createMigration({
|
|
2146
2124
|
version: "1.0.0",
|
|
2147
2125
|
up: (state) => {
|
|
2126
|
+
const pipelines = Object.entries(state.data || {}).map(([id, file]) => {
|
|
2127
|
+
return {
|
|
2128
|
+
...file,
|
|
2129
|
+
id,
|
|
2130
|
+
project: "main"
|
|
2131
|
+
};
|
|
2132
|
+
});
|
|
2148
2133
|
return {
|
|
2149
|
-
|
|
2134
|
+
...state,
|
|
2150
2135
|
projects: [{
|
|
2151
2136
|
id: "main",
|
|
2152
2137
|
name: "Default project",
|
|
2153
2138
|
description: "The initial default project"
|
|
2154
2139
|
}],
|
|
2155
|
-
pipelines
|
|
2156
|
-
return {
|
|
2157
|
-
...file,
|
|
2158
|
-
id,
|
|
2159
|
-
project: "main"
|
|
2160
|
-
};
|
|
2161
|
-
}),
|
|
2162
|
-
proxies: []
|
|
2140
|
+
pipelines
|
|
2163
2141
|
};
|
|
2164
|
-
}
|
|
2165
|
-
down: initialVersion
|
|
2142
|
+
}
|
|
2166
2143
|
}), createMigration({
|
|
2167
2144
|
version: "2.0.0",
|
|
2168
|
-
up: finalVersion
|
|
2169
|
-
down: (state) => {
|
|
2170
|
-
throw new Error("Cannot downgrade to version 1.0.0");
|
|
2171
|
-
}
|
|
2145
|
+
up: finalVersion
|
|
2172
2146
|
})]
|
|
2173
2147
|
});
|
|
2174
2148
|
const savedFileMigratorInternal = createMigrator();
|
|
@@ -2195,21 +2169,19 @@ const savedFileMigrator$1 = savedFileMigratorInternal.createMigrations({
|
|
|
2195
2169
|
for (const block of blocks) if (block.type === "event") triggers.push(block);
|
|
2196
2170
|
else newBlocks.push(block);
|
|
2197
2171
|
return {
|
|
2172
|
+
...state,
|
|
2198
2173
|
canvas: {
|
|
2174
|
+
...state.canvas,
|
|
2199
2175
|
blocks: newBlocks,
|
|
2200
2176
|
triggers
|
|
2201
|
-
}
|
|
2202
|
-
description: state.description,
|
|
2203
|
-
name: state.name,
|
|
2204
|
-
variables: state.variables
|
|
2177
|
+
}
|
|
2205
2178
|
};
|
|
2206
|
-
}
|
|
2207
|
-
down: initialVersion
|
|
2179
|
+
}
|
|
2208
2180
|
}),
|
|
2209
2181
|
createMigration({
|
|
2210
2182
|
version: "2.0.0",
|
|
2211
2183
|
up: (state) => {
|
|
2212
|
-
const { canvas
|
|
2184
|
+
const { canvas } = state;
|
|
2213
2185
|
const { blocks, triggers } = canvas;
|
|
2214
2186
|
const newBlocks = [];
|
|
2215
2187
|
for (const block of blocks) {
|
|
@@ -2228,35 +2200,25 @@ const savedFileMigrator$1 = savedFileMigratorInternal.createMigrations({
|
|
|
2228
2200
|
});
|
|
2229
2201
|
}
|
|
2230
2202
|
return {
|
|
2231
|
-
...
|
|
2203
|
+
...state,
|
|
2232
2204
|
canvas: {
|
|
2205
|
+
...canvas,
|
|
2233
2206
|
triggers,
|
|
2234
2207
|
blocks: newBlocks
|
|
2235
2208
|
}
|
|
2236
2209
|
};
|
|
2237
|
-
},
|
|
2238
|
-
down: () => {
|
|
2239
|
-
throw new Error("Migration down not implemented");
|
|
2240
2210
|
}
|
|
2241
2211
|
}),
|
|
2242
2212
|
createMigration({
|
|
2243
2213
|
version: "3.0.0",
|
|
2244
|
-
up: (state) => {
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
};
|
|
2249
|
-
},
|
|
2250
|
-
down: () => {
|
|
2251
|
-
throw new Error("Migration down not implemented");
|
|
2252
|
-
}
|
|
2214
|
+
up: (state) => ({
|
|
2215
|
+
...state,
|
|
2216
|
+
type: "default"
|
|
2217
|
+
})
|
|
2253
2218
|
}),
|
|
2254
2219
|
createMigration({
|
|
2255
2220
|
version: "4.0.0",
|
|
2256
|
-
up: finalVersion
|
|
2257
|
-
down: () => {
|
|
2258
|
-
throw new Error("Migration down not implemented");
|
|
2259
|
-
}
|
|
2221
|
+
up: finalVersion
|
|
2260
2222
|
})
|
|
2261
2223
|
]
|
|
2262
2224
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -47,24 +47,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
47
47
|
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region ../../packages/migration/src/models/createMigration.ts
|
|
50
|
-
function createMigration(migration) {
|
|
50
|
+
function createMigration$1(migration) {
|
|
51
51
|
return {
|
|
52
52
|
version: migration.version,
|
|
53
53
|
up: async (state, nextVersion) => {
|
|
54
|
-
const newState = await migration.up(state, nextVersion);
|
|
55
|
-
newState.version = nextVersion;
|
|
56
|
-
return newState;
|
|
57
|
-
},
|
|
58
|
-
down: async (state, nextVersion) => {
|
|
59
|
-
const newState = await migration.down(state, nextVersion);
|
|
54
|
+
const newState = migration.up ? await migration.up(state, nextVersion) : state;
|
|
60
55
|
newState.version = nextVersion;
|
|
61
56
|
return newState;
|
|
62
57
|
}
|
|
63
58
|
};
|
|
64
59
|
}
|
|
65
|
-
const initialVersion = () => {
|
|
66
|
-
throw new Error("Unable to go down on the initial version!");
|
|
67
|
-
};
|
|
68
60
|
const finalVersion = () => {
|
|
69
61
|
throw new Error("Unable to go up on the final version!");
|
|
70
62
|
};
|
|
@@ -1983,20 +1975,19 @@ var Migrator = class {
|
|
|
1983
1975
|
if (currentIndex === -1) throw new Error(`Current version "${currentVersion}" not found in migrations`);
|
|
1984
1976
|
if (targetIndex === -1) throw new Error(`Target version "${targetVersion}" not found in migrations`);
|
|
1985
1977
|
if (currentIndex === targetIndex) return finalState;
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
const direction = isUpgrade ? "up" : "down";
|
|
1989
|
-
for (let i = currentIndex; isUpgrade ? i < targetIndex : i > targetIndex; i += increment) {
|
|
1978
|
+
if (!(currentIndex < targetIndex)) return finalState;
|
|
1979
|
+
for (let i = currentIndex; i < targetIndex; i++) {
|
|
1990
1980
|
const currentVersion = versions[i];
|
|
1991
|
-
const nextVersion = versions[i +
|
|
1981
|
+
const nextVersion = versions[i + 1];
|
|
1992
1982
|
if (options?.debug) console.log(" Migrating to version:", nextVersion);
|
|
1993
1983
|
const migrationVersion = currentVersion;
|
|
1994
1984
|
const migration = this.migrations[migrationVersion];
|
|
1995
1985
|
const { version: _, ...stateWithoutVersion } = finalState;
|
|
1996
1986
|
finalState = {
|
|
1997
|
-
...await migration
|
|
1987
|
+
...await migration.up(stateWithoutVersion, currentVersion),
|
|
1998
1988
|
version: nextVersion
|
|
1999
1989
|
};
|
|
1990
|
+
if (options?.onStep) await options.onStep(finalState, nextVersion);
|
|
2000
1991
|
if (options?.debug) console.log(" Migrated state:", finalState);
|
|
2001
1992
|
}
|
|
2002
1993
|
return finalState;
|
|
@@ -2023,10 +2014,9 @@ const createMigrator = () => {
|
|
|
2023
2014
|
};
|
|
2024
2015
|
//#endregion
|
|
2025
2016
|
//#region ../../packages/shared/src/config/migrators.ts
|
|
2017
|
+
const createMigration = (config) => createMigration$1(config);
|
|
2026
2018
|
const settingsMigratorInternal = createMigrator();
|
|
2027
2019
|
const defaultAppSettings$1 = settingsMigratorInternal.createDefault({
|
|
2028
|
-
cacheFolder: "",
|
|
2029
|
-
clearTemporaryFoldersOnPipelineEnd: false,
|
|
2030
2020
|
locale: "en-US",
|
|
2031
2021
|
theme: "light",
|
|
2032
2022
|
version: "7.0.0",
|
|
@@ -2041,15 +2031,19 @@ const defaultAppSettings$1 = settingsMigratorInternal.createDefault({
|
|
|
2041
2031
|
step: 0,
|
|
2042
2032
|
completed: false
|
|
2043
2033
|
}
|
|
2044
|
-
}
|
|
2034
|
+
},
|
|
2035
|
+
buildHistory: { retentionPolicy: {
|
|
2036
|
+
enabled: false,
|
|
2037
|
+
maxEntries: 50,
|
|
2038
|
+
maxAge: 30
|
|
2039
|
+
} }
|
|
2045
2040
|
});
|
|
2046
2041
|
const appSettingsMigrator$1 = settingsMigratorInternal.createMigrations({
|
|
2047
2042
|
defaultValue: defaultAppSettings$1,
|
|
2048
2043
|
migrations: [
|
|
2049
2044
|
createMigration({
|
|
2050
2045
|
version: "1.0.0",
|
|
2051
|
-
up: (state) => state
|
|
2052
|
-
down: initialVersion
|
|
2046
|
+
up: (state) => state
|
|
2053
2047
|
}),
|
|
2054
2048
|
createMigration({
|
|
2055
2049
|
version: "2.0.0",
|
|
@@ -2058,9 +2052,6 @@ const appSettingsMigrator$1 = settingsMigratorInternal.createMigrations({
|
|
|
2058
2052
|
...state,
|
|
2059
2053
|
clearTemporaryFoldersOnPipelineEnd: false
|
|
2060
2054
|
};
|
|
2061
|
-
},
|
|
2062
|
-
down: () => {
|
|
2063
|
-
throw new Error("Can't migrate down from 2.0.0");
|
|
2064
2055
|
}
|
|
2065
2056
|
}),
|
|
2066
2057
|
createMigration({
|
|
@@ -2068,11 +2059,7 @@ const appSettingsMigrator$1 = settingsMigratorInternal.createMigrations({
|
|
|
2068
2059
|
up: (state) => ({
|
|
2069
2060
|
...state,
|
|
2070
2061
|
locale: "en-US"
|
|
2071
|
-
})
|
|
2072
|
-
down: (state) => {
|
|
2073
|
-
const { locale, ...rest } = state;
|
|
2074
|
-
return rest;
|
|
2075
|
-
}
|
|
2062
|
+
})
|
|
2076
2063
|
}),
|
|
2077
2064
|
createMigration({
|
|
2078
2065
|
version: "4.0.0",
|
|
@@ -2088,40 +2075,32 @@ const appSettingsMigrator$1 = settingsMigratorInternal.createMigrations({
|
|
|
2088
2075
|
completed: false
|
|
2089
2076
|
}
|
|
2090
2077
|
}
|
|
2091
|
-
})
|
|
2092
|
-
down: (state) => {
|
|
2093
|
-
const { tours, ...rest } = state;
|
|
2094
|
-
return rest;
|
|
2095
|
-
}
|
|
2078
|
+
})
|
|
2096
2079
|
}),
|
|
2097
2080
|
createMigration({
|
|
2098
2081
|
version: "5.0.0",
|
|
2099
2082
|
up: (state) => ({
|
|
2100
2083
|
...state,
|
|
2101
2084
|
autosave: true
|
|
2102
|
-
})
|
|
2103
|
-
down: (state) => {
|
|
2104
|
-
const { autosave, ...rest } = state;
|
|
2105
|
-
return rest;
|
|
2106
|
-
}
|
|
2085
|
+
})
|
|
2107
2086
|
}),
|
|
2108
2087
|
createMigration({
|
|
2109
2088
|
version: "6.0.0",
|
|
2110
|
-
up: (state) =>
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2089
|
+
up: (state) => {
|
|
2090
|
+
return {
|
|
2091
|
+
...state,
|
|
2092
|
+
agents: [],
|
|
2093
|
+
buildHistory: { retentionPolicy: {
|
|
2094
|
+
enabled: false,
|
|
2095
|
+
maxEntries: 50,
|
|
2096
|
+
maxAge: 30
|
|
2097
|
+
} }
|
|
2098
|
+
};
|
|
2117
2099
|
}
|
|
2118
2100
|
}),
|
|
2119
2101
|
createMigration({
|
|
2120
2102
|
version: "7.0.0",
|
|
2121
|
-
up: finalVersion
|
|
2122
|
-
down: () => {
|
|
2123
|
-
throw new Error("Can't migrate down from 7.0.0");
|
|
2124
|
-
}
|
|
2103
|
+
up: finalVersion
|
|
2125
2104
|
})
|
|
2126
2105
|
]
|
|
2127
2106
|
});
|
|
@@ -2133,38 +2112,33 @@ const defaultFileRepo$1 = fileRepoMigratorInternal.createDefault({
|
|
|
2133
2112
|
name: "Default project",
|
|
2134
2113
|
description: "The initial default project"
|
|
2135
2114
|
}],
|
|
2136
|
-
pipelines: []
|
|
2137
|
-
proxies: []
|
|
2115
|
+
pipelines: []
|
|
2138
2116
|
});
|
|
2139
2117
|
const fileRepoMigrations$1 = fileRepoMigratorInternal.createMigrations({
|
|
2140
2118
|
defaultValue: defaultFileRepo$1,
|
|
2141
2119
|
migrations: [createMigration({
|
|
2142
2120
|
version: "1.0.0",
|
|
2143
2121
|
up: (state) => {
|
|
2122
|
+
const pipelines = Object.entries(state.data || {}).map(([id, file]) => {
|
|
2123
|
+
return {
|
|
2124
|
+
...file,
|
|
2125
|
+
id,
|
|
2126
|
+
project: "main"
|
|
2127
|
+
};
|
|
2128
|
+
});
|
|
2144
2129
|
return {
|
|
2145
|
-
|
|
2130
|
+
...state,
|
|
2146
2131
|
projects: [{
|
|
2147
2132
|
id: "main",
|
|
2148
2133
|
name: "Default project",
|
|
2149
2134
|
description: "The initial default project"
|
|
2150
2135
|
}],
|
|
2151
|
-
pipelines
|
|
2152
|
-
return {
|
|
2153
|
-
...file,
|
|
2154
|
-
id,
|
|
2155
|
-
project: "main"
|
|
2156
|
-
};
|
|
2157
|
-
}),
|
|
2158
|
-
proxies: []
|
|
2136
|
+
pipelines
|
|
2159
2137
|
};
|
|
2160
|
-
}
|
|
2161
|
-
down: initialVersion
|
|
2138
|
+
}
|
|
2162
2139
|
}), createMigration({
|
|
2163
2140
|
version: "2.0.0",
|
|
2164
|
-
up: finalVersion
|
|
2165
|
-
down: (state) => {
|
|
2166
|
-
throw new Error("Cannot downgrade to version 1.0.0");
|
|
2167
|
-
}
|
|
2141
|
+
up: finalVersion
|
|
2168
2142
|
})]
|
|
2169
2143
|
});
|
|
2170
2144
|
const savedFileMigratorInternal = createMigrator();
|
|
@@ -2191,21 +2165,19 @@ const savedFileMigrator$1 = savedFileMigratorInternal.createMigrations({
|
|
|
2191
2165
|
for (const block of blocks) if (block.type === "event") triggers.push(block);
|
|
2192
2166
|
else newBlocks.push(block);
|
|
2193
2167
|
return {
|
|
2168
|
+
...state,
|
|
2194
2169
|
canvas: {
|
|
2170
|
+
...state.canvas,
|
|
2195
2171
|
blocks: newBlocks,
|
|
2196
2172
|
triggers
|
|
2197
|
-
}
|
|
2198
|
-
description: state.description,
|
|
2199
|
-
name: state.name,
|
|
2200
|
-
variables: state.variables
|
|
2173
|
+
}
|
|
2201
2174
|
};
|
|
2202
|
-
}
|
|
2203
|
-
down: initialVersion
|
|
2175
|
+
}
|
|
2204
2176
|
}),
|
|
2205
2177
|
createMigration({
|
|
2206
2178
|
version: "2.0.0",
|
|
2207
2179
|
up: (state) => {
|
|
2208
|
-
const { canvas
|
|
2180
|
+
const { canvas } = state;
|
|
2209
2181
|
const { blocks, triggers } = canvas;
|
|
2210
2182
|
const newBlocks = [];
|
|
2211
2183
|
for (const block of blocks) {
|
|
@@ -2224,35 +2196,25 @@ const savedFileMigrator$1 = savedFileMigratorInternal.createMigrations({
|
|
|
2224
2196
|
});
|
|
2225
2197
|
}
|
|
2226
2198
|
return {
|
|
2227
|
-
...
|
|
2199
|
+
...state,
|
|
2228
2200
|
canvas: {
|
|
2201
|
+
...canvas,
|
|
2229
2202
|
triggers,
|
|
2230
2203
|
blocks: newBlocks
|
|
2231
2204
|
}
|
|
2232
2205
|
};
|
|
2233
|
-
},
|
|
2234
|
-
down: () => {
|
|
2235
|
-
throw new Error("Migration down not implemented");
|
|
2236
2206
|
}
|
|
2237
2207
|
}),
|
|
2238
2208
|
createMigration({
|
|
2239
2209
|
version: "3.0.0",
|
|
2240
|
-
up: (state) => {
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
};
|
|
2245
|
-
},
|
|
2246
|
-
down: () => {
|
|
2247
|
-
throw new Error("Migration down not implemented");
|
|
2248
|
-
}
|
|
2210
|
+
up: (state) => ({
|
|
2211
|
+
...state,
|
|
2212
|
+
type: "default"
|
|
2213
|
+
})
|
|
2249
2214
|
}),
|
|
2250
2215
|
createMigration({
|
|
2251
2216
|
version: "4.0.0",
|
|
2252
|
-
up: finalVersion
|
|
2253
|
-
down: () => {
|
|
2254
|
-
throw new Error("Migration down not implemented");
|
|
2255
|
-
}
|
|
2217
|
+
up: finalVersion
|
|
2256
2218
|
})
|
|
2257
2219
|
]
|
|
2258
2220
|
});
|