pocketbase-zod-schema 0.2.5 → 0.3.0
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 +8 -0
- package/dist/cli/index.cjs +374 -296
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +374 -296
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/migrate.cjs +374 -296
- package/dist/cli/migrate.cjs.map +1 -1
- package/dist/cli/migrate.js +374 -296
- package/dist/cli/migrate.js.map +1 -1
- package/dist/cli/utils/index.d.cts +2 -2
- package/dist/cli/utils/index.d.ts +2 -2
- package/dist/{fields-YjcpBXVp.d.cts → fields-UcOPu1OQ.d.cts} +16 -0
- package/dist/{fields-YjcpBXVp.d.ts → fields-UcOPu1OQ.d.ts} +16 -0
- package/dist/index.cjs +413 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +414 -103
- package/dist/index.js.map +1 -1
- package/dist/migration/analyzer.cjs +12 -2
- package/dist/migration/analyzer.cjs.map +1 -1
- package/dist/migration/analyzer.d.cts +2 -2
- package/dist/migration/analyzer.d.ts +2 -2
- package/dist/migration/analyzer.js +12 -2
- package/dist/migration/analyzer.js.map +1 -1
- package/dist/migration/diff.cjs +76 -1
- package/dist/migration/diff.cjs.map +1 -1
- package/dist/migration/diff.d.cts +2 -2
- package/dist/migration/diff.d.ts +2 -2
- package/dist/migration/diff.js +76 -1
- package/dist/migration/diff.js.map +1 -1
- package/dist/migration/generator.cjs +323 -46
- package/dist/migration/generator.cjs.map +1 -1
- package/dist/migration/generator.d.cts +59 -12
- package/dist/migration/generator.d.ts +59 -12
- package/dist/migration/generator.js +319 -47
- package/dist/migration/generator.js.map +1 -1
- package/dist/migration/index.cjs +399 -49
- package/dist/migration/index.cjs.map +1 -1
- package/dist/migration/index.d.cts +3 -3
- package/dist/migration/index.d.ts +3 -3
- package/dist/migration/index.js +399 -49
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/snapshot.cjs.map +1 -1
- package/dist/migration/snapshot.d.cts +2 -2
- package/dist/migration/snapshot.d.ts +2 -2
- package/dist/migration/snapshot.js.map +1 -1
- package/dist/migration/utils/index.cjs +64 -0
- package/dist/migration/utils/index.cjs.map +1 -1
- package/dist/migration/utils/index.d.cts +39 -202
- package/dist/migration/utils/index.d.ts +39 -202
- package/dist/migration/utils/index.js +63 -1
- package/dist/migration/utils/index.js.map +1 -1
- package/dist/schema.cjs +0 -61
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.d.cts +2 -86
- package/dist/schema.d.ts +2 -86
- package/dist/schema.js +1 -50
- package/dist/schema.js.map +1 -1
- package/dist/type-mapper-DrQmtznD.d.cts +208 -0
- package/dist/type-mapper-n231Fspm.d.ts +208 -0
- package/dist/{types-LFBGHl9Y.d.ts → types-Ds3NQvny.d.ts} +33 -2
- package/dist/{types-mhQXWNi3.d.cts → types-YoBjsa-A.d.cts} +33 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { S as SchemaDefinition, C as CollectionSchema, F as FieldDefinition } from '../types-
|
|
3
|
-
import '../fields-
|
|
2
|
+
import { S as SchemaDefinition, C as CollectionSchema, F as FieldDefinition } from '../types-YoBjsa-A.cjs';
|
|
3
|
+
import '../fields-UcOPu1OQ.cjs';
|
|
4
4
|
import '../permissions-ZHafVSIx.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { S as SchemaDefinition, C as CollectionSchema, F as FieldDefinition } from '../types-
|
|
3
|
-
import '../fields-
|
|
2
|
+
import { S as SchemaDefinition, C as CollectionSchema, F as FieldDefinition } from '../types-Ds3NQvny.js';
|
|
3
|
+
import '../fields-UcOPu1OQ.js';
|
|
4
4
|
import '../permissions-ZHafVSIx.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1196,12 +1196,22 @@ function isAuthCollection(fields) {
|
|
|
1196
1196
|
function buildFieldDefinition(fieldName, zodType) {
|
|
1197
1197
|
const fieldMetadata = extractFieldMetadata(zodType.description);
|
|
1198
1198
|
if (fieldMetadata) {
|
|
1199
|
-
|
|
1199
|
+
let required2;
|
|
1200
|
+
if (fieldMetadata.type === "number") {
|
|
1201
|
+
if (fieldMetadata.options?.required !== void 0) {
|
|
1202
|
+
required2 = fieldMetadata.options.required;
|
|
1203
|
+
} else {
|
|
1204
|
+
required2 = false;
|
|
1205
|
+
}
|
|
1206
|
+
} else {
|
|
1207
|
+
required2 = isFieldRequired(zodType);
|
|
1208
|
+
}
|
|
1209
|
+
const { required: _required, ...options2 } = fieldMetadata.options || {};
|
|
1200
1210
|
const fieldDef2 = {
|
|
1201
1211
|
name: fieldName,
|
|
1202
1212
|
type: fieldMetadata.type,
|
|
1203
1213
|
required: required2,
|
|
1204
|
-
options:
|
|
1214
|
+
options: Object.keys(options2).length > 0 ? options2 : void 0
|
|
1205
1215
|
};
|
|
1206
1216
|
if (fieldMetadata.type === "relation") {
|
|
1207
1217
|
const relationMetadata2 = extractRelationMetadata(zodType.description);
|