pocketbase-zod-schema 0.1.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/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +167 -0
- package/dist/cli/index.cjs +3383 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.d.cts +30 -0
- package/dist/cli/index.d.ts +30 -0
- package/dist/cli/index.js +3331 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/migrate.cjs +3380 -0
- package/dist/cli/migrate.cjs.map +1 -0
- package/dist/cli/migrate.d.cts +1 -0
- package/dist/cli/migrate.d.ts +1 -0
- package/dist/cli/migrate.js +3353 -0
- package/dist/cli/migrate.js.map +1 -0
- package/dist/cli/utils/index.cjs +540 -0
- package/dist/cli/utils/index.cjs.map +1 -0
- package/dist/cli/utils/index.d.cts +232 -0
- package/dist/cli/utils/index.d.ts +232 -0
- package/dist/cli/utils/index.js +487 -0
- package/dist/cli/utils/index.js.map +1 -0
- package/dist/enums.cjs +19 -0
- package/dist/enums.cjs.map +1 -0
- package/dist/enums.d.cts +6 -0
- package/dist/enums.d.ts +6 -0
- package/dist/enums.js +17 -0
- package/dist/enums.js.map +1 -0
- package/dist/index.cjs +4900 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +4726 -0
- package/dist/index.js.map +1 -0
- package/dist/migration/analyzer.cjs +1267 -0
- package/dist/migration/analyzer.cjs.map +1 -0
- package/dist/migration/analyzer.d.cts +186 -0
- package/dist/migration/analyzer.d.ts +186 -0
- package/dist/migration/analyzer.js +1232 -0
- package/dist/migration/analyzer.js.map +1 -0
- package/dist/migration/diff.cjs +557 -0
- package/dist/migration/diff.cjs.map +1 -0
- package/dist/migration/diff.d.cts +291 -0
- package/dist/migration/diff.d.ts +291 -0
- package/dist/migration/diff.js +534 -0
- package/dist/migration/diff.js.map +1 -0
- package/dist/migration/generator.cjs +778 -0
- package/dist/migration/generator.cjs.map +1 -0
- package/dist/migration/generator.d.cts +225 -0
- package/dist/migration/generator.d.ts +225 -0
- package/dist/migration/generator.js +737 -0
- package/dist/migration/generator.js.map +1 -0
- package/dist/migration/index.cjs +3390 -0
- package/dist/migration/index.cjs.map +1 -0
- package/dist/migration/index.d.cts +103 -0
- package/dist/migration/index.d.ts +103 -0
- package/dist/migration/index.js +3265 -0
- package/dist/migration/index.js.map +1 -0
- package/dist/migration/snapshot.cjs +609 -0
- package/dist/migration/snapshot.cjs.map +1 -0
- package/dist/migration/snapshot.d.cts +167 -0
- package/dist/migration/snapshot.d.ts +167 -0
- package/dist/migration/snapshot.js +575 -0
- package/dist/migration/snapshot.js.map +1 -0
- package/dist/migration/utils/index.cjs +672 -0
- package/dist/migration/utils/index.cjs.map +1 -0
- package/dist/migration/utils/index.d.cts +207 -0
- package/dist/migration/utils/index.d.ts +207 -0
- package/dist/migration/utils/index.js +641 -0
- package/dist/migration/utils/index.js.map +1 -0
- package/dist/mutator.cjs +427 -0
- package/dist/mutator.cjs.map +1 -0
- package/dist/mutator.d.cts +190 -0
- package/dist/mutator.d.ts +190 -0
- package/dist/mutator.js +425 -0
- package/dist/mutator.js.map +1 -0
- package/dist/permissions-ZHafVSIx.d.cts +71 -0
- package/dist/permissions-ZHafVSIx.d.ts +71 -0
- package/dist/schema.cjs +430 -0
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.cts +316 -0
- package/dist/schema.d.ts +316 -0
- package/dist/schema.js +396 -0
- package/dist/schema.js.map +1 -0
- package/dist/types-BbTgmg6H.d.cts +91 -0
- package/dist/types-z1Dkjg8m.d.ts +91 -0
- package/dist/types.cjs +4 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +14 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/user-jS1aYoeD.d.cts +123 -0
- package/dist/user-jS1aYoeD.d.ts +123 -0
- package/package.json +165 -0
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fs = require('fs');
|
|
4
|
+
var path = require('path');
|
|
5
|
+
|
|
6
|
+
function _interopNamespace(e) {
|
|
7
|
+
if (e && e.__esModule) return e;
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return e[k]; }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
25
|
+
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
26
|
+
|
|
27
|
+
// src/migration/generator.ts
|
|
28
|
+
|
|
29
|
+
// src/migration/errors.ts
|
|
30
|
+
var MigrationError = class _MigrationError extends Error {
|
|
31
|
+
constructor(message) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.name = "MigrationError";
|
|
34
|
+
Object.setPrototypeOf(this, _MigrationError.prototype);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var MigrationGenerationError = class _MigrationGenerationError extends MigrationError {
|
|
38
|
+
migrationPath;
|
|
39
|
+
originalError;
|
|
40
|
+
constructor(message, migrationPath, originalError) {
|
|
41
|
+
super(message);
|
|
42
|
+
this.name = "MigrationGenerationError";
|
|
43
|
+
this.migrationPath = migrationPath;
|
|
44
|
+
this.originalError = originalError;
|
|
45
|
+
Object.setPrototypeOf(this, _MigrationGenerationError.prototype);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Creates a formatted error message with migration path and original error details
|
|
49
|
+
*/
|
|
50
|
+
getDetailedMessage() {
|
|
51
|
+
const parts = [this.message];
|
|
52
|
+
if (this.migrationPath) {
|
|
53
|
+
parts.push(`
|
|
54
|
+
Migration: ${this.migrationPath}`);
|
|
55
|
+
}
|
|
56
|
+
if (this.originalError) {
|
|
57
|
+
parts.push(`
|
|
58
|
+
Cause: ${this.originalError.message}`);
|
|
59
|
+
}
|
|
60
|
+
return parts.join("");
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var FileSystemError = class _FileSystemError extends MigrationError {
|
|
64
|
+
path;
|
|
65
|
+
operation;
|
|
66
|
+
code;
|
|
67
|
+
originalError;
|
|
68
|
+
constructor(message, path2, operation, code, originalError) {
|
|
69
|
+
super(message);
|
|
70
|
+
this.name = "FileSystemError";
|
|
71
|
+
this.path = path2;
|
|
72
|
+
this.operation = operation;
|
|
73
|
+
this.code = code;
|
|
74
|
+
this.originalError = originalError;
|
|
75
|
+
Object.setPrototypeOf(this, _FileSystemError.prototype);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Creates a formatted error message with path, operation, and error code details
|
|
79
|
+
*/
|
|
80
|
+
getDetailedMessage() {
|
|
81
|
+
const parts = [this.message];
|
|
82
|
+
if (this.operation) {
|
|
83
|
+
parts.push(`
|
|
84
|
+
Operation: ${this.operation}`);
|
|
85
|
+
}
|
|
86
|
+
if (this.path) {
|
|
87
|
+
parts.push(`
|
|
88
|
+
Path: ${this.path}`);
|
|
89
|
+
}
|
|
90
|
+
if (this.code) {
|
|
91
|
+
parts.push(`
|
|
92
|
+
Error Code: ${this.code}`);
|
|
93
|
+
}
|
|
94
|
+
if (this.originalError) {
|
|
95
|
+
parts.push(`
|
|
96
|
+
Cause: ${this.originalError.message}`);
|
|
97
|
+
}
|
|
98
|
+
return parts.join("");
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// src/migration/generator.ts
|
|
103
|
+
var DEFAULT_TEMPLATE = `/// <reference path="{{TYPES_PATH}}" />
|
|
104
|
+
migrate((app) => {
|
|
105
|
+
{{UP_CODE}}
|
|
106
|
+
return true;
|
|
107
|
+
}, (app) => {
|
|
108
|
+
{{DOWN_CODE}}
|
|
109
|
+
return true;
|
|
110
|
+
});
|
|
111
|
+
`;
|
|
112
|
+
var DEFAULT_CONFIG = {
|
|
113
|
+
workspaceRoot: process.cwd(),
|
|
114
|
+
timestampGenerator: () => Math.floor(Date.now() / 1e3).toString(),
|
|
115
|
+
template: DEFAULT_TEMPLATE,
|
|
116
|
+
includeTypeReference: true,
|
|
117
|
+
typesPath: "../pb_data/types.d.ts"
|
|
118
|
+
};
|
|
119
|
+
function mergeConfig(config) {
|
|
120
|
+
return {
|
|
121
|
+
...DEFAULT_CONFIG,
|
|
122
|
+
...config
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function resolveMigrationDir(config) {
|
|
126
|
+
const workspaceRoot = config.workspaceRoot || process.cwd();
|
|
127
|
+
if (path__namespace.isAbsolute(config.migrationDir)) {
|
|
128
|
+
return config.migrationDir;
|
|
129
|
+
}
|
|
130
|
+
return path__namespace.join(workspaceRoot, config.migrationDir);
|
|
131
|
+
}
|
|
132
|
+
function generateTimestamp(config) {
|
|
133
|
+
if (config?.timestampGenerator) {
|
|
134
|
+
return config.timestampGenerator();
|
|
135
|
+
}
|
|
136
|
+
return Math.floor(Date.now() / 1e3).toString();
|
|
137
|
+
}
|
|
138
|
+
function generateMigrationDescription(diff) {
|
|
139
|
+
const parts = [];
|
|
140
|
+
if (diff.collectionsToCreate.length > 0) {
|
|
141
|
+
if (diff.collectionsToCreate.length === 1) {
|
|
142
|
+
parts.push(`created_${diff.collectionsToCreate[0].name}`);
|
|
143
|
+
} else {
|
|
144
|
+
parts.push(`created_${diff.collectionsToCreate.length}_collections`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (diff.collectionsToDelete.length > 0) {
|
|
148
|
+
if (diff.collectionsToDelete.length === 1) {
|
|
149
|
+
parts.push(`deleted_${diff.collectionsToDelete[0].name}`);
|
|
150
|
+
} else {
|
|
151
|
+
parts.push(`deleted_${diff.collectionsToDelete.length}_collections`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (diff.collectionsToModify.length > 0) {
|
|
155
|
+
if (diff.collectionsToModify.length === 1) {
|
|
156
|
+
parts.push(`updated_${diff.collectionsToModify[0].collection}`);
|
|
157
|
+
} else {
|
|
158
|
+
parts.push(`updated_${diff.collectionsToModify.length}_collections`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (parts.length === 0) {
|
|
162
|
+
return "no_changes";
|
|
163
|
+
}
|
|
164
|
+
let description = parts.join("_");
|
|
165
|
+
if (description.length > 80) {
|
|
166
|
+
description = description.substring(0, 77) + "...";
|
|
167
|
+
}
|
|
168
|
+
return description;
|
|
169
|
+
}
|
|
170
|
+
function generateMigrationFilename(diff, config) {
|
|
171
|
+
const timestamp = generateTimestamp(config);
|
|
172
|
+
const description = generateMigrationDescription(diff);
|
|
173
|
+
return `${timestamp}_${description}.js`;
|
|
174
|
+
}
|
|
175
|
+
function createMigrationFileStructure(upCode, downCode, config) {
|
|
176
|
+
const mergedConfig = config ? mergeConfig(config) : DEFAULT_CONFIG;
|
|
177
|
+
let template = mergedConfig.template;
|
|
178
|
+
template = template.replace("{{TYPES_PATH}}", mergedConfig.typesPath);
|
|
179
|
+
template = template.replace("{{UP_CODE}}", upCode);
|
|
180
|
+
template = template.replace("{{DOWN_CODE}}", downCode);
|
|
181
|
+
if (!mergedConfig.includeTypeReference) {
|
|
182
|
+
template = template.replace(/\/\/\/ <reference path="[^"]*" \/>\n?/, "");
|
|
183
|
+
}
|
|
184
|
+
return template;
|
|
185
|
+
}
|
|
186
|
+
function writeMigrationFile(migrationDir, filename, content) {
|
|
187
|
+
try {
|
|
188
|
+
if (!fs__namespace.existsSync(migrationDir)) {
|
|
189
|
+
try {
|
|
190
|
+
fs__namespace.mkdirSync(migrationDir, { recursive: true });
|
|
191
|
+
} catch (error) {
|
|
192
|
+
const fsError = error;
|
|
193
|
+
if (fsError.code === "EACCES" || fsError.code === "EPERM") {
|
|
194
|
+
throw new FileSystemError(
|
|
195
|
+
`Permission denied creating migration directory. Check directory permissions.`,
|
|
196
|
+
migrationDir,
|
|
197
|
+
"create",
|
|
198
|
+
fsError.code,
|
|
199
|
+
error
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
throw new FileSystemError(
|
|
203
|
+
`Failed to create migration directory: ${fsError.message}`,
|
|
204
|
+
migrationDir,
|
|
205
|
+
"create",
|
|
206
|
+
fsError.code,
|
|
207
|
+
error
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const filePath = path__namespace.join(migrationDir, filename);
|
|
212
|
+
fs__namespace.writeFileSync(filePath, content, "utf-8");
|
|
213
|
+
return filePath;
|
|
214
|
+
} catch (error) {
|
|
215
|
+
if (error instanceof FileSystemError) {
|
|
216
|
+
throw error;
|
|
217
|
+
}
|
|
218
|
+
const fsError = error;
|
|
219
|
+
const filePath = path__namespace.join(migrationDir, filename);
|
|
220
|
+
if (fsError.code === "EACCES" || fsError.code === "EPERM") {
|
|
221
|
+
throw new FileSystemError(
|
|
222
|
+
`Permission denied writing migration file. Check file and directory permissions.`,
|
|
223
|
+
filePath,
|
|
224
|
+
"write",
|
|
225
|
+
fsError.code,
|
|
226
|
+
error
|
|
227
|
+
);
|
|
228
|
+
} else if (fsError.code === "ENOSPC") {
|
|
229
|
+
throw new FileSystemError(
|
|
230
|
+
`No space left on device when writing migration file.`,
|
|
231
|
+
filePath,
|
|
232
|
+
"write",
|
|
233
|
+
fsError.code,
|
|
234
|
+
error
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
throw new MigrationGenerationError(`Failed to write migration file: ${fsError.message}`, filePath, error);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function formatValue(value) {
|
|
241
|
+
if (value === null || value === void 0) {
|
|
242
|
+
return "null";
|
|
243
|
+
}
|
|
244
|
+
if (typeof value === "string") {
|
|
245
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n")}"`;
|
|
246
|
+
}
|
|
247
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
248
|
+
return String(value);
|
|
249
|
+
}
|
|
250
|
+
if (Array.isArray(value)) {
|
|
251
|
+
const items = value.map((v) => formatValue(v)).join(", ");
|
|
252
|
+
return `[${items}]`;
|
|
253
|
+
}
|
|
254
|
+
if (typeof value === "object") {
|
|
255
|
+
const entries = Object.entries(value).map(([k, v]) => `${k}: ${formatValue(v)}`).join(", ");
|
|
256
|
+
return `{ ${entries} }`;
|
|
257
|
+
}
|
|
258
|
+
return String(value);
|
|
259
|
+
}
|
|
260
|
+
function generateFieldDefinitionObject(field) {
|
|
261
|
+
const parts = [];
|
|
262
|
+
parts.push(` name: "${field.name}"`);
|
|
263
|
+
parts.push(` type: "${field.type}"`);
|
|
264
|
+
parts.push(` required: ${field.required}`);
|
|
265
|
+
if (field.unique !== void 0) {
|
|
266
|
+
parts.push(` unique: ${field.unique}`);
|
|
267
|
+
}
|
|
268
|
+
if (field.options && Object.keys(field.options).length > 0) {
|
|
269
|
+
for (const [key, value] of Object.entries(field.options)) {
|
|
270
|
+
parts.push(` ${key}: ${formatValue(value)}`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (field.relation) {
|
|
274
|
+
const collectionIdPlaceholder = field.relation.collection === "Users" ? '"_pb_users_auth_"' : `app.findCollectionByNameOrId("${field.relation.collection}").id`;
|
|
275
|
+
parts.push(` collectionId: ${collectionIdPlaceholder}`);
|
|
276
|
+
if (field.relation.maxSelect !== void 0) {
|
|
277
|
+
parts.push(` maxSelect: ${field.relation.maxSelect}`);
|
|
278
|
+
}
|
|
279
|
+
if (field.relation.minSelect !== void 0) {
|
|
280
|
+
parts.push(` minSelect: ${field.relation.minSelect}`);
|
|
281
|
+
}
|
|
282
|
+
if (field.relation.cascadeDelete !== void 0) {
|
|
283
|
+
parts.push(` cascadeDelete: ${field.relation.cascadeDelete}`);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return ` {
|
|
287
|
+
${parts.join(",\n")},
|
|
288
|
+
}`;
|
|
289
|
+
}
|
|
290
|
+
function generateFieldsArray(fields) {
|
|
291
|
+
if (fields.length === 0) {
|
|
292
|
+
return "[]";
|
|
293
|
+
}
|
|
294
|
+
const fieldObjects = fields.map((field) => generateFieldDefinitionObject(field));
|
|
295
|
+
return `[
|
|
296
|
+
${fieldObjects.join(",\n")},
|
|
297
|
+
]`;
|
|
298
|
+
}
|
|
299
|
+
function generateCollectionRules(rules) {
|
|
300
|
+
if (!rules) {
|
|
301
|
+
return "";
|
|
302
|
+
}
|
|
303
|
+
const parts = [];
|
|
304
|
+
if (rules.listRule !== void 0) {
|
|
305
|
+
parts.push(`listRule: ${formatValue(rules.listRule)}`);
|
|
306
|
+
}
|
|
307
|
+
if (rules.viewRule !== void 0) {
|
|
308
|
+
parts.push(`viewRule: ${formatValue(rules.viewRule)}`);
|
|
309
|
+
}
|
|
310
|
+
if (rules.createRule !== void 0) {
|
|
311
|
+
parts.push(`createRule: ${formatValue(rules.createRule)}`);
|
|
312
|
+
}
|
|
313
|
+
if (rules.updateRule !== void 0) {
|
|
314
|
+
parts.push(`updateRule: ${formatValue(rules.updateRule)}`);
|
|
315
|
+
}
|
|
316
|
+
if (rules.deleteRule !== void 0) {
|
|
317
|
+
parts.push(`deleteRule: ${formatValue(rules.deleteRule)}`);
|
|
318
|
+
}
|
|
319
|
+
if (rules.manageRule !== void 0) {
|
|
320
|
+
parts.push(`manageRule: ${formatValue(rules.manageRule)}`);
|
|
321
|
+
}
|
|
322
|
+
return parts.join(",\n ");
|
|
323
|
+
}
|
|
324
|
+
function generateCollectionPermissions(permissions) {
|
|
325
|
+
if (!permissions) {
|
|
326
|
+
return "";
|
|
327
|
+
}
|
|
328
|
+
const parts = [];
|
|
329
|
+
if (permissions.listRule !== void 0) {
|
|
330
|
+
parts.push(`listRule: ${formatValue(permissions.listRule)}`);
|
|
331
|
+
}
|
|
332
|
+
if (permissions.viewRule !== void 0) {
|
|
333
|
+
parts.push(`viewRule: ${formatValue(permissions.viewRule)}`);
|
|
334
|
+
}
|
|
335
|
+
if (permissions.createRule !== void 0) {
|
|
336
|
+
parts.push(`createRule: ${formatValue(permissions.createRule)}`);
|
|
337
|
+
}
|
|
338
|
+
if (permissions.updateRule !== void 0) {
|
|
339
|
+
parts.push(`updateRule: ${formatValue(permissions.updateRule)}`);
|
|
340
|
+
}
|
|
341
|
+
if (permissions.deleteRule !== void 0) {
|
|
342
|
+
parts.push(`deleteRule: ${formatValue(permissions.deleteRule)}`);
|
|
343
|
+
}
|
|
344
|
+
if (permissions.manageRule !== void 0) {
|
|
345
|
+
parts.push(`manageRule: ${formatValue(permissions.manageRule)}`);
|
|
346
|
+
}
|
|
347
|
+
return parts.join(",\n ");
|
|
348
|
+
}
|
|
349
|
+
function generateIndexesArray(indexes) {
|
|
350
|
+
if (!indexes || indexes.length === 0) {
|
|
351
|
+
return "[]";
|
|
352
|
+
}
|
|
353
|
+
const indexStrings = indexes.map((idx) => `"${idx}"`);
|
|
354
|
+
return `[
|
|
355
|
+
${indexStrings.join(",\n ")},
|
|
356
|
+
]`;
|
|
357
|
+
}
|
|
358
|
+
function generateCollectionCreation(collection, varName = "collection") {
|
|
359
|
+
const lines = [];
|
|
360
|
+
lines.push(` const ${varName} = new Collection({`);
|
|
361
|
+
lines.push(` name: "${collection.name}",`);
|
|
362
|
+
lines.push(` type: "${collection.type}",`);
|
|
363
|
+
const permissionsCode = generateCollectionPermissions(collection.permissions);
|
|
364
|
+
const rulesCode = generateCollectionRules(collection.rules);
|
|
365
|
+
if (permissionsCode) {
|
|
366
|
+
lines.push(` ${permissionsCode},`);
|
|
367
|
+
} else if (rulesCode) {
|
|
368
|
+
lines.push(` ${rulesCode},`);
|
|
369
|
+
}
|
|
370
|
+
lines.push(` fields: ${generateFieldsArray(collection.fields)},`);
|
|
371
|
+
lines.push(` indexes: ${generateIndexesArray(collection.indexes)},`);
|
|
372
|
+
lines.push(` });`);
|
|
373
|
+
lines.push(``);
|
|
374
|
+
lines.push(` app.save(${varName});`);
|
|
375
|
+
return lines.join("\n");
|
|
376
|
+
}
|
|
377
|
+
function getFieldConstructorName(fieldType) {
|
|
378
|
+
const constructorMap = {
|
|
379
|
+
text: "TextField",
|
|
380
|
+
email: "EmailField",
|
|
381
|
+
url: "URLField",
|
|
382
|
+
number: "NumberField",
|
|
383
|
+
bool: "BoolField",
|
|
384
|
+
date: "DateField",
|
|
385
|
+
select: "SelectField",
|
|
386
|
+
relation: "RelationField",
|
|
387
|
+
file: "FileField",
|
|
388
|
+
json: "JSONField"
|
|
389
|
+
};
|
|
390
|
+
return constructorMap[fieldType] || "TextField";
|
|
391
|
+
}
|
|
392
|
+
function generateFieldConstructorOptions(field) {
|
|
393
|
+
const parts = [];
|
|
394
|
+
parts.push(` name: "${field.name}"`);
|
|
395
|
+
parts.push(` required: ${field.required}`);
|
|
396
|
+
if (field.unique !== void 0) {
|
|
397
|
+
parts.push(` unique: ${field.unique}`);
|
|
398
|
+
}
|
|
399
|
+
if (field.options && Object.keys(field.options).length > 0) {
|
|
400
|
+
for (const [key, value] of Object.entries(field.options)) {
|
|
401
|
+
parts.push(` ${key}: ${formatValue(value)}`);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (field.relation && field.type === "relation") {
|
|
405
|
+
const collectionIdPlaceholder = field.relation.collection === "Users" ? '"_pb_users_auth_"' : `app.findCollectionByNameOrId("${field.relation.collection}").id`;
|
|
406
|
+
parts.push(` collectionId: ${collectionIdPlaceholder}`);
|
|
407
|
+
if (field.relation.maxSelect !== void 0) {
|
|
408
|
+
parts.push(` maxSelect: ${field.relation.maxSelect}`);
|
|
409
|
+
}
|
|
410
|
+
if (field.relation.minSelect !== void 0) {
|
|
411
|
+
parts.push(` minSelect: ${field.relation.minSelect}`);
|
|
412
|
+
}
|
|
413
|
+
if (field.relation.cascadeDelete !== void 0) {
|
|
414
|
+
parts.push(` cascadeDelete: ${field.relation.cascadeDelete}`);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return parts.join(",\n");
|
|
418
|
+
}
|
|
419
|
+
function generateFieldAddition(collectionName, field, varName) {
|
|
420
|
+
const lines = [];
|
|
421
|
+
const constructorName = getFieldConstructorName(field.type);
|
|
422
|
+
const collectionVar = varName || `collection_${collectionName}_${field.name}`;
|
|
423
|
+
lines.push(` const ${collectionVar} = app.findCollectionByNameOrId("${collectionName}");`);
|
|
424
|
+
lines.push(``);
|
|
425
|
+
lines.push(` ${collectionVar}.fields.add(new ${constructorName}({`);
|
|
426
|
+
lines.push(generateFieldConstructorOptions(field));
|
|
427
|
+
lines.push(` }));`);
|
|
428
|
+
lines.push(``);
|
|
429
|
+
lines.push(` app.save(${collectionVar});`);
|
|
430
|
+
return lines.join("\n");
|
|
431
|
+
}
|
|
432
|
+
function generateFieldModification(collectionName, modification, varName) {
|
|
433
|
+
const lines = [];
|
|
434
|
+
const collectionVar = varName || `collection_${collectionName}_${modification.fieldName}`;
|
|
435
|
+
const fieldVar = `${collectionVar}_field`;
|
|
436
|
+
lines.push(` const ${collectionVar} = app.findCollectionByNameOrId("${collectionName}");`);
|
|
437
|
+
lines.push(` const ${fieldVar} = ${collectionVar}.fields.getByName("${modification.fieldName}");`);
|
|
438
|
+
lines.push(``);
|
|
439
|
+
for (const change of modification.changes) {
|
|
440
|
+
if (change.property.startsWith("options.")) {
|
|
441
|
+
const optionKey = change.property.replace("options.", "");
|
|
442
|
+
lines.push(` ${fieldVar}.${optionKey} = ${formatValue(change.newValue)};`);
|
|
443
|
+
} else if (change.property.startsWith("relation.")) {
|
|
444
|
+
const relationKey = change.property.replace("relation.", "");
|
|
445
|
+
if (relationKey === "collection") {
|
|
446
|
+
const collectionIdValue = change.newValue === "Users" ? '"_pb_users_auth_"' : `app.findCollectionByNameOrId("${change.newValue}").id`;
|
|
447
|
+
lines.push(` ${fieldVar}.collectionId = ${collectionIdValue};`);
|
|
448
|
+
} else {
|
|
449
|
+
lines.push(` ${fieldVar}.${relationKey} = ${formatValue(change.newValue)};`);
|
|
450
|
+
}
|
|
451
|
+
} else {
|
|
452
|
+
lines.push(` ${fieldVar}.${change.property} = ${formatValue(change.newValue)};`);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
lines.push(``);
|
|
456
|
+
lines.push(` app.save(${collectionVar});`);
|
|
457
|
+
return lines.join("\n");
|
|
458
|
+
}
|
|
459
|
+
function generateFieldDeletion(collectionName, fieldName, varName) {
|
|
460
|
+
const lines = [];
|
|
461
|
+
const collectionVar = varName || `collection_${collectionName}_${fieldName}`;
|
|
462
|
+
const fieldVar = `${collectionVar}_field`;
|
|
463
|
+
lines.push(` const ${collectionVar} = app.findCollectionByNameOrId("${collectionName}");`);
|
|
464
|
+
lines.push(` const ${fieldVar} = ${collectionVar}.fields.getByName("${fieldName}");`);
|
|
465
|
+
lines.push(``);
|
|
466
|
+
lines.push(` ${collectionVar}.fields.remove(${fieldVar}.id);`);
|
|
467
|
+
lines.push(``);
|
|
468
|
+
lines.push(` app.save(${collectionVar});`);
|
|
469
|
+
return lines.join("\n");
|
|
470
|
+
}
|
|
471
|
+
function generateIndexAddition(collectionName, index, varName) {
|
|
472
|
+
const lines = [];
|
|
473
|
+
const collectionVar = varName || `collection_${collectionName}_idx`;
|
|
474
|
+
lines.push(` const ${collectionVar} = app.findCollectionByNameOrId("${collectionName}");`);
|
|
475
|
+
lines.push(` ${collectionVar}.indexes.push("${index}");`);
|
|
476
|
+
lines.push(` app.save(${collectionVar});`);
|
|
477
|
+
return lines.join("\n");
|
|
478
|
+
}
|
|
479
|
+
function generateIndexRemoval(collectionName, index, varName) {
|
|
480
|
+
const lines = [];
|
|
481
|
+
const collectionVar = varName || `collection_${collectionName}_idx`;
|
|
482
|
+
const indexVar = `${collectionVar}_indexToRemove`;
|
|
483
|
+
lines.push(` const ${collectionVar} = app.findCollectionByNameOrId("${collectionName}");`);
|
|
484
|
+
lines.push(` const ${indexVar} = ${collectionVar}.indexes.findIndex(idx => idx === "${index}");`);
|
|
485
|
+
lines.push(` if (${indexVar} !== -1) {`);
|
|
486
|
+
lines.push(` ${collectionVar}.indexes.splice(${indexVar}, 1);`);
|
|
487
|
+
lines.push(` }`);
|
|
488
|
+
lines.push(` app.save(${collectionVar});`);
|
|
489
|
+
return lines.join("\n");
|
|
490
|
+
}
|
|
491
|
+
function generateRuleUpdate(collectionName, ruleType, newValue, varName) {
|
|
492
|
+
const lines = [];
|
|
493
|
+
const collectionVar = varName || `collection_${collectionName}_${ruleType}`;
|
|
494
|
+
lines.push(` const ${collectionVar} = app.findCollectionByNameOrId("${collectionName}");`);
|
|
495
|
+
lines.push(` ${collectionVar}.${ruleType} = ${formatValue(newValue)};`);
|
|
496
|
+
lines.push(` app.save(${collectionVar});`);
|
|
497
|
+
return lines.join("\n");
|
|
498
|
+
}
|
|
499
|
+
function generatePermissionUpdate(collectionName, ruleType, newValue, varName) {
|
|
500
|
+
const lines = [];
|
|
501
|
+
const collectionVar = varName || `collection_${collectionName}_${ruleType}`;
|
|
502
|
+
lines.push(` const ${collectionVar} = app.findCollectionByNameOrId("${collectionName}");`);
|
|
503
|
+
lines.push(` ${collectionVar}.${ruleType} = ${formatValue(newValue)};`);
|
|
504
|
+
lines.push(` app.save(${collectionVar});`);
|
|
505
|
+
return lines.join("\n");
|
|
506
|
+
}
|
|
507
|
+
function generateCollectionDeletion(collectionName, varName = "collection") {
|
|
508
|
+
const lines = [];
|
|
509
|
+
lines.push(` const ${varName} = app.findCollectionByNameOrId("${collectionName}");`);
|
|
510
|
+
lines.push(` app.delete(${varName});`);
|
|
511
|
+
return lines.join("\n");
|
|
512
|
+
}
|
|
513
|
+
function generateUpMigration(diff) {
|
|
514
|
+
const lines = [];
|
|
515
|
+
lines.push(` // UP MIGRATION`);
|
|
516
|
+
lines.push(``);
|
|
517
|
+
if (diff.collectionsToCreate.length > 0) {
|
|
518
|
+
lines.push(` // Create new collections`);
|
|
519
|
+
for (let i = 0; i < diff.collectionsToCreate.length; i++) {
|
|
520
|
+
const collection = diff.collectionsToCreate[i];
|
|
521
|
+
const varName = `collection_${collection.name}_create`;
|
|
522
|
+
lines.push(generateCollectionCreation(collection, varName));
|
|
523
|
+
lines.push(``);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
if (diff.collectionsToModify.length > 0) {
|
|
527
|
+
lines.push(` // Modify existing collections`);
|
|
528
|
+
for (const modification of diff.collectionsToModify) {
|
|
529
|
+
const collectionName = modification.collection;
|
|
530
|
+
if (modification.fieldsToAdd.length > 0) {
|
|
531
|
+
lines.push(` // Add fields to ${collectionName}`);
|
|
532
|
+
for (const field of modification.fieldsToAdd) {
|
|
533
|
+
const varName = `collection_${collectionName}_add_${field.name}`;
|
|
534
|
+
lines.push(generateFieldAddition(collectionName, field, varName));
|
|
535
|
+
lines.push(``);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
if (modification.fieldsToModify.length > 0) {
|
|
539
|
+
lines.push(` // Modify fields in ${collectionName}`);
|
|
540
|
+
for (const fieldMod of modification.fieldsToModify) {
|
|
541
|
+
const varName = `collection_${collectionName}_modify_${fieldMod.fieldName}`;
|
|
542
|
+
lines.push(generateFieldModification(collectionName, fieldMod, varName));
|
|
543
|
+
lines.push(``);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
if (modification.fieldsToRemove.length > 0) {
|
|
547
|
+
lines.push(` // Remove fields from ${collectionName}`);
|
|
548
|
+
for (const field of modification.fieldsToRemove) {
|
|
549
|
+
const varName = `collection_${collectionName}_remove_${field.name}`;
|
|
550
|
+
lines.push(generateFieldDeletion(collectionName, field.name, varName));
|
|
551
|
+
lines.push(``);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
if (modification.indexesToAdd.length > 0) {
|
|
555
|
+
lines.push(` // Add indexes to ${collectionName}`);
|
|
556
|
+
for (let i = 0; i < modification.indexesToAdd.length; i++) {
|
|
557
|
+
const index = modification.indexesToAdd[i];
|
|
558
|
+
const varName = `collection_${collectionName}_addidx_${i}`;
|
|
559
|
+
lines.push(generateIndexAddition(collectionName, index, varName));
|
|
560
|
+
lines.push(``);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
if (modification.indexesToRemove.length > 0) {
|
|
564
|
+
lines.push(` // Remove indexes from ${collectionName}`);
|
|
565
|
+
for (let i = 0; i < modification.indexesToRemove.length; i++) {
|
|
566
|
+
const index = modification.indexesToRemove[i];
|
|
567
|
+
const varName = `collection_${collectionName}_rmidx_${i}`;
|
|
568
|
+
lines.push(generateIndexRemoval(collectionName, index, varName));
|
|
569
|
+
lines.push(``);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
if (modification.permissionsToUpdate && modification.permissionsToUpdate.length > 0) {
|
|
573
|
+
lines.push(` // Update permissions for ${collectionName}`);
|
|
574
|
+
for (const permission of modification.permissionsToUpdate) {
|
|
575
|
+
const varName = `collection_${collectionName}_perm_${permission.ruleType}`;
|
|
576
|
+
lines.push(generatePermissionUpdate(collectionName, permission.ruleType, permission.newValue, varName));
|
|
577
|
+
lines.push(``);
|
|
578
|
+
}
|
|
579
|
+
} else if (modification.rulesToUpdate.length > 0) {
|
|
580
|
+
lines.push(` // Update rules for ${collectionName}`);
|
|
581
|
+
for (const rule of modification.rulesToUpdate) {
|
|
582
|
+
const varName = `collection_${collectionName}_rule_${rule.ruleType}`;
|
|
583
|
+
lines.push(generateRuleUpdate(collectionName, rule.ruleType, rule.newValue, varName));
|
|
584
|
+
lines.push(``);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
if (diff.collectionsToDelete.length > 0) {
|
|
590
|
+
lines.push(` // Delete collections`);
|
|
591
|
+
for (let i = 0; i < diff.collectionsToDelete.length; i++) {
|
|
592
|
+
const collection = diff.collectionsToDelete[i];
|
|
593
|
+
const varName = `collection_${collection.name}_delete`;
|
|
594
|
+
lines.push(generateCollectionDeletion(collection.name, varName));
|
|
595
|
+
lines.push(``);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
if (lines.length === 2) {
|
|
599
|
+
lines.push(` // No changes detected`);
|
|
600
|
+
lines.push(``);
|
|
601
|
+
}
|
|
602
|
+
return lines.join("\n");
|
|
603
|
+
}
|
|
604
|
+
function generateDownMigration(diff) {
|
|
605
|
+
const lines = [];
|
|
606
|
+
lines.push(` // DOWN MIGRATION (ROLLBACK)`);
|
|
607
|
+
lines.push(``);
|
|
608
|
+
if (diff.collectionsToDelete.length > 0) {
|
|
609
|
+
lines.push(` // Recreate deleted collections`);
|
|
610
|
+
for (let i = 0; i < diff.collectionsToDelete.length; i++) {
|
|
611
|
+
const collection = diff.collectionsToDelete[i];
|
|
612
|
+
const varName = `collection_${collection.name}_recreate`;
|
|
613
|
+
lines.push(generateCollectionCreation(collection, varName));
|
|
614
|
+
lines.push(``);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
if (diff.collectionsToModify.length > 0) {
|
|
618
|
+
lines.push(` // Revert modifications`);
|
|
619
|
+
for (const modification of diff.collectionsToModify) {
|
|
620
|
+
const collectionName = modification.collection;
|
|
621
|
+
if (modification.permissionsToUpdate && modification.permissionsToUpdate.length > 0) {
|
|
622
|
+
lines.push(` // Revert permissions for ${collectionName}`);
|
|
623
|
+
for (const permission of modification.permissionsToUpdate) {
|
|
624
|
+
const varName = `collection_${collectionName}_revert_perm_${permission.ruleType}`;
|
|
625
|
+
lines.push(generatePermissionUpdate(collectionName, permission.ruleType, permission.oldValue, varName));
|
|
626
|
+
lines.push(``);
|
|
627
|
+
}
|
|
628
|
+
} else if (modification.rulesToUpdate.length > 0) {
|
|
629
|
+
lines.push(` // Revert rules for ${collectionName}`);
|
|
630
|
+
for (const rule of modification.rulesToUpdate) {
|
|
631
|
+
const varName = `collection_${collectionName}_revert_rule_${rule.ruleType}`;
|
|
632
|
+
lines.push(generateRuleUpdate(collectionName, rule.ruleType, rule.oldValue, varName));
|
|
633
|
+
lines.push(``);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
if (modification.indexesToRemove.length > 0) {
|
|
637
|
+
lines.push(` // Restore indexes to ${collectionName}`);
|
|
638
|
+
for (let i = 0; i < modification.indexesToRemove.length; i++) {
|
|
639
|
+
const index = modification.indexesToRemove[i];
|
|
640
|
+
const varName = `collection_${collectionName}_restore_idx_${i}`;
|
|
641
|
+
lines.push(generateIndexAddition(collectionName, index, varName));
|
|
642
|
+
lines.push(``);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
if (modification.indexesToAdd.length > 0) {
|
|
646
|
+
lines.push(` // Remove indexes from ${collectionName}`);
|
|
647
|
+
for (let i = 0; i < modification.indexesToAdd.length; i++) {
|
|
648
|
+
const index = modification.indexesToAdd[i];
|
|
649
|
+
const varName = `collection_${collectionName}_revert_idx_${i}`;
|
|
650
|
+
lines.push(generateIndexRemoval(collectionName, index, varName));
|
|
651
|
+
lines.push(``);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
if (modification.fieldsToRemove.length > 0) {
|
|
655
|
+
lines.push(` // Restore fields to ${collectionName}`);
|
|
656
|
+
for (const field of modification.fieldsToRemove) {
|
|
657
|
+
const varName = `collection_${collectionName}_restore_${field.name}`;
|
|
658
|
+
lines.push(generateFieldAddition(collectionName, field, varName));
|
|
659
|
+
lines.push(``);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
if (modification.fieldsToModify.length > 0) {
|
|
663
|
+
lines.push(` // Revert field modifications in ${collectionName}`);
|
|
664
|
+
for (const fieldMod of modification.fieldsToModify) {
|
|
665
|
+
const reverseChanges = fieldMod.changes.map((change) => ({
|
|
666
|
+
property: change.property,
|
|
667
|
+
oldValue: change.newValue,
|
|
668
|
+
newValue: change.oldValue
|
|
669
|
+
}));
|
|
670
|
+
const reverseMod = {
|
|
671
|
+
fieldName: fieldMod.fieldName,
|
|
672
|
+
currentDefinition: fieldMod.newDefinition,
|
|
673
|
+
newDefinition: fieldMod.currentDefinition,
|
|
674
|
+
changes: reverseChanges
|
|
675
|
+
};
|
|
676
|
+
const varName = `collection_${collectionName}_revert_${fieldMod.fieldName}`;
|
|
677
|
+
lines.push(generateFieldModification(collectionName, reverseMod, varName));
|
|
678
|
+
lines.push(``);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
if (modification.fieldsToAdd.length > 0) {
|
|
682
|
+
lines.push(` // Remove added fields from ${collectionName}`);
|
|
683
|
+
for (const field of modification.fieldsToAdd) {
|
|
684
|
+
const varName = `collection_${collectionName}_revert_add_${field.name}`;
|
|
685
|
+
lines.push(generateFieldDeletion(collectionName, field.name, varName));
|
|
686
|
+
lines.push(``);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
if (diff.collectionsToCreate.length > 0) {
|
|
692
|
+
lines.push(` // Delete created collections`);
|
|
693
|
+
for (let i = 0; i < diff.collectionsToCreate.length; i++) {
|
|
694
|
+
const collection = diff.collectionsToCreate[i];
|
|
695
|
+
const varName = `collection_${collection.name}_rollback`;
|
|
696
|
+
lines.push(generateCollectionDeletion(collection.name, varName));
|
|
697
|
+
lines.push(``);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
if (lines.length === 2) {
|
|
701
|
+
lines.push(` // No changes to revert`);
|
|
702
|
+
lines.push(``);
|
|
703
|
+
}
|
|
704
|
+
return lines.join("\n");
|
|
705
|
+
}
|
|
706
|
+
function generate(diff, config) {
|
|
707
|
+
const normalizedConfig = typeof config === "string" ? { migrationDir: config } : config;
|
|
708
|
+
try {
|
|
709
|
+
const migrationDir = resolveMigrationDir(normalizedConfig);
|
|
710
|
+
const upCode = generateUpMigration(diff);
|
|
711
|
+
const downCode = generateDownMigration(diff);
|
|
712
|
+
const content = createMigrationFileStructure(upCode, downCode, normalizedConfig);
|
|
713
|
+
const filename = generateMigrationFilename(diff, normalizedConfig);
|
|
714
|
+
const filePath = writeMigrationFile(migrationDir, filename, content);
|
|
715
|
+
return filePath;
|
|
716
|
+
} catch (error) {
|
|
717
|
+
if (error instanceof MigrationGenerationError || error instanceof FileSystemError) {
|
|
718
|
+
throw error;
|
|
719
|
+
}
|
|
720
|
+
throw new MigrationGenerationError(
|
|
721
|
+
`Failed to generate migration: ${error instanceof Error ? error.message : String(error)}`,
|
|
722
|
+
normalizedConfig.migrationDir,
|
|
723
|
+
error
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
var MigrationGenerator = class {
|
|
728
|
+
config;
|
|
729
|
+
constructor(config) {
|
|
730
|
+
this.config = mergeConfig(config);
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Generates a migration file from a schema diff
|
|
734
|
+
*/
|
|
735
|
+
generate(diff) {
|
|
736
|
+
return generate(diff, this.config);
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Generates the up migration code without writing to file
|
|
740
|
+
*/
|
|
741
|
+
generateUpMigration(diff) {
|
|
742
|
+
return generateUpMigration(diff);
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Generates the down migration code without writing to file
|
|
746
|
+
*/
|
|
747
|
+
generateDownMigration(diff) {
|
|
748
|
+
return generateDownMigration(diff);
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Generates a migration filename
|
|
752
|
+
*/
|
|
753
|
+
generateMigrationFilename(diff) {
|
|
754
|
+
return generateMigrationFilename(diff, this.config);
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
exports.MigrationGenerator = MigrationGenerator;
|
|
759
|
+
exports.createMigrationFileStructure = createMigrationFileStructure;
|
|
760
|
+
exports.generate = generate;
|
|
761
|
+
exports.generateCollectionCreation = generateCollectionCreation;
|
|
762
|
+
exports.generateCollectionPermissions = generateCollectionPermissions;
|
|
763
|
+
exports.generateCollectionRules = generateCollectionRules;
|
|
764
|
+
exports.generateDownMigration = generateDownMigration;
|
|
765
|
+
exports.generateFieldAddition = generateFieldAddition;
|
|
766
|
+
exports.generateFieldDefinitionObject = generateFieldDefinitionObject;
|
|
767
|
+
exports.generateFieldDeletion = generateFieldDeletion;
|
|
768
|
+
exports.generateFieldModification = generateFieldModification;
|
|
769
|
+
exports.generateFieldsArray = generateFieldsArray;
|
|
770
|
+
exports.generateIndexesArray = generateIndexesArray;
|
|
771
|
+
exports.generateMigrationDescription = generateMigrationDescription;
|
|
772
|
+
exports.generateMigrationFilename = generateMigrationFilename;
|
|
773
|
+
exports.generatePermissionUpdate = generatePermissionUpdate;
|
|
774
|
+
exports.generateTimestamp = generateTimestamp;
|
|
775
|
+
exports.generateUpMigration = generateUpMigration;
|
|
776
|
+
exports.writeMigrationFile = writeMigrationFile;
|
|
777
|
+
//# sourceMappingURL=generator.cjs.map
|
|
778
|
+
//# sourceMappingURL=generator.cjs.map
|