@venizia/ignis 0.4.8-8 → 0.4.8

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 (225) hide show
  1. package/README.md +1 -0
  2. package/dist/esm/base/applications/base.js.map +1 -1
  3. package/dist/esm/components/api-reference/common/types.d.ts +6 -3
  4. package/dist/esm/components/api-reference/common/types.js.map +1 -1
  5. package/dist/esm/components/api-reference/component.js +8 -3
  6. package/dist/esm/components/api-reference/component.js.map +1 -1
  7. package/dist/esm/components/auth/authenticate/component.js +3 -2
  8. package/dist/esm/components/auth/authenticate/component.js.map +1 -1
  9. package/dist/esm/components/auth/authenticate/controllers/factory.d.ts +3 -3
  10. package/dist/esm/components/auth/authenticate/controllers/factory.js +1 -1
  11. package/dist/esm/components/auth/authenticate/controllers/factory.js.map +1 -1
  12. package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.d.ts +5 -3
  13. package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.js +18 -1
  14. package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.js.map +1 -1
  15. package/dist/esm/components/auth/authorize/adapters/common/types.d.ts +1 -2
  16. package/dist/esm/components/auth/authorize/adapters/common/types.js.map +1 -1
  17. package/dist/esm/components/index.d.ts +1 -0
  18. package/dist/esm/components/index.js +1 -0
  19. package/dist/esm/components/index.js.map +1 -1
  20. package/dist/esm/components/mail/common/constants.d.ts +24 -14
  21. package/dist/esm/components/mail/common/constants.js +19 -32
  22. package/dist/esm/components/mail/common/constants.js.map +1 -1
  23. package/dist/esm/components/mail/common/errors.d.ts +10 -1
  24. package/dist/esm/components/mail/common/errors.js +7 -1
  25. package/dist/esm/components/mail/common/errors.js.map +1 -1
  26. package/dist/esm/components/mail/common/types/message.d.ts +4 -4
  27. package/dist/esm/components/mail/common/types/message.js.map +1 -1
  28. package/dist/esm/components/mail/common/types/options.d.ts +54 -10
  29. package/dist/esm/components/mail/common/types/options.js.map +1 -1
  30. package/dist/esm/components/mail/common/types/queue.d.ts +23 -12
  31. package/dist/esm/components/mail/common/types/queue.js.map +1 -1
  32. package/dist/esm/components/mail/common/types/template.d.ts +5 -4
  33. package/dist/esm/components/mail/common/types/template.js.map +1 -1
  34. package/dist/esm/components/mail/common/types/verification.d.ts +1 -0
  35. package/dist/esm/components/mail/common/types/verification.js.map +1 -1
  36. package/dist/esm/components/mail/component.js +11 -2
  37. package/dist/esm/components/mail/component.js.map +1 -1
  38. package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.d.ts +1 -1
  39. package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js +15 -28
  40. package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js.map +1 -1
  41. package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.d.ts +2 -0
  42. package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js +17 -10
  43. package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js.map +1 -1
  44. package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js +11 -6
  45. package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js.map +1 -1
  46. package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.d.ts +2 -3
  47. package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js +15 -6
  48. package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js.map +1 -1
  49. package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.d.ts +2 -3
  50. package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js +2 -2
  51. package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js.map +1 -1
  52. package/dist/esm/components/mail/providers/mail-queue-executor.provider.d.ts +2 -2
  53. package/dist/esm/components/mail/providers/mail-queue-executor.provider.js +7 -9
  54. package/dist/esm/components/mail/providers/mail-queue-executor.provider.js.map +1 -1
  55. package/dist/esm/components/mail/providers/mail-transporter.provider.js +7 -7
  56. package/dist/esm/components/mail/providers/mail-transporter.provider.js.map +1 -1
  57. package/dist/esm/components/mail/services/generators/numeric-code.d.ts +1 -6
  58. package/dist/esm/components/mail/services/generators/numeric-code.js +3 -31
  59. package/dist/esm/components/mail/services/generators/numeric-code.js.map +1 -1
  60. package/dist/esm/components/mail/services/generators/random-token.d.ts +4 -1
  61. package/dist/esm/components/mail/services/generators/random-token.js +9 -6
  62. package/dist/esm/components/mail/services/generators/random-token.js.map +1 -1
  63. package/dist/esm/components/mail/services/mail.service.d.ts +1 -2
  64. package/dist/esm/components/mail/services/mail.service.js +21 -19
  65. package/dist/esm/components/mail/services/mail.service.js.map +1 -1
  66. package/dist/esm/components/mail/services/template.service.d.ts +7 -5
  67. package/dist/esm/components/mail/services/template.service.js +24 -16
  68. package/dist/esm/components/mail/services/template.service.js.map +1 -1
  69. package/dist/esm/components/mail/utilities/attachment.utility.js +8 -6
  70. package/dist/esm/components/mail/utilities/attachment.utility.js.map +1 -1
  71. package/dist/esm/components/mail/utilities/header.utility.d.ts +14 -0
  72. package/dist/esm/components/mail/utilities/header.utility.js +44 -0
  73. package/dist/esm/components/mail/utilities/header.utility.js.map +1 -0
  74. package/dist/esm/components/mail/utilities/index.d.ts +1 -0
  75. package/dist/esm/components/mail/utilities/index.js +1 -0
  76. package/dist/esm/components/mail/utilities/index.js.map +1 -1
  77. package/dist/esm/components/mail/utilities/mime.utility.d.ts +5 -1
  78. package/dist/esm/components/mail/utilities/mime.utility.js +12 -58
  79. package/dist/esm/components/mail/utilities/mime.utility.js.map +1 -1
  80. package/dist/esm/components/mail/utilities/type.utility.d.ts +2 -3
  81. package/dist/esm/components/mail/utilities/type.utility.js +6 -7
  82. package/dist/esm/components/mail/utilities/type.utility.js.map +1 -1
  83. package/dist/esm/components/server-info/common/constants.d.ts +6 -0
  84. package/dist/esm/components/server-info/common/constants.js +6 -0
  85. package/dist/esm/components/server-info/common/constants.js.map +1 -0
  86. package/dist/esm/components/server-info/common/index.d.ts +5 -0
  87. package/dist/esm/components/server-info/common/index.js +5 -0
  88. package/dist/esm/components/server-info/common/index.js.map +1 -0
  89. package/dist/esm/components/server-info/common/keys.d.ts +5 -0
  90. package/dist/esm/components/server-info/common/keys.js +5 -0
  91. package/dist/esm/components/server-info/common/keys.js.map +1 -0
  92. package/dist/esm/components/server-info/common/rest-paths.d.ts +5 -0
  93. package/dist/esm/components/server-info/common/rest-paths.js +5 -0
  94. package/dist/esm/components/server-info/common/rest-paths.js.map +1 -0
  95. package/dist/esm/components/server-info/common/types.d.ts +68 -0
  96. package/dist/esm/components/server-info/common/types.js +2 -0
  97. package/dist/esm/components/server-info/common/types.js.map +1 -0
  98. package/dist/esm/components/server-info/component.d.ts +31 -0
  99. package/dist/esm/components/server-info/component.js +87 -0
  100. package/dist/esm/components/server-info/component.js.map +1 -0
  101. package/dist/esm/components/server-info/controller.d.ts +14 -0
  102. package/dist/esm/components/server-info/controller.js +68 -0
  103. package/dist/esm/components/server-info/controller.js.map +1 -0
  104. package/dist/esm/components/server-info/index.d.ts +5 -0
  105. package/dist/esm/components/server-info/index.js +5 -0
  106. package/dist/esm/components/server-info/index.js.map +1 -0
  107. package/dist/esm/components/server-info/reporter.d.ts +25 -0
  108. package/dist/esm/components/server-info/reporter.js +68 -0
  109. package/dist/esm/components/server-info/reporter.js.map +1 -0
  110. package/dist/esm/components/socket-io/handlers/bun.handler.d.ts +13 -3
  111. package/dist/esm/components/socket-io/handlers/bun.handler.js.map +1 -1
  112. package/dist/esm/components/static-asset/common/constants.d.ts +51 -24
  113. package/dist/esm/components/static-asset/common/constants.js +75 -47
  114. package/dist/esm/components/static-asset/common/constants.js.map +1 -1
  115. package/dist/esm/components/static-asset/common/errors.d.ts +30 -35
  116. package/dist/esm/components/static-asset/common/errors.js +31 -33
  117. package/dist/esm/components/static-asset/common/errors.js.map +1 -1
  118. package/dist/esm/components/static-asset/common/index.d.ts +1 -1
  119. package/dist/esm/components/static-asset/common/index.js +1 -1
  120. package/dist/esm/components/static-asset/common/index.js.map +1 -1
  121. package/dist/esm/components/static-asset/common/keys.d.ts +10 -2
  122. package/dist/esm/components/static-asset/common/keys.js +10 -2
  123. package/dist/esm/components/static-asset/common/keys.js.map +1 -1
  124. package/dist/esm/components/static-asset/common/types.d.ts +267 -147
  125. package/dist/esm/components/static-asset/common/types.js.map +1 -1
  126. package/dist/esm/components/static-asset/common/validation.d.ts +10 -0
  127. package/dist/esm/components/static-asset/common/validation.js +8 -0
  128. package/dist/esm/components/static-asset/common/validation.js.map +1 -0
  129. package/dist/esm/components/static-asset/component.d.ts +4 -2
  130. package/dist/esm/components/static-asset/component.js +26 -31
  131. package/dist/esm/components/static-asset/component.js.map +1 -1
  132. package/dist/esm/components/static-asset/controller/factory.d.ts +37 -79
  133. package/dist/esm/components/static-asset/controller/factory.js +26 -917
  134. package/dist/esm/components/static-asset/controller/factory.js.map +1 -1
  135. package/dist/esm/components/static-asset/controller/index.d.ts +1 -0
  136. package/dist/esm/components/static-asset/controller/index.js +1 -0
  137. package/dist/esm/components/static-asset/controller/index.js.map +1 -1
  138. package/dist/esm/components/static-asset/controller/routes/context.d.ts +62 -0
  139. package/dist/esm/components/static-asset/controller/routes/context.js +45 -0
  140. package/dist/esm/components/static-asset/controller/routes/context.js.map +1 -0
  141. package/dist/esm/components/static-asset/controller/routes/definition.d.ts +40 -0
  142. package/dist/esm/components/static-asset/controller/routes/definition.js +83 -0
  143. package/dist/esm/components/static-asset/controller/routes/definition.js.map +1 -0
  144. package/dist/esm/components/static-asset/controller/routes/direct-upload.d.ts +3 -0
  145. package/dist/esm/components/static-asset/controller/routes/direct-upload.js +153 -0
  146. package/dist/esm/components/static-asset/controller/routes/direct-upload.js.map +1 -0
  147. package/dist/esm/components/static-asset/controller/routes/labels.d.ts +16 -0
  148. package/dist/esm/components/static-asset/controller/routes/labels.js +19 -0
  149. package/dist/esm/components/static-asset/controller/routes/labels.js.map +1 -0
  150. package/dist/esm/components/static-asset/controller/routes/objects.d.ts +7 -0
  151. package/dist/esm/components/static-asset/controller/routes/objects.js +193 -0
  152. package/dist/esm/components/static-asset/controller/routes/objects.js.map +1 -0
  153. package/dist/esm/components/static-asset/controller/routes/serve.d.ts +29 -0
  154. package/dist/esm/components/static-asset/controller/routes/serve.js +152 -0
  155. package/dist/esm/components/static-asset/controller/routes/serve.js.map +1 -0
  156. package/dist/esm/components/static-asset/controller/routes/table.d.ts +12 -0
  157. package/dist/esm/components/static-asset/controller/routes/table.js +52 -0
  158. package/dist/esm/components/static-asset/controller/routes/table.js.map +1 -0
  159. package/dist/esm/components/static-asset/controller/routes/upload.d.ts +10 -0
  160. package/dist/esm/components/static-asset/controller/routes/upload.js +175 -0
  161. package/dist/esm/components/static-asset/controller/routes/upload.js.map +1 -0
  162. package/dist/esm/components/static-asset/index.d.ts +2 -1
  163. package/dist/esm/components/static-asset/index.js +2 -1
  164. package/dist/esm/components/static-asset/index.js.map +1 -1
  165. package/dist/esm/components/static-asset/models/base.model.d.ts +4 -4
  166. package/dist/esm/components/static-asset/models/base.model.js.map +1 -1
  167. package/dist/esm/components/static-asset/services/commitment.service.d.ts +103 -0
  168. package/dist/esm/components/static-asset/services/commitment.service.js +252 -0
  169. package/dist/esm/components/static-asset/services/commitment.service.js.map +1 -0
  170. package/dist/esm/components/static-asset/services/index.d.ts +3 -0
  171. package/dist/esm/components/static-asset/services/index.js +3 -0
  172. package/dist/esm/components/static-asset/services/index.js.map +1 -0
  173. package/dist/esm/components/static-asset/services/policy.service.d.ts +45 -0
  174. package/dist/esm/components/static-asset/services/policy.service.js +104 -0
  175. package/dist/esm/components/static-asset/services/policy.service.js.map +1 -0
  176. package/dist/esm/components/static-asset/utilities/commit-token.utility.d.ts +28 -0
  177. package/dist/esm/components/static-asset/utilities/commit-token.utility.js +112 -0
  178. package/dist/esm/components/static-asset/utilities/commit-token.utility.js.map +1 -0
  179. package/dist/esm/components/static-asset/utilities/entry.utility.d.ts +69 -0
  180. package/dist/esm/components/static-asset/utilities/entry.utility.js +160 -0
  181. package/dist/esm/components/static-asset/utilities/entry.utility.js.map +1 -0
  182. package/dist/esm/components/static-asset/utilities/index.d.ts +6 -0
  183. package/dist/esm/components/static-asset/utilities/index.js +6 -0
  184. package/dist/esm/components/static-asset/utilities/index.js.map +1 -0
  185. package/dist/esm/components/static-asset/{ingest.d.ts → utilities/ingest.utility.d.ts} +5 -5
  186. package/dist/esm/components/static-asset/{ingest.js → utilities/ingest.utility.js} +12 -10
  187. package/dist/esm/components/static-asset/utilities/ingest.utility.js.map +1 -0
  188. package/dist/esm/components/static-asset/{controller/key-scope.d.ts → utilities/key-scope.utility.d.ts} +21 -2
  189. package/dist/esm/components/static-asset/utilities/key-scope.utility.js +74 -0
  190. package/dist/esm/components/static-asset/utilities/key-scope.utility.js.map +1 -0
  191. package/dist/esm/components/static-asset/{controller/meta-link.d.ts → utilities/meta-link.utility.d.ts} +9 -9
  192. package/dist/esm/components/static-asset/{controller/meta-link.js → utilities/meta-link.utility.js} +10 -10
  193. package/dist/esm/components/static-asset/utilities/meta-link.utility.js.map +1 -0
  194. package/dist/esm/components/static-asset/utilities/object-link.utility.d.ts +16 -0
  195. package/dist/esm/components/static-asset/utilities/object-link.utility.js +20 -0
  196. package/dist/esm/components/static-asset/utilities/object-link.utility.js.map +1 -0
  197. package/dist/esm/components/static-asset/utilities/pinned-file.utility.d.ts +39 -0
  198. package/dist/esm/components/static-asset/utilities/pinned-file.utility.js +53 -0
  199. package/dist/esm/components/static-asset/utilities/pinned-file.utility.js.map +1 -0
  200. package/dist/esm/components/static-asset/utilities/route-options.utility.d.ts +43 -0
  201. package/dist/esm/components/static-asset/utilities/route-options.utility.js +71 -0
  202. package/dist/esm/components/static-asset/utilities/route-options.utility.js.map +1 -0
  203. package/dist/esm/components/static-asset/utilities/toggle.utility.d.ts +5 -0
  204. package/dist/esm/components/static-asset/utilities/toggle.utility.js +5 -0
  205. package/dist/esm/components/static-asset/utilities/toggle.utility.js.map +1 -0
  206. package/dist/esm/testing/assert-application-boots.d.ts +2 -2
  207. package/dist/esm/testing/assert-application-boots.js +6 -2
  208. package/dist/esm/testing/assert-application-boots.js.map +1 -1
  209. package/dist/presets/app/preset.json +4 -4
  210. package/dist/presets/lib/preset.json +3 -3
  211. package/dist/presets/shared/preset.json +1 -1
  212. package/package.json +8 -8
  213. package/dist/esm/components/static-asset/common/commit-token.d.ts +0 -28
  214. package/dist/esm/components/static-asset/common/commit-token.js +0 -48
  215. package/dist/esm/components/static-asset/common/commit-token.js.map +0 -1
  216. package/dist/esm/components/static-asset/controller/base.definition.d.ts +0 -30
  217. package/dist/esm/components/static-asset/controller/base.definition.js +0 -307
  218. package/dist/esm/components/static-asset/controller/base.definition.js.map +0 -1
  219. package/dist/esm/components/static-asset/controller/key-scope.js +0 -41
  220. package/dist/esm/components/static-asset/controller/key-scope.js.map +0 -1
  221. package/dist/esm/components/static-asset/controller/meta-link.js.map +0 -1
  222. package/dist/esm/components/static-asset/controller/route-options.d.ts +0 -29
  223. package/dist/esm/components/static-asset/controller/route-options.js +0 -47
  224. package/dist/esm/components/static-asset/controller/route-options.js.map +0 -1
  225. package/dist/esm/components/static-asset/ingest.js.map +0 -1
@@ -1,55 +1,83 @@
1
1
  import { HTTP } from '@venizia/ignis-helpers/common';
2
- /** `content-type` is absent on purpose: it is decided from the object name, never from the backend. */
3
- export const WHITELIST_HEADERS = [
4
- HTTP.Headers.CONTENT_ENCODING,
5
- HTTP.Headers.CACHE_CONTROL,
6
- HTTP.Headers.ETAG,
7
- HTTP.Headers.LAST_MODIFIED,
8
- ];
9
- /**
10
- * Types the controller will let a browser render, keyed off the object name. Anything absent here is
11
- * served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`
12
- * cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.
13
- */
14
- export const RENDERABLE_CONTENT_TYPES = new Set([
15
- 'image/png',
16
- 'image/jpeg',
17
- 'image/gif',
18
- 'image/webp',
19
- 'image/avif',
20
- 'image/bmp',
21
- 'image/x-icon',
22
- 'video/mp4',
23
- 'video/webm',
24
- 'audio/mpeg',
25
- 'audio/wav',
26
- 'audio/ogg',
27
- 'application/pdf',
28
- 'text/plain',
29
- 'text/csv',
30
- ]);
31
- /** Storage backends a static asset controller can serve from. `isValid` checks a string against them. */
32
- export class StaticAssetStorageTypes {
33
- static { this.DISK = 'disk'; }
34
- static { this.BUN_S3 = 'bun-s3'; }
35
- static { this.SCHEME_SET = new Set([this.DISK, this.BUN_S3]); }
36
- static isValid(orgType) {
37
- return this.SCHEME_SET.has(orgType);
38
- }
2
+ /** What a controller sends with every object. */
3
+ export class StaticAssetHeaders {
4
+ static { this.NOSNIFF = 'nosniff'; }
5
+ static { this.CSP_SANDBOX = 'sandbox'; }
6
+ static { this.RANGE_UNIT = HTTP.HeaderValues.RANGE_UNIT_BYTES; }
7
+ }
8
+ /** Content types the controller serves. */
9
+ export class StaticAssetContentTypes {
10
+ /**
11
+ * Types the controller will let a browser render, keyed off the object name. Anything absent here is
12
+ * served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`
13
+ * cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.
14
+ */
15
+ static { this.RENDERABLE = new Set([
16
+ HTTP.HeaderValues.IMAGE_PNG,
17
+ HTTP.HeaderValues.IMAGE_JPEG,
18
+ HTTP.HeaderValues.IMAGE_GIF,
19
+ HTTP.HeaderValues.IMAGE_WEBP,
20
+ 'image/avif',
21
+ 'image/bmp',
22
+ 'image/x-icon',
23
+ 'video/mp4',
24
+ 'video/webm',
25
+ 'audio/mpeg',
26
+ 'audio/wav',
27
+ 'audio/ogg',
28
+ HTTP.HeaderValues.APPLICATION_PDF,
29
+ HTTP.HeaderValues.TEXT_PLAIN,
30
+ HTTP.HeaderValues.TEXT_CSV,
31
+ ]); }
32
+ }
33
+ /** The built-in routes of a generated controller, the keys of `routes`. */
34
+ export class StaticAssetRouteKeys {
35
+ static { this.UPLOAD = 'upload'; }
36
+ static { this.LIST_OBJECTS = 'listObjects'; }
37
+ static { this.DELETE_OBJECT = 'deleteObject'; }
38
+ static { this.GET_OBJECT_BY_NAME = 'getObjectByName'; }
39
+ static { this.DOWNLOAD_OBJECT_BY_NAME = 'downloadObjectByName'; }
40
+ static { this.UPLOAD_POLICY = 'uploadPolicy'; }
41
+ static { this.UPLOAD_COMMIT = 'uploadCommit'; }
42
+ static { this.UPLOAD_VALIDATE = 'uploadValidate'; }
43
+ static { this.RECREATE_META_LINK = 'recreateMetaLink'; }
44
+ /** Every key, in registration order. */
45
+ static { this.ALL = [
46
+ StaticAssetRouteKeys.GET_OBJECT_BY_NAME,
47
+ StaticAssetRouteKeys.DOWNLOAD_OBJECT_BY_NAME,
48
+ StaticAssetRouteKeys.UPLOAD,
49
+ StaticAssetRouteKeys.DELETE_OBJECT,
50
+ StaticAssetRouteKeys.LIST_OBJECTS,
51
+ StaticAssetRouteKeys.UPLOAD_POLICY,
52
+ StaticAssetRouteKeys.UPLOAD_COMMIT,
53
+ StaticAssetRouteKeys.UPLOAD_VALIDATE,
54
+ StaticAssetRouteKeys.RECREATE_META_LINK,
55
+ ]; }
39
56
  }
40
57
  /** What `recreate-metalink` did: refreshed the rows of an object, or created its first one. */
41
58
  export class MetaLinkRecreateActions {
42
59
  static { this.CREATED = 'created'; }
43
60
  static { this.REFRESHED = 'refreshed'; }
44
- static { this.SCHEME_SET = new Set([this.CREATED, this.REFRESHED]); }
45
- static isValid(value) {
46
- return this.SCHEME_SET.has(value);
47
- }
48
61
  }
49
- /** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */
50
- export const DEFAULT_PENDING_PREFIX = 'pending/';
51
- /** The most file parts one upload request may carry unless `parseMultipartBody.maxFiles` says otherwise. */
52
- export const DEFAULT_MAX_UPLOAD_FILES = 20;
53
- /** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */
54
- export const META_LINK_CREATE_FAILED = 'META_LINK_CREATE_FAILED';
62
+ /** Where a commit token is in its life: issued with the policy, then validated against the content it pins. */
63
+ export class StaticAssetTokenStages {
64
+ static { this.ISSUED = 'issued'; }
65
+ static { this.VALIDATED = 'validated'; }
66
+ }
67
+ /** Defaults of the static asset component. */
68
+ export class StaticAssetDefaults {
69
+ /** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */
70
+ static { this.PENDING_PREFIX = 'pending/'; }
71
+ /** The most file parts one upload request may carry unless `serverUpload.maxFiles` says otherwise. */
72
+ static { this.MAX_UPLOAD_FILES = 20; }
73
+ /** The most bytes of JSON one file's signed `metadata` may take: the token travels in every request. */
74
+ static { this.MAX_TOKEN_METADATA_BYTES = 1024; }
75
+ /** The key of the application's token metadata inside a MetaLink row's `metadata` column. */
76
+ static { this.META_LINK_METADATA_KEY = 'app'; }
77
+ }
78
+ /** Codes the component reports in a body instead of throwing. */
79
+ export class StaticAssetMetaLinkCodes {
80
+ /** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */
81
+ static { this.CREATE_FAILED = 'META_LINK_CREATE_FAILED'; }
82
+ }
55
83
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,uGAAuG;AACvG,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,CAAC,OAAO,CAAC,gBAAgB;IAC7B,IAAI,CAAC,OAAO,CAAC,aAAa;IAC1B,IAAI,CAAC,OAAO,CAAC,IAAI;IACjB,IAAI,CAAC,OAAO,CAAC,aAAa;CAClB,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAS;IACtD,WAAW;IACX,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,cAAc;IACd,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,WAAW;IACX,iBAAiB;IACjB,YAAY;IACZ,UAAU;CACX,CAAC,CAAC;AAEH,yGAAyG;AACzG,MAAM,OAAO,uBAAuB;aAClB,SAAI,GAAG,MAAM,CAAC;aACd,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAE/D,MAAM,CAAC,OAAO,CAAC,OAAe;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;;AAMH,+FAA+F;AAC/F,MAAM,OAAO,uBAAuB;aAClB,YAAO,GAAG,SAAS,CAAC;aACpB,cAAS,GAAG,WAAW,CAAC;aAExB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAErE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,yHAAyH;AACzH,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;AAEjD,4GAA4G;AAC5G,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAE3C,2LAA2L;AAC3L,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAyB,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { HTTP } from '@venizia/ignis-helpers/common';\n\n/** `content-type` is absent on purpose: it is decided from the object name, never from the backend. */\nexport const WHITELIST_HEADERS = [\n HTTP.Headers.CONTENT_ENCODING,\n HTTP.Headers.CACHE_CONTROL,\n HTTP.Headers.ETAG,\n HTTP.Headers.LAST_MODIFIED,\n] as const;\n\n/**\n * Types the controller will let a browser render, keyed off the object name. Anything absent here is\n * served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`\n * cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.\n */\nexport const RENDERABLE_CONTENT_TYPES = new Set<string>([\n 'image/png',\n 'image/jpeg',\n 'image/gif',\n 'image/webp',\n 'image/avif',\n 'image/bmp',\n 'image/x-icon',\n 'video/mp4',\n 'video/webm',\n 'audio/mpeg',\n 'audio/wav',\n 'audio/ogg',\n 'application/pdf',\n 'text/plain',\n 'text/csv',\n]);\n\n/** Storage backends a static asset controller can serve from. `isValid` checks a string against them. */\nexport class StaticAssetStorageTypes {\n static readonly DISK = 'disk';\n static readonly BUN_S3 = 'bun-s3';\n\n static readonly SCHEME_SET = new Set([this.DISK, this.BUN_S3]);\n\n static isValid(orgType: string): boolean {\n return this.SCHEME_SET.has(orgType);\n }\n}\n\n/** One of the `StaticAssetStorageTypes` values. */\nexport type TStaticAssetStorageType = TConstValue<typeof StaticAssetStorageTypes>;\n\n/** What `recreate-metalink` did: refreshed the rows of an object, or created its first one. */\nexport class MetaLinkRecreateActions {\n static readonly CREATED = 'created';\n static readonly REFRESHED = 'refreshed';\n\n static readonly SCHEME_SET = new Set([this.CREATED, this.REFRESHED]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** One of the `MetaLinkRecreateActions` values. */\nexport type TMetaLinkRecreateAction = TConstValue<typeof MetaLinkRecreateActions>;\n\n/** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */\nexport const DEFAULT_PENDING_PREFIX = 'pending/';\n\n/** The most file parts one upload request may carry unless `parseMultipartBody.maxFiles` says otherwise. */\nexport const DEFAULT_MAX_UPLOAD_FILES = 20;\n\n/** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */\nexport const META_LINK_CREATE_FAILED = 'META_LINK_CREATE_FAILED';\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,iDAAiD;AACjD,MAAM,OAAO,kBAAkB;aACb,YAAO,GAAG,SAAS,CAAC;aACpB,gBAAW,GAAG,SAAS,CAAC;aACxB,eAAU,GAAG,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC;;AAGlE,2CAA2C;AAC3C,MAAM,OAAO,uBAAuB;IAClC;;;;OAIG;aACa,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,YAAY,CAAC,SAAS;QAC3B,IAAI,CAAC,YAAY,CAAC,UAAU;QAC5B,IAAI,CAAC,YAAY,CAAC,SAAS;QAC3B,IAAI,CAAC,YAAY,CAAC,UAAU;QAC5B,YAAY;QACZ,WAAW;QACX,cAAc;QACd,WAAW;QACX,YAAY;QACZ,YAAY;QACZ,WAAW;QACX,WAAW;QACX,IAAI,CAAC,YAAY,CAAC,eAAe;QACjC,IAAI,CAAC,YAAY,CAAC,UAAU;QAC5B,IAAI,CAAC,YAAY,CAAC,QAAQ;KAC3B,CAAC,CAAC;;AAGL,2EAA2E;AAC3E,MAAM,OAAO,oBAAoB;aACf,WAAM,GAAG,QAAQ,CAAC;aAClB,iBAAY,GAAG,aAAa,CAAC;aAC7B,kBAAa,GAAG,cAAc,CAAC;aAC/B,uBAAkB,GAAG,iBAAiB,CAAC;aACvC,4BAAuB,GAAG,sBAAsB,CAAC;aAEjD,kBAAa,GAAG,cAAc,CAAC;aAC/B,kBAAa,GAAG,cAAc,CAAC;aAC/B,oBAAe,GAAG,gBAAgB,CAAC;aAEnC,uBAAkB,GAAG,kBAAkB,CAAC;IAExD,wCAAwC;aACxB,QAAG,GAAG;QACpB,oBAAoB,CAAC,kBAAkB;QACvC,oBAAoB,CAAC,uBAAuB;QAC5C,oBAAoB,CAAC,MAAM;QAC3B,oBAAoB,CAAC,aAAa;QAClC,oBAAoB,CAAC,YAAY;QACjC,oBAAoB,CAAC,aAAa;QAClC,oBAAoB,CAAC,aAAa;QAClC,oBAAoB,CAAC,eAAe;QACpC,oBAAoB,CAAC,kBAAkB;KAC/B,CAAC;;AAGb,+FAA+F;AAC/F,MAAM,OAAO,uBAAuB;aAClB,YAAO,GAAG,SAAS,CAAC;aACpB,cAAS,GAAG,WAAW,CAAC;;AAM1C,+GAA+G;AAC/G,MAAM,OAAO,sBAAsB;aACjB,WAAM,GAAG,QAAQ,CAAC;aAClB,cAAS,GAAG,WAAW,CAAC;;AAM1C,8CAA8C;AAC9C,MAAM,OAAO,mBAAmB;IAC9B,yHAAyH;aACzG,mBAAc,GAAG,UAAU,CAAC;IAE5C,sGAAsG;aACtF,qBAAgB,GAAG,EAAE,CAAC;IAEtC,wGAAwG;aACxF,6BAAwB,GAAG,IAAI,CAAC;IAEhD,6FAA6F;aAC7E,2BAAsB,GAAG,KAAK,CAAC;;AAGjD,iEAAiE;AACjE,MAAM,OAAO,wBAAwB;IACnC,2LAA2L;aAC3K,kBAAa,GAAG,yBAAyB,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { HTTP } from '@venizia/ignis-helpers/common';\n\n/** What a controller sends with every object. */\nexport class StaticAssetHeaders {\n static readonly NOSNIFF = 'nosniff';\n static readonly CSP_SANDBOX = 'sandbox';\n static readonly RANGE_UNIT = HTTP.HeaderValues.RANGE_UNIT_BYTES;\n}\n\n/** Content types the controller serves. */\nexport class StaticAssetContentTypes {\n /**\n * Types the controller will let a browser render, keyed off the object name. Anything absent here is\n * served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`\n * cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.\n */\n static readonly RENDERABLE = new Set<string>([\n HTTP.HeaderValues.IMAGE_PNG,\n HTTP.HeaderValues.IMAGE_JPEG,\n HTTP.HeaderValues.IMAGE_GIF,\n HTTP.HeaderValues.IMAGE_WEBP,\n 'image/avif',\n 'image/bmp',\n 'image/x-icon',\n 'video/mp4',\n 'video/webm',\n 'audio/mpeg',\n 'audio/wav',\n 'audio/ogg',\n HTTP.HeaderValues.APPLICATION_PDF,\n HTTP.HeaderValues.TEXT_PLAIN,\n HTTP.HeaderValues.TEXT_CSV,\n ]);\n}\n\n/** The built-in routes of a generated controller, the keys of `routes`. */\nexport class StaticAssetRouteKeys {\n static readonly UPLOAD = 'upload';\n static readonly LIST_OBJECTS = 'listObjects';\n static readonly DELETE_OBJECT = 'deleteObject';\n static readonly GET_OBJECT_BY_NAME = 'getObjectByName';\n static readonly DOWNLOAD_OBJECT_BY_NAME = 'downloadObjectByName';\n\n static readonly UPLOAD_POLICY = 'uploadPolicy';\n static readonly UPLOAD_COMMIT = 'uploadCommit';\n static readonly UPLOAD_VALIDATE = 'uploadValidate';\n\n static readonly RECREATE_META_LINK = 'recreateMetaLink';\n\n /** Every key, in registration order. */\n static readonly ALL = [\n StaticAssetRouteKeys.GET_OBJECT_BY_NAME,\n StaticAssetRouteKeys.DOWNLOAD_OBJECT_BY_NAME,\n StaticAssetRouteKeys.UPLOAD,\n StaticAssetRouteKeys.DELETE_OBJECT,\n StaticAssetRouteKeys.LIST_OBJECTS,\n StaticAssetRouteKeys.UPLOAD_POLICY,\n StaticAssetRouteKeys.UPLOAD_COMMIT,\n StaticAssetRouteKeys.UPLOAD_VALIDATE,\n StaticAssetRouteKeys.RECREATE_META_LINK,\n ] as const;\n}\n\n/** What `recreate-metalink` did: refreshed the rows of an object, or created its first one. */\nexport class MetaLinkRecreateActions {\n static readonly CREATED = 'created';\n static readonly REFRESHED = 'refreshed';\n}\n\n/** One of the `MetaLinkRecreateActions` values. */\nexport type TMetaLinkRecreateAction = TConstValue<typeof MetaLinkRecreateActions>;\n\n/** Where a commit token is in its life: issued with the policy, then validated against the content it pins. */\nexport class StaticAssetTokenStages {\n static readonly ISSUED = 'issued';\n static readonly VALIDATED = 'validated';\n}\n\n/** One of the `StaticAssetTokenStages` values. */\nexport type TStaticAssetTokenStage = TConstValue<typeof StaticAssetTokenStages>;\n\n/** Defaults of the static asset component. */\nexport class StaticAssetDefaults {\n /** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */\n static readonly PENDING_PREFIX = 'pending/';\n\n /** The most file parts one upload request may carry unless `serverUpload.maxFiles` says otherwise. */\n static readonly MAX_UPLOAD_FILES = 20;\n\n /** The most bytes of JSON one file's signed `metadata` may take: the token travels in every request. */\n static readonly MAX_TOKEN_METADATA_BYTES = 1024;\n\n /** The key of the application's token metadata inside a MetaLink row's `metadata` column. */\n static readonly META_LINK_METADATA_KEY = 'app';\n}\n\n/** Codes the component reports in a body instead of throwing. */\nexport class StaticAssetMetaLinkCodes {\n /** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */\n static readonly CREATE_FAILED = 'META_LINK_CREATE_FAILED';\n}\n"]}
@@ -3,7 +3,7 @@ import type { TRegisterErrors } from '@venizia/ignis-helpers/core';
3
3
  export declare const StaticAssetErrors: {
4
4
  readonly UPLOAD_NOT_AUTHORIZED: {
5
5
  readonly message: {
6
- readonly text: "Not allowed to request an upload policy";
6
+ readonly text: "Not allowed to upload";
7
7
  readonly code: "core.static_asset.upload_not_authorized";
8
8
  };
9
9
  readonly statusCode: 403;
@@ -35,60 +35,63 @@ export declare const StaticAssetErrors: {
35
35
  readonly statusCode: 400;
36
36
  readonly category: "validation";
37
37
  };
38
- /** Labels ride the body; one in the URL would otherwise leave the row unlabelled without a word. */
39
- readonly LABELS_IN_QUERY: {
38
+ /** The pending object is not the one that was read: it was overwritten or removed after the pin. Raised by a pinned read and by the commit copy. */
39
+ readonly UPLOAD_CHANGED: {
40
40
  readonly message: {
41
- readonly text: "Upload labels belong in the request body, not the query";
42
- readonly code: "core.static_asset.labels_in_query";
41
+ readonly text: "The uploaded file changed after it was validated";
42
+ readonly code: "core.static_asset.upload_changed";
43
43
  };
44
- readonly statusCode: 400;
44
+ readonly statusCode: 409;
45
45
  readonly category: "validation";
46
46
  };
47
- readonly BUCKET_NAME_INVALID: {
47
+ /** The destination already holds an object: the token was committed once, and a second commit would overwrite it. */
48
+ readonly UPLOAD_ALREADY_COMMITTED: {
48
49
  readonly message: {
49
- readonly text: "Invalid bucket name";
50
- readonly code: "core.static_asset.bucket_name_invalid";
50
+ readonly text: "The upload was already committed";
51
+ readonly code: "core.static_asset.upload_already_committed";
51
52
  };
52
- readonly statusCode: 400;
53
+ readonly statusCode: 409;
53
54
  readonly category: "validation";
54
55
  };
55
- readonly OBJECT_NAME_INVALID: {
56
+ /** The metadata a policy would sign is not allowed: oversized, or sent by a client with no `resolvers.metadata` to read it. */
57
+ readonly UPLOAD_METADATA_INVALID: {
56
58
  readonly message: {
57
- readonly text: "Invalid object name or path";
58
- readonly code: "core.static_asset.object_name_invalid";
59
+ readonly text: "Invalid upload metadata";
60
+ readonly code: "core.static_asset.upload_metadata_invalid";
59
61
  };
60
62
  readonly statusCode: 400;
61
63
  readonly category: "validation";
62
64
  };
63
- /** The application's naming hook produced a key outside `controller.keyPrefix`; nothing is written. */
64
- readonly OBJECT_KEY_OUT_OF_SCOPE: {
65
+ /** With a `validation` on, `commit` takes the token `upload-validate` returned, not the one the policy issued. */
66
+ readonly UPLOAD_NOT_VALIDATED: {
65
67
  readonly message: {
66
- readonly text: "Object key is outside the key prefix of this controller";
67
- readonly code: "core.static_asset.object_key_out_of_scope";
68
+ readonly text: "The upload has not been validated";
69
+ readonly code: "core.static_asset.upload_not_validated";
68
70
  };
69
- readonly statusCode: 400;
71
+ readonly statusCode: 422;
70
72
  readonly category: "validation";
71
73
  };
72
- readonly FOLDER_PATH_INVALID: {
74
+ readonly BUCKET_NAME_INVALID: {
73
75
  readonly message: {
74
- readonly text: "Invalid folder path";
75
- readonly code: "core.static_asset.folder_path_invalid";
76
+ readonly text: "Invalid bucket name";
77
+ readonly code: "core.static_asset.bucket_name_invalid";
76
78
  };
77
79
  readonly statusCode: 400;
78
80
  readonly category: "validation";
79
81
  };
80
- readonly FOLDER_SEGMENT_INVALID: {
82
+ readonly OBJECT_NAME_INVALID: {
81
83
  readonly message: {
82
- readonly text: "Invalid folder path segment";
83
- readonly code: "core.static_asset.folder_segment_invalid";
84
+ readonly text: "Invalid object name or path";
85
+ readonly code: "core.static_asset.object_name_invalid";
84
86
  };
85
87
  readonly statusCode: 400;
86
88
  readonly category: "validation";
87
89
  };
88
- readonly FOLDER_DEPTH_EXCEEDED: {
90
+ /** The application's naming hook produced a key outside the entry's `keyPrefix`; nothing is written. */
91
+ readonly OBJECT_KEY_OUT_OF_SCOPE: {
89
92
  readonly message: {
90
- readonly text: "Folder path exceeds the maximum depth";
91
- readonly code: "core.static_asset.folder_depth_exceeded";
93
+ readonly text: "Object key is outside the key prefix of this controller";
94
+ readonly code: "core.static_asset.object_key_out_of_scope";
92
95
  };
93
96
  readonly statusCode: 400;
94
97
  readonly category: "validation";
@@ -101,14 +104,6 @@ export declare const StaticAssetErrors: {
101
104
  readonly statusCode: 400;
102
105
  readonly category: "validation";
103
106
  };
104
- readonly MAX_KEYS_INVALID: {
105
- readonly message: {
106
- readonly text: "Invalid maxKeys - expected a positive integer";
107
- readonly code: "core.static_asset.max_keys_invalid";
108
- };
109
- readonly statusCode: 400;
110
- readonly category: "validation";
111
- };
112
107
  };
113
108
  /** Registers these codes with the shared key registry so a consumer gets autocomplete on `messageCode`. */
114
109
  declare module '@venizia/ignis-helpers' {
@@ -4,7 +4,7 @@ import { HTTP } from '@venizia/ignis-helpers/common';
4
4
  export const StaticAssetErrors = {
5
5
  UPLOAD_NOT_AUTHORIZED: {
6
6
  message: {
7
- text: 'Not allowed to request an upload policy',
7
+ text: 'Not allowed to upload',
8
8
  code: 'core.static_asset.upload_not_authorized',
9
9
  },
10
10
  statusCode: HTTP.ResultCodes.RS_4.Forbidden,
@@ -30,54 +30,60 @@ export const StaticAssetErrors = {
30
30
  statusCode: HTTP.ResultCodes.RS_4.BadRequest,
31
31
  category: ErrorScopes.VALIDATION,
32
32
  },
33
- /** Labels ride the body; one in the URL would otherwise leave the row unlabelled without a word. */
34
- LABELS_IN_QUERY: {
33
+ /** The pending object is not the one that was read: it was overwritten or removed after the pin. Raised by a pinned read and by the commit copy. */
34
+ UPLOAD_CHANGED: {
35
35
  message: {
36
- text: 'Upload labels belong in the request body, not the query',
37
- code: 'core.static_asset.labels_in_query',
36
+ text: 'The uploaded file changed after it was validated',
37
+ code: 'core.static_asset.upload_changed',
38
38
  },
39
- statusCode: HTTP.ResultCodes.RS_4.BadRequest,
39
+ statusCode: HTTP.ResultCodes.RS_4.Conflict,
40
40
  category: ErrorScopes.VALIDATION,
41
41
  },
42
- BUCKET_NAME_INVALID: {
43
- message: { text: 'Invalid bucket name', code: 'core.static_asset.bucket_name_invalid' },
44
- statusCode: HTTP.ResultCodes.RS_4.BadRequest,
42
+ /** The destination already holds an object: the token was committed once, and a second commit would overwrite it. */
43
+ UPLOAD_ALREADY_COMMITTED: {
44
+ message: {
45
+ text: 'The upload was already committed',
46
+ code: 'core.static_asset.upload_already_committed',
47
+ },
48
+ statusCode: HTTP.ResultCodes.RS_4.Conflict,
45
49
  category: ErrorScopes.VALIDATION,
46
50
  },
47
- OBJECT_NAME_INVALID: {
51
+ /** The metadata a policy would sign is not allowed: oversized, or sent by a client with no `resolvers.metadata` to read it. */
52
+ UPLOAD_METADATA_INVALID: {
48
53
  message: {
49
- text: 'Invalid object name or path',
50
- code: 'core.static_asset.object_name_invalid',
54
+ text: 'Invalid upload metadata',
55
+ code: 'core.static_asset.upload_metadata_invalid',
51
56
  },
52
57
  statusCode: HTTP.ResultCodes.RS_4.BadRequest,
53
58
  category: ErrorScopes.VALIDATION,
54
59
  },
55
- /** The application's naming hook produced a key outside `controller.keyPrefix`; nothing is written. */
56
- OBJECT_KEY_OUT_OF_SCOPE: {
60
+ /** With a `validation` on, `commit` takes the token `upload-validate` returned, not the one the policy issued. */
61
+ UPLOAD_NOT_VALIDATED: {
57
62
  message: {
58
- text: 'Object key is outside the key prefix of this controller',
59
- code: 'core.static_asset.object_key_out_of_scope',
63
+ text: 'The upload has not been validated',
64
+ code: 'core.static_asset.upload_not_validated',
60
65
  },
61
- statusCode: HTTP.ResultCodes.RS_4.BadRequest,
66
+ statusCode: HTTP.ResultCodes.RS_4.UnprocessableEntity,
62
67
  category: ErrorScopes.VALIDATION,
63
68
  },
64
- FOLDER_PATH_INVALID: {
65
- message: { text: 'Invalid folder path', code: 'core.static_asset.folder_path_invalid' },
69
+ BUCKET_NAME_INVALID: {
70
+ message: { text: 'Invalid bucket name', code: 'core.static_asset.bucket_name_invalid' },
66
71
  statusCode: HTTP.ResultCodes.RS_4.BadRequest,
67
72
  category: ErrorScopes.VALIDATION,
68
73
  },
69
- FOLDER_SEGMENT_INVALID: {
74
+ OBJECT_NAME_INVALID: {
70
75
  message: {
71
- text: 'Invalid folder path segment',
72
- code: 'core.static_asset.folder_segment_invalid',
76
+ text: 'Invalid object name or path',
77
+ code: 'core.static_asset.object_name_invalid',
73
78
  },
74
79
  statusCode: HTTP.ResultCodes.RS_4.BadRequest,
75
80
  category: ErrorScopes.VALIDATION,
76
81
  },
77
- FOLDER_DEPTH_EXCEEDED: {
82
+ /** The application's naming hook produced a key outside the entry's `keyPrefix`; nothing is written. */
83
+ OBJECT_KEY_OUT_OF_SCOPE: {
78
84
  message: {
79
- text: 'Folder path exceeds the maximum depth',
80
- code: 'core.static_asset.folder_depth_exceeded',
85
+ text: 'Object key is outside the key prefix of this controller',
86
+ code: 'core.static_asset.object_key_out_of_scope',
81
87
  },
82
88
  statusCode: HTTP.ResultCodes.RS_4.BadRequest,
83
89
  category: ErrorScopes.VALIDATION,
@@ -87,13 +93,5 @@ export const StaticAssetErrors = {
87
93
  statusCode: HTTP.ResultCodes.RS_4.BadRequest,
88
94
  category: ErrorScopes.VALIDATION,
89
95
  },
90
- MAX_KEYS_INVALID: {
91
- message: {
92
- text: 'Invalid maxKeys - expected a positive integer',
93
- code: 'core.static_asset.max_keys_invalid',
94
- },
95
- statusCode: HTTP.ResultCodes.RS_4.BadRequest,
96
- category: ErrorScopes.VALIDATION,
97
- },
98
96
  };
99
97
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/errors.ts"],"names":[],"mappings":"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","sourcesContent":["import type { TErrorDefinition, TRegisterErrors } from '@venizia/ignis-helpers/core';\nimport { ErrorScopes } from '@venizia/ignis-helpers/core';\nimport { HTTP } from '@venizia/ignis-helpers/common';\n\n/** Codes a client branches on for a rejected static-asset request. A throw site may override `message` to name the offending value. */\nexport const StaticAssetErrors = {\n UPLOAD_NOT_AUTHORIZED: {\n message: {\n text: 'Not allowed to request an upload policy',\n code: 'core.static_asset.upload_not_authorized',\n },\n statusCode: HTTP.ResultCodes.RS_4.Forbidden,\n category: ErrorScopes.VALIDATION,\n },\n /** Both upload paths - one condition, one code to branch on. */\n UPLOAD_TOO_LARGE: {\n message: {\n text: 'File is larger than the maximum allowed',\n code: 'core.static_asset.upload_too_large',\n },\n statusCode: HTTP.ResultCodes.RS_4.ContentTooLarge,\n category: ErrorScopes.VALIDATION,\n },\n /** Deliberately not 404 and deliberately not \"expired\": a caller learns only that the token is no good, never whether the key it names exists. */\n INVALID_COMMIT_TOKEN: {\n message: { text: 'Invalid commit token', code: 'core.static_asset.invalid_commit_token' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n EXPIRED_COMMIT_TOKEN: {\n message: { text: 'Commit token has expired', code: 'core.static_asset.expired_commit_token' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n /** Labels ride the body; one in the URL would otherwise leave the row unlabelled without a word. */\n LABELS_IN_QUERY: {\n message: {\n text: 'Upload labels belong in the request body, not the query',\n code: 'core.static_asset.labels_in_query',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n BUCKET_NAME_INVALID: {\n message: { text: 'Invalid bucket name', code: 'core.static_asset.bucket_name_invalid' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n OBJECT_NAME_INVALID: {\n message: {\n text: 'Invalid object name or path',\n code: 'core.static_asset.object_name_invalid',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n /** The application's naming hook produced a key outside `controller.keyPrefix`; nothing is written. */\n OBJECT_KEY_OUT_OF_SCOPE: {\n message: {\n text: 'Object key is outside the key prefix of this controller',\n code: 'core.static_asset.object_key_out_of_scope',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n FOLDER_PATH_INVALID: {\n message: { text: 'Invalid folder path', code: 'core.static_asset.folder_path_invalid' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n FOLDER_SEGMENT_INVALID: {\n message: {\n text: 'Invalid folder path segment',\n code: 'core.static_asset.folder_segment_invalid',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n FOLDER_DEPTH_EXCEEDED: {\n message: {\n text: 'Folder path exceeds the maximum depth',\n code: 'core.static_asset.folder_depth_exceeded',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n FILE_EMPTY: {\n message: { text: 'Empty file content', code: 'core.static_asset.file_empty' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n MAX_KEYS_INVALID: {\n message: {\n text: 'Invalid maxKeys - expected a positive integer',\n code: 'core.static_asset.max_keys_invalid',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n} as const satisfies Record<string, TErrorDefinition>;\n\n/** Registers these codes with the shared key registry so a consumer gets autocomplete on `messageCode`. */\ndeclare module '@venizia/ignis-helpers' {\n interface IErrorKeyRegistry extends TRegisterErrors<typeof StaticAssetErrors> {}\n}\n"]}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/errors.ts"],"names":[],"mappings":"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","sourcesContent":["import type { TErrorDefinition, TRegisterErrors } from '@venizia/ignis-helpers/core';\nimport { ErrorScopes } from '@venizia/ignis-helpers/core';\nimport { HTTP } from '@venizia/ignis-helpers/common';\n\n/** Codes a client branches on for a rejected static-asset request. A throw site may override `message` to name the offending value. */\nexport const StaticAssetErrors = {\n UPLOAD_NOT_AUTHORIZED: {\n message: {\n text: 'Not allowed to upload',\n code: 'core.static_asset.upload_not_authorized',\n },\n statusCode: HTTP.ResultCodes.RS_4.Forbidden,\n category: ErrorScopes.VALIDATION,\n },\n /** Both upload paths - one condition, one code to branch on. */\n UPLOAD_TOO_LARGE: {\n message: {\n text: 'File is larger than the maximum allowed',\n code: 'core.static_asset.upload_too_large',\n },\n statusCode: HTTP.ResultCodes.RS_4.ContentTooLarge,\n category: ErrorScopes.VALIDATION,\n },\n /** Deliberately not 404 and deliberately not \"expired\": a caller learns only that the token is no good, never whether the key it names exists. */\n INVALID_COMMIT_TOKEN: {\n message: { text: 'Invalid commit token', code: 'core.static_asset.invalid_commit_token' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n EXPIRED_COMMIT_TOKEN: {\n message: { text: 'Commit token has expired', code: 'core.static_asset.expired_commit_token' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n /** The pending object is not the one that was read: it was overwritten or removed after the pin. Raised by a pinned read and by the commit copy. */\n UPLOAD_CHANGED: {\n message: {\n text: 'The uploaded file changed after it was validated',\n code: 'core.static_asset.upload_changed',\n },\n statusCode: HTTP.ResultCodes.RS_4.Conflict,\n category: ErrorScopes.VALIDATION,\n },\n /** The destination already holds an object: the token was committed once, and a second commit would overwrite it. */\n UPLOAD_ALREADY_COMMITTED: {\n message: {\n text: 'The upload was already committed',\n code: 'core.static_asset.upload_already_committed',\n },\n statusCode: HTTP.ResultCodes.RS_4.Conflict,\n category: ErrorScopes.VALIDATION,\n },\n /** The metadata a policy would sign is not allowed: oversized, or sent by a client with no `resolvers.metadata` to read it. */\n UPLOAD_METADATA_INVALID: {\n message: {\n text: 'Invalid upload metadata',\n code: 'core.static_asset.upload_metadata_invalid',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n /** With a `validation` on, `commit` takes the token `upload-validate` returned, not the one the policy issued. */\n UPLOAD_NOT_VALIDATED: {\n message: {\n text: 'The upload has not been validated',\n code: 'core.static_asset.upload_not_validated',\n },\n statusCode: HTTP.ResultCodes.RS_4.UnprocessableEntity,\n category: ErrorScopes.VALIDATION,\n },\n BUCKET_NAME_INVALID: {\n message: { text: 'Invalid bucket name', code: 'core.static_asset.bucket_name_invalid' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n OBJECT_NAME_INVALID: {\n message: {\n text: 'Invalid object name or path',\n code: 'core.static_asset.object_name_invalid',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n /** The application's naming hook produced a key outside the entry's `keyPrefix`; nothing is written. */\n OBJECT_KEY_OUT_OF_SCOPE: {\n message: {\n text: 'Object key is outside the key prefix of this controller',\n code: 'core.static_asset.object_key_out_of_scope',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n FILE_EMPTY: {\n message: { text: 'Empty file content', code: 'core.static_asset.file_empty' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n} as const satisfies Record<string, TErrorDefinition>;\n\n/** Registers these codes with the shared key registry so a consumer gets autocomplete on `messageCode`. */\ndeclare module '@venizia/ignis-helpers' {\n interface IErrorKeyRegistry extends TRegisterErrors<typeof StaticAssetErrors> {}\n}\n"]}
@@ -2,5 +2,5 @@ export * from './errors.js';
2
2
  export * from './constants.js';
3
3
  export * from './keys.js';
4
4
  export * from './types.js';
5
- export * from './commit-token.js';
5
+ export * from './validation.js';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -2,5 +2,5 @@ export * from './errors.js';
2
2
  export * from './constants.js';
3
3
  export * from './keys.js';
4
4
  export * from './types.js';
5
- export * from './commit-token.js';
5
+ export * from './validation.js';
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './errors';\nexport * from './constants';\nexport * from './keys';\nexport * from './types';\nexport * from './commit-token';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC","sourcesContent":["export * from './errors';\nexport * from './constants';\nexport * from './keys';\nexport * from './types';\nexport * from './validation';\n"]}
@@ -1,6 +1,14 @@
1
1
  /** Container keys of the static asset component. */
2
- export declare class StaticAssetComponentBindingKeys {
2
+ export declare class StaticAssetBindingKeys {
3
3
  /** The options an application registers through `configs.artifacts` land here, because an artifact index carries classes and no options. `application.component(StaticAssetComponent, { options })` passes them directly and wins over this key. */
4
- static readonly STATIC_ASSET_COMPONENT_OPTIONS = "@app/static-asset-component/options";
4
+ static readonly STATIC_ASSET_OPTIONS = "@app/static-asset/options";
5
+ /** The `StaticAssetUploadPolicyService` of one options entry, bound only for an entry that turns `directUpload` on. `name` is the entry's KEY in the options object, not the controller name. */
6
+ static policyService(opts: {
7
+ name: string;
8
+ }): string;
9
+ /** The `StaticAssetUploadCommitService` of one options entry, bound with its policy service. */
10
+ static commitService(opts: {
11
+ name: string;
12
+ }): string;
5
13
  }
6
14
  //# sourceMappingURL=keys.d.ts.map
@@ -1,6 +1,14 @@
1
1
  /** Container keys of the static asset component. */
2
- export class StaticAssetComponentBindingKeys {
2
+ export class StaticAssetBindingKeys {
3
3
  /** The options an application registers through `configs.artifacts` land here, because an artifact index carries classes and no options. `application.component(StaticAssetComponent, { options })` passes them directly and wins over this key. */
4
- static { this.STATIC_ASSET_COMPONENT_OPTIONS = '@app/static-asset-component/options'; }
4
+ static { this.STATIC_ASSET_OPTIONS = '@app/static-asset/options'; }
5
+ /** The `StaticAssetUploadPolicyService` of one options entry, bound only for an entry that turns `directUpload` on. `name` is the entry's KEY in the options object, not the controller name. */
6
+ static policyService(opts) {
7
+ return `@app/static-asset/policy-service/${opts.name}`;
8
+ }
9
+ /** The `StaticAssetUploadCommitService` of one options entry, bound with its policy service. */
10
+ static commitService(opts) {
11
+ return `@app/static-asset/commit-service/${opts.name}`;
12
+ }
5
13
  }
6
14
  //# sourceMappingURL=keys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/keys.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,OAAO,+BAA+B;IAC1C,oPAAoP;aACpO,mCAA8B,GAAG,qCAAqC,CAAC","sourcesContent":["/** Container keys of the static asset component. */\nexport class StaticAssetComponentBindingKeys {\n /** The options an application registers through `configs.artifacts` land here, because an artifact index carries classes and no options. `application.component(StaticAssetComponent, { options })` passes them directly and wins over this key. */\n static readonly STATIC_ASSET_COMPONENT_OPTIONS = '@app/static-asset-component/options';\n}\n"]}
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/keys.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,OAAO,sBAAsB;IACjC,oPAAoP;aACpO,yBAAoB,GAAG,2BAA2B,CAAC;IAEnE,iMAAiM;IACjM,MAAM,CAAC,aAAa,CAAC,IAAsB;QACzC,OAAO,oCAAoC,IAAI,CAAC,IAAI,EAAE,CAAC;IACzD,CAAC;IAED,gGAAgG;IAChG,MAAM,CAAC,aAAa,CAAC,IAAsB;QACzC,OAAO,oCAAoC,IAAI,CAAC,IAAI,EAAE,CAAC;IACzD,CAAC","sourcesContent":["/** Container keys of the static asset component. */\nexport class StaticAssetBindingKeys {\n /** The options an application registers through `configs.artifacts` land here, because an artifact index carries classes and no options. `application.component(StaticAssetComponent, { options })` passes them directly and wins over this key. */\n static readonly STATIC_ASSET_OPTIONS = '@app/static-asset/options';\n\n /** The `StaticAssetUploadPolicyService` of one options entry, bound only for an entry that turns `directUpload` on. `name` is the entry's KEY in the options object, not the controller name. */\n static policyService(opts: { name: string }): string {\n return `@app/static-asset/policy-service/${opts.name}`;\n }\n\n /** The `StaticAssetUploadCommitService` of one options entry, bound with its policy service. */\n static commitService(opts: { name: string }): string {\n return `@app/static-asset/commit-service/${opts.name}`;\n }\n}\n"]}