@hot-updater/standalone 1.0.0-rc.46 → 1.0.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/dist/index.cjs +8 -25
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +8 -25
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -76,7 +76,6 @@ const refusal = (status, value, fallback) => {
|
|
|
76
76
|
return new StandaloneDatabaseError("request-failed", message, status);
|
|
77
77
|
};
|
|
78
78
|
const keysetParams = ({ order, after, limit }) => ({
|
|
79
|
-
v: String(2),
|
|
80
79
|
limit: String(limit),
|
|
81
80
|
...order === void 0 ? {} : { order },
|
|
82
81
|
...after === void 0 ? {} : { cursor: after }
|
|
@@ -99,7 +98,7 @@ const filterParams = (filter) => {
|
|
|
99
98
|
/**
|
|
100
99
|
* Core's API over a self-hosted server's admin handler, protocol 2: the CLI's
|
|
101
100
|
* path to a database it cannot open itself. The first call checks that the
|
|
102
|
-
* server speaks protocol 2, so
|
|
101
|
+
* server speaks protocol 2, so a baseUrl without it fails before any read.
|
|
103
102
|
*/
|
|
104
103
|
const createStandaloneCoreApi = (config) => {
|
|
105
104
|
const http = createStandaloneHttp(config);
|
|
@@ -144,35 +143,25 @@ const createStandaloneCoreApi = (config) => {
|
|
|
144
143
|
return value.data;
|
|
145
144
|
};
|
|
146
145
|
const list = async (path, query) => await call("GET", path, { query }) ?? [];
|
|
147
|
-
const v2 = { v: String(2) };
|
|
148
146
|
const encode = encodeURIComponent;
|
|
149
147
|
return {
|
|
150
148
|
ready: async () => {
|
|
151
|
-
await list("/release-catalogs", {
|
|
152
|
-
...v2,
|
|
153
|
-
limit: "1"
|
|
154
|
-
});
|
|
149
|
+
await list("/release-catalogs", { limit: "1" });
|
|
155
150
|
},
|
|
156
|
-
getBundle: (id) => call("GET", `/bundles/${encode(id)}
|
|
151
|
+
getBundle: (id) => call("GET", `/bundles/${encode(id)}`),
|
|
157
152
|
listBundles: ({ platform, ...input }) => list("/bundles", {
|
|
158
153
|
...keysetParams(input),
|
|
159
154
|
...platform === void 0 ? {} : { platform }
|
|
160
155
|
}),
|
|
161
156
|
countBundles: async (platform) => {
|
|
162
|
-
const total = await call("GET", "/bundles/count", { query: {
|
|
163
|
-
...v2,
|
|
164
|
-
...platform === void 0 ? {} : { platform }
|
|
165
|
-
} });
|
|
157
|
+
const total = await call("GET", "/bundles/count", { query: platform === void 0 ? {} : { platform } });
|
|
166
158
|
if (typeof total !== "number") throw new StandaloneDatabaseError("invalid-response", "The server answered a bundle count without a number.");
|
|
167
159
|
return total;
|
|
168
160
|
},
|
|
169
161
|
countBundleChildren: async (baseBundleIds) => {
|
|
170
162
|
const ids = [...new Set(baseBundleIds)];
|
|
171
163
|
if (ids.length === 0) return {};
|
|
172
|
-
return await call("GET", "/bundles/child-counts", { query: {
|
|
173
|
-
...v2,
|
|
174
|
-
ids: ids.join(",")
|
|
175
|
-
} }) ?? {};
|
|
164
|
+
return await call("GET", "/bundles/child-counts", { query: { ids: ids.join(",") } }) ?? {};
|
|
176
165
|
},
|
|
177
166
|
listPatchesFromBase: (baseBundleId, input) => list(`/bundles/${encode(baseBundleId)}/children`, keysetParams(input)),
|
|
178
167
|
findBaseBundleIds: (candidateKey, bundleId, limit) => list(`/base-candidates/${encode(candidateKey)}`, {
|
|
@@ -186,11 +175,8 @@ const createStandaloneCoreApi = (config) => {
|
|
|
186
175
|
}),
|
|
187
176
|
getReleaseCatalogRow: (scopeKey) => call("GET", `/release-catalogs/${encode(scopeKey)}`),
|
|
188
177
|
listReleaseCatalogs: (input) => list("/release-catalogs", keysetParams(input)),
|
|
189
|
-
listChannels: () => list("/channels",
|
|
190
|
-
findChannelByName: (name) => call("GET", "/channels", { query: {
|
|
191
|
-
...v2,
|
|
192
|
-
name
|
|
193
|
-
} }),
|
|
178
|
+
listChannels: () => list("/channels", {}),
|
|
179
|
+
findChannelByName: (name) => call("GET", "/channels", { query: { name } }),
|
|
194
180
|
deploy: async (deployments) => await call("POST", "/releases", { body: { deployments } }),
|
|
195
181
|
updateReleasePolicy: async ({ releaseId, ...input }) => await call("PATCH", `/releases/${encode(releaseId)}`, { body: input }),
|
|
196
182
|
preflightReleasePolicy: async ({ releaseId, ...input }) => await call("POST", `/releases/${encode(releaseId)}/preflight`, { body: input }),
|
|
@@ -201,10 +187,7 @@ const createStandaloneCoreApi = (config) => {
|
|
|
201
187
|
promoteRelease: async ({ releaseId, ...input }) => await call("POST", `/releases/${encode(releaseId)}/promote`, { body: input }),
|
|
202
188
|
rebuildReleaseCatalog: async (scopeKey) => await call("POST", `/release-catalogs/${encode(scopeKey)}/rebuild`),
|
|
203
189
|
preflightReleaseCatalogRebuild: async (scopeKey) => await call("POST", `/release-catalogs/${encode(scopeKey)}/preflight`),
|
|
204
|
-
ensureChannel: async (name) => await call("POST", "/channels", {
|
|
205
|
-
query: v2,
|
|
206
|
-
body: { name }
|
|
207
|
-
}),
|
|
190
|
+
ensureChannel: async (name) => await call("POST", "/channels", { body: { name } }),
|
|
208
191
|
deleteChannel: async (id) => {
|
|
209
192
|
return await call("DELETE", `/channels/${encode(id)}`).catch((error) => {
|
|
210
193
|
if (error instanceof StandaloneDatabaseError && error.status === 409) return {
|
package/dist/index.d.cts
CHANGED
|
@@ -13,7 +13,7 @@ declare const STANDALONE_ADMIN_PROTOCOL = 2;
|
|
|
13
13
|
/**
|
|
14
14
|
* Core's API over a self-hosted server's admin handler, protocol 2: the CLI's
|
|
15
15
|
* path to a database it cannot open itself. The first call checks that the
|
|
16
|
-
* server speaks protocol 2, so
|
|
16
|
+
* server speaks protocol 2, so a baseUrl without it fails before any read.
|
|
17
17
|
*/
|
|
18
18
|
declare const createStandaloneCoreApi: (config: StandaloneRepositoryConfig) => HotUpdaterCoreApi;
|
|
19
19
|
//#endregion
|
package/dist/index.d.mts
CHANGED
|
@@ -13,7 +13,7 @@ declare const STANDALONE_ADMIN_PROTOCOL = 2;
|
|
|
13
13
|
/**
|
|
14
14
|
* Core's API over a self-hosted server's admin handler, protocol 2: the CLI's
|
|
15
15
|
* path to a database it cannot open itself. The first call checks that the
|
|
16
|
-
* server speaks protocol 2, so
|
|
16
|
+
* server speaks protocol 2, so a baseUrl without it fails before any read.
|
|
17
17
|
*/
|
|
18
18
|
declare const createStandaloneCoreApi: (config: StandaloneRepositoryConfig) => HotUpdaterCoreApi;
|
|
19
19
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -75,7 +75,6 @@ const refusal = (status, value, fallback) => {
|
|
|
75
75
|
return new StandaloneDatabaseError("request-failed", message, status);
|
|
76
76
|
};
|
|
77
77
|
const keysetParams = ({ order, after, limit }) => ({
|
|
78
|
-
v: String(2),
|
|
79
78
|
limit: String(limit),
|
|
80
79
|
...order === void 0 ? {} : { order },
|
|
81
80
|
...after === void 0 ? {} : { cursor: after }
|
|
@@ -98,7 +97,7 @@ const filterParams = (filter) => {
|
|
|
98
97
|
/**
|
|
99
98
|
* Core's API over a self-hosted server's admin handler, protocol 2: the CLI's
|
|
100
99
|
* path to a database it cannot open itself. The first call checks that the
|
|
101
|
-
* server speaks protocol 2, so
|
|
100
|
+
* server speaks protocol 2, so a baseUrl without it fails before any read.
|
|
102
101
|
*/
|
|
103
102
|
const createStandaloneCoreApi = (config) => {
|
|
104
103
|
const http = createStandaloneHttp(config);
|
|
@@ -143,35 +142,25 @@ const createStandaloneCoreApi = (config) => {
|
|
|
143
142
|
return value.data;
|
|
144
143
|
};
|
|
145
144
|
const list = async (path, query) => await call("GET", path, { query }) ?? [];
|
|
146
|
-
const v2 = { v: String(2) };
|
|
147
145
|
const encode = encodeURIComponent;
|
|
148
146
|
return {
|
|
149
147
|
ready: async () => {
|
|
150
|
-
await list("/release-catalogs", {
|
|
151
|
-
...v2,
|
|
152
|
-
limit: "1"
|
|
153
|
-
});
|
|
148
|
+
await list("/release-catalogs", { limit: "1" });
|
|
154
149
|
},
|
|
155
|
-
getBundle: (id) => call("GET", `/bundles/${encode(id)}
|
|
150
|
+
getBundle: (id) => call("GET", `/bundles/${encode(id)}`),
|
|
156
151
|
listBundles: ({ platform, ...input }) => list("/bundles", {
|
|
157
152
|
...keysetParams(input),
|
|
158
153
|
...platform === void 0 ? {} : { platform }
|
|
159
154
|
}),
|
|
160
155
|
countBundles: async (platform) => {
|
|
161
|
-
const total = await call("GET", "/bundles/count", { query: {
|
|
162
|
-
...v2,
|
|
163
|
-
...platform === void 0 ? {} : { platform }
|
|
164
|
-
} });
|
|
156
|
+
const total = await call("GET", "/bundles/count", { query: platform === void 0 ? {} : { platform } });
|
|
165
157
|
if (typeof total !== "number") throw new StandaloneDatabaseError("invalid-response", "The server answered a bundle count without a number.");
|
|
166
158
|
return total;
|
|
167
159
|
},
|
|
168
160
|
countBundleChildren: async (baseBundleIds) => {
|
|
169
161
|
const ids = [...new Set(baseBundleIds)];
|
|
170
162
|
if (ids.length === 0) return {};
|
|
171
|
-
return await call("GET", "/bundles/child-counts", { query: {
|
|
172
|
-
...v2,
|
|
173
|
-
ids: ids.join(",")
|
|
174
|
-
} }) ?? {};
|
|
163
|
+
return await call("GET", "/bundles/child-counts", { query: { ids: ids.join(",") } }) ?? {};
|
|
175
164
|
},
|
|
176
165
|
listPatchesFromBase: (baseBundleId, input) => list(`/bundles/${encode(baseBundleId)}/children`, keysetParams(input)),
|
|
177
166
|
findBaseBundleIds: (candidateKey, bundleId, limit) => list(`/base-candidates/${encode(candidateKey)}`, {
|
|
@@ -185,11 +174,8 @@ const createStandaloneCoreApi = (config) => {
|
|
|
185
174
|
}),
|
|
186
175
|
getReleaseCatalogRow: (scopeKey) => call("GET", `/release-catalogs/${encode(scopeKey)}`),
|
|
187
176
|
listReleaseCatalogs: (input) => list("/release-catalogs", keysetParams(input)),
|
|
188
|
-
listChannels: () => list("/channels",
|
|
189
|
-
findChannelByName: (name) => call("GET", "/channels", { query: {
|
|
190
|
-
...v2,
|
|
191
|
-
name
|
|
192
|
-
} }),
|
|
177
|
+
listChannels: () => list("/channels", {}),
|
|
178
|
+
findChannelByName: (name) => call("GET", "/channels", { query: { name } }),
|
|
193
179
|
deploy: async (deployments) => await call("POST", "/releases", { body: { deployments } }),
|
|
194
180
|
updateReleasePolicy: async ({ releaseId, ...input }) => await call("PATCH", `/releases/${encode(releaseId)}`, { body: input }),
|
|
195
181
|
preflightReleasePolicy: async ({ releaseId, ...input }) => await call("POST", `/releases/${encode(releaseId)}/preflight`, { body: input }),
|
|
@@ -200,10 +186,7 @@ const createStandaloneCoreApi = (config) => {
|
|
|
200
186
|
promoteRelease: async ({ releaseId, ...input }) => await call("POST", `/releases/${encode(releaseId)}/promote`, { body: input }),
|
|
201
187
|
rebuildReleaseCatalog: async (scopeKey) => await call("POST", `/release-catalogs/${encode(scopeKey)}/rebuild`),
|
|
202
188
|
preflightReleaseCatalogRebuild: async (scopeKey) => await call("POST", `/release-catalogs/${encode(scopeKey)}/preflight`),
|
|
203
|
-
ensureChannel: async (name) => await call("POST", "/channels", {
|
|
204
|
-
query: v2,
|
|
205
|
-
body: { name }
|
|
206
|
-
}),
|
|
189
|
+
ensureChannel: async (name) => await call("POST", "/channels", { body: { name } }),
|
|
207
190
|
deleteChannel: async (id) => {
|
|
208
191
|
return await call("DELETE", `/channels/${encode(id)}`).catch((error) => {
|
|
209
192
|
if (error instanceof StandaloneDatabaseError && error.status === 409) return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/standalone",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@hot-updater/
|
|
46
|
-
"@hot-updater/
|
|
45
|
+
"@hot-updater/plugin-core": "1.0.0",
|
|
46
|
+
"@hot-updater/protocol": "1.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"mime": "2.6.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"msw": "^2.7.0",
|
|
53
53
|
"verkit": "0.4.0",
|
|
54
54
|
"vitest": "4.1.4",
|
|
55
|
-
"@hot-updater/test-utils": "1.0.0
|
|
55
|
+
"@hot-updater/test-utils": "1.0.0"
|
|
56
56
|
},
|
|
57
57
|
"nx": {
|
|
58
58
|
"implicitDependencies": [
|