@g9tm/app-diagnostic 0.3.1 → 0.5.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/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @g9tm/app-diagnostic
2
+
3
+ The platform-free TypeScript client of G9AppDiagnostic: the wire profile, the resumable tester-report upload, the recording
4
+ state machine, the tester mode's engine (`TesterEngine`: the draft, the captures, the gesture, the send rules, the outbox and
5
+ the report list) and the live channel (`LiveChannel`). No platform code: a host gives it its files, its media and its HTTP.
6
+
7
+ | Host | Package |
8
+ |---|---|
9
+ | A browser, or the web layer of a native shell | [`@g9tm/app-diagnostic-web`](https://www.npmjs.com/package/@g9tm/app-diagnostic-web) |
10
+ | Capacitor | [`@g9tm/app-diagnostic-capacitor`](https://www.npmjs.com/package/@g9tm/app-diagnostic-capacitor) |
11
+ | Tauri v2 | [`@g9tm/app-diagnostic-tauri`](https://www.npmjs.com/package/@g9tm/app-diagnostic-tauri) |
12
+ | Lynx | [`@g9tm/app-diagnostic-lynx`](https://www.npmjs.com/package/@g9tm/app-diagnostic-lynx) |
13
+
14
+ Erasable TypeScript only, shipped as source (`src/index.ts`): a bundler or Node's type stripping (≥ 22.6) reads it.
15
+ `npm test` runs its tests against a stand-in gateway that keeps the contract. MIT.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@g9tm/app-diagnostic",
3
- "version": "0.3.1",
3
+ "version": "0.5.0",
4
4
  "description": "Device diagnostics client for apps in the field: tester reports (resumable upload) to a G9AppDiagnostic gateway. No platform code: the host reads the archive.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -13,8 +13,15 @@
13
13
  },
14
14
  "./package.json": "./package.json"
15
15
  },
16
- "files": ["src"],
17
- "scripts": { "test": "node --test test/*.test.ts" },
16
+ "files": [
17
+ "src",
18
+ "README.md"
19
+ ],
20
+ "scripts": {
21
+ "test": "node --test test/*.test.ts"
22
+ },
18
23
  "license": "MIT",
19
- "engines": { "node": ">=22.6" }
24
+ "engines": {
25
+ "node": ">=22.6"
26
+ }
20
27
  }
@@ -147,6 +147,11 @@ export interface LiveChannelOptions {
147
147
  * `sqliteChangedRowsOnly`. Presence carries them after the package's own, each once.
148
148
  */
149
149
  readonly extraCapabilities?: readonly string[];
150
+ /**
151
+ * Which of the gateway's apps this is (its WebDiagnostic:Apps id), sent in every presence. Absent = the gateway decides
152
+ * by the host the app connects to, else its first app (one gateway serving one app needs nothing).
153
+ */
154
+ readonly appId?: string;
150
155
  readonly log?: DiagnosticLog;
151
156
  readonly onError?: (where: string, error: unknown) => void;
152
157
  readonly now?: () => number;
@@ -485,6 +490,7 @@ export class LiveChannel {
485
490
  capabilities: [...new Set([...CURRENT_CAPABILITIES, ...(this.options.extraCapabilities ?? [])])],
486
491
  ...(this.options.branch ? { buildBranch: this.options.branch } : {}),
487
492
  ...(this.options.commit ? { buildCommit: this.options.commit } : {}),
493
+ ...(!rest.appId && this.options.appId ? { appId: this.options.appId } : {}),
488
494
  lastSeenUtc: new Date(this.now()).toISOString(),
489
495
  foregroundConsented: this.hasConsent(),
490
496
  };
@@ -23,6 +23,8 @@ export interface PresencePayload {
23
23
  platform: string;
24
24
  platformVersion: string;
25
25
  appVersion: string;
26
+ /** Which of the gateway's apps this is (optional; the gateway settles it and echoes the id it chose). */
27
+ appId?: string;
26
28
  /** The branch and commit the app was built from (an older app sends none). */
27
29
  buildBranch?: string | null;
28
30
  buildCommit?: string | null;