@hotcodepush/node 0.0.1 → 0.2.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.
- package/README.md +11 -20
- package/dist/index.d.mts +1473 -229
- package/dist/index.mjs +201 -54
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
//#region package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.2.0";
|
|
3
3
|
//#endregion
|
|
4
4
|
//#region src/errors.ts
|
|
5
5
|
/**
|
|
6
6
|
* Thrown when the API answers with a status outside 2xx.
|
|
7
7
|
* `code`, `message` and `details` come from the API verbatim.
|
|
8
|
+
* A code newer than this client passes through as a plain string, so `code` is not limited to `HotCodePushErrorCode`.
|
|
8
9
|
* A response without the API error shape becomes `unexpected_response` with the status, and its body is dropped.
|
|
9
10
|
*/
|
|
10
11
|
var HotCodePushError = class extends Error {
|
|
@@ -30,8 +31,8 @@ function resolveErrorBody(text) {
|
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
function resolveHotCodePushError(
|
|
34
|
-
return new HotCodePushError(resolveErrorBody(
|
|
34
|
+
function resolveHotCodePushError({ responseText, status }) {
|
|
35
|
+
return new HotCodePushError(resolveErrorBody(responseText) ?? {
|
|
35
36
|
code: "unexpected_response",
|
|
36
37
|
message: `Request failed with status ${status}.`
|
|
37
38
|
}, status);
|
|
@@ -85,7 +86,7 @@ var HttpClient = class {
|
|
|
85
86
|
await response.body?.cancel();
|
|
86
87
|
}
|
|
87
88
|
async fetchUpload(options) {
|
|
88
|
-
const fetchWithTimeout = withTimeout(fetch, UPLOAD_TIMEOUT_MS);
|
|
89
|
+
const fetchWithTimeout = withTimeout(fetch, { timeoutMs: UPLOAD_TIMEOUT_MS });
|
|
89
90
|
const fetchFunction = isBlobUploadBody(options) ? withRetry(fetchWithTimeout) : fetchWithTimeout;
|
|
90
91
|
const contentLength = isBlobUploadBody(options) ? options.body.size : options.contentLength;
|
|
91
92
|
return parseResponseBody(await fetchFunction(this.resolveRouteUrl(options.path), {
|
|
@@ -100,7 +101,7 @@ var HttpClient = class {
|
|
|
100
101
|
}));
|
|
101
102
|
}
|
|
102
103
|
async fetchResponse(options) {
|
|
103
|
-
const fetchWithTimeout = withTimeout(fetch, this.timeoutMs);
|
|
104
|
+
const fetchWithTimeout = withTimeout(fetch, { timeoutMs: this.timeoutMs });
|
|
104
105
|
return (options.isRetryable ?? IDEMPOTENT_METHODS.has(options.method) ? withRetry(fetchWithTimeout) : fetchWithTimeout)(this.resolveUrl(options), this.resolveRequestInit(options));
|
|
105
106
|
}
|
|
106
107
|
resolveRequestInit(options) {
|
|
@@ -126,12 +127,18 @@ var HttpClient = class {
|
|
|
126
127
|
}
|
|
127
128
|
resolveUrl(options) {
|
|
128
129
|
const url = this.resolveRouteUrl(options.path);
|
|
129
|
-
for (const [name, value] of Object.entries(options.query ?? {})) for (const queryValue of resolveQueryValues(
|
|
130
|
+
for (const [name, value] of Object.entries(options.query ?? {})) for (const queryValue of resolveQueryValues({
|
|
131
|
+
name,
|
|
132
|
+
value
|
|
133
|
+
})) url.searchParams.append(name, queryValue);
|
|
130
134
|
return url;
|
|
131
135
|
}
|
|
132
136
|
};
|
|
133
137
|
async function assertResponseOk(response) {
|
|
134
|
-
if (!response.ok) throw resolveHotCodePushError(
|
|
138
|
+
if (!response.ok) throw resolveHotCodePushError({
|
|
139
|
+
responseText: await response.text(),
|
|
140
|
+
status: response.status
|
|
141
|
+
});
|
|
135
142
|
}
|
|
136
143
|
function isBlobUploadBody(uploadBody) {
|
|
137
144
|
return uploadBody.body instanceof Blob;
|
|
@@ -161,7 +168,7 @@ function resolvePath(template, parameters = {}) {
|
|
|
161
168
|
return encodeURIComponent(parameter);
|
|
162
169
|
});
|
|
163
170
|
}
|
|
164
|
-
function resolveQueryValues(name, value) {
|
|
171
|
+
function resolveQueryValues({ name, value }) {
|
|
165
172
|
if (value === void 0 || value === "") return [];
|
|
166
173
|
if (typeof value !== "object") return [String(value)];
|
|
167
174
|
if (COMMA_LIST_QUERY_NAMES.has(name)) return value.length === 0 ? [] : [value.join(",")];
|
|
@@ -194,7 +201,7 @@ function withRetry(fetchFunction) {
|
|
|
194
201
|
}
|
|
195
202
|
};
|
|
196
203
|
}
|
|
197
|
-
function withTimeout(fetchFunction, timeoutMs) {
|
|
204
|
+
function withTimeout(fetchFunction, { timeoutMs }) {
|
|
198
205
|
return (input, init) => fetchFunction(input, {
|
|
199
206
|
...init,
|
|
200
207
|
signal: AbortSignal.timeout(timeoutMs)
|
|
@@ -231,9 +238,14 @@ var BinariesResource = class {
|
|
|
231
238
|
});
|
|
232
239
|
}
|
|
233
240
|
async get(options) {
|
|
241
|
+
const { appId, binaryId, ...query } = options;
|
|
234
242
|
return this.httpClient.fetchJson({
|
|
235
243
|
method: "GET",
|
|
236
|
-
path: resolvePath("/v1/apps/{appId}/binaries/{binaryId}",
|
|
244
|
+
path: resolvePath("/v1/apps/{appId}/binaries/{binaryId}", {
|
|
245
|
+
appId,
|
|
246
|
+
binaryId
|
|
247
|
+
}),
|
|
248
|
+
query
|
|
237
249
|
});
|
|
238
250
|
}
|
|
239
251
|
/**
|
|
@@ -333,19 +345,14 @@ const SINGLE_UPLOAD_LIMIT_BYTES = 67108864;
|
|
|
333
345
|
function isBlobAboveSingleUploadLimit(uploadBody) {
|
|
334
346
|
return uploadBody.body instanceof Blob && uploadBody.body.size > 67108864;
|
|
335
347
|
}
|
|
336
|
-
async function uploadInParts(uploads,
|
|
348
|
+
async function uploadInParts(uploads, { blob, pathParameters }) {
|
|
337
349
|
const { uploadId } = await uploads.create(pathParameters);
|
|
338
350
|
try {
|
|
339
|
-
const parts =
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
partNumber,
|
|
345
|
-
uploadId
|
|
346
|
-
});
|
|
347
|
-
parts.push(uploadedPart);
|
|
348
|
-
}
|
|
351
|
+
const parts = await uploadEveryPart(uploads, {
|
|
352
|
+
blob,
|
|
353
|
+
pathParameters,
|
|
354
|
+
uploadId
|
|
355
|
+
});
|
|
349
356
|
return await uploads.complete({
|
|
350
357
|
...pathParameters,
|
|
351
358
|
parts,
|
|
@@ -359,6 +366,19 @@ async function uploadInParts(uploads, pathParameters, blob) {
|
|
|
359
366
|
throw error;
|
|
360
367
|
}
|
|
361
368
|
}
|
|
369
|
+
async function uploadEveryPart(uploads, { blob, pathParameters, uploadId }) {
|
|
370
|
+
const parts = [];
|
|
371
|
+
for (let start = 0, partNumber = 1; start < blob.size; start += PART_SIZE_BYTES, partNumber += 1) {
|
|
372
|
+
const uploadedPart = await uploads.parts.upload({
|
|
373
|
+
...pathParameters,
|
|
374
|
+
body: blob.slice(start, start + PART_SIZE_BYTES),
|
|
375
|
+
partNumber,
|
|
376
|
+
uploadId
|
|
377
|
+
});
|
|
378
|
+
parts.push(uploadedPart);
|
|
379
|
+
}
|
|
380
|
+
return parts;
|
|
381
|
+
}
|
|
362
382
|
//#endregion
|
|
363
383
|
//#region src/resources/bundle-pack-upload-parts.ts
|
|
364
384
|
var BundlePackUploadPartsResource = class {
|
|
@@ -429,7 +449,7 @@ var BundlePackUploadsResource = class {
|
|
|
429
449
|
* Aborts a multipart pack upload and discards its parts.
|
|
430
450
|
*/
|
|
431
451
|
async delete(options) {
|
|
432
|
-
await this.httpClient.
|
|
452
|
+
await this.httpClient.fetchStatus({
|
|
433
453
|
method: "DELETE",
|
|
434
454
|
path: resolvePath("/v1/apps/{appId}/bundles/{bundleId}/pack/uploads/{uploadId}", options)
|
|
435
455
|
});
|
|
@@ -451,9 +471,12 @@ var BundlePackResource = class {
|
|
|
451
471
|
async upload(options) {
|
|
452
472
|
const { appId, bundleId, ...uploadBody } = options;
|
|
453
473
|
if (isBlobAboveSingleUploadLimit(uploadBody)) return uploadInParts(this.uploads, {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
474
|
+
blob: uploadBody.body,
|
|
475
|
+
pathParameters: {
|
|
476
|
+
appId,
|
|
477
|
+
bundleId
|
|
478
|
+
}
|
|
479
|
+
});
|
|
457
480
|
return this.httpClient.fetchUpload({
|
|
458
481
|
...uploadBody,
|
|
459
482
|
contentType: "application/x-tar",
|
|
@@ -517,7 +540,7 @@ var BundlesResource = class {
|
|
|
517
540
|
* A bundle that a release serves or a store build embeds is refused.
|
|
518
541
|
*/
|
|
519
542
|
async delete(options) {
|
|
520
|
-
await this.httpClient.
|
|
543
|
+
await this.httpClient.fetchStatus({
|
|
521
544
|
method: "DELETE",
|
|
522
545
|
path: resolvePath("/v1/apps/{appId}/bundles/{bundleId}", options)
|
|
523
546
|
});
|
|
@@ -595,6 +618,7 @@ var ChannelReleasesResource = class {
|
|
|
595
618
|
}
|
|
596
619
|
/**
|
|
597
620
|
* Releases a ready bundle, or what another channel serves, in this channel.
|
|
621
|
+
* With `fromChannelId`, `platform` picks the newest active release of that channel serving the platform.
|
|
598
622
|
* The release gets the next number of the channel.
|
|
599
623
|
*/
|
|
600
624
|
async create(options) {
|
|
@@ -633,8 +657,8 @@ var RollbacksResource = class {
|
|
|
633
657
|
this.httpClient = httpClient;
|
|
634
658
|
}
|
|
635
659
|
/**
|
|
636
|
-
* Rolls the channel back to its
|
|
637
|
-
* A rollback is a new release.
|
|
660
|
+
* Rolls the channel back to the release before its newest active one, or before the newest active one serving `platform`.
|
|
661
|
+
* `toReleaseId` names the target instead. A rollback is a new release.
|
|
638
662
|
*/
|
|
639
663
|
async create(options) {
|
|
640
664
|
const { appId, channelId, idempotencyKey, ...body } = options;
|
|
@@ -686,7 +710,7 @@ var ChannelsResource = class {
|
|
|
686
710
|
* Deletes a channel at once. The default channel of the app is refused.
|
|
687
711
|
*/
|
|
688
712
|
async delete(options) {
|
|
689
|
-
await this.httpClient.
|
|
713
|
+
await this.httpClient.fetchStatus({
|
|
690
714
|
method: "DELETE",
|
|
691
715
|
path: resolvePath("/v1/apps/{appId}/channels/{channelId}", options)
|
|
692
716
|
});
|
|
@@ -697,7 +721,7 @@ var ChannelsResource = class {
|
|
|
697
721
|
*/
|
|
698
722
|
async deleteMany(options) {
|
|
699
723
|
const { appId, ...query } = options;
|
|
700
|
-
await this.httpClient.
|
|
724
|
+
await this.httpClient.fetchStatus({
|
|
701
725
|
method: "DELETE",
|
|
702
726
|
path: resolvePath("/v1/apps/{appId}/channels", { appId }),
|
|
703
727
|
query
|
|
@@ -818,7 +842,7 @@ var DevicesResource = class {
|
|
|
818
842
|
* Deletes a device from the registry, for an erasure request.
|
|
819
843
|
*/
|
|
820
844
|
async delete(options) {
|
|
821
|
-
await this.httpClient.
|
|
845
|
+
await this.httpClient.fetchStatus({
|
|
822
846
|
method: "DELETE",
|
|
823
847
|
path: resolvePath("/v1/apps/{appId}/devices/{deviceId}", options)
|
|
824
848
|
});
|
|
@@ -828,7 +852,7 @@ var DevicesResource = class {
|
|
|
828
852
|
*/
|
|
829
853
|
async deleteMany(options) {
|
|
830
854
|
const { appId, ...query } = options;
|
|
831
|
-
await this.httpClient.
|
|
855
|
+
await this.httpClient.fetchStatus({
|
|
832
856
|
method: "DELETE",
|
|
833
857
|
path: resolvePath("/v1/apps/{appId}/devices", { appId }),
|
|
834
858
|
query
|
|
@@ -929,7 +953,7 @@ var FileUploadsResource = class {
|
|
|
929
953
|
* Aborts a multipart file upload and discards its parts.
|
|
930
954
|
*/
|
|
931
955
|
async delete(options) {
|
|
932
|
-
await this.httpClient.
|
|
956
|
+
await this.httpClient.fetchStatus({
|
|
933
957
|
method: "DELETE",
|
|
934
958
|
path: resolvePath("/v1/apps/{appId}/files/{sha256}/uploads/{uploadId}", options)
|
|
935
959
|
});
|
|
@@ -952,9 +976,12 @@ var FilesResource = class {
|
|
|
952
976
|
async upload(options) {
|
|
953
977
|
const { appId, sha256, ...uploadBody } = options;
|
|
954
978
|
if (isBlobAboveSingleUploadLimit(uploadBody)) return uploadInParts(this.uploads, {
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
979
|
+
blob: uploadBody.body,
|
|
980
|
+
pathParameters: {
|
|
981
|
+
appId,
|
|
982
|
+
sha256
|
|
983
|
+
}
|
|
984
|
+
});
|
|
958
985
|
return this.httpClient.fetchUpload({
|
|
959
986
|
...uploadBody,
|
|
960
987
|
contentType: "application/gzip",
|
|
@@ -1110,7 +1137,7 @@ var SigningKeysResource = class {
|
|
|
1110
1137
|
});
|
|
1111
1138
|
}
|
|
1112
1139
|
async delete(options) {
|
|
1113
|
-
await this.httpClient.
|
|
1140
|
+
await this.httpClient.fetchStatus({
|
|
1114
1141
|
method: "DELETE",
|
|
1115
1142
|
path: resolvePath("/v1/apps/{appId}/signing-keys/{signingKeyId}", options)
|
|
1116
1143
|
});
|
|
@@ -1135,7 +1162,7 @@ var StatisticsFleetResource = class {
|
|
|
1135
1162
|
this.httpClient = httpClient;
|
|
1136
1163
|
}
|
|
1137
1164
|
/**
|
|
1138
|
-
* Gets a snapshot of the fleet from the registry, for one channel when `channelId` is set.
|
|
1165
|
+
* Gets a snapshot of the fleet from the registry, for one channel when `channelId` is set and for one binary when `binaryId` is set.
|
|
1139
1166
|
*/
|
|
1140
1167
|
async get(options) {
|
|
1141
1168
|
const { appId, ...query } = options;
|
|
@@ -1225,7 +1252,7 @@ var AppsResource = class {
|
|
|
1225
1252
|
* An API token answers `forbidden`; sign in with a session.
|
|
1226
1253
|
*/
|
|
1227
1254
|
async delete(options) {
|
|
1228
|
-
await this.httpClient.
|
|
1255
|
+
await this.httpClient.fetchStatus({
|
|
1229
1256
|
method: "DELETE",
|
|
1230
1257
|
path: resolvePath("/v1/apps/{appId}", options)
|
|
1231
1258
|
});
|
|
@@ -1406,7 +1433,7 @@ var NotificationsResource = class {
|
|
|
1406
1433
|
* An API token answers `forbidden`; sign in with a session.
|
|
1407
1434
|
*/
|
|
1408
1435
|
async updateMany(options) {
|
|
1409
|
-
await this.httpClient.
|
|
1436
|
+
await this.httpClient.fetchStatus({
|
|
1410
1437
|
body: options,
|
|
1411
1438
|
method: "PATCH",
|
|
1412
1439
|
path: resolvePath("/v1/notifications")
|
|
@@ -1544,7 +1571,7 @@ var MembersResource = class {
|
|
|
1544
1571
|
* An API token answers `forbidden`; sign in with a session.
|
|
1545
1572
|
*/
|
|
1546
1573
|
async delete(options) {
|
|
1547
|
-
await this.httpClient.
|
|
1574
|
+
await this.httpClient.fetchStatus({
|
|
1548
1575
|
method: "DELETE",
|
|
1549
1576
|
path: resolvePath("/v1/organizations/{organizationId}/members/{memberId}", options)
|
|
1550
1577
|
});
|
|
@@ -1556,7 +1583,7 @@ var MembersResource = class {
|
|
|
1556
1583
|
*/
|
|
1557
1584
|
async deleteMany(options) {
|
|
1558
1585
|
const { organizationId, ...query } = options;
|
|
1559
|
-
await this.httpClient.
|
|
1586
|
+
await this.httpClient.fetchStatus({
|
|
1560
1587
|
method: "DELETE",
|
|
1561
1588
|
path: resolvePath("/v1/organizations/{organizationId}/members", { organizationId }),
|
|
1562
1589
|
query
|
|
@@ -1677,7 +1704,7 @@ var OrganizationInvitationsResource = class {
|
|
|
1677
1704
|
* An API token answers `forbidden`; sign in with a session.
|
|
1678
1705
|
*/
|
|
1679
1706
|
async delete(options) {
|
|
1680
|
-
await this.httpClient.
|
|
1707
|
+
await this.httpClient.fetchStatus({
|
|
1681
1708
|
method: "DELETE",
|
|
1682
1709
|
path: resolvePath("/v1/organizations/{organizationId}/invitations/{invitationId}", options)
|
|
1683
1710
|
});
|
|
@@ -1688,7 +1715,7 @@ var OrganizationInvitationsResource = class {
|
|
|
1688
1715
|
*/
|
|
1689
1716
|
async deleteMany(options) {
|
|
1690
1717
|
const { organizationId, ...query } = options;
|
|
1691
|
-
await this.httpClient.
|
|
1718
|
+
await this.httpClient.fetchStatus({
|
|
1692
1719
|
method: "DELETE",
|
|
1693
1720
|
path: resolvePath("/v1/organizations/{organizationId}/invitations", { organizationId }),
|
|
1694
1721
|
query
|
|
@@ -1742,7 +1769,7 @@ var SsoProviderResource = class {
|
|
|
1742
1769
|
* An API token answers `forbidden`; sign in with a session.
|
|
1743
1770
|
*/
|
|
1744
1771
|
async delete(options) {
|
|
1745
|
-
await this.httpClient.
|
|
1772
|
+
await this.httpClient.fetchStatus({
|
|
1746
1773
|
method: "DELETE",
|
|
1747
1774
|
path: resolvePath("/v1/organizations/{organizationId}/sso-provider", options)
|
|
1748
1775
|
});
|
|
@@ -1788,7 +1815,7 @@ var SubscriptionResource = class {
|
|
|
1788
1815
|
*/
|
|
1789
1816
|
async cancel(options) {
|
|
1790
1817
|
const { organizationId, ...body } = options;
|
|
1791
|
-
await this.httpClient.
|
|
1818
|
+
await this.httpClient.fetchStatus({
|
|
1792
1819
|
body,
|
|
1793
1820
|
isRetryable: true,
|
|
1794
1821
|
method: "POST",
|
|
@@ -1801,7 +1828,7 @@ var SubscriptionResource = class {
|
|
|
1801
1828
|
* An API token answers `forbidden`; sign in with a session.
|
|
1802
1829
|
*/
|
|
1803
1830
|
async uncancel(options) {
|
|
1804
|
-
await this.httpClient.
|
|
1831
|
+
await this.httpClient.fetchStatus({
|
|
1805
1832
|
isRetryable: true,
|
|
1806
1833
|
method: "POST",
|
|
1807
1834
|
path: resolvePath("/v1/organizations/{organizationId}/subscription/uncancel", options)
|
|
@@ -1809,6 +1836,124 @@ var SubscriptionResource = class {
|
|
|
1809
1836
|
}
|
|
1810
1837
|
};
|
|
1811
1838
|
//#endregion
|
|
1839
|
+
//#region src/resources/telemetry-export-deliveries.ts
|
|
1840
|
+
/**
|
|
1841
|
+
* The delivery log of the telemetry export. Each delivery is kept for 30 days.
|
|
1842
|
+
*/
|
|
1843
|
+
var TelemetryExportDeliveriesResource = class {
|
|
1844
|
+
httpClient;
|
|
1845
|
+
constructor(httpClient) {
|
|
1846
|
+
this.httpClient = httpClient;
|
|
1847
|
+
}
|
|
1848
|
+
/**
|
|
1849
|
+
* Counts the deliveries of the telemetry export that match the filters.
|
|
1850
|
+
* An API token answers `forbidden`; sign in with a session.
|
|
1851
|
+
*/
|
|
1852
|
+
async count(options) {
|
|
1853
|
+
const { organizationId, ...query } = options;
|
|
1854
|
+
return this.httpClient.fetchJson({
|
|
1855
|
+
method: "GET",
|
|
1856
|
+
path: resolvePath("/v1/organizations/{organizationId}/telemetry-export/deliveries/count", { organizationId }),
|
|
1857
|
+
query
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Lists the deliveries of the telemetry export, newest first.
|
|
1862
|
+
* Filter by `status`, and by `createdSince` and `createdUntil`, both inclusive.
|
|
1863
|
+
* An API token answers `forbidden`; sign in with a session.
|
|
1864
|
+
*/
|
|
1865
|
+
async list(options) {
|
|
1866
|
+
const { organizationId, ...query } = options;
|
|
1867
|
+
return this.httpClient.fetchJson({
|
|
1868
|
+
method: "GET",
|
|
1869
|
+
path: resolvePath("/v1/organizations/{organizationId}/telemetry-export/deliveries", { organizationId }),
|
|
1870
|
+
query
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
/**
|
|
1874
|
+
* Sends the record again, once, within the request, and answers the settled delivery with its attempt count carried on.
|
|
1875
|
+
* Each call makes another attempt, so the client never retries the call.
|
|
1876
|
+
* An API token answers `forbidden`; sign in with a session.
|
|
1877
|
+
*/
|
|
1878
|
+
async redeliver(options) {
|
|
1879
|
+
return this.httpClient.fetchJson({
|
|
1880
|
+
method: "POST",
|
|
1881
|
+
path: resolvePath("/v1/organizations/{organizationId}/telemetry-export/deliveries/{deliveryId}/redeliver", options)
|
|
1882
|
+
});
|
|
1883
|
+
}
|
|
1884
|
+
};
|
|
1885
|
+
//#endregion
|
|
1886
|
+
//#region src/resources/telemetry-export.ts
|
|
1887
|
+
/**
|
|
1888
|
+
* The telemetry export of the organization, for Admins and Owners.
|
|
1889
|
+
* Setting, switching, testing and redelivering need a paying plan, and any other plan answers `plan_required`; reading and deleting do not.
|
|
1890
|
+
*/
|
|
1891
|
+
var TelemetryExportResource = class {
|
|
1892
|
+
httpClient;
|
|
1893
|
+
deliveries;
|
|
1894
|
+
constructor(httpClient) {
|
|
1895
|
+
this.httpClient = httpClient;
|
|
1896
|
+
this.deliveries = new TelemetryExportDeliveriesResource(httpClient);
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Removes the telemetry export with its delivery log, on any plan.
|
|
1900
|
+
* An API token answers `forbidden`; sign in with a session.
|
|
1901
|
+
*/
|
|
1902
|
+
async delete(options) {
|
|
1903
|
+
await this.httpClient.fetchStatus({
|
|
1904
|
+
method: "DELETE",
|
|
1905
|
+
path: resolvePath("/v1/organizations/{organizationId}/telemetry-export", options)
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
/**
|
|
1909
|
+
* Gets the telemetry export of the organization; an organization without one answers `not_found`.
|
|
1910
|
+
* An API token answers `forbidden`; sign in with a session.
|
|
1911
|
+
*/
|
|
1912
|
+
async get(options) {
|
|
1913
|
+
return this.httpClient.fetchJson({
|
|
1914
|
+
method: "GET",
|
|
1915
|
+
path: resolvePath("/v1/organizations/{organizationId}/telemetry-export", options)
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* Sets the OTLP/HTTP base URL, the `headers` that carry the vendor's credentials and the `signals`, replacing the export before.
|
|
1920
|
+
* A URL ending in a signal path answers `url_signal_path`, and a `content-type`, `content-length` or `host` header `header_reserved`.
|
|
1921
|
+
* The export starts enabled.
|
|
1922
|
+
* An API token answers `forbidden`; sign in with a session.
|
|
1923
|
+
*/
|
|
1924
|
+
async set(options) {
|
|
1925
|
+
const { organizationId, ...body } = options;
|
|
1926
|
+
return this.httpClient.fetchJson({
|
|
1927
|
+
body,
|
|
1928
|
+
method: "PUT",
|
|
1929
|
+
path: resolvePath("/v1/organizations/{organizationId}/telemetry-export", { organizationId })
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
/**
|
|
1933
|
+
* Sends one delivery per signal within the request, a `telemetry_export.test` log record and the current metrics document, and answers the settled deliveries.
|
|
1934
|
+
* Each call sends again, so the client never retries the call.
|
|
1935
|
+
* An API token answers `forbidden`; sign in with a session.
|
|
1936
|
+
*/
|
|
1937
|
+
async test(options) {
|
|
1938
|
+
return this.httpClient.fetchJson({
|
|
1939
|
+
method: "POST",
|
|
1940
|
+
path: resolvePath("/v1/organizations/{organizationId}/telemetry-export/test", options)
|
|
1941
|
+
});
|
|
1942
|
+
}
|
|
1943
|
+
/**
|
|
1944
|
+
* Switches the telemetry export on or off. `isEnabled: false` stamps `disabledAt`; `isEnabled: true` clears it and resets the count of failed deliveries in a row.
|
|
1945
|
+
* An API token answers `forbidden`; sign in with a session.
|
|
1946
|
+
*/
|
|
1947
|
+
async update(options) {
|
|
1948
|
+
const { organizationId, ...body } = options;
|
|
1949
|
+
return this.httpClient.fetchJson({
|
|
1950
|
+
body,
|
|
1951
|
+
method: "PATCH",
|
|
1952
|
+
path: resolvePath("/v1/organizations/{organizationId}/telemetry-export", { organizationId })
|
|
1953
|
+
});
|
|
1954
|
+
}
|
|
1955
|
+
};
|
|
1956
|
+
//#endregion
|
|
1812
1957
|
//#region src/resources/usage-apps.ts
|
|
1813
1958
|
var UsageAppsResource = class {
|
|
1814
1959
|
httpClient;
|
|
@@ -1969,7 +2114,7 @@ var WebhooksResource = class {
|
|
|
1969
2114
|
* An API token answers `forbidden`; sign in with a session.
|
|
1970
2115
|
*/
|
|
1971
2116
|
async delete(options) {
|
|
1972
|
-
await this.httpClient.
|
|
2117
|
+
await this.httpClient.fetchStatus({
|
|
1973
2118
|
method: "DELETE",
|
|
1974
2119
|
path: resolvePath("/v1/organizations/{organizationId}/webhooks/{webhookId}", options)
|
|
1975
2120
|
});
|
|
@@ -2009,7 +2154,7 @@ var WebhooksResource = class {
|
|
|
2009
2154
|
}
|
|
2010
2155
|
/**
|
|
2011
2156
|
* Changes the name, the URL, the subscribed `events`, the app filter or `isEnabled`. The format and the secret never change.
|
|
2012
|
-
*
|
|
2157
|
+
* `isEnabled: false` stamps `disabledAt`; `isEnabled: true` clears it and resets the count of failed deliveries in a row.
|
|
2013
2158
|
* An API token answers `forbidden`; sign in with a session.
|
|
2014
2159
|
*/
|
|
2015
2160
|
async update(options) {
|
|
@@ -2037,6 +2182,7 @@ var OrganizationsResource = class {
|
|
|
2037
2182
|
members;
|
|
2038
2183
|
ssoProvider;
|
|
2039
2184
|
subscription;
|
|
2185
|
+
telemetryExport;
|
|
2040
2186
|
usage;
|
|
2041
2187
|
webhooks;
|
|
2042
2188
|
constructor(httpClient) {
|
|
@@ -2050,6 +2196,7 @@ var OrganizationsResource = class {
|
|
|
2050
2196
|
this.members = new MembersResource(httpClient);
|
|
2051
2197
|
this.ssoProvider = new SsoProviderResource(httpClient);
|
|
2052
2198
|
this.subscription = new SubscriptionResource(httpClient);
|
|
2199
|
+
this.telemetryExport = new TelemetryExportResource(httpClient);
|
|
2053
2200
|
this.usage = new UsageResource(httpClient);
|
|
2054
2201
|
this.webhooks = new WebhooksResource(httpClient);
|
|
2055
2202
|
}
|
|
@@ -2080,7 +2227,7 @@ var OrganizationsResource = class {
|
|
|
2080
2227
|
* An API token answers `forbidden`; sign in with a session.
|
|
2081
2228
|
*/
|
|
2082
2229
|
async delete(options) {
|
|
2083
|
-
await this.httpClient.
|
|
2230
|
+
await this.httpClient.fetchStatus({
|
|
2084
2231
|
method: "DELETE",
|
|
2085
2232
|
path: resolvePath("/v1/organizations/{organizationId}", options)
|
|
2086
2233
|
});
|
|
@@ -2148,7 +2295,7 @@ var UserPasswordResource = class {
|
|
|
2148
2295
|
*/
|
|
2149
2296
|
async create(options) {
|
|
2150
2297
|
const { userId, ...body } = options;
|
|
2151
|
-
await this.httpClient.
|
|
2298
|
+
await this.httpClient.fetchStatus({
|
|
2152
2299
|
body,
|
|
2153
2300
|
method: "POST",
|
|
2154
2301
|
path: resolvePath("/v1/users/{userId}/password", { userId })
|
|
@@ -2169,7 +2316,7 @@ var UserSessionsResource = class {
|
|
|
2169
2316
|
*/
|
|
2170
2317
|
async deleteMany(options) {
|
|
2171
2318
|
const { userId, ...query } = options;
|
|
2172
|
-
await this.httpClient.
|
|
2319
|
+
await this.httpClient.fetchStatus({
|
|
2173
2320
|
method: "DELETE",
|
|
2174
2321
|
path: resolvePath("/v1/users/{userId}/sessions", { userId }),
|
|
2175
2322
|
query
|
|
@@ -2190,7 +2337,7 @@ var UserTokensResource = class {
|
|
|
2190
2337
|
*/
|
|
2191
2338
|
async deleteMany(options) {
|
|
2192
2339
|
const { userId, ...query } = options;
|
|
2193
|
-
await this.httpClient.
|
|
2340
|
+
await this.httpClient.fetchStatus({
|
|
2194
2341
|
method: "DELETE",
|
|
2195
2342
|
path: resolvePath("/v1/users/{userId}/tokens", { userId }),
|
|
2196
2343
|
query
|
|
@@ -2218,7 +2365,7 @@ var UsersResource = class {
|
|
|
2218
2365
|
*/
|
|
2219
2366
|
async delete(options) {
|
|
2220
2367
|
const { userId, ...body } = options;
|
|
2221
|
-
await this.httpClient.
|
|
2368
|
+
await this.httpClient.fetchStatus({
|
|
2222
2369
|
body,
|
|
2223
2370
|
method: "DELETE",
|
|
2224
2371
|
path: resolvePath("/v1/users/{userId}", { userId })
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotcodepush/node",
|
|
3
3
|
"description": "The typed Node client for the HotCodePush REST API",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"keywords": [
|
|
7
7
|
"hotcodepush",
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"prepublishOnly": "npm run build",
|
|
48
48
|
"sync-openapi": "node scripts/sync-openapi.ts",
|
|
49
49
|
"test": "vitest run",
|
|
50
|
-
"typecheck": "npm run generate -- --check && tsc --noEmit"
|
|
50
|
+
"typecheck": "npm run generate -- --check && tsc --noEmit",
|
|
51
|
+
"verify": "npm run lint && npm run typecheck && npm test && npm run build"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@eslint/js": "10.0.1",
|