@or-sdk/library 0.2.3-beta.2158.0 → 0.2.3
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/CHANGELOG.md +9 -0
- package/README.md +59 -13
- package/dist/cjs/LibraryV1.js +35 -35
- package/dist/cjs/LibraryV1.js.map +1 -1
- package/dist/cjs/LibraryV2.js +16 -35
- package/dist/cjs/LibraryV2.js.map +1 -1
- package/dist/esm/LibraryV1.js +35 -35
- package/dist/esm/LibraryV1.js.map +1 -1
- package/dist/esm/LibraryV2.js +16 -30
- package/dist/esm/LibraryV2.js.map +1 -1
- package/dist/types/LibraryV1.d.ts +1 -1
- package/dist/types/LibraryV1.d.ts.map +1 -1
- package/dist/types/LibraryV2.d.ts +3 -4
- package/dist/types/LibraryV2.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/LibraryV1.ts +35 -35
- package/src/LibraryV2.ts +117 -58
package/src/LibraryV1.ts
CHANGED
|
@@ -68,7 +68,7 @@ export class LibraryV1 extends Base {
|
|
|
68
68
|
this._feature = feature;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
private async
|
|
71
|
+
private async _makeRequest<T>(params: CalApiParams): Promise<T> {
|
|
72
72
|
if (this._feature && this._feature !== 'master') {
|
|
73
73
|
params.params ||= {};
|
|
74
74
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -88,7 +88,7 @@ export class LibraryV1 extends Base {
|
|
|
88
88
|
): Promise<GetPackagesResponseDTO> {
|
|
89
89
|
const packageType = type ?? this.packageType;
|
|
90
90
|
|
|
91
|
-
return this.
|
|
91
|
+
return this._makeRequest({
|
|
92
92
|
route: `/api/v1/packages/${packageType}`,
|
|
93
93
|
signal,
|
|
94
94
|
params,
|
|
@@ -105,7 +105,7 @@ export class LibraryV1 extends Base {
|
|
|
105
105
|
): Promise<GetPackagesResponseDTO> {
|
|
106
106
|
const packageType = type ?? this.packageType;
|
|
107
107
|
|
|
108
|
-
return this.
|
|
108
|
+
return this._makeRequest({
|
|
109
109
|
route: `/api/v1/packages/${packageType}/favorites`,
|
|
110
110
|
signal,
|
|
111
111
|
params,
|
|
@@ -123,7 +123,7 @@ export class LibraryV1 extends Base {
|
|
|
123
123
|
params: GetPackagesQueryDTO,
|
|
124
124
|
{ signal, customHeaders }: CrossEnvOptionalParams = {}
|
|
125
125
|
): Promise<GetPackagesResponseDTO> {
|
|
126
|
-
return this.
|
|
126
|
+
return this._makeRequest({
|
|
127
127
|
method: 'GET',
|
|
128
128
|
route: `/api/v1/packages/${this.packageType}/new`,
|
|
129
129
|
params,
|
|
@@ -143,7 +143,7 @@ export class LibraryV1 extends Base {
|
|
|
143
143
|
params: GetPackagesQueryDTO,
|
|
144
144
|
{ signal, customHeaders }: CrossEnvOptionalParams = {}
|
|
145
145
|
): Promise<GetPackagesResponseDTO> {
|
|
146
|
-
return this.
|
|
146
|
+
return this._makeRequest({
|
|
147
147
|
method: 'GET',
|
|
148
148
|
route: `/api/v1/packages/${this.packageType}/popular`,
|
|
149
149
|
params,
|
|
@@ -162,7 +162,7 @@ export class LibraryV1 extends Base {
|
|
|
162
162
|
): Promise<GetPackagesResponseDTO> {
|
|
163
163
|
const packageType = type ?? this.packageType;
|
|
164
164
|
|
|
165
|
-
return this.
|
|
165
|
+
return this._makeRequest({
|
|
166
166
|
route: `/api/v1/playground/${packageType}`,
|
|
167
167
|
signal,
|
|
168
168
|
params,
|
|
@@ -183,9 +183,9 @@ export class LibraryV1 extends Base {
|
|
|
183
183
|
const packageType = type ?? this.packageType;
|
|
184
184
|
const { id, version } = data;
|
|
185
185
|
|
|
186
|
-
return this.
|
|
186
|
+
return this._makeRequest({
|
|
187
187
|
method: 'POST',
|
|
188
|
-
route: `/api/v1/packages/${packageType}/id/${id}/version/${version}`,
|
|
188
|
+
route: `/api/v1/packages/${packageType}/id/${encodeURIComponent(id)}/version/${version}`,
|
|
189
189
|
data,
|
|
190
190
|
customHeaders,
|
|
191
191
|
signal,
|
|
@@ -203,9 +203,9 @@ export class LibraryV1 extends Base {
|
|
|
203
203
|
const packageType = type ?? this.packageType;
|
|
204
204
|
const { id, version } = data;
|
|
205
205
|
|
|
206
|
-
return this.
|
|
206
|
+
return this._makeRequest({
|
|
207
207
|
method: 'POST',
|
|
208
|
-
route: `/api/v1/playground/${packageType}/id/${id}/version/${version}`,
|
|
208
|
+
route: `/api/v1/playground/${packageType}/id/${encodeURIComponent(id)}/version/${version}`,
|
|
209
209
|
data,
|
|
210
210
|
signal,
|
|
211
211
|
});
|
|
@@ -226,8 +226,8 @@ export class LibraryV1 extends Base {
|
|
|
226
226
|
const packageType = type ?? this.packageType;
|
|
227
227
|
const index = isPlayground ? INDEX_TYPE.PLAYGROUND : INDEX_TYPE.PACKAGES;
|
|
228
228
|
|
|
229
|
-
return this.
|
|
230
|
-
route: `/api/v1/${index}/${packageType}/id/${id}`,
|
|
229
|
+
return this._makeRequest({
|
|
230
|
+
route: `/api/v1/${index}/${packageType}/id/${encodeURIComponent(id)}`,
|
|
231
231
|
signal,
|
|
232
232
|
params,
|
|
233
233
|
});
|
|
@@ -243,9 +243,9 @@ export class LibraryV1 extends Base {
|
|
|
243
243
|
) {
|
|
244
244
|
const packageType = type ?? this.packageType;
|
|
245
245
|
|
|
246
|
-
return this.
|
|
246
|
+
return this._makeRequest({
|
|
247
247
|
method: 'DELETE',
|
|
248
|
-
route: `/api/v1/playground/${packageType}/id/${id}/version/${version}`,
|
|
248
|
+
route: `/api/v1/playground/${packageType}/id/${encodeURIComponent(id)}/version/${version}`,
|
|
249
249
|
signal,
|
|
250
250
|
});
|
|
251
251
|
}
|
|
@@ -260,8 +260,8 @@ export class LibraryV1 extends Base {
|
|
|
260
260
|
): Promise<GetPackageResponseDTO> {
|
|
261
261
|
const packageType = type ?? this.packageType;
|
|
262
262
|
|
|
263
|
-
return this.
|
|
264
|
-
route: `/api/v1/packages/${packageType}/id/${id}/latest`,
|
|
263
|
+
return this._makeRequest({
|
|
264
|
+
route: `/api/v1/packages/${packageType}/id/${encodeURIComponent(id)}/latest`,
|
|
265
265
|
signal,
|
|
266
266
|
});
|
|
267
267
|
}
|
|
@@ -280,9 +280,9 @@ export class LibraryV1 extends Base {
|
|
|
280
280
|
const packageType = type ?? this.packageType;
|
|
281
281
|
const index = isPlayground ? INDEX_TYPE.PLAYGROUND : INDEX_TYPE.PACKAGES;
|
|
282
282
|
|
|
283
|
-
return this.
|
|
283
|
+
return this._makeRequest({
|
|
284
284
|
method: 'GET',
|
|
285
|
-
route: `/api/v1/${index}/${packageType}/id/${id}/version/${version}`,
|
|
285
|
+
route: `/api/v1/${index}/${packageType}/id/${encodeURIComponent(id)}/version/${version}`,
|
|
286
286
|
customHeaders,
|
|
287
287
|
signal,
|
|
288
288
|
});
|
|
@@ -298,8 +298,8 @@ export class LibraryV1 extends Base {
|
|
|
298
298
|
): Promise<GetPackageResponseDTO> {
|
|
299
299
|
const packageType = PackageTypeEnum.STEP;
|
|
300
300
|
|
|
301
|
-
return this.
|
|
302
|
-
route: `/api/v1/packages/${packageType}/id/${id}/version/${version}/json`,
|
|
301
|
+
return this._makeRequest({
|
|
302
|
+
route: `/api/v1/packages/${packageType}/id/${encodeURIComponent(id)}/version/${version}/json`,
|
|
303
303
|
signal,
|
|
304
304
|
});
|
|
305
305
|
}
|
|
@@ -318,9 +318,9 @@ export class LibraryV1 extends Base {
|
|
|
318
318
|
|
|
319
319
|
delete data.level;
|
|
320
320
|
|
|
321
|
-
return this.
|
|
321
|
+
return this._makeRequest({
|
|
322
322
|
method: 'POST',
|
|
323
|
-
route: `/api/v1/packages/${packageType}/id/${id}/version/${version}/status/release/${level}`,
|
|
323
|
+
route: `/api/v1/packages/${packageType}/id/${encodeURIComponent(id)}/version/${version}/status/release/${level}`,
|
|
324
324
|
data,
|
|
325
325
|
signal,
|
|
326
326
|
});
|
|
@@ -410,9 +410,9 @@ export class LibraryV1 extends Base {
|
|
|
410
410
|
{ id, version }: Pick<PackageParamUniversalDTO, 'id' | 'version'>,
|
|
411
411
|
{ signal, customHeaders }: CrossEnvOptionalParams = {}
|
|
412
412
|
): Promise<GetPackageArchiveSignedUrlDTO> {
|
|
413
|
-
return this.
|
|
413
|
+
return this._makeRequest({
|
|
414
414
|
method: 'GET',
|
|
415
|
-
route: `/api/v1/packages/${this.packageType}/id/${id}/version/${version}/archive`,
|
|
415
|
+
route: `/api/v1/packages/${this.packageType}/id/${encodeURIComponent(id)}/version/${version}/archive`,
|
|
416
416
|
customHeaders,
|
|
417
417
|
signal,
|
|
418
418
|
});
|
|
@@ -428,9 +428,9 @@ export class LibraryV1 extends Base {
|
|
|
428
428
|
{ id, version }: Pick<PackageParamUniversalDTO, 'id' | 'version'>,
|
|
429
429
|
{ signal, customHeaders }: CrossEnvOptionalParams = {}
|
|
430
430
|
): Promise<PutLegacyVersionResponseDTO> {
|
|
431
|
-
return this.
|
|
431
|
+
return this._makeRequest({
|
|
432
432
|
method: 'PUT',
|
|
433
|
-
route: `/api/v1/service/sync/${this.packageType}/id/${id}/version/${version}`,
|
|
433
|
+
route: `/api/v1/service/sync/${this.packageType}/id/${encodeURIComponent(id)}/version/${version}`,
|
|
434
434
|
customHeaders,
|
|
435
435
|
signal,
|
|
436
436
|
});
|
|
@@ -443,7 +443,7 @@ export class LibraryV1 extends Base {
|
|
|
443
443
|
data: DeprecateLegacyStepsBodyDTO,
|
|
444
444
|
{ signal }: Pick<OptionalParams, 'signal'> = {}
|
|
445
445
|
) {
|
|
446
|
-
return this.
|
|
446
|
+
return this._makeRequest({
|
|
447
447
|
method: 'POST',
|
|
448
448
|
route: '/api/v1/service/sync/STEP/legacy/deprecate',
|
|
449
449
|
data,
|
|
@@ -460,9 +460,9 @@ export class LibraryV1 extends Base {
|
|
|
460
460
|
): Promise<SyncLegacyResponseDTO> {
|
|
461
461
|
const packageType = PackageTypeEnum.STEP;
|
|
462
462
|
|
|
463
|
-
return this.
|
|
463
|
+
return this._makeRequest({
|
|
464
464
|
method: 'PUT',
|
|
465
|
-
route: `/api/v1/service/sync/${packageType}/legacy/id/${id}/latest`,
|
|
465
|
+
route: `/api/v1/service/sync/${packageType}/legacy/id/${encodeURIComponent(id)}/latest`,
|
|
466
466
|
signal,
|
|
467
467
|
});
|
|
468
468
|
}
|
|
@@ -483,9 +483,9 @@ export class LibraryV1 extends Base {
|
|
|
483
483
|
categories: legacyStepTemplate.categories,
|
|
484
484
|
};
|
|
485
485
|
|
|
486
|
-
return this.
|
|
486
|
+
return this._makeRequest({
|
|
487
487
|
method: 'PUT',
|
|
488
|
-
route: `/api/v1/service/sync/${packageType}/legacy/id/${id}/version/${version}/json`,
|
|
488
|
+
route: `/api/v1/service/sync/${packageType}/legacy/id/${encodeURIComponent(id)}/version/${version}/json`,
|
|
489
489
|
data,
|
|
490
490
|
signal,
|
|
491
491
|
});
|
|
@@ -500,7 +500,7 @@ export class LibraryV1 extends Base {
|
|
|
500
500
|
): Promise<CategoryListResponseDTO> {
|
|
501
501
|
const packageType = type || this.packageType;
|
|
502
502
|
|
|
503
|
-
return this.
|
|
503
|
+
return this._makeRequest({
|
|
504
504
|
route: `/api/v1/categories/${packageType}`,
|
|
505
505
|
signal,
|
|
506
506
|
params,
|
|
@@ -516,7 +516,7 @@ export class LibraryV1 extends Base {
|
|
|
516
516
|
): Promise<CategoryItemResponseDTO> {
|
|
517
517
|
const packageType = type ?? this.packageType;
|
|
518
518
|
|
|
519
|
-
return this.
|
|
519
|
+
return this._makeRequest({
|
|
520
520
|
method: 'PUT',
|
|
521
521
|
route: `/api/v1/categories/${packageType}`,
|
|
522
522
|
data,
|
|
@@ -534,8 +534,8 @@ export class LibraryV1 extends Base {
|
|
|
534
534
|
): Promise<CategoryItemResponseDTO> {
|
|
535
535
|
const packageType = type ?? this.packageType;
|
|
536
536
|
|
|
537
|
-
return this.
|
|
538
|
-
route: `/api/v1/categories/${packageType}/id/${id}`,
|
|
537
|
+
return this._makeRequest({
|
|
538
|
+
route: `/api/v1/categories/${packageType}/id/${encodeURIComponent(id)}`,
|
|
539
539
|
signal,
|
|
540
540
|
});
|
|
541
541
|
}
|
package/src/LibraryV2.ts
CHANGED
|
@@ -28,7 +28,6 @@ import type {
|
|
|
28
28
|
GetPackagesParamsDTO,
|
|
29
29
|
PackageDependencyDeleteParamsDTO,
|
|
30
30
|
PackageTypeEnum,
|
|
31
|
-
PackageUpdatesParamsDTO,
|
|
32
31
|
UniversalPackageParamsDTO,
|
|
33
32
|
UpdatePackageByRevisionBodyDTO,
|
|
34
33
|
} from '@or-sdk/library-types-v2';
|
|
@@ -44,9 +43,12 @@ export class LibraryV2 extends Base {
|
|
|
44
43
|
* import { LibraryV2 } from '@or-sdk/library';
|
|
45
44
|
* import config from '../config';
|
|
46
45
|
*
|
|
47
|
-
*
|
|
46
|
+
*
|
|
47
|
+
* export default LibrarySDK = new LibraryV2({
|
|
48
48
|
* token: 'my-account-token-string',
|
|
49
|
-
* libraryApiUrl: config.LIBRARY_API_URL
|
|
49
|
+
* libraryApiUrl: config.LIBRARY_API_URL,
|
|
50
|
+
* feature: 'master', // optional
|
|
51
|
+
* packageType: 'STEP', // optional
|
|
50
52
|
* });
|
|
51
53
|
* ```
|
|
52
54
|
*/
|
|
@@ -66,7 +68,7 @@ export class LibraryV2 extends Base {
|
|
|
66
68
|
this._feature = feature || null;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
private async
|
|
71
|
+
private async _makeRequest<T>(params: CalApiParams): Promise<T> {
|
|
70
72
|
if (this._feature && this._feature !== 'master') {
|
|
71
73
|
params.params ||= {};
|
|
72
74
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -76,7 +78,7 @@ export class LibraryV2 extends Base {
|
|
|
76
78
|
return this.callApiV2<T>(params);
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
_patchParamsForPlayground(
|
|
81
|
+
private _patchParamsForPlayground(
|
|
80
82
|
params: IsPlaygroundParam & (GetPackagesParamsDTO | DeletePackageParamsDTO)
|
|
81
83
|
): GetPackagesParamsDTO | DeletePackageParamsDTO {
|
|
82
84
|
if (params.isPlayground) {
|
|
@@ -102,13 +104,17 @@ export class LibraryV2 extends Base {
|
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
/**
|
|
105
|
-
*
|
|
107
|
+
* Retrieves a list of packages based on the provided parameters.
|
|
108
|
+
* @param params - The parameters for retrieving the packages.
|
|
109
|
+
* @param signal - An optional AbortSignal object that can be used to cancel the request.
|
|
110
|
+
* @param customHeaders - An optional object containing custom headers to be included in the request.
|
|
111
|
+
* @returns A promise that resolves to the response containing the list of packages.
|
|
106
112
|
*/
|
|
107
113
|
async getPackages(
|
|
108
114
|
params: GetPackagesParamsDTO & IsPlaygroundParam,
|
|
109
115
|
{ signal, customHeaders }: CrossEnvOptionalParams = {}
|
|
110
116
|
): Promise<GetPackagesListResponseDTO> {
|
|
111
|
-
return this.
|
|
117
|
+
return this._makeRequest({
|
|
112
118
|
method: 'GET',
|
|
113
119
|
route: `/api/v2/packages/${this.packageType}`,
|
|
114
120
|
params: this._patchParamsForPlayground(params),
|
|
@@ -118,13 +124,18 @@ export class LibraryV2 extends Base {
|
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
/**
|
|
121
|
-
*
|
|
127
|
+
* Retrieves a list of popular packages based on the provided parameters.
|
|
128
|
+
*
|
|
129
|
+
* @param params - The parameters for retrieving the packages.
|
|
130
|
+
* @param signal - An optional signal object for cancelling the request.
|
|
131
|
+
* @param customHeaders - An optional object containing custom headers for the request.
|
|
132
|
+
* @returns A promise that resolves to the response containing the list of packages.
|
|
122
133
|
*/
|
|
123
134
|
async getPackagesPopular(
|
|
124
135
|
params: GetPackagesParamsDTO & IsPlaygroundParam,
|
|
125
136
|
{ signal, customHeaders }: CrossEnvOptionalParams = {}
|
|
126
137
|
): Promise<GetPackagesListResponseDTO> {
|
|
127
|
-
return this.
|
|
138
|
+
return this._makeRequest({
|
|
128
139
|
method: 'GET',
|
|
129
140
|
route: `/api/v2/packages/${this.packageType}/popular`,
|
|
130
141
|
params: this._patchParamsForPlayground(params),
|
|
@@ -134,13 +145,18 @@ export class LibraryV2 extends Base {
|
|
|
134
145
|
}
|
|
135
146
|
|
|
136
147
|
/**
|
|
137
|
-
*
|
|
148
|
+
* Retrieves the favorite packages based on the provided parameters.
|
|
149
|
+
*
|
|
150
|
+
* @param params - The parameters for retrieving the favorite packages.
|
|
151
|
+
* @param signal - An optional signal object that allows cancellation of the request.
|
|
152
|
+
* @param customHeaders - An optional object containing custom headers for the request.
|
|
153
|
+
* @returns A promise that resolves to the response containing the favorite packages.
|
|
138
154
|
*/
|
|
139
155
|
async getPackagesFavorites(
|
|
140
156
|
params: GetPackagesParamsDTO & IsPlaygroundParam,
|
|
141
157
|
{ signal, customHeaders }: CrossEnvOptionalParams = {}
|
|
142
158
|
): Promise<GetPackagesListResponseDTO> {
|
|
143
|
-
return this.
|
|
159
|
+
return this._makeRequest({
|
|
144
160
|
method: 'GET',
|
|
145
161
|
route: `/api/v2/packages/${this.packageType}/favorites`,
|
|
146
162
|
params: this._patchParamsForPlayground(params),
|
|
@@ -151,15 +167,19 @@ export class LibraryV2 extends Base {
|
|
|
151
167
|
|
|
152
168
|
|
|
153
169
|
/**
|
|
154
|
-
|
|
155
|
-
|
|
170
|
+
* Adds a package.
|
|
171
|
+
*
|
|
172
|
+
* @param data - The data for the package.
|
|
173
|
+
* @param options - Optional parameters for the request.
|
|
174
|
+
* @returns A promise that resolves to the response containing the added package.
|
|
175
|
+
*/
|
|
156
176
|
async addPackage(
|
|
157
177
|
data: AddPackageBodyDTO,
|
|
158
178
|
{ signal, customHeaders }: CrossEnvOptionalParams = {}
|
|
159
179
|
): Promise<AddPackageResponseDTO> {
|
|
160
180
|
const packageType = data.type ?? this.packageType;
|
|
161
181
|
|
|
162
|
-
return this.
|
|
182
|
+
return this._makeRequest({
|
|
163
183
|
method: 'POST',
|
|
164
184
|
route: `/api/v2/packages/${packageType}`,
|
|
165
185
|
data,
|
|
@@ -169,7 +189,11 @@ export class LibraryV2 extends Base {
|
|
|
169
189
|
}
|
|
170
190
|
|
|
171
191
|
/**
|
|
172
|
-
*
|
|
192
|
+
* Retrieves the versions of a package based on the provided parameters.
|
|
193
|
+
*
|
|
194
|
+
* @param params - The parameters for retrieving the package versions.
|
|
195
|
+
* @param {OptionalParams} options - The optional parameters for the request.
|
|
196
|
+
* @returns - A promise that resolves with the response containing the package versions.
|
|
173
197
|
*/
|
|
174
198
|
async getPackageVersions(
|
|
175
199
|
{
|
|
@@ -180,7 +204,7 @@ export class LibraryV2 extends Base {
|
|
|
180
204
|
): Promise<GetPackageResponseDTO> {
|
|
181
205
|
const packageType = type ?? this.packageType;
|
|
182
206
|
|
|
183
|
-
return this.
|
|
207
|
+
return this._makeRequest({
|
|
184
208
|
route: `/api/v2/packages/${packageType}/id/${encodeURIComponent(id)}`,
|
|
185
209
|
signal,
|
|
186
210
|
params: this._patchParamsForPlayground(params),
|
|
@@ -188,7 +212,15 @@ export class LibraryV2 extends Base {
|
|
|
188
212
|
}
|
|
189
213
|
|
|
190
214
|
/**
|
|
191
|
-
*
|
|
215
|
+
* Deletes a package. PDE or ACCOUNT level packages can be deleted only with admin token or service token.
|
|
216
|
+
*
|
|
217
|
+
* @param id - The ID of the package.
|
|
218
|
+
* @param version - The version of the package.
|
|
219
|
+
* @param revisionId - The revision ID of the package.
|
|
220
|
+
* @param params - Additional parameters for the request.
|
|
221
|
+
* @param type - The type of the package.
|
|
222
|
+
* @param signal - The signal object used to cancel the request.
|
|
223
|
+
* @returns A promise that resolves to a boolean indicating whether the package was deleted successfully.
|
|
192
224
|
*/
|
|
193
225
|
async deletePackage(
|
|
194
226
|
{
|
|
@@ -201,7 +233,7 @@ export class LibraryV2 extends Base {
|
|
|
201
233
|
): Promise<boolean> {
|
|
202
234
|
const packageType = type ?? this.packageType;
|
|
203
235
|
|
|
204
|
-
return this.
|
|
236
|
+
return this._makeRequest({
|
|
205
237
|
method: 'DELETE',
|
|
206
238
|
route: revisionId ?
|
|
207
239
|
`/api/v2/packages/${packageType}/id/${encodeURIComponent(id)}/revision/${revisionId}` :
|
|
@@ -212,7 +244,11 @@ export class LibraryV2 extends Base {
|
|
|
212
244
|
}
|
|
213
245
|
|
|
214
246
|
/**
|
|
215
|
-
*
|
|
247
|
+
* Retrieves the latest release of a package.
|
|
248
|
+
*
|
|
249
|
+
* @param {Pick<UniversalPackageParamsDTO, 'id'>} params - The parameters for retrieving the package.
|
|
250
|
+
* @param {OptionalParams} options - The optional parameters for the request.
|
|
251
|
+
* @returns {Promise<GetPackageReleaseResponseDTO>} - A promise that resolves to the latest package release.
|
|
216
252
|
*/
|
|
217
253
|
async getPackageLatest(
|
|
218
254
|
{ id }: Pick<UniversalPackageParamsDTO, 'id'>,
|
|
@@ -220,14 +256,22 @@ export class LibraryV2 extends Base {
|
|
|
220
256
|
): Promise<GetPackageReleaseResponseDTO> {
|
|
221
257
|
const packageType = type ?? this.packageType;
|
|
222
258
|
|
|
223
|
-
return this.
|
|
259
|
+
return this._makeRequest({
|
|
224
260
|
route: `/api/v2/packages/${packageType}/id/${encodeURIComponent(id)}/latest`,
|
|
225
261
|
signal,
|
|
226
262
|
});
|
|
227
263
|
}
|
|
228
264
|
|
|
229
265
|
/**
|
|
230
|
-
*
|
|
266
|
+
* Retrieves a package based on the provided parameters.
|
|
267
|
+
*
|
|
268
|
+
* @param id - The ID of the package.
|
|
269
|
+
* @param version - The version of the package.
|
|
270
|
+
* @param revisionId - The revision ID of the package (optional).
|
|
271
|
+
* @param signal - The signal object used to cancel the request (optional).
|
|
272
|
+
* @param customHeaders - Custom headers to be included in the request (optional).
|
|
273
|
+
* @param type - The type of the package (optional).
|
|
274
|
+
* @returns A promise that resolves to the response containing the package information.
|
|
231
275
|
*/
|
|
232
276
|
async getPackage(
|
|
233
277
|
{ id, version, revisionId }: Pick<UniversalPackageParamsDTO, 'id' | 'version' | 'revisionId'>,
|
|
@@ -235,7 +279,7 @@ export class LibraryV2 extends Base {
|
|
|
235
279
|
): Promise<GetPackageResponseDTO> {
|
|
236
280
|
const packageType = type ?? this.packageType;
|
|
237
281
|
|
|
238
|
-
return this.
|
|
282
|
+
return this._makeRequest({
|
|
239
283
|
method: 'GET',
|
|
240
284
|
route: revisionId ?
|
|
241
285
|
`/api/v2/packages/${packageType}/id/${encodeURIComponent(id)}/revision/${revisionId}` :
|
|
@@ -246,34 +290,18 @@ export class LibraryV2 extends Base {
|
|
|
246
290
|
}
|
|
247
291
|
|
|
248
292
|
/**
|
|
249
|
-
*
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
): Promise<GetPackageResponseDTO> {
|
|
255
|
-
const packageType = type ?? this.packageType;
|
|
256
|
-
|
|
257
|
-
return this.makeRequest({
|
|
258
|
-
method: 'GET',
|
|
259
|
-
route: `/api/v2/packages/${packageType}/id/${encodeURIComponent(id)}/updates`,
|
|
260
|
-
customHeaders,
|
|
261
|
-
params: {
|
|
262
|
-
releaseType,
|
|
263
|
-
},
|
|
264
|
-
signal,
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Set system status, for set UPLOADED status for example
|
|
293
|
+
* Adds a system status for a package release.
|
|
294
|
+
*
|
|
295
|
+
* @param params - The parameters for adding the system status.
|
|
296
|
+
* @param signal - Optional signal for cancelling the request.
|
|
297
|
+
* @returns A promise that resolves to a boolean indicating whether the system status was successfully added.
|
|
270
298
|
*/
|
|
271
299
|
async addPackageSystemStatus(
|
|
272
300
|
params: AddPackageReleaseSystemStatusParamsDTO,
|
|
273
301
|
{ signal }: CrossEnvOptionalParams = {}
|
|
274
302
|
): Promise<boolean> {
|
|
275
303
|
const { id, version, revisionId, type, status } = params;
|
|
276
|
-
return this.
|
|
304
|
+
return this._makeRequest({
|
|
277
305
|
method: 'POST',
|
|
278
306
|
route: params.revisionId ?
|
|
279
307
|
`/api/v2/packages/${type}/id/${encodeURIComponent(id)}/version/${version}/system/${status}` :
|
|
@@ -283,14 +311,17 @@ export class LibraryV2 extends Base {
|
|
|
283
311
|
}
|
|
284
312
|
|
|
285
313
|
/**
|
|
286
|
-
*
|
|
314
|
+
* Adds a package release status with some level and status, e.g. ACCOUNT BETA.
|
|
315
|
+
* @param params - The parameters for adding the package release status.
|
|
316
|
+
* @param signal - Optional signal object for cancelling the request.
|
|
317
|
+
* @returns A promise that resolves to a boolean indicating the success of the operation.
|
|
287
318
|
*/
|
|
288
319
|
async addPackageReleaseStatus(
|
|
289
320
|
params: AddPackageReleaseReleaseStatusParamsDTO,
|
|
290
321
|
{ signal }: CrossEnvOptionalParams = {}
|
|
291
322
|
): Promise<boolean> {
|
|
292
323
|
const { id, version, revisionId, type, status, level } = params;
|
|
293
|
-
return this.
|
|
324
|
+
return this._makeRequest({
|
|
294
325
|
method: 'POST',
|
|
295
326
|
route: params.revisionId ?
|
|
296
327
|
// eslint-disable-next-line max-len
|
|
@@ -302,13 +333,18 @@ export class LibraryV2 extends Base {
|
|
|
302
333
|
}
|
|
303
334
|
|
|
304
335
|
/**
|
|
305
|
-
*
|
|
336
|
+
* Updates meta data, sharing a package release.
|
|
337
|
+
*
|
|
338
|
+
* @param {UniversalPackageParamsDTO} params - The parameters for updating the package release.
|
|
339
|
+
* @param {UpdatePackageByRevisionBodyDTO} params - The parameters for updating the package release.
|
|
340
|
+
* @param {CrossEnvOptionalParams} options - The optional parameters for the request.
|
|
341
|
+
* @returns {Promise} - A promise that resolves with the updated package release response.
|
|
306
342
|
*/
|
|
307
343
|
async updatePackageRelease(
|
|
308
344
|
{ id, revisionId, type, ...data }: UniversalPackageParamsDTO & UpdatePackageByRevisionBodyDTO,
|
|
309
345
|
{ signal }: CrossEnvOptionalParams = {}
|
|
310
346
|
): Promise<GetPackageReleaseResponseDTO> {
|
|
311
|
-
return this.
|
|
347
|
+
return this._makeRequest({
|
|
312
348
|
method: 'PUT',
|
|
313
349
|
route: `/api/v2/packages/${type}/id/${encodeURIComponent(id)}/revision/${revisionId}`,
|
|
314
350
|
data,
|
|
@@ -317,16 +353,18 @@ export class LibraryV2 extends Base {
|
|
|
317
353
|
}
|
|
318
354
|
|
|
319
355
|
/**
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
356
|
+
* Retrieves the download archive credentials for a specific package.
|
|
357
|
+
* @param id - The ID of the package.
|
|
358
|
+
* @param version - The version of the package.
|
|
359
|
+
* @param signal - An optional signal object for canceling the request.
|
|
360
|
+
* @param customHeaders - An optional object containing custom headers for the request.
|
|
361
|
+
* @returns A promise that resolves to the download archive credentials.
|
|
362
|
+
*/
|
|
325
363
|
public async getDownloadArchiveCredentials(
|
|
326
364
|
{ id, version }: Pick<UniversalPackageParamsDTO, 'id' | 'version'>,
|
|
327
365
|
{ signal, customHeaders }: CrossEnvOptionalParams = {}
|
|
328
366
|
): Promise<GetPackageArchiveSignedUrlDTO> {
|
|
329
|
-
return this.
|
|
367
|
+
return this._makeRequest({
|
|
330
368
|
method: 'GET',
|
|
331
369
|
route: `/api/v2/packages/${this.packageType}/id/${encodeURIComponent(id)}/version/${version}/archive`,
|
|
332
370
|
customHeaders,
|
|
@@ -335,7 +373,11 @@ export class LibraryV2 extends Base {
|
|
|
335
373
|
}
|
|
336
374
|
|
|
337
375
|
/**
|
|
338
|
-
*
|
|
376
|
+
* Retrieves the package dependencies for a given package ID and revision ID.
|
|
377
|
+
* @param {String} params.id - The parameters for retrieving package dependencies.
|
|
378
|
+
* @param {String} params.revisionId - The parameters for retrieving package dependencies.
|
|
379
|
+
* @param {OptionalParams} options - The optional parameters for the request.
|
|
380
|
+
* @returns {Promise} - A promise that resolves with an array of package dependencies.
|
|
339
381
|
*/
|
|
340
382
|
async getPackageDependencies(
|
|
341
383
|
{ id, revisionId }: Omit<UniversalPackageParamsDTO, 'type' | 'version'>,
|
|
@@ -343,19 +385,26 @@ export class LibraryV2 extends Base {
|
|
|
343
385
|
): Promise<AddPackageDependenciesBodyDTO[]> {
|
|
344
386
|
const packageType = type ?? this.packageType;
|
|
345
387
|
|
|
346
|
-
return this.
|
|
388
|
+
return this._makeRequest({
|
|
347
389
|
route: `/api/v2/packages/${packageType}/id/${encodeURIComponent(id)}/revision/${revisionId}/dependencies`,
|
|
348
390
|
signal,
|
|
349
391
|
});
|
|
350
392
|
}
|
|
351
393
|
|
|
394
|
+
/**
|
|
395
|
+
* Adds a package dependency.
|
|
396
|
+
*
|
|
397
|
+
* @param {AddPackageDependenciesBodyDTO} data - The package dependency data.
|
|
398
|
+
* @param {OptionalParams} options - Optional parameters for the request.
|
|
399
|
+
* @returns {Promise<AddPackageDependenciesBodyDTO[]>} The response containing the added package dependencies.
|
|
400
|
+
*/
|
|
352
401
|
async addPackageDependency(
|
|
353
402
|
{ id, revisionId, ...data }: Omit<UniversalPackageParamsDTO, 'type' | 'version'> & AddPackageDependenciesBodyDTO,
|
|
354
403
|
{ signal, type }: OptionalParams = {}
|
|
355
404
|
): Promise<AddPackageDependenciesBodyDTO[]> {
|
|
356
405
|
const packageType = type ?? this.packageType;
|
|
357
406
|
|
|
358
|
-
return this.
|
|
407
|
+
return this._makeRequest({
|
|
359
408
|
method: 'POST',
|
|
360
409
|
route: `/api/v2/packages/${packageType}/id/${encodeURIComponent(id)}/revision/${revisionId}/dependencies`,
|
|
361
410
|
signal,
|
|
@@ -363,13 +412,23 @@ export class LibraryV2 extends Base {
|
|
|
363
412
|
});
|
|
364
413
|
}
|
|
365
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Deletes a package dependency.
|
|
417
|
+
*
|
|
418
|
+
* @param id - The ID of the package.
|
|
419
|
+
* @param revisionId - The ID of the package revision.
|
|
420
|
+
* @param dependencyId - The ID of the dependency to be deleted.
|
|
421
|
+
* @param signal - An optional signal object for cancelling the request.
|
|
422
|
+
* @param type - An optional package type. If not provided, the default package type will be used.
|
|
423
|
+
* @returns A promise that resolves to an array of AddPackageDependenciesBodyDTO objects.
|
|
424
|
+
*/
|
|
366
425
|
async deletePackageDependency(
|
|
367
426
|
{ id, revisionId, dependencyId }: Omit<PackageDependencyDeleteParamsDTO, 'type'>,
|
|
368
427
|
{ signal, type }: OptionalParams = {}
|
|
369
428
|
): Promise<AddPackageDependenciesBodyDTO[]> {
|
|
370
429
|
const packageType = type ?? this.packageType;
|
|
371
430
|
|
|
372
|
-
return this.
|
|
431
|
+
return this._makeRequest({
|
|
373
432
|
// eslint-disable-next-line max-len
|
|
374
433
|
route: `/api/v2/packages/${packageType}/id/${encodeURIComponent(id)}/revision/${revisionId}/dependencies/${dependencyId}`,
|
|
375
434
|
signal,
|