@hotcodepush/node 0.1.0 → 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 +299 -175
- package/dist/index.mjs +11 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,49 +1,40 @@
|
|
|
1
1
|
# @hotcodepush/node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@hotcodepush/node)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The typed Node.js client for the [HotCodePush](https://hotcodepush.com) REST API, the over-the-air (OTA) update platform for React Native, Expo, Capacitor and Cordova.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
npm install
|
|
10
|
+
npm install @hotcodepush/node
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
It requires Node.js 22 or later.
|
|
13
|
+
It is ES modules only and requires Node.js 22 or later.
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
import { HotCodePush } from '@hotcodepush/node';
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
const hotCodePush = new HotCodePush();
|
|
20
|
+
const hotCodePush = new HotCodePush({ token: process.env.HOTCODEPUSH_TOKEN });
|
|
22
21
|
|
|
22
|
+
const [organization] = await hotCodePush.organizations.list();
|
|
23
23
|
const app = await hotCodePush.organizations.apps.create({
|
|
24
24
|
framework: 'capacitor',
|
|
25
25
|
name: 'Demo',
|
|
26
|
-
organizationId:
|
|
26
|
+
organizationId: organization.id,
|
|
27
27
|
});
|
|
28
28
|
const channel = await hotCodePush.apps.channels.create({
|
|
29
29
|
appId: app.id,
|
|
30
30
|
name: 'staging',
|
|
31
31
|
});
|
|
32
|
-
await hotCodePush.apps.channels.pause({ appId: app.id, channelId: channel.id });
|
|
33
|
-
|
|
34
|
-
const [release] = await hotCodePush.apps.releases.list({
|
|
35
|
-
appId: app.id,
|
|
36
|
-
channelId: channel.id,
|
|
37
|
-
number: 1,
|
|
38
|
-
});
|
|
39
32
|
```
|
|
40
33
|
|
|
34
|
+
`token` is an API token from the console's [API tokens](https://console.hotcodepush.com/settings/tokens) page. Left out, the client reads `HOTCODEPUSH_TOKEN`.
|
|
41
35
|
The resources mirror the API's paths, `/v1/apps/{appId}/channels` being `apps.channels`, and every paginated list has a `count` beside it.
|
|
42
|
-
A boolean filter such as `isRead` takes a `boolean`.
|
|
43
|
-
Each attempt of a call may take 60 seconds; pass `timeout` in milliseconds to change it. A binary upload gets ten minutes per attempt.
|
|
44
|
-
A `baseUrl` with a path, such as `https://proxy.example/hcp`, keeps it in front of every route.
|
|
45
36
|
Uploads stream their body, a `Blob` or a `ReadableStream` with its `contentLength`.
|
|
46
|
-
Creating calls send an `Idempotency-Key` and are retried
|
|
37
|
+
Creating calls send an `Idempotency-Key` and are retried. Pass `idempotencyKey` to reuse one across your own retries.
|
|
47
38
|
A failed request throws a `HotCodePushError` with the API's `code`, `message`, `details` and the HTTP `status`.
|
|
48
39
|
|
|
49
40
|
## Documentation
|
|
@@ -62,7 +53,7 @@ npm run fmt # ESLint's fixes and Prettier, run before every commit
|
|
|
62
53
|
```
|
|
63
54
|
|
|
64
55
|
`npm run sync-openapi` fetches the API's OpenAPI document into `openapi.json`, and `npm run generate` regenerates the types from it.
|
|
65
|
-
`npm run check-openapi-drift` compares the operations of `openapi.json` with the live API's
|
|
56
|
+
`npm run check-openapi-drift` compares the operations of `openapi.json` with the live API's. CI runs it after the tests.
|
|
66
57
|
`CLAUDE.md` holds the layout and the rules.
|
|
67
58
|
|
|
68
59
|
## License
|