@voltro/plugin-releases 0.0.0-stage → 0.83.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.
@@ -0,0 +1,55 @@
1
+ //#region src/rollout.ts
2
+ var e = (e) => {
3
+ let t = /^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(e.trim());
4
+ return t ? {
5
+ parts: [
6
+ Number(t[1]),
7
+ Number(t[2] ?? 0),
8
+ Number(t[3] ?? 0)
9
+ ],
10
+ pre: t[4] ? t[4].split(".") : []
11
+ } : null;
12
+ }, t = (t, n) => {
13
+ let r = e(t), i = e(n);
14
+ if (!r || !i) return t.localeCompare(n);
15
+ for (let e = 0; e < 3; e++) {
16
+ let t = (r.parts[e] ?? 0) - (i.parts[e] ?? 0);
17
+ if (t !== 0) return t < 0 ? -1 : 1;
18
+ }
19
+ if (r.pre.length === 0 && i.pre.length === 0) return 0;
20
+ if (r.pre.length === 0) return 1;
21
+ if (i.pre.length === 0) return -1;
22
+ for (let e = 0; e < Math.max(r.pre.length, i.pre.length); e++) {
23
+ let t = r.pre[e], n = i.pre[e];
24
+ if (t === void 0) return -1;
25
+ if (n === void 0) return 1;
26
+ let a = Number(t), o = Number(n), s = !Number.isNaN(a) && !Number.isNaN(o) ? a - o : t.localeCompare(n);
27
+ if (s !== 0) return s < 0 ? -1 : 1;
28
+ }
29
+ return 0;
30
+ }, n = (e, n) => t(e, n) > 0, r = (e) => {
31
+ let t = 2166136261;
32
+ for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619) >>> 0;
33
+ return t >>> 0;
34
+ }, i = (e, t) => r(`${t}:${e}`) % 100, a = (e) => {
35
+ if (e.releaseCohorts && e.installCohorts) {
36
+ for (let t of e.installCohorts) if (e.releaseCohorts.includes(t)) return !0;
37
+ }
38
+ return e.percent >= 100 ? !0 : e.percent <= 0 ? !1 : i(e.installId, e.salt) < e.percent;
39
+ }, o = (e, r) => {
40
+ let i = e.minSupportedVersion !== null && t(r.version, e.minSupportedVersion) < 0, o = e.latestVersion !== null && n(e.latestVersion, r.version) && a({
41
+ installId: r.installId,
42
+ salt: e.rolloutSalt ?? "",
43
+ percent: e.rolloutPercent,
44
+ ...r.cohorts === void 0 ? {} : { installCohorts: r.cohorts },
45
+ releaseCohorts: e.cohorts
46
+ }), s = Object.entries(e.killSwitches).filter(([, e]) => e.some((e) => t(e, r.version) === 0)).map(([e]) => e);
47
+ return {
48
+ blocked: i,
49
+ updateAvailable: o,
50
+ latestVersion: e.latestVersion,
51
+ killed: s
52
+ };
53
+ }, s = (e) => [...e].sort((e, n) => t(n, e));
54
+ //#endregion
55
+ export { e as a, n as i, o as n, i as o, a as r, s, t };
@@ -0,0 +1,217 @@
1
+ import { ReleaseNotFound as e, ReleaseRefused as t } from "./errors.js";
2
+ import { Schema as n } from "effect";
3
+ import { defineMutation as r, defineQuery as i } from "@voltro/protocol";
4
+ //#region src/names.ts
5
+ var a = "_voltro_release_apps", o = "_voltro_release_channels", s = "_voltro_releases", c = "_voltro_release_artifacts", l = "_voltro_release_events", u = "@voltro/plugin-releases", d = "releases:manage", f = n.Struct({
6
+ app: n.String,
7
+ channel: n.String,
8
+ latestVersion: n.NullOr(n.String),
9
+ minSupportedVersion: n.NullOr(n.String),
10
+ killSwitches: n.Record({
11
+ key: n.String,
12
+ value: n.Array(n.String)
13
+ }),
14
+ rolloutPercent: n.Number,
15
+ rolloutSalt: n.NullOr(n.String),
16
+ cohorts: n.NullOr(n.Array(n.String))
17
+ }), p = i({
18
+ name: "releases.policy",
19
+ input: n.Struct({
20
+ app: n.String,
21
+ channel: n.String
22
+ }),
23
+ output: f,
24
+ source: [o, s],
25
+ openAccess: "the release policy of a channel is what every client — signed in or not — must evaluate before it may continue; it carries versions and feature keys, no data"
26
+ }), m = n.Struct({
27
+ id: n.String,
28
+ version: n.String,
29
+ buildId: n.NullOr(n.String),
30
+ state: n.String,
31
+ rolloutPercent: n.Number,
32
+ channel: n.String,
33
+ createdAt: n.String,
34
+ artifacts: n.Number,
35
+ signed: n.Boolean
36
+ }), h = i({
37
+ name: "releases.list",
38
+ input: n.Struct({ app: n.String }),
39
+ output: n.Array(m),
40
+ source: [s],
41
+ guards: [{ scope: d }]
42
+ }), g = r({
43
+ name: "releases.registerApp",
44
+ input: n.Struct({
45
+ app: n.String,
46
+ platform: n.Literal("web", "ios", "android", "macos", "windows", "linux"),
47
+ shell: n.Literal("pwa", "expo", "tauri", "electron"),
48
+ bundleId: n.optional(n.String),
49
+ updaterPublicKey: n.optional(n.String),
50
+ runtimeVersion: n.optional(n.String),
51
+ channels: n.optional(n.Array(n.String))
52
+ }),
53
+ output: n.Struct({
54
+ id: n.String,
55
+ created: n.Boolean
56
+ }),
57
+ error: t,
58
+ guards: [{ scope: d }]
59
+ }), _ = r({
60
+ name: "releases.create",
61
+ input: n.Struct({
62
+ app: n.String,
63
+ channel: n.String,
64
+ version: n.String,
65
+ buildId: n.optional(n.String),
66
+ notes: n.optional(n.String),
67
+ cohorts: n.optional(n.Array(n.String))
68
+ }),
69
+ output: n.Struct({ id: n.String }),
70
+ error: n.Union(t, e),
71
+ guards: [{ scope: d }]
72
+ }), v = r({
73
+ name: "releases.upload",
74
+ input: n.Struct({
75
+ releaseId: n.String,
76
+ kind: n.String,
77
+ target: n.optional(n.String),
78
+ url: n.String,
79
+ sha256: n.String,
80
+ size: n.Number,
81
+ signature: n.optional(n.String),
82
+ notarized: n.optional(n.Boolean),
83
+ assetKey: n.optional(n.String),
84
+ contentType: n.optional(n.String)
85
+ }),
86
+ output: n.Struct({ id: n.String }),
87
+ error: n.Union(t, e),
88
+ guards: [{ scope: d }]
89
+ }), y = r({
90
+ name: "releases.promote",
91
+ input: n.Struct({
92
+ app: n.String,
93
+ version: n.String,
94
+ to: n.String,
95
+ rolloutPercent: n.optional(n.Number)
96
+ }),
97
+ output: n.Struct({
98
+ channel: n.String,
99
+ version: n.String,
100
+ rolloutPercent: n.Number
101
+ }),
102
+ error: n.Union(t, e),
103
+ guards: [{ scope: d }]
104
+ }), b = r({
105
+ name: "releases.rollout",
106
+ input: n.Struct({
107
+ app: n.String,
108
+ channel: n.String,
109
+ percent: n.Number
110
+ }),
111
+ output: n.Struct({
112
+ version: n.String,
113
+ rolloutPercent: n.Number
114
+ }),
115
+ error: n.Union(t, e),
116
+ guards: [{ scope: d }]
117
+ }), x = r({
118
+ name: "releases.rollback",
119
+ input: n.Struct({
120
+ app: n.String,
121
+ channel: n.String,
122
+ reason: n.String
123
+ }),
124
+ output: n.Struct({ version: n.NullOr(n.String) }),
125
+ error: n.Union(t, e),
126
+ guards: [{ scope: d }]
127
+ }), S = r({
128
+ name: "releases.setPolicy",
129
+ input: n.Struct({
130
+ app: n.String,
131
+ channel: n.String,
132
+ minSupportedVersion: n.optional(n.NullOr(n.String)),
133
+ killSwitches: n.optional(n.Record({
134
+ key: n.String,
135
+ value: n.Array(n.String)
136
+ })),
137
+ reason: n.String
138
+ }),
139
+ output: f,
140
+ error: n.Union(t, e),
141
+ guards: [{ scope: d }]
142
+ }), C = [
143
+ {
144
+ tag: "releases.policy",
145
+ kind: "query",
146
+ import: {
147
+ module: "@voltro/plugin-releases/rpc",
148
+ name: "policyDescriptor"
149
+ }
150
+ },
151
+ {
152
+ tag: "releases.list",
153
+ kind: "query",
154
+ import: {
155
+ module: "@voltro/plugin-releases/rpc",
156
+ name: "listDescriptor"
157
+ }
158
+ },
159
+ {
160
+ tag: "releases.registerApp",
161
+ kind: "mutation",
162
+ import: {
163
+ module: "@voltro/plugin-releases/rpc",
164
+ name: "registerAppDescriptor"
165
+ }
166
+ },
167
+ {
168
+ tag: "releases.create",
169
+ kind: "mutation",
170
+ import: {
171
+ module: "@voltro/plugin-releases/rpc",
172
+ name: "createDescriptor"
173
+ }
174
+ },
175
+ {
176
+ tag: "releases.upload",
177
+ kind: "mutation",
178
+ import: {
179
+ module: "@voltro/plugin-releases/rpc",
180
+ name: "uploadDescriptor"
181
+ }
182
+ },
183
+ {
184
+ tag: "releases.promote",
185
+ kind: "mutation",
186
+ import: {
187
+ module: "@voltro/plugin-releases/rpc",
188
+ name: "promoteDescriptor"
189
+ }
190
+ },
191
+ {
192
+ tag: "releases.rollout",
193
+ kind: "mutation",
194
+ import: {
195
+ module: "@voltro/plugin-releases/rpc",
196
+ name: "rolloutDescriptor"
197
+ }
198
+ },
199
+ {
200
+ tag: "releases.rollback",
201
+ kind: "mutation",
202
+ import: {
203
+ module: "@voltro/plugin-releases/rpc",
204
+ name: "rollbackDescriptor"
205
+ }
206
+ },
207
+ {
208
+ tag: "releases.setPolicy",
209
+ kind: "mutation",
210
+ import: {
211
+ module: "@voltro/plugin-releases/rpc",
212
+ name: "setPolicyDescriptor"
213
+ }
214
+ }
215
+ ];
216
+ //#endregion
217
+ export { c as _, _ as a, y as c, x as d, b as f, a as g, s as h, m as i, g as l, v as m, f as n, h as o, S as p, d as r, p as s, u as t, C as u, o as v, l as y };
package/dist/rpc.d.ts ADDED
@@ -0,0 +1,175 @@
1
+ import { MutationProcedureDescriptor } from '@voltro/protocol';
2
+ import { PluginRpcClientDescriptor } from '@voltro/protocol';
3
+ import { QueryProcedureDescriptor } from '@voltro/protocol';
4
+ import { Schema } from 'effect';
5
+
6
+ export declare const BASE_NAME = "@voltro/plugin-releases";
7
+
8
+ export declare const createDescriptor: MutationProcedureDescriptor<"releases.create", Schema.Struct<{
9
+ app: typeof Schema.String;
10
+ channel: typeof Schema.String;
11
+ version: typeof Schema.String;
12
+ buildId: Schema.optional<typeof Schema.String>;
13
+ notes: Schema.optional<typeof Schema.String>;
14
+ cohorts: Schema.optional<Schema.Array$<typeof Schema.String>>;
15
+ }>, Schema.Struct<{
16
+ id: typeof Schema.String;
17
+ }>, Schema.Union<[typeof ReleaseRefused, typeof ReleaseNotFound]>>;
18
+
19
+ export declare const listDescriptor: QueryProcedureDescriptor<"releases.list", Schema.Struct<{
20
+ app: typeof Schema.String;
21
+ }>, Schema.Array$<Schema.Struct<{
22
+ id: typeof Schema.String;
23
+ version: typeof Schema.String;
24
+ buildId: Schema.NullOr<typeof Schema.String>;
25
+ state: typeof Schema.String;
26
+ rolloutPercent: typeof Schema.Number;
27
+ channel: typeof Schema.String;
28
+ createdAt: typeof Schema.String;
29
+ artifacts: typeof Schema.Number;
30
+ signed: typeof Schema.Boolean;
31
+ }>>, typeof Schema.Never>;
32
+
33
+ /** The reactive policy every client subscribes to. Table-sourced, so a
34
+ * promote, rollout change or policy edit reaches every live client. */
35
+ export declare const policyDescriptor: QueryProcedureDescriptor<"releases.policy", Schema.Struct<{
36
+ app: typeof Schema.String;
37
+ channel: typeof Schema.String;
38
+ }>, Schema.Struct<{
39
+ app: typeof Schema.String;
40
+ channel: typeof Schema.String;
41
+ latestVersion: Schema.NullOr<typeof Schema.String>;
42
+ minSupportedVersion: Schema.NullOr<typeof Schema.String>;
43
+ killSwitches: Schema.Record$<typeof Schema.String, Schema.Array$<typeof Schema.String>>;
44
+ rolloutPercent: typeof Schema.Number;
45
+ rolloutSalt: Schema.NullOr<typeof Schema.String>;
46
+ cohorts: Schema.NullOr<Schema.Array$<typeof Schema.String>>;
47
+ }>, typeof Schema.Never>;
48
+
49
+ export declare const PolicySchema: Schema.Struct<{
50
+ app: typeof Schema.String;
51
+ channel: typeof Schema.String;
52
+ latestVersion: Schema.NullOr<typeof Schema.String>;
53
+ minSupportedVersion: Schema.NullOr<typeof Schema.String>;
54
+ killSwitches: Schema.Record$<typeof Schema.String, Schema.Array$<typeof Schema.String>>;
55
+ rolloutPercent: typeof Schema.Number;
56
+ rolloutSalt: Schema.NullOr<typeof Schema.String>;
57
+ cohorts: Schema.NullOr<Schema.Array$<typeof Schema.String>>;
58
+ }>;
59
+
60
+ export declare type PolicyWire = typeof PolicySchema.Type;
61
+
62
+ export declare const promoteDescriptor: MutationProcedureDescriptor<"releases.promote", Schema.Struct<{
63
+ app: typeof Schema.String;
64
+ version: typeof Schema.String;
65
+ to: typeof Schema.String;
66
+ rolloutPercent: Schema.optional<typeof Schema.Number>;
67
+ }>, Schema.Struct<{
68
+ channel: typeof Schema.String;
69
+ version: typeof Schema.String;
70
+ rolloutPercent: typeof Schema.Number;
71
+ }>, Schema.Union<[typeof ReleaseRefused, typeof ReleaseNotFound]>>;
72
+
73
+ /** Register an app target at runtime — what a hosted feed (one api serving
74
+ * many projects' apps) needs, where `apps:` in the plugin's config cannot
75
+ * know them. Idempotent: a target that exists answers with its id. */
76
+ export declare const registerAppDescriptor: MutationProcedureDescriptor<"releases.registerApp", Schema.Struct<{
77
+ app: typeof Schema.String;
78
+ platform: Schema.Literal<["web", "ios", "android", "macos", "windows", "linux"]>;
79
+ shell: Schema.Literal<["pwa", "expo", "tauri", "electron"]>;
80
+ bundleId: Schema.optional<typeof Schema.String>;
81
+ updaterPublicKey: Schema.optional<typeof Schema.String>;
82
+ runtimeVersion: Schema.optional<typeof Schema.String>;
83
+ channels: Schema.optional<Schema.Array$<typeof Schema.String>>;
84
+ }>, Schema.Struct<{
85
+ id: typeof Schema.String;
86
+ created: typeof Schema.Boolean;
87
+ }>, typeof ReleaseRefused>;
88
+
89
+ declare class ReleaseNotFound extends ReleaseNotFound_base {
90
+ }
91
+
92
+ declare const ReleaseNotFound_base: Schema.TaggedErrorClass<ReleaseNotFound, "ReleaseNotFound", {
93
+ readonly _tag: Schema.tag<"ReleaseNotFound">;
94
+ } & {
95
+ app: typeof Schema.String;
96
+ version: Schema.optional<typeof Schema.String>;
97
+ channel: Schema.optional<typeof Schema.String>;
98
+ }>;
99
+
100
+ declare class ReleaseRefused extends ReleaseRefused_base {
101
+ }
102
+
103
+ declare const ReleaseRefused_base: Schema.TaggedErrorClass<ReleaseRefused, "ReleaseRefused", {
104
+ readonly _tag: Schema.tag<"ReleaseRefused">;
105
+ } & {
106
+ reason: typeof Schema.String;
107
+ }>;
108
+
109
+ /** The scope that promotes, rolls out, rolls back and changes policy. */
110
+ export declare const RELEASES_MANAGE_SCOPE = "releases:manage";
111
+
112
+ export declare const releasesRpcClientImports: ReadonlyArray<PluginRpcClientDescriptor>;
113
+
114
+ export declare const ReleaseSummarySchema: Schema.Struct<{
115
+ id: typeof Schema.String;
116
+ version: typeof Schema.String;
117
+ buildId: Schema.NullOr<typeof Schema.String>;
118
+ state: typeof Schema.String;
119
+ rolloutPercent: typeof Schema.Number;
120
+ channel: typeof Schema.String;
121
+ createdAt: typeof Schema.String;
122
+ artifacts: typeof Schema.Number;
123
+ signed: typeof Schema.Boolean;
124
+ }>;
125
+
126
+ export declare const rollbackDescriptor: MutationProcedureDescriptor<"releases.rollback", Schema.Struct<{
127
+ app: typeof Schema.String;
128
+ channel: typeof Schema.String;
129
+ reason: typeof Schema.String;
130
+ }>, Schema.Struct<{
131
+ version: Schema.NullOr<typeof Schema.String>;
132
+ }>, Schema.Union<[typeof ReleaseRefused, typeof ReleaseNotFound]>>;
133
+
134
+ export declare const rolloutDescriptor: MutationProcedureDescriptor<"releases.rollout", Schema.Struct<{
135
+ app: typeof Schema.String;
136
+ channel: typeof Schema.String;
137
+ percent: typeof Schema.Number;
138
+ }>, Schema.Struct<{
139
+ version: typeof Schema.String;
140
+ rolloutPercent: typeof Schema.Number;
141
+ }>, Schema.Union<[typeof ReleaseRefused, typeof ReleaseNotFound]>>;
142
+
143
+ export declare const setPolicyDescriptor: MutationProcedureDescriptor<"releases.setPolicy", Schema.Struct<{
144
+ app: typeof Schema.String;
145
+ channel: typeof Schema.String;
146
+ minSupportedVersion: Schema.optional<Schema.NullOr<typeof Schema.String>>;
147
+ killSwitches: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Array$<typeof Schema.String>>>;
148
+ reason: typeof Schema.String;
149
+ }>, Schema.Struct<{
150
+ app: typeof Schema.String;
151
+ channel: typeof Schema.String;
152
+ latestVersion: Schema.NullOr<typeof Schema.String>;
153
+ minSupportedVersion: Schema.NullOr<typeof Schema.String>;
154
+ killSwitches: Schema.Record$<typeof Schema.String, Schema.Array$<typeof Schema.String>>;
155
+ rolloutPercent: typeof Schema.Number;
156
+ rolloutSalt: Schema.NullOr<typeof Schema.String>;
157
+ cohorts: Schema.NullOr<Schema.Array$<typeof Schema.String>>;
158
+ }>, Schema.Union<[typeof ReleaseRefused, typeof ReleaseNotFound]>>;
159
+
160
+ export declare const uploadDescriptor: MutationProcedureDescriptor<"releases.upload", Schema.Struct<{
161
+ releaseId: typeof Schema.String;
162
+ kind: typeof Schema.String;
163
+ target: Schema.optional<typeof Schema.String>;
164
+ url: typeof Schema.String;
165
+ sha256: typeof Schema.String;
166
+ size: typeof Schema.Number;
167
+ signature: Schema.optional<typeof Schema.String>;
168
+ notarized: Schema.optional<typeof Schema.Boolean>;
169
+ assetKey: Schema.optional<typeof Schema.String>;
170
+ contentType: Schema.optional<typeof Schema.String>;
171
+ }>, Schema.Struct<{
172
+ id: typeof Schema.String;
173
+ }>, Schema.Union<[typeof ReleaseRefused, typeof ReleaseNotFound]>>;
174
+
175
+ export { }
package/dist/rpc.js ADDED
@@ -0,0 +1,2 @@
1
+ import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "./rpc-U7ytx6SC.js";
2
+ export { f as BASE_NAME, s as PolicySchema, u as RELEASES_MANAGE_SCOPE, i as ReleaseSummarySchema, e as createDescriptor, c as listDescriptor, d as policyDescriptor, t as promoteDescriptor, a as registerAppDescriptor, p as releasesRpcClientImports, n as rollbackDescriptor, r as rolloutDescriptor, l as setPolicyDescriptor, o as uploadDescriptor };
package/dist/web.d.ts ADDED
@@ -0,0 +1,73 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ /** Blocks the app until it updates, when the channel's policy says so. */
4
+ export declare const ForcedUpdateGate: (props: ForcedUpdateGateProps) => ReactNode;
5
+
6
+ export declare interface ForcedUpdateGateProps extends UseReleasePolicyOptions {
7
+ readonly children: ReactNode;
8
+ /** Rendered instead of the app while the version is below the minimum.
9
+ * Receives the verdict so it can offer the platform's `updates.apply()`. */
10
+ readonly fallback: (verdict: PolicyVerdict) => ReactNode;
11
+ }
12
+
13
+ declare interface PolicyVerdict {
14
+ /** The client must update before it may continue. */
15
+ readonly blocked: boolean;
16
+ /** A newer version exists on the channel — and this install is in its rollout. */
17
+ readonly updateAvailable: boolean;
18
+ readonly latestVersion: string | null;
19
+ /** Feature keys the running version must treat as off. */
20
+ readonly killed: ReadonlyArray<string>;
21
+ }
22
+
23
+ declare interface ReleasePolicy {
24
+ readonly app: string;
25
+ readonly channel: string;
26
+ /** The channel's current release version, or null before the first promote. */
27
+ readonly latestVersion: string | null;
28
+ readonly minSupportedVersion: string | null;
29
+ /** `{ featureKey: [versions the feature is switched off for] }` */
30
+ readonly killSwitches: Readonly<Record<string, ReadonlyArray<string>>>;
31
+ readonly rolloutPercent: number;
32
+ readonly rolloutSalt: string | null;
33
+ readonly cohorts: ReadonlyArray<string> | null;
34
+ }
35
+
36
+ export declare interface ReleasePolicyState {
37
+ readonly policy: ReleasePolicy | null;
38
+ readonly verdict: PolicyVerdict | null;
39
+ readonly loading: boolean;
40
+ }
41
+
42
+ /** A stable per-install id from the platform's storage (minted once). */
43
+ export declare const useInstallId: (explicit?: string) => string;
44
+
45
+ /** Is a feature switched off for the running version by a kill switch? */
46
+ export declare const useKillSwitch: (options: UseReleasePolicyOptions & {
47
+ readonly key: string;
48
+ }) => boolean;
49
+
50
+ /** The live release policy of a channel and this client's verdict under it. */
51
+ export declare const useReleasePolicy: (options: UseReleasePolicyOptions) => ReleasePolicyState;
52
+
53
+ export declare interface UseReleasePolicyOptions {
54
+ readonly app: string;
55
+ readonly channel: string;
56
+ /** The running version. Defaults to the platform adapter's `appVersion`. */
57
+ readonly version?: string;
58
+ /** A stable per-install id for the rollout bucket. Defaults to a value kept
59
+ * in the platform's persisted storage. */
60
+ readonly installId?: string;
61
+ readonly cohorts?: ReadonlyArray<string>;
62
+ readonly apiName?: string;
63
+ }
64
+
65
+ /**
66
+ * The update IMPULSE: when the channel's policy says a newer version is
67
+ * rolled out to this install, ask the platform's update channel to check —
68
+ * the service worker, the desktop updater, the OTA client — instead of
69
+ * polling on a timer. Returns the verdict so the caller can also render it.
70
+ */
71
+ export declare const useUpdateImpulse: (options: UseReleasePolicyOptions) => ReleasePolicyState;
72
+
73
+ export { }
package/dist/web.js ADDED
@@ -0,0 +1,47 @@
1
+ import { n as e } from "./rollout-CGRKMTfv.js";
2
+ import { t } from "./rpc-U7ytx6SC.js";
3
+ import { pluginTag as n } from "@voltro/protocol";
4
+ import { createElement as r, useEffect as i, useRef as a } from "react";
5
+ import { usePlatform as o, useSubscription as s } from "@voltro/client";
6
+ //#region src/web.ts
7
+ var c = (e) => n(t, e), l = "voltro:install-id", u = (e) => {
8
+ let { storage: t } = o();
9
+ if (e !== void 0) return e;
10
+ let n = t("local");
11
+ if (n === null) return "ephemeral";
12
+ let r = n.getItem(l);
13
+ if (r) return r;
14
+ let i = `inst_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
15
+ return n.setItem(l, i), i;
16
+ }, d = (t) => {
17
+ let { platform: n } = o(), r = u(t.installId), { data: i, loading: a } = s(t.apiName ?? "app", c("policy"), {
18
+ app: t.app,
19
+ channel: t.channel
20
+ }), l = t.version ?? n.appVersion, d = i ?? null;
21
+ return {
22
+ policy: d,
23
+ verdict: d !== null && l !== void 0 ? e(d, {
24
+ version: l,
25
+ installId: r,
26
+ ...t.cohorts === void 0 ? {} : { cohorts: t.cohorts }
27
+ }) : null,
28
+ loading: a
29
+ };
30
+ }, f = (e) => {
31
+ let { verdict: t } = d(e);
32
+ return t?.killed.includes(e.key) ?? !1;
33
+ }, p = (e) => {
34
+ let { children: t, fallback: n, ...i } = e, { verdict: a } = d(i);
35
+ return a?.blocked ? r(m, {
36
+ render: n,
37
+ verdict: a
38
+ }) : t;
39
+ }, m = ({ render: e, verdict: t }) => e(t), h = (e) => {
40
+ let t = d(e), { updates: n } = o(), r = a(null);
41
+ return i(() => {
42
+ let e = t.verdict?.updateAvailable ? t.verdict.latestVersion : null;
43
+ e !== null && e !== r.current && (r.current = e, n?.check());
44
+ }, [t.verdict, n]), t;
45
+ };
46
+ //#endregion
47
+ export { p as ForcedUpdateGate, u as useInstallId, f as useKillSwitch, d as useReleasePolicy, h as useUpdateImpulse };
package/package.json CHANGED
@@ -1,6 +1,69 @@
1
1
  {
2
2
  "name": "@voltro/plugin-releases",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.83.0",
4
+ "description": "Release channels, artefacts and rollouts for the apps a Voltro api serves — the self-hosted update server behind Tauri, Expo OTA, electron-updater and PWA update feeds, with a reactive release policy every client subscribes to.",
5
+ "keywords": [
6
+ "voltro",
7
+ "typescript",
8
+ "framework"
9
+ ],
10
+ "license": "SEE LICENSE IN LICENSE",
11
+ "homepage": "https://voltro.dev",
12
+ "bugs": {
13
+ "email": "support@voltro.dev"
14
+ },
15
+ "author": {
16
+ "name": "Voltro UG",
17
+ "url": "https://voltro.dev"
18
+ },
19
+ "type": "module",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.js",
24
+ "default": "./dist/index.js"
25
+ },
26
+ "./web": {
27
+ "types": "./dist/web.d.ts",
28
+ "import": "./dist/web.js",
29
+ "default": "./dist/web.js"
30
+ },
31
+ "./errors": {
32
+ "types": "./dist/errors.d.ts",
33
+ "import": "./dist/errors.js",
34
+ "default": "./dist/errors.js"
35
+ },
36
+ "./rpc": {
37
+ "types": "./dist/rpc.d.ts",
38
+ "import": "./dist/rpc.js",
39
+ "default": "./dist/rpc.js"
40
+ },
41
+ "./package.json": "./package.json"
42
+ },
43
+ "main": "./dist/index.js",
44
+ "module": "./dist/index.js",
45
+ "types": "./dist/index.d.ts",
46
+ "sideEffects": false,
47
+ "engines": {
48
+ "node": ">=24.0.0"
49
+ },
50
+ "dependencies": {
51
+ "@voltro/client": "0.83.0",
52
+ "@voltro/database": "0.83.0",
53
+ "@voltro/logger": "0.83.0",
54
+ "@voltro/protocol": "0.83.0",
55
+ "@voltro/runtime": "0.83.0"
56
+ },
57
+ "peerDependencies": {
58
+ "effect": "^3.22.2",
59
+ "react": "^19.0.0"
60
+ },
61
+ "peerDependenciesMeta": {
62
+ "react": {
63
+ "optional": true
64
+ }
65
+ },
66
+ "publishConfig": {
67
+ "access": "public"
68
+ }
69
+ }