@forge/os 2.1.5-next.1 → 2.1.5-next.2
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/out/os.d.ts +5 -5
- package/out/os.d.ts.map +1 -1
- package/out/os.js +10 -10
- package/package.json +1 -1
package/out/os.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ import { ObjectReference, PresignedUrlResponse, UploadUrlBody } from './types';
|
|
|
4
4
|
export declare class ObjectStoreClient {
|
|
5
5
|
private sendRequest;
|
|
6
6
|
private requestJson;
|
|
7
|
-
put(
|
|
8
|
-
get(
|
|
9
|
-
delete(
|
|
10
|
-
download(
|
|
7
|
+
put(key: string, buffer: Buffer, ttlSeconds?: number): Promise<ObjectReference | undefined>;
|
|
8
|
+
get(key: string): Promise<ObjectReference | undefined>;
|
|
9
|
+
delete(key: string): Promise<void>;
|
|
10
|
+
download(key: string): Promise<Buffer | undefined>;
|
|
11
11
|
createUploadUrl(body: UploadUrlBody): Promise<PresignedUrlResponse | undefined>;
|
|
12
|
-
createDownloadUrl(
|
|
12
|
+
createDownloadUrl(key: string): Promise<PresignedUrlResponse | undefined>;
|
|
13
13
|
}
|
|
14
14
|
export declare const os: ObjectStoreClient;
|
|
15
15
|
//# sourceMappingURL=os.d.ts.map
|
package/out/os.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"os.d.ts","sourceRoot":"","sources":["../src/os.ts"],"names":[],"mappings":";;AAGA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAS/E,qBAAa,iBAAiB;YAEd,WAAW;YASX,WAAW;IAqCZ,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"os.d.ts","sourceRoot":"","sources":["../src/os.ts"],"names":[],"mappings":";;AAGA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAS/E,qBAAa,iBAAiB;YAEd,WAAW;YASX,WAAW;IAqCZ,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAa3F,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAgBtD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAalC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAoBlD,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAgB/E,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;CAWvF;AAED,eAAO,MAAM,EAAE,mBAA0B,CAAC"}
|
package/out/os.js
CHANGED
|
@@ -40,25 +40,25 @@ class ObjectStoreClient {
|
|
|
40
40
|
throw new errors_1.ForgeObjectStoreError(`Unexpected error. Response was not valid JSON: ${responseText}`);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
async put(
|
|
43
|
+
async put(key, buffer, ttlSeconds) {
|
|
44
44
|
const headers = {
|
|
45
45
|
Accept: 'application/json',
|
|
46
46
|
'Content-Type': 'application/octet-stream',
|
|
47
47
|
...(ttlSeconds ? { 'ttl-seconds': ttlSeconds.toString() } : {})
|
|
48
48
|
};
|
|
49
|
-
return this.requestJson(ValidHttpMethod.PUT, `api/v1/objects/${
|
|
49
|
+
return this.requestJson(ValidHttpMethod.PUT, `api/v1/objects/${key}`, headers, buffer);
|
|
50
50
|
}
|
|
51
|
-
async get(
|
|
51
|
+
async get(key) {
|
|
52
52
|
return this.requestJson(ValidHttpMethod.POST, `api/v1/metadata`, {
|
|
53
53
|
Accept: 'application/json',
|
|
54
54
|
'Content-Type': 'application/json'
|
|
55
|
-
}, JSON.stringify({ key
|
|
55
|
+
}, JSON.stringify({ key }));
|
|
56
56
|
}
|
|
57
|
-
async delete(
|
|
58
|
-
return this.requestJson(ValidHttpMethod.POST, `api/v1/delete`, { Accept: 'application/json', 'Content-Type': 'application/json' }, JSON.stringify({ key
|
|
57
|
+
async delete(key) {
|
|
58
|
+
return this.requestJson(ValidHttpMethod.POST, `api/v1/delete`, { Accept: 'application/json', 'Content-Type': 'application/json' }, JSON.stringify({ key }));
|
|
59
59
|
}
|
|
60
|
-
async download(
|
|
61
|
-
const response = await this.sendRequest(`api/v1/objects/${
|
|
60
|
+
async download(key) {
|
|
61
|
+
const response = await this.sendRequest(`api/v1/objects/${key}/download`, {
|
|
62
62
|
method: ValidHttpMethod.GET,
|
|
63
63
|
headers: {
|
|
64
64
|
Accept: 'application/octet-stream'
|
|
@@ -76,11 +76,11 @@ class ObjectStoreClient {
|
|
|
76
76
|
'Content-Type': 'application/json'
|
|
77
77
|
}, JSON.stringify(body));
|
|
78
78
|
}
|
|
79
|
-
async createDownloadUrl(
|
|
79
|
+
async createDownloadUrl(key) {
|
|
80
80
|
return this.requestJson(ValidHttpMethod.POST, `api/v1/download-url`, {
|
|
81
81
|
Accept: 'application/json',
|
|
82
82
|
'Content-Type': 'application/json'
|
|
83
|
-
}, JSON.stringify({ key
|
|
83
|
+
}, JSON.stringify({ key }));
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
exports.ObjectStoreClient = ObjectStoreClient;
|