@glassly/cloud-client 0.4.0-beta.1025 → 0.4.0-beta.1052
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 +1 -0
- package/src/modules/core/core.ts +20 -9
- package/src/modules/core/reports.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glassly/cloud-client",
|
|
3
|
-
"version": "0.4.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.1052",
|
|
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-beta.
|
|
15
|
+
"@glassly/cloud-protocol": "0.4.0-beta.1052",
|
|
16
16
|
"tweetnacl": "^1.0.3"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
package/src/index.ts
CHANGED
package/src/modules/core/core.ts
CHANGED
|
@@ -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: {
|
|
@@ -188,6 +196,7 @@ export class Core {
|
|
|
188
196
|
reportId: string,
|
|
189
197
|
source: string,
|
|
190
198
|
entries: ReportLogEntry[],
|
|
199
|
+
options?: { replace?: boolean },
|
|
191
200
|
): Promise<AddReportArtifactsResult>;
|
|
192
201
|
addScreenshots(
|
|
193
202
|
reportId: string,
|
|
@@ -224,16 +233,18 @@ export class Core {
|
|
|
224
233
|
* Always revalidated: older Cores mark it cacheable for five minutes, and the
|
|
225
234
|
* platform HTTP cache (NSURLCache on iOS) would otherwise answer a refresh.
|
|
226
235
|
*/
|
|
227
|
-
list(): Promise<StoreCatalogResponse> {
|
|
228
|
-
return http.get<StoreCatalogResponse>(
|
|
236
|
+
list(opts?: StoreHostOptions): Promise<StoreCatalogResponse> {
|
|
237
|
+
return http.get<StoreCatalogResponse>(`/api/client/store${hostQuery(opts)}`, { headers: NO_CACHE });
|
|
229
238
|
},
|
|
230
|
-
get(packageName: string): Promise<StoreListing> {
|
|
231
|
-
return http.get<StoreListing>(`/api/client/store/${encodeURIComponent(packageName)}`, {
|
|
239
|
+
get(packageName: string, opts?: StoreHostOptions): Promise<StoreListing> {
|
|
240
|
+
return http.get<StoreListing>(`/api/client/store/${encodeURIComponent(packageName)}${hostQuery(opts)}`, {
|
|
241
|
+
headers: NO_CACHE,
|
|
242
|
+
});
|
|
232
243
|
},
|
|
233
244
|
/** Every published release of a listing, newest first, each with its own bundle. */
|
|
234
|
-
releases(packageName: string): Promise<StoreReleasesResponse> {
|
|
245
|
+
releases(packageName: string, opts?: StoreHostOptions): Promise<StoreReleasesResponse> {
|
|
235
246
|
return http.get<StoreReleasesResponse>(
|
|
236
|
-
`/api/client/store/${encodeURIComponent(packageName)}/releases`,
|
|
247
|
+
`/api/client/store/${encodeURIComponent(packageName)}/releases${hostQuery(opts)}`,
|
|
237
248
|
{ headers: NO_CACHE },
|
|
238
249
|
);
|
|
239
250
|
},
|
|
@@ -99,10 +99,12 @@ export class Reports {
|
|
|
99
99
|
return this.http.post<SubmitReportResult>(REPORTS_PATH, input);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/** `replace` swaps out the report's earlier log bundles from `source`. */
|
|
102
103
|
async addLogs(
|
|
103
104
|
reportId: string,
|
|
104
105
|
source: string,
|
|
105
106
|
entries: ReportLogEntry[],
|
|
107
|
+
options: { replace?: boolean } = {},
|
|
106
108
|
): Promise<AddReportArtifactsResult> {
|
|
107
109
|
return await this.http.post<AddReportArtifactsResult>(
|
|
108
110
|
`${REPORTS_PATH}/${encodeURIComponent(reportId)}/artifacts`,
|
|
@@ -110,6 +112,7 @@ export class Reports {
|
|
|
110
112
|
type: "logs",
|
|
111
113
|
source,
|
|
112
114
|
entries,
|
|
115
|
+
...(options.replace ? { replace: true } : {}),
|
|
113
116
|
},
|
|
114
117
|
);
|
|
115
118
|
}
|