@venizia/ignis 0.4.8-0 → 0.4.8-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/dist/esm/base/applications/base.d.ts +19 -0
  2. package/dist/esm/base/applications/base.js +19 -0
  3. package/dist/esm/base/applications/base.js.map +1 -1
  4. package/dist/esm/base/applications/boot-steps.d.ts +1 -0
  5. package/dist/esm/base/applications/boot-steps.js.map +1 -1
  6. package/dist/esm/base/applications/common/types.d.ts +21 -4
  7. package/dist/esm/base/applications/common/types.js.map +1 -1
  8. package/dist/esm/base/metadata/request-context.d.ts +1 -0
  9. package/dist/esm/base/metadata/request-context.js +1 -0
  10. package/dist/esm/base/metadata/request-context.js.map +1 -1
  11. package/dist/esm/components/api-reference/common/constants.d.ts +1 -0
  12. package/dist/esm/components/api-reference/common/constants.js +1 -0
  13. package/dist/esm/components/api-reference/common/constants.js.map +1 -1
  14. package/dist/esm/components/api-reference/common/keys.d.ts +1 -0
  15. package/dist/esm/components/api-reference/common/keys.js +1 -0
  16. package/dist/esm/components/api-reference/common/keys.js.map +1 -1
  17. package/dist/esm/components/api-reference/common/types.d.ts +18 -1
  18. package/dist/esm/components/api-reference/common/types.js.map +1 -1
  19. package/dist/esm/components/api-reference/component.d.ts +14 -0
  20. package/dist/esm/components/api-reference/component.js +14 -0
  21. package/dist/esm/components/api-reference/component.js.map +1 -1
  22. package/dist/esm/components/api-reference/ui/factory.d.ts +1 -0
  23. package/dist/esm/components/api-reference/ui/factory.js +1 -0
  24. package/dist/esm/components/api-reference/ui/factory.js.map +1 -1
  25. package/dist/esm/components/api-reference/ui/scalar.d.ts +1 -0
  26. package/dist/esm/components/api-reference/ui/scalar.js +1 -0
  27. package/dist/esm/components/api-reference/ui/scalar.js.map +1 -1
  28. package/dist/esm/components/api-reference/ui/swagger.d.ts +1 -0
  29. package/dist/esm/components/api-reference/ui/swagger.js +1 -0
  30. package/dist/esm/components/api-reference/ui/swagger.js.map +1 -1
  31. package/dist/esm/components/auth/authenticate/component.d.ts +1 -0
  32. package/dist/esm/components/auth/authenticate/component.js +1 -0
  33. package/dist/esm/components/auth/authenticate/component.js.map +1 -1
  34. package/dist/esm/components/auth/authenticate/controllers/factory.d.ts +1 -0
  35. package/dist/esm/components/auth/authenticate/controllers/factory.js +1 -0
  36. package/dist/esm/components/auth/authenticate/controllers/factory.js.map +1 -1
  37. package/dist/esm/components/auth/authenticate/controllers/jwks/controller.d.ts +1 -0
  38. package/dist/esm/components/auth/authenticate/controllers/jwks/controller.js +1 -0
  39. package/dist/esm/components/auth/authenticate/controllers/jwks/controller.js.map +1 -1
  40. package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.d.ts +1 -0
  41. package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.js +1 -0
  42. package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.js.map +1 -1
  43. package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.d.ts +1 -0
  44. package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.js +1 -0
  45. package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.js.map +1 -1
  46. package/dist/esm/components/auth/authenticate/strategies/jwks/issuer.d.ts +1 -0
  47. package/dist/esm/components/auth/authenticate/strategies/jwks/issuer.js +1 -0
  48. package/dist/esm/components/auth/authenticate/strategies/jwks/issuer.js.map +1 -1
  49. package/dist/esm/components/auth/authenticate/strategies/jwks/verifier.d.ts +1 -0
  50. package/dist/esm/components/auth/authenticate/strategies/jwks/verifier.js +1 -0
  51. package/dist/esm/components/auth/authenticate/strategies/jwks/verifier.js.map +1 -1
  52. package/dist/esm/components/auth/authenticate/strategies/jws.strategy.d.ts +1 -0
  53. package/dist/esm/components/auth/authenticate/strategies/jws.strategy.js +1 -0
  54. package/dist/esm/components/auth/authenticate/strategies/jws.strategy.js.map +1 -1
  55. package/dist/esm/components/auth/authorize/adapters/scoped-casbin/common/types.d.ts +2 -0
  56. package/dist/esm/components/auth/authorize/adapters/scoped-casbin/common/types.js.map +1 -1
  57. package/dist/esm/components/auth/authorize/adapters/scoped-casbin/policy-edges.d.ts +1 -0
  58. package/dist/esm/components/auth/authorize/adapters/scoped-casbin/policy-edges.js +1 -0
  59. package/dist/esm/components/auth/authorize/adapters/scoped-casbin/policy-edges.js.map +1 -1
  60. package/dist/esm/components/auth/authorize/component.d.ts +1 -0
  61. package/dist/esm/components/auth/authorize/component.js +1 -0
  62. package/dist/esm/components/auth/authorize/component.js.map +1 -1
  63. package/dist/esm/components/auth/authorize/enforcers/casbin.enforcer.d.ts +1 -0
  64. package/dist/esm/components/auth/authorize/enforcers/casbin.enforcer.js +1 -0
  65. package/dist/esm/components/auth/authorize/enforcers/casbin.enforcer.js.map +1 -1
  66. package/dist/esm/components/auth/models/entities/columns.d.ts +1 -0
  67. package/dist/esm/components/auth/models/entities/columns.js.map +1 -1
  68. package/dist/esm/components/auth/models/entities/permission.model.d.ts +2 -0
  69. package/dist/esm/components/auth/models/entities/permission.model.js.map +1 -1
  70. package/dist/esm/components/auth/models/entities/policy-definition.model.d.ts +1 -0
  71. package/dist/esm/components/auth/models/entities/policy-definition.model.js.map +1 -1
  72. package/dist/esm/components/controller/grpc/common/types.d.ts +2 -0
  73. package/dist/esm/components/controller/grpc/common/types.js +1 -0
  74. package/dist/esm/components/controller/grpc/common/types.js.map +1 -1
  75. package/dist/esm/components/controller/grpc/grpc.component.d.ts +1 -0
  76. package/dist/esm/components/controller/grpc/grpc.component.js +1 -0
  77. package/dist/esm/components/controller/grpc/grpc.component.js.map +1 -1
  78. package/dist/esm/components/health-check/common/constants.d.ts +1 -0
  79. package/dist/esm/components/health-check/common/constants.js +1 -0
  80. package/dist/esm/components/health-check/common/constants.js.map +1 -1
  81. package/dist/esm/components/health-check/common/keys.d.ts +1 -0
  82. package/dist/esm/components/health-check/common/keys.js +1 -0
  83. package/dist/esm/components/health-check/common/keys.js.map +1 -1
  84. package/dist/esm/components/health-check/common/rest-paths.d.ts +1 -0
  85. package/dist/esm/components/health-check/common/rest-paths.js +1 -0
  86. package/dist/esm/components/health-check/common/rest-paths.js.map +1 -1
  87. package/dist/esm/components/health-check/common/types.d.ts +24 -3
  88. package/dist/esm/components/health-check/common/types.js.map +1 -1
  89. package/dist/esm/components/health-check/component.d.ts +15 -0
  90. package/dist/esm/components/health-check/component.js +15 -0
  91. package/dist/esm/components/health-check/component.js.map +1 -1
  92. package/dist/esm/components/health-check/controller.d.ts +1 -0
  93. package/dist/esm/components/health-check/controller.js +1 -0
  94. package/dist/esm/components/health-check/controller.js.map +1 -1
  95. package/dist/esm/components/mail/common/constants.d.ts +6 -0
  96. package/dist/esm/components/mail/common/constants.js +5 -0
  97. package/dist/esm/components/mail/common/constants.js.map +1 -1
  98. package/dist/esm/components/mail/common/keys.d.ts +1 -0
  99. package/dist/esm/components/mail/common/keys.js +1 -0
  100. package/dist/esm/components/mail/common/keys.js.map +1 -1
  101. package/dist/esm/components/mail/common/types/message.d.ts +10 -0
  102. package/dist/esm/components/mail/common/types/message.js.map +1 -1
  103. package/dist/esm/components/mail/common/types/options.d.ts +22 -1
  104. package/dist/esm/components/mail/common/types/options.js.map +1 -1
  105. package/dist/esm/components/mail/common/types/queue.d.ts +7 -0
  106. package/dist/esm/components/mail/common/types/queue.js.map +1 -1
  107. package/dist/esm/components/mail/common/types/template.d.ts +2 -0
  108. package/dist/esm/components/mail/common/types/template.js.map +1 -1
  109. package/dist/esm/components/mail/common/types/verification.d.ts +5 -0
  110. package/dist/esm/components/mail/common/types/verification.js.map +1 -1
  111. package/dist/esm/components/mail/component.d.ts +1 -0
  112. package/dist/esm/components/mail/component.js +1 -0
  113. package/dist/esm/components/mail/component.js.map +1 -1
  114. package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.d.ts +1 -0
  115. package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js +1 -0
  116. package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js.map +1 -1
  117. package/dist/esm/components/mail/helpers/executors/direct-executor.helper.d.ts +1 -0
  118. package/dist/esm/components/mail/helpers/executors/direct-executor.helper.js +1 -0
  119. package/dist/esm/components/mail/helpers/executors/direct-executor.helper.js.map +1 -1
  120. package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.d.ts +1 -0
  121. package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js +1 -0
  122. package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js.map +1 -1
  123. package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.d.ts +1 -0
  124. package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js +1 -0
  125. package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js.map +1 -1
  126. package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.d.ts +1 -0
  127. package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js +1 -0
  128. package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js.map +1 -1
  129. package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.d.ts +1 -0
  130. package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js +1 -0
  131. package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js.map +1 -1
  132. package/dist/esm/components/mail/providers/mail-queue-executor.provider.d.ts +2 -0
  133. package/dist/esm/components/mail/providers/mail-queue-executor.provider.js +1 -0
  134. package/dist/esm/components/mail/providers/mail-queue-executor.provider.js.map +1 -1
  135. package/dist/esm/components/mail/providers/mail-transporter.provider.d.ts +2 -0
  136. package/dist/esm/components/mail/providers/mail-transporter.provider.js +1 -0
  137. package/dist/esm/components/mail/providers/mail-transporter.provider.js.map +1 -1
  138. package/dist/esm/components/mail/services/generators/numeric-code.d.ts +1 -0
  139. package/dist/esm/components/mail/services/generators/numeric-code.js +1 -0
  140. package/dist/esm/components/mail/services/generators/numeric-code.js.map +1 -1
  141. package/dist/esm/components/mail/services/generators/random-token.d.ts +1 -0
  142. package/dist/esm/components/mail/services/generators/random-token.js +1 -0
  143. package/dist/esm/components/mail/services/generators/random-token.js.map +1 -1
  144. package/dist/esm/components/mail/services/generators/verification-data.d.ts +1 -0
  145. package/dist/esm/components/mail/services/generators/verification-data.js +1 -0
  146. package/dist/esm/components/mail/services/generators/verification-data.js.map +1 -1
  147. package/dist/esm/components/mail/services/mail.service.d.ts +1 -0
  148. package/dist/esm/components/mail/services/mail.service.js +1 -0
  149. package/dist/esm/components/mail/services/mail.service.js.map +1 -1
  150. package/dist/esm/components/mail/services/template.service.d.ts +1 -0
  151. package/dist/esm/components/mail/services/template.service.js +1 -0
  152. package/dist/esm/components/mail/services/template.service.js.map +1 -1
  153. package/dist/esm/components/mail/utilities/address.utility.d.ts +1 -0
  154. package/dist/esm/components/mail/utilities/address.utility.js +1 -0
  155. package/dist/esm/components/mail/utilities/address.utility.js.map +1 -1
  156. package/dist/esm/components/mail/utilities/mime.utility.d.ts +1 -0
  157. package/dist/esm/components/mail/utilities/mime.utility.js +1 -0
  158. package/dist/esm/components/mail/utilities/mime.utility.js.map +1 -1
  159. package/dist/esm/components/mail/utilities/verification.utility.d.ts +1 -0
  160. package/dist/esm/components/mail/utilities/verification.utility.js +1 -0
  161. package/dist/esm/components/mail/utilities/verification.utility.js.map +1 -1
  162. package/dist/esm/components/request-tracker/component.d.ts +1 -0
  163. package/dist/esm/components/request-tracker/component.js +1 -0
  164. package/dist/esm/components/request-tracker/component.js.map +1 -1
  165. package/dist/esm/components/socket-io/common/keys.d.ts +1 -0
  166. package/dist/esm/components/socket-io/common/keys.js +1 -0
  167. package/dist/esm/components/socket-io/common/keys.js.map +1 -1
  168. package/dist/esm/components/socket-io/component.d.ts +1 -0
  169. package/dist/esm/components/socket-io/component.js +1 -0
  170. package/dist/esm/components/socket-io/component.js.map +1 -1
  171. package/dist/esm/components/static-asset/common/constants.d.ts +3 -0
  172. package/dist/esm/components/static-asset/common/constants.js +1 -0
  173. package/dist/esm/components/static-asset/common/constants.js.map +1 -1
  174. package/dist/esm/components/static-asset/common/keys.d.ts +1 -0
  175. package/dist/esm/components/static-asset/common/keys.js +1 -0
  176. package/dist/esm/components/static-asset/common/keys.js.map +1 -1
  177. package/dist/esm/components/static-asset/common/types.d.ts +42 -6
  178. package/dist/esm/components/static-asset/common/types.js.map +1 -1
  179. package/dist/esm/components/static-asset/controller/factory.d.ts +2 -0
  180. package/dist/esm/components/static-asset/controller/factory.js +1 -0
  181. package/dist/esm/components/static-asset/controller/factory.js.map +1 -1
  182. package/dist/esm/components/static-asset/ingest.d.ts +5 -1
  183. package/dist/esm/components/static-asset/ingest.js.map +1 -1
  184. package/dist/esm/components/static-asset/models/base.model.d.ts +2 -0
  185. package/dist/esm/components/static-asset/models/base.model.js.map +1 -1
  186. package/dist/esm/components/websocket/common/keys.d.ts +1 -0
  187. package/dist/esm/components/websocket/common/keys.js +1 -0
  188. package/dist/esm/components/websocket/common/keys.js.map +1 -1
  189. package/dist/esm/components/websocket/component.d.ts +1 -0
  190. package/dist/esm/components/websocket/component.js +1 -0
  191. package/dist/esm/components/websocket/component.js.map +1 -1
  192. package/dist/esm/testing/assert-application-boots.d.ts +39 -8
  193. package/dist/esm/testing/assert-application-boots.js +14 -0
  194. package/dist/esm/testing/assert-application-boots.js.map +1 -1
  195. package/dist/esm/utilities/drizzle-result.utility.d.ts +1 -0
  196. package/dist/esm/utilities/drizzle-result.utility.js +1 -0
  197. package/dist/esm/utilities/drizzle-result.utility.js.map +1 -1
  198. package/dist/presets/app/preset.json +4 -4
  199. package/dist/presets/lib/preset.json +3 -3
  200. package/dist/presets/shared/preset.json +1 -1
  201. package/package.json +8 -8
@@ -7,12 +7,14 @@ export declare const WHITELIST_HEADERS: readonly ["content-encoding", "cache-con
7
7
  * cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.
8
8
  */
9
9
  export declare const RENDERABLE_CONTENT_TYPES: Set<string>;
10
+ /** Storage backends a static asset controller can serve from. `isValid` checks a string against them. */
10
11
  export declare class StaticAssetStorageTypes {
11
12
  static readonly DISK = "disk";
12
13
  static readonly BUN_S3 = "bun-s3";
13
14
  static readonly SCHEME_SET: Set<string>;
14
15
  static isValid(orgType: string): boolean;
15
16
  }
17
+ /** One of the `StaticAssetStorageTypes` values. */
16
18
  export type TStaticAssetStorageType = TConstValue<typeof StaticAssetStorageTypes>;
17
19
  /** What `recreate-metalink` did: refreshed the rows of an object, or created its first one. */
18
20
  export declare class MetaLinkRecreateActions {
@@ -21,6 +23,7 @@ export declare class MetaLinkRecreateActions {
21
23
  static readonly SCHEME_SET: Set<string>;
22
24
  static isValid(value: string): boolean;
23
25
  }
26
+ /** One of the `MetaLinkRecreateActions` values. */
24
27
  export type TMetaLinkRecreateAction = TConstValue<typeof MetaLinkRecreateActions>;
25
28
  /** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */
26
29
  export declare const DEFAULT_PENDING_PREFIX = "pending/";
@@ -28,6 +28,7 @@ export const RENDERABLE_CONTENT_TYPES = new Set([
28
28
  'text/plain',
29
29
  'text/csv',
30
30
  ]);
31
+ /** Storage backends a static asset controller can serve from. `isValid` checks a string against them. */
31
32
  export class StaticAssetStorageTypes {
32
33
  static { this.DISK = 'disk'; }
33
34
  static { this.BUN_S3 = 'bun-s3'; }
@@ -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,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;;AAKH,+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;;AAKH,yHAAyH;AACzH,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;AAEjD,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\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\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\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/** 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,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,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/** 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,3 +1,4 @@
1
+ /** Container keys of the static asset component. */
1
2
  export declare class StaticAssetComponentBindingKeys {
2
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. */
3
4
  static readonly STATIC_ASSET_COMPONENT_OPTIONS = "@app/static-asset-component/options";
@@ -1,3 +1,4 @@
1
+ /** Container keys of the static asset component. */
1
2
  export class StaticAssetComponentBindingKeys {
2
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. */
3
4
  static { this.STATIC_ASSET_COMPONENT_OPTIONS = '@app/static-asset-component/options'; }
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/keys.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,+BAA+B;IAC1C,oPAAoP;aACpO,mCAA8B,GAAG,qCAAqC,CAAC","sourcesContent":["export 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,+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"]}
@@ -7,6 +7,7 @@ import type { AnyType, TValueOrAsyncResolver, ValueOrPromise } from '@venizia/ig
7
7
  import type { TMultipartStorage } from '@venizia/ignis-helpers';
8
8
  import type { TMetaLinkCompatibleSchema, TMetaLinkSchema } from '../models/index.js';
9
9
  import type { StaticAssetStorageTypes } from './constants.js';
10
+ /** Per-controller upload tuning: multipart parsing, name and link normalization, folder depth and size ceiling. */
10
11
  export type TStaticAssetExtraOptions = {
11
12
  parseMultipartBody?: {
12
13
  storage?: TMultipartStorage;
@@ -17,7 +18,11 @@ export type TStaticAssetExtraOptions = {
17
18
  file: TUploadNaming;
18
19
  }) => string;
19
20
  normalizeLinkFn?: (opts: IObjectLocation) => string;
20
- /** Maximum folder nesting depth allowed in object paths. Default: 2 */
21
+ /**
22
+ * Maximum folder nesting depth allowed in object paths.
23
+ *
24
+ * @default BaseStorageHelper.DEFAULT_MAX_FOLDER_DEPTH
25
+ */
21
26
  maxFolderDepth?: number;
22
27
  /** Largest file the UPLOAD route accepts. Absent means no ceiling. Checked against `content-length` before spooling, then per file after parsing. */
23
28
  maxBytes?: number;
@@ -36,13 +41,16 @@ export type TDefineExtraRoutes = (opts: {
36
41
  helper: IStorageHelper;
37
42
  basePath: string;
38
43
  }) => void;
44
+ /** Path parameters of the bucket routes. */
39
45
  export type TBucketParams = {
40
46
  bucketName: string;
41
47
  };
48
+ /** Path parameters of the object routes. */
42
49
  export type TObjectParams = {
43
50
  bucketName: string;
44
51
  objectName: string;
45
52
  };
53
+ /** Labels recorded on the MetaLink row of an uploaded object. */
46
54
  export type TUploadQuery = {
47
55
  principalType?: string;
48
56
  principalId?: string;
@@ -51,11 +59,13 @@ export type TUploadQuery = {
51
59
  sequence?: number;
52
60
  folderPath?: string;
53
61
  };
62
+ /** Query of the list objects route. Every value arrives as a string. */
54
63
  export type TListQuery = {
55
64
  prefix?: string;
56
65
  recursive?: string;
57
66
  maxKeys?: string;
58
67
  };
68
+ /** Enables the signed-policy upload flow, where the client posts bytes straight to the storage and IGNIS only signs the permission and verifies the commit. */
59
69
  export type TDirectUploadOptions = {
60
70
  /** Who may ask for a policy. REQUIRED, not defaulted: this route hands out a write credential, and there is no safe default for that. */
61
71
  authorize: (opts: {
@@ -65,9 +75,17 @@ export type TDirectUploadOptions = {
65
75
  secretKey: string;
66
76
  /** The ceiling the policy carries as `content-length-range`. A signed PUT cannot express this at all, which is why this is a POST policy. */
67
77
  maxBytes: number;
68
- /** Where a policy may write. The final key is NEVER in a policy, so content cannot be replaced after the commit. Default: `pending/`. */
78
+ /**
79
+ * Where a policy may write. The final key is NEVER in a policy, so content cannot be replaced after the commit.
80
+ *
81
+ * @default 'pending/'
82
+ */
69
83
  pendingPrefix?: string;
70
- /** How long a policy and its commit token stay good. Default: the helper's POST default. */
84
+ /**
85
+ * How long a policy and its commit token stay good.
86
+ *
87
+ * @default StoragePresignDefaults.POST_EXPIRES_IN
88
+ */
71
89
  expiresIn?: IDuration;
72
90
  /** Runs BEFORE the copy to the final key, so a hook that throws leaves the object under the pending prefix for a lifecycle rule to collect, rather than stranding it at the final key. */
73
91
  onCommit?: (opts: {
@@ -76,6 +94,7 @@ export type TDirectUploadOptions = {
76
94
  object: IObjectRef;
77
95
  }) => ValueOrPromise<void>;
78
96
  };
97
+ /** Body of the upload policy route: the files the client intends to upload. */
79
98
  export type TUploadPolicyRequest = {
80
99
  files: Array<{
81
100
  fileName: string;
@@ -99,9 +118,14 @@ export type TMetaLinkConfig<Schema extends TMetaLinkCompatibleSchema = TMetaLink
99
118
  };
100
119
  /** The part of a built-in route an application may change. */
101
120
  export type TStaticAssetRouteConfig = Partial<Omit<IAuthRouteConfig, 'method' | 'request' | 'responses'>> & {
102
- /** Whether this route is registered. Defaults to true. */
121
+ /**
122
+ * Whether this route is registered.
123
+ *
124
+ * @default true
125
+ */
103
126
  enabled?: boolean;
104
127
  };
128
+ /** Per-route overrides for the built-in routes of a generated asset controller. A key left out keeps that route as built. */
105
129
  export type TStaticAssetRoutes = {
106
130
  getBuckets?: TStaticAssetRouteConfig;
107
131
  getBucketByName?: TStaticAssetRouteConfig;
@@ -116,13 +140,23 @@ export type TStaticAssetRoutes = {
116
140
  uploadCommit?: TStaticAssetRouteConfig;
117
141
  recreateMetaLink?: TStaticAssetRouteConfig;
118
142
  };
143
+ /** Static asset controllers keyed by an application-chosen name. Each entry pairs a storage type with its matching helper, and `useMetaLink: true` requires a `metaLink` config. */
119
144
  export type TStaticAssetsComponentOptions<Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema> = {
120
145
  [key: string]: {
121
146
  controller: {
122
147
  name: string;
123
148
  basePath: string;
149
+ /**
150
+ * Whether `/path` and `/path/` are different routes on this controller.
151
+ *
152
+ * @default true
153
+ */
124
154
  isStrict?: boolean;
125
- /** `true` serves a raw nested object path (`/objects/photos/2024/f.jpg`) - a URL shape change; a percent-encoded path keeps working either way. Default: `false`. */
155
+ /**
156
+ * `true` serves a raw nested object path (`/objects/photos/2024/f.jpg`) - a URL shape change; a percent-encoded path keeps working either way.
157
+ *
158
+ * @default false
159
+ */
126
160
  rawObjectPath?: boolean;
127
161
  /** The single bucket every object route uses. It leaves the URL (`/objects/{objectName}`) and the four bucket-management routes are not registered. The function form is read per request, so an environment variable can be read lazily. */
128
162
  bucket?: TValueOrAsyncResolver<string>;
@@ -131,7 +165,9 @@ export type TStaticAssetsComponentOptions<Schema extends TMetaLinkCompatibleSche
131
165
  * as a 404 without calling the storage, `listObjects` lists only inside it, and an upload key
132
166
  * must land inside it: the default name is placed there, a `resolveObjectName` or
133
167
  * `extra.normalizeNameFn` key outside it is refused. `maxFolderDepth` counts the folders below
134
- * it. Absent: every key in the bucket.
168
+ * it.
169
+ *
170
+ * @default every key in the bucket
135
171
  */
136
172
  keyPrefix?: string;
137
173
  routes?: TStaticAssetRoutes;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BaseRestController, IAuthRouteConfig, TRouteContext } from '@/base';\nimport type { IDuration } from '@venizia/ignis-helpers/common';\nimport type {\n BaseRelationalEntity,\n DefaultCRUDRepository,\n TTableObject,\n} from '@venizia/ignis-connectors/postgres';\nimport type {\n DiskHelper,\n IBucketRef,\n IFileStat,\n IObjectLocation,\n IObjectRef,\n IStorageHelper,\n IUploadResult,\n TUploadNaming,\n} from '@venizia/ignis-helpers';\nimport type { BunS3Helper } from '@venizia/ignis-helpers/bun-s3';\nimport type { AnyType, TValueOrAsyncResolver, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { TMultipartStorage } from '@venizia/ignis-helpers';\nimport type { TMetaLinkCompatibleSchema, TMetaLinkSchema } from '../models';\nimport type { StaticAssetStorageTypes } from './constants';\n\nexport type TStaticAssetExtraOptions = {\n parseMultipartBody?: {\n storage?: TMultipartStorage;\n uploadDir?: string;\n };\n\n /** `folderPath` carries the upload query's target folder - dropping it flattens nested uploads. */\n normalizeNameFn?: (opts: { file: TUploadNaming }) => string;\n normalizeLinkFn?: (opts: IObjectLocation) => string;\n\n /** Maximum folder nesting depth allowed in object paths. Default: 2 */\n maxFolderDepth?: number;\n\n /** Largest file the UPLOAD route accepts. Absent means no ceiling. Checked against `content-length` before spooling, then per file after parsing. */\n maxBytes?: number;\n [key: string]: AnyType;\n};\n\n/** Decides the key one uploaded file is stored under. `defaultKey` is what IGNIS would have written. */\nexport type TObjectNameResolver = (opts: {\n bucket: IBucketRef;\n file: TUploadNaming;\n defaultKey: string;\n}) => string;\n\n/** Adds routes of the application's own to a generated asset controller. Runs after every built-in route, so a built-in route always wins a path collision. `basePath` is the mount path with exactly one leading slash. */\n/** Adds routes of the application's own. Registration order decides a path collision, so the same shape serves both the before and the after hook. */\nexport type TDefineExtraRoutes = (opts: {\n controller: BaseRestController;\n helper: IStorageHelper;\n basePath: string;\n}) => void;\n\n// Declared by hand rather than inferred: RouteHandler inference here is heavy.\nexport type TBucketParams = { bucketName: string };\nexport type TObjectParams = { bucketName: string; objectName: string };\nexport type TUploadQuery = {\n principalType?: string;\n principalId?: string;\n variant?: string;\n /** Display order within the principal. Caller-supplied: deriving it would be a non-atomic read of `max(sequence)` then a write of `max + 1`. */\n sequence?: number;\n folderPath?: string;\n};\nexport type TListQuery = { prefix?: string; recursive?: string; maxKeys?: string };\n\nexport type TDirectUploadOptions = {\n /** Who may ask for a policy. REQUIRED, not defaulted: this route hands out a write credential, and there is no safe default for that. */\n authorize: (opts: { context: TRouteContext }) => ValueOrPromise<boolean>;\n\n /** Signs the commit token. Keep it out of the repository and out of the client. */\n secretKey: string;\n\n /** The ceiling the policy carries as `content-length-range`. A signed PUT cannot express this at all, which is why this is a POST policy. */\n maxBytes: number;\n\n /** Where a policy may write. The final key is NEVER in a policy, so content cannot be replaced after the commit. Default: `pending/`. */\n pendingPrefix?: string;\n\n /** How long a policy and its commit token stay good. Default: the helper's POST default. */\n expiresIn?: IDuration;\n\n /** Runs BEFORE the copy to the final key, so a hook that throws leaves the object under the pending prefix for a lifecycle rule to collect, rather than stranding it at the final key. */\n onCommit?: (opts: {\n bucket: IBucketRef;\n pendingObject: IObjectRef;\n object: IObjectRef;\n }) => ValueOrPromise<void>;\n};\n\nexport type TUploadPolicyRequest = {\n files: Array<{ fileName: string; contentType?: string; size?: number }>;\n};\n\n/** The MetaLink table belongs to the application. `Schema` defaults to the table IGNIS ships, and widens to any table whose row carries the same fields. */\nexport type TMetaLinkConfig<Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema> = {\n model: TValueOrAsyncResolver<typeof BaseRelationalEntity<Schema>>;\n repository: TValueOrAsyncResolver<DefaultCRUDRepository<Schema>>;\n createMetaLink?: (opts: {\n uploadResult: IUploadResult;\n fileStat: IFileStat;\n /** The caller's labels. Named for where they used to travel - they arrive in the request BODY now, as form fields on an upload and beside the commit token on a direct one. */\n query: TUploadQuery;\n }) => ValueOrPromise<{ count: number; data: TTableObject<Schema> }>;\n};\n\n/** The part of a built-in route an application may change. */\nexport type TStaticAssetRouteConfig = Partial<\n Omit<IAuthRouteConfig, 'method' | 'request' | 'responses'>\n> & {\n /** Whether this route is registered. Defaults to true. */\n enabled?: boolean;\n};\n\nexport type TStaticAssetRoutes = {\n getBuckets?: TStaticAssetRouteConfig;\n getBucketByName?: TStaticAssetRouteConfig;\n createBucket?: TStaticAssetRouteConfig;\n deleteBucket?: TStaticAssetRouteConfig;\n\n upload?: TStaticAssetRouteConfig;\n listObjects?: TStaticAssetRouteConfig;\n deleteObject?: TStaticAssetRouteConfig;\n getObjectByName?: TStaticAssetRouteConfig;\n downloadObjectByName?: TStaticAssetRouteConfig;\n\n uploadPolicy?: TStaticAssetRouteConfig;\n uploadCommit?: TStaticAssetRouteConfig;\n\n recreateMetaLink?: TStaticAssetRouteConfig;\n};\n\nexport type TStaticAssetsComponentOptions<\n Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema,\n> = {\n [key: string]: {\n controller: {\n name: string;\n basePath: string;\n isStrict?: boolean;\n\n /** `true` serves a raw nested object path (`/objects/photos/2024/f.jpg`) - a URL shape change; a percent-encoded path keeps working either way. Default: `false`. */\n rawObjectPath?: boolean;\n\n /** The single bucket every object route uses. It leaves the URL (`/objects/{objectName}`) and the four bucket-management routes are not registered. The function form is read per request, so an environment variable can be read lazily. */\n bucket?: TValueOrAsyncResolver<string>;\n\n /**\n * The key scope this controller owns, e.g. `inventory/`. Every route refuses a key outside it\n * as a 404 without calling the storage, `listObjects` lists only inside it, and an upload key\n * must land inside it: the default name is placed there, a `resolveObjectName` or\n * `extra.normalizeNameFn` key outside it is refused. `maxFolderDepth` counts the folders below\n * it. Absent: every key in the bucket.\n */\n keyPrefix?: string;\n\n routes?: TStaticAssetRoutes;\n\n /** Direct upload: the browser posts the bytes to the storage and IGNIS only signs the permission. Absent leaves both routes unregistered. Requires `bucket` - a policy names one bucket, and a bucket in the URL is a bucket the caller chooses. */\n directUpload?: TDirectUploadOptions;\n };\n extra?: TStaticAssetExtraOptions;\n\n /** Decides the stored object name of each uploaded file; absent keeps the storage helper's own naming. */\n resolveObjectName?: TObjectNameResolver;\n\n /** Registers the application's own routes BEFORE every built-in one, so a literal path wins over the catch-all `rawObjectPath` produces. Hono matches in registration order. */\n defineRoutesBefore?: TDefineExtraRoutes;\n\n /** Registers the application's own routes on the generated controller, after every built-in one. */\n defineExtraRoutes?: TDefineExtraRoutes;\n } & (\n | { storage: typeof StaticAssetStorageTypes.BUN_S3; helper: BunS3Helper }\n | { storage: typeof StaticAssetStorageTypes.DISK; helper: DiskHelper }\n ) &\n (\n | { useMetaLink?: false | undefined }\n | { useMetaLink: true; metaLink: TMetaLinkConfig<Schema> }\n );\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BaseRestController, IAuthRouteConfig, TRouteContext } from '@/base';\nimport type { IDuration } from '@venizia/ignis-helpers/common';\nimport type {\n BaseRelationalEntity,\n DefaultCRUDRepository,\n TTableObject,\n} from '@venizia/ignis-connectors/postgres';\nimport type {\n DiskHelper,\n IBucketRef,\n IFileStat,\n IObjectLocation,\n IObjectRef,\n IStorageHelper,\n IUploadResult,\n TUploadNaming,\n} from '@venizia/ignis-helpers';\nimport type { BunS3Helper } from '@venizia/ignis-helpers/bun-s3';\nimport type { AnyType, TValueOrAsyncResolver, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { TMultipartStorage } from '@venizia/ignis-helpers';\nimport type { TMetaLinkCompatibleSchema, TMetaLinkSchema } from '../models';\nimport type { StaticAssetStorageTypes } from './constants';\n\n/** Per-controller upload tuning: multipart parsing, name and link normalization, folder depth and size ceiling. */\nexport type TStaticAssetExtraOptions = {\n parseMultipartBody?: {\n storage?: TMultipartStorage;\n uploadDir?: string;\n };\n\n /** `folderPath` carries the upload query's target folder - dropping it flattens nested uploads. */\n normalizeNameFn?: (opts: { file: TUploadNaming }) => string;\n normalizeLinkFn?: (opts: IObjectLocation) => string;\n\n /**\n * Maximum folder nesting depth allowed in object paths.\n *\n * @default BaseStorageHelper.DEFAULT_MAX_FOLDER_DEPTH\n */\n maxFolderDepth?: number;\n\n /** Largest file the UPLOAD route accepts. Absent means no ceiling. Checked against `content-length` before spooling, then per file after parsing. */\n maxBytes?: number;\n [key: string]: AnyType;\n};\n\n/** Decides the key one uploaded file is stored under. `defaultKey` is what IGNIS would have written. */\nexport type TObjectNameResolver = (opts: {\n bucket: IBucketRef;\n file: TUploadNaming;\n defaultKey: string;\n}) => string;\n\n/** Adds routes of the application's own to a generated asset controller. Runs after every built-in route, so a built-in route always wins a path collision. `basePath` is the mount path with exactly one leading slash. */\n/** Adds routes of the application's own. Registration order decides a path collision, so the same shape serves both the before and the after hook. */\nexport type TDefineExtraRoutes = (opts: {\n controller: BaseRestController;\n helper: IStorageHelper;\n basePath: string;\n}) => void;\n\n// Declared by hand rather than inferred: RouteHandler inference here is heavy.\n/** Path parameters of the bucket routes. */\nexport type TBucketParams = { bucketName: string };\n/** Path parameters of the object routes. */\nexport type TObjectParams = { bucketName: string; objectName: string };\n/** Labels recorded on the MetaLink row of an uploaded object. */\nexport type TUploadQuery = {\n principalType?: string;\n principalId?: string;\n variant?: string;\n /** Display order within the principal. Caller-supplied: deriving it would be a non-atomic read of `max(sequence)` then a write of `max + 1`. */\n sequence?: number;\n folderPath?: string;\n};\n/** Query of the list objects route. Every value arrives as a string. */\nexport type TListQuery = { prefix?: string; recursive?: string; maxKeys?: string };\n\n/** Enables the signed-policy upload flow, where the client posts bytes straight to the storage and IGNIS only signs the permission and verifies the commit. */\nexport type TDirectUploadOptions = {\n /** Who may ask for a policy. REQUIRED, not defaulted: this route hands out a write credential, and there is no safe default for that. */\n authorize: (opts: { context: TRouteContext }) => ValueOrPromise<boolean>;\n\n /** Signs the commit token. Keep it out of the repository and out of the client. */\n secretKey: string;\n\n /** The ceiling the policy carries as `content-length-range`. A signed PUT cannot express this at all, which is why this is a POST policy. */\n maxBytes: number;\n\n /**\n * Where a policy may write. The final key is NEVER in a policy, so content cannot be replaced after the commit.\n *\n * @default 'pending/'\n */\n pendingPrefix?: string;\n\n /**\n * How long a policy and its commit token stay good.\n *\n * @default StoragePresignDefaults.POST_EXPIRES_IN\n */\n expiresIn?: IDuration;\n\n /** Runs BEFORE the copy to the final key, so a hook that throws leaves the object under the pending prefix for a lifecycle rule to collect, rather than stranding it at the final key. */\n onCommit?: (opts: {\n bucket: IBucketRef;\n pendingObject: IObjectRef;\n object: IObjectRef;\n }) => ValueOrPromise<void>;\n};\n\n/** Body of the upload policy route: the files the client intends to upload. */\nexport type TUploadPolicyRequest = {\n files: Array<{ fileName: string; contentType?: string; size?: number }>;\n};\n\n/** The MetaLink table belongs to the application. `Schema` defaults to the table IGNIS ships, and widens to any table whose row carries the same fields. */\nexport type TMetaLinkConfig<Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema> = {\n model: TValueOrAsyncResolver<typeof BaseRelationalEntity<Schema>>;\n repository: TValueOrAsyncResolver<DefaultCRUDRepository<Schema>>;\n createMetaLink?: (opts: {\n uploadResult: IUploadResult;\n fileStat: IFileStat;\n /** The caller's labels. Named for where they used to travel - they arrive in the request BODY now, as form fields on an upload and beside the commit token on a direct one. */\n query: TUploadQuery;\n }) => ValueOrPromise<{ count: number; data: TTableObject<Schema> }>;\n};\n\n/** The part of a built-in route an application may change. */\nexport type TStaticAssetRouteConfig = Partial<\n Omit<IAuthRouteConfig, 'method' | 'request' | 'responses'>\n> & {\n /**\n * Whether this route is registered.\n *\n * @default true\n */\n enabled?: boolean;\n};\n\n/** Per-route overrides for the built-in routes of a generated asset controller. A key left out keeps that route as built. */\nexport type TStaticAssetRoutes = {\n getBuckets?: TStaticAssetRouteConfig;\n getBucketByName?: TStaticAssetRouteConfig;\n createBucket?: TStaticAssetRouteConfig;\n deleteBucket?: TStaticAssetRouteConfig;\n\n upload?: TStaticAssetRouteConfig;\n listObjects?: TStaticAssetRouteConfig;\n deleteObject?: TStaticAssetRouteConfig;\n getObjectByName?: TStaticAssetRouteConfig;\n downloadObjectByName?: TStaticAssetRouteConfig;\n\n uploadPolicy?: TStaticAssetRouteConfig;\n uploadCommit?: TStaticAssetRouteConfig;\n\n recreateMetaLink?: TStaticAssetRouteConfig;\n};\n\n/** Static asset controllers keyed by an application-chosen name. Each entry pairs a storage type with its matching helper, and `useMetaLink: true` requires a `metaLink` config. */\nexport type TStaticAssetsComponentOptions<\n Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema,\n> = {\n [key: string]: {\n controller: {\n name: string;\n basePath: string;\n\n /**\n * Whether `/path` and `/path/` are different routes on this controller.\n *\n * @default true\n */\n isStrict?: boolean;\n\n /**\n * `true` serves a raw nested object path (`/objects/photos/2024/f.jpg`) - a URL shape change; a percent-encoded path keeps working either way.\n *\n * @default false\n */\n rawObjectPath?: boolean;\n\n /** The single bucket every object route uses. It leaves the URL (`/objects/{objectName}`) and the four bucket-management routes are not registered. The function form is read per request, so an environment variable can be read lazily. */\n bucket?: TValueOrAsyncResolver<string>;\n\n /**\n * The key scope this controller owns, e.g. `inventory/`. Every route refuses a key outside it\n * as a 404 without calling the storage, `listObjects` lists only inside it, and an upload key\n * must land inside it: the default name is placed there, a `resolveObjectName` or\n * `extra.normalizeNameFn` key outside it is refused. `maxFolderDepth` counts the folders below\n * it.\n *\n * @default every key in the bucket\n */\n keyPrefix?: string;\n\n routes?: TStaticAssetRoutes;\n\n /** Direct upload: the browser posts the bytes to the storage and IGNIS only signs the permission. Absent leaves both routes unregistered. Requires `bucket` - a policy names one bucket, and a bucket in the URL is a bucket the caller chooses. */\n directUpload?: TDirectUploadOptions;\n };\n extra?: TStaticAssetExtraOptions;\n\n /** Decides the stored object name of each uploaded file; absent keeps the storage helper's own naming. */\n resolveObjectName?: TObjectNameResolver;\n\n /** Registers the application's own routes BEFORE every built-in one, so a literal path wins over the catch-all `rawObjectPath` produces. Hono matches in registration order. */\n defineRoutesBefore?: TDefineExtraRoutes;\n\n /** Registers the application's own routes on the generated controller, after every built-in one. */\n defineExtraRoutes?: TDefineExtraRoutes;\n } & (\n | { storage: typeof StaticAssetStorageTypes.BUN_S3; helper: BunS3Helper }\n | { storage: typeof StaticAssetStorageTypes.DISK; helper: DiskHelper }\n ) &\n (\n | { useMetaLink?: false | undefined }\n | { useMetaLink: true; metaLink: TMetaLinkConfig<Schema> }\n );\n};\n"]}
@@ -5,6 +5,7 @@ import type { AnyType } from '@venizia/ignis-helpers/common';
5
5
  import { BaseHelper } from '@venizia/ignis-helpers/core';
6
6
  import { type Env } from 'hono';
7
7
  import { type TDefineExtraRoutes, type TMetaLinkConfig, type TObjectNameResolver, type TStaticAssetExtraOptions, type TStaticAssetsComponentOptions, type TStaticAssetStorageType } from '../common/index.js';
8
+ /** Input of `AssetControllerFactory.defineAssetController`: one entry of `TStaticAssetsComponentOptions` with its storage type and helper. */
8
9
  export interface IAssetControllerOptions {
9
10
  controller: TStaticAssetsComponentOptions[string]['controller'];
10
11
  storage: TStaticAssetStorageType;
@@ -24,6 +25,7 @@ export interface IAssetControllerOptions {
24
25
  /** The upload labels, read off the multipart form. Every value arrives as text, so `sequence` is the one that needs converting. */
25
26
  /** One list: the reader below and the stale-caller warning must agree. */
26
27
  declare const UPLOAD_LABEL_NAMES: readonly ["principalType", "principalId", "variant", "sequence", "folderPath"];
28
+ /** Builds the REST controller class for a static asset entry. Static helpers also expose label checking, object link building and served content type resolution. */
27
29
  export declare class AssetControllerFactory extends BaseHelper {
28
30
  constructor();
29
31
  /** Names any label a caller put in the query - where the upload routes refuse it. */
@@ -120,6 +120,7 @@ const applyMetadataHeaders = ({ ctx, metadata }) => {
120
120
  ctx.header(key.toLowerCase(), String(value).replace(/[\r\n]/g, ''));
121
121
  });
122
122
  };
123
+ /** Builds the REST controller class for a static asset entry. Static helpers also expose label checking, object link building and served content type resolution. */
123
124
  export class AssetControllerFactory extends BaseHelper {
124
125
  constructor() {
125
126
  super({ scope: AssetControllerFactory.name });