@dimah-s3/server 1.7.1 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.md +72 -16
  2. package/dist/adapters/express.d.ts +7 -7
  3. package/dist/adapters/express.d.ts.map +1 -1
  4. package/dist/adapters/express.js +94 -94
  5. package/dist/adapters/express.js.map +1 -1
  6. package/dist/adapters/fastify.d.ts +11 -5
  7. package/dist/adapters/fastify.d.ts.map +1 -1
  8. package/dist/adapters/fastify.js +94 -94
  9. package/dist/adapters/fastify.js.map +1 -1
  10. package/dist/adapters/node.d.ts +20 -3
  11. package/dist/adapters/node.d.ts.map +1 -1
  12. package/dist/adapters/node.js +92 -92
  13. package/dist/adapters/node.js.map +1 -1
  14. package/dist/api/context.d.ts +8 -4
  15. package/dist/api/context.d.ts.map +1 -1
  16. package/dist/api/{routes/index.d.ts → core-endpoints.d.ts} +43 -68
  17. package/dist/api/core-endpoints.d.ts.map +1 -0
  18. package/dist/api/create-s3-endpoint.d.ts +70 -48
  19. package/dist/api/create-s3-endpoint.d.ts.map +1 -1
  20. package/dist/api/create-s3-middleware.d.ts +19 -16
  21. package/dist/api/create-s3-middleware.d.ts.map +1 -1
  22. package/dist/api/router-context.d.ts +23 -0
  23. package/dist/api/router-context.d.ts.map +1 -0
  24. package/dist/api/router.d.ts +15 -5
  25. package/dist/api/router.d.ts.map +1 -1
  26. package/dist/config/feature-toggle.d.ts +16 -0
  27. package/dist/config/feature-toggle.d.ts.map +1 -0
  28. package/dist/config/resolve-config.d.ts +9 -0
  29. package/dist/config/resolve-config.d.ts.map +1 -0
  30. package/dist/config/resolve-routes.d.ts +37 -0
  31. package/dist/config/resolve-routes.d.ts.map +1 -0
  32. package/dist/dimah-s3.d.ts +22 -32
  33. package/dist/dimah-s3.d.ts.map +1 -1
  34. package/dist/helpers/authorize-download.d.ts +25 -0
  35. package/dist/helpers/authorize-download.d.ts.map +1 -0
  36. package/dist/helpers/aws-errors.d.ts +16 -0
  37. package/dist/helpers/aws-errors.d.ts.map +1 -0
  38. package/dist/helpers/best-effort.d.ts +22 -3
  39. package/dist/helpers/best-effort.d.ts.map +1 -1
  40. package/dist/helpers/checksum-config.d.ts +13 -0
  41. package/dist/helpers/checksum-config.d.ts.map +1 -0
  42. package/dist/helpers/constraints.d.ts +17 -12
  43. package/dist/helpers/constraints.d.ts.map +1 -1
  44. package/dist/helpers/error-boundary.d.ts +28 -0
  45. package/dist/helpers/error-boundary.d.ts.map +1 -0
  46. package/dist/helpers/finalize-confirmed.d.ts +42 -13
  47. package/dist/helpers/finalize-confirmed.d.ts.map +1 -1
  48. package/dist/helpers/head-object.d.ts +6 -9
  49. package/dist/helpers/head-object.d.ts.map +1 -1
  50. package/dist/helpers/hooks.d.ts +29 -15
  51. package/dist/helpers/hooks.d.ts.map +1 -1
  52. package/dist/helpers/inline-types.d.ts +24 -7
  53. package/dist/helpers/inline-types.d.ts.map +1 -1
  54. package/dist/helpers/list-parts.d.ts +4 -6
  55. package/dist/helpers/list-parts.d.ts.map +1 -1
  56. package/dist/helpers/metadata-encoding.d.ts +15 -0
  57. package/dist/helpers/metadata-encoding.d.ts.map +1 -0
  58. package/dist/helpers/object-meta.d.ts +39 -0
  59. package/dist/helpers/object-meta.d.ts.map +1 -0
  60. package/dist/helpers/object-s3.d.ts +5 -2
  61. package/dist/helpers/object-s3.d.ts.map +1 -1
  62. package/dist/helpers/open-target.d.ts +89 -0
  63. package/dist/helpers/open-target.d.ts.map +1 -0
  64. package/dist/helpers/part-layout.d.ts +19 -0
  65. package/dist/helpers/part-layout.d.ts.map +1 -0
  66. package/dist/helpers/presign.d.ts +54 -0
  67. package/dist/helpers/presign.d.ts.map +1 -0
  68. package/dist/helpers/request.d.ts +6 -11
  69. package/dist/helpers/request.d.ts.map +1 -1
  70. package/dist/helpers/resolve-target.d.ts +28 -20
  71. package/dist/helpers/resolve-target.d.ts.map +1 -1
  72. package/dist/helpers/sniff-object.d.ts +22 -0
  73. package/dist/helpers/sniff-object.d.ts.map +1 -0
  74. package/dist/helpers/ticket.d.ts +75 -0
  75. package/dist/helpers/ticket.d.ts.map +1 -0
  76. package/dist/index.d.ts +4 -12
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +2647 -1579
  79. package/dist/index.js.map +1 -1
  80. package/dist/operations/catalog.d.ts +16 -0
  81. package/dist/operations/catalog.d.ts.map +1 -0
  82. package/dist/operations/confirm.d.ts +19 -0
  83. package/dist/operations/confirm.d.ts.map +1 -0
  84. package/dist/operations/delete-many.d.ts +18 -0
  85. package/dist/operations/delete-many.d.ts.map +1 -0
  86. package/dist/operations/delete.d.ts +14 -0
  87. package/dist/operations/delete.d.ts.map +1 -0
  88. package/dist/operations/download.d.ts +20 -0
  89. package/dist/operations/download.d.ts.map +1 -0
  90. package/dist/operations/file.d.ts +38 -0
  91. package/dist/operations/file.d.ts.map +1 -0
  92. package/dist/operations/multipart/abort.d.ts +20 -0
  93. package/dist/operations/multipart/abort.d.ts.map +1 -0
  94. package/dist/operations/multipart/complete.d.ts +21 -0
  95. package/dist/operations/multipart/complete.d.ts.map +1 -0
  96. package/dist/operations/multipart/init.d.ts +19 -0
  97. package/dist/operations/multipart/init.d.ts.map +1 -0
  98. package/dist/operations/multipart/list-parts.d.ts +11 -0
  99. package/dist/operations/multipart/list-parts.d.ts.map +1 -0
  100. package/dist/operations/multipart/open-multipart.d.ts +25 -0
  101. package/dist/operations/multipart/open-multipart.d.ts.map +1 -0
  102. package/dist/operations/multipart/sign-part.d.ts +20 -0
  103. package/dist/operations/multipart/sign-part.d.ts.map +1 -0
  104. package/dist/operations/put.d.ts +18 -0
  105. package/dist/operations/put.d.ts.map +1 -0
  106. package/dist/operations/run-operation.d.ts +18 -0
  107. package/dist/operations/run-operation.d.ts.map +1 -0
  108. package/dist/operations/s3-api.d.ts +12 -0
  109. package/dist/operations/s3-api.d.ts.map +1 -0
  110. package/dist/operations/upload.d.ts +19 -0
  111. package/dist/operations/upload.d.ts.map +1 -0
  112. package/dist/plugin/apply-plugins.d.ts +9 -11
  113. package/dist/plugin/apply-plugins.d.ts.map +1 -1
  114. package/dist/plugin/chain-hooks.d.ts +12 -9
  115. package/dist/plugin/chain-hooks.d.ts.map +1 -1
  116. package/dist/plugin/define-plugin.d.ts +11 -4
  117. package/dist/plugin/define-plugin.d.ts.map +1 -1
  118. package/dist/plugin/index.d.ts +1 -2
  119. package/dist/plugin/index.d.ts.map +1 -1
  120. package/dist/plugin/types.d.ts +52 -56
  121. package/dist/plugin/types.d.ts.map +1 -1
  122. package/dist/plugins.d.ts +10 -8
  123. package/dist/plugins.d.ts.map +1 -1
  124. package/dist/plugins.js +325 -1627
  125. package/dist/plugins.js.map +1 -1
  126. package/dist/route.d.ts +0 -1
  127. package/dist/route.d.ts.map +1 -1
  128. package/dist/types/config.d.ts +171 -172
  129. package/dist/types/config.d.ts.map +1 -1
  130. package/dist/types/hook-contexts.d.ts +139 -147
  131. package/dist/types/hook-contexts.d.ts.map +1 -1
  132. package/dist/types/index.d.ts +3 -3
  133. package/dist/types/index.d.ts.map +1 -1
  134. package/dist/types/locals.d.ts +37 -0
  135. package/dist/types/locals.d.ts.map +1 -0
  136. package/dist/types/resolved.d.ts +118 -0
  137. package/dist/types/resolved.d.ts.map +1 -0
  138. package/package.json +8 -12
  139. package/dist/api/bind-endpoints.d.ts +0 -12
  140. package/dist/api/bind-endpoints.d.ts.map +0 -1
  141. package/dist/api/index.d.ts +0 -6
  142. package/dist/api/index.d.ts.map +0 -1
  143. package/dist/api/index.js +0 -1353
  144. package/dist/api/index.js.map +0 -1
  145. package/dist/api/routes/catalog.d.ts +0 -9
  146. package/dist/api/routes/catalog.d.ts.map +0 -1
  147. package/dist/api/routes/confirm.d.ts +0 -13
  148. package/dist/api/routes/confirm.d.ts.map +0 -1
  149. package/dist/api/routes/delete-batch.d.ts +0 -14
  150. package/dist/api/routes/delete-batch.d.ts.map +0 -1
  151. package/dist/api/routes/delete.d.ts +0 -26
  152. package/dist/api/routes/delete.d.ts.map +0 -1
  153. package/dist/api/routes/download.d.ts +0 -21
  154. package/dist/api/routes/download.d.ts.map +0 -1
  155. package/dist/api/routes/file.d.ts +0 -20
  156. package/dist/api/routes/file.d.ts.map +0 -1
  157. package/dist/api/routes/index.d.ts.map +0 -1
  158. package/dist/api/routes/multipart/abort.d.ts +0 -16
  159. package/dist/api/routes/multipart/abort.d.ts.map +0 -1
  160. package/dist/api/routes/multipart/complete.d.ts +0 -22
  161. package/dist/api/routes/multipart/complete.d.ts.map +0 -1
  162. package/dist/api/routes/multipart/init.d.ts +0 -22
  163. package/dist/api/routes/multipart/init.d.ts.map +0 -1
  164. package/dist/api/routes/multipart/list-parts.d.ts +0 -17
  165. package/dist/api/routes/multipart/list-parts.d.ts.map +0 -1
  166. package/dist/api/routes/multipart/part.d.ts +0 -20
  167. package/dist/api/routes/multipart/part.d.ts.map +0 -1
  168. package/dist/api/routes/upload.d.ts +0 -22
  169. package/dist/api/routes/upload.d.ts.map +0 -1
  170. package/dist/errors.d.ts +0 -23
  171. package/dist/errors.d.ts.map +0 -1
  172. package/dist/helpers/expires.d.ts +0 -21
  173. package/dist/helpers/expires.d.ts.map +0 -1
  174. package/dist/helpers/features.d.ts +0 -17
  175. package/dist/helpers/features.d.ts.map +0 -1
  176. package/dist/helpers/index.d.ts +0 -19
  177. package/dist/helpers/index.d.ts.map +0 -1
  178. package/dist/helpers/is-aws-not-found.d.ts +0 -5
  179. package/dist/helpers/is-aws-not-found.d.ts.map +0 -1
  180. package/dist/helpers/previous-key.d.ts +0 -5
  181. package/dist/helpers/previous-key.d.ts.map +0 -1
  182. package/dist/helpers/resolve-route.d.ts +0 -33
  183. package/dist/helpers/resolve-route.d.ts.map +0 -1
  184. package/dist/plugin/hook-registry.d.ts +0 -21
  185. package/dist/plugin/hook-registry.d.ts.map +0 -1
  186. package/dist/put.d.ts +0 -15
  187. package/dist/put.d.ts.map +0 -1
@@ -1,86 +1,82 @@
1
1
  import type { Endpoint } from "better-call";
2
- import type { DeleteConfig, DownloadConfig, MultipartConfig, UploadConfig, DimahS3Config, ResolvedDimahS3Config } from "../types/config.js";
3
- import type { FeatureHookKeyMap, MultipartHookKey } from "./hook-registry";
4
- type HookFields<T, K extends keyof T> = Pick<T, K>;
2
+ import type { DeleteConfig, DimahS3Config, DimahS3Logger, DownloadConfig, MultipartConfig, TicketSubject, UploadConfig } from "../types/config.js";
3
+ import type { GuardContext } from "../types/hook-contexts.js";
4
+ import type { Guard } from "../types/locals.js";
5
5
  /**
6
- * Hook fields a plugin may contribute. Scalars like `method` /
7
- * `object` / `acl` stay user-owned on the route `upload` feature.
8
- * Keys come from {@link FEATURE_HOOK_KEYS} / {@link MULTIPART_HOOK_KEYS}.
6
+ * Hooks a plugin adds. Plugin hooks run before the user's hook for the same
7
+ * slot, in plugin order, for guards and lifecycle hooks alike. A route that
8
+ * sets `plugins: { [id]: false }` skips the plugin's route hooks.
9
9
  */
10
10
  export type DimahS3PluginHooks = {
11
- guard?: DimahS3Config["guard"];
12
- upload?: HookFields<UploadConfig, FeatureHookKeyMap["upload"][number]> & {
13
- multipart?: HookFields<MultipartConfig, MultipartHookKey>;
11
+ /** Runs before every operation, before the user's instance guard. */
12
+ guard?: Guard<GuardContext>;
13
+ /**
14
+ * Binds upload tickets to a subject when the config sets no
15
+ * `ticketSubject`. The first plugin that provides one is used.
16
+ */
17
+ ticketSubject?: TicketSubject;
18
+ upload?: Pick<UploadConfig, "guard" | "onStart" | "confirmGuard" | "onConfirmed"> & {
19
+ multipart?: Pick<MultipartConfig, "guard" | "onAbort">;
14
20
  };
15
- download?: HookFields<DownloadConfig, FeatureHookKeyMap["download"][number]>;
16
- delete?: HookFields<DeleteConfig, FeatureHookKeyMap["delete"][number]>;
21
+ download?: Pick<DownloadConfig, "guard" | "onPresigned">;
22
+ delete?: Pick<DeleteConfig, "guard" | "onDeleted">;
17
23
  };
18
- /**
19
- * Environment passed to {@link DimahS3Plugin.init}.
20
- * Config is pre-merge (user config only) — use `isFeatureOn` for
21
- * feature-flag checks. Routes are already validated before `init` runs.
22
- */
24
+ /** What {@link DimahS3Plugin.init} receives. */
23
25
  export type PluginInitEnv = {
24
- /** User config before plugin hooks are merged — read-only. */
26
+ /** The user config. The routes are already validated. */
25
27
  config: Readonly<DimahS3Config>;
26
- /** Lookup another registered plugin by id. */
28
+ /** Looks up a registered plugin by id. */
27
29
  getPlugin: (id: string) => DimahS3Plugin | undefined;
30
+ /**
31
+ * This plugin's options for a route (`routes[route].plugins[id]`).
32
+ * `false` means the route turned the plugin off, and `undefined` means the
33
+ * route sets nothing or does not exist.
34
+ */
35
+ routeOptions: <T extends object>(route: string) => T | false | undefined;
36
+ /** The instance logger. */
37
+ logger: DimahS3Logger;
28
38
  };
29
39
  /**
30
- * Server plugin contract. Feature packages (e.g. `@dimah-s3/db`) return
31
- * these from factories like `db()` / `definePlugin()`.
40
+ * A server plugin, such as `db()` from `@dimah-s3/db`. Build one with
41
+ * `definePlugin` so its `id` and `context` types are kept.
32
42
  *
33
- * @typeParam Id — unique plugin id; becomes the key on `s3.context` and the
34
- * flattened instance (`s3[id]`).
35
- * @typeParam TContext — exposed on `s3.context[id]` and `s3[id]` after
36
- * `dimahS3()`.
37
- * @typeParam TEndpoints — better-call endpoints merged onto `s3.api`.
43
+ * @typeParam Id - The plugin id. It keys `s3.context` and the instance
44
+ * (`s3[id]`).
45
+ * @typeParam TContext - The value on `s3.context[id]` and `s3[id]`.
38
46
  */
39
- export type DimahS3Plugin<Id extends string = string, TContext extends Record<string, unknown> = Record<string, unknown>, TEndpoints extends Record<string, Endpoint> = Record<string, Endpoint>> = {
40
- /** Unique id — duplicate ids throw at init. */
47
+ export type DimahS3Plugin<Id extends string = string, TContext extends Record<string, unknown> = Record<string, unknown>> = {
48
+ /** Unique id. A duplicate or an instance key such as `api` throws. */
41
49
  id: Id;
42
50
  /**
43
- * Other plugin ids that must be registered. Validated when `dimahS3()`
44
- * runs — missing deps throw with a clear message.
45
- * Merge order remains plugins-array order (not topological).
51
+ * Ids of plugins that must be registered too. A missing or circular
52
+ * dependency throws at `dimahS3()`. Hooks still run in plugin order.
46
53
  */
47
54
  dependsOn?: readonly string[];
48
55
  /**
49
- * Runs once after the context map is built and before hooks are merged.
50
- * Synchronous so `dimahS3()` stays a sync factory — validate options /
51
- * required feature flags here.
56
+ * Runs once at `dimahS3()`, in plugin order, after the routes are
57
+ * validated. Throw here to reject the config. It must be synchronous:
58
+ * returning a promise throws.
52
59
  */
53
60
  init?: (env: PluginInitEnv) => void;
54
- /** Lifecycle / guard hooks merged ahead of user config hooks. */
55
61
  hooks?: DimahS3PluginHooks;
56
62
  /**
57
- * Extra HTTP routes on the shared handler. Use {@link createS3Endpoint}.
58
- * Paths are absolute under `basePath` (e.g. `/db/objects`).
63
+ * HTTP endpoints mounted on the handler under `basePath`. Build them with
64
+ * `createS3Endpoint`. They are not added to `s3.api`.
59
65
  */
60
- endpoints?: TEndpoints;
61
- /** Opaque context keyed by `id` on the dimahS3 instance. */
66
+ endpoints?: Record<string, Endpoint>;
67
+ /** Exposed on `s3.context[id]` and `s3[id]`. */
62
68
  context?: TContext;
63
69
  };
64
- export type AppliedPlugins<C extends Record<string, unknown> = Record<string, unknown>, E extends Record<string, Endpoint> = Record<string, Endpoint>> = {
65
- /** Config with plugin hooks chained ahead of user hooks. */
66
- config: ResolvedDimahS3Config;
70
+ /** Plugin ids mapped to their `context` types. */
71
+ export type PluginContextMap<P extends readonly DimahS3Plugin[]> = {
72
+ [K in P[number] as K["id"]]: K extends DimahS3Plugin<string, infer Ctx> ? Ctx : never;
73
+ };
74
+ /** What `applyPlugins` returns to `dimahS3()`. */
75
+ export type AppliedPlugins<C> = {
67
76
  /** Plugin contexts keyed by plugin id. */
68
77
  context: C;
69
78
  getPlugin: (id: string) => DimahS3Plugin | undefined;
70
- /** Plugin HTTP endpoints merged onto `s3.api` and the router. */
71
- endpoints: E;
72
- };
73
- /** Map plugin ids → their `context` types. */
74
- export type PluginContextMap<P extends readonly DimahS3Plugin[]> = {
75
- [K in P[number] as K["id"]]: K extends DimahS3Plugin<string, infer Ctx> ? Ctx : never;
79
+ /** Every plugin endpoint, keyed by name, to mount beside the core ones. */
80
+ endpoints: Record<string, Endpoint>;
76
81
  };
77
- /** Map plugin endpoint names → better-call endpoints. */
78
- export type PluginEndpointMap<P extends readonly DimahS3Plugin[]> = P extends readonly [] ? Record<string, never> : UnionToIntersection<P[number] extends {
79
- endpoints?: infer E;
80
- } ? E extends Record<string, Endpoint> ? E : Record<string, never> : Record<string, never>>;
81
- type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : Record<string, never>;
82
- /** Keys reserved on the dimahS3 instance — plugins may not use these as ids. */
83
- export declare const RESERVED_PLUGIN_IDS: readonly ["handler", "api", "context", "getPlugin", "$ERROR_CODES", "$Infer", "upload", "confirm", "download", "catalog", "file", "delete", "deleteBatch", "put", "multipart"];
84
- export type ReservedPluginId = (typeof RESERVED_PLUGIN_IDS)[number];
85
- export {};
86
82
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,eAAe,EACf,YAAY,EACZ,aAAa,EACb,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE3E,KAAK,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEnD;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,MAAM,C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G,CAAC,GACnE,GAAG,GACH,KAAK;CACV,CAAC;AAEF,kDAAkD;AAClD,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B,0CAA0C;IAC1C,OAAO,EAAE,CAAC,CAAC;IACX,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,aAAa,GAAG,SAAS,CAAC;IACrD,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACrC,CAAC"}
package/dist/plugins.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- export { applyPlugins, chainHooks, definePlugin, FEATURE_HOOK_KEYS, MULTIPART_HOOK_KEYS, LIFECYCLE_FEATURE_HOOK_KEYS, LIFECYCLE_MULTIPART_HOOK_KEYS, RESERVED_PLUGIN_IDS, } from "./plugin";
2
- export type { AppliedPlugins, DimahS3Plugin, DimahS3PluginHooks, PluginContextMap, PluginEndpointMap, PluginInitEnv, ReservedPluginId, } from "./plugin";
3
- export { createS3Endpoint, createS3Middleware } from "./api";
4
- export type { CoreEndpoints, S3EndpointContext } from "./api";
5
- export { CORE_ENDPOINT_NAMES } from "./api";
6
- export { ROUTE_FEATURES, ROUTE_OPERATIONS } from "./types";
7
- export { isFeatureOn } from "./helpers";
8
- export type { DeleteConfig, DeleteGuardContext, DeleteOnDeletedContext, DimahS3Config, DimahS3RouteConfig, DisabledFeature, DownloadConfig, DownloadGuardContext, DownloadOnPresignedContext, EnabledFeature, EnabledUploadConfig, FeatureToggle, GuardContext, MultipartConfig, MultipartOnAbortContext, MultipartOnInitContext, MultipartOnListContext, MultipartGuardContext, MultipartUploadContext, ObjectFile, OpenedRoute, ResolvedDimahS3Config, ResolvedFeature, ResolvedRoute, ResolvedUploadConfig, RouteFeature, RouteGuardContext, RouteOperation, StoredObjectContext, UploadConfig, UploadConfirmGuardContext, UploadGuardContext, UploadObjectContext, UploadObjectInfo, UploadOnConfirmedContext, UploadOnPresignedContext, } from "./types";
1
+ export { createS3Endpoint } from "./api/create-s3-endpoint";
2
+ export type { S3Endpoint, S3EndpointMethod, S3EndpointOptions, } from "./api/create-s3-endpoint";
3
+ export { createS3Middleware } from "./api/create-s3-middleware";
4
+ export type { S3EndpointContext } from "./api/context";
5
+ export { isFeatureOn } from "./config/feature-toggle";
6
+ export { definePlugin } from "./plugin";
7
+ export type { DimahS3Plugin, DimahS3PluginHooks, PluginContextMap, PluginInitEnv, } from "./plugin";
8
+ export { isAwsNotFound } from "./helpers/aws-errors";
9
+ export { deleteObjectIfMatch, type ConditionalDeleteInput, } from "./helpers/best-effort";
10
+ export { readUploadMarker } from "./helpers/object-meta";
9
11
  //# sourceMappingURL=plugins.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAC3B,6BAA6B,EAC7B,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC7D,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,cAAc,EACd,mBAAmB,EACnB,a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