@tomradex/community 0.14.0 → 0.15.1

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/dist/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export { Community, Community as default, CommunityConfig, type BrowseResult, ty
2
2
  export { PublishRefused, githubAccess, prepareRelease, type GitHubAccess, type Prepared } from "./publish.js";
3
3
  export { expansion, latestInstallable, planUpdate, revoked, type Revocation, type RiskLevel, type Tier, type UpdatePlan, type VersionRow } from "./rules.js";
4
4
  export { linkGitHub } from "./oauth.js";
5
- export { OFFICIAL_CATALOG_URL, OfficialCatalog, isOfficialId, type CatalogState } from "./official.js";
5
+ export { OFFICIAL_CATALOG_URL, OfficialCatalog, bundleOfficialPlugins, isOfficialId, type CatalogState } from "./official.js";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,11 @@
1
1
  import { type Attestation, type Catalog } from "@tomradex/plugin-kit";
2
- import type { Revocation, VersionRow } from "./rules.js";
2
+ import { type Revocation, type VersionRow } from "./rules.js";
3
3
  /** Where Tomrade's own plugins are released: github.com/haoyuant/tomrade-plugins. */
4
4
  export declare const OFFICIAL_CATALOG_URL = "https://github.com/haoyuant/tomrade-plugins/releases/download/catalog/catalog.json";
5
5
  export declare const isOfficialId: (id: string) => boolean;
6
+ /** A bundle the app carries: the catalog it was built against, in the cache's shape, beside each package named for its digest. */
7
+ export declare const BUNDLE_CATALOG = "catalog.json";
8
+ export declare const bundledPackage: (dir: string, digest: string) => string;
6
9
  export interface CatalogState {
7
10
  /** When the catalog in use was fetched; null when there is none yet. */
8
11
  fetchedAt: number | null;
@@ -14,6 +17,8 @@ export interface OfficialCatalogOptions {
14
17
  url: string;
15
18
  /** Where the last good catalog is kept, so a machine offline still lists what it saw. */
16
19
  cacheFile?: string;
20
+ /** The catalog the app was built against, in the cache's shape: used offline when no newer copy is kept. */
21
+ bundleFile?: string;
17
22
  /** How long a fetched catalog is used before it is fetched again. */
18
23
  freshMs: number;
19
24
  /** Whether this build believes an attestation for a digest. */
@@ -39,11 +44,31 @@ export declare class OfficialCatalog {
39
44
  read(): Promise<Catalog>;
40
45
  private fetch;
41
46
  private save;
42
- private cached;
47
+ private copy;
43
48
  private trusted;
44
49
  /** Plugins with at least one version this build trusts, as store rows. */
45
50
  plugins(): Promise<Record<string, unknown>[]>;
51
+ /** What the app carries, read without the network: the versions of these plugins and the revocations the bundled catalog lists. */
52
+ carried(ids: string[]): {
53
+ versions: VersionRow[];
54
+ revocations: Revocation[];
55
+ } | null;
46
56
  versions(ids: string[]): Promise<VersionRow[]>;
47
57
  revocations(): Promise<Revocation[]>;
48
58
  }
59
+ /**
60
+ * What a build carries for a machine that cannot reach the catalog: the catalog as it stands, and the version of
61
+ * each plugin named that this Tomrade would install, downloaded and checked as an install checks it. Throws when
62
+ * one cannot be had, so a build never goes out without it.
63
+ */
64
+ export declare function bundleOfficialPlugins(opts: {
65
+ url: string;
66
+ ids: string[];
67
+ dir: string;
68
+ verify(raw: unknown, digest: string): Attestation | null;
69
+ }): Promise<{
70
+ id: string;
71
+ version: string;
72
+ digest: string;
73
+ }[]>;
49
74
  //# sourceMappingURL=official.d.ts.map
package/dist/service.d.ts CHANGED
@@ -13,9 +13,13 @@ export declare const CommunityConfig: z.ZodPreprocess<z.ZodObject<{
13
13
  cacheFile: z.ZodOptional<z.ZodString>;
14
14
  freshMs: z.ZodDefault<z.ZodNumber>;
15
15
  }, z.core.$strip>>;
16
+ officialBundle: z.ZodOptional<z.ZodObject<{
17
+ dir: z.ZodString;
18
+ }, z.core.$strip>>;
16
19
  starters: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
17
20
  id: z.ZodString;
18
- whenModelHost: z.ZodArray<z.ZodString>;
21
+ whenModelHost: z.ZodOptional<z.ZodArray<z.ZodString>>;
22
+ replaces: z.ZodOptional<z.ZodString>;
19
23
  }, z.core.$strip>]>>>;
20
24
  startersFile: z.ZodOptional<z.ZodString>;
21
25
  checkEveryMs: z.ZodDefault<z.ZodNumber>;
@@ -180,9 +184,13 @@ export declare class Community extends Service {
180
184
  cacheFile: z.ZodOptional<z.ZodString>;
181
185
  freshMs: z.ZodDefault<z.ZodNumber>;
182
186
  }, z.core.$strip>>;
187
+ officialBundle: z.ZodOptional<z.ZodObject<{
188
+ dir: z.ZodString;
189
+ }, z.core.$strip>>;
183
190
  starters: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
184
191
  id: z.ZodString;
185
- whenModelHost: z.ZodArray<z.ZodString>;
192
+ whenModelHost: z.ZodOptional<z.ZodArray<z.ZodString>>;
193
+ replaces: z.ZodOptional<z.ZodString>;
186
194
  }, z.core.$strip>]>>>;
187
195
  startersFile: z.ZodOptional<z.ZodString>;
188
196
  checkEveryMs: z.ZodDefault<z.ZodNumber>;
@@ -195,6 +203,8 @@ export declare class Community extends Service {
195
203
  private publisherCache;
196
204
  /** Packages fetched to be read before installing, by digest; installing takes them from here. */
197
205
  private downloadDir;
206
+ /** Bundled packages that did not verify: this run gets those builds from the network. */
207
+ private bundleRefused;
198
208
  /** For tests: GitHub access other than through the connected account. */
199
209
  github: GitHubAccess;
200
210
  readonly official: OfficialCatalog;
@@ -229,6 +239,8 @@ export declare class Community extends Service {
229
239
  plugin(id: string): Promise<PluginDetail>;
230
240
  /** Fetched once per digest: reading a version before installing it costs no second download. */
231
241
  private download;
242
+ /** The app's own copy of this exact build, checked as a download is; one that is not that build is passed over for the network. */
243
+ private fromBundle;
232
244
  private pick;
233
245
  /** Reads the exact package that would be installed, here, with the same analyzer the publisher ran. */
234
246
  inspect(id: string, version?: string): Promise<Inspection>;
@@ -254,7 +266,12 @@ export declare class Community extends Service {
254
266
  /** Official plugins not installed whose latest version this Tomrade can install contributes `kind`; none without a plugin store or a readable catalog. */
255
267
  providing(kind: string): Promise<Providing[]>;
256
268
  /** Each starter goes on once; one that cannot be fetched yet is tried again at the next check. */
257
- installStarters(): Promise<void>;
269
+ /** `carried`: only starters that replace a row, from the app's own copies, with no network. */
270
+ installStarters(opts?: {
271
+ carried?: boolean;
272
+ }): Promise<void>;
273
+ /** The newest version of a plugin the app carries that it may install, and where it comes from. */
274
+ private carried;
258
275
  private putStarters;
259
276
  /** Revocations switch a plugin off; updates the rules allow land by themselves. */
260
277
  sweep(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomradex/community",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "author": "Haoyuan Tang",
6
6
  "engines": {
@@ -27,14 +27,14 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@tomradex/github": "0.14.0",
31
- "@tomradex/hub-cloud": "0.14.0",
32
- "@tomradex/ipc": "0.14.0",
33
- "@tomradex/plugin-cli": "0.2.16",
34
- "@tomradex/plugin-kit": "0.14.0",
35
- "@tomradex/plugin-sdk": "0.2.16",
36
- "@tomradex/plugins": "0.14.0",
37
- "@tomradex/settings": "0.14.0",
30
+ "@tomradex/github": "0.15.1",
31
+ "@tomradex/hub-cloud": "0.15.1",
32
+ "@tomradex/ipc": "0.15.1",
33
+ "@tomradex/plugin-cli": "0.2.18",
34
+ "@tomradex/plugin-kit": "0.15.1",
35
+ "@tomradex/plugin-sdk": "0.2.18",
36
+ "@tomradex/plugins": "0.15.1",
37
+ "@tomradex/settings": "0.15.1",
38
38
  "cordis": "4.0.0-rc.8",
39
39
  "zod": "^4.4.3"
40
40
  },