pocketbase-zod-schema 0.2.3 → 0.2.5
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 +14 -0
- package/README.md +209 -24
- package/dist/cli/index.cjs +34 -0
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +3 -1
- package/dist/cli/index.d.ts +3 -1
- package/dist/cli/index.js +34 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/migrate.cjs +34 -0
- package/dist/cli/migrate.cjs.map +1 -1
- package/dist/cli/migrate.js +34 -0
- package/dist/cli/migrate.js.map +1 -1
- package/dist/cli/utils/index.d.cts +3 -1
- package/dist/cli/utils/index.d.ts +3 -1
- package/dist/fields-YjcpBXVp.d.cts +348 -0
- package/dist/fields-YjcpBXVp.d.ts +348 -0
- package/dist/index.cjs +833 -694
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +818 -687
- package/dist/index.js.map +1 -1
- package/dist/migration/analyzer.cjs +34 -0
- package/dist/migration/analyzer.cjs.map +1 -1
- package/dist/migration/analyzer.d.cts +2 -1
- package/dist/migration/analyzer.d.ts +2 -1
- package/dist/migration/analyzer.js +34 -0
- package/dist/migration/analyzer.js.map +1 -1
- package/dist/migration/diff.d.cts +3 -1
- package/dist/migration/diff.d.ts +3 -1
- package/dist/migration/generator.d.cts +3 -1
- package/dist/migration/generator.d.ts +3 -1
- package/dist/migration/index.cjs +36 -0
- package/dist/migration/index.cjs.map +1 -1
- package/dist/migration/index.d.cts +2 -1
- package/dist/migration/index.d.ts +2 -1
- package/dist/migration/index.js +35 -1
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/snapshot.cjs.map +1 -1
- package/dist/migration/snapshot.d.cts +3 -1
- package/dist/migration/snapshot.d.ts +3 -1
- package/dist/migration/snapshot.js.map +1 -1
- package/dist/migration/utils/index.cjs +16 -0
- package/dist/migration/utils/index.cjs.map +1 -1
- package/dist/migration/utils/index.d.cts +2 -2
- package/dist/migration/utils/index.d.ts +2 -2
- package/dist/migration/utils/index.js +15 -1
- package/dist/migration/utils/index.js.map +1 -1
- package/dist/mutator.cjs +2 -98
- package/dist/mutator.cjs.map +1 -1
- package/dist/mutator.d.cts +4 -31
- package/dist/mutator.d.ts +4 -31
- package/dist/mutator.js +2 -98
- package/dist/mutator.js.map +1 -1
- package/dist/schema.cjs +200 -78
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.d.cts +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +186 -72
- package/dist/schema.js.map +1 -1
- package/dist/{types-z1Dkjg8m.d.ts → types-LFBGHl9Y.d.ts} +2 -2
- package/dist/{types-BbTgmg6H.d.cts → types-mhQXWNi3.d.cts} +2 -2
- package/package.json +1 -6
- package/dist/types.cjs +0 -4
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.cts +0 -14
- package/dist/types.d.ts +0 -14
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/user-BnFWg5tw.d.cts +0 -161
- package/dist/user-BnFWg5tw.d.ts +0 -161
package/dist/cli/index.d.cts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { MigrationConfig, StatusOutput, VerbosityLevel, createProgressBar, createSpinner, formatChangeSummary, formatDuration, formatStatusJson, getMigrationsDirectory, getSchemaDirectory, getVerbosity, loadConfig, logBox, logDebug, logError, logInfo, logKeyValue, logList, logSection, logStep, logSuccess, logTable, logTimed, logTimestamp, logWarning, setVerbosity, withProgress } from './utils/index.cjs';
|
|
2
2
|
import 'ora';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-mhQXWNi3.cjs';
|
|
4
|
+
import '../fields-YjcpBXVp.cjs';
|
|
5
|
+
import 'zod';
|
|
4
6
|
import '../permissions-ZHafVSIx.cjs';
|
|
5
7
|
|
|
6
8
|
/**
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { MigrationConfig, StatusOutput, VerbosityLevel, createProgressBar, createSpinner, formatChangeSummary, formatDuration, formatStatusJson, getMigrationsDirectory, getSchemaDirectory, getVerbosity, loadConfig, logBox, logDebug, logError, logInfo, logKeyValue, logList, logSection, logStep, logSuccess, logTable, logTimed, logTimestamp, logWarning, setVerbosity, withProgress } from './utils/index.js';
|
|
2
2
|
import 'ora';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-LFBGHl9Y.js';
|
|
4
|
+
import '../fields-YjcpBXVp.js';
|
|
5
|
+
import 'zod';
|
|
4
6
|
import '../permissions-ZHafVSIx.js';
|
|
5
7
|
|
|
6
8
|
/**
|
package/dist/cli/index.js
CHANGED
|
@@ -36,6 +36,18 @@ function extractRelationMetadata(description) {
|
|
|
36
36
|
}
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
|
+
var FIELD_METADATA_KEY = "__pocketbase_field__";
|
|
40
|
+
function extractFieldMetadata(description) {
|
|
41
|
+
if (!description) return null;
|
|
42
|
+
try {
|
|
43
|
+
const parsed = JSON.parse(description);
|
|
44
|
+
if (parsed[FIELD_METADATA_KEY]) {
|
|
45
|
+
return parsed[FIELD_METADATA_KEY];
|
|
46
|
+
}
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
39
51
|
|
|
40
52
|
// src/migration/errors.ts
|
|
41
53
|
var MigrationError = class _MigrationError extends Error {
|
|
@@ -1274,6 +1286,28 @@ function isAuthCollection(fields) {
|
|
|
1274
1286
|
return hasEmail && hasPassword;
|
|
1275
1287
|
}
|
|
1276
1288
|
function buildFieldDefinition(fieldName, zodType) {
|
|
1289
|
+
const fieldMetadata = extractFieldMetadata(zodType.description);
|
|
1290
|
+
if (fieldMetadata) {
|
|
1291
|
+
const required2 = isFieldRequired(zodType);
|
|
1292
|
+
const fieldDef2 = {
|
|
1293
|
+
name: fieldName,
|
|
1294
|
+
type: fieldMetadata.type,
|
|
1295
|
+
required: required2,
|
|
1296
|
+
options: fieldMetadata.options
|
|
1297
|
+
};
|
|
1298
|
+
if (fieldMetadata.type === "relation") {
|
|
1299
|
+
const relationMetadata2 = extractRelationMetadata(zodType.description);
|
|
1300
|
+
if (relationMetadata2) {
|
|
1301
|
+
fieldDef2.relation = {
|
|
1302
|
+
collection: relationMetadata2.collection,
|
|
1303
|
+
maxSelect: relationMetadata2.maxSelect,
|
|
1304
|
+
minSelect: relationMetadata2.minSelect,
|
|
1305
|
+
cascadeDelete: relationMetadata2.cascadeDelete
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
return fieldDef2;
|
|
1310
|
+
}
|
|
1277
1311
|
const fieldType = mapZodTypeToPocketBase(zodType, fieldName);
|
|
1278
1312
|
const required = isFieldRequired(zodType);
|
|
1279
1313
|
const options = extractFieldOptions(zodType);
|