@agentshouse/mdruntime-adapter 0.1.0-c13e5bc38b145 → 0.1.0-c159093d95310

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/dist/read.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { type AdapterFailure, type BinaryFile, type BootstrapPage, type RefreshResult } from '@agentshouse/mdruntime';
1
+ import { type AdapterFailure, type BinaryFile, type BootstrapPage, type RefreshResult, type TransportUncertainty } from '@agentshouse/mdruntime';
2
2
  import type { TrackedAuthority } from './discovery.js';
3
+ import { type HousePart } from './part.js';
3
4
  import type { HouseMode } from './transport.js';
4
5
  import { type LogPosition } from './version.js';
5
6
  export type HeadChange = BootstrapPage['changes'][string];
@@ -10,10 +11,13 @@ export type Answered = {
10
11
  readonly changes: Map<string, HeadChange>;
11
12
  readonly binaryFiles: Map<string, BinaryFile>;
12
13
  readonly removals: Set<string>;
14
+ readonly folders: Set<string>;
15
+ readonly folderRemovals: Set<string>;
13
16
  };
14
17
  export declare function answering(): Answered;
15
18
  export declare function revised(answer: Answered, path: string, revision: string): void;
16
19
  export declare function forgotten(answer: Answered, path: string): void;
20
+ export declare function folded(answer: Answered, path: string, removed: boolean): void;
17
21
  export declare function answered(answer: Answered): Generator<number, {
18
22
  documents: Readonly<Record<string, string>>;
19
23
  revisions: Readonly<Record<string, string>>;
@@ -21,6 +25,8 @@ export declare function answered(answer: Answered): Generator<number, {
21
25
  changes: Readonly<Record<string, HeadChange>>;
22
26
  binaryFiles: Readonly<Record<string, BinaryFile>>;
23
27
  removals: readonly string[];
28
+ folders?: readonly string[];
29
+ folderRemovals?: readonly string[];
24
30
  }, void>;
25
31
  export type HouseManifestFile = {
26
32
  path: string;
@@ -38,28 +44,26 @@ export type HouseScope = LogPosition & {
38
44
  anchor: string;
39
45
  files: readonly HouseManifestFile[];
40
46
  contents: readonly HouseContent[];
47
+ folders?: readonly string[];
41
48
  };
42
- export type HouseCut = {
43
- position: string;
44
- log_epoch: string;
45
- };
46
- export type HouseCursor = {
47
- room: string;
48
- path: string | null;
49
- cut?: HouseCut;
49
+ export type HouseRoomParts = LogPosition & {
50
+ anchor: string;
51
+ parts: readonly HousePart[];
50
52
  };
51
- export type HouseEnvelope = {
52
- scopes: readonly HouseScope[];
53
- next?: HouseCursor;
53
+ export type HouseParted = {
54
+ rooms: readonly HouseRoomParts[];
55
+ next?: string;
54
56
  };
55
57
  export type HouseGrant = {
56
- method: 'GET';
57
- url: string;
58
- } | {
59
- method: 'POST';
60
58
  operation: string;
61
59
  url: string;
62
60
  };
61
+ export type HouseFileAddress = {
62
+ url: string;
63
+ name: string;
64
+ sha256: string;
65
+ mediaType: string;
66
+ };
63
67
  export type HouseChange = {
64
68
  path: string;
65
69
  removed: true;
@@ -81,9 +85,14 @@ export type HousePage = {
81
85
  through: string;
82
86
  read: number;
83
87
  };
88
+ export type HouseFolder = {
89
+ path: string;
90
+ removed: boolean;
91
+ };
84
92
  export type HouseView = LogPosition & {
85
93
  authority: string;
86
94
  changes: readonly HouseChange[];
95
+ folders?: readonly HouseFolder[];
87
96
  next?: HousePage;
88
97
  };
89
98
  type PageFailure = AdapterFailure | {
@@ -95,19 +104,19 @@ export type HouseEnumeration = {
95
104
  export declare function authorityRoot(handle: string): string;
96
105
  export declare function schemaPath(handle: string, schema: string): string;
97
106
  export declare function parseGrant(body: unknown): HouseGrant | null;
107
+ export declare function parseFileAddress(body: unknown): HouseFileAddress | null;
98
108
  export declare function headChange(held: {
99
109
  readonly author?: unknown;
100
110
  readonly created_at?: unknown;
101
111
  }): HeadChange | undefined | null;
102
112
  export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
103
- export declare function parseEnvelope(body: unknown): Generator<number, HouseEnvelope | null, void>;
104
- export declare function parseSiteBootstrap(body: unknown): Generator<number, HouseScope | null, void>;
105
- export declare function siteBootstrapNext(body: unknown): string | null;
106
- export declare function siteBootstrapOffset(body: unknown): number | null;
113
+ export declare function parseParted(body: unknown): HouseParted | null;
114
+ export declare function parseSiteParted(body: unknown): HouseRoomParts | null;
115
+ export declare function emptyScope(room: HouseRoomParts): HouseScope;
116
+ export declare function housePart(room: HouseRoomParts, body: unknown, listed: HousePart, mode: HouseMode): Promise<HouseScope | TransportUncertainty | null>;
107
117
  export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
108
118
  export declare function wholeView(first: HouseView, more: (page: HousePage) => Promise<HouseView | PageFailure>): Promise<HouseView | PageFailure>;
109
119
  export declare function advancedScope(scope: HouseScope, view: HouseView): Generator<number, HouseScope, void>;
110
- export declare function matchesScope(scope: HouseScope, tracked: TrackedAuthority): boolean;
111
120
  export declare function bootstrapping(scope: HouseScope): Generator<number, BootstrapPage, void>;
112
121
  export type HouseSchema = {
113
122
  schema: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAsC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpF,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAQ1D,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,G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AgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAO9E;AAED,wBAAgB,MAAM,CACpB,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,SAAS,GAAG,SAAS,CAEvB;AA0BD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,SAAS,EACf,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,aAAa,CAAC,CAExB"}
package/dist/read.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { patching, ROW_WEIGHT, stepped, } from '@agentshouse/mdruntime';
2
+ import { checkedPayload, gunzipped, parsePart } from './part.js';
2
3
  import { DECIMAL, readPosition, roomVersion } from './version.js';
3
4
  const REVISION_FILE = /^fr_([0-9a-z]+)\.[0-9a-z]+\.[0-9a-z]$/u;
4
5
  function fileOf(revision) {
@@ -12,6 +13,8 @@ export function answering() {
12
13
  changes: new Map(),
13
14
  binaryFiles: new Map(),
14
15
  removals: new Set(),
16
+ folders: new Set(),
17
+ folderRemovals: new Set(),
15
18
  };
16
19
  }
17
20
  export function revised(answer, path, revision) {
@@ -28,12 +31,26 @@ export function forgotten(answer, path) {
28
31
  answer.binaryFiles.delete(path);
29
32
  answer.removals.delete(path);
30
33
  }
31
- export function* answered(answer) {
32
- const removals = [];
33
- for (const path of answer.removals) {
34
- removals.push(path);
34
+ export function folded(answer, path, removed) {
35
+ if (removed) {
36
+ answer.folders.delete(path);
37
+ answer.folderRemovals.add(path);
38
+ }
39
+ else {
40
+ answer.folderRemovals.delete(path);
41
+ answer.folders.add(path);
42
+ }
43
+ }
44
+ function* pathsOf(paths) {
45
+ const list = [];
46
+ for (const path of paths) {
47
+ list.push(path);
35
48
  yield ROW_WEIGHT;
36
49
  }
50
+ return list;
51
+ }
52
+ export function* answered(answer) {
53
+ const removals = yield* pathsOf(answer.removals);
37
54
  return {
38
55
  documents: yield* patching({}, answer.documents),
39
56
  revisions: yield* patching({}, answer.revisions),
@@ -41,6 +58,10 @@ export function* answered(answer) {
41
58
  changes: yield* patching({}, answer.changes),
42
59
  binaryFiles: yield* patching({}, answer.binaryFiles),
43
60
  removals,
61
+ ...(answer.folders.size === 0 ? {} : { folders: yield* pathsOf(answer.folders) }),
62
+ ...(answer.folderRemovals.size === 0
63
+ ? {}
64
+ : { folderRemovals: yield* pathsOf(answer.folderRemovals) }),
44
65
  };
45
66
  }
46
67
  export function authorityRoot(handle) {
@@ -58,22 +79,37 @@ export function parseGrant(body) {
58
79
  const transfer = body.transfer;
59
80
  if (typeof transfer.url !== 'string')
60
81
  return null;
61
- if (transfer.method === 'GET')
62
- return { method: 'GET', url: transfer.url };
63
82
  if (transfer.method !== 'POST' || typeof transfer.operation !== 'string')
64
83
  return null;
65
- return { method: 'POST', operation: transfer.operation, url: transfer.url };
84
+ return { operation: transfer.operation, url: transfer.url };
85
+ }
86
+ export function parseFileAddress(body) {
87
+ if (typeof body !== 'object' || body === null)
88
+ return null;
89
+ const { download, name, sha256, media_type: mediaType } = body;
90
+ if (typeof download !== 'string' ||
91
+ typeof name !== 'string' ||
92
+ typeof sha256 !== 'string' ||
93
+ typeof mediaType !== 'string') {
94
+ return null;
95
+ }
96
+ return { url: download, name, sha256, mediaType };
66
97
  }
67
98
  function changeAuthor(value) {
68
99
  if (typeof value !== 'object' || value === null)
69
100
  return null;
70
- const { user, site, name } = value;
101
+ const { user, site, inbox, name } = value;
71
102
  if (typeof name !== 'string')
72
103
  return null;
73
- if (typeof user === 'string' && site === undefined)
104
+ const named = [user, site, inbox].filter((id) => id !== undefined);
105
+ if (named.length !== 1)
106
+ return null;
107
+ if (typeof user === 'string')
74
108
  return { kind: 'user', id: user, name };
75
- if (typeof site === 'string' && user === undefined)
109
+ if (typeof site === 'string')
76
110
  return { kind: 'site', id: site, name };
111
+ if (typeof inbox === 'string')
112
+ return { kind: 'inbox', id: inbox, name };
77
113
  return null;
78
114
  }
79
115
  export function headChange(held) {
@@ -135,13 +171,13 @@ function parseFile(value, mode) {
135
171
  ...binaried(binary),
136
172
  };
137
173
  }
138
- function* parseScope(value, mode) {
174
+ function parseRoomParts(value) {
139
175
  if (typeof value !== 'object' || value === null)
140
176
  return null;
141
177
  const held = value;
142
178
  if (typeof held.manifest !== 'object' || held.manifest === null)
143
179
  return null;
144
- if (!Array.isArray(held.contents))
180
+ if (!Array.isArray(held.parts))
145
181
  return null;
146
182
  const manifest = held.manifest;
147
183
  if (manifest.scope !== 'room')
@@ -151,79 +187,103 @@ function* parseScope(value, mode) {
151
187
  return null;
152
188
  if (typeof manifest.room_handle !== 'string' || manifest.room_handle.length === 0)
153
189
  return null;
154
- if (!Array.isArray(manifest.files))
155
- return null;
156
- const files = [];
157
- for (const entry of manifest.files) {
158
- const file = parseFile(entry, mode);
159
- if (file === null)
190
+ const parts = [];
191
+ for (const entry of held.parts) {
192
+ const part = parsePart(entry);
193
+ if (part === null)
160
194
  return null;
161
- files.push(file);
162
- yield ROW_WEIGHT;
163
- }
164
- const contents = [];
165
- for (const entry of held.contents) {
166
- if (typeof entry !== 'object' || entry === null)
167
- return null;
168
- const content = entry;
169
- if (typeof content.path !== 'string' || typeof content.content !== 'string')
170
- return null;
171
- contents.push({ path: content.path, content: content.content });
172
- yield ROW_WEIGHT;
195
+ parts.push(part);
173
196
  }
174
- return { anchor: manifest.anchor, ...at, files, contents };
175
- }
176
- function parseCut(value) {
177
- if (value === undefined)
178
- return undefined;
179
- if (typeof value !== 'object' || value === null)
180
- return null;
181
- const { position, log_epoch: logEpoch } = value;
182
- if (typeof position !== 'string' || typeof logEpoch !== 'string')
183
- return null;
184
- return { position, log_epoch: logEpoch };
185
- }
186
- function parseCursor(value) {
187
- if (typeof value !== 'object' || value === null)
188
- return null;
189
- const { room, path, cut } = value;
190
- if (typeof room !== 'string' || (path !== null && typeof path !== 'string'))
191
- return null;
192
- const parsed = parseCut(cut);
193
- if (parsed === null)
194
- return null;
195
- return { room, path, ...(parsed === undefined ? {} : { cut: parsed }) };
197
+ return { anchor: manifest.anchor, ...at, parts };
196
198
  }
197
- export function* parseEnvelope(body) {
199
+ export function parseParted(body) {
198
200
  if (typeof body !== 'object' || body === null)
199
201
  return null;
200
202
  if (!('scopes' in body) || !Array.isArray(body.scopes))
201
203
  return null;
202
- const scopes = [];
204
+ const rooms = [];
203
205
  for (const entry of body.scopes) {
204
- const scope = yield* parseScope(entry, 'credential');
205
- if (scope === null)
206
+ const room = parseRoomParts(entry);
207
+ if (room === null)
206
208
  return null;
207
- scopes.push(scope);
209
+ rooms.push(room);
208
210
  }
209
211
  if (!('next' in body) || body.next === undefined)
210
- return { scopes };
211
- const next = parseCursor(body.next);
212
- return next === null ? null : { scopes, next };
212
+ return { rooms };
213
+ const next = body.next;
214
+ if (typeof next !== 'object' || next === null || typeof next.room !== 'string')
215
+ return null;
216
+ return { rooms, next: next.room };
217
+ }
218
+ export function parseSiteParted(body) {
219
+ return parseRoomParts(body);
220
+ }
221
+ export function emptyScope(room) {
222
+ return {
223
+ anchor: room.anchor,
224
+ position: room.position,
225
+ logEpoch: room.logEpoch,
226
+ files: [],
227
+ contents: [],
228
+ };
229
+ }
230
+ function* partLines(text, mode) {
231
+ const files = [];
232
+ const contents = [];
233
+ const folders = [];
234
+ let start = 0;
235
+ while (start < text.length) {
236
+ const end = text.indexOf('\n', start);
237
+ if (end === -1)
238
+ return null;
239
+ let entry;
240
+ try {
241
+ entry = JSON.parse(text.slice(start, end));
242
+ }
243
+ catch {
244
+ return null;
245
+ }
246
+ start = end + 1;
247
+ if (folderLine(entry)) {
248
+ folders.push(entry.folder);
249
+ yield ROW_WEIGHT;
250
+ continue;
251
+ }
252
+ const file = parseFile(entry, mode);
253
+ if (file === null)
254
+ return null;
255
+ files.push(file);
256
+ const { content } = entry;
257
+ if (typeof content === 'string')
258
+ contents.push({ path: file.path, content });
259
+ else if (content !== undefined)
260
+ return null;
261
+ yield ROW_WEIGHT;
262
+ }
263
+ return { files, contents, folders };
213
264
  }
214
- export function* parseSiteBootstrap(body) {
215
- return yield* parseScope(body, 'site');
265
+ function folderLine(entry) {
266
+ if (typeof entry !== 'object' || entry === null || !('folder' in entry))
267
+ return false;
268
+ return typeof entry.folder === 'string' && Object.keys(entry).length === 1;
216
269
  }
217
- export function siteBootstrapNext(body) {
218
- if (typeof body !== 'object' || body === null || !('next' in body))
270
+ export async function housePart(room, body, listed, mode) {
271
+ const payload = await checkedPayload(body, listed);
272
+ if (payload === null)
219
273
  return null;
220
- return typeof body.next === 'string' && body.next.length > 0 ? body.next : null;
274
+ const text = await gunzipped(payload);
275
+ const read = text === null ? null : await stepped(partLines(text, mode));
276
+ return read === null ? { kind: 'transport-uncertainty' } : { ...emptyScope(room), ...read };
221
277
  }
222
- export function siteBootstrapOffset(body) {
223
- if (typeof body !== 'object' || body === null || !('offset' in body))
278
+ function folderChange(value) {
279
+ if (typeof value !== 'object' || value === null)
224
280
  return null;
225
- return Number.isSafeInteger(body.offset) && body.offset > 0
226
- ? body.offset
281
+ const { path, folder, removed, ...rest } = value;
282
+ return typeof path === 'string' &&
283
+ folder === true &&
284
+ (removed === undefined || removed === true) &&
285
+ Object.keys(rest).length === 0
286
+ ? { path, removed: removed === true }
227
287
  : null;
228
288
  }
229
289
  function parseChange(value, mode) {
@@ -282,7 +342,13 @@ export function parseEnumeration(body, mode) {
282
342
  if (!Array.isArray(held.changes))
283
343
  return null;
284
344
  const changes = [];
345
+ const folders = [];
285
346
  for (const change of held.changes) {
347
+ const folder = folderChange(change);
348
+ if (folder !== null) {
349
+ folders.push(folder);
350
+ continue;
351
+ }
286
352
  const mapped = parseChange(change, mode);
287
353
  if (mapped === null)
288
354
  return null;
@@ -295,6 +361,7 @@ export function parseEnumeration(body, mode) {
295
361
  authority: held.authority,
296
362
  ...at,
297
363
  changes,
364
+ ...(folders.length === 0 ? {} : { folders }),
298
365
  ...(next === undefined ? {} : { next }),
299
366
  });
300
367
  }
@@ -318,6 +385,7 @@ function advances(asked, next) {
318
385
  }
319
386
  export async function wholeView(first, more) {
320
387
  const changes = new Map(first.changes.map((change) => [change.path, change]));
388
+ const folders = new Map((first.folders ?? []).map((folder) => [folder.path, folder]));
321
389
  let view = first;
322
390
  while (view.next !== undefined) {
323
391
  const asked = view.next;
@@ -333,6 +401,10 @@ export async function wholeView(first, more) {
333
401
  changes.delete(change.path);
334
402
  changes.set(change.path, change);
335
403
  }
404
+ for (const folder of page.folders ?? []) {
405
+ folders.delete(folder.path);
406
+ folders.set(folder.path, folder);
407
+ }
336
408
  view = page;
337
409
  }
338
410
  return {
@@ -340,6 +412,7 @@ export async function wholeView(first, more) {
340
412
  position: view.position,
341
413
  logEpoch: first.logEpoch,
342
414
  changes: [...changes.values()],
415
+ ...(folders.size === 0 ? {} : { folders: [...folders.values()] }),
343
416
  };
344
417
  }
345
418
  export function* advancedScope(scope, view) {
@@ -369,9 +442,17 @@ export function* advancedScope(scope, view) {
369
442
  if ('content' in change)
370
443
  contents.set(change.path, change.content);
371
444
  }
372
- const listed = [];
445
+ const kept = [];
373
446
  for (const [path, content] of contents) {
374
- listed.push({ path, content });
447
+ kept.push({ path, content });
448
+ yield ROW_WEIGHT;
449
+ }
450
+ const folders = new Set(scope.folders);
451
+ for (const folder of view.folders ?? []) {
452
+ if (folder.removed)
453
+ folders.delete(folder.path);
454
+ else
455
+ folders.add(folder.path);
375
456
  yield ROW_WEIGHT;
376
457
  }
377
458
  return {
@@ -379,12 +460,10 @@ export function* advancedScope(scope, view) {
379
460
  position: view.position,
380
461
  logEpoch: view.logEpoch,
381
462
  files: [...files.values()],
382
- contents: listed,
463
+ contents: kept,
464
+ ...(folders.size === 0 ? {} : { folders: [...folders] }),
383
465
  };
384
466
  }
385
- export function matchesScope(scope, tracked) {
386
- return scope.anchor === tracked.authority;
387
- }
388
467
  export function* bootstrapping(scope) {
389
468
  const contents = new Map();
390
469
  for (const entry of scope.contents) {
@@ -404,7 +483,9 @@ export function* bootstrapping(scope) {
404
483
  if (file.revision !== undefined)
405
484
  revised(answer, file.path, file.revision);
406
485
  }
407
- const { removals: _removals, ...page } = yield* answered(answer);
486
+ for (const folder of scope.folders ?? [])
487
+ folded(answer, folder, false);
488
+ const { removals: _removals, folderRemovals: _folderRemovals, ...page } = yield* answered(answer);
408
489
  return { kind: 'bootstrap', roomVersion: roomVersion(scope), ...page };
409
490
  }
410
491
  export function schemaOf(scope, schema) {
@@ -438,6 +519,10 @@ function* refreshing(view, fromRoomVersion) {
438
519
  if (change.revision !== undefined)
439
520
  revised(answer, change.path, change.revision);
440
521
  }
522
+ for (const folder of view.folders ?? []) {
523
+ yield ROW_WEIGHT;
524
+ folded(answer, folder.path, folder.removed);
525
+ }
441
526
  return { kind: 'net-advancement', roomVersion: roomVersion(view), ...(yield* answered(answer)) };
442
527
  }
443
528
  export async function refreshFrom(view, fromRoomVersion) {
@@ -1,7 +1,9 @@
1
+ import type { ReferrerScope } from '@agentshouse/mdruntime';
1
2
  import type { TrackedAuthority } from './discovery.js';
2
3
  export type HouseReferrer = {
3
4
  locator: string;
4
5
  referrer: Readonly<Record<string, string>>;
5
6
  };
6
7
  export declare function houseReferrer(referrer: unknown, tracked: ReadonlyMap<string, TrackedAuthority>): HouseReferrer | null;
8
+ export declare function houseReferrerScope(referrer: unknown, tracked: ReadonlyMap<string, TrackedAuthority>): ReferrerScope | null;
7
9
  //# sourceMappingURL=referrer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"referrer.d.ts","sourceRoot":"","sources":["../src/referrer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC;AAgB5F,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAC7C,aAAa,GAAG,IAAI,CAqBtB"}
1
+ {"version":3,"file":"referrer.d.ts","sourceRoot":"","sources":["../src/referrer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC;AAgB5F,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAC7C,aAAa,GAAG,IAAI,CAoBtB;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAC7C,aAAa,GAAG,IAAI,CAOtB"}
package/dist/referrer.js CHANGED
@@ -29,7 +29,13 @@ export function houseReferrer(referrer, tracked) {
29
29
  referrer: { room_ref: roomRef, record: held.record },
30
30
  };
31
31
  }
32
- if (named(held, 'message'))
33
- return { locator: '', referrer: { message: held.message } };
34
32
  return null;
35
33
  }
34
+ export function houseReferrerScope(referrer, tracked) {
35
+ const held = fields(referrer);
36
+ if (held !== null && named(held, 'room', 'path')) {
37
+ return { locator: held.room, path: held.path };
38
+ }
39
+ const found = houseReferrer(referrer, tracked);
40
+ return found === null ? null : { locator: found.locator };
41
+ }
@@ -0,0 +1,6 @@
1
+ export declare const INBOX_CHANNEL_KINDS: readonly ['telegram-bot'];
2
+ export type InboxChannelKind = (typeof INBOX_CHANNEL_KINDS)[number];
3
+ export declare const INBOX_CHAT_TYPE = "inbox-chat";
4
+ export declare const INBOX_MESSAGE_TYPE = "inbox-message";
5
+ export declare const HOUSE_ROOM_TYPES: string;
6
+ //# sourceMappingURL=room-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-types.d.ts","sourceRoot":"","sources":["../src/room-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,YAAI,cAAc,CAAU,CAAC;AAE7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAalD,eAAO,MAAM,gBAAgB,QAsDjB,CAAC"}
@@ -0,0 +1,66 @@
1
+ export const INBOX_CHANNEL_KINDS = ['telegram-bot'];
2
+ export const INBOX_CHAT_TYPE = 'inbox-chat';
3
+ export const INBOX_MESSAGE_TYPE = 'inbox-message';
4
+ const IDENTITY = "{ type: string, pattern: '^\\S+$' }";
5
+ const AGENT = [' agent: { type: string, format: uuid }', ' name: { type: string }'];
6
+ const ASSIGNEE = [
7
+ ' type: object',
8
+ ' properties:',
9
+ ' user: { type: string, format: uuid }',
10
+ ...AGENT,
11
+ ];
12
+ export const HOUSE_ROOM_TYPES = [
13
+ `${INBOX_CHAT_TYPE}:`,
14
+ ' properties:',
15
+ ' inbox: { type: string, format: uuid }',
16
+ ` channel: { enum: [${INBOX_CHANNEL_KINDS.join(', ')}] }`,
17
+ ` chat: ${IDENTITY}`,
18
+ ' customer:',
19
+ ' type: object',
20
+ ' properties:',
21
+ ' name: { type: string }',
22
+ ` username: ${IDENTITY}`,
23
+ ` phone: ${IDENTITY}`,
24
+ ' assignee:',
25
+ ...ASSIGNEE,
26
+ ' return_to:',
27
+ ' type: object',
28
+ ' properties:',
29
+ ...AGENT,
30
+ ' conversation: { type: string, format: uuid }',
31
+ ' required: [inbox, channel, chat, customer]',
32
+ `${INBOX_MESSAGE_TYPE}:`,
33
+ ' properties:',
34
+ ' direction: { enum: [in, out] }',
35
+ ' sender:',
36
+ ' type: object',
37
+ ' properties:',
38
+ ' name: { type: string }',
39
+ ` username: ${IDENTITY}`,
40
+ ' sent_at: { type: string, format: date-time }',
41
+ ` channel_message: ${IDENTITY}`,
42
+ ' state: { enum: [sending, sent, failed] }',
43
+ ' reason: { type: string }',
44
+ ' reactions:',
45
+ ' type: array',
46
+ ' items:',
47
+ ' type: object',
48
+ ' properties:',
49
+ ' reaction: { type: string, minLength: 1 }',
50
+ ' sender:',
51
+ ' type: object',
52
+ ' properties:',
53
+ ` id: ${IDENTITY}`,
54
+ ' name: { type: string }',
55
+ ` username: ${IDENTITY}`,
56
+ ' count: { type: integer, minimum: 1 }',
57
+ ' required: [reaction]',
58
+ ` post: ${IDENTITY}`,
59
+ ' assignee:',
60
+ ...ASSIGNEE,
61
+ ' sent_outside: { const: true }',
62
+ ' required: [direction]',
63
+ ' if: { properties: { direction: { const: in } } }',
64
+ ' then: { required: [sent_at] }',
65
+ '',
66
+ ].join('\n');
@@ -1 +1 @@
1
- {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAUR,MAAM,wBAAwB,CAAC;AA4BhC,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAyCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAwR1F"}
1
+ {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAUR,MAAM,wBAAwB,CAAC;AA8BhC,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAuCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAoQ1F"}