@contrail/documents 2.4.0 → 2.5.0-alpha.ea3ab65

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/CHANGELOG.md CHANGED
@@ -5,6 +5,23 @@ All notable changes to `@contrail/documents` are documented here.
5
5
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
6
  Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.5.0] - 2026-10-05
9
+
10
+ ### Added
11
+
12
+ - `TransactionClientTraceFields` — `initiatedAt` (epoch ms the transaction was initiated, on the
13
+ sender's clock: the user's action completing, or the enqueue for a fallback), `initiatedSource`
14
+ (`TransactionInitiatedSource`: `user_action` | `enqueue_fallback`), and the sender's clock offset
15
+ estimate `initiatedClockOffsetMs` / `initiatedClockUncertaintyMs`. Carried, all optional, on
16
+ `WriteTransactionRequest`, `DocumentTransactionPayload`, `DocumentTransactionMessage` and
17
+ `DocumentTransaction`, so a receiver can measure an edit's path from the sender's action to its own
18
+ screen and correct for both clocks.
19
+ - `traceId?: string` on `WriteTransactionResponse`, `DocumentTransactionPayload`,
20
+ `DocumentTransactionMessage` and `DocumentTransaction` — the server's append-span trace id, so the
21
+ sender and every receiver can be joined to the backend trace.
22
+ - `createdOn?: string` on `DocumentTransaction` (replay items), matching what the broadcast already
23
+ carries, so replayed transactions can report the same legs as live ones.
24
+
8
25
  ## [2.4.0] - 2026-09-26
9
26
 
10
27
  Also shipped on the 1.x line as 1.21.0.
@@ -11,7 +11,14 @@ export type DocumentOperation = {
11
11
  elementId: string;
12
12
  };
13
13
  export type DocumentElementPatch = Partial<Omit<DocumentElement, 'id' | 'documentId'>>;
14
- interface WriteTransactionRequestBase {
14
+ export type TransactionInitiatedSource = 'user_action' | 'enqueue_fallback';
15
+ export interface TransactionClientTraceFields {
16
+ initiatedAt?: number;
17
+ initiatedSource?: TransactionInitiatedSource;
18
+ initiatedClockOffsetMs?: number;
19
+ initiatedClockUncertaintyMs?: number;
20
+ }
21
+ interface WriteTransactionRequestBase extends TransactionClientTraceFields {
15
22
  clientTransactionId?: string;
16
23
  }
17
24
  export interface InlineWriteTransactionRequest extends WriteTransactionRequestBase {
@@ -28,10 +35,13 @@ export interface WriteTransactionResponse {
28
35
  createdOn: string;
29
36
  createdById: string;
30
37
  clientTransactionId?: string;
38
+ traceId?: string;
31
39
  }
32
- interface DocumentTransactionBase {
40
+ interface DocumentTransactionBase extends TransactionClientTraceFields {
33
41
  sequenceNumber: number;
34
42
  clientTransactionId?: string;
43
+ createdOn?: string;
44
+ traceId?: string;
35
45
  }
36
46
  export interface InlineDocumentTransaction extends DocumentTransactionBase {
37
47
  operations: DocumentOperation[];
@@ -47,12 +57,13 @@ export interface GetDocumentTransactionsResponse {
47
57
  hasMore: boolean;
48
58
  lastReturnedSequenceNumber: number;
49
59
  }
50
- interface DocumentTransactionMessageBase {
60
+ interface DocumentTransactionMessageBase extends TransactionClientTraceFields {
51
61
  type: 'DOCUMENT_TRANSACTION';
52
62
  documentId: string;
53
63
  sequenceNumber: number;
54
64
  createdOn: string;
55
65
  clientTransactionId?: string;
66
+ traceId?: string;
56
67
  }
57
68
  export type DocumentTransactionMessage = (DocumentTransactionMessageBase & {
58
69
  operations: DocumentOperation[];
@@ -68,7 +79,8 @@ export interface TransactionUploadTarget {
68
79
  }
69
80
  export type DocumentTransactionPayload = {
70
81
  clientTransactionId?: string;
71
- } & ({
82
+ traceId?: string;
83
+ } & TransactionClientTraceFields & ({
72
84
  operations: DocumentOperation[];
73
85
  operationsS3Key?: never;
74
86
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "2.4.0",
3
+ "version": "2.5.0-alpha.ea3ab65",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",