@hot-updater/protocol 0.0.0-stage → 1.0.0-rc.21
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/LICENSE +33 -0
- package/README.md +49 -2
- package/dist/index.cjs +806 -0
- package/dist/index.d.cts +548 -0
- package/dist/index.d.mts +548 -0
- package/dist/index.mjs +753 -0
- package/package.json +52 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Sungyu Kang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
ADDITIONAL DISCLAIMER
|
|
26
|
+
|
|
27
|
+
The authors of this software shall not be held responsible for any legal issues,
|
|
28
|
+
regulatory violations, policy violations, or disputes arising from the use,
|
|
29
|
+
distribution, or integration of this software.
|
|
30
|
+
|
|
31
|
+
Users are solely responsible for ensuring compliance with all applicable laws,
|
|
32
|
+
regulations, and third-party policies (including but not limited to app store
|
|
33
|
+
policies).
|
package/README.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @hot-updater/protocol
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The device-safe, zero-dependency package for what crosses a boundary:
|
|
4
|
+
|
|
5
|
+
- the data formats and pure computations that the app and the server share,
|
|
6
|
+
where both sides must get the same answer;
|
|
7
|
+
- the contracts between a host and its extensions on the device, such as the
|
|
8
|
+
client plugin contract, and the reference host that runs them.
|
|
9
|
+
|
|
10
|
+
It runs anywhere: Hermes, Node, Workers, and Deno. Code that only the server
|
|
11
|
+
or the CLI uses belongs in `@hot-updater/plugin-core` or
|
|
12
|
+
`@hot-updater/server`.
|
|
13
|
+
|
|
14
|
+
## What belongs here
|
|
15
|
+
|
|
16
|
+
Code moves into this package only when all three hold:
|
|
17
|
+
|
|
18
|
+
1. It crosses a boundary: a format or computation both the app and the server
|
|
19
|
+
run, or a contract a host on the device offers its extensions.
|
|
20
|
+
2. It does no I/O of its own: what reaches the device or the network, such as
|
|
21
|
+
the plugin host's `fetch` and storage, the caller passes in. It uses no Node
|
|
22
|
+
or React Native API and keeps no global state.
|
|
23
|
+
3. It needs no dependency. This package has none; what it takes from another
|
|
24
|
+
package, such as verkit's version parsing, is bundled into `dist`.
|
|
25
|
+
|
|
26
|
+
It holds the domain types, the release catalog format and its scope rules,
|
|
27
|
+
the check a client runs on a fetched release catalog (`parseReleaseCatalog`),
|
|
28
|
+
the rollout cohort math, bundle artifacts, the bundle id format (`uuid`), the
|
|
29
|
+
client plugin contract, `canonicalizeAppVersion`, and `resolveBaseURL`. The
|
|
30
|
+
device's update client and doctor's server checks both run
|
|
31
|
+
`parseReleaseCatalog`, so they accept the same catalogs. Client
|
|
32
|
+
plugin authors import `defineClientPlugin` and its types from here.
|
|
33
|
+
`createPluginHost` is the host the SDK runs client plugins on: a device SDK
|
|
34
|
+
passes it the platform, the device's storage, and `fetch`, and
|
|
35
|
+
`@hot-updater/test-utils/react-native` passes it fakes.
|
|
36
|
+
|
|
37
|
+
## Boundary with `@hot-updater/plugin-core`
|
|
38
|
+
|
|
39
|
+
`@hot-updater/plugin-core` is the kit that extends the server: the storage and
|
|
40
|
+
database adapter contracts, the server plugin authoring API, and their
|
|
41
|
+
helpers. It runs wherever the server runs, in Node, Workers, Deno, or Lambda,
|
|
42
|
+
and depends on this package, never the reverse. The app never imports it:
|
|
43
|
+
React Native imports this package and the built-in Insights client, never
|
|
44
|
+
plugin-core or the server.
|
|
45
|
+
|
|
46
|
+
`src/package.spec.ts` checks that this package has no dependencies and imports
|
|
47
|
+
only what its build bundles. An oxlint rule refuses `@hot-updater/plugin-core`
|
|
48
|
+
and `@hot-updater/server` imports in `packages/protocol/src`,
|
|
49
|
+
`packages/react-native/src`, and the Insights client in
|
|
50
|
+
`plugins/insights/src/client`.
|