native-update 4.1.1 → 4.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/AI-INTEGRATION-GUIDE.md +1 -1
- package/LICENSE +21 -17
- package/README.md +35 -20
- package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +8 -0
- package/dist/esm/core/update-check.d.ts +3 -0
- package/dist/esm/core/update-check.js +2 -0
- package/dist/esm/definitions.d.ts +18 -0
- package/dist/esm/plugin.js +6 -5
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.js +2 -2
- package/docs/CHANGELOG.md +22 -0
- package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +10 -1
- package/package.json +2 -6
package/AI-INTEGRATION-GUIDE.md
CHANGED
|
@@ -209,7 +209,7 @@ const stateListener = await NativeUpdate.addListener('updateStateChanged', (even
|
|
|
209
209
|
|
|
210
210
|
Easiest path: use the hosted backend at [nativeupdate.aoneahsan.com](https://nativeupdate.aoneahsan.com)
|
|
211
211
|
(free dashboard — register the app, upload bundles, get the `serverUrl` + API key).
|
|
212
|
-
|
|
212
|
+
Running your own server instead? It must implement this contract
|
|
213
213
|
(full spec: [server requirements](https://nativeupdate-docs.aoneahsan.com/backend/overview)):
|
|
214
214
|
|
|
215
215
|
### GET {serverUrl}/v1/updates/check?channel={channel}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
Native Update License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2024 Ahsan Mahmood
|
|
3
|
+
Copyright (c) 2024-2026 Ahsan Mahmood. All rights reserved.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
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:
|
|
5
|
+
This license applies to the native-update package from version 4.1.2 onward. Versions published before
|
|
6
|
+
4.1.2 remain available under the license they were published with.
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
1. Use. You may install the native-update package and use it, without charge, inside applications you
|
|
9
|
+
build and distribute, to receive updates from the Native Update service
|
|
10
|
+
(https://nativeupdate.aoneahsan.com) under a Native Update account and plan, or from a server you
|
|
11
|
+
operate that implements the update contract documented at https://nativeupdate-docs.aoneahsan.com.
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
2. Restrictions. You may not sell, sublicense, or redistribute the package or any part of it on its own
|
|
14
|
+
or as part of a library, SDK, or service that offers over-the-air update delivery to others; publish
|
|
15
|
+
a modified copy of it; or remove this notice. Shipping the package inside your own application
|
|
16
|
+
binaries and web bundles, as step 1 describes, is not redistribution under this section.
|
|
17
|
+
|
|
18
|
+
3. The service. Use of the Native Update service, dashboard, API, and CLI is governed by the Terms of
|
|
19
|
+
Service at https://nativeupdate.aoneahsan.com/terms.
|
|
20
|
+
|
|
21
|
+
4. No warranty. THE PACKAGE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
22
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
23
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
|
|
24
|
+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
25
|
+
CONNECTION WITH THE PACKAGE OR THE USE OR OTHER DEALINGS IN THE PACKAGE.
|
package/README.md
CHANGED
|
@@ -23,14 +23,13 @@
|
|
|
23
23
|
|
|
24
24
|
Native Update ships web-layer fixes to a released Capacitor app without waiting for store review, and wraps
|
|
25
25
|
the platform APIs for store updates and review prompts behind one TypeScript surface. It talks to a
|
|
26
|
-
documented HTTP contract, so you can point it at the hosted
|
|
27
|
-
backend, or write your own server. A bundled CLI creates, signs and deploys bundles, and the same operations
|
|
26
|
+
documented HTTP contract, so you can point it at the hosted Native Update service or write your own server. A bundled CLI creates, signs and deploys bundles, and the same operations
|
|
28
27
|
are available as an HTTP API for CI and coding agents.
|
|
29
28
|
|
|
30
29
|
| | |
|
|
31
30
|
|---|---|
|
|
32
|
-
| **Version** | `4.0
|
|
33
|
-
| **License** |
|
|
31
|
+
| **Version** | `4.2.0` |
|
|
32
|
+
| **License** | Proprietary — free to use in your apps ([LICENSE](./LICENSE)) |
|
|
34
33
|
| **Node** | `>=24.16.0` (install + CLI toolchain) |
|
|
35
34
|
| **Platforms** | iOS 14+ · Android 8.0+ (API 26) · Web |
|
|
36
35
|
| **Package size** | 281 kB tarball · ~1.14 MB unpacked · 136 files |
|
|
@@ -61,7 +60,7 @@ are available as an HTTP API for CI and coding agents.
|
|
|
61
60
|
- [🤝 Contributing](#contributing)
|
|
62
61
|
- [💬 Support](#support)
|
|
63
62
|
- [📄 License](#license)
|
|
64
|
-
- [
|
|
63
|
+
- [👥 Team](#author)
|
|
65
64
|
- [🔗 Links](#links)
|
|
66
65
|
- [🏷️ Keywords](#keywords)
|
|
67
66
|
|
|
@@ -76,10 +75,10 @@ usually mean three separate integrations.
|
|
|
76
75
|
| | `native-update` | Typical alternative |
|
|
77
76
|
|---|---|---|
|
|
78
77
|
| Scope | OTA bundles, store-update flows and in-app reviews in one API | one concern per package |
|
|
79
|
-
| Backend | hosted
|
|
78
|
+
| Backend | the hosted Native Update service, or your own server against a published HTTP contract | vendor-hosted only |
|
|
80
79
|
| Release automation | bundled CLI plus an HTTP management API for CI and agents | dashboard clicks, or a separate CLI |
|
|
81
80
|
| Bundle integrity | checksum plus optional signature, verified again at boot | varies |
|
|
82
|
-
| Cost model | free plugin;
|
|
81
|
+
| Cost model | free plugin; a Free plan, then Pro or Team on the hosted service | usage-priced service |
|
|
83
82
|
|
|
84
83
|
**Not the right tool when** your app is web-only (the OTA layer needs the native runtime), when you cannot
|
|
85
84
|
run or pay for any update server, or when your release process forbids shipping code outside a store review.
|
|
@@ -101,8 +100,8 @@ policies is your responsibility — see [Limitations](#limitations).
|
|
|
101
100
|
flow, or send the user to the App Store.
|
|
102
101
|
- **In-app reviews** — request the native review dialog without leaving the app, respecting platform limits.
|
|
103
102
|
- **Background updates** — schedule checks and notify the user when a bundle is ready.
|
|
104
|
-
- **
|
|
105
|
-
|
|
103
|
+
- **Hosted service or your own server** — the hosted dashboard and API, or any server that implements the
|
|
104
|
+
documented HTTP contract.
|
|
106
105
|
- **Release tooling** — a CLI for creating, signing, verifying and deploying bundles, plus an HTTP
|
|
107
106
|
management API covering the same lifecycle for CI and coding agents.
|
|
108
107
|
- **TypeScript throughout** — declarations for every method, option, event and error code.
|
|
@@ -130,7 +129,7 @@ unavailable rather than pretending. See [Limitations](#limitations).
|
|
|
130
129
|
| `@capacitor/preferences` | `>=8.0.0` | peer — records which bundle is active and whether it was confirmed |
|
|
131
130
|
| iOS | 14.0+ | minimum deployment target of the native plugin |
|
|
132
131
|
| Android | 8.0+ (API 26) | Capacitor 8.5 minimum; compile/target SDK 36 and Java 21 |
|
|
133
|
-
| An update server | — | the hosted
|
|
132
|
+
| An update server | — | the hosted Native Update service, or your own implementation of the HTTP contract |
|
|
134
133
|
|
|
135
134
|
<a id="installation"></a>
|
|
136
135
|
## 📦 Installation [#](#installation)
|
|
@@ -247,6 +246,20 @@ if (allowed) {
|
|
|
247
246
|
Ask after something went well for the user, never on launch. The platforms cap how often the dialog appears
|
|
248
247
|
and silently ignore extra requests.
|
|
249
248
|
|
|
249
|
+
### When delivery is paused
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
const result = await NativeUpdate.checkForUpdate();
|
|
253
|
+
|
|
254
|
+
if (result.held) {
|
|
255
|
+
// A newer release exists, but the hosted service is not serving it while the developer
|
|
256
|
+
// account is over its plan limits. Nothing is downloaded.
|
|
257
|
+
showBanner(result.heldMessage);
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
`held` arrives only from the hosted service (from 4.2.0). Your users keep the bundle they have.
|
|
262
|
+
|
|
250
263
|
<a id="configuration"></a>
|
|
251
264
|
## ⚙️ Configuration [#](#configuration)
|
|
252
265
|
|
|
@@ -403,8 +416,8 @@ Full reference: [CLI docs](https://nativeupdate-docs.aoneahsan.com/reference/cli
|
|
|
403
416
|
[Integrity and signing](https://nativeupdate-docs.aoneahsan.com/concepts/bundle-integrity-and-signing)
|
|
404
417
|
- **Certificate pinning** — pin the update host's certificate on iOS and Android.
|
|
405
418
|
[Reference](https://nativeupdate-docs.aoneahsan.com/reference/sdk/security/certificate-pinning)
|
|
406
|
-
- **
|
|
407
|
-
[
|
|
419
|
+
- **Your own server** — implement the update contract in any language; the CLI scaffolds a starting point.
|
|
420
|
+
[Backend overview](https://nativeupdate-docs.aoneahsan.com/backend/overview)
|
|
408
421
|
|
|
409
422
|
<a id="recovery-troubleshooting"></a>
|
|
410
423
|
## 🚑 Recovery & Troubleshooting [#](#recovery-troubleshooting)
|
|
@@ -427,8 +440,8 @@ More: [troubleshooting guide](https://nativeupdate-docs.aoneahsan.com/how-to/tro
|
|
|
427
440
|
|
|
428
441
|
- **OTA replaces the web layer only.** Anything that changes native code, permissions or the manifest still
|
|
429
442
|
needs a store release.
|
|
430
|
-
- **You supply the backend.** This package does not host your bundles. Use the hosted
|
|
431
|
-
the
|
|
443
|
+
- **You supply the backend.** This package does not host your bundles. Use the hosted Native Update service, or
|
|
444
|
+
implement the HTTP contract on your own server.
|
|
432
445
|
- **Web is not a deployment target for the native flows.** Store-update and review calls resolve without
|
|
433
446
|
doing anything on web, and certificate pinning is unavailable there because browsers do not expose
|
|
434
447
|
certificate details to JavaScript. Storage capacity on web is a fixed default, not a measurement.
|
|
@@ -450,8 +463,8 @@ More: [troubleshooting guide](https://nativeupdate-docs.aoneahsan.com/how-to/tro
|
|
|
450
463
|
## ❓ FAQ [#](#faq)
|
|
451
464
|
|
|
452
465
|
**Do I have to use the hosted backend?**
|
|
453
|
-
No. The [HTTP contract](https://nativeupdate-docs.aoneahsan.com/backend/api-contract) is published, the
|
|
454
|
-
|
|
466
|
+
No. The [HTTP contract](https://nativeupdate-docs.aoneahsan.com/backend/api-contract) is published, and the
|
|
467
|
+
CLI can scaffold an Express, Firebase or Vercel server that implements it.
|
|
455
468
|
|
|
456
469
|
**Does `require()` work, or is this ESM-only?**
|
|
457
470
|
Both. The package publishes an ESM build and a real CommonJS build with matching type declarations. Versions
|
|
@@ -528,13 +541,15 @@ If this package saves you time, you can support its maintenance at
|
|
|
528
541
|
<a id="license"></a>
|
|
529
542
|
## 📄 License [#](#license)
|
|
530
543
|
|
|
531
|
-
|
|
544
|
+
Proprietary © Ahsan Mahmood, from 4.1.2. You may install and use the package in the apps you build, with
|
|
545
|
+
a Native Update account or your own contract server; you may not redistribute it on its own. Versions before
|
|
546
|
+
4.1.2 were published under MIT. The full text ships in the package as `LICENSE`.
|
|
532
547
|
|
|
533
548
|
<a id="author"></a>
|
|
534
|
-
##
|
|
549
|
+
## 👥 Team [#](#author)
|
|
535
550
|
|
|
536
|
-
|
|
537
|
-
[
|
|
551
|
+
Built and run by the Native Update team — [nativeupdate.aoneahsan.com](https://nativeupdate.aoneahsan.com) ·
|
|
552
|
+
[contact](https://nativeupdate.aoneahsan.com/contact)
|
|
538
553
|
|
|
539
554
|
<a id="links"></a>
|
|
540
555
|
## 🔗 Links [#](#links)
|
|
@@ -20,6 +20,8 @@ class LiveUpdatePlugin(
|
|
|
20
20
|
private val context: Context
|
|
21
21
|
) {
|
|
22
22
|
private var config: JSObject? = null
|
|
23
|
+
// Billing hold from the last update check (server says a release exists but is not served).
|
|
24
|
+
@Volatile private var lastHeld: JSObject? = null
|
|
23
25
|
private var progressListener: ((JSObject) -> Unit)? = null
|
|
24
26
|
private var stateChangeListener: ((JSObject) -> Unit)? = null
|
|
25
27
|
/**
|
|
@@ -395,6 +397,11 @@ class LiveUpdatePlugin(
|
|
|
395
397
|
} else {
|
|
396
398
|
val result = JSObject()
|
|
397
399
|
result.put("available", false)
|
|
400
|
+
lastHeld?.let { held ->
|
|
401
|
+
result.put("held", true)
|
|
402
|
+
held.optString("version", "").takeIf { it.isNotEmpty() }?.let { result.put("version", it) }
|
|
403
|
+
held.optString("message", "").takeIf { it.isNotEmpty() }?.let { result.put("heldMessage", it) }
|
|
404
|
+
}
|
|
398
405
|
call.resolve(result)
|
|
399
406
|
}
|
|
400
407
|
} catch (e: Exception) {
|
|
@@ -574,6 +581,7 @@ class LiveUpdatePlugin(
|
|
|
574
581
|
if (response.isSuccessful) {
|
|
575
582
|
val body = response.body?.string()
|
|
576
583
|
val json = body?.let { JSObject(it) }
|
|
584
|
+
lastHeld = if (json != null && json.optBoolean("held", false)) json else null
|
|
577
585
|
if (json != null && json.optBoolean("available", false)) json else null
|
|
578
586
|
} else {
|
|
579
587
|
android.util.Log.w(
|
|
@@ -97,6 +97,9 @@ export interface BackendUpdateCheckResponse {
|
|
|
97
97
|
minNativeVersion?: string | null;
|
|
98
98
|
expiresAt?: string;
|
|
99
99
|
message?: string;
|
|
100
|
+
/** Billing hold: a newer release exists but is not served (see `CheckForUpdateResult.held`). */
|
|
101
|
+
held?: boolean;
|
|
102
|
+
code?: string;
|
|
100
103
|
}
|
|
101
104
|
/**
|
|
102
105
|
* Perform one update check against the Native Update backend.
|
|
@@ -111,5 +111,7 @@ export async function checkForUpdate(baseUrl, req) {
|
|
|
111
111
|
minNativeVersion: (_e = data.minNativeVersion) !== null && _e !== void 0 ? _e : undefined,
|
|
112
112
|
expiresAt: data.expiresAt,
|
|
113
113
|
message: data.message,
|
|
114
|
+
held: data.held === true ? true : undefined,
|
|
115
|
+
code: data.code,
|
|
114
116
|
};
|
|
115
117
|
}
|
|
@@ -364,6 +364,15 @@ export interface LatestVersion {
|
|
|
364
364
|
signature?: string;
|
|
365
365
|
signatureAlgorithm?: 'RSA-SHA256';
|
|
366
366
|
delta?: DeltaUpdateInfo;
|
|
367
|
+
/**
|
|
368
|
+
* The hosted service has a newer release for this app, but delivery is paused because the app's
|
|
369
|
+
* developer account is over its plan limits for longer than the grace period. No bundle is offered
|
|
370
|
+
* (`available` stays `false`); show `heldMessage` to your users if you want them to know an update is
|
|
371
|
+
* waiting. Added in 4.2.0; absent on servers that do not send it.
|
|
372
|
+
*/
|
|
373
|
+
held?: boolean;
|
|
374
|
+
/** Human-readable reason sent with `held`, e.g. that delivery resumes once the developer renews. */
|
|
375
|
+
heldMessage?: string;
|
|
367
376
|
}
|
|
368
377
|
/**
|
|
369
378
|
* Result from checkForUpdate convenience method
|
|
@@ -380,6 +389,15 @@ export interface CheckForUpdateResult {
|
|
|
380
389
|
signature?: string;
|
|
381
390
|
signatureAlgorithm?: 'RSA-SHA256';
|
|
382
391
|
delta?: DeltaUpdateInfo;
|
|
392
|
+
/**
|
|
393
|
+
* The hosted service has a newer release for this app, but delivery is paused because the app's
|
|
394
|
+
* developer account is over its plan limits for longer than the grace period. No bundle is offered
|
|
395
|
+
* (`available` stays `false`); show `heldMessage` to your users if you want them to know an update is
|
|
396
|
+
* waiting. Added in 4.2.0; absent on servers that do not send it.
|
|
397
|
+
*/
|
|
398
|
+
held?: boolean;
|
|
399
|
+
/** Human-readable reason sent with `held`, e.g. that delivery resumes once the developer renews. */
|
|
400
|
+
heldMessage?: string;
|
|
383
401
|
}
|
|
384
402
|
export interface DeltaUpdateInfo {
|
|
385
403
|
format: 'NUDELTA/1';
|
package/dist/esm/plugin.js
CHANGED
|
@@ -235,7 +235,7 @@ class NativeUpdatePluginWeb {
|
|
|
235
235
|
// tolerant no-update result, matching the old stub's behavior.
|
|
236
236
|
const result = await this.checkForUpdate();
|
|
237
237
|
if (!result.available) {
|
|
238
|
-
return { available: false };
|
|
238
|
+
return result.held ? { available: false, held: true, version: result.latestVersion, heldMessage: result.heldMessage } : { available: false };
|
|
239
239
|
}
|
|
240
240
|
return {
|
|
241
241
|
available: true,
|
|
@@ -384,10 +384,9 @@ class NativeUpdatePluginWeb {
|
|
|
384
384
|
identity: await this.resolveAppIdentity(),
|
|
385
385
|
});
|
|
386
386
|
if (!data.available) {
|
|
387
|
-
return
|
|
388
|
-
available: false,
|
|
389
|
-
currentVersion
|
|
390
|
-
};
|
|
387
|
+
return data.held
|
|
388
|
+
? { available: false, currentVersion, latestVersion: data.version, held: true, heldMessage: data.message }
|
|
389
|
+
: { available: false, currentVersion };
|
|
391
390
|
}
|
|
392
391
|
return {
|
|
393
392
|
available: true,
|
|
@@ -779,6 +778,8 @@ const NativeUpdate = new Proxy(NativeUpdateBridge, {
|
|
|
779
778
|
signature: latest.signature,
|
|
780
779
|
signatureAlgorithm: latest.signatureAlgorithm,
|
|
781
780
|
delta: latest.delta,
|
|
781
|
+
held: latest.held === true ? true : undefined,
|
|
782
|
+
heldMessage: latest.heldMessage,
|
|
782
783
|
};
|
|
783
784
|
};
|
|
784
785
|
}
|