@glassly/cloud-client 0.4.0-dev.1039 → 0.4.0-dev.1041

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glassly/cloud-client",
3
- "version": "0.4.0-dev.1039",
3
+ "version": "0.4.0-dev.1041",
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.4.0-dev.1039",
15
+ "@glassly/cloud-protocol": "0.4.0-dev.1041",
16
16
  "tweetnacl": "^1.0.3"
17
17
  },
18
18
  "devDependencies": {
package/src/index.ts CHANGED
@@ -53,6 +53,7 @@ export type {
53
53
  StoreListingScreenshot,
54
54
  StoreRelease,
55
55
  StoreReleasesResponse,
56
+ StoreHostOptions,
56
57
  } from "./modules/core/core";
57
58
 
58
59
  export type {
@@ -118,6 +118,14 @@ export interface StoreRelease {
118
118
  publishedAt: string;
119
119
  }
120
120
 
121
+ export interface StoreHostOptions {
122
+ hostVersion?: string | null;
123
+ }
124
+
125
+ function hostQuery(opts?: StoreHostOptions): string {
126
+ return opts?.hostVersion ? `?hostVersion=${encodeURIComponent(opts.hostVersion)}` : "";
127
+ }
128
+
121
129
  export interface StoreReleasesResponse {
122
130
  packageName: string;
123
131
  /** Newest version first. */
@@ -177,9 +185,9 @@ export class Core {
177
185
  getRegistry(opts?: { environment?: string }): Promise<PreinstalledMiniappRegistry>;
178
186
  };
179
187
  readonly store: {
180
- list(): Promise<StoreCatalogResponse>;
181
- get(packageName: string): Promise<StoreListing>;
182
- releases(packageName: string): Promise<StoreReleasesResponse>;
188
+ list(opts?: StoreHostOptions): Promise<StoreCatalogResponse>;
189
+ get(packageName: string, opts?: StoreHostOptions): Promise<StoreListing>;
190
+ releases(packageName: string, opts?: StoreHostOptions): Promise<StoreReleasesResponse>;
183
191
  fetchAsset(url: string): Promise<Uint8Array>;
184
192
  };
185
193
  readonly reports: {
@@ -224,16 +232,18 @@ export class Core {
224
232
  * Always revalidated: older Cores mark it cacheable for five minutes, and the
225
233
  * platform HTTP cache (NSURLCache on iOS) would otherwise answer a refresh.
226
234
  */
227
- list(): Promise<StoreCatalogResponse> {
228
- return http.get<StoreCatalogResponse>("/api/client/store", { headers: NO_CACHE });
235
+ list(opts?: StoreHostOptions): Promise<StoreCatalogResponse> {
236
+ return http.get<StoreCatalogResponse>(`/api/client/store${hostQuery(opts)}`, { headers: NO_CACHE });
229
237
  },
230
- get(packageName: string): Promise<StoreListing> {
231
- return http.get<StoreListing>(`/api/client/store/${encodeURIComponent(packageName)}`, { headers: NO_CACHE });
238
+ get(packageName: string, opts?: StoreHostOptions): Promise<StoreListing> {
239
+ return http.get<StoreListing>(`/api/client/store/${encodeURIComponent(packageName)}${hostQuery(opts)}`, {
240
+ headers: NO_CACHE,
241
+ });
232
242
  },
233
243
  /** Every published release of a listing, newest first, each with its own bundle. */
234
- releases(packageName: string): Promise<StoreReleasesResponse> {
244
+ releases(packageName: string, opts?: StoreHostOptions): Promise<StoreReleasesResponse> {
235
245
  return http.get<StoreReleasesResponse>(
236
- `/api/client/store/${encodeURIComponent(packageName)}/releases`,
246
+ `/api/client/store/${encodeURIComponent(packageName)}/releases${hostQuery(opts)}`,
237
247
  { headers: NO_CACHE },
238
248
  );
239
249
  },