@code.store/arcxp-sdk-ts 4.44.0 → 4.45.0
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.
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { type ReadStream } from 'node:fs';
|
|
1
3
|
import type { AGallery } from '../../types/gallery';
|
|
2
4
|
import type { AnImage } from '../../types/story';
|
|
3
5
|
import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api';
|
|
@@ -6,6 +8,10 @@ export declare class ArcProtoCenter extends ArcAbstractAPI {
|
|
|
6
8
|
constructor(options: ArcAPIOptions);
|
|
7
9
|
getImageDataById(imageId: string): Promise<AnImage>;
|
|
8
10
|
uploadImageANS(image: AnImage): Promise<AnImage>;
|
|
11
|
+
uploadImageStream(readableStream: ReadStream, options?: {
|
|
12
|
+
contentType?: string;
|
|
13
|
+
filename?: string;
|
|
14
|
+
}): Promise<AnImage>;
|
|
9
15
|
deleteImage(imageId: string): Promise<any>;
|
|
10
16
|
deleteGallery(galleryId: string): Promise<any>;
|
|
11
17
|
getImages(params: GetImagesParams): Promise<GetImagesResponse>;
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ArcProtoCenter = void 0;
|
|
7
7
|
const form_data_1 = __importDefault(require("form-data"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
9
|
const abstract_api_1 = require("../abstract-api");
|
|
9
10
|
class ArcProtoCenter extends abstract_api_1.ArcAbstractAPI {
|
|
10
11
|
constructor(options) {
|
|
@@ -23,6 +24,17 @@ class ArcProtoCenter extends abstract_api_1.ArcAbstractAPI {
|
|
|
23
24
|
const { data } = await this.client.post('/v2/photos', form, { headers: form.getHeaders() });
|
|
24
25
|
return data;
|
|
25
26
|
}
|
|
27
|
+
async uploadImageStream(readableStream, options) {
|
|
28
|
+
const form = new form_data_1.default();
|
|
29
|
+
const contentType = options?.contentType ?? 'application/octet-stream';
|
|
30
|
+
const filename = node_path_1.default.basename(String(options?.filename || readableStream.path || 'file.jpg'));
|
|
31
|
+
form.append('file', readableStream, {
|
|
32
|
+
filename: filename,
|
|
33
|
+
contentType,
|
|
34
|
+
});
|
|
35
|
+
const { data } = await this.client.post('/v2/photos', form, { headers: form.getHeaders() });
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
26
38
|
async deleteImage(imageId) {
|
|
27
39
|
const { data } = await this.client.delete(`/v2/photos/${imageId}`);
|
|
28
40
|
return data;
|
|
@@ -44,7 +56,7 @@ class ArcProtoCenter extends abstract_api_1.ArcAbstractAPI {
|
|
|
44
56
|
return data;
|
|
45
57
|
}
|
|
46
58
|
async updateImage(imageId, photoDto) {
|
|
47
|
-
const { data } = await this.client.put(`/v2/photos/${imageId}`,
|
|
59
|
+
const { data } = await this.client.put(`/v2/photos/${imageId}`, photoDto);
|
|
48
60
|
return data;
|
|
49
61
|
}
|
|
50
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/photo-center/index.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAiC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/photo-center/index.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAiC;AACjC,0DAA6B;AAI7B,kDAAqE;AAGrE,MAAa,cAAe,SAAQ,6BAAc;IAChD,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,KAAK,CAAC,gBAAgB,CAAC,OAAe;QACpC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,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AAC;IAED,KAAK,CAAC,aAAa,CAAC,SAAiB;QACnC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,SAAS,EAAE,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAAuB;QACrC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAoB,YAAY,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAuB,eAAe,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAC1F,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,SAAiB;QAChC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAW,iBAAiB,SAAS,EAAE,CAAC,CAAC;QAC/E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAe,EAAE,QAAiB;QAClD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAU,cAAc,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;QACnF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAlED,wCAkEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code.store/arcxp-sdk-ts",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.45.0",
|
|
4
4
|
"description": "A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/index.js",
|