@hot-updater/plugin-core 1.1.3 → 1.2.0-rc.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,6 +1,6 @@
1
- import { BundlePatchRow, BundleRow, ChannelRow, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.cjs";
2
- import { ChannelDeleteResult } from "./types/models.cjs";
3
- import { Bundle } from "./types/index.cjs";
1
+ import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, NativeBuildArtifactKind, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.cjs";
2
+ import { ChannelDeleteResult, NativeBuildDeleteResult } from "./types/models.cjs";
3
+ import { Bundle, Platform } from "./types/index.cjs";
4
4
  import { ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult } from "./releaseCatalogMutation.cjs";
5
5
  import { PromoteReleaseResult, ReleasePolicyPatch } from "./releaseManagement.cjs";
6
6
  //#region src/coreApi.d.ts
@@ -55,6 +55,55 @@ interface StoredBundleDeployment {
55
55
  readonly release: DeployReleasePolicy;
56
56
  }
57
57
  type Deployment = BundleDeployment | StoredBundleDeployment;
58
+ /**
59
+ * A native build's scope: its platform, the default channel it compiled in,
60
+ * and whichever of the fingerprint and the app version the update strategy
61
+ * selects by.
62
+ */
63
+ type NativeBuildScope = {
64
+ readonly platform: Platform;
65
+ readonly channel: string;
66
+ } & ({
67
+ readonly fingerprintHash: string;
68
+ readonly appVersion: null;
69
+ } | {
70
+ readonly fingerprintHash: null;
71
+ readonly appVersion: string;
72
+ });
73
+ /** A native build to register: its stored artifact and its built-in bundle. */
74
+ type NativeBuildRegistration = NativeBuildScope & {
75
+ /** A UUIDv7, which also names the artifact's storage directory. */
76
+ readonly id: string;
77
+ /** The MIN_BUNDLE_ID the build compiled in: the built-in bundle's ID. */
78
+ readonly minBundleId: string;
79
+ readonly gitCommitHash: string | null;
80
+ /**
81
+ * The native build key of every input the artifact was built from:
82
+ * `nbk1:` and a SHA-256. A build with the same key reuses this one. Null
83
+ * for a build whose inputs no key covers, which is never reused.
84
+ */
85
+ readonly buildKey: string | null;
86
+ /**
87
+ * The build number the artifact reports, its `CFBundleVersion` or
88
+ * `versionCode`, or null (or left out) when it can't be read.
89
+ */
90
+ readonly buildNumber?: string | null;
91
+ readonly artifact: {
92
+ readonly kind: NativeBuildArtifactKind;
93
+ readonly storageUri: string;
94
+ readonly byteSize: number;
95
+ };
96
+ /**
97
+ * The built-in bundle as deploy stores a bundle, with a manifest that
98
+ * lists only its JavaScript bundle file, taken from the artifact.
99
+ */
100
+ readonly embeddedBundle: {
101
+ readonly manifestStorageUri: string;
102
+ readonly manifestFileHash: string;
103
+ readonly assetBaseStorageUri: string;
104
+ readonly metadata?: DatabaseBundleMetadata;
105
+ };
106
+ };
58
107
  interface ReleaseTarget {
59
108
  readonly releaseId: string;
60
109
  /** Refuses the change when the release is at another revision. */
@@ -94,6 +143,23 @@ interface HotUpdaterCoreApi {
94
143
  listReleaseCatalogs(input: KeysetInput): Promise<ReleaseCatalogRow[]>;
95
144
  listChannels(): Promise<ChannelRow[]>;
96
145
  findChannelByName(name: string): Promise<ChannelRow | null>;
146
+ /** A native build by ID: one read of its key. */
147
+ getNativeBuild(id: string): Promise<NativeBuildRow | null>;
148
+ /**
149
+ * The newest native build of a scope: one read of its index. With
150
+ * `buildKey`, the newest of the scope registered with that native build
151
+ * key, also one read.
152
+ */
153
+ findNativeBuild(scope: NativeBuildScope, options?: {
154
+ readonly buildKey?: string;
155
+ }): Promise<NativeBuildRow | null>;
156
+ /**
157
+ * One page of native builds, by ID: oldest or newest first. With
158
+ * `channelId`, only the builds that embed that channel, also one read.
159
+ */
160
+ listNativeBuilds(input: KeysetInput & {
161
+ readonly channelId?: string;
162
+ }): Promise<NativeBuildRow[]>;
97
163
  /**
98
164
  * Writes each new bundle with its patches, and each release, with the next
99
165
  * catalog of each scope, in one transaction. A stored bundle's deployment
@@ -124,8 +190,33 @@ interface HotUpdaterCoreApi {
124
190
  updateBundle(id: string, update: Partial<Omit<Bundle, "id" | "patches">> & {
125
191
  readonly patches?: Bundle["patches"];
126
192
  }): Promise<void>;
127
- /** Deletes bundles with their patches; a bundle a release uses refuses. */
193
+ /**
194
+ * Deletes bundles with their patches; a bundle a release uses, or a native
195
+ * build's built-in bundle, refuses.
196
+ */
128
197
  deleteBundles(ids: readonly string[]): Promise<void>;
198
+ /**
199
+ * Writes a native build and its built-in bundle's row in one transaction.
200
+ * That row is no OTA bundle: no release publishes it, and the bundle
201
+ * totals leave it out.
202
+ */
203
+ registerNativeBuild(registration: NativeBuildRegistration): Promise<NativeBuildRow>;
204
+ /**
205
+ * Records that a store took a native build: the track and the store's
206
+ * label of the build, with the time of the record. One read and one write;
207
+ * the CLI calls it after the store accepted the upload, or found the build
208
+ * already there. Null for an unknown ID.
209
+ */
210
+ recordNativeBuildSubmission(id: string, submission: {
211
+ readonly destination: NativeBuildSubmissionDestination;
212
+ readonly version: string;
213
+ }): Promise<NativeBuildRow | null>;
214
+ /**
215
+ * Deletes a native build and its built-in bundle's row in one transaction,
216
+ * with the patches from that bundle: an installed build then downloads
217
+ * full bundles. Its artifact stays in storage for the caller to delete.
218
+ */
219
+ deleteNativeBuild(id: string): Promise<NativeBuildDeleteResult>;
129
220
  }
130
221
  //#endregion
131
- export { BundleDeployment, BundleDetail, DeployReleasePolicy, Deployment, HotUpdaterCoreApi, KeysetInput, ReleaseFilter, ReleaseTarget, StoredBundleDeployment };
222
+ export { BundleDeployment, BundleDetail, DeployReleasePolicy, Deployment, HotUpdaterCoreApi, KeysetInput, NativeBuildRegistration, NativeBuildScope, ReleaseFilter, ReleaseTarget, StoredBundleDeployment };
@@ -1,6 +1,6 @@
1
- import { BundlePatchRow, BundleRow, ChannelRow, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.mjs";
2
- import { ChannelDeleteResult } from "./types/models.mjs";
3
- import { Bundle } from "./types/index.mjs";
1
+ import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, NativeBuildArtifactKind, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.mjs";
2
+ import { ChannelDeleteResult, NativeBuildDeleteResult } from "./types/models.mjs";
3
+ import { Bundle, Platform } from "./types/index.mjs";
4
4
  import { ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult } from "./releaseCatalogMutation.mjs";
5
5
  import { PromoteReleaseResult, ReleasePolicyPatch } from "./releaseManagement.mjs";
6
6
  //#region src/coreApi.d.ts
@@ -55,6 +55,55 @@ interface StoredBundleDeployment {
55
55
  readonly release: DeployReleasePolicy;
56
56
  }
57
57
  type Deployment = BundleDeployment | StoredBundleDeployment;
58
+ /**
59
+ * A native build's scope: its platform, the default channel it compiled in,
60
+ * and whichever of the fingerprint and the app version the update strategy
61
+ * selects by.
62
+ */
63
+ type NativeBuildScope = {
64
+ readonly platform: Platform;
65
+ readonly channel: string;
66
+ } & ({
67
+ readonly fingerprintHash: string;
68
+ readonly appVersion: null;
69
+ } | {
70
+ readonly fingerprintHash: null;
71
+ readonly appVersion: string;
72
+ });
73
+ /** A native build to register: its stored artifact and its built-in bundle. */
74
+ type NativeBuildRegistration = NativeBuildScope & {
75
+ /** A UUIDv7, which also names the artifact's storage directory. */
76
+ readonly id: string;
77
+ /** The MIN_BUNDLE_ID the build compiled in: the built-in bundle's ID. */
78
+ readonly minBundleId: string;
79
+ readonly gitCommitHash: string | null;
80
+ /**
81
+ * The native build key of every input the artifact was built from:
82
+ * `nbk1:` and a SHA-256. A build with the same key reuses this one. Null
83
+ * for a build whose inputs no key covers, which is never reused.
84
+ */
85
+ readonly buildKey: string | null;
86
+ /**
87
+ * The build number the artifact reports, its `CFBundleVersion` or
88
+ * `versionCode`, or null (or left out) when it can't be read.
89
+ */
90
+ readonly buildNumber?: string | null;
91
+ readonly artifact: {
92
+ readonly kind: NativeBuildArtifactKind;
93
+ readonly storageUri: string;
94
+ readonly byteSize: number;
95
+ };
96
+ /**
97
+ * The built-in bundle as deploy stores a bundle, with a manifest that
98
+ * lists only its JavaScript bundle file, taken from the artifact.
99
+ */
100
+ readonly embeddedBundle: {
101
+ readonly manifestStorageUri: string;
102
+ readonly manifestFileHash: string;
103
+ readonly assetBaseStorageUri: string;
104
+ readonly metadata?: DatabaseBundleMetadata;
105
+ };
106
+ };
58
107
  interface ReleaseTarget {
59
108
  readonly releaseId: string;
60
109
  /** Refuses the change when the release is at another revision. */
@@ -94,6 +143,23 @@ interface HotUpdaterCoreApi {
94
143
  listReleaseCatalogs(input: KeysetInput): Promise<ReleaseCatalogRow[]>;
95
144
  listChannels(): Promise<ChannelRow[]>;
96
145
  findChannelByName(name: string): Promise<ChannelRow | null>;
146
+ /** A native build by ID: one read of its key. */
147
+ getNativeBuild(id: string): Promise<NativeBuildRow | null>;
148
+ /**
149
+ * The newest native build of a scope: one read of its index. With
150
+ * `buildKey`, the newest of the scope registered with that native build
151
+ * key, also one read.
152
+ */
153
+ findNativeBuild(scope: NativeBuildScope, options?: {
154
+ readonly buildKey?: string;
155
+ }): Promise<NativeBuildRow | null>;
156
+ /**
157
+ * One page of native builds, by ID: oldest or newest first. With
158
+ * `channelId`, only the builds that embed that channel, also one read.
159
+ */
160
+ listNativeBuilds(input: KeysetInput & {
161
+ readonly channelId?: string;
162
+ }): Promise<NativeBuildRow[]>;
97
163
  /**
98
164
  * Writes each new bundle with its patches, and each release, with the next
99
165
  * catalog of each scope, in one transaction. A stored bundle's deployment
@@ -124,8 +190,33 @@ interface HotUpdaterCoreApi {
124
190
  updateBundle(id: string, update: Partial<Omit<Bundle, "id" | "patches">> & {
125
191
  readonly patches?: Bundle["patches"];
126
192
  }): Promise<void>;
127
- /** Deletes bundles with their patches; a bundle a release uses refuses. */
193
+ /**
194
+ * Deletes bundles with their patches; a bundle a release uses, or a native
195
+ * build's built-in bundle, refuses.
196
+ */
128
197
  deleteBundles(ids: readonly string[]): Promise<void>;
198
+ /**
199
+ * Writes a native build and its built-in bundle's row in one transaction.
200
+ * That row is no OTA bundle: no release publishes it, and the bundle
201
+ * totals leave it out.
202
+ */
203
+ registerNativeBuild(registration: NativeBuildRegistration): Promise<NativeBuildRow>;
204
+ /**
205
+ * Records that a store took a native build: the track and the store's
206
+ * label of the build, with the time of the record. One read and one write;
207
+ * the CLI calls it after the store accepted the upload, or found the build
208
+ * already there. Null for an unknown ID.
209
+ */
210
+ recordNativeBuildSubmission(id: string, submission: {
211
+ readonly destination: NativeBuildSubmissionDestination;
212
+ readonly version: string;
213
+ }): Promise<NativeBuildRow | null>;
214
+ /**
215
+ * Deletes a native build and its built-in bundle's row in one transaction,
216
+ * with the patches from that bundle: an installed build then downloads
217
+ * full bundles. Its artifact stays in storage for the caller to delete.
218
+ */
219
+ deleteNativeBuild(id: string): Promise<NativeBuildDeleteResult>;
129
220
  }
130
221
  //#endregion
131
- export { BundleDeployment, BundleDetail, DeployReleasePolicy, Deployment, HotUpdaterCoreApi, KeysetInput, ReleaseFilter, ReleaseTarget, StoredBundleDeployment };
222
+ export { BundleDeployment, BundleDetail, DeployReleasePolicy, Deployment, HotUpdaterCoreApi, KeysetInput, NativeBuildRegistration, NativeBuildScope, ReleaseFilter, ReleaseTarget, StoredBundleDeployment };