@wireapp/api-client 27.28.0 → 27.29.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.
- package/lib/APIClient.d.ts +1 -0
- package/lib/APIClient.d.ts.map +1 -1
- package/lib/APIClient.js +9 -11
- package/lib/Config.d.ts +0 -13
- package/lib/Config.d.ts.map +1 -1
- package/lib/cells/CellsAPI.d.ts +27 -7
- package/lib/cells/CellsAPI.d.ts.map +1 -1
- package/lib/cells/CellsAPI.js +58 -3
- package/lib/demo/initClient.d.ts.map +1 -1
- package/lib/demo/initClient.js +0 -13
- package/package.json +2 -2
package/lib/APIClient.d.ts
CHANGED
package/lib/APIClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIClient.d.ts","sourceRoot":"","sources":["../src/APIClient.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAIpC,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAC;AAClC,OAAO,EACL,eAAe,EAEf,OAAO,EACP,OAAO,EACP,MAAM,EACN,iBAAiB,EACjB,SAAS,EAET,YAAY,EACb,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,WAAW,CAAC;AAChD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AACrC,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAC;AAClC,O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C9D,IAAW,eAAe,IAAI,MAAM,CAKnC;IAED,gEAAgE;IAChE,IAAW,iBAAiB,IAAI,MAAM,CAKrC;IAED;;OAEG;IACU,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAc7C"}
|
package/lib/APIClient.js
CHANGED
|
@@ -35,7 +35,6 @@ const env_1 = require("./env/");
|
|
|
35
35
|
const generic_1 = require("./generic");
|
|
36
36
|
const giphy_1 = require("./giphy/");
|
|
37
37
|
const http_1 = require("./http/");
|
|
38
|
-
const cells_1 = require("./mocks/cells");
|
|
39
38
|
const notification_1 = require("./notification/");
|
|
40
39
|
const OAuthAPI_1 = require("./oauth/OAuthAPI");
|
|
41
40
|
const obfuscation_1 = require("./obfuscation/");
|
|
@@ -63,6 +62,7 @@ class APIClient extends events_1.EventEmitter {
|
|
|
63
62
|
logger;
|
|
64
63
|
// APIs
|
|
65
64
|
api;
|
|
65
|
+
cellsApi = null;
|
|
66
66
|
// Configuration
|
|
67
67
|
accessTokenStore;
|
|
68
68
|
context;
|
|
@@ -102,22 +102,20 @@ class APIClient extends events_1.EventEmitter {
|
|
|
102
102
|
configureApis(backendFeatures) {
|
|
103
103
|
this.logger.info('configuring APIs with config', backendFeatures);
|
|
104
104
|
const assetAPI = new asset_1.AssetAPI(this.transport.http, backendFeatures);
|
|
105
|
-
//
|
|
106
|
-
|
|
105
|
+
// Prevents the CellsAPI from being initialized multiple times
|
|
106
|
+
if (!this.cellsApi) {
|
|
107
|
+
this.cellsApi = new CellsAPI_1.CellsAPI({
|
|
108
|
+
httpClientConfig: this.config,
|
|
109
|
+
accessTokenStore: this.accessTokenStore,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
107
112
|
return {
|
|
108
113
|
account: new AccountAPI_1.AccountAPI(this.transport.http),
|
|
109
114
|
asset: assetAPI,
|
|
110
115
|
auth: new auth_1.AuthAPI(this.transport.http),
|
|
111
116
|
services: new services_1.ServicesAPI(this.transport.http, assetAPI),
|
|
112
117
|
broadcast: new broadcast_1.BroadcastAPI(this.transport.http),
|
|
113
|
-
cells:
|
|
114
|
-
httpClient: new http_1.HttpClient({
|
|
115
|
-
...this.config,
|
|
116
|
-
urls: { ...this.config.urls, rest: cellsConfig.pydio.url + cellsConfig.pydio.segment },
|
|
117
|
-
headers: { ...this.config.headers, Authorization: `Bearer ${cellsConfig.pydio.apiKey}` },
|
|
118
|
-
}, this.accessTokenStore),
|
|
119
|
-
config: cellsConfig,
|
|
120
|
-
}),
|
|
118
|
+
cells: this.cellsApi,
|
|
121
119
|
client: new client_1.ClientAPI(this.transport.http),
|
|
122
120
|
connection: new connection_1.ConnectionAPI(this.transport.http),
|
|
123
121
|
conversation: new conversation_1.ConversationAPI(this.transport.http, backendFeatures),
|
package/lib/Config.d.ts
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import { BackendData } from './env/';
|
|
2
2
|
export interface Config {
|
|
3
3
|
urls: BackendData;
|
|
4
|
-
cells?: {
|
|
5
|
-
pydio: {
|
|
6
|
-
apiKey: string;
|
|
7
|
-
segment: string;
|
|
8
|
-
url: string;
|
|
9
|
-
};
|
|
10
|
-
s3: {
|
|
11
|
-
apiKey: string;
|
|
12
|
-
bucket: string;
|
|
13
|
-
endpoint: string;
|
|
14
|
-
region: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
4
|
headers?: Record<string, string>;
|
|
18
5
|
}
|
|
19
6
|
//# sourceMappingURL=Config.d.ts.map
|
package/lib/Config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../src/Config.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,QAAQ,CAAC;AAEnC,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,WAAW,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../src/Config.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,QAAQ,CAAC;AAEnC,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC"}
|
package/lib/cells/CellsAPI.d.ts
CHANGED
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
import { RestCreateCheckResponse, RestDeleteVersionResponse, RestNode, RestNodeCollection, RestPerformActionResponse, RestPromoteVersionResponse, RestPublicLinkDeleteSuccess, RestShareLink, RestVersion } from 'cells-sdk-ts';
|
|
2
2
|
import { CellsStorage } from './CellsStorage/CellsStorage';
|
|
3
|
-
import {
|
|
3
|
+
import { AccessTokenStore } from '../auth';
|
|
4
4
|
import { HttpClient } from '../http';
|
|
5
|
+
interface CellsConfig {
|
|
6
|
+
pydio: {
|
|
7
|
+
apiKey: string;
|
|
8
|
+
segment: string;
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
11
|
+
s3: {
|
|
12
|
+
apiKey: string;
|
|
13
|
+
bucket: string;
|
|
14
|
+
endpoint: string;
|
|
15
|
+
region: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
5
18
|
export declare class CellsAPI {
|
|
6
|
-
private
|
|
7
|
-
private
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
private accessTokenStore;
|
|
20
|
+
private httpClientConfig;
|
|
21
|
+
private storageService;
|
|
22
|
+
private client;
|
|
23
|
+
constructor({ accessTokenStore, httpClientConfig, }: {
|
|
24
|
+
accessTokenStore: AccessTokenStore;
|
|
25
|
+
httpClientConfig: HttpClient['config'];
|
|
12
26
|
});
|
|
27
|
+
initialize({ cellsConfig, httpClient, storageService, }: {
|
|
28
|
+
cellsConfig: CellsConfig;
|
|
29
|
+
httpClient?: HttpClient;
|
|
30
|
+
storageService?: CellsStorage;
|
|
31
|
+
}): void;
|
|
13
32
|
uploadFileDraft({ uuid, versionId, path, file, autoRename, }: {
|
|
14
33
|
uuid: string;
|
|
15
34
|
versionId: string;
|
|
@@ -57,4 +76,5 @@ export declare class CellsAPI {
|
|
|
57
76
|
uuid: string;
|
|
58
77
|
}): Promise<RestShareLink>;
|
|
59
78
|
}
|
|
79
|
+
export {};
|
|
60
80
|
//# sourceMappingURL=CellsAPI.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CellsAPI.d.ts","sourceRoot":"","sources":["../../src/cells/CellsAPI.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEL,uBAAuB,EACvB,yBAAyB,EACzB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,aAAa,EACb,WAAW,EACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAGzD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"CellsAPI.d.ts","sourceRoot":"","sources":["../../src/cells/CellsAPI.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEL,uBAAuB,EACvB,yBAAyB,EACzB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,aAAa,EACb,WAAW,EACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAGzD,OAAO,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AAInC,UAAU,WAAW;IACnB,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,EAAE,EAAE;QACF,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,q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AAA;KAAC,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;IAmBvE,gBAAgB,CAAC,EAAC,IAAI,EAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;IAmBvE,eAAe,CAAC,EAAC,IAAI,EAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC;IAU3E,OAAO,CAAC,EAAC,EAAE,EAAC,EAAE;QAAC,EAAE,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,QAAQ,CAAC;IAU9C,WAAW,CAAC,EAAC,IAAI,EAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAahE,WAAW,CAAC,EAAC,MAAM,EAAC,EAAE;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAapE,oBAAoB,CAAC,EAAC,IAAI,EAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAUlF,oBAAoB,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAe3F,iBAAiB,CAAC,EAAC,IAAI,EAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,aAAa,CAAC;CASxE"}
|
package/lib/cells/CellsAPI.js
CHANGED
|
@@ -21,14 +21,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.CellsAPI = void 0;
|
|
22
22
|
const cells_sdk_ts_1 = require("cells-sdk-ts");
|
|
23
23
|
const S3Service_1 = require("./CellsStorage/S3Service");
|
|
24
|
+
const http_1 = require("../http");
|
|
25
|
+
const CONFIGURATION_ERROR = 'CellsAPI is not initialized. Call initialize() before using any methods.';
|
|
24
26
|
class CellsAPI {
|
|
27
|
+
accessTokenStore;
|
|
28
|
+
httpClientConfig;
|
|
25
29
|
storageService;
|
|
26
30
|
client;
|
|
27
|
-
constructor({
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
31
|
+
constructor({ accessTokenStore, httpClientConfig, }) {
|
|
32
|
+
this.accessTokenStore = accessTokenStore;
|
|
33
|
+
this.httpClientConfig = httpClientConfig;
|
|
34
|
+
this.storageService = null;
|
|
35
|
+
this.client = null;
|
|
36
|
+
}
|
|
37
|
+
initialize({ cellsConfig, httpClient, storageService, }) {
|
|
38
|
+
const http = httpClient ||
|
|
39
|
+
new http_1.HttpClient({
|
|
40
|
+
...this.httpClientConfig,
|
|
41
|
+
urls: { ...this.httpClientConfig.urls, rest: cellsConfig.pydio.url + cellsConfig.pydio.segment },
|
|
42
|
+
headers: { ...this.httpClientConfig.headers, Authorization: `Bearer ${cellsConfig.pydio.apiKey}` },
|
|
43
|
+
}, this.accessTokenStore);
|
|
44
|
+
this.storageService = storageService || new S3Service_1.S3Service(cellsConfig.s3);
|
|
45
|
+
this.client = new cells_sdk_ts_1.NodeServiceApi(undefined, undefined, http.client);
|
|
30
46
|
}
|
|
31
47
|
async uploadFileDraft({ uuid, versionId, path, file, autoRename = true, }) {
|
|
48
|
+
if (!this.client || !this.storageService) {
|
|
49
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
50
|
+
}
|
|
32
51
|
let filePath = `${path}`.normalize('NFC');
|
|
33
52
|
const result = await this.client.createCheck({
|
|
34
53
|
Inputs: [{ Type: 'LEAF', Locator: { Path: filePath, Uuid: uuid }, VersionId: versionId }],
|
|
@@ -46,18 +65,30 @@ class CellsAPI {
|
|
|
46
65
|
return result.data;
|
|
47
66
|
}
|
|
48
67
|
async promoteFileDraft({ uuid, versionId }) {
|
|
68
|
+
if (!this.client || !this.storageService) {
|
|
69
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
70
|
+
}
|
|
49
71
|
const result = await this.client.promoteVersion(uuid, versionId, { Publish: true });
|
|
50
72
|
return result.data;
|
|
51
73
|
}
|
|
52
74
|
async deleteFileDraft({ uuid, versionId }) {
|
|
75
|
+
if (!this.client || !this.storageService) {
|
|
76
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
77
|
+
}
|
|
53
78
|
const result = await this.client.deleteVersion(uuid, versionId);
|
|
54
79
|
return result.data;
|
|
55
80
|
}
|
|
56
81
|
async deleteFile({ uuid }) {
|
|
82
|
+
if (!this.client || !this.storageService) {
|
|
83
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
84
|
+
}
|
|
57
85
|
const result = await this.client.performAction('delete', { Nodes: [{ Uuid: uuid }] });
|
|
58
86
|
return result.data;
|
|
59
87
|
}
|
|
60
88
|
async lookupFileByPath({ path }) {
|
|
89
|
+
if (!this.client || !this.storageService) {
|
|
90
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
91
|
+
}
|
|
61
92
|
const result = await this.client.lookup({
|
|
62
93
|
Locators: { Many: [{ Path: path }] },
|
|
63
94
|
Flags: ['WithVersionsAll', 'WithPreSignedURLs'],
|
|
@@ -69,6 +100,9 @@ class CellsAPI {
|
|
|
69
100
|
return node;
|
|
70
101
|
}
|
|
71
102
|
async lookupFileByUuid({ uuid }) {
|
|
103
|
+
if (!this.client || !this.storageService) {
|
|
104
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
105
|
+
}
|
|
72
106
|
const result = await this.client.lookup({
|
|
73
107
|
Locators: { Many: [{ Uuid: uuid }] },
|
|
74
108
|
Flags: ['WithVersionsAll', 'WithPreSignedURLs'],
|
|
@@ -80,14 +114,23 @@ class CellsAPI {
|
|
|
80
114
|
return node;
|
|
81
115
|
}
|
|
82
116
|
async getFileVersions({ uuid }) {
|
|
117
|
+
if (!this.client || !this.storageService) {
|
|
118
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
119
|
+
}
|
|
83
120
|
const result = await this.client.nodeVersions(uuid, { FilterBy: 'VersionsAll' });
|
|
84
121
|
return result.data.Versions;
|
|
85
122
|
}
|
|
86
123
|
async getFile({ id }) {
|
|
124
|
+
if (!this.client || !this.storageService) {
|
|
125
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
126
|
+
}
|
|
87
127
|
const result = await this.client.getByUuid(id);
|
|
88
128
|
return result.data;
|
|
89
129
|
}
|
|
90
130
|
async getAllFiles({ path }) {
|
|
131
|
+
if (!this.client || !this.storageService) {
|
|
132
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
133
|
+
}
|
|
91
134
|
const result = await this.client.lookup({
|
|
92
135
|
Locators: { Many: [{ Path: `${path}/*` }] },
|
|
93
136
|
Flags: ['WithVersionsAll', 'WithPreSignedURLs'],
|
|
@@ -95,6 +138,9 @@ class CellsAPI {
|
|
|
95
138
|
return result.data;
|
|
96
139
|
}
|
|
97
140
|
async searchFiles({ phrase }) {
|
|
141
|
+
if (!this.client || !this.storageService) {
|
|
142
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
143
|
+
}
|
|
98
144
|
const result = await this.client.lookup({
|
|
99
145
|
Query: { FileName: phrase, Type: 'LEAF' },
|
|
100
146
|
Flags: ['WithVersionsAll', 'WithPreSignedURLs'],
|
|
@@ -102,10 +148,16 @@ class CellsAPI {
|
|
|
102
148
|
return result.data;
|
|
103
149
|
}
|
|
104
150
|
async deleteFilePublicLink({ uuid }) {
|
|
151
|
+
if (!this.client || !this.storageService) {
|
|
152
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
153
|
+
}
|
|
105
154
|
const result = await this.client.deletePublicLink(uuid);
|
|
106
155
|
return result.data;
|
|
107
156
|
}
|
|
108
157
|
async createFilePublicLink({ uuid, label }) {
|
|
158
|
+
if (!this.client || !this.storageService) {
|
|
159
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
160
|
+
}
|
|
109
161
|
const result = await this.client.createPublicLink(uuid, {
|
|
110
162
|
Link: {
|
|
111
163
|
Label: label,
|
|
@@ -115,6 +167,9 @@ class CellsAPI {
|
|
|
115
167
|
return result.data;
|
|
116
168
|
}
|
|
117
169
|
async getFilePublicLink({ uuid }) {
|
|
170
|
+
if (!this.client || !this.storageService) {
|
|
171
|
+
throw new Error(CONFIGURATION_ERROR);
|
|
172
|
+
}
|
|
118
173
|
const result = await this.client.getPublicLink(uuid);
|
|
119
174
|
return result.data;
|
|
120
175
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initClient.d.ts","sourceRoot":"","sources":["../../src/demo/initClient.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAOvC,wBAAsB,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"initClient.d.ts","sourceRoot":"","sources":["../../src/demo/initClient.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAOvC,wBAAsB,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC,CAoBrD"}
|
package/lib/demo/initClient.js
CHANGED
|
@@ -34,19 +34,6 @@ async function initClient() {
|
|
|
34
34
|
rest: process.env.WIRE_BACKEND_REST,
|
|
35
35
|
ws: process.env.WIRE_BACKEND_WS,
|
|
36
36
|
},
|
|
37
|
-
cells: {
|
|
38
|
-
pydio: {
|
|
39
|
-
apiKey: process.env.CELLS_PYDIO_API_KEY,
|
|
40
|
-
url: process.env.CELLS_PYDIO_URL,
|
|
41
|
-
segment: process.env.CELLS_PYDIO_REST_SEGMENT,
|
|
42
|
-
},
|
|
43
|
-
s3: {
|
|
44
|
-
apiKey: process.env.CELLS_S3_API_KEY,
|
|
45
|
-
bucket: process.env.CELLS_S3_BUCKET,
|
|
46
|
-
endpoint: process.env.CELLS_S3_ENDPOINT,
|
|
47
|
-
region: process.env.CELLS_S3_REGION,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
37
|
};
|
|
51
38
|
const apiClient = new APIClient_1.APIClient(apiConfig);
|
|
52
39
|
await apiClient.login(credentials);
|
package/package.json
CHANGED