@voltro/plugin-releases 0.85.0 → 0.86.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.
@@ -1,11 +1,11 @@
1
1
  # Third-Party Notices — @voltro/plugin-releases
2
2
 
3
- This package depends on the open-source software listed below. Each is the
3
+ This package uses the open-source software listed below. Each is the
4
4
  property of its respective copyright holders and is used under the terms of
5
5
  its license. This file is provided for attribution; it grants no rights in
6
6
  @voltro/plugin-releases itself, which is proprietary (see LICENSE).
7
7
 
8
- Generated from the resolved runtime dependency closure (48 packages).
8
+ Generated from the resolved runtime dependency closure (47 packages).
9
9
 
10
10
  ---
11
11
 
@@ -3776,34 +3776,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3776
3776
  SOFTWARE.
3777
3777
  ```
3778
3778
 
3779
- ## layerr@3.0.0
3780
-
3781
- License: MIT
3782
-
3783
- ```
3784
- MIT License
3785
-
3786
- Copyright (c) 2020 Perry Mitchell
3787
-
3788
- Permission is hereby granted, free of charge, to any person obtaining a copy
3789
- of this software and associated documentation files (the "Software"), to deal
3790
- in the Software without restriction, including without limitation the rights
3791
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3792
- copies of the Software, and to permit persons to whom the Software is
3793
- furnished to do so, subject to the following conditions:
3794
-
3795
- The above copyright notice and this permission notice shall be included in all
3796
- copies or substantial portions of the Software.
3797
-
3798
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3799
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3800
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3801
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3802
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3803
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3804
- SOFTWARE.
3805
- ```
3806
-
3807
3779
  ## lib0@0.2.117
3808
3780
 
3809
3781
  License: MIT
@@ -4153,14 +4125,14 @@ Apache License
4153
4125
  limitations under the License.
4154
4126
  ```
4155
4127
 
4156
- ## ulidx@2.4.1
4128
+ ## ulid@3.0.2
4157
4129
 
4158
4130
  License: MIT
4159
4131
 
4160
4132
  ```
4161
- MIT License
4133
+ The MIT License (MIT)
4162
4134
 
4163
- Copyright (c) 2021 Perry Mitchell
4135
+ Copyright (c) 2017 Alizain Feerasta
4164
4136
 
4165
4137
  Permission is hereby granted, free of charge, to any person obtaining a copy
4166
4138
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,27 @@
1
+ //#region src/artifactMetadata.ts
2
+ var e = (e) => typeof e == "string" && e.trim().length > 0 && !/[\u0000-\u001f\u007f]/.test(e), t = (t) => e(t) && t.length <= 200, n = (e) => typeof e == "string" && /^[a-f0-9]{64}$/i.test(e), r = (e) => Number.isSafeInteger(e) && e > 0, i = (e) => typeof e == "string" && e.trim().length > 0 && !e.includes("\0"), a = (a) => {
3
+ for (let t of [
4
+ "releaseId",
5
+ "kind",
6
+ "url"
7
+ ]) if (!e(a[t])) return `Artifact ${t} must be nonblank text without control characters`;
8
+ if (a.operationId !== void 0 && !t(a.operationId)) return "Artifact operationId must be nonblank text without control characters and at most 200 characters";
9
+ if (!n(a.sha256)) return "Artifact sha256 must contain exactly 64 hexadecimal characters";
10
+ if (!r(a.size)) return "Artifact size must be a positive safe integer";
11
+ for (let t of [
12
+ "target",
13
+ "assetKey",
14
+ "contentType"
15
+ ]) {
16
+ let n = a[t];
17
+ if (n !== void 0 && !e(n)) return `Artifact ${t} must be nonblank text without control characters`;
18
+ }
19
+ if (a.signature !== void 0 && !i(a.signature)) return "Artifact signature must not be blank or contain NUL";
20
+ }, o = (e) => {
21
+ if (typeof e != "string" || !/^[1-9][0-9]*$/.test(e)) throw Error("Stored artifact size must be a positive integer");
22
+ let t = Number(e);
23
+ if (!r(t)) throw Error("Stored artifact size exceeds the numeric feed range");
24
+ return t;
25
+ };
26
+ //#endregion
27
+ export { n as artifactHash, a as artifactMetadataIssue, t as artifactOperationId, r as artifactSize, o as artifactStoredSize, e as artifactText, i as hasArtifactSignature };
package/dist/feeds.js ADDED
@@ -0,0 +1,112 @@
1
+ import { hasArtifactSignature as e } from "./artifactMetadata.js";
2
+ import { compareVersions as t, inRollout as n } from "./rollout.js";
3
+ //#region src/feeds.ts
4
+ var r = (e, r) => r.currentVersion !== null && t(e.version, r.currentVersion) <= 0 ? !1 : n({
5
+ installId: r.installId,
6
+ salt: e.rolloutSalt,
7
+ percent: e.rolloutPercent,
8
+ ...r.cohorts === void 0 ? {} : { installCohorts: r.cohorts },
9
+ releaseCohorts: e.cohorts
10
+ }), i = (t, n) => {
11
+ if (!r(t, n)) return null;
12
+ let i = t.artifacts.find((t) => t.target === n.target && e(t.signature)) ?? (n.target === "darwin-aarch64" || n.target === "darwin-x86_64" ? t.artifacts.find((t) => t.target === "darwin-universal" && e(t.signature)) : void 0);
13
+ return !i || !e(i.signature) ? null : {
14
+ version: t.version,
15
+ notes: t.notes ?? "",
16
+ pub_date: t.createdAt.toISOString(),
17
+ platforms: { [n.target]: {
18
+ signature: i.signature,
19
+ url: i.url
20
+ } }
21
+ };
22
+ }, a = (e, t, n = {}) => {
23
+ let r = {
24
+ win: [
25
+ "nsis",
26
+ "msi",
27
+ "exe"
28
+ ],
29
+ mac: ["dmg", "zip"],
30
+ linux: [
31
+ "appimage",
32
+ "deb",
33
+ "rpm"
34
+ ]
35
+ }, i = e.artifacts.filter((e) => r[t].includes(e.kind));
36
+ if (i.length === 0) return null;
37
+ let a = [`version: ${e.version}`, "files:"];
38
+ for (let e of i) {
39
+ a.push(` - url: ${e.url}`);
40
+ let t = n[e.sha256];
41
+ a.push(t === void 0 ? ` sha256: ${e.sha256}` : ` sha512: ${t}`), a.push(` size: ${e.size}`);
42
+ }
43
+ let o = i[0];
44
+ a.push(`path: ${o.url}`);
45
+ let s = n[o.sha256];
46
+ return a.push(s === void 0 ? `sha256: ${o.sha256}` : `sha512: ${s}`), a.push(`releaseDate: '${e.createdAt.toISOString()}'`), e.notes && a.push(`releaseNotes: ${JSON.stringify(e.notes)}`), a.join("\n") + "\n";
47
+ }, o = (e, t, n) => {
48
+ if (n.rolledBackTo !== null) return {
49
+ kind: "rollback",
50
+ commitTime: n.rolledBackTo.commitTime.toISOString()
51
+ };
52
+ if (e === null || n.runtimeVersion !== null && n.runtimeVersion !== t.runtimeVersion) return { kind: "no-update" };
53
+ let i = e.buildId ?? e.id;
54
+ if (t.currentUpdateId === i || !r(e, {
55
+ installId: t.installId,
56
+ currentVersion: null,
57
+ ...t.cohorts === void 0 ? {} : { cohorts: t.cohorts }
58
+ })) return { kind: "no-update" };
59
+ let a = e.artifacts.find((e) => e.kind === "expo-bundle" && e.target === t.platform);
60
+ if (!a) return { kind: "no-update" };
61
+ let o = e.artifacts.filter((e) => e.kind === "expo-asset" && (e.target === null || e.target === t.platform)).map((e) => ({
62
+ hash: e.sha256,
63
+ key: e.assetKey ?? e.sha256,
64
+ contentType: e.contentType ?? "application/octet-stream",
65
+ url: e.url
66
+ }));
67
+ return {
68
+ kind: "manifest",
69
+ manifest: {
70
+ id: i,
71
+ createdAt: e.createdAt.toISOString(),
72
+ runtimeVersion: t.runtimeVersion,
73
+ launchAsset: {
74
+ hash: a.sha256,
75
+ key: a.assetKey ?? "bundle",
76
+ contentType: a.contentType ?? "application/javascript",
77
+ url: a.url
78
+ },
79
+ assets: o,
80
+ metadata: {},
81
+ extra: {
82
+ version: e.version,
83
+ ...e.notes ? { notes: e.notes } : {}
84
+ }
85
+ }
86
+ };
87
+ }, s = {
88
+ macos: ["dmg", "zip"],
89
+ windows: [
90
+ "nsis",
91
+ "msi",
92
+ "exe"
93
+ ],
94
+ linux: [
95
+ "appimage",
96
+ "deb",
97
+ "rpm"
98
+ ],
99
+ ios: ["ipa"],
100
+ android: ["apk", "aab"]
101
+ }, c = (e, t, n) => {
102
+ let r = s[t] ?? [], i = e.artifacts.filter((e) => r.includes(e.kind));
103
+ return i.length === 0 ? null : n === void 0 ? (t === "macos" ? i.find((e) => e.target === "darwin-universal") : void 0) ?? i[0] : i.find((e) => e.target === `${t === "macos" ? "darwin" : t}-${n}`) || (t === "macos" && (n === "aarch64" || n === "x86_64") ? i.find((e) => e.target === "darwin-universal") ?? null : null);
104
+ }, l = (e) => /Windows/i.test(e) ? {
105
+ os: "windows",
106
+ arch: /ARM64|aarch64/i.test(e) ? "aarch64" : "x86_64"
107
+ } : /Macintosh|Mac OS X/i.test(e) ? { os: "macos" } : /Android/i.test(e) ? { os: "android" } : /iPhone|iPad|iPod/i.test(e) ? { os: "ios" } : /Linux/i.test(e) ? {
108
+ os: "linux",
109
+ arch: /aarch64|arm64/i.test(e) ? "aarch64" : "x86_64"
110
+ } : null;
111
+ //#endregion
112
+ export { r as offeredTo, l as osFromUserAgent, c as pickDownload, a as renderElectronLatestYml, o as renderExpoFeed, i as renderTauriFeed };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { ColumnBuilder } from '@voltro/database';
2
+ import { DataStore } from '@voltro/database';
3
+ import { Effect } from 'effect';
2
4
  import { FieldDefinitions } from '@voltro/database';
3
5
  import { InferRow } from '@voltro/database';
6
+ import { PluginRouteContext } from '@voltro/protocol';
4
7
  import { Schema } from 'effect';
5
8
  import { Table } from '@voltro/database';
6
9
  import { VoltroPlugin } from '@voltro/protocol';
@@ -184,7 +187,7 @@ export declare const releaseArtifactsTable: Table<"_voltro_release_artifacts", F
184
187
  /** Where the bytes are — a storage ref URL, a CDN URL. The feed hands this out. */
185
188
  readonly url: ColumnBuilder<string, "text", boolean>;
186
189
  readonly sha256: ColumnBuilder<string, "text", boolean>;
187
- readonly size: ColumnBuilder<number, "integer", boolean>;
190
+ readonly size: ColumnBuilder<string, "bigint", boolean>;
188
191
  /** minisign / Expo code-signing signature over the bytes. */
189
192
  readonly signature: ColumnBuilder<string | null, "text", boolean>;
190
193
  readonly notarized: ColumnBuilder<boolean, "boolean", true>;
@@ -228,6 +231,12 @@ export declare const releaseEventsTable: Table<"_voltro_release_events", FieldDe
228
231
  readonly at: ColumnBuilder<Date, "timestamp", true>;
229
232
  }>, true, "byReleaseEventApp">;
230
233
 
234
+ export declare type ReleaseManagementAction = 'apps' | 'create' | 'prepare-upload' | 'upload' | 'promote' | 'rollout' | 'rollback' | 'policy';
235
+
236
+ export declare interface ReleaseManagementContext extends PluginRouteContext {
237
+ readonly mutationStore: DataStore;
238
+ }
239
+
231
240
  export declare class ReleaseNotFound extends ReleaseNotFound_base {
232
241
  }
233
242
 
@@ -269,7 +278,14 @@ export declare const RELEASES_TABLE = "_voltro_releases";
269
278
 
270
279
  export declare type ReleaseShell = (typeof RELEASE_SHELLS)[number];
271
280
 
272
- export declare const releasesPlugin: (options: ReleasesPluginOptions) => VoltroPlugin;
281
+ export declare interface ReleasesPlugin extends VoltroPlugin {
282
+ /** Trusted server capability. Authorize the caller and execute inside its
283
+ * transaction; failed Effects must escape that transaction to roll it back.
284
+ * Uses the same input schemas and atomic writers as RPC and Inspect. */
285
+ readonly manage: (action: ReleaseManagementAction, input: unknown, context: ReleaseManagementContext) => Effect.Effect<unknown, unknown>;
286
+ }
287
+
288
+ export declare const releasesPlugin: (options: ReleasesPluginOptions) => ReleasesPlugin;
273
289
 
274
290
  export declare interface ReleasesPluginOptions {
275
291
  /** The app targets this api releases for; created on activation if absent. */
@@ -372,7 +388,7 @@ export declare const releaseTables: readonly [ Table<"_voltro_release_apps", Fie
372
388
  /** Where the bytes are — a storage ref URL, a CDN URL. The feed hands this out. */
373
389
  readonly url: ColumnBuilder<string, "text", boolean>;
374
390
  readonly sha256: ColumnBuilder<string, "text", boolean>;
375
- readonly size: ColumnBuilder<number, "integer", boolean>;
391
+ readonly size: ColumnBuilder<string, "bigint", boolean>;
376
392
  /** minisign / Expo code-signing signature over the bytes. */
377
393
  readonly signature: ColumnBuilder<string | null, "text", boolean>;
378
394
  readonly notarized: ColumnBuilder<boolean, "boolean", true>;