@maestro-js/file-storage 1.0.0-alpha.22 → 1.0.0-alpha.24

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.
package/dist/index.d.ts CHANGED
@@ -62,7 +62,7 @@ declare function provider(key: FileStorage.Provider.Key): {
62
62
  missing: (path: string) => Promise<boolean>;
63
63
  download: (path: string, filename?: string, headers?: HeadersInit) => Promise<Response>;
64
64
  url: (path: string) => string;
65
- temporaryUrl: (path: string, expires: Iso.Instant, params?: any) => Promise<string>;
65
+ temporaryUrl: (path: string, expires: Iso.Instant | Iso.Duration, params?: any) => Promise<string>;
66
66
  temporaryUploadUrl: (path: string, expires: Iso.Instant) => Promise<{
67
67
  url: string;
68
68
  headers: Headers;
@@ -99,7 +99,7 @@ declare const FileStorage: {
99
99
  missing: (path: string) => Promise<boolean>;
100
100
  download: (path: string, filename?: string, headers?: HeadersInit) => Promise<Response>;
101
101
  url: (path: string) => string;
102
- temporaryUrl: (path: string, expires: Iso.Instant, params?: any) => Promise<string>;
102
+ temporaryUrl: (path: string, expires: Iso.Instant | Iso.Duration, params?: any) => Promise<string>;
103
103
  temporaryUploadUrl: (path: string, expires: Iso.Instant) => Promise<{
104
104
  url: string;
105
105
  headers: Headers;
@@ -137,7 +137,7 @@ declare namespace FileStorage {
137
137
  missing(path: string): Promise<boolean>;
138
138
  download(path: string, filename?: string, headers?: HeadersInit): Promise<Response>;
139
139
  url(path: string): string;
140
- temporaryUrl(path: string, expires: Iso.Instant, params?: any): Promise<string>;
140
+ temporaryUrl(path: string, expires: Iso.Instant | Iso.Duration, params?: any): Promise<string>;
141
141
  temporaryUploadUrl(path: string, expires: Iso.Instant): Promise<{
142
142
  url: string;
143
143
  headers: Headers;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- import "iso-fns2";
2
+ import { durationFns, instantFns } from "iso-fns2";
3
3
  import { parse as parsePath, join as joinPath } from "path";
4
4
  import "stream";
5
5
  import "stream/web";
@@ -511,7 +511,8 @@ function create(config) {
511
511
  return driver.url(path2);
512
512
  }
513
513
  async function temporaryUrl(path2, expires, params) {
514
- return await driver.temporaryUrl(path2, expires, params);
514
+ const expirationDate = durationFns.isValid(expires) ? instantFns.add(instantFns.now(), expires) : expires;
515
+ return await driver.temporaryUrl(path2, expirationDate, params);
515
516
  }
516
517
  async function temporaryUploadUrl(path2, expires) {
517
518
  return await driver.temporaryUploadUrl(path2, expires);
package/package.json CHANGED
@@ -7,9 +7,9 @@
7
7
  "default": "./dist/index.js"
8
8
  }
9
9
  },
10
- "version": "1.0.0-alpha.22",
10
+ "version": "1.0.0-alpha.24",
11
11
  "publishConfig": {
12
- "access": "restricted"
12
+ "access": "public"
13
13
  },
14
14
  "files": [
15
15
  "dist"
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "iso-fns2": "npm:iso-fns@2.0.0-alpha.26",
19
19
  "mime-types": "^2.1.35",
20
- "@maestro-js/service-registry": "1.0.0-alpha.22"
20
+ "@maestro-js/service-registry": "1.0.0-alpha.24"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@aws-sdk/client-s3": "^3.750.0",