pocketbase-zod-schema 0.2.2 → 0.2.4
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/dist/cli/index.cjs +52 -1
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +52 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/migrate.cjs +52 -1
- package/dist/cli/migrate.cjs.map +1 -1
- package/dist/cli/migrate.js +52 -1
- package/dist/cli/migrate.js.map +1 -1
- package/dist/index.cjs +658 -690
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +658 -683
- package/dist/index.js.map +1 -1
- package/dist/migration/generator.cjs +52 -1
- package/dist/migration/generator.cjs.map +1 -1
- package/dist/migration/generator.d.cts +0 -7
- package/dist/migration/generator.d.ts +0 -7
- package/dist/migration/generator.js +52 -1
- package/dist/migration/generator.js.map +1 -1
- package/dist/migration/index.cjs +52 -1
- package/dist/migration/index.cjs.map +1 -1
- package/dist/migration/index.js +52 -1
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/snapshot.cjs.map +1 -1
- package/dist/migration/snapshot.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 +0 -78
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.d.cts +0 -1
- package/dist/schema.d.ts +0 -1
- package/dist/schema.js +1 -72
- package/dist/schema.js.map +1 -1
- 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/migrate.cjs
CHANGED
|
@@ -2105,6 +2105,55 @@ function generateIndexesArray(indexes) {
|
|
|
2105
2105
|
${indexStrings.join(",\n ")},
|
|
2106
2106
|
]`;
|
|
2107
2107
|
}
|
|
2108
|
+
function getSystemFields() {
|
|
2109
|
+
return [
|
|
2110
|
+
// id field - primary key, auto-generated
|
|
2111
|
+
{
|
|
2112
|
+
name: "id",
|
|
2113
|
+
type: "text",
|
|
2114
|
+
required: true,
|
|
2115
|
+
options: {
|
|
2116
|
+
autogeneratePattern: "[a-z0-9]{15}",
|
|
2117
|
+
hidden: false,
|
|
2118
|
+
id: "text3208210256",
|
|
2119
|
+
max: 15,
|
|
2120
|
+
min: 15,
|
|
2121
|
+
pattern: "^[a-z0-9]+$",
|
|
2122
|
+
presentable: false,
|
|
2123
|
+
primaryKey: true,
|
|
2124
|
+
system: true
|
|
2125
|
+
}
|
|
2126
|
+
},
|
|
2127
|
+
// created field - autodate, set on creation
|
|
2128
|
+
{
|
|
2129
|
+
name: "created",
|
|
2130
|
+
type: "autodate",
|
|
2131
|
+
required: true,
|
|
2132
|
+
options: {
|
|
2133
|
+
hidden: false,
|
|
2134
|
+
id: "autodate2990389176",
|
|
2135
|
+
onCreate: true,
|
|
2136
|
+
onUpdate: false,
|
|
2137
|
+
presentable: false,
|
|
2138
|
+
system: false
|
|
2139
|
+
}
|
|
2140
|
+
},
|
|
2141
|
+
// updated field - autodate, set on creation and update
|
|
2142
|
+
{
|
|
2143
|
+
name: "updated",
|
|
2144
|
+
type: "autodate",
|
|
2145
|
+
required: true,
|
|
2146
|
+
options: {
|
|
2147
|
+
hidden: false,
|
|
2148
|
+
id: "autodate3332085495",
|
|
2149
|
+
onCreate: true,
|
|
2150
|
+
onUpdate: true,
|
|
2151
|
+
presentable: false,
|
|
2152
|
+
system: false
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
];
|
|
2156
|
+
}
|
|
2108
2157
|
function generateCollectionCreation(collection, varName = "collection", isLast = false) {
|
|
2109
2158
|
const lines = [];
|
|
2110
2159
|
lines.push(` const ${varName} = new Collection({`);
|
|
@@ -2117,7 +2166,9 @@ function generateCollectionCreation(collection, varName = "collection", isLast =
|
|
|
2117
2166
|
} else if (rulesCode) {
|
|
2118
2167
|
lines.push(` ${rulesCode},`);
|
|
2119
2168
|
}
|
|
2120
|
-
|
|
2169
|
+
const systemFields = getSystemFields();
|
|
2170
|
+
const allFields = [...systemFields, ...collection.fields];
|
|
2171
|
+
lines.push(` fields: ${generateFieldsArray(allFields)},`);
|
|
2121
2172
|
lines.push(` indexes: ${generateIndexesArray(collection.indexes)},`);
|
|
2122
2173
|
lines.push(` });`);
|
|
2123
2174
|
lines.push(``);
|