@glassly/cloud-client 0.3.7 → 0.3.8-beta.1013
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/package.json +2 -2
- package/src/index.ts +2 -0
- package/src/modules/core/core.ts +36 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glassly/cloud-client",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8-beta.1013",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"exports": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"test": "bun test"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@glassly/cloud-protocol": "0.3.
|
|
15
|
+
"@glassly/cloud-protocol": "0.3.8-beta.1013",
|
|
16
16
|
"tweetnacl": "^1.0.3"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
package/src/index.ts
CHANGED
package/src/modules/core/core.ts
CHANGED
|
@@ -105,6 +105,25 @@ export interface StoreCatalogResponse {
|
|
|
105
105
|
listings: StoreListing[];
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
/** One published release of a listing (`GET /api/client/store/:packageName/releases`). */
|
|
109
|
+
export interface StoreRelease {
|
|
110
|
+
version: string;
|
|
111
|
+
/** The listing's active release. */
|
|
112
|
+
current: boolean;
|
|
113
|
+
/** Lowest Glassly App version the release runs on; null when its manifest sets none. */
|
|
114
|
+
minHostVersion: string | null;
|
|
115
|
+
sdkVersion: string | null;
|
|
116
|
+
releaseNotes: string | null;
|
|
117
|
+
bundle: { url: string; sha256: string; sizeBytes: number };
|
|
118
|
+
publishedAt: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface StoreReleasesResponse {
|
|
122
|
+
packageName: string;
|
|
123
|
+
/** Newest version first. */
|
|
124
|
+
releases: StoreRelease[];
|
|
125
|
+
}
|
|
126
|
+
|
|
108
127
|
/**
|
|
109
128
|
* `install_once`: installed by default, once. `mandatory`: reinstalled
|
|
110
129
|
* whenever it is missing. Neither updates a miniapp the phone has; the Store
|
|
@@ -144,6 +163,8 @@ export interface CoreDeps {
|
|
|
144
163
|
http: HttpClient;
|
|
145
164
|
}
|
|
146
165
|
|
|
166
|
+
const NO_CACHE = { "Cache-Control": "no-cache" };
|
|
167
|
+
|
|
147
168
|
/**
|
|
148
169
|
* `cloud.core`. Stateless REST grouped by resource.
|
|
149
170
|
*
|
|
@@ -158,6 +179,7 @@ export class Core {
|
|
|
158
179
|
readonly store: {
|
|
159
180
|
list(): Promise<StoreCatalogResponse>;
|
|
160
181
|
get(packageName: string): Promise<StoreListing>;
|
|
182
|
+
releases(packageName: string): Promise<StoreReleasesResponse>;
|
|
161
183
|
fetchAsset(url: string): Promise<Uint8Array>;
|
|
162
184
|
};
|
|
163
185
|
readonly reports: {
|
|
@@ -197,12 +219,23 @@ export class Core {
|
|
|
197
219
|
},
|
|
198
220
|
};
|
|
199
221
|
this.store = {
|
|
200
|
-
/**
|
|
222
|
+
/**
|
|
223
|
+
* The whole catalog. Small enough that search and tag filters stay on the device.
|
|
224
|
+
* Always revalidated: older Cores mark it cacheable for five minutes, and the
|
|
225
|
+
* platform HTTP cache (NSURLCache on iOS) would otherwise answer a refresh.
|
|
226
|
+
*/
|
|
201
227
|
list(): Promise<StoreCatalogResponse> {
|
|
202
|
-
return http.get<StoreCatalogResponse>("/api/client/store");
|
|
228
|
+
return http.get<StoreCatalogResponse>("/api/client/store", { headers: NO_CACHE });
|
|
203
229
|
},
|
|
204
230
|
get(packageName: string): Promise<StoreListing> {
|
|
205
|
-
return http.get<StoreListing>(`/api/client/store/${encodeURIComponent(packageName)}
|
|
231
|
+
return http.get<StoreListing>(`/api/client/store/${encodeURIComponent(packageName)}`, { headers: NO_CACHE });
|
|
232
|
+
},
|
|
233
|
+
/** Every published release of a listing, newest first, each with its own bundle. */
|
|
234
|
+
releases(packageName: string): Promise<StoreReleasesResponse> {
|
|
235
|
+
return http.get<StoreReleasesResponse>(
|
|
236
|
+
`/api/client/store/${encodeURIComponent(packageName)}/releases`,
|
|
237
|
+
{ headers: NO_CACHE },
|
|
238
|
+
);
|
|
206
239
|
},
|
|
207
240
|
/**
|
|
208
241
|
* Icons and screenshots need the user Bearer, which an <Image> cannot
|