@mentra/cloud-client 3.3.0-dev.878 → 3.3.0-dev.879
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 +0 -6
- package/src/modules/core/core.ts +6 -127
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mentra/cloud-client",
|
|
3
|
-
"version": "3.3.0-dev.
|
|
3
|
+
"version": "3.3.0-dev.879",
|
|
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
|
-
"@mentra/cloud-protocol": "3.3.0-dev.
|
|
15
|
+
"@mentra/cloud-protocol": "3.3.0-dev.879",
|
|
16
16
|
"tweetnacl": "^1.0.3"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -49,12 +49,6 @@ export { noopLogger } from "./logger";
|
|
|
49
49
|
export type { Logger } from "./logger";
|
|
50
50
|
|
|
51
51
|
// Runtime lifecycle state exposed to hosts for UI/debugging and fallback policy.
|
|
52
|
-
export type {
|
|
53
|
-
PreinstalledInstallPolicy,
|
|
54
|
-
PreinstalledMiniappRegistry,
|
|
55
|
-
PreinstalledMiniappRegistryEntry,
|
|
56
|
-
} from "./modules/core/core";
|
|
57
|
-
|
|
58
52
|
export type {
|
|
59
53
|
RuntimeAudioTransport,
|
|
60
54
|
RuntimeSnapshot,
|
package/src/modules/core/core.ts
CHANGED
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* helper, which attaches the access token from `cloud.auth` as the Bearer, so
|
|
7
7
|
* core never touches credentials itself.
|
|
8
8
|
*
|
|
9
|
-
* Today it exposes the
|
|
10
|
-
*
|
|
11
|
-
* other core resources are specced.
|
|
9
|
+
* Today it exposes the unified report submission surface and the support
|
|
10
|
+
* profile update.
|
|
12
11
|
*
|
|
13
12
|
* Guardrail: this is device-facing only. It deliberately carries none of the
|
|
14
13
|
* Dev Console / OEM Portal / store web UI surface; those are separate clients.
|
|
@@ -60,97 +59,19 @@ export type {
|
|
|
60
59
|
SupportStateInput,
|
|
61
60
|
} from "./support-profile";
|
|
62
61
|
|
|
63
|
-
/**
|
|
64
|
-
* A single miniapp entry as returned by the listing.
|
|
65
|
-
*
|
|
66
|
-
* These shapes are owned by miniapp-service, which is not finalized yet, so they
|
|
67
|
-
* are defined here against the spec rather than imported. They are intentionally
|
|
68
|
-
* NOT taken from `@mentra/cloud-protocol`: that package is the live
|
|
69
|
-
* session wire contract (subscriptions, transcripts, the message unions), while
|
|
70
|
-
* a miniapp listing is a core REST resource with no place on the runtime wire.
|
|
71
|
-
* When miniapp-service locks its schema, move these to the shared package and
|
|
72
|
-
* import them here instead.
|
|
73
|
-
*/
|
|
74
|
-
export interface MiniappListing {
|
|
75
|
-
/** The reverse-DNS identifier, for example "com.example.notes". */
|
|
76
|
-
packageName: string;
|
|
77
|
-
/** Human-readable name shown to the user. */
|
|
78
|
-
name: string;
|
|
79
|
-
/** The version offered to this user (the latest the user is entitled to). */
|
|
80
|
-
version: string;
|
|
81
|
-
/** Optional one-line summary for a launcher list. */
|
|
82
|
-
description?: string;
|
|
83
|
-
/** Optional icon URL for a launcher list. */
|
|
84
|
-
iconUrl?: string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* The manifest that ships inside a miniapp bundle.
|
|
89
|
-
*
|
|
90
|
-
* Same ownership note as `MiniappListing`: this is a miniapp-service shape,
|
|
91
|
-
* defined here against the spec until that schema is locked. The fields below
|
|
92
|
-
* are the minimum the device needs to identify and describe a fetched bundle;
|
|
93
|
-
* miniapp-service is expected to add permission and capability declarations.
|
|
94
|
-
*/
|
|
95
|
-
export interface MiniappManifest {
|
|
96
|
-
packageName: string;
|
|
97
|
-
name: string;
|
|
98
|
-
version: string;
|
|
99
|
-
/** Optional permissions the miniapp declares it needs. */
|
|
100
|
-
permissions?: string[];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** What `getBundle` resolves to: where to download the bundle, plus its manifest. */
|
|
104
|
-
export interface MiniappBundle {
|
|
105
|
-
/** A (typically signed, short-lived) URL the device downloads the bundle from. */
|
|
106
|
-
downloadUrl: string;
|
|
107
|
-
/** The concrete version resolved, important when the caller omitted `version`. */
|
|
108
|
-
version: string;
|
|
109
|
-
manifest: MiniappManifest;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export type PreinstalledInstallPolicy =
|
|
113
|
-
| "install_once"
|
|
114
|
-
| "keep_updated"
|
|
115
|
-
| "mandatory";
|
|
116
|
-
|
|
117
|
-
export interface PreinstalledMiniappRegistryEntry {
|
|
118
|
-
packageName: string;
|
|
119
|
-
version: string;
|
|
120
|
-
bundleUrl: string;
|
|
121
|
-
bundleSha256: string;
|
|
122
|
-
required: boolean;
|
|
123
|
-
installPolicy: PreinstalledInstallPolicy;
|
|
124
|
-
channel: string;
|
|
125
|
-
minMobileVersion?: string;
|
|
126
|
-
maxMobileVersion?: string;
|
|
127
|
-
tenantId?: string;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface PreinstalledMiniappRegistry {
|
|
131
|
-
generatedAt: string;
|
|
132
|
-
entries: PreinstalledMiniappRegistryEntry[];
|
|
133
|
-
}
|
|
134
|
-
|
|
135
62
|
/** The dependencies `cloud.core` is wired with. */
|
|
136
63
|
export interface CoreDeps {
|
|
137
64
|
http: HttpClient;
|
|
138
65
|
}
|
|
139
66
|
|
|
140
67
|
/**
|
|
141
|
-
* `cloud.core`. Stateless REST grouped by resource
|
|
68
|
+
* `cloud.core`. Stateless REST grouped by resource.
|
|
142
69
|
*
|
|
143
|
-
*
|
|
144
|
-
* `cloud.core.
|
|
145
|
-
*
|
|
146
|
-
* working.
|
|
70
|
+
* Each group is exposed as a plain object so callers write
|
|
71
|
+
* `cloud.core.reports.submit()`. Methods are bound in the constructor so
|
|
72
|
+
* destructuring a group keeps working.
|
|
147
73
|
*/
|
|
148
74
|
export class Core {
|
|
149
|
-
readonly miniapps: {
|
|
150
|
-
list(): Promise<MiniappListing[]>;
|
|
151
|
-
getBundle(packageName: string, version?: string): Promise<MiniappBundle>;
|
|
152
|
-
getRegistry(opts?: { environment?: string }): Promise<PreinstalledMiniappRegistry>;
|
|
153
|
-
};
|
|
154
75
|
readonly reports: {
|
|
155
76
|
getLogCollection(reportId: string, signal?: AbortSignal): Promise<ReportLogCollectionSnapshot>;
|
|
156
77
|
submit(input: SubmitReportInput): Promise<SubmitReportResult>;
|
|
@@ -185,48 +106,6 @@ export class Core {
|
|
|
185
106
|
const reports = new Reports({ http });
|
|
186
107
|
const supportProfiles = new SupportProfiles(http);
|
|
187
108
|
|
|
188
|
-
this.miniapps = {
|
|
189
|
-
/**
|
|
190
|
-
* List the miniapps available to the authenticated user.
|
|
191
|
-
*
|
|
192
|
-
* A GET so it is naturally safe to retry on a transient network error,
|
|
193
|
-
* which the shared HTTP helper does for us.
|
|
194
|
-
*/
|
|
195
|
-
list(): Promise<MiniappListing[]> {
|
|
196
|
-
return http.get<MiniappListing[]>("/api/client/miniapps");
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Fetch the downloadable bundle for one miniapp.
|
|
201
|
-
*
|
|
202
|
-
* When `version` is omitted the cloud resolves the version the user is
|
|
203
|
-
* entitled to (usually the latest); the resolved value comes back in the
|
|
204
|
-
* response so the caller can record exactly what it got. The version is
|
|
205
|
-
* passed as a query parameter and URL-encoded so an unusual version string
|
|
206
|
-
* cannot break the path.
|
|
207
|
-
*/
|
|
208
|
-
getBundle(packageName: string, version?: string): Promise<MiniappBundle> {
|
|
209
|
-
const base = `/api/client/miniapps/${encodeURIComponent(packageName)}/bundle`;
|
|
210
|
-
const path =
|
|
211
|
-
version === undefined
|
|
212
|
-
? base
|
|
213
|
-
: `${base}?version=${encodeURIComponent(version)}`;
|
|
214
|
-
return http.get<MiniappBundle>(path);
|
|
215
|
-
},
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Fetch the admin-managed preinstalled miniapp registry for this device.
|
|
219
|
-
*
|
|
220
|
-
* The mobile client owns reconciliation: Core only returns the desired
|
|
221
|
-
* bundle versions and install policy for the current user/OEM/channel.
|
|
222
|
-
*/
|
|
223
|
-
getRegistry(opts?: { environment?: string }): Promise<PreinstalledMiniappRegistry> {
|
|
224
|
-
const query = opts?.environment
|
|
225
|
-
? `?environment=${encodeURIComponent(opts.environment)}`
|
|
226
|
-
: "";
|
|
227
|
-
return http.get<PreinstalledMiniappRegistry>(`/api/client/miniapps/registry${query}`);
|
|
228
|
-
},
|
|
229
|
-
};
|
|
230
109
|
this.reports = {
|
|
231
110
|
submit: reports.submit.bind(reports),
|
|
232
111
|
getLogCollection: reports.getLogCollection.bind(reports),
|