monorise 0.0.5 → 1.0.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.
Files changed (193) hide show
  1. package/dist/base/index.d.ts +52 -1
  2. package/dist/base/index.js.map +1 -1
  3. package/dist/core/index.d.ts +60 -5
  4. package/dist/core/index.js +303 -33
  5. package/dist/core/index.js.map +1 -1
  6. package/dist/react/actions/core.action.d.ts +9 -0
  7. package/dist/react/actions/core.action.d.ts.map +1 -1
  8. package/dist/react/index.d.ts +21 -2
  9. package/dist/react/index.d.ts.map +1 -1
  10. package/dist/react/index.js +75 -1
  11. package/dist/react/index.js.map +1 -1
  12. package/dist/react/lib/utils.d.ts +1 -1
  13. package/dist/react/lib/utils.d.ts.map +1 -1
  14. package/dist/react/services/core.service.d.ts +2 -1
  15. package/dist/react/services/core.service.d.ts.map +1 -1
  16. package/dist/sst/.sst/platform/src/components/aws/alb.d.ts +280 -0
  17. package/dist/sst/.sst/platform/src/components/aws/alb.d.ts.map +1 -0
  18. package/dist/sst/.sst/platform/src/components/aws/apigateway-websocket-route.d.ts +1 -1
  19. package/dist/sst/.sst/platform/src/components/aws/apigateway-websocket-route.d.ts.map +1 -1
  20. package/dist/sst/.sst/platform/src/components/aws/apigateway-websocket.d.ts +13 -2
  21. package/dist/sst/.sst/platform/src/components/aws/apigateway-websocket.d.ts.map +1 -1
  22. package/dist/sst/.sst/platform/src/components/aws/apigatewayv1-authorizer.d.ts.map +1 -1
  23. package/dist/sst/.sst/platform/src/components/aws/apigatewayv1-lambda-route.d.ts +1 -1
  24. package/dist/sst/.sst/platform/src/components/aws/apigatewayv1-lambda-route.d.ts.map +1 -1
  25. package/dist/sst/.sst/platform/src/components/aws/apigatewayv1.d.ts +93 -83
  26. package/dist/sst/.sst/platform/src/components/aws/apigatewayv1.d.ts.map +1 -1
  27. package/dist/sst/.sst/platform/src/components/aws/apigatewayv2-authorizer.d.ts.map +1 -1
  28. package/dist/sst/.sst/platform/src/components/aws/apigatewayv2-lambda-route.d.ts +1 -1
  29. package/dist/sst/.sst/platform/src/components/aws/apigatewayv2-lambda-route.d.ts.map +1 -1
  30. package/dist/sst/.sst/platform/src/components/aws/apigatewayv2.d.ts +8 -2
  31. package/dist/sst/.sst/platform/src/components/aws/apigatewayv2.d.ts.map +1 -1
  32. package/dist/sst/.sst/platform/src/components/aws/app-sync-data-source.d.ts +1 -1
  33. package/dist/sst/.sst/platform/src/components/aws/app-sync-data-source.d.ts.map +1 -1
  34. package/dist/sst/.sst/platform/src/components/aws/app-sync.d.ts +1 -1
  35. package/dist/sst/.sst/platform/src/components/aws/app-sync.d.ts.map +1 -1
  36. package/dist/sst/.sst/platform/src/components/aws/aurora.d.ts +18 -0
  37. package/dist/sst/.sst/platform/src/components/aws/aurora.d.ts.map +1 -1
  38. package/dist/sst/.sst/platform/src/components/aws/auth-v1.d.ts +1 -1
  39. package/dist/sst/.sst/platform/src/components/aws/auth-v1.d.ts.map +1 -1
  40. package/dist/sst/.sst/platform/src/components/aws/auth.d.ts.map +1 -1
  41. package/dist/sst/.sst/platform/src/components/aws/bucket-lambda-subscriber.d.ts +1 -1
  42. package/dist/sst/.sst/platform/src/components/aws/bucket-lambda-subscriber.d.ts.map +1 -1
  43. package/dist/sst/.sst/platform/src/components/aws/bucket-notification.d.ts.map +1 -1
  44. package/dist/sst/.sst/platform/src/components/aws/bucket.d.ts +13 -8
  45. package/dist/sst/.sst/platform/src/components/aws/bucket.d.ts.map +1 -1
  46. package/dist/sst/.sst/platform/src/components/aws/bus-lambda-subscriber.d.ts +3 -2
  47. package/dist/sst/.sst/platform/src/components/aws/bus-lambda-subscriber.d.ts.map +1 -1
  48. package/dist/sst/.sst/platform/src/components/aws/bus.d.ts +34 -3
  49. package/dist/sst/.sst/platform/src/components/aws/bus.d.ts.map +1 -1
  50. package/dist/sst/.sst/platform/src/components/aws/cdn.d.ts +11 -0
  51. package/dist/sst/.sst/platform/src/components/aws/cdn.d.ts.map +1 -1
  52. package/dist/sst/.sst/platform/src/components/aws/cluster.d.ts +59 -1
  53. package/dist/sst/.sst/platform/src/components/aws/cluster.d.ts.map +1 -1
  54. package/dist/sst/.sst/platform/src/components/aws/cognito-identity-pool.d.ts +5 -0
  55. package/dist/sst/.sst/platform/src/components/aws/cognito-identity-pool.d.ts.map +1 -1
  56. package/dist/sst/.sst/platform/src/components/aws/cognito-user-pool.d.ts +100 -0
  57. package/dist/sst/.sst/platform/src/components/aws/cognito-user-pool.d.ts.map +1 -1
  58. package/dist/sst/.sst/platform/src/components/aws/cron-v2.d.ts +325 -0
  59. package/dist/sst/.sst/platform/src/components/aws/cron-v2.d.ts.map +1 -0
  60. package/dist/sst/.sst/platform/src/components/aws/cron.d.ts +15 -6
  61. package/dist/sst/.sst/platform/src/components/aws/cron.d.ts.map +1 -1
  62. package/dist/sst/.sst/platform/src/components/aws/dsql.d.ts +369 -0
  63. package/dist/sst/.sst/platform/src/components/aws/dsql.d.ts.map +1 -0
  64. package/dist/sst/.sst/platform/src/components/aws/dynamo-lambda-subscriber.d.ts +1 -1
  65. package/dist/sst/.sst/platform/src/components/aws/dynamo-lambda-subscriber.d.ts.map +1 -1
  66. package/dist/sst/.sst/platform/src/components/aws/dynamo.d.ts +63 -3
  67. package/dist/sst/.sst/platform/src/components/aws/dynamo.d.ts.map +1 -1
  68. package/dist/sst/.sst/platform/src/components/aws/email.d.ts +5 -0
  69. package/dist/sst/.sst/platform/src/components/aws/email.d.ts.map +1 -1
  70. package/dist/sst/.sst/platform/src/components/aws/fargate.d.ts +95 -4
  71. package/dist/sst/.sst/platform/src/components/aws/fargate.d.ts.map +1 -1
  72. package/dist/sst/.sst/platform/src/components/aws/function.d.ts +121 -21
  73. package/dist/sst/.sst/platform/src/components/aws/function.d.ts.map +1 -1
  74. package/dist/sst/.sst/platform/src/components/aws/helpers/arn.d.ts +11 -0
  75. package/dist/sst/.sst/platform/src/components/aws/helpers/arn.d.ts.map +1 -1
  76. package/dist/sst/.sst/platform/src/components/aws/helpers/container-builder.d.ts.map +1 -1
  77. package/dist/sst/.sst/platform/src/components/aws/helpers/function-builder.d.ts +7 -3
  78. package/dist/sst/.sst/platform/src/components/aws/helpers/function-builder.d.ts.map +1 -1
  79. package/dist/sst/.sst/platform/src/components/aws/helpers/load-balancer.d.ts +9 -0
  80. package/dist/sst/.sst/platform/src/components/aws/helpers/load-balancer.d.ts.map +1 -0
  81. package/dist/sst/.sst/platform/src/components/aws/helpers/provider.d.ts +2 -2
  82. package/dist/sst/.sst/platform/src/components/aws/helpers/provider.d.ts.map +1 -1
  83. package/dist/sst/.sst/platform/src/components/aws/helpers/site-builder.d.ts +1 -1
  84. package/dist/sst/.sst/platform/src/components/aws/helpers/site-builder.d.ts.map +1 -1
  85. package/dist/sst/.sst/platform/src/components/aws/helpers/subscriber.d.ts +1 -1
  86. package/dist/sst/.sst/platform/src/components/aws/helpers/subscriber.d.ts.map +1 -1
  87. package/dist/sst/.sst/platform/src/components/aws/https-redirect.d.ts.map +1 -1
  88. package/dist/sst/.sst/platform/src/components/aws/index.d.ts +4 -0
  89. package/dist/sst/.sst/platform/src/components/aws/index.d.ts.map +1 -1
  90. package/dist/sst/.sst/platform/src/components/aws/kinesis-stream-lambda-subscriber.d.ts.map +1 -1
  91. package/dist/sst/.sst/platform/src/components/aws/kinesis-stream.d.ts +8 -3
  92. package/dist/sst/.sst/platform/src/components/aws/kinesis-stream.d.ts.map +1 -1
  93. package/dist/sst/.sst/platform/src/components/aws/linkable.d.ts +1 -1
  94. package/dist/sst/.sst/platform/src/components/aws/linkable.d.ts.map +1 -1
  95. package/dist/sst/.sst/platform/src/components/aws/mysql.d.ts +34 -5
  96. package/dist/sst/.sst/platform/src/components/aws/mysql.d.ts.map +1 -1
  97. package/dist/sst/.sst/platform/src/components/aws/nextjs.d.ts +39 -5
  98. package/dist/sst/.sst/platform/src/components/aws/nextjs.d.ts.map +1 -1
  99. package/dist/sst/.sst/platform/src/components/aws/nuxt.d.ts.map +1 -1
  100. package/dist/sst/.sst/platform/src/components/aws/open-search.d.ts +12 -1
  101. package/dist/sst/.sst/platform/src/components/aws/open-search.d.ts.map +1 -1
  102. package/dist/sst/.sst/platform/src/components/aws/opencontrol.d.ts +7 -3
  103. package/dist/sst/.sst/platform/src/components/aws/opencontrol.d.ts.map +1 -1
  104. package/dist/sst/.sst/platform/src/components/aws/permission.d.ts +5 -0
  105. package/dist/sst/.sst/platform/src/components/aws/permission.d.ts.map +1 -1
  106. package/dist/sst/.sst/platform/src/components/aws/postgres-v1.d.ts +13 -2
  107. package/dist/sst/.sst/platform/src/components/aws/postgres-v1.d.ts.map +1 -1
  108. package/dist/sst/.sst/platform/src/components/aws/postgres.d.ts +34 -5
  109. package/dist/sst/.sst/platform/src/components/aws/postgres.d.ts.map +1 -1
  110. package/dist/sst/.sst/platform/src/components/aws/queue-lambda-subscriber.d.ts +6 -1
  111. package/dist/sst/.sst/platform/src/components/aws/queue-lambda-subscriber.d.ts.map +1 -1
  112. package/dist/sst/.sst/platform/src/components/aws/queue.d.ts +10 -1
  113. package/dist/sst/.sst/platform/src/components/aws/queue.d.ts.map +1 -1
  114. package/dist/sst/.sst/platform/src/components/aws/realtime-lambda-subscriber.d.ts +1 -1
  115. package/dist/sst/.sst/platform/src/components/aws/realtime-lambda-subscriber.d.ts.map +1 -1
  116. package/dist/sst/.sst/platform/src/components/aws/realtime.d.ts +6 -1
  117. package/dist/sst/.sst/platform/src/components/aws/realtime.d.ts.map +1 -1
  118. package/dist/sst/.sst/platform/src/components/aws/redis-v1.d.ts +10 -0
  119. package/dist/sst/.sst/platform/src/components/aws/redis-v1.d.ts.map +1 -1
  120. package/dist/sst/.sst/platform/src/components/aws/redis.d.ts +14 -0
  121. package/dist/sst/.sst/platform/src/components/aws/redis.d.ts.map +1 -1
  122. package/dist/sst/.sst/platform/src/components/aws/router.d.ts +482 -2
  123. package/dist/sst/.sst/platform/src/components/aws/router.d.ts.map +1 -1
  124. package/dist/sst/.sst/platform/src/components/aws/service-v1.d.ts.map +1 -1
  125. package/dist/sst/.sst/platform/src/components/aws/service.d.ts +125 -0
  126. package/dist/sst/.sst/platform/src/components/aws/service.d.ts.map +1 -1
  127. package/dist/sst/.sst/platform/src/components/aws/sns-topic-lambda-subscriber.d.ts +1 -1
  128. package/dist/sst/.sst/platform/src/components/aws/sns-topic-lambda-subscriber.d.ts.map +1 -1
  129. package/dist/sst/.sst/platform/src/components/aws/sns-topic.d.ts +6 -1
  130. package/dist/sst/.sst/platform/src/components/aws/sns-topic.d.ts.map +1 -1
  131. package/dist/sst/.sst/platform/src/components/aws/ssr-site.d.ts +7 -7
  132. package/dist/sst/.sst/platform/src/components/aws/ssr-site.d.ts.map +1 -1
  133. package/dist/sst/.sst/platform/src/components/aws/static-site.d.ts.map +1 -1
  134. package/dist/sst/.sst/platform/src/components/aws/step-functions/state.d.ts +1 -1
  135. package/dist/sst/.sst/platform/src/components/aws/step-functions/state.d.ts.map +1 -1
  136. package/dist/sst/.sst/platform/src/components/aws/step-functions/task.d.ts +10 -2
  137. package/dist/sst/.sst/platform/src/components/aws/step-functions/task.d.ts.map +1 -1
  138. package/dist/sst/.sst/platform/src/components/aws/step-functions.d.ts +5 -0
  139. package/dist/sst/.sst/platform/src/components/aws/step-functions.d.ts.map +1 -1
  140. package/dist/sst/.sst/platform/src/components/aws/tan-stack-start.d.ts +20 -6
  141. package/dist/sst/.sst/platform/src/components/aws/tan-stack-start.d.ts.map +1 -1
  142. package/dist/sst/.sst/platform/src/components/aws/task.d.ts +35 -15
  143. package/dist/sst/.sst/platform/src/components/aws/task.d.ts.map +1 -1
  144. package/dist/sst/.sst/platform/src/components/aws/vector.d.ts +5 -0
  145. package/dist/sst/.sst/platform/src/components/aws/vector.d.ts.map +1 -1
  146. package/dist/sst/.sst/platform/src/components/aws/vpc.d.ts +51 -4
  147. package/dist/sst/.sst/platform/src/components/aws/vpc.d.ts.map +1 -1
  148. package/dist/sst/.sst/platform/src/components/aws/workflow.d.ts +331 -0
  149. package/dist/sst/.sst/platform/src/components/aws/workflow.d.ts.map +1 -0
  150. package/dist/sst/.sst/platform/src/components/cloudflare/ai.d.ts +82 -0
  151. package/dist/sst/.sst/platform/src/components/cloudflare/ai.d.ts.map +1 -0
  152. package/dist/sst/.sst/platform/src/components/cloudflare/binding.d.ts +15 -1
  153. package/dist/sst/.sst/platform/src/components/cloudflare/binding.d.ts.map +1 -1
  154. package/dist/sst/.sst/platform/src/components/cloudflare/bucket.d.ts +4 -2
  155. package/dist/sst/.sst/platform/src/components/cloudflare/bucket.d.ts.map +1 -1
  156. package/dist/sst/.sst/platform/src/components/cloudflare/cron.d.ts +29 -5
  157. package/dist/sst/.sst/platform/src/components/cloudflare/cron.d.ts.map +1 -1
  158. package/dist/sst/.sst/platform/src/components/cloudflare/d1.d.ts +37 -2
  159. package/dist/sst/.sst/platform/src/components/cloudflare/d1.d.ts.map +1 -1
  160. package/dist/sst/.sst/platform/src/components/cloudflare/index.d.ts +1 -0
  161. package/dist/sst/.sst/platform/src/components/cloudflare/index.d.ts.map +1 -1
  162. package/dist/sst/.sst/platform/src/components/cloudflare/kv.d.ts +36 -2
  163. package/dist/sst/.sst/platform/src/components/cloudflare/kv.d.ts.map +1 -1
  164. package/dist/sst/.sst/platform/src/components/cloudflare/providers/worker-placement.d.ts +27 -0
  165. package/dist/sst/.sst/platform/src/components/cloudflare/providers/worker-placement.d.ts.map +1 -0
  166. package/dist/sst/.sst/platform/src/components/cloudflare/providers/zone-lookup.d.ts.map +1 -1
  167. package/dist/sst/.sst/platform/src/components/cloudflare/queue-worker-subscriber.d.ts +116 -0
  168. package/dist/sst/.sst/platform/src/components/cloudflare/queue-worker-subscriber.d.ts.map +1 -0
  169. package/dist/sst/.sst/platform/src/components/cloudflare/queue.d.ts +186 -3
  170. package/dist/sst/.sst/platform/src/components/cloudflare/queue.d.ts.map +1 -1
  171. package/dist/sst/.sst/platform/src/components/cloudflare/static-site.d.ts +2 -2
  172. package/dist/sst/.sst/platform/src/components/cloudflare/static-site.d.ts.map +1 -1
  173. package/dist/sst/.sst/platform/src/components/cloudflare/worker.d.ts +39 -5
  174. package/dist/sst/.sst/platform/src/components/cloudflare/worker.d.ts.map +1 -1
  175. package/dist/sst/.sst/platform/src/components/component.d.ts.map +1 -1
  176. package/dist/sst/.sst/platform/src/components/duration.d.ts +2 -0
  177. package/dist/sst/.sst/platform/src/components/duration.d.ts.map +1 -1
  178. package/dist/sst/.sst/platform/src/components/esbuild.d.ts +3 -0
  179. package/dist/sst/.sst/platform/src/components/esbuild.d.ts.map +1 -0
  180. package/dist/sst/.sst/platform/src/components/link.d.ts +2 -2
  181. package/dist/sst/.sst/platform/src/components/link.d.ts.map +1 -1
  182. package/dist/sst/.sst/platform/src/components/linkable.d.ts +32 -2
  183. package/dist/sst/.sst/platform/src/components/linkable.d.ts.map +1 -1
  184. package/dist/sst/.sst/platform/src/components/rpc/rpc.d.ts.map +1 -1
  185. package/dist/sst/.sst/platform/src/components/vercel/dns.d.ts +2 -2
  186. package/dist/sst/.sst/platform/src/util/minify.d.ts +2 -0
  187. package/dist/sst/.sst/platform/src/util/minify.d.ts.map +1 -0
  188. package/dist/sst/components/q-function.d.ts +2 -3
  189. package/dist/sst/components/q-function.d.ts.map +1 -1
  190. package/dist/sst/index.js.map +1 -1
  191. package/package.json +2 -2
  192. package/dist/sst/.sst/platform/src/components/aws/helpers/quota.d.ts +0 -7
  193. package/dist/sst/.sst/platform/src/components/aws/helpers/quota.d.ts.map +0 -1
@@ -6,6 +6,9 @@ interface EntitySchemaMap {
6
6
  [key: string]: Record<string, any>;
7
7
  }
8
8
  type DraftEntity<T extends Entity = Entity> = T extends keyof EntitySchemaMap ? EntitySchemaMap[T] : never;
9
+ type NumericFields<T> = {
10
+ [K in keyof T as T[K] extends number ? K : never]?: number;
11
+ };
9
12
  type CreatedEntity<T extends Entity = Entity> = {
10
13
  entityId: string;
11
14
  entityType: string;
@@ -210,6 +213,46 @@ interface MonoriseEntityConfig<T extends Entity = Entity, B extends z.ZodRawShap
210
213
  sortValue?: string;
211
214
  }[];
212
215
  }[];
216
+ /**
217
+ * @description (Optional) Constraints for `adjustEntity` operations.
218
+ * When adjusting numeric fields, these constraints are enforced at the database level.
219
+ * If an adjustment would violate a constraint, the operation is rejected.
220
+ *
221
+ * @example
222
+ * ```ts
223
+ * {
224
+ * adjustmentConstraints: {
225
+ * // Static: same for all entities of this type
226
+ * balance: { min: 0 },
227
+ * credits: { min: 0, max: 10000 },
228
+ *
229
+ * // Dynamic: reads constraint value from entity's own data
230
+ * balance: { minField: 'minBalance' },
231
+ * credits: { min: 0, maxField: 'creditLimit' },
232
+ * }
233
+ * }
234
+ * ```
235
+ */
236
+ adjustmentConstraints?: {
237
+ [fieldName: string]: {
238
+ /** Static minimum value */
239
+ min?: number;
240
+ /** Static maximum value */
241
+ max?: number;
242
+ /** Field name on the entity whose value is used as the minimum (must be a numeric field) */
243
+ minField?: keyof {
244
+ [K in keyof B as B[K] extends z.ZodNumber | z.ZodOptional<z.ZodNumber> ? K : never]: K;
245
+ } extends never ? string : keyof {
246
+ [K in keyof B as B[K] extends z.ZodNumber | z.ZodOptional<z.ZodNumber> ? K : never]: K;
247
+ };
248
+ /** Field name on the entity whose value is used as the maximum (must be a numeric field) */
249
+ maxField?: keyof {
250
+ [K in keyof B as B[K] extends z.ZodNumber | z.ZodOptional<z.ZodNumber> ? K : never]: K;
251
+ } extends never ? string : keyof {
252
+ [K in keyof B as B[K] extends z.ZodNumber | z.ZodOptional<z.ZodNumber> ? K : never]: K;
253
+ };
254
+ };
255
+ };
213
256
  }
214
257
 
215
258
  declare const createEntityConfig: <T extends Entity, B extends z.ZodRawShape, C extends z.ZodRawShape, M extends z.ZodRawShape, CO extends z.ZodObject<C> | undefined = undefined, MO extends z.ZodObject<M> | undefined = undefined>(config: MonoriseEntityConfig<T, B, C, M, CO, MO>) => {
@@ -261,6 +304,14 @@ declare const createEntityConfig: <T extends Entity, B extends z.ZodRawShape, C
261
304
  sortValue?: string;
262
305
  }[];
263
306
  }[];
307
+ adjustmentConstraints?: {
308
+ [fieldName: string]: {
309
+ min?: number;
310
+ max?: number;
311
+ minField?: (keyof { [K in keyof B as B[K] extends z.ZodNumber | z.ZodOptional<z.ZodNumber> ? K : never]: K; } extends never ? string : keyof { [K_1 in keyof B as B[K_1] extends z.ZodNumber | z.ZodOptional<z.ZodNumber> ? K_1 : never]: K_1; }) | undefined;
312
+ maxField?: (keyof { [K_2 in keyof B as B[K_2] extends z.ZodNumber | z.ZodOptional<z.ZodNumber> ? K_2 : never]: K_2; } extends never ? string : keyof { [K_3 in keyof B as B[K_3] extends z.ZodNumber | z.ZodOptional<z.ZodNumber> ? K_3 : never]: K_3; }) | undefined;
313
+ };
314
+ } | undefined;
264
315
  };
265
316
 
266
- export { type CreatedEntity, type DraftEntity, Entity, type EntitySchemaMap, type MonoriseEntityConfig, createEntityConfig };
317
+ export { type CreatedEntity, type DraftEntity, Entity, type EntitySchemaMap, type MonoriseEntityConfig, type NumericFields, createEntityConfig };
@@ -1 +1 @@
1
- {"version":3,"sources":["../types/monorise.type.ts","../utils/index.ts"],"sourcesContent":["import type { z } from 'zod';\n\nexport enum Entity {}\n\nexport interface EntitySchemaMap {\n [key: string]: Record<string, any>;\n}\n\nexport type DraftEntity<T extends Entity = Entity> =\n T extends keyof EntitySchemaMap ? EntitySchemaMap[T] : never;\n\nexport type CreatedEntity<T extends Entity = Entity> = {\n entityId: string;\n entityType: string;\n data: T extends keyof EntitySchemaMap ? EntitySchemaMap[T] : never;\n createdAt: string;\n updatedAt: string;\n};\n\n/**\n * @description Configuration for a monorise entity, a shared configuration that is used across frontend and backend.\n * This can be served as a single source of truth for the entity configuration.\n * It is used to define the schema, and mutual relationships between this entity and other entities.\n *\n * @example\n * ```ts\n * const baseSchema = z.object({\n * title: z.string(),\n * }).partial();\n *\n * const createSchema = baseSchema.extend({\n * title: z.string(),\n * })\n *\n * const config = createEntityConfig({\n * name: 'learner',\n * displayName: 'Learner',\n * baseSchema,\n * createSchema,\n * });\n * ```\n */\nexport interface MonoriseEntityConfig<\n T extends Entity = Entity,\n B extends z.ZodRawShape = z.ZodRawShape,\n C extends z.ZodRawShape = z.ZodRawShape,\n M extends z.ZodRawShape = z.ZodRawShape,\n CO extends z.ZodObject<C> | undefined = undefined,\n MO extends z.ZodObject<M> | undefined = undefined,\n> {\n /**\n * @description Name of the entity. Must be in **lower-kebab-case** and **unique** across all entities\n *\n * @example `learner`, `learning-activity`\n */\n name: string | T;\n\n /**\n * @description Display name of the entity. It is not required to be unique\n */\n displayName: string;\n\n /**\n * @description (DEPRECATED) Use `uniqueFields` instead, Monorise should not handle auth mechanism\n * @description (Optional) Specify the authentication method to be used for the entity\n */\n authMethod?: {\n /**\n * @description Authentication method using email\n *\n * Note: The email used for authentication is unique per entity.\n * For example, if `johndoe@mail.com` is used for `learner` entity,\n * it can be reused again on `admin` entity. However, the same email\n * address cannot be repeated for the same entity.\n */\n email: {\n /**\n * @description Number of milliseconds before the token expires\n */\n tokenExpiresIn: number;\n };\n };\n\n /**\n * @description Base schema for the entity\n */\n baseSchema: z.ZodObject<B>;\n\n /**\n * @description Minimal schema required to create an entity\n */\n createSchema?: CO;\n searchableFields?: (keyof B)[];\n uniqueFields?: (keyof B)[];\n\n /**\n * @description Define mutual relationship of this entity with other entities\n */\n mutual?: {\n /**\n * @description Subscribes to update events from specified entities in the array.\n * These events will be used to run prejoin processor.\n */\n subscribes?: { entityType: Entity }[];\n /**\n * @description Virtual schema for mutual relationship. The schema is only used for validation purpose, but these fields are not stored in the database\n */\n mutualSchema: MO;\n\n /**\n * @description Keys of `mutualFields` are fields defined in `mutualSchema`.\n * Each field is a mutual relationship between this entity and another entity.\n */\n mutualFields: {\n [key: string]: {\n entityType: Entity;\n toMutualIds?: (context: any) => string[];\n /**\n * @description (Optional) Custom function to process `mutualData`. If not provided, `mutualData` will be empty.\n *\n * @returns the final state of `mutualData` to be stored in the mutual record. Must be an object.\n */\n mutualDataProcessor?: (\n mutualIds: string[],\n currentMutual: any,\n customContext?: Record<string, any>,\n ) => Record<string, any>;\n };\n };\n\n /**\n * @description (Optional) Better known as tree processor\n * This is used to prejoin entities that are not directly related as mutual.\n * For example, if `learner` entity is related to `course` entity, and `course` entity is related to `module` entity,\n * prejoins can be used to join `learner` and `module` entities.\n * With this, the `learner` entity can access the `module` entity without having to go through the `course` entity,\n * hence reducing the number of queries.\n *\n * DynamoDB best practices: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-general-normalization.html\n *\n */\n prejoins?: {\n mutualField: string;\n targetEntityType: Entity;\n entityPaths: {\n skipCache?: boolean;\n entityType: Entity;\n processor?: (items: any[], context: Record<string, any>) => any;\n }[];\n }[];\n };\n /**\n * Use this function to perform side effects on the final schema for example refine/superRefine the schema\n *\n * @param schema The final schema of the entity (the combination of `baseSchema`/`createSchema` and `mutualSchema` if specified)\n * @returns void\n *\n * @example\n * ```ts\n * effect: (schema) => {\n * schema.refine(\n * // refinement logic here\n * )\n * }\n */\n effect?: (\n schema: z.ZodObject<z.ZodRawShape>,\n ) => z.ZodEffects<z.ZodObject<z.ZodRawShape>>;\n\n /**\n * @description (Optional) Use tags to create additional access patterns for the entity.\n * Time complexity for retrieving tagged entities is O(1).\n *\n * The following configuration will create a tag named `region` for the `organization` entity grouped by `region`.\n * You would then be able to retrieve all organizations in a specific region by:\n * GET `/core/tag/organization/region?group={region_name}`\n *\n * @example\n *\n * ```ts\n * {\n * name: 'organization',\n * tags: [\n * {\n * name: 'region',\n * processor: (entity) => {\n * return [\n * {\n * group: entity.data.region\n * }\n * ]\n * },\n * }\n * ]\n * }\n * ```\n *\n * @description\n *\n * The following configuration will create a tag named `dob` for the `user` entity sorted by `dob`.\n * You would then be able to retrieve all users sorted by `dob` by:\n * GET `/core/tag/user/dob?start=2000-01-01&end=2020-12-31`\n *\n * @example\n * ```ts\n * {\n * name: 'user',\n * tags: [\n * {\n * name: 'dob',\n * processor: (entity) => {\n * return [\n * {\n * sortValue: entity.data.dob\n * }\n * ]\n * },\n * }\n * ]\n * }\n * ```\n */\n tags?: {\n name: string;\n processor: (entity: { entityId: string; entityType: string; data: Record<string, any>; createdAt: string; updatedAt: string }) => {\n group?: string;\n sortValue?: string;\n }[];\n }[];\n}\n","import type { Entity, MonoriseEntityConfig } from '../types/monorise.type';\nimport { z } from 'zod';\n\nfunction makeSchema<\n T extends Entity,\n B extends z.ZodRawShape,\n C extends z.ZodRawShape,\n M extends z.ZodRawShape,\n CO extends z.ZodObject<C> | undefined = undefined,\n MO extends z.ZodObject<M> | undefined = undefined,\n>(config: MonoriseEntityConfig<T, B, C, M, CO, MO>) {\n const { baseSchema, createSchema, mutual, effect } = config;\n const { mutualSchema } = mutual || {};\n\n type FinalSchemaType = CO extends z.AnyZodObject\n ? MO extends z.AnyZodObject\n ? z.ZodObject<MO['shape'] & CO['shape']>\n : CO\n : MO extends z.AnyZodObject\n ? z.ZodObject<MO['shape'] & B>\n : z.ZodObject<B>;\n\n const finalSchema = z.object({\n ...baseSchema.shape,\n ...createSchema?.shape,\n ...mutualSchema?.shape,\n }) as FinalSchemaType;\n\n if (effect) {\n return effect(finalSchema) as z.ZodEffects<FinalSchemaType>;\n }\n\n return finalSchema;\n}\n\nconst createEntityConfig = <\n T extends Entity,\n B extends z.ZodRawShape,\n C extends z.ZodRawShape,\n M extends z.ZodRawShape,\n CO extends z.ZodObject<C> | undefined = undefined,\n MO extends z.ZodObject<M> | undefined = undefined,\n>(\n config: MonoriseEntityConfig<T, B, C, M, CO, MO>,\n) => ({\n ...config,\n finalSchema: makeSchema(config),\n});\n\nexport { createEntityConfig };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEO,IAAK,SAAL,kBAAKA,YAAL;AAAK,SAAAA;AAAA,GAAA;;;ACDZ,SAAS,SAAS;AAElB,SAAS,WAOP,QAAkD;AAClD,QAAM,EAAE,YAAY,cAAc,QAAQ,OAAO,IAAI;AACrD,QAAM,EAAE,aAAa,IAAI,UAAU,CAAC;AAUpC,QAAM,cAAc,EAAE,OAAO,iDACxB,WAAW,QACX,6CAAc,QACd,6CAAc,MAClB;AAED,MAAI,QAAQ;AACV,WAAO,OAAO,WAAW;AAAA,EAC3B;AAEA,SAAO;AACT;AAEA,IAAM,qBAAqB,CAQzB,WACI,iCACD,SADC;AAAA,EAEJ,aAAa,WAAW,MAAM;AAChC;","names":["Entity"]}
1
+ {"version":3,"sources":["../types/monorise.type.ts","../utils/index.ts"],"sourcesContent":["import type { z } from 'zod';\n\nexport enum Entity {}\n\nexport interface EntitySchemaMap {\n [key: string]: Record<string, any>;\n}\n\nexport type DraftEntity<T extends Entity = Entity> =\n T extends keyof EntitySchemaMap ? EntitySchemaMap[T] : never;\n\nexport type NumericFields<T> = {\n [K in keyof T as T[K] extends number ? K : never]?: number;\n};\n\nexport type CreatedEntity<T extends Entity = Entity> = {\n entityId: string;\n entityType: string;\n data: T extends keyof EntitySchemaMap ? EntitySchemaMap[T] : never;\n createdAt: string;\n updatedAt: string;\n};\n\n/**\n * @description Configuration for a monorise entity, a shared configuration that is used across frontend and backend.\n * This can be served as a single source of truth for the entity configuration.\n * It is used to define the schema, and mutual relationships between this entity and other entities.\n *\n * @example\n * ```ts\n * const baseSchema = z.object({\n * title: z.string(),\n * }).partial();\n *\n * const createSchema = baseSchema.extend({\n * title: z.string(),\n * })\n *\n * const config = createEntityConfig({\n * name: 'learner',\n * displayName: 'Learner',\n * baseSchema,\n * createSchema,\n * });\n * ```\n */\nexport interface MonoriseEntityConfig<\n T extends Entity = Entity,\n B extends z.ZodRawShape = z.ZodRawShape,\n C extends z.ZodRawShape = z.ZodRawShape,\n M extends z.ZodRawShape = z.ZodRawShape,\n CO extends z.ZodObject<C> | undefined = undefined,\n MO extends z.ZodObject<M> | undefined = undefined,\n> {\n /**\n * @description Name of the entity. Must be in **lower-kebab-case** and **unique** across all entities\n *\n * @example `learner`, `learning-activity`\n */\n name: string | T;\n\n /**\n * @description Display name of the entity. It is not required to be unique\n */\n displayName: string;\n\n /**\n * @description (DEPRECATED) Use `uniqueFields` instead, Monorise should not handle auth mechanism\n * @description (Optional) Specify the authentication method to be used for the entity\n */\n authMethod?: {\n /**\n * @description Authentication method using email\n *\n * Note: The email used for authentication is unique per entity.\n * For example, if `johndoe@mail.com` is used for `learner` entity,\n * it can be reused again on `admin` entity. However, the same email\n * address cannot be repeated for the same entity.\n */\n email: {\n /**\n * @description Number of milliseconds before the token expires\n */\n tokenExpiresIn: number;\n };\n };\n\n /**\n * @description Base schema for the entity\n */\n baseSchema: z.ZodObject<B>;\n\n /**\n * @description Minimal schema required to create an entity\n */\n createSchema?: CO;\n searchableFields?: (keyof B)[];\n uniqueFields?: (keyof B)[];\n\n /**\n * @description Define mutual relationship of this entity with other entities\n */\n mutual?: {\n /**\n * @description Subscribes to update events from specified entities in the array.\n * These events will be used to run prejoin processor.\n */\n subscribes?: { entityType: Entity }[];\n /**\n * @description Virtual schema for mutual relationship. The schema is only used for validation purpose, but these fields are not stored in the database\n */\n mutualSchema: MO;\n\n /**\n * @description Keys of `mutualFields` are fields defined in `mutualSchema`.\n * Each field is a mutual relationship between this entity and another entity.\n */\n mutualFields: {\n [key: string]: {\n entityType: Entity;\n toMutualIds?: (context: any) => string[];\n /**\n * @description (Optional) Custom function to process `mutualData`. If not provided, `mutualData` will be empty.\n *\n * @returns the final state of `mutualData` to be stored in the mutual record. Must be an object.\n */\n mutualDataProcessor?: (\n mutualIds: string[],\n currentMutual: any,\n customContext?: Record<string, any>,\n ) => Record<string, any>;\n };\n };\n\n /**\n * @description (Optional) Better known as tree processor\n * This is used to prejoin entities that are not directly related as mutual.\n * For example, if `learner` entity is related to `course` entity, and `course` entity is related to `module` entity,\n * prejoins can be used to join `learner` and `module` entities.\n * With this, the `learner` entity can access the `module` entity without having to go through the `course` entity,\n * hence reducing the number of queries.\n *\n * DynamoDB best practices: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-general-normalization.html\n *\n */\n prejoins?: {\n mutualField: string;\n targetEntityType: Entity;\n entityPaths: {\n skipCache?: boolean;\n entityType: Entity;\n processor?: (items: any[], context: Record<string, any>) => any;\n }[];\n }[];\n };\n /**\n * Use this function to perform side effects on the final schema for example refine/superRefine the schema\n *\n * @param schema The final schema of the entity (the combination of `baseSchema`/`createSchema` and `mutualSchema` if specified)\n * @returns void\n *\n * @example\n * ```ts\n * effect: (schema) => {\n * schema.refine(\n * // refinement logic here\n * )\n * }\n */\n effect?: (\n schema: z.ZodObject<z.ZodRawShape>,\n ) => z.ZodEffects<z.ZodObject<z.ZodRawShape>>;\n\n /**\n * @description (Optional) Use tags to create additional access patterns for the entity.\n * Time complexity for retrieving tagged entities is O(1).\n *\n * The following configuration will create a tag named `region` for the `organization` entity grouped by `region`.\n * You would then be able to retrieve all organizations in a specific region by:\n * GET `/core/tag/organization/region?group={region_name}`\n *\n * @example\n *\n * ```ts\n * {\n * name: 'organization',\n * tags: [\n * {\n * name: 'region',\n * processor: (entity) => {\n * return [\n * {\n * group: entity.data.region\n * }\n * ]\n * },\n * }\n * ]\n * }\n * ```\n *\n * @description\n *\n * The following configuration will create a tag named `dob` for the `user` entity sorted by `dob`.\n * You would then be able to retrieve all users sorted by `dob` by:\n * GET `/core/tag/user/dob?start=2000-01-01&end=2020-12-31`\n *\n * @example\n * ```ts\n * {\n * name: 'user',\n * tags: [\n * {\n * name: 'dob',\n * processor: (entity) => {\n * return [\n * {\n * sortValue: entity.data.dob\n * }\n * ]\n * },\n * }\n * ]\n * }\n * ```\n */\n tags?: {\n name: string;\n processor: (entity: { entityId: string; entityType: string; data: Record<string, any>; createdAt: string; updatedAt: string }) => {\n group?: string;\n sortValue?: string;\n }[];\n }[];\n\n /**\n * @description (Optional) Constraints for `adjustEntity` operations.\n * When adjusting numeric fields, these constraints are enforced at the database level.\n * If an adjustment would violate a constraint, the operation is rejected.\n *\n * @example\n * ```ts\n * {\n * adjustmentConstraints: {\n * // Static: same for all entities of this type\n * balance: { min: 0 },\n * credits: { min: 0, max: 10000 },\n *\n * // Dynamic: reads constraint value from entity's own data\n * balance: { minField: 'minBalance' },\n * credits: { min: 0, maxField: 'creditLimit' },\n * }\n * }\n * ```\n */\n adjustmentConstraints?: {\n [fieldName: string]: {\n /** Static minimum value */\n min?: number;\n /** Static maximum value */\n max?: number;\n /** Field name on the entity whose value is used as the minimum (must be a numeric field) */\n minField?: keyof {\n [K in keyof B as B[K] extends z.ZodNumber | z.ZodOptional<z.ZodNumber> ? K : never]: K;\n } extends never ? string : keyof {\n [K in keyof B as B[K] extends z.ZodNumber | z.ZodOptional<z.ZodNumber> ? K : never]: K;\n };\n /** Field name on the entity whose value is used as the maximum (must be a numeric field) */\n maxField?: keyof {\n [K in keyof B as B[K] extends z.ZodNumber | z.ZodOptional<z.ZodNumber> ? K : never]: K;\n } extends never ? string : keyof {\n [K in keyof B as B[K] extends z.ZodNumber | z.ZodOptional<z.ZodNumber> ? K : never]: K;\n };\n };\n };\n}\n","import type { Entity, MonoriseEntityConfig } from '../types/monorise.type';\nimport { z } from 'zod';\n\nfunction makeSchema<\n T extends Entity,\n B extends z.ZodRawShape,\n C extends z.ZodRawShape,\n M extends z.ZodRawShape,\n CO extends z.ZodObject<C> | undefined = undefined,\n MO extends z.ZodObject<M> | undefined = undefined,\n>(config: MonoriseEntityConfig<T, B, C, M, CO, MO>) {\n const { baseSchema, createSchema, mutual, effect } = config;\n const { mutualSchema } = mutual || {};\n\n type FinalSchemaType = CO extends z.AnyZodObject\n ? MO extends z.AnyZodObject\n ? z.ZodObject<MO['shape'] & CO['shape']>\n : CO\n : MO extends z.AnyZodObject\n ? z.ZodObject<MO['shape'] & B>\n : z.ZodObject<B>;\n\n const finalSchema = z.object({\n ...baseSchema.shape,\n ...createSchema?.shape,\n ...mutualSchema?.shape,\n }) as FinalSchemaType;\n\n if (effect) {\n return effect(finalSchema) as z.ZodEffects<FinalSchemaType>;\n }\n\n return finalSchema;\n}\n\nconst createEntityConfig = <\n T extends Entity,\n B extends z.ZodRawShape,\n C extends z.ZodRawShape,\n M extends z.ZodRawShape,\n CO extends z.ZodObject<C> | undefined = undefined,\n MO extends z.ZodObject<M> | undefined = undefined,\n>(\n config: MonoriseEntityConfig<T, B, C, M, CO, MO>,\n) => ({\n ...config,\n finalSchema: makeSchema(config),\n});\n\nexport { createEntityConfig };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEO,IAAK,SAAL,kBAAKA,YAAL;AAAK,SAAAA;AAAA,GAAA;;;ACDZ,SAAS,SAAS;AAElB,SAAS,WAOP,QAAkD;AAClD,QAAM,EAAE,YAAY,cAAc,QAAQ,OAAO,IAAI;AACrD,QAAM,EAAE,aAAa,IAAI,UAAU,CAAC;AAUpC,QAAM,cAAc,EAAE,OAAO,iDACxB,WAAW,QACX,6CAAc,QACd,6CAAc,MAClB;AAED,MAAI,QAAQ;AACV,WAAO,OAAO,WAAW;AAAA,EAC3B;AAEA,SAAO;AACT;AAEA,IAAM,qBAAqB,CAQzB,WACI,iCACD,SADC;AAAA,EAEJ,aAAa,WAAW,MAAM;AAChC;","names":["Entity"]}
@@ -5,7 +5,7 @@ import { DynamoDB, TransactWriteItemsInput, AttributeValue, TransactWriteItem, U
5
5
  import * as hono_utils_http_status from 'hono/utils/http-status';
6
6
  import * as hono_utils_types from 'hono/utils/types';
7
7
  import { createFactory } from 'hono/factory';
8
- import httpStatus4 from 'http-status';
8
+ import httpStatus8 from 'http-status';
9
9
  import { unmarshall, marshall } from '@aws-sdk/util-dynamodb';
10
10
  import { EventBridgeClient } from '@aws-sdk/client-eventbridge';
11
11
  import * as hono_aws_lambda from 'hono/aws-lambda';
@@ -53,6 +53,19 @@ declare abstract class Repository {
53
53
  ExpressionAttributeNames: Record<string, string>;
54
54
  ExpressionAttributeValues: Record<string, AttributeValue>;
55
55
  };
56
+ toAdjustUpdate(adjustments: Record<string, number>, constraints?: {
57
+ [field: string]: {
58
+ min?: number;
59
+ max?: number;
60
+ minField?: string;
61
+ maxField?: string;
62
+ };
63
+ }, prefix?: string): {
64
+ UpdateExpression: string;
65
+ ConditionExpression?: string;
66
+ ExpressionAttributeNames: Record<string, string>;
67
+ ExpressionAttributeValues: Record<string, AttributeValue>;
68
+ };
56
69
  }
57
70
 
58
71
  declare class Entity$1<T extends Entity$2> extends Item$1 {
@@ -119,6 +132,12 @@ declare class EntityRepository extends Repository {
119
132
  ExpressionAttributeNames?: Record<string, string>;
120
133
  ExpressionAttributeValues?: Record<string, AttributeValue>;
121
134
  }): Promise<Entity$1<T>>;
135
+ adjustEntity<T extends Entity$2>(entityType: T, entityId: string, adjustments: Record<string, number>, constraints?: {
136
+ [field: string]: {
137
+ min?: number;
138
+ max?: number;
139
+ };
140
+ }): Promise<Entity$1<T>>;
122
141
  deleteEntity<T extends Entity$2>(entityType: T, entityId: string): Promise<void>;
123
142
  queryEntities<T extends Entity$2>(entityType: T, query: string): Promise<{
124
143
  items: Entity$1<T>[];
@@ -446,10 +465,10 @@ factory.createMiddleware((c, next) => __async(null, null, function* () {
446
465
  return yield next();
447
466
  }
448
467
  if (!xApiKey || Array.isArray(xApiKey) || !API_KEYS.includes(xApiKey)) {
449
- c.status(httpStatus4.UNAUTHORIZED);
468
+ c.status(httpStatus8.UNAUTHORIZED);
450
469
  return c.json({
451
- status: httpStatus4.UNAUTHORIZED,
452
- message: httpStatus4["401_MESSAGE"]
470
+ status: httpStatus8.UNAUTHORIZED,
471
+ message: httpStatus8["401_MESSAGE"]
453
472
  });
454
473
  }
455
474
  return yield next();
@@ -4427,6 +4446,26 @@ external_exports.object({
4427
4446
  lastKey: external_exports.string().optional()
4428
4447
  });
4429
4448
 
4449
+ type WhereOperator = {
4450
+ $eq: string | number | boolean;
4451
+ } | {
4452
+ $ne: string | number | boolean;
4453
+ } | {
4454
+ $gt: number;
4455
+ } | {
4456
+ $lt: number;
4457
+ } | {
4458
+ $gte: number;
4459
+ } | {
4460
+ $lte: number;
4461
+ } | {
4462
+ $exists: boolean;
4463
+ } | {
4464
+ $beginsWith: string;
4465
+ };
4466
+ type WhereClause = WhereOperator | string | number | boolean;
4467
+ type WhereConditions = Record<string, WhereClause>;
4468
+
4430
4469
  declare class EntityServiceLifeCycle {
4431
4470
  private EntityConfig;
4432
4471
  private publishEvent;
@@ -4452,11 +4491,18 @@ declare class EntityService {
4452
4491
  mutualId?: string;
4453
4492
  };
4454
4493
  }) => Promise<Entity<T>>;
4455
- updateEntity: <T extends Entity$2>({ entityType, entityId, entityPayload, accountId, }: {
4494
+ adjustEntity: <T extends Entity$2>({ entityType, entityId, adjustments, accountId, }: {
4495
+ entityType: T;
4496
+ entityId: string;
4497
+ adjustments: Record<string, number>;
4498
+ accountId?: string;
4499
+ }) => Promise<Entity<T>>;
4500
+ updateEntity: <T extends Entity$2>({ entityType, entityId, entityPayload, accountId, where, }: {
4456
4501
  entityType: T;
4457
4502
  entityId: string;
4458
4503
  entityPayload: Partial<EntitySchemaMap[T]>;
4459
4504
  accountId?: string | string[];
4505
+ where?: WhereConditions;
4460
4506
  }) => Promise<Entity<T>>;
4461
4507
  deleteEntity: <T extends Entity$2>({ entityType, entityId, accountId, }: {
4462
4508
  entityType: T;
@@ -4518,6 +4564,14 @@ declare class UpdateEntityController {
4518
4564
  }, hono_utils_http_status.ContentfulStatusCode, "json">>;
4519
4565
  }
4520
4566
 
4567
+ declare class AdjustEntityController {
4568
+ private entityService;
4569
+ constructor(entityService: EntityService);
4570
+ controller: hono.MiddlewareHandler<any, string, {}, Response & hono.TypedResponse<{
4571
+ [x: string]: hono_utils_types.JSONValue;
4572
+ }, hono_utils_http_status.ContentfulStatusCode, "json">>;
4573
+ }
4574
+
4521
4575
  declare class UpsertEntityController {
4522
4576
  private EntityConfig;
4523
4577
  private entityRepository;
@@ -4673,6 +4727,7 @@ declare class DependencyContainer {
4673
4727
  get createEntityController(): CreateEntityController;
4674
4728
  get upsertEntityController(): UpsertEntityController;
4675
4729
  get updateEntityController(): UpdateEntityController;
4730
+ get adjustEntityController(): AdjustEntityController;
4676
4731
  get deleteEntityController(): DeleteEntityController;
4677
4732
  get listEntitiesByEntityController(): ListEntitiesByEntityController;
4678
4733
  get getMutualController(): GetMutualController;