@lavitre/apps 1.53.0 → 1.55.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.
@@ -0,0 +1,140 @@
1
+ import type { PublicFile, PublicStorageListResult, PublicStorageScope } from './Common.Model.js';
2
+ /**
3
+ * Error codes for the public storage API (`Connector.publicStorage` /
4
+ * `Frame.publicStorage`).
5
+ *
6
+ * The six wire codes — `tooLarge`, `unsupportedType`, `invalidPath`,
7
+ * `storageNotConfigured`, `unavailable`, `failed` — come straight from the
8
+ * host's `publicStorageResponse.error`. `unsupported` and `invalidExpiry`
9
+ * are synthesized locally by the SDK, never sent by the host:
10
+ * - `unsupported` fires when no response arrives within the request's
11
+ * timeout (see {@link PUBLIC_STORAGE_TIMEOUT_MS} /
12
+ * {@link PUBLIC_STORAGE_PUT_TIMEOUT_MS}) — the signature of a vitre host
13
+ * that predates this feature, which silently ignores the unknown
14
+ * `putPublicFile` / `deletePublicFile` / `listPublicFiles` message types
15
+ * instead of answering.
16
+ * - `invalidExpiry` fires when `put`'s `options.expiresIn` isn't a positive
17
+ * safe integer — see {@link validateExpiresIn}. Rejected before any
18
+ * request is sent.
19
+ */
20
+ export type PublicStorageErrorCode = 'tooLarge' | 'unsupportedType' | 'invalidPath' | 'storageNotConfigured' | 'unavailable' | 'failed' | 'unsupported' | 'invalidExpiry';
21
+ /**
22
+ * Thrown by `publicStorage.put` / `.delete` / `.list` when the host answers
23
+ * with `ok: false`, when the request times out, or (for `put`) locally when
24
+ * the payload exceeds {@link MAX_PUBLIC_FILE_SIZE_BYTES} — see
25
+ * {@link PublicStorageErrorCode}.
26
+ */
27
+ export declare class PublicStorageError extends Error {
28
+ readonly code: PublicStorageErrorCode;
29
+ constructor(code: PublicStorageErrorCode);
30
+ }
31
+ /**
32
+ * How long `publicStorage.delete` / `.list` wait for `publicStorageResponse`
33
+ * before treating the host as not supporting the public storage API. Passed
34
+ * as `Connector`/`Frame`'s private `postRequest(..., timeout)` 4th argument,
35
+ * which removes the pending resolver when the timer fires (same fix as
36
+ * {@link APP_SETTINGS_TIMEOUT_MS} — see its doc comment).
37
+ */
38
+ export declare const PUBLIC_STORAGE_TIMEOUT_MS = 10000;
39
+ /**
40
+ * `publicStorage.put` waits longer than {@link PUBLIC_STORAGE_TIMEOUT_MS} —
41
+ * the host has to receive and store the upload before it can answer.
42
+ */
43
+ export declare const PUBLIC_STORAGE_PUT_TIMEOUT_MS = 120000;
44
+ /**
45
+ * Per-file size cap enforced client-side, before the request is even sent —
46
+ * matches the host's own `tooLarge` limit. See the README "Public storage"
47
+ * section for the full semantics (scopes, allowed types, path rules).
48
+ */
49
+ export declare const MAX_PUBLIC_FILE_SIZE_BYTES: number;
50
+ /**
51
+ * Lower bound for `put`'s `options.expiresIn` (seconds) — there is no upper
52
+ * bound beyond what fits in a safe integer, see {@link validateExpiresIn}.
53
+ */
54
+ export declare const MIN_PUBLIC_FILE_EXPIRES_IN_SECONDS = 1;
55
+ /**
56
+ * Validates `PublicStorageApi.put`'s optional `options.expiresIn` (seconds)
57
+ * before any request is sent. `undefined` is always valid — expiry is
58
+ * opt-in; omitting it keeps the file permanent. When set, it must be a
59
+ * positive safe integer (`Number.isSafeInteger`, `>= 1`) — no upper bound.
60
+ * Throws `PublicStorageError('invalidExpiry')` otherwise (e.g. `0`,
61
+ * negative, non-integer, `NaN`, `Infinity`, or above
62
+ * `Number.MAX_SAFE_INTEGER`).
63
+ */
64
+ export declare function validateExpiresIn(expiresIn: number | undefined): void;
65
+ /**
66
+ * Builds the `expiresIn` part of the `putPublicFile` wire message from
67
+ * `options.expiresIn`: an empty object when unset, so `expiresIn` is a
68
+ * genuinely absent key on the message for a `put` that didn't opt in —
69
+ * not a key present with value `undefined`. Spread into the message
70
+ * object, e.g. `{ type: 'putPublicFile', ..., ...putPublicFileExpiryField(options?.expiresIn) }`.
71
+ * Call {@link validateExpiresIn} first — this does no validation of its own.
72
+ */
73
+ export declare function putPublicFileExpiryField(expiresIn: number | undefined): {
74
+ expiresIn: number;
75
+ } | Record<string, never>;
76
+ /**
77
+ * Fills `downloadUrl` from `url` (`?download=1`) when the host didn't send
78
+ * one — the signature of a vitre host that predates this field. Applied to
79
+ * `put`'s resolved `PublicFile` and to every `list` entry, so apps can
80
+ * always rely on `file.downloadUrl` regardless of host version. A
81
+ * `downloadUrl` already set by the host (e.g. carrying its own query
82
+ * params) is kept as-is.
83
+ */
84
+ export declare function withDownloadUrlFallback<T extends {
85
+ url: string;
86
+ downloadUrl?: string;
87
+ }>(file: T): T;
88
+ /**
89
+ * Options for `PublicStorageApi.put`.
90
+ */
91
+ export type PublicStoragePutOptions = {
92
+ /**
93
+ * Opt-in expiry, in seconds, as a positive safe integer — no upper bound.
94
+ * The link answers 404 once expired and the server deletes the file.
95
+ * Omit for a permanent file (the default) — rewriting the same `path`
96
+ * later without `expiresIn` makes it permanent again. Validated locally
97
+ * with {@link validateExpiresIn}; an invalid value rejects with
98
+ * `PublicStorageError('invalidExpiry')` before any request is sent.
99
+ */
100
+ expiresIn?: number;
101
+ };
102
+ /**
103
+ * Public, unauthenticated file storage an app can write to, scoped to the
104
+ * vitre's TEAM — see the README "Public storage" section for the full
105
+ * semantics. Files are readable by ANYONE without authentication at the
106
+ * returned `url` (a stable link under `https://a.lavit.re/`) — never put
107
+ * private data here.
108
+ *
109
+ * Exposed as `connector.publicStorage` / `frame.publicStorage`. Only a
110
+ * Vitre-hosted `Connector` / `Frame` has it — a companion connector cannot
111
+ * write to public storage.
112
+ */
113
+ export type PublicStorageApi = {
114
+ /**
115
+ * Upload (or overwrite) a file at `path` within `scope` (`'app'` by
116
+ * default — this app's own space; `'shared'` is a space every app of the
117
+ * team shares). `data` may be an `ArrayBuffer`, `Blob`, or `Uint8Array`; it
118
+ * is normalized to an `ArrayBuffer` and transferred to the host zero-copy
119
+ * — don't reuse the buffer you pass after calling `put` (it is detached,
120
+ * same as any other `Transferable` handed to `postMessage`). Rejects
121
+ * locally with `PublicStorageError('tooLarge')`, without a round-trip, if
122
+ * the payload exceeds {@link MAX_PUBLIC_FILE_SIZE_BYTES}. Overwriting an
123
+ * existing path replaces the file; readers revalidate.
124
+ *
125
+ * `options.expiresIn` opts the file into automatic deletion — see
126
+ * {@link PublicStoragePutOptions}. Invalid values reject locally with
127
+ * `PublicStorageError('invalidExpiry')`, without a round-trip.
128
+ */
129
+ put(path: string, data: ArrayBuffer | Blob | Uint8Array, contentType: string, scope?: PublicStorageScope, options?: PublicStoragePutOptions): Promise<PublicFile>;
130
+ /**
131
+ * Delete the file at `path` within `scope` (`'app'` by default). Resolves
132
+ * even if the path didn't exist.
133
+ */
134
+ delete(path: string, scope?: PublicStorageScope): Promise<void>;
135
+ /**
136
+ * List files within `scope` (`'app'` by default), optionally filtered to
137
+ * those whose path starts with `prefix`.
138
+ */
139
+ list(prefix?: string, scope?: PublicStorageScope): Promise<PublicStorageListResult>;
140
+ };
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Thrown by `publicStorage.put` / `.delete` / `.list` when the host answers
3
+ * with `ok: false`, when the request times out, or (for `put`) locally when
4
+ * the payload exceeds {@link MAX_PUBLIC_FILE_SIZE_BYTES} — see
5
+ * {@link PublicStorageErrorCode}.
6
+ */
7
+ export class PublicStorageError extends Error {
8
+ constructor(code) {
9
+ super(`Public storage request failed: ${code}`);
10
+ // Not a TS constructor parameter property — those aren't erasable syntax,
11
+ // so Node's type-stripping test runner (`pnpm test`, no transpile step)
12
+ // fails to load this module. Plain field + explicit assignment instead;
13
+ // identical runtime shape (still a public readonly `code`).
14
+ Object.defineProperty(this, "code", {
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true,
18
+ value: void 0
19
+ });
20
+ this.name = 'PublicStorageError';
21
+ this.code = code;
22
+ }
23
+ }
24
+ /**
25
+ * How long `publicStorage.delete` / `.list` wait for `publicStorageResponse`
26
+ * before treating the host as not supporting the public storage API. Passed
27
+ * as `Connector`/`Frame`'s private `postRequest(..., timeout)` 4th argument,
28
+ * which removes the pending resolver when the timer fires (same fix as
29
+ * {@link APP_SETTINGS_TIMEOUT_MS} — see its doc comment).
30
+ */
31
+ export const PUBLIC_STORAGE_TIMEOUT_MS = 10000;
32
+ /**
33
+ * `publicStorage.put` waits longer than {@link PUBLIC_STORAGE_TIMEOUT_MS} —
34
+ * the host has to receive and store the upload before it can answer.
35
+ */
36
+ export const PUBLIC_STORAGE_PUT_TIMEOUT_MS = 120000;
37
+ /**
38
+ * Per-file size cap enforced client-side, before the request is even sent —
39
+ * matches the host's own `tooLarge` limit. See the README "Public storage"
40
+ * section for the full semantics (scopes, allowed types, path rules).
41
+ */
42
+ export const MAX_PUBLIC_FILE_SIZE_BYTES = 50 * 1024 * 1024;
43
+ /**
44
+ * Lower bound for `put`'s `options.expiresIn` (seconds) — there is no upper
45
+ * bound beyond what fits in a safe integer, see {@link validateExpiresIn}.
46
+ */
47
+ export const MIN_PUBLIC_FILE_EXPIRES_IN_SECONDS = 1;
48
+ /**
49
+ * Validates `PublicStorageApi.put`'s optional `options.expiresIn` (seconds)
50
+ * before any request is sent. `undefined` is always valid — expiry is
51
+ * opt-in; omitting it keeps the file permanent. When set, it must be a
52
+ * positive safe integer (`Number.isSafeInteger`, `>= 1`) — no upper bound.
53
+ * Throws `PublicStorageError('invalidExpiry')` otherwise (e.g. `0`,
54
+ * negative, non-integer, `NaN`, `Infinity`, or above
55
+ * `Number.MAX_SAFE_INTEGER`).
56
+ */
57
+ export function validateExpiresIn(expiresIn) {
58
+ if (expiresIn === undefined)
59
+ return;
60
+ if (!Number.isSafeInteger(expiresIn) || expiresIn < MIN_PUBLIC_FILE_EXPIRES_IN_SECONDS) {
61
+ throw new PublicStorageError('invalidExpiry');
62
+ }
63
+ }
64
+ /**
65
+ * Builds the `expiresIn` part of the `putPublicFile` wire message from
66
+ * `options.expiresIn`: an empty object when unset, so `expiresIn` is a
67
+ * genuinely absent key on the message for a `put` that didn't opt in —
68
+ * not a key present with value `undefined`. Spread into the message
69
+ * object, e.g. `{ type: 'putPublicFile', ..., ...putPublicFileExpiryField(options?.expiresIn) }`.
70
+ * Call {@link validateExpiresIn} first — this does no validation of its own.
71
+ */
72
+ export function putPublicFileExpiryField(expiresIn) {
73
+ return expiresIn === undefined ? {} : { expiresIn };
74
+ }
75
+ /**
76
+ * Fills `downloadUrl` from `url` (`?download=1`) when the host didn't send
77
+ * one — the signature of a vitre host that predates this field. Applied to
78
+ * `put`'s resolved `PublicFile` and to every `list` entry, so apps can
79
+ * always rely on `file.downloadUrl` regardless of host version. A
80
+ * `downloadUrl` already set by the host (e.g. carrying its own query
81
+ * params) is kept as-is.
82
+ */
83
+ export function withDownloadUrlFallback(file) {
84
+ if (file.downloadUrl)
85
+ return file;
86
+ return { ...file, downloadUrl: `${file.url}?download=1` };
87
+ }
88
+ //# sourceMappingURL=PublicStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PublicStorage.js","sourceRoot":"","sources":["../../Common/PublicStorage.ts"],"names":[],"mappings":"AA8BA;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAM3C,YAAY,IAA4B;QACtC,KAAK,CAAC,kCAAkC,IAAI,EAAE,CAAC,CAAA;QANjD,0EAA0E;QAC1E,wEAAwE;QACxE,wEAAwE;QACxE,4DAA4D;QAC5C;;;;;WAA4B;QAG1C,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,CAAA;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAA;AAEnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAA;AAEnD;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAA6B;IAC7D,IAAI,SAAS,KAAK,SAAS;QAAE,OAAM;IACnC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,kCAAkC,EAAE,CAAC;QACvF,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,CAAA;IAC/C,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CACtC,SAA6B;IAE7B,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAA;AACrD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CACrC,IAAO;IAEP,IAAI,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAA;IACjC,OAAO,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,GAAG,aAAa,EAAE,CAAA;AAC3D,CAAC","sourcesContent":["import type { PublicFile, PublicStorageListResult, PublicStorageScope } from './Common.Model.js'\n\n/**\n * Error codes for the public storage API (`Connector.publicStorage` /\n * `Frame.publicStorage`).\n *\n * The six wire codes — `tooLarge`, `unsupportedType`, `invalidPath`,\n * `storageNotConfigured`, `unavailable`, `failed` — come straight from the\n * host's `publicStorageResponse.error`. `unsupported` and `invalidExpiry`\n * are synthesized locally by the SDK, never sent by the host:\n * - `unsupported` fires when no response arrives within the request's\n * timeout (see {@link PUBLIC_STORAGE_TIMEOUT_MS} /\n * {@link PUBLIC_STORAGE_PUT_TIMEOUT_MS}) — the signature of a vitre host\n * that predates this feature, which silently ignores the unknown\n * `putPublicFile` / `deletePublicFile` / `listPublicFiles` message types\n * instead of answering.\n * - `invalidExpiry` fires when `put`'s `options.expiresIn` isn't a positive\n * safe integer — see {@link validateExpiresIn}. Rejected before any\n * request is sent.\n */\nexport type PublicStorageErrorCode =\n | 'tooLarge'\n | 'unsupportedType'\n | 'invalidPath'\n | 'storageNotConfigured'\n | 'unavailable'\n | 'failed'\n | 'unsupported'\n | 'invalidExpiry'\n\n/**\n * Thrown by `publicStorage.put` / `.delete` / `.list` when the host answers\n * with `ok: false`, when the request times out, or (for `put`) locally when\n * the payload exceeds {@link MAX_PUBLIC_FILE_SIZE_BYTES} — see\n * {@link PublicStorageErrorCode}.\n */\nexport class PublicStorageError extends Error {\n // Not a TS constructor parameter property — those aren't erasable syntax,\n // so Node's type-stripping test runner (`pnpm test`, no transpile step)\n // fails to load this module. Plain field + explicit assignment instead;\n // identical runtime shape (still a public readonly `code`).\n public readonly code: PublicStorageErrorCode\n constructor(code: PublicStorageErrorCode) {\n super(`Public storage request failed: ${code}`)\n this.name = 'PublicStorageError'\n this.code = code\n }\n}\n\n/**\n * How long `publicStorage.delete` / `.list` wait for `publicStorageResponse`\n * before treating the host as not supporting the public storage API. Passed\n * as `Connector`/`Frame`'s private `postRequest(..., timeout)` 4th argument,\n * which removes the pending resolver when the timer fires (same fix as\n * {@link APP_SETTINGS_TIMEOUT_MS} — see its doc comment).\n */\nexport const PUBLIC_STORAGE_TIMEOUT_MS = 10000\n\n/**\n * `publicStorage.put` waits longer than {@link PUBLIC_STORAGE_TIMEOUT_MS} —\n * the host has to receive and store the upload before it can answer.\n */\nexport const PUBLIC_STORAGE_PUT_TIMEOUT_MS = 120000\n\n/**\n * Per-file size cap enforced client-side, before the request is even sent —\n * matches the host's own `tooLarge` limit. See the README \"Public storage\"\n * section for the full semantics (scopes, allowed types, path rules).\n */\nexport const MAX_PUBLIC_FILE_SIZE_BYTES = 50 * 1024 * 1024\n\n/**\n * Lower bound for `put`'s `options.expiresIn` (seconds) — there is no upper\n * bound beyond what fits in a safe integer, see {@link validateExpiresIn}.\n */\nexport const MIN_PUBLIC_FILE_EXPIRES_IN_SECONDS = 1\n\n/**\n * Validates `PublicStorageApi.put`'s optional `options.expiresIn` (seconds)\n * before any request is sent. `undefined` is always valid — expiry is\n * opt-in; omitting it keeps the file permanent. When set, it must be a\n * positive safe integer (`Number.isSafeInteger`, `>= 1`) — no upper bound.\n * Throws `PublicStorageError('invalidExpiry')` otherwise (e.g. `0`,\n * negative, non-integer, `NaN`, `Infinity`, or above\n * `Number.MAX_SAFE_INTEGER`).\n */\nexport function validateExpiresIn(expiresIn: number | undefined): void {\n if (expiresIn === undefined) return\n if (!Number.isSafeInteger(expiresIn) || expiresIn < MIN_PUBLIC_FILE_EXPIRES_IN_SECONDS) {\n throw new PublicStorageError('invalidExpiry')\n }\n}\n\n/**\n * Builds the `expiresIn` part of the `putPublicFile` wire message from\n * `options.expiresIn`: an empty object when unset, so `expiresIn` is a\n * genuinely absent key on the message for a `put` that didn't opt in —\n * not a key present with value `undefined`. Spread into the message\n * object, e.g. `{ type: 'putPublicFile', ..., ...putPublicFileExpiryField(options?.expiresIn) }`.\n * Call {@link validateExpiresIn} first — this does no validation of its own.\n */\nexport function putPublicFileExpiryField(\n expiresIn: number | undefined,\n): { expiresIn: number } | Record<string, never> {\n return expiresIn === undefined ? {} : { expiresIn }\n}\n\n/**\n * Fills `downloadUrl` from `url` (`?download=1`) when the host didn't send\n * one — the signature of a vitre host that predates this field. Applied to\n * `put`'s resolved `PublicFile` and to every `list` entry, so apps can\n * always rely on `file.downloadUrl` regardless of host version. A\n * `downloadUrl` already set by the host (e.g. carrying its own query\n * params) is kept as-is.\n */\nexport function withDownloadUrlFallback<T extends { url: string; downloadUrl?: string }>(\n file: T,\n): T {\n if (file.downloadUrl) return file\n return { ...file, downloadUrl: `${file.url}?download=1` }\n}\n\n/**\n * Options for `PublicStorageApi.put`.\n */\nexport type PublicStoragePutOptions = {\n /**\n * Opt-in expiry, in seconds, as a positive safe integer — no upper bound.\n * The link answers 404 once expired and the server deletes the file.\n * Omit for a permanent file (the default) — rewriting the same `path`\n * later without `expiresIn` makes it permanent again. Validated locally\n * with {@link validateExpiresIn}; an invalid value rejects with\n * `PublicStorageError('invalidExpiry')` before any request is sent.\n */\n expiresIn?: number\n}\n\n/**\n * Public, unauthenticated file storage an app can write to, scoped to the\n * vitre's TEAM — see the README \"Public storage\" section for the full\n * semantics. Files are readable by ANYONE without authentication at the\n * returned `url` (a stable link under `https://a.lavit.re/`) — never put\n * private data here.\n *\n * Exposed as `connector.publicStorage` / `frame.publicStorage`. Only a\n * Vitre-hosted `Connector` / `Frame` has it — a companion connector cannot\n * write to public storage.\n */\nexport type PublicStorageApi = {\n /**\n * Upload (or overwrite) a file at `path` within `scope` (`'app'` by\n * default — this app's own space; `'shared'` is a space every app of the\n * team shares). `data` may be an `ArrayBuffer`, `Blob`, or `Uint8Array`; it\n * is normalized to an `ArrayBuffer` and transferred to the host zero-copy\n * — don't reuse the buffer you pass after calling `put` (it is detached,\n * same as any other `Transferable` handed to `postMessage`). Rejects\n * locally with `PublicStorageError('tooLarge')`, without a round-trip, if\n * the payload exceeds {@link MAX_PUBLIC_FILE_SIZE_BYTES}. Overwriting an\n * existing path replaces the file; readers revalidate.\n *\n * `options.expiresIn` opts the file into automatic deletion — see\n * {@link PublicStoragePutOptions}. Invalid values reject locally with\n * `PublicStorageError('invalidExpiry')`, without a round-trip.\n */\n put(\n path: string,\n data: ArrayBuffer | Blob | Uint8Array,\n contentType: string,\n scope?: PublicStorageScope,\n options?: PublicStoragePutOptions,\n ): Promise<PublicFile>\n /**\n * Delete the file at `path` within `scope` (`'app'` by default). Resolves\n * even if the path didn't exist.\n */\n delete(path: string, scope?: PublicStorageScope): Promise<void>\n /**\n * List files within `scope` (`'app'` by default), optionally filtered to\n * those whose path starts with `prefix`.\n */\n list(prefix?: string, scope?: PublicStorageScope): Promise<PublicStorageListResult>\n}\n"]}
@@ -2,6 +2,8 @@ export * from './Common.Model.js';
2
2
  export { compareVersions, isMinVersion } from './Version.js';
3
3
  export { CrdtChannel, MIN_CRDT_HOST_VERSION, type CrdtAttachment, type CrdtInboundMessage, type CrdtOutboundMessage, type CrdtPostMessage, } from './CrdtChannel.js';
4
4
  export { BlobStore } from './BlobStore.js';
5
+ export { AppSettingsError, APP_SETTINGS_TIMEOUT_MS, type AppSettingsErrorCode, } from './AppSettings.js';
6
+ export { PublicStorageError, PUBLIC_STORAGE_TIMEOUT_MS, PUBLIC_STORAGE_PUT_TIMEOUT_MS, MAX_PUBLIC_FILE_SIZE_BYTES, MIN_PUBLIC_FILE_EXPIRES_IN_SECONDS, validateExpiresIn, putPublicFileExpiryField, withDownloadUrlFallback, type PublicStorageErrorCode, type PublicStorageApi, type PublicStoragePutOptions, } from './PublicStorage.js';
5
7
  export { AiChannel, MIN_AI_HOST_VERSION, type AiTool, type AiToolHandler, type AiInboundMessage, type AiOutboundMessage, type AiPostMessage, } from './AiChannel.js';
6
8
  export declare const ensureDefaultValue: <T>(value: Partial<T> | null, defaultValue: T) => T;
7
9
  export * from './PreviewScaling.js';
@@ -2,6 +2,8 @@ export * from './Common.Model.js';
2
2
  export { compareVersions, isMinVersion } from './Version.js';
3
3
  export { CrdtChannel, MIN_CRDT_HOST_VERSION, } from './CrdtChannel.js';
4
4
  export { BlobStore } from './BlobStore.js';
5
+ export { AppSettingsError, APP_SETTINGS_TIMEOUT_MS, } from './AppSettings.js';
6
+ export { PublicStorageError, PUBLIC_STORAGE_TIMEOUT_MS, PUBLIC_STORAGE_PUT_TIMEOUT_MS, MAX_PUBLIC_FILE_SIZE_BYTES, MIN_PUBLIC_FILE_EXPIRES_IN_SECONDS, validateExpiresIn, putPublicFileExpiryField, withDownloadUrlFallback, } from './PublicStorage.js';
5
7
  export { AiChannel, MIN_AI_HOST_VERSION, } from './AiChannel.js';
6
8
  export const ensureDefaultValue = (value, defaultValue) => {
7
9
  const ensureValue = (value, defaultValue) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../Common/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EACL,WAAW,EACX,qBAAqB,GAKtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EACL,SAAS,EACT,mBAAmB,GAMpB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,KAAwB,EACxB,YAAe,EACf,EAAE;IACF,MAAM,WAAW,GAAG,CAAC,KAAU,EAAE,YAAiB,EAAE,EAAE;QACpD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAA;QACd,CAAC;QAED,IAAI,OAAO,KAAK,KAAK,OAAO,YAAY,EAAE,CAAC;YACzC,OAAO,YAAY,CAAA;QACrB,CAAC;QAED,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBAChC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC1B,OAAO,YAAY,CAAA;gBACrB,CAAC;qBAAM,CAAC;oBACN,OAAO,KAAK,CAAA;gBACd,CAAC;YACH,CAAC;YAED,KAAK,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACzD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACxC,KAAK,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;YAChE,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC,CAAA;IAED,OAAO,WAAW,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,YAAY,CAAM,CAAA;AACzE,CAAC,CAAA;AACD,cAAc,qBAAqB,CAAA","sourcesContent":["export * from './Common.Model.js'\nexport { compareVersions, isMinVersion } from './Version.js'\nexport {\n CrdtChannel,\n MIN_CRDT_HOST_VERSION,\n type CrdtAttachment,\n type CrdtInboundMessage,\n type CrdtOutboundMessage,\n type CrdtPostMessage,\n} from './CrdtChannel.js'\nexport { BlobStore } from './BlobStore.js'\nexport {\n AiChannel,\n MIN_AI_HOST_VERSION,\n type AiTool,\n type AiToolHandler,\n type AiInboundMessage,\n type AiOutboundMessage,\n type AiPostMessage,\n} from './AiChannel.js'\n\nexport const ensureDefaultValue = <T>(\n value: Partial<T> | null,\n defaultValue: T,\n) => {\n const ensureValue = (value: any, defaultValue: any) => {\n if (defaultValue === undefined) {\n return value\n }\n\n if (typeof value !== typeof defaultValue) {\n return defaultValue\n }\n\n if (typeof defaultValue === 'object') {\n if (Array.isArray(defaultValue)) {\n if (!Array.isArray(value)) {\n return defaultValue\n } else {\n return value\n }\n }\n\n value = value === undefined || value == null ? {} : value\n Object.keys(defaultValue).forEach((key) => {\n value[key] = ensureDefaultValue(value[key], defaultValue[key])\n })\n }\n\n return value\n }\n\n return ensureValue(value === undefined ? {} : value, defaultValue) as T\n}\nexport * from './PreviewScaling.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../Common/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EACL,WAAW,EACX,qBAAqB,GAKtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,GAExB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,6BAA6B,EAC7B,0BAA0B,EAC1B,kCAAkC,EAClC,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,GAIxB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,SAAS,EACT,mBAAmB,GAMpB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,KAAwB,EACxB,YAAe,EACf,EAAE;IACF,MAAM,WAAW,GAAG,CAAC,KAAU,EAAE,YAAiB,EAAE,EAAE;QACpD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAA;QACd,CAAC;QAED,IAAI,OAAO,KAAK,KAAK,OAAO,YAAY,EAAE,CAAC;YACzC,OAAO,YAAY,CAAA;QACrB,CAAC;QAED,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBAChC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC1B,OAAO,YAAY,CAAA;gBACrB,CAAC;qBAAM,CAAC;oBACN,OAAO,KAAK,CAAA;gBACd,CAAC;YACH,CAAC;YAED,KAAK,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACzD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACxC,KAAK,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;YAChE,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC,CAAA;IAED,OAAO,WAAW,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,YAAY,CAAM,CAAA;AACzE,CAAC,CAAA;AACD,cAAc,qBAAqB,CAAA","sourcesContent":["export * from './Common.Model.js'\nexport { compareVersions, isMinVersion } from './Version.js'\nexport {\n CrdtChannel,\n MIN_CRDT_HOST_VERSION,\n type CrdtAttachment,\n type CrdtInboundMessage,\n type CrdtOutboundMessage,\n type CrdtPostMessage,\n} from './CrdtChannel.js'\nexport { BlobStore } from './BlobStore.js'\nexport {\n AppSettingsError,\n APP_SETTINGS_TIMEOUT_MS,\n type AppSettingsErrorCode,\n} from './AppSettings.js'\nexport {\n PublicStorageError,\n PUBLIC_STORAGE_TIMEOUT_MS,\n PUBLIC_STORAGE_PUT_TIMEOUT_MS,\n MAX_PUBLIC_FILE_SIZE_BYTES,\n MIN_PUBLIC_FILE_EXPIRES_IN_SECONDS,\n validateExpiresIn,\n putPublicFileExpiryField,\n withDownloadUrlFallback,\n type PublicStorageErrorCode,\n type PublicStorageApi,\n type PublicStoragePutOptions,\n} from './PublicStorage.js'\nexport {\n AiChannel,\n MIN_AI_HOST_VERSION,\n type AiTool,\n type AiToolHandler,\n type AiInboundMessage,\n type AiOutboundMessage,\n type AiPostMessage,\n} from './AiChannel.js'\n\nexport const ensureDefaultValue = <T>(\n value: Partial<T> | null,\n defaultValue: T,\n) => {\n const ensureValue = (value: any, defaultValue: any) => {\n if (defaultValue === undefined) {\n return value\n }\n\n if (typeof value !== typeof defaultValue) {\n return defaultValue\n }\n\n if (typeof defaultValue === 'object') {\n if (Array.isArray(defaultValue)) {\n if (!Array.isArray(value)) {\n return defaultValue\n } else {\n return value\n }\n }\n\n value = value === undefined || value == null ? {} : value\n Object.keys(defaultValue).forEach((key) => {\n value[key] = ensureDefaultValue(value[key], defaultValue[key])\n })\n }\n\n return value\n }\n\n return ensureValue(value === undefined ? {} : value, defaultValue) as T\n}\nexport * from './PreviewScaling.js'\n"]}
@@ -1,4 +1,4 @@
1
- import type { AppMessage, BorderOptions, ChangePrivacy, ChangeTeamSpace, ChangeTeamSpaceGuest, ChromeStyle, ConnectedMediaDevice, ConnectionCodeUpdated, DeviceFrameReference, DeviceFullscreenUpdated, DeviceJoined, DeviceLeft, DeviceMessageReceived, DevicePrivacyChanged, DeviceScalingUpdated, EnumerateLoadedFrames, EnumerateLoadedFramesCompleted, EventTelemetry, FieldUpdated, FileData, FramePrivacy, GetStats, HideNotification, HostInformation, Interaction, KnockKnock, LayoutPosition, LayoutPositionWithRules, LocalConnectorMessageReceived, MenuClicked, MenuEntry, MenuVisibility, NotificationButtonClicked, NotificationDismissed, NotificationInfo, OpenFrameOptions, PendingDevicesInfo, PositionType, PositionUpdated, PrivacyChanged, RequestSerialPortAccess, SerialPortAccessResult, ResizeMode, SaveSettings, SendKnockKnock, SendMessageTo, SendMessageToAll, SendToLocalFrame, SendToSerialPort, SetReducedAudioMode, SettingsUpdated, ShareDataRequest, ShareFileRequest, Size, StartEventTelemetry, StateReplaced, StatsResponse, UpdateState, ViewMode, Visibility, VitreSettings, VitreSettingsSetter, VoiceAction, VoiceActionDetection } from '../Common/index.js';
1
+ import type { AppMessage, AppSettingsChanged, AppSettingsResponse, BorderOptions, ChangePrivacy, ChangeTeamSpace, ChangeTeamSpaceGuest, ChromeStyle, ConnectedMediaDevice, ConnectionCodeUpdated, DeletePublicFile, DeviceFrameReference, DeviceFullscreenUpdated, DeviceJoined, DeviceLeft, DeviceMessageReceived, DevicePrivacyChanged, DeviceScalingUpdated, EnumerateLoadedFrames, EnumerateLoadedFramesCompleted, EventTelemetry, FieldUpdated, FileData, FramePrivacy, GetAppSettings, GetStats, HideNotification, HostInformation, Interaction, KnockKnock, LayoutPosition, LayoutPositionWithRules, ListPublicFiles, LocalConnectorMessageReceived, MenuClicked, MenuEntry, MenuVisibility, NotificationButtonClicked, NotificationDismissed, NotificationInfo, OpenFrameOptions, PendingDevicesInfo, PositionType, PositionUpdated, PrivacyChanged, PublicStorageResponse, PutPublicFile, RequestSerialPortAccess, SerialPortAccessResult, ResizeMode, SaveSettings, SendKnockKnock, SendMessageTo, SendMessageToAll, SendToLocalFrame, SendToSerialPort, SetAppSettings, SetReducedAudioMode, SettingsUpdated, ShareDataRequest, ShareFileRequest, Size, StartEventTelemetry, StateReplaced, StatsResponse, UpdateState, ViewMode, Visibility, VitreSettings, VitreSettingsSetter, VoiceAction, VoiceActionDetection } from '../Common/index.js';
2
2
  export type InitializeConnector = {
3
3
  hostInfo: HostInformation;
4
4
  appId?: string;
@@ -454,6 +454,12 @@ export type ConnectorApiMessagesIn = ({
454
454
  } & ExternalMessageReceived) | ({
455
455
  type: 'appTokenReceived';
456
456
  } & AppTokenReceivedData) | ({
457
+ type: 'appSettingsResponse';
458
+ } & AppSettingsResponse) | ({
459
+ type: 'appSettingsChanged';
460
+ } & AppSettingsChanged) | ({
461
+ type: 'publicStorageResponse';
462
+ } & PublicStorageResponse) | ({
457
463
  type: 'executeInFrameResult';
458
464
  } & ExecuteInFrameResultData) | ({
459
465
  type: 'mediaDevicesChanged';
@@ -539,6 +545,16 @@ export type ConnectorApiMessagesOut = ({
539
545
  } & ShareDataRequest) | ({
540
546
  type: 'saveSettings';
541
547
  } & SaveSettings) | ({
548
+ type: 'getAppSettings';
549
+ } & GetAppSettings) | ({
550
+ type: 'setAppSettings';
551
+ } & SetAppSettings) | ({
552
+ type: 'putPublicFile';
553
+ } & PutPublicFile) | ({
554
+ type: 'deletePublicFile';
555
+ } & DeletePublicFile) | ({
556
+ type: 'listPublicFiles';
557
+ } & ListPublicFiles) | ({
542
558
  type: 'changeTeamSpace';
543
559
  } & ChangeTeamSpace) | ({
544
560
  type: 'changeTeamSpaceGuest';
@@ -1 +1 @@
1
- {"version":3,"file":"Connector.Model.js","sourceRoot":"","sources":["../../Connector/Connector.Model.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AppMessage,\n BorderOptions,\n ChangePrivacy,\n ChangeTeamSpace,\n ChangeTeamSpaceGuest,\n ChromeStyle,\n ConnectedMediaDevice,\n ConnectionCodeUpdated,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceJoined,\n DeviceLeft,\n DeviceMessageReceived,\n DevicePrivacyChanged,\n DeviceScalingUpdated,\n EnumerateLoadedFrames,\n EnumerateLoadedFramesCompleted,\n EventTelemetry,\n FieldUpdated,\n FileData,\n FramePrivacy,\n GetStats,\n HideNotification,\n HostInformation,\n Interaction,\n KnockKnock,\n LayoutPosition,\n LayoutPositionWithRules,\n LocalConnectorMessageReceived,\n MenuClicked,\n MenuEntry,\n MenuVisibility,\n NotificationButtonClicked,\n NotificationDismissed,\n NotificationInfo,\n OpenFrameOptions,\n PendingDevicesInfo,\n PositionType,\n PositionUpdated,\n PrivacyChanged,\n RequestSerialPortAccess,\n SerialPortAccessResult,\n ResizeMode,\n SaveSettings,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToLocalFrame,\n SendToSerialPort,\n SetReducedAudioMode,\n SettingsUpdated,\n ShareDataRequest,\n ShareFileRequest,\n Size,\n StartEventTelemetry,\n StateReplaced,\n StatsResponse,\n UpdateState,\n ViewMode,\n Visibility,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\n\nexport type InitializeConnector = {\n hostInfo: HostInformation\n appId?: string\n state?: Record<string, any>\n}\n\nexport type RegExpDefinition = {\n pattern: string\n options: string\n}\n\nexport type ShareTargetOptions = {\n name?: string\n urlDomains?: string[]\n urlRegex?: string[]\n urlRegexWithOptions?: RegExpDefinition[]\n files?: FileShareTarget[]\n /**\n * Icon shown for this share target in the companion import picker. A bitmap\n * (full colour). May be a path relative to the connector URL — the host\n * resolves it to an absolute URL. When both `iconUrl` and `maskIconUrl` are\n * set, the companion prefers `maskIconUrl`. When neither is set the picker\n * falls back to the app icon (`ConnectorOptions.iconUrl`).\n */\n iconUrl?: string\n /**\n * Monochrome mask icon for this share target, tinted by the companion theme\n * (CSS `mask`). May be relative to the connector URL — resolved absolute by\n * the host. Preferred over `iconUrl` when both are set.\n */\n maskIconUrl?: string\n}\n\nexport type FileShareTarget = {\n fileExtension?: string\n fileExtensionRegex?: RegExpDefinition\n binaryHeader?: ArrayBufferLike\n mimeTypes?: string[]\n tag?: any\n id: string\n}\n\nexport type MenuCategoryInfo = {\n type: 'mainMenu'\n label?: string\n description?: string\n order?: number\n}\n\nexport type SettingsMenuCategoryInfo = {\n type: 'settingsMenu'\n label?: string\n description?: string\n}\n\nexport type MainMenuQuickActions = {\n type: 'mainMenuQuickActions'\n label?: string\n description?: string\n order?: number\n}\n\nexport type ExportMenuCategory = {\n type: 'exportMenu'\n label?: string\n description?: string\n order?: number\n}\n\nexport type RootMenuCategory =\n | { type: 'desktopIcons' }\n | MainMenuQuickActions\n | MenuCategoryInfo\n | SettingsMenuCategoryInfo\n | ExportMenuCategory\n\nexport type RootMenuEntry = Omit<MenuEntry, 'category'> & {\n category?: RootMenuCategory\n}\n\nexport type ConnectorOptions = {\n name: string\n iconUrl?: string\n menu?: RootMenuEntry[]\n /**\n * @deprecated Use `shareTargets`. When `shareTargets` is set the host uses it\n * and ignores this field. Kept on the wire for older Vitres that only read a\n * single share target — the SDK mirrors `shareTargets[0]` here automatically.\n */\n shareTarget?: ShareTargetOptions\n /**\n * Share targets advertised by this app. Several may be declared so an app can\n * receive distinct kinds of content (each with its own `name`/matchers). When\n * provided, this supersedes the deprecated singular `shareTarget`.\n */\n shareTargets?: ShareTargetOptions[]\n /**\n * The app's settings, rendered by the la Vitre settings form and read back from\n * `hostInformation.settings`.\n *\n * This is a **map of fields**, NOT a full JSON schema: one key per setting, the\n * same keys as `hostInformation.settings`. The host builds the enclosing\n * `{ type: 'object', title: <app name>, properties: … }` itself.\n *\n * ```ts\n * // RIGHT\n * settingsSchema: {\n * city: { type: 'string', title: 'City', default: 'Paris' },\n * layout: { type: 'object', title: 'Layout', properties: { columns: { type: 'number' } } },\n * }\n * // WRONG — a full JSON schema\n * settingsSchema: { type: 'object', properties: { city: { type: 'string' } } }\n * ```\n */\n settingsSchema?: SettingsSchemaProperties\n /** react-jsonschema-form `uiSchema`, keyed like `settingsSchema` (one entry per field). */\n settingsSchemaUI?: any\n voiceActions?: VoiceAction[]\n}\n\n/**\n * One setting: the JSON-Schema subset the la Vitre settings form renders\n * (`string`, `number`, `boolean`, `enum`, `array` with `items`, `object` with\n * `properties`). Every nested `properties` value and `items` is itself a\n * `SettingsFieldSchema` object, never a bare string; `required` is a list of key\n * names on the enclosing object, never `required: true` on a field.\n */\nexport type SettingsFieldSchema = {\n type?: string\n title?: string\n description?: string\n default?: unknown\n enum?: unknown[]\n enumNames?: string[]\n items?: SettingsFieldSchema | SettingsFieldSchema[]\n properties?: SettingsSchemaProperties\n required?: string[]\n [keyword: string]: unknown\n}\n\n/** A map of fields — see `ConnectorOptions.settingsSchema`. */\nexport type SettingsSchemaProperties = { [field: string]: SettingsFieldSchema }\n\nexport type ConnectorInitialized = {\n options: ConnectorOptions\n}\n\nexport type OpenFrame = {\n options: OpenFrameOptions\n}\n\nexport type OpenLocalFrame = {\n options: OpenFrameOptions\n}\n\nexport type EnumerateMediaDevices = {\n requestId: string\n}\n\nexport type OpenStream = {\n requestId: string\n streamId: string\n constraints: MediaStreamConstraints\n}\n\nexport type OpenStreamFrame = {\n constraints?: MediaStreamConstraints\n streamSourceUrl?: string\n requestId: string\n frameConnectorId: string\n name: string\n url: string\n allowFullscreen?: boolean\n /**\n * @deprecated Use menuVisibility property vitre v20\n */\n hideMenu?: boolean\n startPosition?: LayoutPosition\n startPositions?: LayoutPositionWithRules[]\n interaction?: Interaction\n resizeMode?: ResizeMode\n mode?: ViewMode\n data?: any\n file?: FileData\n privacy?: FramePrivacy\n mirrorInitiatorStream?: boolean\n size?: Size\n minSize?: Size\n maxSize?: Size\n startInteractive?: boolean\n border?: BorderOptions\n positionType?: PositionType\n voiceActions?: VoiceAction[]\n visibility?: Visibility\n menuVisibility?: MenuVisibility\n closable?: boolean\n closeLabel?: string\n}\n\nexport type SetRootMenu = {\n menu: RootMenuEntry[]\n}\n\nexport type SettingsSchema = {\n /** A map of fields, NOT a full JSON schema — see `ConnectorOptions.settingsSchema`. */\n schema: SettingsSchemaProperties\n schemaUI: any\n}\n\nexport type SetFramePosition = {\n frameConnectorId: string\n position: LayoutPosition\n}\n\nexport type CloseFrame = {\n frameConnectorId: string\n}\n\nexport type SetFrameOwner = {\n frameConnectorId: string\n /** Device id of the new owner (HostInformation.devicesInSpace[].id). */\n owner: string\n}\n\n/// Live update of an already-open frame's shared-content style (background /\n/// box-shadow / drop-shadow surface, and companion icon). Emitted by\n/// `connector.setChromeStyle`. Only the provided fields are changed; the others\n/// keep their current value.\nexport type SetChromeStyle = {\n frameConnectorId: string\n} & ChromeStyle\n\n/// Host→app notification that an already-open shared frame's owner was\n/// reassigned via `setFrameOwner`, INCLUDING changes initiated by another\n/// device in the space. Surfaced on the SDK `Connector` as\n/// `onFrameOwnerChanged`. `owner` is the new owner's device id\n/// (HostInformation.devicesInSpace[].id).\nexport type FrameOwnerChanged = {\n frameConnectorId: string\n owner: string\n}\n\n/**\n * @deprecated Use `SetShareTargets` (`setShareTargets`).\n */\nexport type SetShareTarget = {\n shareTarget: ShareTargetOptions\n}\n\nexport type SetShareTargets = {\n shareTargets: ShareTargetOptions[]\n}\n\nexport type FrameUnloaded = {\n frameConnectorId: string\n}\n\nexport type FrameInfo = {\n frameConnectorId: string\n zIndex: number\n}\n\nexport type ShareDataReceived = {\n data: ShareData\n}\n\nexport type FileShareDataReceived = {\n data: FileData\n}\n\nexport type ShareData = {\n url: string\n}\n\nexport type TrackKind = 'audio' | 'video'\n\nexport type MediaTrackInfo = {\n id: string\n kind: TrackKind\n deviceName: string\n capabilities: MediaTrackCapabilities\n settings: MediaTrackSettings\n}\n\nexport type OpenStreamCompleted = {\n requestId: string\n streamId: string\n error?: string\n tracks?: MediaTrackInfo[]\n}\n\n/// One track of an app-provided shared stream. `readable` is the transferable\n/// output of a `MediaStreamTrackProcessor` (breakout box) — the host rebuilds a\n/// live `MediaStreamTrack` from it via `MediaStreamTrackGenerator`. Listed in\n/// the postMessage transfer list, so the host receives the SAME stream\n/// zero-copy (no re-encode) — works only when app and host are same-site\n/// (e.g. `*.apps.lavit.re` ↔ `app.lavit.re`) and Chromium.\nexport type ShareStreamTrack = {\n kind: TrackKind\n readable: ReadableStream\n settings?: MediaTrackSettings\n}\n\nexport type ShareStreamOptions = {\n /** Display label for the share (defaults to the app name). */\n name?: string\n /** Source resolution hint, used by the host to size the share. */\n width?: number\n height?: number\n /**\n * Controls how remote peers render this shared stream.\n *\n * - `'appFrame'` (default when absent): receivers load the app iframe, exactly\n * as before this field existed. N-1 receivers that do not know this field\n * will behave as `'appFrame'` automatically (backward-compatible).\n * - `'standard'`: receivers render a classic shared-video languette without\n * loading the app iframe. Use when the app provides raw video/audio and the\n * frame UI is not meaningful on the receiver side (e.g. a camera feed).\n */\n receiverDisplay?: 'standard' | 'appFrame'\n}\n\nexport type ShareStream = {\n requestId: string\n sharedStreamId: string\n options?: ShareStreamOptions\n tracks: ShareStreamTrack[]\n}\n\n/// Swap the source track(s) of an already-open app share WITHOUT closing it.\n/// The host swaps the underlying track in place (sender.replaceTrack on the\n/// vitre→peer side, no renegotiation), so peers see continuity.\nexport type ReplaceShareStream = {\n requestId: string\n sharedStreamId: string\n tracks: ShareStreamTrack[]\n}\n\nexport type StopShareStream = {\n sharedStreamId: string\n}\n\nexport type ShareStreamCompleted = {\n requestId: string\n sharedStreamId: string\n error?: string\n}\n\nexport type OpenStreamFrameCompleted = {\n requestId: string\n error?: string\n tracks?: MediaTrackInfo[]\n streamSourceUrl?: string\n}\n\nexport type EnumerateMediaDevicesCompleted = {\n requestId: string\n devices: ConnectedMediaDevice[]\n}\n\nexport type FramePositionUpdated = {\n frameConnectorId: string\n} & PositionUpdated\n\nexport type ExternalMessageReceived = {\n requestId: string\n appId: string\n message: any\n apiKeyId: string\n apiKeyName: string\n}\n\nexport type ExternalMessageResponseData = {\n requestId: string\n response?: any\n}\n\nexport type RequestAppTokenData = {\n requestId: string\n}\n\nexport type AppTokenReceivedData = {\n requestId: string\n token?: string\n error?: string\n}\n\nexport type ExecuteInFrameData = {\n requestId: string\n /** Must match the `name` attribute of the <iframe> embedded in frame.html. */\n frameName: string\n /** Runs as a function body — use `return <expr>` to yield a value. */\n code: string\n}\n\nexport type ExecuteInFrameResultData = {\n requestId: string\n /** JSON string of the injected code's return value; absent on error. */\n result?: string\n error?: string\n}\n\nexport type SetFrameSize = {\n frameId: string\n size: Size\n}\n\n/// Inbound to a Vitre `Connector` from a companion-side\n/// `CompanionConnector` (same `appId`). `fromCompanionId` is the\n/// connection-id of the sending companion so the Vitre connector can reply\n/// targeted-back via `sendMessageToCompanionConnector`.\nexport type MessageFromCompanionConnector = {\n fromCompanionId: string\n message: string\n fileData?: FileData\n}\n\n/// Inbound to a Vitre `Connector` when a companion FRAME sent a message via\n/// `CompanionFrame.sendMessageToVitreConnector` (works for a local companion\n/// frame with no paired Vitre frame). Carries the `frameConnectorId` of the\n/// companion frame that spoke, on top of the connector-message shape.\nexport type MessageFromCompanionFrame = {\n fromCompanionId: string\n frameConnectorId: string\n message: string\n fileData?: FileData\n}\n\n/// Inbound to a Vitre `Connector` when a connected companion clicks a\n/// menu entry that lives on a frame's options menu AND was declared with\n/// `availability: 'companion'` (or `'companionAdmin'`). The click did NOT\n/// fire on the Vitre — it fired on the companion-side render of the\n/// frame's options. The Vitre-side connector receives this so the app\n/// can react (typically: call `openCompanionFrame` from the companion's\n/// main connector, or push state into the frame). Distinct from\n/// `menuClicked` so apps that only care about Vitre-side menu clicks\n/// don't get woken up by companion clicks.\n///\n/// `frameConnectorId` is the id of the frame whose options menu was\n/// clicked; `fromCompanionId` is the connection-id of the clicker so\n/// targeted reactions are possible.\nexport type FrameMenuClickedOnCompanion = {\n frameConnectorId: string\n fromCompanionId: string\n menuId: string\n isChecked: boolean\n tag?: any\n}\n\n/// Target for `sendMessageToCompanionConnector` — broadcast to every\n/// companion currently connected to the Vitre, or address a single\n/// companion by id. Discriminated on `kind` so the union is unambiguous\n/// for callers and for the host that routes on this shape (a structural\n/// `{ all: true } | { companionId }` would let `{ all: true, companionId }`\n/// slip past the type system via an intermediate variable).\nexport type CompanionConnectorTarget =\n | { kind: 'all' }\n | { kind: 'one'; companionId: string }\n\n/// Payload emitted by a Vitre `Connector` when it wants to talk to the\n/// companion-side `CompanionConnector` for the same `appId`.\nexport type SendMessageToCompanionConnector = {\n target: CompanionConnectorTarget\n message: string\n fileData?: FileData\n}\n\nexport type ConnectorApiMessagesIn =\n | ({ type: 'devicePrivacyChanged' } & DevicePrivacyChanged)\n | ({ type: 'initialize' } & InitializeConnector)\n | ({ type: 'deviceJoined' } & DeviceJoined)\n | ({ type: 'deviceLeft' } & DeviceLeft)\n | ({ type: 'deviceMessageReceived' } & DeviceMessageReceived)\n | ({ type: 'deviceFullscreenUpdated' } & DeviceFullscreenUpdated)\n | ({ type: 'menuClicked' } & MenuClicked)\n | ({ type: 'fieldUpdated' } & FieldUpdated)\n | ({ type: 'shareDataReceived' } & ShareDataReceived)\n | ({ type: 'fileShareDataReceived' } & FileShareDataReceived)\n | ({ type: 'frameLoaded' } & FrameInfo)\n | ({ type: 'frameConnectorLoaded' } & FrameInfo)\n | ({ type: 'frameConnectorLoading' } & OpenFrame)\n | ({ type: 'privacyChanged' } & PrivacyChanged)\n | ({ type: 'frameUnloaded' } & FrameUnloaded)\n | ({\n type: 'enumerateMediaDevicesCompleted'\n } & EnumerateMediaDevicesCompleted)\n | ({ type: 'openStreamCompleted' } & OpenStreamCompleted)\n | ({ type: 'openStreamFrameCompleted' } & OpenStreamFrameCompleted)\n | ({ type: 'shareStreamCompleted' } & ShareStreamCompleted)\n | ({\n type: 'enumerateLoadedFramesCompleted'\n } & EnumerateLoadedFramesCompleted)\n | ({ type: 'localConnectorMessageReceived' } & LocalConnectorMessageReceived)\n | ({ type: 'extensionMessage' } & AppMessage)\n | ({ type: 'vitreSettingsResponse' } & VitreSettings)\n | ({ type: 'knockKnockReceived' } & KnockKnock)\n | ({ type: 'settingsUpdated' } & SettingsUpdated)\n | ({ type: 'vitreSettingsUpdated' } & VitreSettings)\n | ({ type: 'notificationDismissed' } & NotificationDismissed)\n | ({ type: 'notificationButtonClicked' } & NotificationButtonClicked)\n | ({ type: 'frameZIndexChanged' } & FrameInfo)\n | ({ type: 'deviceFrameLoaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameUnloaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameConnectorLoaded' } & DeviceFrameReference)\n | ({ type: 'pendingDevicesConnectionRequested' } & PendingDevicesInfo)\n | ({ type: 'appMessage' } & AppMessage)\n | ({ type: 'voiceActionDetected' } & VoiceActionDetection)\n | ({ type: 'framePositionUpdated' } & FramePositionUpdated)\n | ({ type: 'deviceScalingUpdated' } & DeviceScalingUpdated)\n | ({ type: 'stateReplaced' } & StateReplaced)\n | ({ type: 'statsResponse' } & StatsResponse)\n | ({ type: 'serialPortAccessResult'; requestId: string } & SerialPortAccessResult)\n | ({ type: 'frameOwnerChanged' } & FrameOwnerChanged)\n | ({ type: 'connectionCodeUpdated' } & ConnectionCodeUpdated)\n | ({ type: 'externalMessageReceived' } & ExternalMessageReceived)\n | ({ type: 'appTokenReceived' } & AppTokenReceivedData)\n | ({ type: 'executeInFrameResult' } & ExecuteInFrameResultData)\n | ({ type: 'mediaDevicesChanged' } & MediaDevicesChanged)\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSyncComplete' }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocSyncComplete'; guid: string }\n | {\n type: 'crdtSubdocTransferProgress'\n guid: string\n receivedBytes: number\n totalBytes: number\n }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n | ({\n type: 'messageFromCompanionConnector'\n } & MessageFromCompanionConnector)\n | ({\n type: 'messageFromCompanionFrame'\n } & MessageFromCompanionFrame)\n | ({\n type: 'frameMenuClickedOnCompanion'\n } & FrameMenuClickedOnCompanion)\n\nexport type MediaDevicesChanged = {\n devices: ConnectedMediaDevice[]\n}\n\nexport type ConnectorApiMessagesOut =\n | ({ type: 'sendMessageTo' } & SendMessageTo)\n | ({ type: 'sendMessageToAll' } & SendMessageToAll)\n | ({ type: 'connectorInitialized' } & ConnectorInitialized)\n | ({ type: 'openFrame' } & OpenFrame)\n | ({ type: 'openLocalFrame' } & OpenLocalFrame)\n | ({ type: 'sendToLocalFrame' } & SendToLocalFrame)\n | ({ type: 'enumerateMediaDevices' } & EnumerateMediaDevices)\n | ({ type: 'openStream' } & OpenStream)\n | ({ type: 'openStreamFrame' } & OpenStreamFrame)\n | ({ type: 'shareStream' } & ShareStream)\n | ({ type: 'replaceShareStream' } & ReplaceShareStream)\n | ({ type: 'stopShareStream' } & StopShareStream)\n | ({ type: 'setRootMenu' } & SetRootMenu)\n | ({ type: 'enumerateLoadedFrames' } & EnumerateLoadedFrames)\n | ({ type: 'setShareTarget' } & SetShareTarget)\n | ({ type: 'setShareTargets' } & SetShareTargets)\n | ({ type: 'extensionMessage' } & AppMessage)\n | ({ type: 'appMessage' } & AppMessage)\n | { type: 'getVitreSettings' }\n | ({ type: 'setVitreSettings' } & VitreSettingsSetter)\n | ({ type: 'shareFile' } & ShareFileRequest)\n | ({ type: 'shareData' } & ShareDataRequest)\n | ({ type: 'saveSettings' } & SaveSettings)\n | ({ type: 'changeTeamSpace' } & ChangeTeamSpace)\n | ({ type: 'changeTeamSpaceGuest' } & ChangeTeamSpaceGuest)\n | ({ type: 'showNotification' } & NotificationInfo)\n | ({ type: 'hideNotification' } & HideNotification)\n | ({ type: 'changePrivacy' } & ChangePrivacy)\n | ({ type: 'trackEvent' } & EventTelemetry)\n | ({ type: 'startTrackEvent' } & StartEventTelemetry)\n | ({ type: 'stopTrackEvent' } & EventTelemetry)\n | ({ type: 'setSettingsSchema' } & SettingsSchema)\n | { type: 'setVoiceActions'; actions: VoiceAction[] }\n | ({ type: 'closeFrame' } & CloseFrame)\n | ({ type: 'setFrameOwner' } & SetFrameOwner)\n | ({ type: 'setChromeStyle' } & SetChromeStyle)\n | ({ type: 'setFramePosition' } & SetFramePosition)\n | ({ type: 'updateState' } & UpdateState)\n | ({ type: 'sendKnockKnock' } & SendKnockKnock)\n | ({ type: 'getStats' } & GetStats)\n | ({ type: 'setReducedAudioMode' } & SetReducedAudioMode)\n | ({ type: 'externalMessageResponse' } & ExternalMessageResponseData)\n | ({ type: 'requestAppToken' } & RequestAppTokenData)\n | ({ type: 'executeInFrame' } & ExecuteInFrameData)\n | ({ type: 'setFrameSize' } & SetFrameSize)\n | ({ type: 'sendToSerialPort' } & SendToSerialPort)\n | ({ type: 'requestSerialPortAccess'; requestId: string } & RequestSerialPortAccess)\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestAwareness' }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n | ({\n type: 'sendMessageToCompanionConnector'\n } & SendMessageToCompanionConnector)\n"]}
1
+ {"version":3,"file":"Connector.Model.js","sourceRoot":"","sources":["../../Connector/Connector.Model.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AppMessage,\n AppSettingsChanged,\n AppSettingsResponse,\n BorderOptions,\n ChangePrivacy,\n ChangeTeamSpace,\n ChangeTeamSpaceGuest,\n ChromeStyle,\n ConnectedMediaDevice,\n ConnectionCodeUpdated,\n DeletePublicFile,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceJoined,\n DeviceLeft,\n DeviceMessageReceived,\n DevicePrivacyChanged,\n DeviceScalingUpdated,\n EnumerateLoadedFrames,\n EnumerateLoadedFramesCompleted,\n EventTelemetry,\n FieldUpdated,\n FileData,\n FramePrivacy,\n GetAppSettings,\n GetStats,\n HideNotification,\n HostInformation,\n Interaction,\n KnockKnock,\n LayoutPosition,\n LayoutPositionWithRules,\n ListPublicFiles,\n LocalConnectorMessageReceived,\n MenuClicked,\n MenuEntry,\n MenuVisibility,\n NotificationButtonClicked,\n NotificationDismissed,\n NotificationInfo,\n OpenFrameOptions,\n PendingDevicesInfo,\n PositionType,\n PositionUpdated,\n PrivacyChanged,\n PublicStorageResponse,\n PutPublicFile,\n RequestSerialPortAccess,\n SerialPortAccessResult,\n ResizeMode,\n SaveSettings,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToLocalFrame,\n SendToSerialPort,\n SetAppSettings,\n SetReducedAudioMode,\n SettingsUpdated,\n ShareDataRequest,\n ShareFileRequest,\n Size,\n StartEventTelemetry,\n StateReplaced,\n StatsResponse,\n UpdateState,\n ViewMode,\n Visibility,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\n\nexport type InitializeConnector = {\n hostInfo: HostInformation\n appId?: string\n state?: Record<string, any>\n}\n\nexport type RegExpDefinition = {\n pattern: string\n options: string\n}\n\nexport type ShareTargetOptions = {\n name?: string\n urlDomains?: string[]\n urlRegex?: string[]\n urlRegexWithOptions?: RegExpDefinition[]\n files?: FileShareTarget[]\n /**\n * Icon shown for this share target in the companion import picker. A bitmap\n * (full colour). May be a path relative to the connector URL — the host\n * resolves it to an absolute URL. When both `iconUrl` and `maskIconUrl` are\n * set, the companion prefers `maskIconUrl`. When neither is set the picker\n * falls back to the app icon (`ConnectorOptions.iconUrl`).\n */\n iconUrl?: string\n /**\n * Monochrome mask icon for this share target, tinted by the companion theme\n * (CSS `mask`). May be relative to the connector URL — resolved absolute by\n * the host. Preferred over `iconUrl` when both are set.\n */\n maskIconUrl?: string\n}\n\nexport type FileShareTarget = {\n fileExtension?: string\n fileExtensionRegex?: RegExpDefinition\n binaryHeader?: ArrayBufferLike\n mimeTypes?: string[]\n tag?: any\n id: string\n}\n\nexport type MenuCategoryInfo = {\n type: 'mainMenu'\n label?: string\n description?: string\n order?: number\n}\n\nexport type SettingsMenuCategoryInfo = {\n type: 'settingsMenu'\n label?: string\n description?: string\n}\n\nexport type MainMenuQuickActions = {\n type: 'mainMenuQuickActions'\n label?: string\n description?: string\n order?: number\n}\n\nexport type ExportMenuCategory = {\n type: 'exportMenu'\n label?: string\n description?: string\n order?: number\n}\n\nexport type RootMenuCategory =\n | { type: 'desktopIcons' }\n | MainMenuQuickActions\n | MenuCategoryInfo\n | SettingsMenuCategoryInfo\n | ExportMenuCategory\n\nexport type RootMenuEntry = Omit<MenuEntry, 'category'> & {\n category?: RootMenuCategory\n}\n\nexport type ConnectorOptions = {\n name: string\n iconUrl?: string\n menu?: RootMenuEntry[]\n /**\n * @deprecated Use `shareTargets`. When `shareTargets` is set the host uses it\n * and ignores this field. Kept on the wire for older Vitres that only read a\n * single share target — the SDK mirrors `shareTargets[0]` here automatically.\n */\n shareTarget?: ShareTargetOptions\n /**\n * Share targets advertised by this app. Several may be declared so an app can\n * receive distinct kinds of content (each with its own `name`/matchers). When\n * provided, this supersedes the deprecated singular `shareTarget`.\n */\n shareTargets?: ShareTargetOptions[]\n /**\n * The app's settings, rendered by the la Vitre settings form and read back from\n * `hostInformation.settings`.\n *\n * This is a **map of fields**, NOT a full JSON schema: one key per setting, the\n * same keys as `hostInformation.settings`. The host builds the enclosing\n * `{ type: 'object', title: <app name>, properties: … }` itself.\n *\n * ```ts\n * // RIGHT\n * settingsSchema: {\n * city: { type: 'string', title: 'City', default: 'Paris' },\n * layout: { type: 'object', title: 'Layout', properties: { columns: { type: 'number' } } },\n * }\n * // WRONG — a full JSON schema\n * settingsSchema: { type: 'object', properties: { city: { type: 'string' } } }\n * ```\n */\n settingsSchema?: SettingsSchemaProperties\n /** react-jsonschema-form `uiSchema`, keyed like `settingsSchema` (one entry per field). */\n settingsSchemaUI?: any\n voiceActions?: VoiceAction[]\n}\n\n/**\n * One setting: the JSON-Schema subset the la Vitre settings form renders\n * (`string`, `number`, `boolean`, `enum`, `array` with `items`, `object` with\n * `properties`). Every nested `properties` value and `items` is itself a\n * `SettingsFieldSchema` object, never a bare string; `required` is a list of key\n * names on the enclosing object, never `required: true` on a field.\n */\nexport type SettingsFieldSchema = {\n type?: string\n title?: string\n description?: string\n default?: unknown\n enum?: unknown[]\n enumNames?: string[]\n items?: SettingsFieldSchema | SettingsFieldSchema[]\n properties?: SettingsSchemaProperties\n required?: string[]\n [keyword: string]: unknown\n}\n\n/** A map of fields — see `ConnectorOptions.settingsSchema`. */\nexport type SettingsSchemaProperties = { [field: string]: SettingsFieldSchema }\n\nexport type ConnectorInitialized = {\n options: ConnectorOptions\n}\n\nexport type OpenFrame = {\n options: OpenFrameOptions\n}\n\nexport type OpenLocalFrame = {\n options: OpenFrameOptions\n}\n\nexport type EnumerateMediaDevices = {\n requestId: string\n}\n\nexport type OpenStream = {\n requestId: string\n streamId: string\n constraints: MediaStreamConstraints\n}\n\nexport type OpenStreamFrame = {\n constraints?: MediaStreamConstraints\n streamSourceUrl?: string\n requestId: string\n frameConnectorId: string\n name: string\n url: string\n allowFullscreen?: boolean\n /**\n * @deprecated Use menuVisibility property vitre v20\n */\n hideMenu?: boolean\n startPosition?: LayoutPosition\n startPositions?: LayoutPositionWithRules[]\n interaction?: Interaction\n resizeMode?: ResizeMode\n mode?: ViewMode\n data?: any\n file?: FileData\n privacy?: FramePrivacy\n mirrorInitiatorStream?: boolean\n size?: Size\n minSize?: Size\n maxSize?: Size\n startInteractive?: boolean\n border?: BorderOptions\n positionType?: PositionType\n voiceActions?: VoiceAction[]\n visibility?: Visibility\n menuVisibility?: MenuVisibility\n closable?: boolean\n closeLabel?: string\n}\n\nexport type SetRootMenu = {\n menu: RootMenuEntry[]\n}\n\nexport type SettingsSchema = {\n /** A map of fields, NOT a full JSON schema — see `ConnectorOptions.settingsSchema`. */\n schema: SettingsSchemaProperties\n schemaUI: any\n}\n\nexport type SetFramePosition = {\n frameConnectorId: string\n position: LayoutPosition\n}\n\nexport type CloseFrame = {\n frameConnectorId: string\n}\n\nexport type SetFrameOwner = {\n frameConnectorId: string\n /** Device id of the new owner (HostInformation.devicesInSpace[].id). */\n owner: string\n}\n\n/// Live update of an already-open frame's shared-content style (background /\n/// box-shadow / drop-shadow surface, and companion icon). Emitted by\n/// `connector.setChromeStyle`. Only the provided fields are changed; the others\n/// keep their current value.\nexport type SetChromeStyle = {\n frameConnectorId: string\n} & ChromeStyle\n\n/// Host→app notification that an already-open shared frame's owner was\n/// reassigned via `setFrameOwner`, INCLUDING changes initiated by another\n/// device in the space. Surfaced on the SDK `Connector` as\n/// `onFrameOwnerChanged`. `owner` is the new owner's device id\n/// (HostInformation.devicesInSpace[].id).\nexport type FrameOwnerChanged = {\n frameConnectorId: string\n owner: string\n}\n\n/**\n * @deprecated Use `SetShareTargets` (`setShareTargets`).\n */\nexport type SetShareTarget = {\n shareTarget: ShareTargetOptions\n}\n\nexport type SetShareTargets = {\n shareTargets: ShareTargetOptions[]\n}\n\nexport type FrameUnloaded = {\n frameConnectorId: string\n}\n\nexport type FrameInfo = {\n frameConnectorId: string\n zIndex: number\n}\n\nexport type ShareDataReceived = {\n data: ShareData\n}\n\nexport type FileShareDataReceived = {\n data: FileData\n}\n\nexport type ShareData = {\n url: string\n}\n\nexport type TrackKind = 'audio' | 'video'\n\nexport type MediaTrackInfo = {\n id: string\n kind: TrackKind\n deviceName: string\n capabilities: MediaTrackCapabilities\n settings: MediaTrackSettings\n}\n\nexport type OpenStreamCompleted = {\n requestId: string\n streamId: string\n error?: string\n tracks?: MediaTrackInfo[]\n}\n\n/// One track of an app-provided shared stream. `readable` is the transferable\n/// output of a `MediaStreamTrackProcessor` (breakout box) — the host rebuilds a\n/// live `MediaStreamTrack` from it via `MediaStreamTrackGenerator`. Listed in\n/// the postMessage transfer list, so the host receives the SAME stream\n/// zero-copy (no re-encode) — works only when app and host are same-site\n/// (e.g. `*.apps.lavit.re` ↔ `app.lavit.re`) and Chromium.\nexport type ShareStreamTrack = {\n kind: TrackKind\n readable: ReadableStream\n settings?: MediaTrackSettings\n}\n\nexport type ShareStreamOptions = {\n /** Display label for the share (defaults to the app name). */\n name?: string\n /** Source resolution hint, used by the host to size the share. */\n width?: number\n height?: number\n /**\n * Controls how remote peers render this shared stream.\n *\n * - `'appFrame'` (default when absent): receivers load the app iframe, exactly\n * as before this field existed. N-1 receivers that do not know this field\n * will behave as `'appFrame'` automatically (backward-compatible).\n * - `'standard'`: receivers render a classic shared-video languette without\n * loading the app iframe. Use when the app provides raw video/audio and the\n * frame UI is not meaningful on the receiver side (e.g. a camera feed).\n */\n receiverDisplay?: 'standard' | 'appFrame'\n}\n\nexport type ShareStream = {\n requestId: string\n sharedStreamId: string\n options?: ShareStreamOptions\n tracks: ShareStreamTrack[]\n}\n\n/// Swap the source track(s) of an already-open app share WITHOUT closing it.\n/// The host swaps the underlying track in place (sender.replaceTrack on the\n/// vitre→peer side, no renegotiation), so peers see continuity.\nexport type ReplaceShareStream = {\n requestId: string\n sharedStreamId: string\n tracks: ShareStreamTrack[]\n}\n\nexport type StopShareStream = {\n sharedStreamId: string\n}\n\nexport type ShareStreamCompleted = {\n requestId: string\n sharedStreamId: string\n error?: string\n}\n\nexport type OpenStreamFrameCompleted = {\n requestId: string\n error?: string\n tracks?: MediaTrackInfo[]\n streamSourceUrl?: string\n}\n\nexport type EnumerateMediaDevicesCompleted = {\n requestId: string\n devices: ConnectedMediaDevice[]\n}\n\nexport type FramePositionUpdated = {\n frameConnectorId: string\n} & PositionUpdated\n\nexport type ExternalMessageReceived = {\n requestId: string\n appId: string\n message: any\n apiKeyId: string\n apiKeyName: string\n}\n\nexport type ExternalMessageResponseData = {\n requestId: string\n response?: any\n}\n\nexport type RequestAppTokenData = {\n requestId: string\n}\n\nexport type AppTokenReceivedData = {\n requestId: string\n token?: string\n error?: string\n}\n\nexport type ExecuteInFrameData = {\n requestId: string\n /** Must match the `name` attribute of the <iframe> embedded in frame.html. */\n frameName: string\n /** Runs as a function body — use `return <expr>` to yield a value. */\n code: string\n}\n\nexport type ExecuteInFrameResultData = {\n requestId: string\n /** JSON string of the injected code's return value; absent on error. */\n result?: string\n error?: string\n}\n\nexport type SetFrameSize = {\n frameId: string\n size: Size\n}\n\n/// Inbound to a Vitre `Connector` from a companion-side\n/// `CompanionConnector` (same `appId`). `fromCompanionId` is the\n/// connection-id of the sending companion so the Vitre connector can reply\n/// targeted-back via `sendMessageToCompanionConnector`.\nexport type MessageFromCompanionConnector = {\n fromCompanionId: string\n message: string\n fileData?: FileData\n}\n\n/// Inbound to a Vitre `Connector` when a companion FRAME sent a message via\n/// `CompanionFrame.sendMessageToVitreConnector` (works for a local companion\n/// frame with no paired Vitre frame). Carries the `frameConnectorId` of the\n/// companion frame that spoke, on top of the connector-message shape.\nexport type MessageFromCompanionFrame = {\n fromCompanionId: string\n frameConnectorId: string\n message: string\n fileData?: FileData\n}\n\n/// Inbound to a Vitre `Connector` when a connected companion clicks a\n/// menu entry that lives on a frame's options menu AND was declared with\n/// `availability: 'companion'` (or `'companionAdmin'`). The click did NOT\n/// fire on the Vitre — it fired on the companion-side render of the\n/// frame's options. The Vitre-side connector receives this so the app\n/// can react (typically: call `openCompanionFrame` from the companion's\n/// main connector, or push state into the frame). Distinct from\n/// `menuClicked` so apps that only care about Vitre-side menu clicks\n/// don't get woken up by companion clicks.\n///\n/// `frameConnectorId` is the id of the frame whose options menu was\n/// clicked; `fromCompanionId` is the connection-id of the clicker so\n/// targeted reactions are possible.\nexport type FrameMenuClickedOnCompanion = {\n frameConnectorId: string\n fromCompanionId: string\n menuId: string\n isChecked: boolean\n tag?: any\n}\n\n/// Target for `sendMessageToCompanionConnector` — broadcast to every\n/// companion currently connected to the Vitre, or address a single\n/// companion by id. Discriminated on `kind` so the union is unambiguous\n/// for callers and for the host that routes on this shape (a structural\n/// `{ all: true } | { companionId }` would let `{ all: true, companionId }`\n/// slip past the type system via an intermediate variable).\nexport type CompanionConnectorTarget =\n | { kind: 'all' }\n | { kind: 'one'; companionId: string }\n\n/// Payload emitted by a Vitre `Connector` when it wants to talk to the\n/// companion-side `CompanionConnector` for the same `appId`.\nexport type SendMessageToCompanionConnector = {\n target: CompanionConnectorTarget\n message: string\n fileData?: FileData\n}\n\nexport type ConnectorApiMessagesIn =\n | ({ type: 'devicePrivacyChanged' } & DevicePrivacyChanged)\n | ({ type: 'initialize' } & InitializeConnector)\n | ({ type: 'deviceJoined' } & DeviceJoined)\n | ({ type: 'deviceLeft' } & DeviceLeft)\n | ({ type: 'deviceMessageReceived' } & DeviceMessageReceived)\n | ({ type: 'deviceFullscreenUpdated' } & DeviceFullscreenUpdated)\n | ({ type: 'menuClicked' } & MenuClicked)\n | ({ type: 'fieldUpdated' } & FieldUpdated)\n | ({ type: 'shareDataReceived' } & ShareDataReceived)\n | ({ type: 'fileShareDataReceived' } & FileShareDataReceived)\n | ({ type: 'frameLoaded' } & FrameInfo)\n | ({ type: 'frameConnectorLoaded' } & FrameInfo)\n | ({ type: 'frameConnectorLoading' } & OpenFrame)\n | ({ type: 'privacyChanged' } & PrivacyChanged)\n | ({ type: 'frameUnloaded' } & FrameUnloaded)\n | ({\n type: 'enumerateMediaDevicesCompleted'\n } & EnumerateMediaDevicesCompleted)\n | ({ type: 'openStreamCompleted' } & OpenStreamCompleted)\n | ({ type: 'openStreamFrameCompleted' } & OpenStreamFrameCompleted)\n | ({ type: 'shareStreamCompleted' } & ShareStreamCompleted)\n | ({\n type: 'enumerateLoadedFramesCompleted'\n } & EnumerateLoadedFramesCompleted)\n | ({ type: 'localConnectorMessageReceived' } & LocalConnectorMessageReceived)\n | ({ type: 'extensionMessage' } & AppMessage)\n | ({ type: 'vitreSettingsResponse' } & VitreSettings)\n | ({ type: 'knockKnockReceived' } & KnockKnock)\n | ({ type: 'settingsUpdated' } & SettingsUpdated)\n | ({ type: 'vitreSettingsUpdated' } & VitreSettings)\n | ({ type: 'notificationDismissed' } & NotificationDismissed)\n | ({ type: 'notificationButtonClicked' } & NotificationButtonClicked)\n | ({ type: 'frameZIndexChanged' } & FrameInfo)\n | ({ type: 'deviceFrameLoaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameUnloaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameConnectorLoaded' } & DeviceFrameReference)\n | ({ type: 'pendingDevicesConnectionRequested' } & PendingDevicesInfo)\n | ({ type: 'appMessage' } & AppMessage)\n | ({ type: 'voiceActionDetected' } & VoiceActionDetection)\n | ({ type: 'framePositionUpdated' } & FramePositionUpdated)\n | ({ type: 'deviceScalingUpdated' } & DeviceScalingUpdated)\n | ({ type: 'stateReplaced' } & StateReplaced)\n | ({ type: 'statsResponse' } & StatsResponse)\n | ({ type: 'serialPortAccessResult'; requestId: string } & SerialPortAccessResult)\n | ({ type: 'frameOwnerChanged' } & FrameOwnerChanged)\n | ({ type: 'connectionCodeUpdated' } & ConnectionCodeUpdated)\n | ({ type: 'externalMessageReceived' } & ExternalMessageReceived)\n | ({ type: 'appTokenReceived' } & AppTokenReceivedData)\n | ({ type: 'appSettingsResponse' } & AppSettingsResponse)\n | ({ type: 'appSettingsChanged' } & AppSettingsChanged)\n | ({ type: 'publicStorageResponse' } & PublicStorageResponse)\n | ({ type: 'executeInFrameResult' } & ExecuteInFrameResultData)\n | ({ type: 'mediaDevicesChanged' } & MediaDevicesChanged)\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSyncComplete' }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocSyncComplete'; guid: string }\n | {\n type: 'crdtSubdocTransferProgress'\n guid: string\n receivedBytes: number\n totalBytes: number\n }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n | ({\n type: 'messageFromCompanionConnector'\n } & MessageFromCompanionConnector)\n | ({\n type: 'messageFromCompanionFrame'\n } & MessageFromCompanionFrame)\n | ({\n type: 'frameMenuClickedOnCompanion'\n } & FrameMenuClickedOnCompanion)\n\nexport type MediaDevicesChanged = {\n devices: ConnectedMediaDevice[]\n}\n\nexport type ConnectorApiMessagesOut =\n | ({ type: 'sendMessageTo' } & SendMessageTo)\n | ({ type: 'sendMessageToAll' } & SendMessageToAll)\n | ({ type: 'connectorInitialized' } & ConnectorInitialized)\n | ({ type: 'openFrame' } & OpenFrame)\n | ({ type: 'openLocalFrame' } & OpenLocalFrame)\n | ({ type: 'sendToLocalFrame' } & SendToLocalFrame)\n | ({ type: 'enumerateMediaDevices' } & EnumerateMediaDevices)\n | ({ type: 'openStream' } & OpenStream)\n | ({ type: 'openStreamFrame' } & OpenStreamFrame)\n | ({ type: 'shareStream' } & ShareStream)\n | ({ type: 'replaceShareStream' } & ReplaceShareStream)\n | ({ type: 'stopShareStream' } & StopShareStream)\n | ({ type: 'setRootMenu' } & SetRootMenu)\n | ({ type: 'enumerateLoadedFrames' } & EnumerateLoadedFrames)\n | ({ type: 'setShareTarget' } & SetShareTarget)\n | ({ type: 'setShareTargets' } & SetShareTargets)\n | ({ type: 'extensionMessage' } & AppMessage)\n | ({ type: 'appMessage' } & AppMessage)\n | { type: 'getVitreSettings' }\n | ({ type: 'setVitreSettings' } & VitreSettingsSetter)\n | ({ type: 'shareFile' } & ShareFileRequest)\n | ({ type: 'shareData' } & ShareDataRequest)\n | ({ type: 'saveSettings' } & SaveSettings)\n | ({ type: 'getAppSettings' } & GetAppSettings)\n | ({ type: 'setAppSettings' } & SetAppSettings)\n | ({ type: 'putPublicFile' } & PutPublicFile)\n | ({ type: 'deletePublicFile' } & DeletePublicFile)\n | ({ type: 'listPublicFiles' } & ListPublicFiles)\n | ({ type: 'changeTeamSpace' } & ChangeTeamSpace)\n | ({ type: 'changeTeamSpaceGuest' } & ChangeTeamSpaceGuest)\n | ({ type: 'showNotification' } & NotificationInfo)\n | ({ type: 'hideNotification' } & HideNotification)\n | ({ type: 'changePrivacy' } & ChangePrivacy)\n | ({ type: 'trackEvent' } & EventTelemetry)\n | ({ type: 'startTrackEvent' } & StartEventTelemetry)\n | ({ type: 'stopTrackEvent' } & EventTelemetry)\n | ({ type: 'setSettingsSchema' } & SettingsSchema)\n | { type: 'setVoiceActions'; actions: VoiceAction[] }\n | ({ type: 'closeFrame' } & CloseFrame)\n | ({ type: 'setFrameOwner' } & SetFrameOwner)\n | ({ type: 'setChromeStyle' } & SetChromeStyle)\n | ({ type: 'setFramePosition' } & SetFramePosition)\n | ({ type: 'updateState' } & UpdateState)\n | ({ type: 'sendKnockKnock' } & SendKnockKnock)\n | ({ type: 'getStats' } & GetStats)\n | ({ type: 'setReducedAudioMode' } & SetReducedAudioMode)\n | ({ type: 'externalMessageResponse' } & ExternalMessageResponseData)\n | ({ type: 'requestAppToken' } & RequestAppTokenData)\n | ({ type: 'executeInFrame' } & ExecuteInFrameData)\n | ({ type: 'setFrameSize' } & SetFrameSize)\n | ({ type: 'sendToSerialPort' } & SendToSerialPort)\n | ({ type: 'requestSerialPortAccess'; requestId: string } & RequestSerialPortAccess)\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestAwareness' }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n | ({\n type: 'sendMessageToCompanionConnector'\n } & SendMessageToCompanionConnector)\n"]}
@@ -1,7 +1,8 @@
1
1
  import type * as Y from 'yjs';
2
2
  import { CrdtChannel } from '../Common/CrdtChannel.js';
3
3
  import { BlobStore } from '../Common/BlobStore.js';
4
- import type { AppId, AppMessage, ChromeStyle, ConnectedMediaDevice, Device, DeviceFrameReference, DeviceFullscreenUpdated, DeviceMessageReceived, DeviceScalingUpdated, Field, FileData, HostInformation, KnockKnock, LayoutPosition, MessageTarget, NotificationButtonClicked, NotificationInfo, OpenFrameOptions, Privacy, ReplacedBy, RequestSerialPortAccess, SendKnockKnock, SendMessageTo, SendMessageToAll, SendToSerialPort, Size, StatsResponse, UpdatedStateEntry, UpdateStateEntry, VitreSettings, VitreSettingsSetter, VoiceAction, VoiceActionDetection } from '../Common/index.js';
4
+ import type { PublicStorageApi } from '../Common/PublicStorage.js';
5
+ import type { AppId, AppMessage, AppSettingsLevel, AppSettingsValue, ChromeStyle, ConnectedMediaDevice, Device, DeviceFrameReference, DeviceFullscreenUpdated, DeviceMessageReceived, DeviceScalingUpdated, Field, FileData, HostInformation, KnockKnock, LayoutPosition, MessageTarget, NotificationButtonClicked, NotificationInfo, OpenFrameOptions, Privacy, ReplacedBy, RequestSerialPortAccess, SendKnockKnock, SendMessageTo, SendMessageToAll, SendToSerialPort, Size, StatsResponse, UpdatedStateEntry, UpdateStateEntry, VitreSettings, VitreSettingsSetter, VoiceAction, VoiceActionDetection } from '../Common/index.js';
5
6
  import type { Frame } from '../Frame/index.js';
6
7
  import type { CompanionConnectorTarget, ExternalMessageReceived, ConnectorApiMessagesIn, ConnectorApiMessagesOut, ConnectorOptions, FrameInfo, FramePositionUpdated, InitializeConnector, MediaTrackInfo, OpenStreamFrame, RootMenuEntry, SettingsSchema, ShareData, ShareStreamOptions, ShareTargetOptions } from './Connector.Model.js';
7
8
  export declare class Connector {
@@ -28,6 +29,13 @@ export declare class Connector {
28
29
  onKnockKnockReceived?: (knockKnock: KnockKnock) => void;
29
30
  onPendingDevicesConnectionRequested?: (pendingClients: Device[]) => void;
30
31
  onSettingsUpdated?: (settings: any) => void;
32
+ /**
33
+ * Pushed whenever the AppSettings value at a given level changes — see
34
+ * {@link getSettings} / {@link setSettings}. Fires for changes made by
35
+ * this app itself as well as by another vitre/app instance sharing the
36
+ * same team/space. Added 1.52.
37
+ */
38
+ onSettingsChanged?: (change: AppSettingsValue) => void;
31
39
  onVitreSettingsUpdated?: (settings: VitreSettings) => void;
32
40
  onConnectionCodeUpdated?: (companionCode?: string) => void;
33
41
  onNotificationDismissed?: (notificationId: string) => void;
@@ -73,6 +81,13 @@ export declare class Connector {
73
81
  * but bare — see BlobStore.
74
82
  */
75
83
  readonly blobs: BlobStore;
84
+ /**
85
+ * Public, unauthenticated file storage scoped to the vitre's TEAM — see
86
+ * the README "Public storage" section for the full semantics (scopes,
87
+ * allowed file types, size cap, path rules). Files are readable by
88
+ * ANYONE at the returned URL — never put private data here.
89
+ */
90
+ readonly publicStorage: PublicStorageApi;
76
91
  /** @deprecated Use `crdt.doc`. The setter forwards to `crdt.attach(doc)`
77
92
  * so legacy callers that ever assigned `connector.yjsDoc = myDoc` keep
78
93
  * working — without it, getter-only would throw `TypeError: Cannot set
@@ -121,6 +136,11 @@ export declare class Connector {
121
136
  * share action.
122
137
  */
123
138
  canShareStream(): boolean;
139
+ /** Normalize `publicStorage.put`'s payload to a plain `ArrayBuffer` —
140
+ * slicing out exactly a typed array's view (not its whole underlying
141
+ * buffer, in case it's a subarray) so the transferred bytes match the
142
+ * size the caller intended. */
143
+ private toPublicFileBuffer;
124
144
  private toShareTracks;
125
145
  /**
126
146
  * Share a camera/microphone (or any) `MediaStream` the app controls TO the
@@ -175,6 +195,33 @@ export declare class Connector {
175
195
  */
176
196
  shareFile(fileData: FileData, targetAppId: AppId, owner?: string): void;
177
197
  saveSettings(settings: any): void;
198
+ /**
199
+ * Read the app's settings at one of the three levels — `vitre` (this
200
+ * vitre), `team` (the vitre's team), or `space` (the space the vitre is
201
+ * currently in). Every vitre/app instance of the team can read the same
202
+ * value; values are JSON objects capped at 64 KB — never store secrets.
203
+ *
204
+ * Distinct from the legacy `settingsSchema`/`saveSettings` mechanism (see
205
+ * {@link setSettingsSchema}, {@link saveSettings}), which is a single
206
+ * vitre-scoped blob rendered by the host's settings form.
207
+ *
208
+ * Rejects with an {@link AppSettingsError} of code `'unsupported'` if the
209
+ * host doesn't answer within 10s — a vitre host older than this feature
210
+ * never responds to `getAppSettings`.
211
+ */
212
+ getSettings(level: AppSettingsLevel): Promise<AppSettingsValue>;
213
+ /**
214
+ * Write the app's settings at `level`, with optimistic concurrency:
215
+ * `expectedVersion` must be the version last observed for that level (from
216
+ * {@link getSettings} or {@link onSettingsChanged}) — `0` if never
217
+ * written. A stale version rejects with an {@link AppSettingsError} of
218
+ * code `'conflict'`; re-read and retry. An oversized `value` (> 64 KB)
219
+ * rejects with `'tooLarge'`.
220
+ *
221
+ * Rejects with code `'unsupported'` if the host doesn't answer within
222
+ * 10s — see {@link getSettings}.
223
+ */
224
+ setSettings(level: AppSettingsLevel, value: Record<string, unknown>, expectedVersion: number): Promise<AppSettingsValue>;
178
225
  changeTeamSpace(space: string): void;
179
226
  changeTeamSpaceGuest(space: string, teamDomain: string): void;
180
227
  showNotification(notification: NotificationInfo): void;