pocketbase-zod-schema 0.3.5 → 0.3.6

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.6](https://github.com/dastron/pocketbase-zod-schema/compare/pocketbase-zod-schema-v0.3.5...pocketbase-zod-schema-v0.3.6) (2026-01-14)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * trigger release ([f69272a](https://github.com/dastron/pocketbase-zod-schema/commit/f69272a56596583217de5c2e2626399fcd2f8143))
9
+
3
10
  ## [0.3.5](https://github.com/dastron/pocketbase-zod-schema/compare/pocketbase-zod-schema-v0.3.4...pocketbase-zod-schema-v0.3.5) (2026-01-12)
4
11
 
5
12
 
@@ -2985,6 +2985,9 @@ function parseMigrationOperationsFromContent(content) {
2985
2985
  const collectionsToCreate = [];
2986
2986
  const collectionsToDelete = [];
2987
2987
  const collectionsToUpdate = [];
2988
+ const mockApp = {
2989
+ findCollectionByNameOrId: (name) => ({ id: name, name })
2990
+ };
2988
2991
  const getUpdate = (name) => {
2989
2992
  let update = collectionsToUpdate.find((u) => u.collectionName === name);
2990
2993
  if (!update) {
@@ -3082,7 +3085,7 @@ function parseMigrationOperationsFromContent(content) {
3082
3085
  if (bCount === 0) {
3083
3086
  const objStr = content.substring(startObj, i);
3084
3087
  try {
3085
- const collectionObj = new Function(`return ${objStr}`)();
3088
+ const collectionObj = new Function("app", `return ${objStr}`)(mockApp);
3086
3089
  if (collectionObj && collectionObj.name) {
3087
3090
  const schema = convertPocketBaseCollection(collectionObj);
3088
3091
  collectionsToCreate.push(schema);
@@ -3182,7 +3185,7 @@ function parseMigrationOperationsFromContent(content) {
3182
3185
  const objStr = content.substring(objStart, j);
3183
3186
  const typeMatch = fullMatch.match(/new\s+(\w+)Field/);
3184
3187
  try {
3185
- const rawObj = new Function(`return ${objStr}`)();
3188
+ const rawObj = new Function("app", `return ${objStr}`)(mockApp);
3186
3189
  const typeMap = {
3187
3190
  Text: "text",
3188
3191
  Number: "number",
@@ -3231,7 +3234,7 @@ function parseMigrationOperationsFromContent(content) {
3231
3234
  update.fieldsToUpdate.push(fieldUpdate);
3232
3235
  }
3233
3236
  try {
3234
- const value = new Function(`return ${valueStr}`)();
3237
+ const value = new Function("app", `return ${valueStr}`)(mockApp);
3235
3238
  fieldUpdate.changes[propPath] = value;
3236
3239
  } catch {
3237
3240
  fieldUpdate.changes[propPath] = valueStr.trim();
@@ -3242,7 +3245,7 @@ function parseMigrationOperationsFromContent(content) {
3242
3245
  if (propPath === "indexes") {
3243
3246
  } else if (propPath.endsWith("Rule")) {
3244
3247
  try {
3245
- const value = new Function(`return ${valueStr}`)();
3248
+ const value = new Function("app", `return ${valueStr}`)(mockApp);
3246
3249
  update.rulesToUpdate[propPath] = value;
3247
3250
  } catch {
3248
3251
  update.rulesToUpdate[propPath] = valueStr.trim();