@geekmidas/storage 10.0.0-alpha.9 → 10.0.0-alpha.91

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 (48) hide show
  1. package/README.md +49 -13
  2. package/dist/aws.cjs +102 -63
  3. package/dist/aws.cjs.map +1 -1
  4. package/dist/aws.d.cts +9 -10
  5. package/dist/aws.d.cts.map +1 -1
  6. package/dist/aws.d.mts +9 -10
  7. package/dist/aws.d.mts.map +1 -1
  8. package/dist/aws.mjs +87 -49
  9. package/dist/aws.mjs.map +1 -1
  10. package/dist/{errors-D5UnAd-X.mjs → errors-BB8jdHif.cjs} +83 -5
  11. package/dist/errors-BB8jdHif.cjs.map +1 -0
  12. package/dist/{errors-Bce0CJ11.cjs → errors-COXs1iNg.mjs} +42 -35
  13. package/dist/errors-COXs1iNg.mjs.map +1 -0
  14. package/dist/index.cjs +19 -3
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +32 -11
  17. package/dist/index.d.cts.map +1 -1
  18. package/dist/index.d.mts +32 -11
  19. package/dist/index.d.mts.map +1 -1
  20. package/dist/index.mjs +17 -4
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/{registry-DBsAUTT3.d.cts → registry-ClEvHGpM.d.cts} +3 -6
  23. package/dist/registry-ClEvHGpM.d.cts.map +1 -0
  24. package/dist/{registry-DEqSHjx-.d.mts → registry-ClEvHGpM.d.mts} +3 -6
  25. package/dist/registry-ClEvHGpM.d.mts.map +1 -0
  26. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  27. package/dist/s3Url.cjs +108 -4
  28. package/dist/s3Url.cjs.map +1 -0
  29. package/dist/s3Url.d.cts +52 -2
  30. package/dist/s3Url.d.cts.map +1 -0
  31. package/dist/s3Url.d.mts +52 -2
  32. package/dist/s3Url.d.mts.map +1 -0
  33. package/dist/s3Url.mjs +89 -3
  34. package/dist/s3Url.mjs.map +1 -0
  35. package/package.json +10 -5
  36. package/dist/chunk-B9dir_RE.mjs +0 -11
  37. package/dist/errors-Bce0CJ11.cjs.map +0 -1
  38. package/dist/errors-D5UnAd-X.mjs.map +0 -1
  39. package/dist/registry-DBsAUTT3.d.cts.map +0 -1
  40. package/dist/registry-DEqSHjx-.d.mts.map +0 -1
  41. package/dist/s3Url-BfztIltX.d.cts +0 -39
  42. package/dist/s3Url-BfztIltX.d.cts.map +0 -1
  43. package/dist/s3Url-Bo32UTTA.cjs +0 -103
  44. package/dist/s3Url-Bo32UTTA.cjs.map +0 -1
  45. package/dist/s3Url-C8FGPNrG.mjs +0 -52
  46. package/dist/s3Url-C8FGPNrG.mjs.map +0 -1
  47. package/dist/s3Url-COpMIgF9.d.mts +0 -42
  48. package/dist/s3Url-COpMIgF9.d.mts.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,7 +1,5 @@
1
- import { StorageClient, StorageDriver, createStorageClient, registerStorageDriver, registeredStorageSchemes } from "./registry-DBsAUTT3.cjs";
2
-
1
+ import { i as registeredStorageSchemes, l as StorageClient, n as createStorageClient, r as registerStorageDriver, t as StorageDriver } from "./registry-ClEvHGpM.cjs";
3
2
  //#region src/errors.d.ts
4
-
5
3
  /**
6
4
  * Storage errors — shared by every implementation, not just S3.
7
5
  *
@@ -15,13 +13,26 @@ import { StorageClient, StorageDriver, createStorageClient, registerStorageDrive
15
13
  * is thrown, and carries user input into every log line that touches it.
16
14
  */
17
15
  /** Base for anything wrong with a storage URL, so callers may catch broadly. */
18
- declare abstract class StorageUrlError extends Error {
19
- /** The URL that could not be used. */
16
+ export declare abstract class StorageUrlError extends Error {
17
+ /**
18
+ * The URL that could not be used, with any credentials it carried replaced
19
+ * by `REDACTED` — an error is logged, and a key in its userinfo would be
20
+ * logged with it.
21
+ */
20
22
  readonly url: string;
21
23
  constructor(url: string, message: string);
22
24
  }
25
+ /**
26
+ * Replace a URL's userinfo with `REDACTED`, so `s3://KEY:SECRET@uploads` can be
27
+ * logged as `s3://REDACTED@uploads`. A URL without userinfo comes back as is.
28
+ *
29
+ * A string the URL parser rejects is still redacted, up to its last `@`: an
30
+ * unencoded `/` in a secret is the commonest way to write a malformed one, and
31
+ * that string is exactly the one that ends up in an error.
32
+ */
33
+ export declare function redactStorageUrl(url: string): string;
23
34
  /** The string is not a URL at all. */
24
- declare class MalformedStorageUrl extends StorageUrlError {
35
+ export declare class MalformedStorageUrl extends StorageUrlError {
25
36
  constructor(url: string);
26
37
  }
27
38
  /**
@@ -29,7 +40,7 @@ declare class MalformedStorageUrl extends StorageUrlError {
29
40
  * or the reverse. The usual cause is a construct resolving against the wrong
30
41
  * target, which is worth distinguishing from a malformed string.
31
42
  */
32
- declare class UnexpectedStorageScheme extends StorageUrlError {
43
+ export declare class UnexpectedStorageScheme extends StorageUrlError {
33
44
  /** The scheme this client handles, e.g. `'s3:'`. */
34
45
  readonly expected: string;
35
46
  /** The scheme the URL actually carried, e.g. `'gs:'`. */
@@ -43,9 +54,20 @@ declare class UnexpectedStorageScheme extends StorageUrlError {
43
54
  * container. One error covers all three — the word in the message is the
44
55
  * common one rather than a new abstraction nobody uses.
45
56
  */
46
- declare class MissingStorageBucket extends StorageUrlError {
57
+ export declare class MissingStorageBucket extends StorageUrlError {
47
58
  constructor(url: string);
48
59
  }
60
+ /**
61
+ * The URL's userinfo carries one half of a key pair: an access key with no
62
+ * secret, or a secret with no access key. Either both are in the URL, or
63
+ * neither is and the provider's default credential chain applies — half a pair
64
+ * is never silently completed from the environment.
65
+ */
66
+ export declare class IncompleteStorageCredentials extends StorageUrlError {
67
+ /** Which half is missing: `'accessKeyId'` or `'secretAccessKey'`. */
68
+ readonly missing: 'accessKeyId' | 'secretAccessKey';
69
+ constructor(url: string, missing: 'accessKeyId' | 'secretAccessKey');
70
+ }
49
71
  /**
50
72
  * No driver is registered for the URL's scheme.
51
73
  *
@@ -53,14 +75,13 @@ declare class MissingStorageBucket extends StorageUrlError {
53
75
  * point registered nothing at all — so the registered schemes are carried
54
76
  * alongside, since "what *is* available" is the actionable half.
55
77
  */
56
- declare class UnregisteredStorageScheme extends StorageUrlError {
78
+ export declare class UnregisteredStorageScheme extends StorageUrlError {
57
79
  /** The scheme that had no driver, e.g. `'gs:'`. */
58
80
  readonly scheme: string;
59
81
  /** What is registered, so the caller can see what was pinned instead. */
60
82
  readonly registered: readonly string[];
61
83
  constructor(url: string, scheme: string, registered: readonly string[]);
62
84
  }
63
- //# sourceMappingURL=errors.d.ts.map
64
85
  //#endregion
65
- export { MalformedStorageUrl, MissingStorageBucket, StorageClient, StorageDriver, StorageUrlError, UnexpectedStorageScheme, UnregisteredStorageScheme, createStorageClient, registerStorageDriver, registeredStorageSchemes };
86
+ export { type StorageClient, type StorageDriver, createStorageClient, registerStorageDriver, registeredStorageSchemes };
66
87
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;;;;;;AAcA;AAYA;AAWA;AAoBA;AAaA;;;;;;uBAxDsB,eAAA,SAAwB,KAAK;;;;;;cAYtC,mBAAA,SAA4B,eAAe;;;;;;;;cAW3C,uBAAA,SAAgC,eAAe;;;;;;;;;;;;;;cAoB/C,oBAAA,SAA6B,eAAe;;;;;;;;;;cAa5C,yBAAA,SAAkC,eAAe"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/errors.ts"],"mappings":";;;;;;;;;;;;;;;8BAcsB,wBAAwB;;;;;;WAMpC;EAET,YAAY,aAAa;;;;;;;;;;wBAeV,iBAAiB;;qBAapB,4BAA4B;EACxC,YAAY;;;;;;;qBAUA,gCAAgC;;WAEnC;;WAEA;EAET,YAAY,aAAa,kBAAkB;;;;;;;;;qBAc/B,6BAA6B;EACzC,YAAY;;;;;;;;qBAWA,qCAAqC;;WAExC;EAET,YAAY,aAAa;;;;;;;;;qBAgBb,kCAAkC;;WAErC;;WAEA;EAET,YAAY,aAAa,gBAAgB"}
package/dist/index.d.mts CHANGED
@@ -1,7 +1,5 @@
1
- import { StorageClient, StorageDriver, createStorageClient, registerStorageDriver, registeredStorageSchemes } from "./registry-DEqSHjx-.mjs";
2
-
1
+ import { i as registeredStorageSchemes, l as StorageClient, n as createStorageClient, r as registerStorageDriver, t as StorageDriver } from "./registry-ClEvHGpM.mjs";
3
2
  //#region src/errors.d.ts
4
-
5
3
  /**
6
4
  * Storage errors — shared by every implementation, not just S3.
7
5
  *
@@ -15,13 +13,26 @@ import { StorageClient, StorageDriver, createStorageClient, registerStorageDrive
15
13
  * is thrown, and carries user input into every log line that touches it.
16
14
  */
17
15
  /** Base for anything wrong with a storage URL, so callers may catch broadly. */
18
- declare abstract class StorageUrlError extends Error {
19
- /** The URL that could not be used. */
16
+ export declare abstract class StorageUrlError extends Error {
17
+ /**
18
+ * The URL that could not be used, with any credentials it carried replaced
19
+ * by `REDACTED` — an error is logged, and a key in its userinfo would be
20
+ * logged with it.
21
+ */
20
22
  readonly url: string;
21
23
  constructor(url: string, message: string);
22
24
  }
25
+ /**
26
+ * Replace a URL's userinfo with `REDACTED`, so `s3://KEY:SECRET@uploads` can be
27
+ * logged as `s3://REDACTED@uploads`. A URL without userinfo comes back as is.
28
+ *
29
+ * A string the URL parser rejects is still redacted, up to its last `@`: an
30
+ * unencoded `/` in a secret is the commonest way to write a malformed one, and
31
+ * that string is exactly the one that ends up in an error.
32
+ */
33
+ export declare function redactStorageUrl(url: string): string;
23
34
  /** The string is not a URL at all. */
24
- declare class MalformedStorageUrl extends StorageUrlError {
35
+ export declare class MalformedStorageUrl extends StorageUrlError {
25
36
  constructor(url: string);
26
37
  }
27
38
  /**
@@ -29,7 +40,7 @@ declare class MalformedStorageUrl extends StorageUrlError {
29
40
  * or the reverse. The usual cause is a construct resolving against the wrong
30
41
  * target, which is worth distinguishing from a malformed string.
31
42
  */
32
- declare class UnexpectedStorageScheme extends StorageUrlError {
43
+ export declare class UnexpectedStorageScheme extends StorageUrlError {
33
44
  /** The scheme this client handles, e.g. `'s3:'`. */
34
45
  readonly expected: string;
35
46
  /** The scheme the URL actually carried, e.g. `'gs:'`. */
@@ -43,9 +54,20 @@ declare class UnexpectedStorageScheme extends StorageUrlError {
43
54
  * container. One error covers all three — the word in the message is the
44
55
  * common one rather than a new abstraction nobody uses.
45
56
  */
46
- declare class MissingStorageBucket extends StorageUrlError {
57
+ export declare class MissingStorageBucket extends StorageUrlError {
47
58
  constructor(url: string);
48
59
  }
60
+ /**
61
+ * The URL's userinfo carries one half of a key pair: an access key with no
62
+ * secret, or a secret with no access key. Either both are in the URL, or
63
+ * neither is and the provider's default credential chain applies — half a pair
64
+ * is never silently completed from the environment.
65
+ */
66
+ export declare class IncompleteStorageCredentials extends StorageUrlError {
67
+ /** Which half is missing: `'accessKeyId'` or `'secretAccessKey'`. */
68
+ readonly missing: 'accessKeyId' | 'secretAccessKey';
69
+ constructor(url: string, missing: 'accessKeyId' | 'secretAccessKey');
70
+ }
49
71
  /**
50
72
  * No driver is registered for the URL's scheme.
51
73
  *
@@ -53,14 +75,13 @@ declare class MissingStorageBucket extends StorageUrlError {
53
75
  * point registered nothing at all — so the registered schemes are carried
54
76
  * alongside, since "what *is* available" is the actionable half.
55
77
  */
56
- declare class UnregisteredStorageScheme extends StorageUrlError {
78
+ export declare class UnregisteredStorageScheme extends StorageUrlError {
57
79
  /** The scheme that had no driver, e.g. `'gs:'`. */
58
80
  readonly scheme: string;
59
81
  /** What is registered, so the caller can see what was pinned instead. */
60
82
  readonly registered: readonly string[];
61
83
  constructor(url: string, scheme: string, registered: readonly string[]);
62
84
  }
63
- //# sourceMappingURL=errors.d.ts.map
64
85
  //#endregion
65
- export { MalformedStorageUrl, MissingStorageBucket, StorageClient, StorageDriver, StorageUrlError, UnexpectedStorageScheme, UnregisteredStorageScheme, createStorageClient, registerStorageDriver, registeredStorageSchemes };
86
+ export { type StorageClient, type StorageDriver, createStorageClient, registerStorageDriver, registeredStorageSchemes };
66
87
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;;;;;;AAcA;AAYA;AAWA;AAoBA;AAaA;;;;;;uBAxDsB,eAAA,SAAwB,KAAK;;;;;;cAYtC,mBAAA,SAA4B,eAAe;;;;;;;;cAW3C,uBAAA,SAAgC,eAAe;;;;;;;;;;;;;;cAoB/C,oBAAA,SAA6B,eAAe;;;;;;;;;;cAa5C,yBAAA,SAAkC,eAAe"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/errors.ts"],"mappings":";;;;;;;;;;;;;;;8BAcsB,wBAAwB;;;;;;WAMpC;EAET,YAAY,aAAa;;;;;;;;;;wBAeV,iBAAiB;;qBAapB,4BAA4B;EACxC,YAAY;;;;;;;qBAUA,gCAAgC;;WAEnC;;WAEA;EAET,YAAY,aAAa,kBAAkB;;;;;;;;;qBAc/B,6BAA6B;EACzC,YAAY;;;;;;;;qBAWA,qCAAqC;;WAExC;EAET,YAAY,aAAa;;;;;;;;;qBAgBb,kCAAkC;;WAErC;;WAEA;EAET,YAAY,aAAa,gBAAgB"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,19 @@
1
- import { MalformedStorageUrl, MissingStorageBucket, StorageUrlError, UnexpectedStorageScheme, UnregisteredStorageScheme } from "./errors-D5UnAd-X.mjs";
2
-
1
+ import { a as UnexpectedStorageScheme, i as StorageUrlError, n as MalformedStorageUrl, o as UnregisteredStorageScheme, r as MissingStorageBucket, s as redactStorageUrl, t as IncompleteStorageCredentials } from "./errors-COXs1iNg.mjs";
3
2
  //#region src/registry.ts
3
+ /**
4
+ * Driver registry — how a storage URL becomes a client without the caller
5
+ * naming a cloud.
6
+ *
7
+ * A construct declares that it needs object storage and receives one URL. It
8
+ * must not import `AmazonStorageClient` to use it: that would name a provider in
9
+ * the neutral layer and drag the AWS SDK into an app that only ever talks to
10
+ * GCS. So the protocol selects the driver, and whoever assembles the
11
+ * application decides which drivers exist — a generated handler registering the
12
+ * one its target needs, or a dev entry registering several.
13
+ *
14
+ * Registration is explicit rather than an import side effect, because a
15
+ * side-effecting module is exactly what a bundler is entitled to drop.
16
+ */
4
17
  const drivers = /* @__PURE__ */ new Map();
5
18
  /** Make a driver available to {@link createStorageClient}. Idempotent. */
6
19
  function registerStorageDriver(driver) {
@@ -26,7 +39,7 @@ function schemeOf(url) {
26
39
  const separator = url.indexOf(":");
27
40
  return separator === -1 ? "" : url.slice(0, separator + 1);
28
41
  }
29
-
30
42
  //#endregion
31
- export { MalformedStorageUrl, MissingStorageBucket, StorageUrlError, UnexpectedStorageScheme, UnregisteredStorageScheme, createStorageClient, registerStorageDriver, registeredStorageSchemes };
43
+ export { IncompleteStorageCredentials, MalformedStorageUrl, MissingStorageBucket, StorageUrlError, UnexpectedStorageScheme, UnregisteredStorageScheme, createStorageClient, redactStorageUrl, registerStorageDriver, registeredStorageSchemes };
44
+
32
45
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["driver: StorageDriver","url: string"],"sources":["../src/registry.ts"],"sourcesContent":["/**\n * Driver registry — how a storage URL becomes a client without the caller\n * naming a cloud.\n *\n * A construct declares that it needs object storage and receives one URL. It\n * must not import `AmazonStorageClient` to use it: that would name a provider in\n * the neutral layer and drag the AWS SDK into an app that only ever talks to\n * GCS. So the protocol selects the driver, and whoever assembles the\n * application decides which drivers exist — a generated handler registering the\n * one its target needs, or a dev entry registering several.\n *\n * Registration is explicit rather than an import side effect, because a\n * side-effecting module is exactly what a bundler is entitled to drop.\n */\n\nimport { UnregisteredStorageScheme } from './errors';\nimport type { StorageClient } from './StorageClient';\n\n/**\n * Builds a client from a URL it recognises.\n *\n * The driver owns parsing: the shape of an `s3://` URL is S3's business, and a\n * `gs://` driver shares nothing with it beyond this signature.\n */\nexport interface StorageDriver {\n\t/** The URL scheme this driver handles, including the colon — e.g. `'s3:'`. */\n\treadonly scheme: string;\n\tcreate(url: string): StorageClient;\n}\n\nconst drivers = new Map<string, StorageDriver>();\n\n/** Make a driver available to {@link createStorageClient}. Idempotent. */\nexport function registerStorageDriver(driver: StorageDriver): void {\n\tdrivers.set(driver.scheme, driver);\n}\n\n/** Which schemes are currently registered — the useful half of a failure. */\nexport function registeredStorageSchemes(): string[] {\n\treturn [...drivers.keys()].sort();\n}\n\n/**\n * Build a client for a URL.\n *\n * @throws {UnregisteredStorageScheme} when no driver handles the scheme, which\n * in practice means the build pinned a different one, or nothing registered.\n */\nexport function createStorageClient(url: string): StorageClient {\n\tconst scheme = schemeOf(url);\n\tconst driver = drivers.get(scheme);\n\n\tif (!driver) {\n\t\tthrow new UnregisteredStorageScheme(\n\t\t\turl,\n\t\t\tscheme,\n\t\t\tregisteredStorageSchemes(),\n\t\t);\n\t}\n\n\treturn driver.create(url);\n}\n\nfunction schemeOf(url: string): string {\n\tconst separator = url.indexOf(':');\n\treturn separator === -1 ? '' : url.slice(0, separator + 1);\n}\n"],"mappings":";;;AA8BA,MAAM,0BAAU,IAAI;;AAGpB,SAAgB,sBAAsBA,QAA6B;AAClE,SAAQ,IAAI,OAAO,QAAQ,OAAO;AAClC;;AAGD,SAAgB,2BAAqC;AACpD,QAAO,CAAC,GAAG,QAAQ,MAAM,AAAC,EAAC,MAAM;AACjC;;;;;;;AAQD,SAAgB,oBAAoBC,KAA4B;CAC/D,MAAM,SAAS,SAAS,IAAI;CAC5B,MAAM,SAAS,QAAQ,IAAI,OAAO;AAElC,MAAK,OACJ,OAAM,IAAI,0BACT,KACA,QACA,0BAA0B;AAI5B,QAAO,OAAO,OAAO,IAAI;AACzB;AAED,SAAS,SAASA,KAAqB;CACtC,MAAM,YAAY,IAAI,QAAQ,IAAI;AAClC,QAAO,cAAc,KAAK,KAAK,IAAI,MAAM,GAAG,YAAY,EAAE;AAC1D"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/registry.ts"],"sourcesContent":["/**\n * Driver registry — how a storage URL becomes a client without the caller\n * naming a cloud.\n *\n * A construct declares that it needs object storage and receives one URL. It\n * must not import `AmazonStorageClient` to use it: that would name a provider in\n * the neutral layer and drag the AWS SDK into an app that only ever talks to\n * GCS. So the protocol selects the driver, and whoever assembles the\n * application decides which drivers exist — a generated handler registering the\n * one its target needs, or a dev entry registering several.\n *\n * Registration is explicit rather than an import side effect, because a\n * side-effecting module is exactly what a bundler is entitled to drop.\n */\n\nimport { UnregisteredStorageScheme } from './errors';\nimport type { StorageClient } from './StorageClient';\n\n/**\n * Builds a client from a URL it recognises.\n *\n * The driver owns parsing: the shape of an `s3://` URL is S3's business, and a\n * `gs://` driver shares nothing with it beyond this signature.\n */\nexport interface StorageDriver {\n\t/** The URL scheme this driver handles, including the colon — e.g. `'s3:'`. */\n\treadonly scheme: string;\n\tcreate(url: string): StorageClient;\n}\n\nconst drivers = new Map<string, StorageDriver>();\n\n/** Make a driver available to {@link createStorageClient}. Idempotent. */\nexport function registerStorageDriver(driver: StorageDriver): void {\n\tdrivers.set(driver.scheme, driver);\n}\n\n/** Which schemes are currently registered — the useful half of a failure. */\nexport function registeredStorageSchemes(): string[] {\n\treturn [...drivers.keys()].sort();\n}\n\n/**\n * Build a client for a URL.\n *\n * @throws {UnregisteredStorageScheme} when no driver handles the scheme, which\n * in practice means the build pinned a different one, or nothing registered.\n */\nexport function createStorageClient(url: string): StorageClient {\n\tconst scheme = schemeOf(url);\n\tconst driver = drivers.get(scheme);\n\n\tif (!driver) {\n\t\tthrow new UnregisteredStorageScheme(\n\t\t\turl,\n\t\t\tscheme,\n\t\t\tregisteredStorageSchemes(),\n\t\t);\n\t}\n\n\treturn driver.create(url);\n}\n\nfunction schemeOf(url: string): string {\n\tconst separator = url.indexOf(':');\n\treturn separator === -1 ? '' : url.slice(0, separator + 1);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8BA,MAAM,0BAAU,IAAI,IAA2B;;AAG/C,SAAgB,sBAAsB,QAA6B;CAClE,QAAQ,IAAI,OAAO,QAAQ,MAAM;AAClC;;AAGA,SAAgB,2BAAqC;CACpD,OAAO,CAAC,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,KAAK;AACjC;;;;;;;AAQA,SAAgB,oBAAoB,KAA4B;CAC/D,MAAM,SAAS,SAAS,GAAG;CAC3B,MAAM,SAAS,QAAQ,IAAI,MAAM;CAEjC,IAAI,CAAC,QACJ,MAAM,IAAI,0BACT,KACA,QACA,yBAAyB,CAC1B;CAGD,OAAO,OAAO,OAAO,GAAG;AACzB;AAEA,SAAS,SAAS,KAAqB;CACtC,MAAM,YAAY,IAAI,QAAQ,GAAG;CACjC,OAAO,cAAc,KAAK,KAAK,IAAI,MAAM,GAAG,YAAY,CAAC;AAC1D"}
@@ -1,5 +1,4 @@
1
1
  import { Cache } from "@geekmidas/cache";
2
-
3
2
  //#region src/StorageClient.d.ts
4
3
  interface DocumentVersion {
5
4
  id: string;
@@ -8,7 +7,7 @@ interface DocumentVersion {
8
7
  declare enum StorageProvider {
9
8
  AWSS3 = "geekimdas.toolbox.storage.aws.s3",
10
9
  GCP = "geekimdas.toolbox.storage.gcp",
11
- AZURE = "geekimdas.toolbox.storage.azure",
10
+ AZURE = "geekimdas.toolbox.storage.azure"
12
11
  }
13
12
  interface StorageClient {
14
13
  readonly provider: StorageProvider;
@@ -93,7 +92,6 @@ interface File {
93
92
  */
94
93
  disposition?: 'inline' | 'attachment';
95
94
  }
96
- //# sourceMappingURL=StorageClient.d.ts.map
97
95
  //#endregion
98
96
  //#region src/registry.d.ts
99
97
  /**
@@ -118,7 +116,6 @@ declare function registeredStorageSchemes(): string[];
118
116
  * in practice means the build pinned a different one, or nothing registered.
119
117
  */
120
118
  declare function createStorageClient(url: string): StorageClient;
121
- //# sourceMappingURL=registry.d.ts.map
122
119
  //#endregion
123
- export { DocumentVersion, File, GetUploadParams, GetUploadResponse, StorageClient, StorageDriver, StorageProvider, createStorageClient, registerStorageDriver, registeredStorageSchemes };
124
- //# sourceMappingURL=registry-DBsAUTT3.d.cts.map
120
+ export { DocumentVersion as a, GetUploadResponse as c, registeredStorageSchemes as i, StorageClient as l, createStorageClient as n, File as o, registerStorageDriver as r, GetUploadParams as s, StorageDriver as t, StorageProvider as u };
121
+ //# sourceMappingURL=registry-ClEvHGpM.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-ClEvHGpM.d.cts","names":[],"sources":["../src/StorageClient.ts","../src/registry.ts"],"mappings":";;UACiB;EAChB;EACA,WAAW;;aAGA;EACX;EACA;EACA;;UAGgB;WACP,UAAU;WACV,QAAQ;;;;;;;;;EASjB,aAAa,QAAQ,iBAAiB,qBAAqB;;;;;;;;;EAU3D,eAAe,MAAM,MAAM,qBAAqB;;;;;;EAMhD,YAAY,cAAc,QAAQ;;;;;;;EAQlC,sBAAsB,MAAM,MAAM,oBAAoB;;;;;;;EAOtD,OACC,aACA,eAAe,QACf,sBACE;;;;;;;EAOH,UACC,QAAQ,iBACR,qBACE,QAAQ;;;;;;EAMX,OAAO,cAAc;;UAGL;EAChB;EACA;EACA;;KAGW;EACX;EACA;;KAGW;EACX;EACA,QAAQ;;UAGQ;EAChB;EACA;;;;;EAKA;;;;;;EAMA;;;;;;;;;;UClFgB;;WAEP;EACT,OAAO,cAAc;;;iBAMN,sBAAsB,QAAQ;;iBAK9B;;;;;;;iBAUA,oBAAoB,cAAc"}
@@ -1,5 +1,4 @@
1
1
  import { Cache } from "@geekmidas/cache";
2
-
3
2
  //#region src/StorageClient.d.ts
4
3
  interface DocumentVersion {
5
4
  id: string;
@@ -8,7 +7,7 @@ interface DocumentVersion {
8
7
  declare enum StorageProvider {
9
8
  AWSS3 = "geekimdas.toolbox.storage.aws.s3",
10
9
  GCP = "geekimdas.toolbox.storage.gcp",
11
- AZURE = "geekimdas.toolbox.storage.azure",
10
+ AZURE = "geekimdas.toolbox.storage.azure"
12
11
  }
13
12
  interface StorageClient {
14
13
  readonly provider: StorageProvider;
@@ -93,7 +92,6 @@ interface File {
93
92
  */
94
93
  disposition?: 'inline' | 'attachment';
95
94
  }
96
- //# sourceMappingURL=StorageClient.d.ts.map
97
95
  //#endregion
98
96
  //#region src/registry.d.ts
99
97
  /**
@@ -118,7 +116,6 @@ declare function registeredStorageSchemes(): string[];
118
116
  * in practice means the build pinned a different one, or nothing registered.
119
117
  */
120
118
  declare function createStorageClient(url: string): StorageClient;
121
- //# sourceMappingURL=registry.d.ts.map
122
119
  //#endregion
123
- export { DocumentVersion, File, GetUploadParams, GetUploadResponse, StorageClient, StorageDriver, StorageProvider, createStorageClient, registerStorageDriver, registeredStorageSchemes };
124
- //# sourceMappingURL=registry-DEqSHjx-.d.mts.map
120
+ export { DocumentVersion as a, GetUploadResponse as c, registeredStorageSchemes as i, StorageClient as l, createStorageClient as n, File as o, registerStorageDriver as r, GetUploadParams as s, StorageDriver as t, StorageProvider as u };
121
+ //# sourceMappingURL=registry-ClEvHGpM.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-ClEvHGpM.d.mts","names":[],"sources":["../src/StorageClient.ts","../src/registry.ts"],"mappings":";;UACiB;EAChB;EACA,WAAW;;aAGA;EACX;EACA;EACA;;UAGgB;WACP,UAAU;WACV,QAAQ;;;;;;;;;EASjB,aAAa,QAAQ,iBAAiB,qBAAqB;;;;;;;;;EAU3D,eAAe,MAAM,MAAM,qBAAqB;;;;;;EAMhD,YAAY,cAAc,QAAQ;;;;;;;EAQlC,sBAAsB,MAAM,MAAM,oBAAoB;;;;;;;EAOtD,OACC,aACA,eAAe,QACf,sBACE;;;;;;;EAOH,UACC,QAAQ,iBACR,qBACE,QAAQ;;;;;;EAMX,OAAO,cAAc;;UAGL;EAChB;EACA;EACA;;KAGW;EACX;EACA;;KAGW;EACX;EACA,QAAQ;;UAGQ;EAChB;EACA;;;;;EAKA;;;;;;EAMA;;;;;;;;;;UClFgB;;WAEP;EACT,OAAO,cAAc;;;iBAMN,sBAAsB,QAAQ;;iBAK9B;;;;;;;iBAUA,oBAAoB,cAAc"}
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };
package/dist/s3Url.cjs CHANGED
@@ -1,5 +1,109 @@
1
- const require_s3Url = require('./s3Url-Bo32UTTA.cjs');
2
- require('./errors-Bce0CJ11.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
3
+ var __defProp = Object.defineProperty;
4
+ var __exportAll = (all, no_symbols) => {
5
+ let target = {};
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
11
+ return target;
12
+ };
13
+ //#endregion
14
+ const require_errors = require("./errors-BB8jdHif.cjs");
15
+ //#region src/s3Url.ts
16
+ /**
17
+ * The `s3://` URL codec — how an S3 bucket is addressed as a single string.
18
+ *
19
+ * It lives beside the client rather than in a neutral package because `bucket`,
20
+ * `region`, and `forcePathStyle` are S3's vocabulary. The neutral layer only
21
+ * knows that a construct provides *one URL*; what that URL says is between the
22
+ * component that composes it and the client that parses it. A `gs://` codec
23
+ * would sit beside its own client and share nothing with this one.
24
+ *
25
+ * Both directions live here so they cannot drift: `parse(build(x))` is `x`.
26
+ */
27
+ var s3Url_exports = /* @__PURE__ */ __exportAll({
28
+ build: () => build,
29
+ parse: () => parse
30
+ });
31
+ const SCHEME = "s3:";
32
+ /**
33
+ * Compose an address into a URL.
34
+ *
35
+ * Credentials appear only when the address carries them, percent-encoded —
36
+ * AWS secrets routinely contain `/` and `+`. An address without them builds a
37
+ * URL with no userinfo, which leaves the caller to the SDK's own chain.
38
+ */
39
+ function build(address) {
40
+ const { bucket, region, endpoint, forcePathStyle, accessKeyId, secretAccessKey } = address;
41
+ if (!bucket) throw new require_errors.MissingStorageBucket("");
42
+ const url = new URL(`${SCHEME}//${bucket}`);
43
+ if (accessKeyId || secretAccessKey) {
44
+ if (!accessKeyId) throw new require_errors.IncompleteStorageCredentials(url.toString(), "accessKeyId");
45
+ if (!secretAccessKey) throw new require_errors.IncompleteStorageCredentials(url.toString(), "secretAccessKey");
46
+ url.username = encodeURIComponent(accessKeyId);
47
+ url.password = encodeURIComponent(secretAccessKey);
48
+ }
49
+ if (region) url.searchParams.set("region", region);
50
+ if (endpoint) url.searchParams.set("endpoint", endpoint);
51
+ if (forcePathStyle) url.searchParams.set("forcePathStyle", "true");
52
+ return url.toString();
53
+ }
54
+ /**
55
+ * Parse a URL back into an address. Throws if it is not an `s3://` URL, or if
56
+ * its userinfo carries only one half of a key pair.
57
+ */
58
+ function parse(url) {
59
+ let parsed;
60
+ try {
61
+ parsed = new URL(url);
62
+ } catch {
63
+ throw new require_errors.MalformedStorageUrl(url);
64
+ }
65
+ if (parsed.protocol !== SCHEME) throw new require_errors.UnexpectedStorageScheme(url, SCHEME, parsed.protocol);
66
+ const bucket = parsed.hostname;
67
+ if (!bucket) throw new require_errors.MissingStorageBucket(url);
68
+ const region = parsed.searchParams.get("region") ?? void 0;
69
+ const endpoint = parsed.searchParams.get("endpoint") ?? void 0;
70
+ const forcePathStyle = parsed.searchParams.get("forcePathStyle") === "true" ? true : void 0;
71
+ const credentials = credentialsOf(url, parsed);
72
+ return {
73
+ bucket,
74
+ ...region ? { region } : {},
75
+ ...endpoint ? { endpoint } : {},
76
+ ...forcePathStyle ? { forcePathStyle } : {},
77
+ ...credentials
78
+ };
79
+ }
80
+ /** The URL's userinfo as a key pair: both halves, or nothing. */
81
+ function credentialsOf(url, parsed) {
82
+ const accessKeyId = decode(url, parsed.username);
83
+ const secretAccessKey = decode(url, parsed.password);
84
+ if (!accessKeyId && !secretAccessKey) return {};
85
+ if (!accessKeyId) throw new require_errors.IncompleteStorageCredentials(url, "accessKeyId");
86
+ if (!secretAccessKey) throw new require_errors.IncompleteStorageCredentials(url, "secretAccessKey");
87
+ return {
88
+ accessKeyId,
89
+ secretAccessKey
90
+ };
91
+ }
92
+ function decode(url, value) {
93
+ try {
94
+ return decodeURIComponent(value);
95
+ } catch {
96
+ throw new require_errors.MalformedStorageUrl(url);
97
+ }
98
+ }
99
+ //#endregion
100
+ exports.build = build;
101
+ exports.parse = parse;
102
+ Object.defineProperty(exports, "s3Url_exports", {
103
+ enumerable: true,
104
+ get: function() {
105
+ return s3Url_exports;
106
+ }
107
+ });
3
108
 
4
- exports.build = require_s3Url.build;
5
- exports.parse = require_s3Url.parse;
109
+ //# sourceMappingURL=s3Url.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3Url.cjs","names":["MissingStorageBucket","IncompleteStorageCredentials","MalformedStorageUrl","UnexpectedStorageScheme"],"sources":["../src/s3Url.ts"],"sourcesContent":["/**\n * The `s3://` URL codec — how an S3 bucket is addressed as a single string.\n *\n * It lives beside the client rather than in a neutral package because `bucket`,\n * `region`, and `forcePathStyle` are S3's vocabulary. The neutral layer only\n * knows that a construct provides *one URL*; what that URL says is between the\n * component that composes it and the client that parses it. A `gs://` codec\n * would sit beside its own client and share nothing with this one.\n *\n * Both directions live here so they cannot drift: `parse(build(x))` is `x`.\n */\n\nimport {\n\tIncompleteStorageCredentials,\n\tMalformedStorageUrl,\n\tMissingStorageBucket,\n\tUnexpectedStorageScheme,\n} from './errors';\n\n/**\n * What an S3 URL addresses, and optionally who it calls as.\n *\n * Credentials are optional and come as a pair. With them, the URL is a key\n * scoped to this one bucket (`s3://KEY:SECRET@uploads`); without them the AWS\n * SDK resolves its own chain — an execution role when deployed,\n * `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` otherwise. The URL's pair wins\n * over that chain.\n */\nexport interface S3Address {\n\tbucket: string;\n\t/** Read off the bucket, never inherited: a bucket may live in another region. */\n\tregion?: string;\n\t/** Set for S3-compatible backends such as MinIO. */\n\tendpoint?: string;\n\t/** MinIO and most S3-compatible servers need path-style addressing. */\n\tforcePathStyle?: boolean;\n\t/** The URL's own access key; always paired with `secretAccessKey`. */\n\taccessKeyId?: string;\n\t/** The URL's own secret; always paired with `accessKeyId`. */\n\tsecretAccessKey?: string;\n}\n\nconst SCHEME = 's3:';\n\n/**\n * Compose an address into a URL.\n *\n * Credentials appear only when the address carries them, percent-encoded —\n * AWS secrets routinely contain `/` and `+`. An address without them builds a\n * URL with no userinfo, which leaves the caller to the SDK's own chain.\n */\nexport function build(address: S3Address): string {\n\tconst {\n\t\tbucket,\n\t\tregion,\n\t\tendpoint,\n\t\tforcePathStyle,\n\t\taccessKeyId,\n\t\tsecretAccessKey,\n\t} = address;\n\tif (!bucket) throw new MissingStorageBucket('');\n\n\tconst url = new URL(`${SCHEME}//${bucket}`);\n\tif (accessKeyId || secretAccessKey) {\n\t\tif (!accessKeyId) {\n\t\t\tthrow new IncompleteStorageCredentials(url.toString(), 'accessKeyId');\n\t\t}\n\t\tif (!secretAccessKey) {\n\t\t\tthrow new IncompleteStorageCredentials(url.toString(), 'secretAccessKey');\n\t\t}\n\t\turl.username = encodeURIComponent(accessKeyId);\n\t\turl.password = encodeURIComponent(secretAccessKey);\n\t}\n\tif (region) url.searchParams.set('region', region);\n\tif (endpoint) url.searchParams.set('endpoint', endpoint);\n\tif (forcePathStyle) url.searchParams.set('forcePathStyle', 'true');\n\treturn url.toString();\n}\n\n/**\n * Parse a URL back into an address. Throws if it is not an `s3://` URL, or if\n * its userinfo carries only one half of a key pair.\n */\nexport function parse(url: string): S3Address {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(url);\n\t} catch {\n\t\tthrow new MalformedStorageUrl(url);\n\t}\n\n\tif (parsed.protocol !== SCHEME) {\n\t\tthrow new UnexpectedStorageScheme(url, SCHEME, parsed.protocol);\n\t}\n\n\tconst bucket = parsed.hostname;\n\tif (!bucket) throw new MissingStorageBucket(url);\n\n\tconst region = parsed.searchParams.get('region') ?? undefined;\n\tconst endpoint = parsed.searchParams.get('endpoint') ?? undefined;\n\tconst forcePathStyle =\n\t\tparsed.searchParams.get('forcePathStyle') === 'true' ? true : undefined;\n\tconst credentials = credentialsOf(url, parsed);\n\n\treturn {\n\t\tbucket,\n\t\t...(region ? { region } : {}),\n\t\t...(endpoint ? { endpoint } : {}),\n\t\t...(forcePathStyle ? { forcePathStyle } : {}),\n\t\t...credentials,\n\t};\n}\n\n/** The URL's userinfo as a key pair: both halves, or nothing. */\nfunction credentialsOf(\n\turl: string,\n\tparsed: URL,\n): Pick<S3Address, 'accessKeyId' | 'secretAccessKey'> {\n\tconst accessKeyId = decode(url, parsed.username);\n\tconst secretAccessKey = decode(url, parsed.password);\n\tif (!accessKeyId && !secretAccessKey) return {};\n\tif (!accessKeyId) {\n\t\tthrow new IncompleteStorageCredentials(url, 'accessKeyId');\n\t}\n\tif (!secretAccessKey) {\n\t\tthrow new IncompleteStorageCredentials(url, 'secretAccessKey');\n\t}\n\treturn { accessKeyId, secretAccessKey };\n}\n\nfunction decode(url: string, value: string): string {\n\ttry {\n\t\treturn decodeURIComponent(value);\n\t} catch {\n\t\tthrow new MalformedStorageUrl(url);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,SAAS;;;;;;;;AASf,SAAgB,MAAM,SAA4B;CACjD,MAAM,EACL,QACA,QACA,UACA,gBACA,aACA,oBACG;CACJ,IAAI,CAAC,QAAQ,MAAM,IAAIA,eAAAA,qBAAqB,EAAE;CAE9C,MAAM,MAAM,IAAI,IAAI,GAAG,OAAO,IAAI,QAAQ;CAC1C,IAAI,eAAe,iBAAiB;EACnC,IAAI,CAAC,aACJ,MAAM,IAAIC,eAAAA,6BAA6B,IAAI,SAAS,GAAG,aAAa;EAErE,IAAI,CAAC,iBACJ,MAAM,IAAIA,eAAAA,6BAA6B,IAAI,SAAS,GAAG,iBAAiB;EAEzE,IAAI,WAAW,mBAAmB,WAAW;EAC7C,IAAI,WAAW,mBAAmB,eAAe;CAClD;CACA,IAAI,QAAQ,IAAI,aAAa,IAAI,UAAU,MAAM;CACjD,IAAI,UAAU,IAAI,aAAa,IAAI,YAAY,QAAQ;CACvD,IAAI,gBAAgB,IAAI,aAAa,IAAI,kBAAkB,MAAM;CACjE,OAAO,IAAI,SAAS;AACrB;;;;;AAMA,SAAgB,MAAM,KAAwB;CAC7C,IAAI;CACJ,IAAI;EACH,SAAS,IAAI,IAAI,GAAG;CACrB,QAAQ;EACP,MAAM,IAAIC,eAAAA,oBAAoB,GAAG;CAClC;CAEA,IAAI,OAAO,aAAa,QACvB,MAAM,IAAIC,eAAAA,wBAAwB,KAAK,QAAQ,OAAO,QAAQ;CAG/D,MAAM,SAAS,OAAO;CACtB,IAAI,CAAC,QAAQ,MAAM,IAAIH,eAAAA,qBAAqB,GAAG;CAE/C,MAAM,SAAS,OAAO,aAAa,IAAI,QAAQ,KAAK,KAAA;CACpD,MAAM,WAAW,OAAO,aAAa,IAAI,UAAU,KAAK,KAAA;CACxD,MAAM,iBACL,OAAO,aAAa,IAAI,gBAAgB,MAAM,SAAS,OAAO,KAAA;CAC/D,MAAM,cAAc,cAAc,KAAK,MAAM;CAE7C,OAAO;EACN;EACA,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;EAC3B,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;EAC/B,GAAI,iBAAiB,EAAE,eAAe,IAAI,CAAC;EAC3C,GAAG;CACJ;AACD;;AAGA,SAAS,cACR,KACA,QACqD;CACrD,MAAM,cAAc,OAAO,KAAK,OAAO,QAAQ;CAC/C,MAAM,kBAAkB,OAAO,KAAK,OAAO,QAAQ;CACnD,IAAI,CAAC,eAAe,CAAC,iBAAiB,OAAO,CAAC;CAC9C,IAAI,CAAC,aACJ,MAAM,IAAIC,eAAAA,6BAA6B,KAAK,aAAa;CAE1D,IAAI,CAAC,iBACJ,MAAM,IAAIA,eAAAA,6BAA6B,KAAK,iBAAiB;CAE9D,OAAO;EAAE;EAAa;CAAgB;AACvC;AAEA,SAAS,OAAO,KAAa,OAAuB;CACnD,IAAI;EACH,OAAO,mBAAmB,KAAK;CAChC,QAAQ;EACP,MAAM,IAAIC,eAAAA,oBAAoB,GAAG;CAClC;AACD"}
package/dist/s3Url.d.cts CHANGED
@@ -1,2 +1,52 @@
1
- import { S3Address, build, parse } from "./s3Url-BfztIltX.cjs";
2
- export { S3Address, build, parse };
1
+ declare namespace s3Url_d_exports {
2
+ export { S3Address, build, parse };
3
+ }
4
+ /**
5
+ * The `s3://` URL codec — how an S3 bucket is addressed as a single string.
6
+ *
7
+ * It lives beside the client rather than in a neutral package because `bucket`,
8
+ * `region`, and `forcePathStyle` are S3's vocabulary. The neutral layer only
9
+ * knows that a construct provides *one URL*; what that URL says is between the
10
+ * component that composes it and the client that parses it. A `gs://` codec
11
+ * would sit beside its own client and share nothing with this one.
12
+ *
13
+ * Both directions live here so they cannot drift: `parse(build(x))` is `x`.
14
+ */
15
+ /**
16
+ * What an S3 URL addresses, and optionally who it calls as.
17
+ *
18
+ * Credentials are optional and come as a pair. With them, the URL is a key
19
+ * scoped to this one bucket (`s3://KEY:SECRET@uploads`); without them the AWS
20
+ * SDK resolves its own chain — an execution role when deployed,
21
+ * `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` otherwise. The URL's pair wins
22
+ * over that chain.
23
+ */
24
+ export interface S3Address {
25
+ bucket: string;
26
+ /** Read off the bucket, never inherited: a bucket may live in another region. */
27
+ region?: string;
28
+ /** Set for S3-compatible backends such as MinIO. */
29
+ endpoint?: string;
30
+ /** MinIO and most S3-compatible servers need path-style addressing. */
31
+ forcePathStyle?: boolean;
32
+ /** The URL's own access key; always paired with `secretAccessKey`. */
33
+ accessKeyId?: string;
34
+ /** The URL's own secret; always paired with `accessKeyId`. */
35
+ secretAccessKey?: string;
36
+ }
37
+ /**
38
+ * Compose an address into a URL.
39
+ *
40
+ * Credentials appear only when the address carries them, percent-encoded —
41
+ * AWS secrets routinely contain `/` and `+`. An address without them builds a
42
+ * URL with no userinfo, which leaves the caller to the SDK's own chain.
43
+ */
44
+ export declare function build(address: S3Address): string;
45
+ /**
46
+ * Parse a URL back into an address. Throws if it is not an `s3://` URL, or if
47
+ * its userinfo carries only one half of a key pair.
48
+ */
49
+ export declare function parse(url: string): S3Address;
50
+ //#endregion
51
+ export { s3Url_d_exports as t };
52
+ //# sourceMappingURL=s3Url.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3Url.d.cts","names":[],"sources":["../src/s3Url.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iBA4BiB;EAChB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;wBAYe,MAAM,SAAS;;;;;wBAgCf,MAAM,cAAc"}
package/dist/s3Url.d.mts CHANGED
@@ -1,2 +1,52 @@
1
- import { S3Address, build, parse } from "./s3Url-COpMIgF9.mjs";
2
- export { S3Address, build, parse };
1
+ declare namespace s3Url_d_exports {
2
+ export { S3Address, build, parse };
3
+ }
4
+ /**
5
+ * The `s3://` URL codec — how an S3 bucket is addressed as a single string.
6
+ *
7
+ * It lives beside the client rather than in a neutral package because `bucket`,
8
+ * `region`, and `forcePathStyle` are S3's vocabulary. The neutral layer only
9
+ * knows that a construct provides *one URL*; what that URL says is between the
10
+ * component that composes it and the client that parses it. A `gs://` codec
11
+ * would sit beside its own client and share nothing with this one.
12
+ *
13
+ * Both directions live here so they cannot drift: `parse(build(x))` is `x`.
14
+ */
15
+ /**
16
+ * What an S3 URL addresses, and optionally who it calls as.
17
+ *
18
+ * Credentials are optional and come as a pair. With them, the URL is a key
19
+ * scoped to this one bucket (`s3://KEY:SECRET@uploads`); without them the AWS
20
+ * SDK resolves its own chain — an execution role when deployed,
21
+ * `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` otherwise. The URL's pair wins
22
+ * over that chain.
23
+ */
24
+ export interface S3Address {
25
+ bucket: string;
26
+ /** Read off the bucket, never inherited: a bucket may live in another region. */
27
+ region?: string;
28
+ /** Set for S3-compatible backends such as MinIO. */
29
+ endpoint?: string;
30
+ /** MinIO and most S3-compatible servers need path-style addressing. */
31
+ forcePathStyle?: boolean;
32
+ /** The URL's own access key; always paired with `secretAccessKey`. */
33
+ accessKeyId?: string;
34
+ /** The URL's own secret; always paired with `accessKeyId`. */
35
+ secretAccessKey?: string;
36
+ }
37
+ /**
38
+ * Compose an address into a URL.
39
+ *
40
+ * Credentials appear only when the address carries them, percent-encoded —
41
+ * AWS secrets routinely contain `/` and `+`. An address without them builds a
42
+ * URL with no userinfo, which leaves the caller to the SDK's own chain.
43
+ */
44
+ export declare function build(address: S3Address): string;
45
+ /**
46
+ * Parse a URL back into an address. Throws if it is not an `s3://` URL, or if
47
+ * its userinfo carries only one half of a key pair.
48
+ */
49
+ export declare function parse(url: string): S3Address;
50
+ //#endregion
51
+ export { s3Url_d_exports as t };
52
+ //# sourceMappingURL=s3Url.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3Url.d.mts","names":[],"sources":["../src/s3Url.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iBA4BiB;EAChB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;wBAYe,MAAM,SAAS;;;;;wBAgCf,MAAM,cAAc"}