@lilaquadrat/studio 10.0.0-beta.8 → 10.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 (244) hide show
  1. package/eslint.config.js +146 -0
  2. package/lib/fastify-plugins.d.ts +6 -0
  3. package/lib/fastify-plugins.js +7 -0
  4. package/lib/fastify-plugins.js.map +1 -0
  5. package/lib/helpers.d.ts +4 -2
  6. package/lib/helpers.js +13 -2
  7. package/lib/helpers.js.map +1 -1
  8. package/lib/main.d.ts +1 -3
  9. package/lib/main.js +7 -3
  10. package/lib/main.js.map +1 -1
  11. package/lib/models.d.ts +4 -4
  12. package/lib/models.js +4 -4
  13. package/lib/models.js.map +1 -1
  14. package/lib/services.d.ts +5 -5
  15. package/lib/services.js +5 -13
  16. package/lib/services.js.map +1 -1
  17. package/lib/src/Immutable.class.d.ts +8 -1
  18. package/lib/src/Immutable.class.js +52 -8
  19. package/lib/src/Immutable.class.js.map +1 -1
  20. package/lib/src/ShareClientFactory.class.d.ts +1 -3
  21. package/lib/src/ShareClientFactory.class.js +1 -9
  22. package/lib/src/ShareClientFactory.class.js.map +1 -1
  23. package/lib/src/classes/models.class.js.map +1 -1
  24. package/lib/src/classes/modelv2.class.d.ts +2 -0
  25. package/lib/src/classes/modelv2.class.js +1 -1
  26. package/lib/src/classes/modelv2.class.js.map +1 -1
  27. package/lib/src/classes/mongo.class.js +4 -14
  28. package/lib/src/classes/mongo.class.js.map +1 -1
  29. package/lib/src/functions/handleError.d.ts +2 -3
  30. package/lib/src/functions/handleError.js +3 -16
  31. package/lib/src/functions/handleError.js.map +1 -1
  32. package/lib/src/functions/optionsHelper.d.ts +4 -4
  33. package/lib/src/functions/optionsHelper.js +5 -4
  34. package/lib/src/functions/optionsHelper.js.map +1 -1
  35. package/lib/src/functions/respondCode.d.ts +2 -1
  36. package/lib/src/functions/respondCode.js +1 -1
  37. package/lib/src/functions/respondCode.js.map +1 -1
  38. package/lib/src/helpers/ControllerHelper.d.ts +73 -0
  39. package/lib/src/helpers/ControllerHelper.js +242 -0
  40. package/lib/src/helpers/ControllerHelper.js.map +1 -0
  41. package/lib/src/helpers/EnvMapper.js +1 -0
  42. package/lib/src/helpers/EnvMapper.js.map +1 -0
  43. package/lib/src/helpers/auth0config.d.ts +6 -0
  44. package/lib/src/helpers/auth0config.js +23 -0
  45. package/lib/src/helpers/auth0config.js.map +1 -0
  46. package/lib/src/helpers/authPlugin.d.ts +29 -0
  47. package/lib/src/helpers/authPlugin.js +77 -0
  48. package/lib/src/helpers/authPlugin.js.map +1 -0
  49. package/lib/src/helpers/cacheHelper.d.ts +69 -0
  50. package/lib/src/helpers/cacheHelper.js +235 -0
  51. package/lib/src/helpers/cacheHelper.js.map +1 -0
  52. package/lib/src/helpers/createSasToken.d.ts +0 -2
  53. package/lib/src/helpers/createSasToken.js +35 -32
  54. package/lib/src/helpers/createSasToken.js.map +1 -1
  55. package/lib/src/helpers/getSecrets.d.ts +1 -1
  56. package/lib/src/helpers/getSecrets.js +10 -12
  57. package/lib/src/helpers/getSecrets.js.map +1 -1
  58. package/lib/src/helpers/limiterPlugin.d.ts +9 -0
  59. package/lib/src/helpers/limiterPlugin.js +72 -0
  60. package/lib/src/helpers/limiterPlugin.js.map +1 -0
  61. package/lib/src/helpers/loggingPlugin.d.ts +30 -0
  62. package/lib/src/helpers/loggingPlugin.js +87 -0
  63. package/lib/src/helpers/loggingPlugin.js.map +1 -0
  64. package/lib/src/helpers/queryAssertionPlugin.d.ts +3 -0
  65. package/lib/src/helpers/queryAssertionPlugin.js +20 -0
  66. package/lib/src/helpers/queryAssertionPlugin.js.map +1 -0
  67. package/lib/src/helpers/safeObjectId.d.ts +1 -1
  68. package/lib/src/helpers/safeObjectId.js +5 -1
  69. package/lib/src/helpers/safeObjectId.js.map +1 -1
  70. package/lib/src/helpers/storageSdkFactory.d.ts +2 -0
  71. package/lib/src/helpers/storageSdkFactory.js +11 -0
  72. package/lib/src/helpers/storageSdkFactory.js.map +1 -0
  73. package/lib/src/helpers/studioAppPlugin.d.ts +3 -0
  74. package/lib/src/helpers/studioAppPlugin.js +16 -0
  75. package/lib/src/helpers/studioAppPlugin.js.map +1 -0
  76. package/lib/src/logger.js +57 -8
  77. package/lib/src/logger.js.map +1 -1
  78. package/lib/src/models/access.model.d.ts +14 -3
  79. package/lib/src/models/access.model.js +7 -9
  80. package/lib/src/models/access.model.js.map +1 -1
  81. package/lib/src/models/customers.model.js +14 -4
  82. package/lib/src/models/customers.model.js.map +1 -1
  83. package/lib/src/models/design.model.d.ts +4 -0
  84. package/lib/src/models/design.model.js +58 -0
  85. package/lib/src/models/design.model.js.map +1 -0
  86. package/lib/src/models/domain.model.js +1 -1
  87. package/lib/src/models/domain.model.js.map +1 -1
  88. package/lib/src/models/editor.model.js +7 -0
  89. package/lib/src/models/editor.model.js.map +1 -1
  90. package/lib/src/models/emailLimit.model.d.ts +4 -0
  91. package/lib/src/models/emailLimit.model.js +31 -0
  92. package/lib/src/models/emailLimit.model.js.map +1 -0
  93. package/lib/src/models/hosting.model.js +1 -3
  94. package/lib/src/models/hosting.model.js.map +1 -1
  95. package/lib/src/models/hostingSettings.model.js +6 -4
  96. package/lib/src/models/hostingSettings.model.js.map +1 -1
  97. package/lib/src/models/invoice.model.d.ts +4 -0
  98. package/lib/src/models/invoice.model.js +235 -0
  99. package/lib/src/models/invoice.model.js.map +1 -0
  100. package/lib/src/models/mailFrom.model.js +51 -10
  101. package/lib/src/models/mailFrom.model.js.map +1 -1
  102. package/lib/src/models/project.model.js +2 -4
  103. package/lib/src/models/project.model.js.map +1 -1
  104. package/lib/src/models/publish-method.model.js +79 -430
  105. package/lib/src/models/publish-method.model.js.map +1 -1
  106. package/lib/src/models/publish.model.js +6 -0
  107. package/lib/src/models/publish.model.js.map +1 -1
  108. package/lib/src/models/storage.model.js +23 -5
  109. package/lib/src/models/storage.model.js.map +1 -1
  110. package/lib/src/models/structure.model.js +40 -0
  111. package/lib/src/models/structure.model.js.map +1 -1
  112. package/lib/src/models/upload.model.js +38 -2
  113. package/lib/src/models/upload.model.js.map +1 -1
  114. package/lib/src/prompts/textGeneration.js +88 -0
  115. package/lib/src/prompts/textGeneration.js.map +1 -1
  116. package/lib/src/prompts/textGenerationMulti.js +78 -44
  117. package/lib/src/prompts/textGenerationMulti.js.map +1 -1
  118. package/lib/src/services/access.service.d.ts +132 -33
  119. package/lib/src/services/access.service.js +270 -92
  120. package/lib/src/services/access.service.js.map +1 -1
  121. package/lib/src/services/ai.service.d.ts +4 -3
  122. package/lib/src/services/ai.service.js +22 -29
  123. package/lib/src/services/ai.service.js.map +1 -1
  124. package/lib/src/services/auth.service.d.ts +11 -0
  125. package/lib/src/services/auth.service.js +70 -0
  126. package/lib/src/services/auth.service.js.map +1 -0
  127. package/lib/src/services/conf.service.d.ts +3 -31
  128. package/lib/src/services/conf.service.js +58 -167
  129. package/lib/src/services/conf.service.js.map +1 -1
  130. package/lib/src/services/customers.service.d.ts +8 -4
  131. package/lib/src/services/customers.service.js +34 -7
  132. package/lib/src/services/customers.service.js.map +1 -1
  133. package/lib/src/services/designs.service.d.ts +7 -0
  134. package/lib/src/services/designs.service.js +10 -0
  135. package/lib/src/services/designs.service.js.map +1 -0
  136. package/lib/src/services/domains.service.d.ts +18 -84
  137. package/lib/src/services/domains.service.js +91 -583
  138. package/lib/src/services/domains.service.js.map +1 -1
  139. package/lib/src/services/editor.service.d.ts +4 -0
  140. package/lib/src/services/editor.service.js +28 -0
  141. package/lib/src/services/editor.service.js.map +1 -1
  142. package/lib/src/services/emailLimit.service.d.ts +21 -0
  143. package/lib/src/services/emailLimit.service.js +51 -0
  144. package/lib/src/services/emailLimit.service.js.map +1 -0
  145. package/lib/src/services/hosting.service.d.ts +12 -24
  146. package/lib/src/services/hosting.service.js +32 -122
  147. package/lib/src/services/hosting.service.js.map +1 -1
  148. package/lib/src/services/hostingAdmin.service.d.ts +1 -1
  149. package/lib/src/services/hostingAdmin.service.js +2 -2
  150. package/lib/src/services/hostingAdmin.service.js.map +1 -1
  151. package/lib/src/services/import.service.d.ts +6 -22
  152. package/lib/src/services/import.service.js +63 -65
  153. package/lib/src/services/import.service.js.map +1 -1
  154. package/lib/src/services/invoices.service.d.ts +30 -0
  155. package/lib/src/services/invoices.service.js +265 -0
  156. package/lib/src/services/invoices.service.js.map +1 -0
  157. package/lib/src/services/jetstream.service.d.ts +5 -3
  158. package/lib/src/services/jetstream.service.js +63 -7
  159. package/lib/src/services/jetstream.service.js.map +1 -1
  160. package/lib/src/services/listParticipants.service.d.ts +3 -5
  161. package/lib/src/services/listParticipants.service.js +76 -16
  162. package/lib/src/services/listParticipants.service.js.map +1 -1
  163. package/lib/src/services/mailFrom.service.d.ts +14 -1
  164. package/lib/src/services/mailFrom.service.js +59 -0
  165. package/lib/src/services/mailFrom.service.js.map +1 -1
  166. package/lib/src/services/me.service.d.ts +23 -12
  167. package/lib/src/services/me.service.js +65 -88
  168. package/lib/src/services/me.service.js.map +1 -1
  169. package/lib/src/services/publish.service.d.ts +6 -8
  170. package/lib/src/services/publish.service.js +34 -32
  171. package/lib/src/services/publish.service.js.map +1 -1
  172. package/lib/src/services/publishData.service.d.ts +10 -7
  173. package/lib/src/services/publishData.service.js +32 -75
  174. package/lib/src/services/publishData.service.js.map +1 -1
  175. package/lib/src/services/spamAnalasys.service.d.ts +4 -4
  176. package/lib/src/services/spamAnalasys.service.js +36 -44
  177. package/lib/src/services/spamAnalasys.service.js.map +1 -1
  178. package/lib/src/services/storage.service.d.ts +68 -39
  179. package/lib/src/services/storage.service.js +378 -209
  180. package/lib/src/services/storage.service.js.map +1 -1
  181. package/lib/src/services/structures.service.d.ts +8 -1
  182. package/lib/src/services/structures.service.js +26 -1
  183. package/lib/src/services/structures.service.js.map +1 -1
  184. package/lib/src/services/upload.service.d.ts +8 -1
  185. package/lib/src/services/upload.service.js +76 -3
  186. package/lib/src/services/upload.service.js.map +1 -1
  187. package/lib/tests/groupStructuresByModel.spec.d.ts +1 -0
  188. package/lib/tests/groupStructuresByModel.spec.js +33 -0
  189. package/lib/tests/groupStructuresByModel.spec.js.map +1 -0
  190. package/lib/tests/listParticipantsServiceJoin.spec.d.ts +1 -0
  191. package/lib/tests/listParticipantsServiceJoin.spec.js +151 -0
  192. package/lib/tests/listParticipantsServiceJoin.spec.js.map +1 -0
  193. package/lib/tests/storageServiceHandleFile.spec.d.ts +1 -0
  194. package/lib/tests/storageServiceHandleFile.spec.js +94 -0
  195. package/lib/tests/storageServiceHandleFile.spec.js.map +1 -0
  196. package/lib/tests/storageServiceToken.spec.d.ts +1 -0
  197. package/lib/tests/storageServiceToken.spec.js +104 -0
  198. package/lib/tests/storageServiceToken.spec.js.map +1 -0
  199. package/lib/tests/uploadServiceCreate.spec.d.ts +1 -0
  200. package/lib/tests/uploadServiceCreate.spec.js +81 -0
  201. package/lib/tests/uploadServiceCreate.spec.js.map +1 -0
  202. package/package.json +30 -26
  203. package/lib/src/AzureBlobStorage.share.d.ts +0 -19
  204. package/lib/src/AzureBlobStorage.share.js +0 -162
  205. package/lib/src/AzureBlobStorage.share.js.map +0 -1
  206. package/lib/src/AzureFileStorage.share.d.ts +0 -22
  207. package/lib/src/AzureFileStorage.share.js +0 -139
  208. package/lib/src/AzureFileStorage.share.js.map +0 -1
  209. package/lib/src/AzureVault.d.ts +0 -14
  210. package/lib/src/AzureVault.js +0 -28
  211. package/lib/src/AzureVault.js.map +0 -1
  212. package/lib/src/dns.challenge.class.d.ts +0 -17
  213. package/lib/src/dns.challenge.class.js +0 -41
  214. package/lib/src/dns.challenge.class.js.map +0 -1
  215. package/lib/src/http.challenge.class.d.ts +0 -33
  216. package/lib/src/http.challenge.class.js +0 -58
  217. package/lib/src/http.challenge.class.js.map +0 -1
  218. package/lib/src/models/certificate-action.model.d.ts +0 -5
  219. package/lib/src/models/certificate-action.model.js +0 -230
  220. package/lib/src/models/certificate-action.model.js.map +0 -1
  221. package/lib/src/models/certificate.model.d.ts +0 -4
  222. package/lib/src/models/certificate.model.js +0 -96
  223. package/lib/src/models/certificate.model.js.map +0 -1
  224. package/lib/src/models/editorBase.model.d.ts +0 -4
  225. package/lib/src/models/editorBase.model.js +0 -39
  226. package/lib/src/models/editorBase.model.js.map +0 -1
  227. package/lib/src/services/certificates.service.js +0 -199
  228. package/lib/src/services/certificates.service.js.map +0 -1
  229. package/lib/src/services/certificatesAction.service.d.ts +0 -0
  230. package/lib/src/services/certificatesAction.service.js +0 -237
  231. package/lib/src/services/certificatesAction.service.js.map +0 -1
  232. package/lib/src/services/editorBase.service.d.ts +0 -46
  233. package/lib/src/services/editorBase.service.js +0 -161
  234. package/lib/src/services/editorBase.service.js.map +0 -1
  235. package/lib/src/services/handleFile.service.d.ts +0 -9
  236. package/lib/src/services/handleFile.service.js +0 -45
  237. package/lib/src/services/handleFile.service.js.map +0 -1
  238. package/lib/src/services/media.service.d.ts +0 -35
  239. package/lib/src/services/media.service.js +0 -418
  240. package/lib/src/services/media.service.js.map +0 -1
  241. package/lib/src/services/share.service.d.ts +0 -6
  242. package/lib/src/services/share.service.js +0 -4
  243. package/lib/src/services/share.service.js.map +0 -1
  244. /package/lib/src/{services/certificates.service.d.ts → helpers/EnvMapper.d.ts} +0 -0
@@ -112,6 +112,46 @@ model.setSchema({
112
112
  type: { enum: ['boolean'] },
113
113
  },
114
114
  }, 'create-boolean');
115
+ // Create file Schema
116
+ model.setSchema({
117
+ type: 'object',
118
+ properties: {
119
+ model: { enum: ['customers', 'listsParticipants'] },
120
+ type: { enum: ['file'] },
121
+ company: { type: 'string' },
122
+ project: { type: 'string' },
123
+ unique: { type: 'boolean' },
124
+ title: { type: 'string', maxLength: 100 },
125
+ description: { type: 'string', maxLength: 500 },
126
+ assetId: { type: 'string', maxLength: 100 },
127
+ maxFileSize: { type: 'number', maximum: 10485760 },
128
+ max: { type: 'number' },
129
+ allowedMimeTypes: {
130
+ type: 'array',
131
+ items: { type: 'string' },
132
+ maxItems: 50,
133
+ }
134
+ },
135
+ required: ['assetId', 'type', 'company', 'title'],
136
+ additionalProperties: false,
137
+ }, 'create-file');
138
+ // Create file Schema
139
+ model.setSchema({
140
+ type: 'object',
141
+ properties: {
142
+ description: { type: 'string', maxLength: 500 },
143
+ assetId: { type: 'string', maxLength: 100 },
144
+ maxFileSize: { type: 'number', maximum: 10485760 },
145
+ max: { type: 'number' },
146
+ allowedMimeTypes: {
147
+ type: 'array',
148
+ items: { type: 'string' },
149
+ maxItems: 50,
150
+ }
151
+ },
152
+ required: ['assetId', 'maxFileSize', 'allowedMimeTypes'],
153
+ additionalProperties: false,
154
+ }, 'change-file', { unsetWithinPartial: true });
115
155
  // Change String Schema
116
156
  model.setSchema({
117
157
  type: 'object',
@@ -1 +1 @@
1
- {"version":3,"file":"structure.model.js","sourceRoot":"","sources":["../../../src/models/structure.model.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,6BAA6B,CAAC;AAElD,MAAM,KAAK,GAAG,IAAI,OAAO,CAAY,WAAW,EAAE,YAAY,CAAC,CAAC;AAEhE,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;AACtB,KAAK,CAAC,WAAW,GAAG,YAAY,CAAC;AACjC,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC;AACnC,KAAK,CAAC,eAAe,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AAE9D,KAAK,CAAC,gBAAgB,GAAG,CAAC,EAAU,EAAE,IAAe,EAAE,EAAE;IAEvD,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;AAEjD,CAAC,CAAC;AAEF,KAAK,CAAC,QAAQ,CACZ;IACE,GAAG,EAAE;QACH,EAAE,EAAE,CAAC;QACL,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,CAAC;KACT;IACD,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,0BAA0B;CACjC,EACD,CAAC,CACF,CAAC;AA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E,KAAK;CAC5B,EACD,gBAAgB,EAChB,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAC7B,CAAC;AAEF,mBAAmB;AACnB,MAAM;AACN,sBAAsB;AACtB,oBAAoB;AACpB,sDAAsD;AACtD,oDAAoD;AACpD,yDAAyD;AACzD,iCAAiC;AACjC,iCAAiC;AACjC,mBAAmB;AACnB,yBAAyB;AACzB,qCAAqC;AACrC,wBAAwB;AACxB,WAAW;AACX,SAAS;AACT,8BAA8B;AAC9B,mCAAmC;AACnC,OAAO;AACP,cAAc;AACd,KAAK;AAEL,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"structure.model.js","sourceRoot":"","sources":["../../../src/models/structure.model.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,6BAA6B,CAAC;AAElD,MAAM,KAAK,GAAG,IAAI,OAAO,CAAY,WAAW,EAAE,YAAY,CAAC,CAAC;AAEhE,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;AACtB,KAAK,CAAC,WAAW,GAAG,YAAY,CAAC;AACjC,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC;AACnC,KAAK,CAAC,eAAe,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AAE9D,KAAK,CAAC,gBAAgB,GAAG,CAAC,EAAU,EAAE,IAAe,EAAE,EAAE;IAEvD,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;AAEjD,CAAC,CAAC;AAEF,KAAK,CAAC,QAAQ,CACZ;IACE,GAAG,EAAE;QACH,EAAE,EAAE,CAAC;QACL,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,CAAC;KACT;IACD,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,0BAA0B;CACjC,EACD,CAAC,CACF,CAAC;AAEF,qCAAqC;AACrC,MAAM,UAAU,GAAG;IACjB,IAAI,E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AAkB,EAAE,IAAI,EAAE,CAC7B,CAAC;AAEF,wBAAwB;AACxB,KAAK,CAAC,SAAS,CACb;IACE,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE;QAC5C,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE;KAChD;IACD,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,oBAAoB,EAAE,KAAK;CAC5B,EACD,gBAAgB,EAChB,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAC7B,CAAC;AAEF,mBAAmB;AACnB,MAAM;AACN,sBAAsB;AACtB,oBAAoB;AACpB,sDAAsD;AACtD,oDAAoD;AACpD,yDAAyD;AACzD,iCAAiC;AACjC,iCAAiC;AACjC,mBAAmB;AACnB,yBAAyB;AACzB,qCAAqC;AACrC,wBAAwB;AACxB,WAAW;AACX,SAAS;AACT,8BAA8B;AAC9B,mCAAmC;AACnC,OAAO;AACP,cAAc;AACd,KAAK;AAEL,eAAe,KAAK,CAAC"}
@@ -27,6 +27,7 @@ model.addIndex({
27
27
  project: 1,
28
28
  list: 1,
29
29
  customer: 1,
30
+ parentId: 1,
30
31
  app: 1,
31
32
  },
32
33
  name: 'customer_list',
@@ -42,7 +43,7 @@ model.addIndex({
42
43
  key: {
43
44
  updated: 1,
44
45
  },
45
- expireAfterSeconds: 1, // 24 hours - adjust as needed
46
+ expireAfterSeconds: 1,
46
47
  partialFilterExpression: {
47
48
  state: 'finished',
48
49
  },
@@ -59,9 +60,10 @@ model.setSchema({
59
60
  list: { type: 'object' },
60
61
  user: { type: 'string' },
61
62
  app: { type: 'string' },
63
+ assetId: { type: 'string' },
62
64
  mimetype: { type: 'string' },
63
65
  bucket: { type: 'string' },
64
- state: { type: 'string', enum: ['uploading', 'processing', 'finished', 'error'] },
66
+ state: { type: 'string', enum: ['uploading', 'waiting', 'processing', 'finished', 'error'] },
65
67
  size: { type: 'number' },
66
68
  chunks: { type: 'number' },
67
69
  paths: { type: 'array' },
@@ -77,5 +79,39 @@ model.setSchema({
77
79
  required: ['filename', 'company', 'size', 'chunks', 'mimetype', 'state', 'updated', 'app'],
78
80
  additionalProperties: false,
79
81
  }, 'create');
82
+ model.setSchema({
83
+ type: 'object',
84
+ properties: {
85
+ filename: { type: 'string' },
86
+ prefix: { type: 'string' },
87
+ company: { type: 'string' },
88
+ project: { type: 'string' },
89
+ customer: { type: 'object' },
90
+ list: { type: 'object' },
91
+ user: { type: 'string' },
92
+ app: { type: 'string' },
93
+ assetId: { type: 'string' },
94
+ mimetype: { type: 'string' },
95
+ bucket: { type: 'string' },
96
+ state: { type: 'string', enum: ['uploading', 'waiting', 'processing', 'finished', 'error'] },
97
+ size: { type: 'number' },
98
+ chunks: { type: 'number' },
99
+ paths: { type: 'array' },
100
+ updated: { type: 'object' },
101
+ options: {
102
+ type: 'object',
103
+ properties: {
104
+ overwrite: { type: 'boolean' },
105
+ thumbnails: { type: 'boolean' },
106
+ contentId: { type: 'string' },
107
+ structureInternalId: { type: 'object' },
108
+ moduleUuid: { type: 'string' },
109
+ },
110
+ required: ['contentId', 'structureId', 'moduleUuid']
111
+ },
112
+ },
113
+ required: ['filename', 'company', 'size', 'chunks', 'mimetype', 'state', 'updated', 'app'],
114
+ additionalProperties: false,
115
+ }, 'create-members');
80
116
  export default model;
81
117
  //# sourceMappingURL=upload.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload.model.js","sourceRoot":"","sources":["../../../src/models/upload.model.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,6BAA6B,CAAC;AAElD,MAAM,KAAK,GAAG,IAAI,OAAO,CAAS,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEvD,KAAK,CAAC,QAAQ,CACZ;IACE,GAAG,EAAE;QACH,QAAQ,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;QAC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S,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC;IAC1F,oBAAoB,EAAE,KAAK;CAC5B,EACD,gBAAgB,CACjB,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-len */
1
2
  export default function textGeneration(input, element, context) {
2
3
  const inputKeyExplanations = {
3
4
  headline: 'headline: main title. will be ## in the context',
@@ -5,6 +6,92 @@ export default function textGeneration(input, element, context) {
5
6
  intro: 'intro: introductory text will be #### in the context',
6
7
  text: 'text: array of paragraphs',
7
8
  };
9
+ return `You are an AI text generation assistant integrated with an enterprise CMS. Your primary goal is to generate text for a single page ("site") of a website using structured JSON input, exact contextual fields, and—most crucially—strict adherence to the provided "instructions." All your outputs and processing must be governed first and foremost by the "instructions" field, with contextual influences applied only as permitted or guided by those instructions.
10
+
11
+ Use the input JSON provided to you, which has the following structure:
12
+
13
+ {
14
+ "input": "${input}"
15
+ "context": {
16
+ "demographic": "Target audience for the page",
17
+ "tone": "Desired tone (e.g., friendly, professional)",
18
+ "project": "Description of the overall project",
19
+ "site": "Information about the current site/page",
20
+ "parent": "Context of the parent page, if any",
21
+ "siblings": "Context from sibling elements/pages",
22
+ "direct": "Direct context for current content/module",
23
+ "environment": "Description of the display environment and usage",
24
+ "content": "Markdown content for the site"
25
+ },
26
+ "instructions": "Any specific instructions for generating or shaping the text"
27
+ }
28
+
29
+ the input is a ${inputKeyExplanations[element]}
30
+
31
+ # Detailed Task
32
+
33
+ - The "instructions" field is the absolute authority for shaping, directing, and constraining all generated content. You must follow it exactly; override context or default approaches if the instructions require it.
34
+ - Use the "context" fields to inform additional writing details, applying the following weighted influences (higher means more important), but only as permitted by the instructions:
35
+ - project: 0.4
36
+ - site: 0.48
37
+ - parent: 0.48
38
+ - siblings: 0.64
39
+ - direct: 0.8
40
+ - environment: 0.8
41
+ - content: 0.32
42
+ - demographic: 0.6
43
+ - tone: 0.6
44
+ - Every key in the "input" object must receive a unique, relevant value (do not duplicate content across fields), and the text should only reflect the context to the extent allowed by the instructions.
45
+ - Your output **must** precisely match the input JSON structure, with no additional keys, extra fields, or markup. Produce only the required JSON.
46
+ - Never ask questions, seek clarification, or provide explanations. Only generate and output content as directed by instructions.
47
+ - No markup (Markdown, HTML, or formatting syntax) is allowed in outputs—plain text only.
48
+ - Persist in internally verifying compliance with the instructions above all else before writing your final JSON response.
49
+
50
+ # Steps
51
+
52
+ 1. Thoroughly read and analyze the "instructions" field; determine any required structure, style, ordering, or output format mandates.
53
+ 2. Reread each context field and apply only those elements which the instructions specify, or where not otherwise constrained, weigh them according to the context weights above.
54
+ 3. For each "input" key (including "intro" and every "text" string), carefully plan and compose content that fully implements the instructions, referencing additional context as allowed.
55
+ 4. Confirm no duplication between any "input" keys. All outputs must be non-redundant and unique.
56
+ 5. Internally review your response for absolute adherence to the instructions, overriding context weightings or defaults if needed.
57
+ 6. Output only the updated JSON with your generated field values.
58
+
59
+ # Output Format
60
+
61
+ Output must be the completed JSON object, strictly matching the input in structure and property names. Do not add, remove, or reorder fields. No extra text, commentary, explanations, or markup of any kind should ever be output. Plain text values only.
62
+
63
+ # Example
64
+
65
+ **Input (for context, this will be sent to you):**
66
+ {
67
+ "input": "${input}"
68
+ "context": {
69
+ "demographic": "University students",
70
+ "tone": "Enthusiastic and clear",
71
+ "project": "An educational resources portal for biology students",
72
+ "site": "Homepage for the biology resources section",
73
+ "parent": "Main portal landing page",
74
+ "siblings": "Mathematics and chemistry resource pages",
75
+ "direct": "Highlighting latest biology tutorials and guides",
76
+ "environment": "Displayed in a mobile-friendly web app",
77
+ "content": "Collection of resources, articles, and video guides"
78
+ },
79
+ "instructions": "Explain the section's purpose in the intro, then provide two distinct welcoming paragraphs that introduce resources and encourage navigation."
80
+ }
81
+
82
+ **Expected Output:**
83
+ {
84
+ "input": "${input}"
85
+ }
86
+ *(Actual outputs should match in length, substance, and adherence to the instructions; always ensure they follow the specific guidance provided.)*
87
+
88
+ # Notes
89
+
90
+ - The "instructions" field must govern and take precedence in all cases. Never ignore, sideline, or deprioritize details within "instructions"; always double-check that outputs meet them fully.
91
+ - All text must be unique, plain text, and adhere precisely to the instructions and output format constraints.
92
+ - Never explain, comment, or output context or process steps—output only the specified JSON fields and values.
93
+
94
+ **Reminder: Strictly follow the "instructions" for content, style, and scope. Output only the structured JSON—no extra text, explanations, or markup.**`;
8
95
  return `you are an text assistant. you are part of a enterprise cms. you are creating text for a single site of a website.
9
96
 
10
97
  i will provide an json in this format:
@@ -53,6 +140,7 @@ the weights for the context are like this:
53
140
  RULE: you use the instructions and the context to produce new text like the instructions say.
54
141
  RULE: the weighted context has to be used to produce the text and
55
142
  RULE: output has to match the input json, no additional keys allowed
143
+ RULE: only output the input json, no context or anything else
56
144
  RULE: dont even ask for something. just produce some ouput
57
145
  RULE: only human readable text, no code, no json, no html, no markdown
58
146
  RULE: dont ever use new lines in the output, just use a single line of text
@@ -1 +1 @@
1
- {"version":3,"file":"textGeneration.js","sourceRoot":"","sources":["../../../src/prompts/textGeneration.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAU,EAAE,OAAe,EAAE,OAAY;IAE9E,MAAM,oBAAoB,GAA2B;QACnD,QAAQ,EAAE,iDAAiD;QAC3D,OAAO,EAAE,mEAAmE;QAC5E,KAAK,EAAE,sDAAsD;QAC7D,IAAI,EAAE,2BAA2B;KAClC,CAAC;IAEF,OAAO;;;;gBAIO,KAAK;;;;;;;;;;;;;;;iBAeJ,oBAAoB,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC7C,CAAC;AAEF,CAAC"}
1
+ {"version":3,"file":"textGeneration.js","sourceRoot":"","sources":["../../../src/prompts/textGeneration.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAU,EAAE,OAAe,EAAE,OAAY;IAE9E,MAAM,oBAAoB,GAA2B;QACnD,QAAQ,EAAE,iDAAiD;QAC3D,OAAO,EAAE,mEAAmE;QAC5E,KAAK,EAAE,sDAAsD;QAC7D,IAAI,EAAE,2BAA2B;KAClC,CAAC;IAEF,OAAO;;;;;cAKK,KAAK;;;;;;;;;;;;;;;iBAeF,oBAAoB,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsChC,KAAK;;;;;;;;;;;;;;;;;cAiBL,KAAK;;;;;;;;;;wJAUqI,CAAA;IAEtJ,OAAO;;;;gBAIO,KAAK;;;;;;;;;;;;;;;iBAeJ,oBAAoB,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC7C,CAAC;AAEF,CAAC"}
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-len */
1
2
  export default function textGenerationMulti(input, context) {
2
3
  const inputKeyExplanations = {
3
4
  headline: 'headline: main title. will be ## in the context',
@@ -9,56 +10,89 @@ export default function textGenerationMulti(input, context) {
9
10
  .filter(key => inputKeyExplanations[key])
10
11
  .map(key => ` ${inputKeyExplanations[key]}`)
11
12
  .join('\n');
12
- return `you are an text assistant. you are part of a enterprise cms. you are creating text for a single site of a website.
13
+ return `You are an AI text generation assistant integrated with an enterprise CMS. Your primary goal is to generate text for a single page ("site") of a website using structured JSON input, exact contextual fields, and—most crucially—strict adherence to the provided "instructions." All your outputs and processing must be governed first and foremost by the "instructions" field, with contextual influences applied only as permitted or guided by those instructions.
14
+
15
+ Use the input JSON provided to you, which has the following structure:
13
16
 
14
- i will provide an json in this format:
15
17
  {
16
- "input": ${JSON.stringify(input, null, 2)},
17
- "context: {
18
- "demographic": "TARGET AUDIENCE",
19
- "tone": "TONE",
20
- "project": PROJECT CONTEXT,
21
- "site": SITE CONTEXT,
22
- "parent": "PARENT CONTEXT",
23
- "siblings": "SIBLINGS CONTEXT",
24
- "direct": "DIRECT CONTEXT AND MODULE EXPLANATION",
25
- "content": SITE CONTENT
26
- }
27
- "instructions": INSTRUCTIONS
18
+ "input": ${JSON.stringify(input, null, 2)},
19
+ "context": {
20
+ "demographic": "Target audience for the page",
21
+ "tone": "Desired tone (e.g., friendly, professional)",
22
+ "project": "Description of the overall project",
23
+ "site": "Information about the current site/page",
24
+ "parent": "Context of the parent page, if any",
25
+ "siblings": "Context from sibling elements/pages",
26
+ "direct": "Direct context for current content/module",
27
+ "environment": "Description of the display environment and usage",
28
+ "content": "Markdown content for the site"
29
+ },
30
+ "instructions": "Any specific instructions for generating or shaping the text"
28
31
  }
29
32
 
30
- ${explanations ? `Explanation of input keys:\n${explanations}\n\n` : ''}Context can have the following values:
31
- demographic is the target audience of the text.
32
- tone is the tone of the text. e.g. friendly, professional, etc.
33
- project is provided by the user to help you understand the whole project.
34
- site is provided by the user to help you understand the current page.
35
- parent if this is filled, it means the current content is a direct child of this.
36
- siblings these are elements at the same level as the current element which have the same parent und purpose
37
- direct gives the content which is at the same level and in direct context e.g. inside the same object
38
- environment describes where and how the content is shown
39
- content is the rest of the content of the current page in markdown format.
33
+ ${explanations ? `Explanation of input keys:\n${explanations}\n\n` : ''}# Detailed Task
34
+
35
+ - The "instructions" field is the absolute authority for shaping, directing, and constraining all generated content. You must follow it exactly; override context or default approaches if the instructions require it.
36
+ - Use the "context" fields to inform additional writing details, applying the following weighted influences (higher means more important), but only as permitted by the instructions:
37
+ - project: 0.4
38
+ - site: 0.48
39
+ - parent: 0.48
40
+ - siblings: 0.64
41
+ - direct: 0.8
42
+ - environment: 0.8
43
+ - content: 0.32
44
+ - demographic: 0.6
45
+ - tone: 0.6
46
+ - Every key in the "input" object must receive a unique, relevant value (do not duplicate content across fields), and the text should only reflect the context to the extent allowed by the instructions.
47
+ - Your output **must** precisely match the input JSON structure, with no additional keys, extra fields, or markup. Produce only the required JSON.
48
+ - Never ask questions, seek clarification, or provide explanations. Only generate and output content as directed by instructions.
49
+ - No markup (Markdown, HTML, or formatting syntax) is allowed in outputs—plain text only.
50
+ - Persist in internally verifying compliance with the instructions above all else before writing your final JSON response.
51
+
52
+ # Steps
53
+
54
+ 1. Thoroughly read and analyze the "instructions" field; determine any required structure, style, ordering, or output format mandates.
55
+ 2. Reread each context field and apply only those elements which the instructions specify, or where not otherwise constrained, weigh them according to the context weights above.
56
+ 3. For each "input" key (including "intro" and every "text" string), carefully plan and compose content that fully implements the instructions, referencing additional context as allowed.
57
+ 4. Confirm no duplication between any "input" keys. All outputs must be non-redundant and unique.
58
+ 5. Internally review your response for absolute adherence to the instructions, overriding context weightings or defaults if needed.
59
+ 6. Output only the updated JSON with your generated field values.
60
+
61
+ # Output Format
62
+
63
+ Output must be the completed JSON object, strictly matching the input in structure and property names. Do not add, remove, or reorder fields. No extra text, commentary, explanations, or markup of any kind should ever be output. Plain text values only.
64
+
65
+ # Example
66
+
67
+ **Input (for context, this will be sent to you):**
68
+ {
69
+ "input": ${JSON.stringify(input, null, 2)},
70
+ "context": {
71
+ "demographic": "University students",
72
+ "tone": "Enthusiastic and clear",
73
+ "project": "An educational resources portal for biology students",
74
+ "site": "Homepage for the biology resources section",
75
+ "parent": "Main portal landing page",
76
+ "siblings": "Mathematics and chemistry resource pages",
77
+ "direct": "Highlighting latest biology tutorials and guides",
78
+ "environment": "Displayed in a mobile-friendly web app",
79
+ "content": "Collection of resources, articles, and video guides"
80
+ },
81
+ "instructions": "Explain the section's purpose in the intro, then provide two distinct welcoming paragraphs that introduce resources and encourage navigation."
82
+ }
83
+
84
+ **Expected Output:**
85
+ {
86
+ "input": ${JSON.stringify(input, null, 2)}
87
+ }
88
+ *(Actual outputs should match in length, substance, and adherence to the instructions; always ensure they follow the specific guidance provided.)*
40
89
 
41
- project, site, direct and content are provided by the user to help you understand the current page.
42
- demographic and tone are provided by the user to help you understand the target audience and tone of the text.
90
+ # Notes
43
91
 
44
- the weights for the context are like this:
45
- project: 0.4
46
- site: 0.48
47
- parent: 0.48
48
- siblings: 0.64
49
- direct: 0.8
50
- content: 0.32
51
- demographic: 0.6
52
- environment: 0.8
53
- tone: 0.6
92
+ - The "instructions" field must govern and take precedence in all cases. Never ignore, sideline, or deprioritize details within "instructions"; always double-check that outputs meet them fully.
93
+ - All text must be unique, plain text, and adhere precisely to the instructions and output format constraints.
94
+ - Never explain, comment, or output context or process steps—output only the specified JSON fields and values.
54
95
 
55
- RULE: you use the instructions and the context to produce new text like the instructions say.
56
- RULE: every key in the input json has to be affected
57
- RULE: each key has to have unique text, no duplicates
58
- RULE: the weighted context has to be used to produce the text and
59
- RULE: output has to match the input json, no additional keys allowed
60
- RULE: dont even ask for something. just produce some ouput
61
- RULE: only text outputs, no markup of any kind
62
- `;
96
+ **Reminder: Strictly follow the "instructions" for content, style, and scope. Output only the structured JSON—no extra text, explanations, or markup.**`;
63
97
  }
64
98
  //# sourceMappingURL=textGenerationMulti.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"textGenerationMulti.js","sourceRoot":"","sources":["../../../src/prompts/textGenerationMulti.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAU,EAAE,OAAY;IAElE,MAAM,oBAAoB,GAA2B;QACnD,QAAQ,EAAE,iDAAiD;QAC3D,OAAO,EAAE,mEAAmE;QAC5E,KAAK,EAAE,sDAAsD;QAC7D,IAAI,EAAE,2BAA2B;KAClC,CAAC;IAEF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;SACpC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC;SACxC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC;SAC9C,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;;;;eAIM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;;;;;;;;;;;;;;EAc3C,YAAY,CAAC,CAAC,CAAC,+BAA+B,YAAY,MAAM,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCtE,CAAC;AAEF,CAAC"}
1
+ {"version":3,"file":"textGenerationMulti.js","sourceRoot":"","sources":["../../../src/prompts/textGenerationMulti.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAU,EAAE,OAAY;IAElE,MAAM,oBAAoB,GAA2B;QACnD,QAAQ,EAAE,iDAAiD;QAC3D,OAAO,EAAE,mEAAmE;QAC5E,KAAK,EAAE,sDAAsD;QAC7D,IAAI,EAAE,2BAA2B;KAClC,CAAC;IAEF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;SACpC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC;SACxC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC;SAC9C,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;;;;;aAKI,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;EAezC,YAAY,CAAC,CAAC,CAAC,+BAA+B,YAAY,MAAM,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAoC1D,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;aAiB9B,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;;;;;;;;;;wJAU6G,CAAC;AAEzJ,CAAC"}
@@ -1,37 +1,136 @@
1
- import Timeseries from '../Timeseries.class.js';
2
- import { NextFunction, Request, Response } from 'express';
3
- import { Access } from '@lilaquadrat/interfaces';
4
- type AccessSettings = {
5
- callLimits: {
6
- second: number;
1
+ /**
2
+ * AccessService distributed rate limiter (Mongo-only, multi-pod safe).
3
+ *
4
+ * ============================================================================
5
+ * OVERVIEW
6
+ * ============================================================================
7
+ * Counts requests per key (IP or user id) over fixed time buckets and reports
8
+ * when a limit is exceeded. Designed to be shared across multiple Fastify APIs
9
+ * pointing at the same MongoDB. No Redis required.
10
+ *
11
+ * Storage = a single Mongo collection (`accessLimits`) of counter documents,
12
+ * one per unique key. Each document holds the current minute bucket count and
13
+ * current hour bucket count. A TTL index reaps stale docs automatically.
14
+ *
15
+ * Two buckets only by design: minute (short burst) and hour (sustained load).
16
+ * Second/quarter buckets dropped — sec is noisy under network jitter, quarter
17
+ * is redundant with minute+hour.
18
+ *
19
+ * ============================================================================
20
+ * PERFORMANCE STRATEGY ("Tier 1")
21
+ * ============================================================================
22
+ * Three layered optimizations to minimize Mongo writes while keeping the
23
+ * limit decision correct:
24
+ *
25
+ * 1. Single atomic upsert per DB hit
26
+ * Pipeline update with `$cond` either increments the existing bucket
27
+ * count or resets it (when the window rolled over). Both minute and
28
+ * hour intervals updated in one round-trip, no read-then-write race.
29
+ *
30
+ * 2. Per-pod LRU cache (in-process Map)
31
+ * Caches the last known counts for ~10k hottest keys. If a request
32
+ * arrives for a cached key that is well under its limit and the cache
33
+ * entry is fresh, the DB is skipped entirely. The local counter is
34
+ * bumped instead. Trade-off described below.
35
+ *
36
+ * 3. Threshold-based flush
37
+ * Cache is trusted only while projected count < 70% of limit. Above
38
+ * that, every request forces a DB sync so the real count is known
39
+ * before a 429 is issued.
40
+ *
41
+ * Result: under normal traffic, most requests do zero Mongo work. Under
42
+ * abuse, every request near/over the limit syncs to Mongo and gets
43
+ * blocked accurately.
44
+ *
45
+ * ============================================================================
46
+ * CACHE TRADE-OFF (read this if Mongo counts look low)
47
+ * ============================================================================
48
+ * Mongo count = lagging snapshot. Real count = `mongoCount + sum(per-pod
49
+ * cache deltas)`. A burst of 10 requests in < 2s may only produce ~1–2
50
+ * Mongo writes; the rest are absorbed by the cache and never sync.
51
+ *
52
+ * This is correct behavior — the limit is still enforced because the cache
53
+ * holds the projected count locally and returns `LimiterBreach` from RAM.
54
+ *
55
+ * If exact Mongo numbers are required (debugging, audit), set
56
+ * CACHE_SOFT_SYNC_MS = 0 and CACHE_SAFE_RATIO = 0 (every request hits DB).
57
+ * Multi-pod note: each pod has its own cache. Across N pods, true count can
58
+ * exceed limit by up to N × (CACHE_SAFE_RATIO × limit) before any pod
59
+ * sees a breach. For strict global enforcement on tiny limits, tighten
60
+ * CACHE_SAFE_RATIO or set to 0.
61
+ *
62
+ * ============================================================================
63
+ * DOCUMENT SHAPE (in `accessLimits` collection)
64
+ * ============================================================================
65
+ * {
66
+ * _id: "studio:ip:1.2.3.4", // or "studio:user:<sub>"
67
+ * minute: { bucket: 29347521, count: 12 },
68
+ * hour: { bucket: 489125, count: 230 },
69
+ * expiresAt: ISODate("...") // TTL target, ~2h ahead
70
+ * }
71
+ *
72
+ * Bucket values = Math.floor(now_ms / windowMs). Same value across all pods
73
+ * means same window. expiresAt set 2 hours past current hour start so the
74
+ * doc survives just long enough to be relevant.
75
+ *
76
+ * ============================================================================
77
+ * USAGE
78
+ * ============================================================================
79
+ * const breach = await AccessService.hit(key, { minute: 60, hour: 1000 });
80
+ * if (breach) return reply.code(429).send({ retryAfter: breach.retryAfter });
81
+ *
82
+ * Normally wired via `limiterPlugin` (Fastify) which composes the key from
83
+ * namespace + IP/user and resolves the tier from URL prefix. See
84
+ * `src/helpers/limiterPlugin.ts`.
85
+ */
86
+ import { type LimiterTier, type LimiterBreach } from '@lilaquadrat/interfaces';
87
+ export default class AccessService {
88
+ /**
89
+ * Atomic upsert of minute + hour buckets for a single key.
90
+ *
91
+ * Uses Mongo 4.2+ pipeline update with `$cond`:
92
+ * if stored bucket === current bucket → increment count
93
+ * else → reset count to 1
94
+ *
95
+ * Both intervals handled in one document, one round-trip. `upsert: true`
96
+ * creates the doc on first ever hit. `returnDocument: 'after'` gives the
97
+ * post-increment values so we can compare against the limit immediately.
98
+ *
99
+ * @param key Composed key (`{namespace}:ip:...` or `:user:...`).
100
+ * @param minuteBucket floor(Date.now() / MINUTE_MS) — same on all pods.
101
+ * @param hourBucket floor(Date.now() / HOUR_MS).
102
+ * @returns Post-increment counts for minute and hour.
103
+ */
104
+ static incr(key: string, minuteBucket: number, hourBucket: number): Promise<{
7
105
  minute: number;
8
- quarter: number;
9
106
  hour: number;
10
- };
11
- };
12
- export default class AccessService extends Timeseries<Access> {
13
- model: import("../classes/TimeseriesModel.class.js").default<Access>;
14
- settings: AccessSettings;
15
- constructor(settings: AccessSettings);
16
- count(after: Date): Promise<number>;
17
- lastHour(ipOrUser: string, options?: {
18
- user: boolean;
19
- }): Promise<AccessSettings['callLimits'] | undefined>;
107
+ }>;
108
+ /**
109
+ * Main entry point. Records a request and reports whether it exceeded any
110
+ * configured limit.
111
+ *
112
+ * Decision path:
113
+ * 1. If neither minute nor hour limit set → no-op.
114
+ * 2. Look up cache. If a fresh entry exists, the request keeps the same
115
+ * bucket, AND the projected count stays under CACHE_SAFE_RATIO of the
116
+ * configured limit bump locally, skip Mongo, return allowed.
117
+ * 3. Otherwise → atomic Mongo upsert, refresh cache from the result.
118
+ * 4. Compare post-increment counts to tier limits. If exceeded, return
119
+ * a LimiterBreach with the offending interval, observed count, and
120
+ * a Retry-After value computed from the time remaining in the window.
121
+ *
122
+ * Important: a breach is only returned when count *exceeds* the limit
123
+ * (`>`), not when it equals it. A limit of 60/minute permits exactly 60
124
+ * requests; the 61st returns the breach.
125
+ *
126
+ * @param key Pre-composed cache+DB key. Caller controls namespacing.
127
+ * @param tier Configured per-interval limits. Missing field = no limit.
128
+ * @returns undefined if allowed, LimiterBreach if denied.
129
+ */
130
+ static hit(key: string, tier: LimiterTier): Promise<LimiterBreach | undefined>;
20
131
  /**
21
- applies the provided settings that limit the requests per second, minute, 15 minutes and hour.
22
- responds with code 429 if the limits are exceeded
23
- ```TS
24
- callLimits: {
25
- second: number,
26
- minute: number,
27
- quarter: number
28
- hour: number
29
- }
30
- ```
31
- */
32
- applyLimits(req: Request, res: Response, next: NextFunction, options?: {
33
- user: boolean;
34
- }): Promise<boolean>;
35
- sendResponse(limit: string, interval: string, res: Response): void;
132
+ * Drops the entire in-process cache. Intended for tests and ops tooling
133
+ * (e.g. after manually editing accessLimits docs). Does not touch Mongo.
134
+ */
135
+ static clearCache(): void;
36
136
  }
37
- export {};