@terreno/api 56.0.0-beta.0 → 57.0.0-beta.1

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +2 -122
  2. package/LICENSE +21 -202
  3. package/dist/api.d.ts +3 -2
  4. package/dist/auth.js +21 -25
  5. package/dist/betterAuthSetup.d.ts +15 -1
  6. package/dist/betterAuthSetup.js +4 -6
  7. package/dist/configurationPlugin.js +2 -2
  8. package/dist/expressServer.js +11 -5
  9. package/dist/githubAuth.js +1 -4
  10. package/dist/plugins.d.ts +7 -6
  11. package/dist/plugins.js +24 -8
  12. package/dist/realtime/changeStreamWatcher.d.ts +1 -1
  13. package/dist/realtime/changeStreamWatcher.js +0 -2
  14. package/dist/realtime/realtimeApp.d.ts +1 -1
  15. package/dist/realtime/realtimeApp.js +16 -8
  16. package/dist/realtime/types.d.ts +14 -0
  17. package/dist/sync/executors.js +14 -14
  18. package/dist/sync/models.js +1 -1
  19. package/dist/sync/registry.d.ts +4 -4
  20. package/dist/sync/registry.js +1 -1
  21. package/dist/sync/socketHandlers.d.ts +1 -1
  22. package/dist/sync/syncSeqPlugin.js +25 -29
  23. package/dist/tests/models.d.ts +27 -11
  24. package/dist/tests/models.js +5 -3
  25. package/dist/tests/testHelper.d.ts +9 -3
  26. package/package.json +5 -6
  27. package/src/actions.test.ts +19 -12
  28. package/src/actions.ts +2 -2
  29. package/src/api.coverage.test.ts +7 -9
  30. package/src/api.errorPaths.test.ts +47 -1
  31. package/src/api.errors.test.ts +32 -23
  32. package/src/api.ts +22 -12
  33. package/src/auth.test.ts +251 -1
  34. package/src/auth.ts +25 -23
  35. package/src/betterAuthSetup.ts +7 -7
  36. package/src/configuration.test.ts +59 -38
  37. package/src/configurationPlugin.test.ts +72 -42
  38. package/src/configurationPlugin.ts +2 -2
  39. package/src/consentApp.test.ts +12 -12
  40. package/src/expressServer.ts +11 -5
  41. package/src/githubAuth.ts +1 -3
  42. package/src/middleware.test.ts +16 -0
  43. package/src/models/versionConfig.ts +1 -1
  44. package/src/openApiBuilder.test.ts +24 -9
  45. package/src/openApiValidator.test.ts +41 -0
  46. package/src/permissions.middleware.test.ts +73 -81
  47. package/src/permissions.test.ts +35 -25
  48. package/src/plugins.test.ts +74 -29
  49. package/src/plugins.ts +29 -11
  50. package/src/populate.test.ts +25 -16
  51. package/src/realtime/changeStreamWatcher.ts +1 -4
  52. package/src/realtime/realtime.test.ts +239 -0
  53. package/src/realtime/realtimeApp.ts +15 -8
  54. package/src/realtime/realtimeAppSetup.test.ts +159 -0
  55. package/src/realtime/types.ts +14 -0
  56. package/src/secretProvidersGcpClient.test.ts +66 -0
  57. package/src/sync/executors.ts +16 -14
  58. package/src/sync/models.ts +2 -1
  59. package/src/sync/registry.ts +6 -8
  60. package/src/sync/socketHandlers.ts +1 -3
  61. package/src/sync/syncFrontier.test.ts +2 -2
  62. package/src/sync/syncSeqPlugin.test.ts +446 -0
  63. package/src/sync/syncSeqPlugin.ts +43 -51
  64. package/src/tests/models.ts +8 -6
@@ -1,4 +1,4 @@
1
- import mongoose, {type Model, model, Schema} from "mongoose";
1
+ import mongoose, {type Model, model, Schema, type StringSchemaDefinition} from "mongoose";
2
2
  import passportLocalMongoose from "passport-local-mongoose";
3
3
 
4
4
  import {createdUpdatedPlugin, DateOnly, isDisabledPlugin} from "../plugins";
@@ -41,11 +41,11 @@ export interface Food {
41
41
  dateAdded?: string;
42
42
  };
43
43
  tags: string[];
44
- eatenBy: [Schema.Types.ObjectId | User];
44
+ eatenBy: Array<mongoose.Types.ObjectId | User>;
45
45
  lastEatenWith: {[name: string]: Date};
46
46
  categories: FoodCategory[];
47
47
  expiration: string;
48
- likesIds: {userId: string; likes: boolean}[];
48
+ likesIds: {userId: mongoose.Types.ObjectId | string; likes: boolean}[];
49
49
  }
50
50
 
51
51
  export interface RequiredField {
@@ -126,9 +126,11 @@ const foodSchema = new Schema<Food>(
126
126
  type: Schema.Types.ObjectId,
127
127
  },
128
128
  ],
129
- // noExplicitAny: DateOnly is a custom SchemaType not recognized by Mongoose's built-in type definitions
130
- // biome-ignore lint/suspicious/noExplicitAny: DateOnly is a custom SchemaType not recognized by Mongoose's built-in type definitions
131
- expiration: {description: "Expiration date of the food", type: DateOnly as any},
129
+ expiration: {
130
+ description: "Expiration date of the food",
131
+ // DateOnly is a custom SchemaType registered on Schema.Types; it stores an ISO date string.
132
+ type: DateOnly as unknown as StringSchemaDefinition,
133
+ },
132
134
  hidden: {
133
135
  default: false,
134
136
  description: "Whether this food is hidden from listings",