@open-docex/shared 0.0.0-stage → 0.1.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.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +101 -2
  3. package/dist/errors/catalogue.d.ts +30 -0
  4. package/dist/errors/catalogue.d.ts.map +1 -0
  5. package/dist/errors/catalogue.js +52 -0
  6. package/dist/errors/catalogue.js.map +1 -0
  7. package/dist/errors/index.d.ts +9 -0
  8. package/dist/errors/index.d.ts.map +1 -0
  9. package/dist/errors/index.js +9 -0
  10. package/dist/errors/index.js.map +1 -0
  11. package/dist/errors/open-docex-error.d.ts +81 -0
  12. package/dist/errors/open-docex-error.d.ts.map +1 -0
  13. package/dist/errors/open-docex-error.js +127 -0
  14. package/dist/errors/open-docex-error.js.map +1 -0
  15. package/dist/ids/index.d.ts +41 -0
  16. package/dist/ids/index.d.ts.map +1 -0
  17. package/dist/ids/index.js +70 -0
  18. package/dist/ids/index.js.map +1 -0
  19. package/dist/index.d.ts +16 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +16 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/ot/index.d.ts +4 -0
  24. package/dist/ot/index.d.ts.map +1 -0
  25. package/dist/ot/index.js +3 -0
  26. package/dist/ot/index.js.map +1 -0
  27. package/dist/ot/types.d.ts +55 -0
  28. package/dist/ot/types.d.ts.map +1 -0
  29. package/dist/ot/types.js +11 -0
  30. package/dist/ot/types.js.map +1 -0
  31. package/dist/protocol/close-codes.d.ts +39 -0
  32. package/dist/protocol/close-codes.d.ts.map +1 -0
  33. package/dist/protocol/close-codes.js +47 -0
  34. package/dist/protocol/close-codes.js.map +1 -0
  35. package/dist/protocol/codec.d.ts +32 -0
  36. package/dist/protocol/codec.d.ts.map +1 -0
  37. package/dist/protocol/codec.js +270 -0
  38. package/dist/protocol/codec.js.map +1 -0
  39. package/dist/protocol/frames.d.ts +45 -0
  40. package/dist/protocol/frames.d.ts.map +1 -0
  41. package/dist/protocol/frames.js +125 -0
  42. package/dist/protocol/frames.js.map +1 -0
  43. package/dist/protocol/index.d.ts +12 -0
  44. package/dist/protocol/index.d.ts.map +1 -0
  45. package/dist/protocol/index.js +12 -0
  46. package/dist/protocol/index.js.map +1 -0
  47. package/dist/protocol/messages.d.ts +250 -0
  48. package/dist/protocol/messages.d.ts.map +1 -0
  49. package/dist/protocol/messages.js +7 -0
  50. package/dist/protocol/messages.js.map +1 -0
  51. package/dist/protocol/validate.d.ts +61 -0
  52. package/dist/protocol/validate.d.ts.map +1 -0
  53. package/dist/protocol/validate.js +139 -0
  54. package/dist/protocol/validate.js.map +1 -0
  55. package/dist/text/apply.d.ts +27 -0
  56. package/dist/text/apply.d.ts.map +1 -0
  57. package/dist/text/apply.js +151 -0
  58. package/dist/text/apply.js.map +1 -0
  59. package/dist/text/chunk.d.ts +33 -0
  60. package/dist/text/chunk.d.ts.map +1 -0
  61. package/dist/text/chunk.js +152 -0
  62. package/dist/text/chunk.js.map +1 -0
  63. package/dist/text/equal.d.ts +4 -0
  64. package/dist/text/equal.d.ts.map +1 -0
  65. package/dist/text/equal.js +16 -0
  66. package/dist/text/equal.js.map +1 -0
  67. package/dist/text/href.d.ts +13 -0
  68. package/dist/text/href.d.ts.map +1 -0
  69. package/dist/text/href.js +31 -0
  70. package/dist/text/href.js.map +1 -0
  71. package/dist/text/index.d.ts +18 -0
  72. package/dist/text/index.d.ts.map +1 -0
  73. package/dist/text/index.js +14 -0
  74. package/dist/text/index.js.map +1 -0
  75. package/dist/text/ot.d.ts +7 -0
  76. package/dist/text/ot.d.ts.map +1 -0
  77. package/dist/text/ot.js +136 -0
  78. package/dist/text/ot.js.map +1 -0
  79. package/dist/text/page.d.ts +35 -0
  80. package/dist/text/page.d.ts.map +1 -0
  81. package/dist/text/page.js +31 -0
  82. package/dist/text/page.js.map +1 -0
  83. package/dist/text/rebase.d.ts +50 -0
  84. package/dist/text/rebase.d.ts.map +1 -0
  85. package/dist/text/rebase.js +59 -0
  86. package/dist/text/rebase.js.map +1 -0
  87. package/dist/text/schema.d.ts +43 -0
  88. package/dist/text/schema.d.ts.map +1 -0
  89. package/dist/text/schema.js +482 -0
  90. package/dist/text/schema.js.map +1 -0
  91. package/dist/text/steps.d.ts +17 -0
  92. package/dist/text/steps.d.ts.map +1 -0
  93. package/dist/text/steps.js +14 -0
  94. package/dist/text/steps.js.map +1 -0
  95. package/dist/util/canonical-json.d.ts +16 -0
  96. package/dist/util/canonical-json.d.ts.map +1 -0
  97. package/dist/util/canonical-json.js +28 -0
  98. package/dist/util/canonical-json.js.map +1 -0
  99. package/dist/util/index.d.ts +10 -0
  100. package/dist/util/index.d.ts.map +1 -0
  101. package/dist/util/index.js +10 -0
  102. package/dist/util/index.js.map +1 -0
  103. package/dist/util/random.d.ts +17 -0
  104. package/dist/util/random.d.ts.map +1 -0
  105. package/dist/util/random.js +40 -0
  106. package/dist/util/random.js.map +1 -0
  107. package/dist/util/utf8.d.ts +13 -0
  108. package/dist/util/utf8.d.ts.map +1 -0
  109. package/dist/util/utf8.js +38 -0
  110. package/dist/util/utf8.js.map +1 -0
  111. package/package.json +57 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Naveen Kumar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,102 @@
1
- # Temporary Holding Version
1
+ # @open-docex/shared
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Contracts shared by `@open-docex/server` and `@open-docex/client`: the wire protocol, the error catalogue and `OpenDocexError`, branded ids, and the text document model with its operational-transform (OT) functions.
4
+
5
+ It runs in Node.js and in browsers and has no Node or DOM dependency.
6
+
7
+ Part of [open_docex](https://github.com/iNew-b-yte/open_docex/blob/main/README.md), which explains the purpose, who it is for and the requirements of the whole project.
8
+
9
+ **Most adopters do not install this package directly.** `@open-docex/server` and `@open-docex/client` depend on it and install it for you. Install it yourself only if you want to import error types or codes in your own code, for example to handle `OpenDocexError` in a route.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ npm install @open-docex/shared
15
+ ```
16
+
17
+ Requires Node.js 22, 24 or 26. The package is ESM only.
18
+
19
+ ## What it exports
20
+
21
+ Import from a subpath. The root re-exports everything, but a server's main process should use only `/errors`, `/ids` and `/protocol`, so that ProseMirror stays out of it.
22
+
23
+ | Subpath | Contents |
24
+ |---|---|
25
+ | `@open-docex/shared/errors` | `ERROR_CATALOGUE`, `OpenDocexError`, `toClientError`, and the types `ErrorCode`, `ErrorCategory`, `ErrorSeverity`, `CatalogueEntry` |
26
+ | `@open-docex/shared/ids` | `DocumentId` and other branded ids, `asDocumentId`, `newClientId` |
27
+ | `@open-docex/shared/protocol` | WebSocket message types and the encode/decode functions |
28
+ | `@open-docex/shared/ot` | Chunking types shared by the document models |
29
+ | `@open-docex/shared/text` | The text schema, text operations, rebase, chunking, page settings |
30
+
31
+ The protocol, the OT functions and the text model are internal contracts between the two packages. They are public so that both packages can share them, but they are not a stable integration surface for adopters. Build against `@open-docex/server` and `@open-docex/client`, not against the wire format.
32
+
33
+ ## Errors
34
+
35
+ Every failure in open_docex is an `OpenDocexError` with a code from the catalogue below. `category`, `retryable`, `severity` and `remediation` always come from `ERROR_CATALOGUE`, so they cannot differ from the table.
36
+
37
+ ```js
38
+ import { ERROR_CATALOGUE, OpenDocexError, toClientError } from '@open-docex/shared/errors';
39
+ import { asDocumentId } from '@open-docex/shared/ids';
40
+
41
+ const documentId = asDocumentId('invoice-2026-001');
42
+
43
+ const err = new OpenDocexError('STORAGE_READ_FAILED', 'S3 returned 503 for bucket acme-private', { documentId });
44
+ console.log(err.code, err.category, err.retryable, err.severity);
45
+ // STORAGE_READ_FAILED storage true error
46
+
47
+ // What a browser may see: the catalogue text only, never `message` or `cause`.
48
+ console.log(toClientError(err));
49
+ // { code: 'STORAGE_READ_FAILED', retryable: true, message: 'The document could not be loaded. Retrying.' }
50
+
51
+ console.log(ERROR_CATALOGUE.CONFIG_LIBREOFFICE_NOT_FOUND.remediation);
52
+ // Install LibreOffice on the server, or set `libreoffice.path` to the `soffice` executable.
53
+ ```
54
+
55
+ `message` on the server side is for your logs and may contain detail. Clients only ever receive the catalogue's client message (HLD section 11.1, 14). Do not send `err.message` or `err.cause` to a browser.
56
+
57
+ ### Error codes
58
+
59
+ Generated from `ERROR_CATALOGUE`. `CLIENT_*` codes are raised in the browser only.
60
+
61
+ | Code | Category | Retryable | Severity | What to do |
62
+ |---|---|---|---|---|
63
+ | `CONFIG_INVALID` | config | no | fatal | Fix the option named in `message` (see the configuration reference) and restart. |
64
+ | `CONFIG_LIBREOFFICE_NOT_FOUND` | config | no | fatal | Install LibreOffice on the server, or set `libreoffice.path` to the `soffice` executable. |
65
+ | `CONFIG_DATA_DIR_UNWRITABLE` | config | no | fatal | Create `dataDir` and make it writable by the Node.js process user, or point `dataDir` elsewhere. |
66
+ | `STORAGE_READ_FAILED` | storage | yes | error | Check that the storage adapter can reach its backend and that `ref` exists; see `cause`. |
67
+ | `STORAGE_WRITE_FAILED` | storage | yes | warning | The engine kept a local copy and retries after 1, 5 and 15 min. Check storage availability and credentials. |
68
+ | `STORAGE_LOCAL_MODE` | storage | no | warning | No action needed while retries run. Watch the `storage` events. |
69
+ | `STORAGE_PENDING` | recovery | no | error | Retries are exhausted. Fix storage, then call the recovery `retry()` for this document, or `resolve()` it. |
70
+ | `STORAGE_CONFLICT` | recovery | no | error | The storage file changed while a newer local copy existed. Compare both and call `resolve()` with your choice. The engine never overwrites it on its own. |
71
+ | `QUEUE_FULL` | queue | yes | warning | Clients retry automatically. If this is frequent, raise `queue.perDocument`/`queue.global` or reduce load. |
72
+ | `QUEUE_UNAVAILABLE` | queue | yes | error | Raised when the queue is closed, for example during shutdown. Clients retry. |
73
+ | `ENGINE_RESTARTING` | engine | yes | warning | Clients reconnect automatically. Inspect the preceding `error` event for the crash cause. |
74
+ | `ENGINE_UNAVAILABLE` | engine | no | error | The engine is FAILED. Fix the cause in the `fatal` event and restart the application. |
75
+ | `ENGINE_FAILED` | engine | no | fatal | The restart limit was exceeded. Inspect the preceding `error` events and logs, fix, and restart. |
76
+ | `DOCUMENT_FAULTED` | document | no | error | Inspect the `error` event's `cause`. Other documents keep running. Reopening reloads from the journal. |
77
+ | `DOCUMENT_UNSUPPORTED_CONTENT` | document | no | warning | See `unsupported`. Call `documents.allowUnsupportedEdit(documentId)` to allow editing; those parts are removed on save. |
78
+ | `DOCUMENT_READ_ONLY` | document | no | warning | The session is view-only or the document is read-only. The change was discarded. |
79
+ | `DOCUMENT_NOT_FOUND` | document | no | error | The storage adapter reports no file for the `ref` returned by `authorize`. Check the mapping. |
80
+ | `DOCUMENT_TOO_LARGE` | document | no | error | The file exceeds `limits.maxFileBytes`. Raise the limit or reduce the file. |
81
+ | `CONVERSION_FAILED` | conversion | no | error | LibreOffice could not convert it. Check that the file is a valid .docx/.odt/.xlsx/.ods and that `soffice --headless --version` works for the server user. |
82
+ | `CONVERSION_TIMEOUT` | conversion | yes | error | Raise `libreoffice.timeoutMs`, or add capacity (`maxConcurrent`, `codecThreads`). |
83
+ | `SESSION_SLOW_CONSUMER` | session | yes | warning | The client fell behind its send buffer. Raise `send.highWaterMarkBytes` if this happens on healthy networks. |
84
+ | `SESSION_CLOSED` | session | no | info | Closed by the server or the adopter. No action is needed unless unexpected. |
85
+ | `SESSION_RESYNC_REQUIRED` | session | yes | info | The client reloads automatically. |
86
+ | `ACCESS_DENIED` | access | no | error | Your `authorize` or `canSubmit` hook rejected the request. |
87
+ | `PROTOCOL_INVALID_MESSAGE` | protocol | no | error | Make sure `@open-docex/client` and `@open-docex/server` are the same release. Otherwise a client sent a malformed frame. |
88
+ | `PROTOCOL_VERSION_UNSUPPORTED` | protocol | no | error | Deploy the same release of client and server. |
89
+ | `PROTOCOL_OP_REJECTED` | protocol | no | error | The change failed validation and was discarded. If this is frequent, report a bug with the `error` event. |
90
+ | `CLIENT_CONNECT_FAILED` | client | yes | error | Check the server is running and that proxies allow WebSocket upgrades on the engine path. |
91
+ | `CLIENT_ASSET_TOO_LARGE` | client | no | warning | Use a smaller image. |
92
+ | `CLIENT_IMAGE_TYPE_UNSUPPORTED` | client | no | warning | Only PNG, JPEG and GIF are supported (PO-24). |
93
+
94
+ ## Not supported in V1
95
+
96
+ - Text documents only. Spreadsheets arrive in a later version, so `@open-docex/shared/sheet` does not exist yet.
97
+ - No undo or redo.
98
+ - A file with content the editor cannot represent opens read-only, with the error code `DOCUMENT_UNSUPPORTED_CONTENT`. See the server README.
99
+
100
+ ## Licence
101
+
102
+ MIT.
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Error codes and the error catalogue (HLD §11.2, LLD Part 1 §4).
3
+ *
4
+ * @module
5
+ */
6
+ /** Every error code open_docex raises (HLD §11.2). `CLIENT_*` codes are raised in the browser only (LLD L-16). */
7
+ export type ErrorCode = 'CONFIG_INVALID' | 'CONFIG_LIBREOFFICE_NOT_FOUND' | 'CONFIG_DATA_DIR_UNWRITABLE' | 'STORAGE_READ_FAILED' | 'STORAGE_WRITE_FAILED' | 'STORAGE_LOCAL_MODE' | 'STORAGE_PENDING' | 'STORAGE_CONFLICT' | 'QUEUE_FULL' | 'QUEUE_UNAVAILABLE' | 'ENGINE_RESTARTING' | 'ENGINE_UNAVAILABLE' | 'ENGINE_FAILED' | 'DOCUMENT_FAULTED' | 'DOCUMENT_UNSUPPORTED_CONTENT' | 'DOCUMENT_READ_ONLY' | 'DOCUMENT_NOT_FOUND' | 'DOCUMENT_TOO_LARGE' | 'CONVERSION_FAILED' | 'CONVERSION_TIMEOUT' | 'SESSION_SLOW_CONSUMER' | 'SESSION_CLOSED' | 'SESSION_RESYNC_REQUIRED' | 'ACCESS_DENIED' | 'PROTOCOL_INVALID_MESSAGE' | 'PROTOCOL_VERSION_UNSUPPORTED' | 'PROTOCOL_OP_REJECTED' | 'CLIENT_CONNECT_FAILED' | 'CLIENT_ASSET_TOO_LARGE' | 'CLIENT_IMAGE_TYPE_UNSUPPORTED';
8
+ /** The family an error belongs to (HLD §11.1). */
9
+ export type ErrorCategory = 'config' | 'storage' | 'queue' | 'engine' | 'session' | 'access' | 'protocol' | 'document' | 'conversion' | 'recovery' | 'client';
10
+ /** How serious an error is (HLD §11.1). */
11
+ export type ErrorSeverity = 'info' | 'warning' | 'error' | 'fatal';
12
+ /** The fixed properties of one error code. */
13
+ export interface CatalogueEntry {
14
+ category: ErrorCategory;
15
+ retryable: boolean;
16
+ severity: ErrorSeverity;
17
+ /** The only text a client ever sees for this code (HLD §11.1, §14). */
18
+ clientMessage: string;
19
+ /** What the adopter should do about it. */
20
+ remediation: string;
21
+ }
22
+ /**
23
+ * The full error catalogue (LLD Part 1 §4). The catalogue and every entry are frozen.
24
+ * `OpenDocexError` takes its category, retryability, severity and remediation from here,
25
+ * so they cannot drift from the code.
26
+ */
27
+ export declare const ERROR_CATALOGUE: Readonly<Record<ErrorCode, Readonly<CatalogueEntry>>>;
28
+ /** True when `x` is one of the catalogue's error codes. Safe for untrusted input. */
29
+ export declare function isErrorCode(x: unknown): x is ErrorCode;
30
+ //# sourceMappingURL=catalogue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogue.d.ts","sourceRoot":"","sources":["../../src/errors/catalogue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,kHAAkH;AAClH,MAAM,MAAM,SAAS,GACjB,gBAAgB,GAChB,8BAA8B,GAC9B,4BAA4B,GAC5B,qBAAqB,GACrB,sBAAsB,GACtB,oBAAoB,GACpB,iBAAiB,GACjB,kBAAkB,GAClB,YAAY,GACZ,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,GACpB,eAAe,GACf,kBAAkB,GAClB,8BAA8B,GAC9B,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,oBAAoB,GACpB,uBAAuB,GACvB,gBAAgB,GAChB,yBAAyB,GACzB,eAAe,GACf,0BAA0B,GAC1B,8BAA8B,GAC9B,sBAAsB,GACtB,uBAAuB,GACvB,wBAAwB,GACxB,+BAA+B,CAAC;AAEpC,kDAAkD;AAClD,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,SAAS,GACT,OAAO,GACP,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,UAAU,GACV,UAAU,GACV,YAAY,GACZ,UAAU,GACV,QAAQ,CAAC;AAEb,2CAA2C;AAC3C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEnE,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,aAAa,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC;IACxB,uEAAuE;IACvE,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;CACrB;AAeD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CA+DhF,CAAC;AAEH,qFAAqF;AACrF,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,SAAS,CAEtD"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Error codes and the error catalogue (HLD §11.2, LLD Part 1 §4).
3
+ *
4
+ * @module
5
+ */
6
+ /** Client text for codes that are not meant to reach a client (LLD Part 1 §4). */
7
+ const SERVER_PROBLEM = 'The editing service hit a server problem.';
8
+ function entry(category, retryable, severity, clientMessage, remediation) {
9
+ return Object.freeze({ category, retryable, severity, clientMessage, remediation });
10
+ }
11
+ /**
12
+ * The full error catalogue (LLD Part 1 §4). The catalogue and every entry are frozen.
13
+ * `OpenDocexError` takes its category, retryability, severity and remediation from here,
14
+ * so they cannot drift from the code.
15
+ */
16
+ export const ERROR_CATALOGUE = Object.freeze({
17
+ CONFIG_INVALID: entry('config', false, 'fatal', SERVER_PROBLEM, 'Fix the option named in `message` (see the configuration reference) and restart.'),
18
+ CONFIG_LIBREOFFICE_NOT_FOUND: entry('config', false, 'fatal', SERVER_PROBLEM, 'Install LibreOffice on the server, or set `libreoffice.path` to the `soffice` executable.'),
19
+ CONFIG_DATA_DIR_UNWRITABLE: entry('config', false, 'fatal', SERVER_PROBLEM, 'Create `dataDir` and make it writable by the Node.js process user, or point `dataDir` elsewhere.'),
20
+ STORAGE_READ_FAILED: entry('storage', true, 'error', 'The document could not be loaded. Retrying.', 'Check that the storage adapter can reach its backend and that `ref` exists; see `cause`.'),
21
+ STORAGE_WRITE_FAILED: entry('storage', true, 'warning', SERVER_PROBLEM, 'The engine kept a local copy and retries after 1, 5 and 15 min. Check storage availability and credentials.'),
22
+ STORAGE_LOCAL_MODE: entry('storage', false, 'warning', 'Changes are saved on the server and will be copied to storage later.', 'No action needed while retries run. Watch the `storage` events.'),
23
+ STORAGE_PENDING: entry('recovery', false, 'error', 'Changes are saved on the server; storage sync is pending.', 'Retries are exhausted. Fix storage, then call the recovery `retry()` for this document, or `resolve()` it.'),
24
+ STORAGE_CONFLICT: entry('recovery', false, 'error', 'Changes are saved on the server; storage sync is pending.', 'The storage file changed while a newer local copy existed. Compare both and call `resolve()` with your choice. The engine never overwrites it on its own.'),
25
+ QUEUE_FULL: entry('queue', true, 'warning', 'The server is busy. Your change will be retried.', 'Clients retry automatically. If this is frequent, raise `queue.perDocument`/`queue.global` or reduce load.'),
26
+ QUEUE_UNAVAILABLE: entry('queue', true, 'error', 'The server is busy. Your change will be retried.', 'Check connectivity and credentials for the configured Redis/Valkey or Kafka [V3].'),
27
+ ENGINE_RESTARTING: entry('engine', true, 'warning', 'Reconnecting…', 'Clients reconnect automatically. Inspect the preceding `error` event for the crash cause.'),
28
+ ENGINE_UNAVAILABLE: entry('engine', false, 'error', 'The editing service is unavailable.', 'The engine is FAILED. Fix the cause in the `fatal` event and restart the application.'),
29
+ ENGINE_FAILED: entry('engine', false, 'fatal', SERVER_PROBLEM, 'The restart limit was exceeded. Inspect the preceding `error` events and logs, fix, and restart.'),
30
+ DOCUMENT_FAULTED: entry('document', false, 'error', 'This document hit an internal error. Reload to continue.', "Inspect the `error` event's `cause`. Other documents keep running. Reopening reloads from the journal."),
31
+ DOCUMENT_UNSUPPORTED_CONTENT: entry('document', false, 'warning', "Parts of this file can't be edited here, so it opened read-only.", 'See `unsupported`. Call `documents.allowUnsupportedEdit(documentId)` to allow editing; those parts are removed on save.'),
32
+ DOCUMENT_READ_ONLY: entry('document', false, 'warning', 'This document is read-only.', 'The session is view-only or the document is read-only. The change was discarded.'),
33
+ DOCUMENT_NOT_FOUND: entry('document', false, 'error', 'The document was not found.', 'The storage adapter reports no file for the `ref` returned by `authorize`. Check the mapping.'),
34
+ DOCUMENT_TOO_LARGE: entry('document', false, 'error', 'The file is too large.', 'The file exceeds `limits.maxFileBytes`. Raise the limit or reduce the file.'),
35
+ CONVERSION_FAILED: entry('conversion', false, 'error', 'The file could not be opened.', 'LibreOffice could not convert it. Check that the file is a valid .docx/.odt/.xlsx/.ods and that `soffice --headless --version` works for the server user.'),
36
+ CONVERSION_TIMEOUT: entry('conversion', true, 'error', 'Opening the file took too long. Retrying.', 'Raise `libreoffice.timeoutMs`, or add capacity (`maxConcurrent`, `codecThreads`).'),
37
+ SESSION_SLOW_CONSUMER: entry('session', true, 'warning', 'Connection too slow. Reloading.', 'The client fell behind its send buffer. Raise `send.highWaterMarkBytes` if this happens on healthy networks.'),
38
+ SESSION_CLOSED: entry('session', false, 'info', 'The session was closed.', 'Closed by the server or the adopter. No action is needed unless unexpected.'),
39
+ SESSION_RESYNC_REQUIRED: entry('session', true, 'info', 'Reloading the latest version…', 'The client reloads automatically.'),
40
+ ACCESS_DENIED: entry('access', false, 'error', "You don't have access to this document.", 'Your `authorize` or `canSubmit` hook rejected the request.'),
41
+ PROTOCOL_INVALID_MESSAGE: entry('protocol', false, 'error', 'Client and server are out of sync. Reload the page.', 'Make sure `@open-docex/client` and `@open-docex/server` are the same release. Otherwise a client sent a malformed frame.'),
42
+ PROTOCOL_VERSION_UNSUPPORTED: entry('protocol', false, 'error', 'Please reload the page to update the editor.', 'Deploy the same release of client and server.'),
43
+ PROTOCOL_OP_REJECTED: entry('protocol', false, 'error', 'A change could not be applied. Reloading.', 'The change failed validation and was discarded. If this is frequent, report a bug with the `error` event.'),
44
+ CLIENT_CONNECT_FAILED: entry('client', true, 'error', "Can't connect.", 'Check the server is running and that proxies allow WebSocket upgrades on the engine path.'),
45
+ CLIENT_ASSET_TOO_LARGE: entry('client', false, 'warning', 'This image is too large.', 'Use a smaller image.'),
46
+ CLIENT_IMAGE_TYPE_UNSUPPORTED: entry('client', false, 'warning', 'Only PNG, JPEG and GIF images can be added.', 'Only PNG, JPEG and GIF are supported (PO-24).'),
47
+ });
48
+ /** True when `x` is one of the catalogue's error codes. Safe for untrusted input. */
49
+ export function isErrorCode(x) {
50
+ return typeof x === 'string' && Object.prototype.hasOwnProperty.call(ERROR_CATALOGUE, x);
51
+ }
52
+ //# sourceMappingURL=catalogue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogue.js","sourceRoot":"","sources":["../../src/errors/catalogue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA+DH,kFAAkF;AAClF,MAAM,cAAc,GAAG,2CAA2C,CAAC;AAEnE,SAAS,KAAK,CACZ,QAAuB,EACvB,SAAkB,EAClB,QAAuB,EACvB,aAAqB,EACrB,WAAmB;IAEnB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC,CAAC;AACtF,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAA0D,MAAM,CAAC,MAAM,CAAC;IAClG,cAAc,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAC5D,kFAAkF,CAAC;IACrF,4BAA4B,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAC1E,2FAA2F,CAAC;IAC9F,0BAA0B,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EACxE,kGAAkG,CAAC;IACrG,mBAAmB,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,6CAA6C,EAChG,0FAA0F,CAAC;IAC7F,oBAAoB,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EACpE,6GAA6G,CAAC;IAChH,kBAAkB,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,EACnD,sEAAsE,EACtE,iEAAiE,CAAC;IACpE,eAAe,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,2DAA2D,EAC5G,4GAA4G,CAAC;IAC/G,gBAA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+1,9 @@
1
+ /**
2
+ * `@open-docex/shared/errors`: error codes, the catalogue, `OpenDocexError` and the
3
+ * sanitized client form (HLD §11, LLD Part 1 §4).
4
+ *
5
+ * @module
6
+ */
7
+ export { ERROR_CATALOGUE, type CatalogueEntry, type ErrorCategory, type ErrorCode, type ErrorSeverity, } from './catalogue.js';
8
+ export { OpenDocexError, toClientError, type ClientErrorPayload, type OpenDocexErrorShape, } from './open-docex-error.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,cAAc,EACd,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `@open-docex/shared/errors`: error codes, the catalogue, `OpenDocexError` and the
3
+ * sanitized client form (HLD §11, LLD Part 1 §4).
4
+ *
5
+ * @module
6
+ */
7
+ export { ERROR_CATALOGUE, } from './catalogue.js';
8
+ export { OpenDocexError, toClientError, } from './open-docex-error.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,eAAe,GAKhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,cAAc,EACd,aAAa,GAGd,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * The open_docex error class and the sanitized client form (HLD §11.1, LLD Part 1 §4).
3
+ *
4
+ * @module
5
+ */
6
+ import { type ErrorCategory, type ErrorCode, type ErrorSeverity } from './catalogue.js';
7
+ /** The error shape of HLD §11.1. It is plain data, so it survives IPC and structured clone. */
8
+ export interface OpenDocexErrorShape {
9
+ code: ErrorCode;
10
+ category: ErrorCategory;
11
+ retryable: boolean;
12
+ severity: ErrorSeverity;
13
+ documentId?: string;
14
+ instanceId?: string;
15
+ message: string;
16
+ remediation: string;
17
+ cause?: unknown;
18
+ }
19
+ /** Options for {@link OpenDocexError}. */
20
+ export interface OpenDocexErrorOptions {
21
+ documentId?: string;
22
+ instanceId?: string;
23
+ cause?: unknown;
24
+ }
25
+ /**
26
+ * Every failure in open_docex is an `OpenDocexError` carrying a code from HLD §11.2.
27
+ *
28
+ * `category`, `retryable`, `severity` and `remediation` always come from
29
+ * `ERROR_CATALOGUE[code]`. `message` defaults to the code's client message; it is for logs
30
+ * and adopters and is never sent to a client (use {@link toClientError}).
31
+ */
32
+ export declare class OpenDocexError extends Error implements OpenDocexErrorShape {
33
+ readonly name: "OpenDocexError";
34
+ readonly code: ErrorCode;
35
+ readonly category: ErrorCategory;
36
+ readonly retryable: boolean;
37
+ readonly severity: ErrorSeverity;
38
+ readonly remediation: string;
39
+ readonly documentId?: string;
40
+ readonly instanceId?: string;
41
+ constructor(code: ErrorCode, message?: string, opts?: OpenDocexErrorOptions);
42
+ /**
43
+ * Returns the plain HLD §11.1 shape. `cause` becomes a plain `{ name, message }` object so
44
+ * the shape is IPC-safe: IPC keeps only `name`, `message` and `stack` of an `Error` (CL-1).
45
+ */
46
+ toShape(): OpenDocexErrorShape;
47
+ /**
48
+ * Rebuilds an error from a shape made by {@link OpenDocexError.toShape}. The catalogue
49
+ * fields are taken from the code again, not from the shape.
50
+ */
51
+ static fromShape(s: OpenDocexErrorShape): OpenDocexError;
52
+ /**
53
+ * Structural check, safe across realms and IPC: true for an `OpenDocexError` and for any
54
+ * object with a known `code` and the shape's `category`, `retryable`, `severity`, `message`
55
+ * and `remediation` fields (for example a structured clone of {@link toShape}'s result).
56
+ * With `code`, also requires that code.
57
+ */
58
+ static is(x: unknown, code?: ErrorCode): x is OpenDocexError;
59
+ }
60
+ /** The sanitized error a client receives (HLD §11.1, §14). */
61
+ export interface ClientErrorPayload {
62
+ code: ErrorCode;
63
+ retryable: boolean;
64
+ message: string;
65
+ clientSeq?: number;
66
+ reqId?: number;
67
+ }
68
+ /** Context for {@link toClientError}. */
69
+ export interface ClientErrorContext {
70
+ clientSeq?: number;
71
+ reqId?: number;
72
+ /** Code used when `err` is not an `OpenDocexError`. Defaults to `DOCUMENT_FAULTED`. */
73
+ fallback?: ErrorCode;
74
+ }
75
+ /**
76
+ * Turns any thrown value into the payload sent to a client. The code is `err.code` for an
77
+ * `OpenDocexError`, otherwise `ctx.fallback ?? 'DOCUMENT_FAULTED'`. The message is always the
78
+ * catalogue's client message: no `message`, `cause`, stack, path or storage detail is copied.
79
+ */
80
+ export declare function toClientError(err: unknown, ctx?: ClientErrorContext): ClientErrorPayload;
81
+ //# sourceMappingURL=open-docex-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-docex-error.d.ts","sourceRoot":"","sources":["../../src/errors/open-docex-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAExB,+FAA+F;AAC/F,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,aAAa,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MA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G,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,kBAAkB,GAAG,kBAAkB,CAOxF"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * The open_docex error class and the sanitized client form (HLD §11.1, LLD Part 1 §4).
3
+ *
4
+ * @module
5
+ */
6
+ import { ERROR_CATALOGUE, isErrorCode, } from './catalogue.js';
7
+ /**
8
+ * Every failure in open_docex is an `OpenDocexError` carrying a code from HLD §11.2.
9
+ *
10
+ * `category`, `retryable`, `severity` and `remediation` always come from
11
+ * `ERROR_CATALOGUE[code]`. `message` defaults to the code's client message; it is for logs
12
+ * and adopters and is never sent to a client (use {@link toClientError}).
13
+ */
14
+ export class OpenDocexError extends Error {
15
+ name = 'OpenDocexError';
16
+ code;
17
+ category;
18
+ retryable;
19
+ severity;
20
+ remediation;
21
+ documentId;
22
+ instanceId;
23
+ constructor(code, message, opts) {
24
+ const entry = ERROR_CATALOGUE[code];
25
+ super(message ?? entry.clientMessage, opts && 'cause' in opts ? { cause: opts.cause } : undefined);
26
+ this.code = code;
27
+ this.category = entry.category;
28
+ this.retryable = entry.retryable;
29
+ this.severity = entry.severity;
30
+ this.remediation = entry.remediation;
31
+ if (opts?.documentId !== undefined)
32
+ this.documentId = opts.documentId;
33
+ if (opts?.instanceId !== undefined)
34
+ this.instanceId = opts.instanceId;
35
+ }
36
+ /**
37
+ * Returns the plain HLD §11.1 shape. `cause` becomes a plain `{ name, message }` object so
38
+ * the shape is IPC-safe: IPC keeps only `name`, `message` and `stack` of an `Error` (CL-1).
39
+ */
40
+ toShape() {
41
+ const shape = {
42
+ code: this.code,
43
+ category: this.category,
44
+ retryable: this.retryable,
45
+ severity: this.severity,
46
+ message: this.message,
47
+ remediation: this.remediation,
48
+ };
49
+ if (this.documentId !== undefined)
50
+ shape.documentId = this.documentId;
51
+ if (this.instanceId !== undefined)
52
+ shape.instanceId = this.instanceId;
53
+ if (this.cause !== undefined)
54
+ shape.cause = plainCause(this.cause);
55
+ return shape;
56
+ }
57
+ /**
58
+ * Rebuilds an error from a shape made by {@link OpenDocexError.toShape}. The catalogue
59
+ * fields are taken from the code again, not from the shape.
60
+ */
61
+ static fromShape(s) {
62
+ const opts = {};
63
+ if (s.documentId !== undefined)
64
+ opts.documentId = s.documentId;
65
+ if (s.instanceId !== undefined)
66
+ opts.instanceId = s.instanceId;
67
+ if (s.cause !== undefined)
68
+ opts.cause = s.cause;
69
+ return new OpenDocexError(s.code, s.message, opts);
70
+ }
71
+ /**
72
+ * Structural check, safe across realms and IPC: true for an `OpenDocexError` and for any
73
+ * object with a known `code` and the shape's `category`, `retryable`, `severity`, `message`
74
+ * and `remediation` fields (for example a structured clone of {@link toShape}'s result).
75
+ * With `code`, also requires that code.
76
+ */
77
+ static is(x, code) {
78
+ if (typeof x !== 'object' || x === null)
79
+ return false;
80
+ const o = x;
81
+ if (!isErrorCode(o['code']))
82
+ return false;
83
+ if (code !== undefined && o['code'] !== code)
84
+ return false;
85
+ if (x instanceof OpenDocexError)
86
+ return true;
87
+ return (typeof o['category'] === 'string' &&
88
+ typeof o['retryable'] === 'boolean' &&
89
+ typeof o['severity'] === 'string' &&
90
+ typeof o['message'] === 'string' &&
91
+ typeof o['remediation'] === 'string');
92
+ }
93
+ }
94
+ function safeString(v) {
95
+ try {
96
+ return String(v);
97
+ }
98
+ catch {
99
+ return '';
100
+ }
101
+ }
102
+ function plainCause(cause) {
103
+ if (typeof cause === 'object' && cause !== null) {
104
+ const c = cause;
105
+ return {
106
+ name: typeof c.name === 'string' ? c.name : 'Error',
107
+ message: typeof c.message === 'string' ? c.message : safeString(cause),
108
+ };
109
+ }
110
+ return { name: 'Error', message: safeString(cause) };
111
+ }
112
+ /**
113
+ * Turns any thrown value into the payload sent to a client. The code is `err.code` for an
114
+ * `OpenDocexError`, otherwise `ctx.fallback ?? 'DOCUMENT_FAULTED'`. The message is always the
115
+ * catalogue's client message: no `message`, `cause`, stack, path or storage detail is copied.
116
+ */
117
+ export function toClientError(err, ctx) {
118
+ const code = OpenDocexError.is(err) ? err.code : (ctx?.fallback ?? 'DOCUMENT_FAULTED');
119
+ const entry = ERROR_CATALOGUE[code];
120
+ const payload = { code, retryable: entry.retryable, message: entry.clientMessage };
121
+ if (ctx?.clientSeq !== undefined)
122
+ payload.clientSeq = ctx.clientSeq;
123
+ if (ctx?.reqId !== undefined)
124
+ payload.reqId = ctx.reqId;
125
+ return payload;
126
+ }
127
+ //# sourceMappingURL=open-docex-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-docex-error.js","sourceRoot":"","sources":["../../src/errors/open-docex-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,gBAAgB,CAAC;AAsBxB;;;;;;GAMG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACrB,IAAI,GAAG,gBAAyB,CAAC;IAC1C,IAAI,CAAY;IAChB,QAAQ,CAAgB;IACxB,SAAS,CAAU;IACnB,QAAQ,CAAgB;IACxB,WAAW,CAAS;IACpB,UAAU,CAAU;IACpB,UAAU,CAAU;IAE7B,YAAY,IAAe,EAAE,OAAgB,EAAE,IAA4B;QACzE,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QACpC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,aAAa,EAAE,IAAI,IAAI,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACnG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,IAAI,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,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;SACvE,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;AACvD,CAAC;AAmBD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY,EAAE,GAAwB;IAClE,MAAM,IAAI,GAAc,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,IAAI,kBAAkB,CAAC,CAAC;IAClG,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,OAAO,GAAuB,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC;IACvG,IAAI,GAAG,EAAE,SAAS,KAAK,SAAS;QAAE,OAAO,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;IACpE,IAAI,GAAG,EAAE,KAAK,KAAK,SAAS;QAAE,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IACxD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,41 @@
1
+ declare const brand: unique symbol;
2
+ /** A nominal ("branded") type: `T` that only a checking function can produce. */
3
+ export type Brand<T, B extends string> = T & {
4
+ readonly [brand]: B;
5
+ };
6
+ /** An adopter document ID: 1–1,024 UTF-16 code units with no C0 control characters (LLD L-5). */
7
+ export type DocumentId = Brand<string, 'DocumentId'>;
8
+ /** A client session ID: 22 base64url characters. */
9
+ export type ClientId = Brand<string, 'ClientId'>;
10
+ /** A document load epoch: 22 base64url characters. */
11
+ export type Epoch = Brand<string, 'Epoch'>;
12
+ /**
13
+ * Returns 16 random bytes as base64url (22 characters). Uses `crypto.getRandomValues`, not
14
+ * `randomUUID`, because `randomUUID` fails on non-secure origins.
15
+ */
16
+ export declare function newRandomId(): string;
17
+ /** Returns a new random {@link ClientId} (same format as {@link newRandomId}). */
18
+ export declare function newClientId(): ClientId;
19
+ /** Returns a new random {@link Epoch} (same format as {@link newRandomId}). */
20
+ export declare function newEpoch(): Epoch;
21
+ /**
22
+ * Checks an adopter document ID: 1–1,024 UTF-16 code units with no C0 control characters.
23
+ * The ID is never used as a file name (HLD §14).
24
+ *
25
+ * @throws {OpenDocexError} `PROTOCOL_INVALID_MESSAGE` when `raw` is not a valid document ID.
26
+ */
27
+ export declare function asDocumentId(raw: string): DocumentId;
28
+ /** True when `x` has the {@link ClientId} format (`/^[A-Za-z0-9_-]{22}$/`). */
29
+ export declare function isClientId(x: unknown): x is ClientId;
30
+ /** True when `x` has the {@link Epoch} format (`/^[A-Za-z0-9_-]{22}$/`). */
31
+ export declare function isEpoch(x: unknown): x is Epoch;
32
+ /** True when `x` is an asset ID: the lowercase hex SHA-256 of the asset's bytes (64 characters). */
33
+ export declare function isAssetId(x: unknown): x is string;
34
+ /**
35
+ * Returns the asset ID of `bytes`: their SHA-256 as 64 lowercase hex characters, computed with
36
+ * `globalThis.crypto.subtle` (LLD §0 R-12). In browsers `crypto.subtle` exists only in secure
37
+ * contexts (HTTPS or localhost).
38
+ */
39
+ export declare function computeAssetId(bytes: Uint8Array): Promise<string>;
40
+ export {};
41
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ids/index.ts"],"names":[],"mappings":"AASA,OAAO,CAAC,MAAM,KAAK,EAAE,OAAO,MAAM,CAAC;AAEnC,iFAAiF;AACjF,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC;AACrE,iGAAiG;AACjG,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AACrD,oDAAoD;AACpD,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACjD,sDAAsD;AACtD,MAAM,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAO3C;;;GAGG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,kFAAkF;AAClF,wBAAgB,WAAW,IAAI,QAAQ,CAEtC;AAED,+EAA+E;AAC/E,wBAAgB,QAAQ,IAAI,KAAK,CAEhC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAUpD;AAED,+EAA+E;AAC/E,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,QAAQ,CAEpD;AAED,4EAA4E;AAC5E,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,KAAK,CAE9C;AAED,oGAAoG;AACpG,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAEjD;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAQvE"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * `@open-docex/shared/ids`: typed identifiers and random ID generation, identical in Node.js
3
+ * and browsers (LLD Part 1 §3, §0 R-12).
4
+ *
5
+ * @module
6
+ */
7
+ import { OpenDocexError } from '../errors/index.js';
8
+ import { base64url, randomBytes } from '../util/index.js';
9
+ const RANDOM_ID = /^[A-Za-z0-9_-]{22}$/;
10
+ const ASSET_ID = /^[0-9a-f]{64}$/;
11
+ const C0_CONTROL = /[\u0000-\u001f]/;
12
+ const MAX_DOCUMENT_ID_LENGTH = 1024;
13
+ /**
14
+ * Returns 16 random bytes as base64url (22 characters). Uses `crypto.getRandomValues`, not
15
+ * `randomUUID`, because `randomUUID` fails on non-secure origins.
16
+ */
17
+ export function newRandomId() {
18
+ return base64url(randomBytes(16));
19
+ }
20
+ /** Returns a new random {@link ClientId} (same format as {@link newRandomId}). */
21
+ export function newClientId() {
22
+ return newRandomId();
23
+ }
24
+ /** Returns a new random {@link Epoch} (same format as {@link newRandomId}). */
25
+ export function newEpoch() {
26
+ return newRandomId();
27
+ }
28
+ /**
29
+ * Checks an adopter document ID: 1–1,024 UTF-16 code units with no C0 control characters.
30
+ * The ID is never used as a file name (HLD §14).
31
+ *
32
+ * @throws {OpenDocexError} `PROTOCOL_INVALID_MESSAGE` when `raw` is not a valid document ID.
33
+ */
34
+ export function asDocumentId(raw) {
35
+ if (typeof raw !== 'string' ||
36
+ raw.length === 0 ||
37
+ raw.length > MAX_DOCUMENT_ID_LENGTH ||
38
+ C0_CONTROL.test(raw)) {
39
+ throw new OpenDocexError('PROTOCOL_INVALID_MESSAGE', 'Invalid document ID.');
40
+ }
41
+ return raw;
42
+ }
43
+ /** True when `x` has the {@link ClientId} format (`/^[A-Za-z0-9_-]{22}$/`). */
44
+ export function isClientId(x) {
45
+ return typeof x === 'string' && RANDOM_ID.test(x);
46
+ }
47
+ /** True when `x` has the {@link Epoch} format (`/^[A-Za-z0-9_-]{22}$/`). */
48
+ export function isEpoch(x) {
49
+ return typeof x === 'string' && RANDOM_ID.test(x);
50
+ }
51
+ /** True when `x` is an asset ID: the lowercase hex SHA-256 of the asset's bytes (64 characters). */
52
+ export function isAssetId(x) {
53
+ return typeof x === 'string' && ASSET_ID.test(x);
54
+ }
55
+ /**
56
+ * Returns the asset ID of `bytes`: their SHA-256 as 64 lowercase hex characters, computed with
57
+ * `globalThis.crypto.subtle` (LLD §0 R-12). In browsers `crypto.subtle` exists only in secure
58
+ * contexts (HTTPS or localhost).
59
+ */
60
+ export async function computeAssetId(bytes) {
61
+ // A copy backed by a plain ArrayBuffer satisfies the DOM lib's BufferSource type when the client
62
+ // type-checks shared's source, without a type assertion.
63
+ const data = new Uint8Array(bytes);
64
+ const digest = new Uint8Array(await globalThis.crypto.subtle.digest('SHA-256', data));
65
+ let hex = '';
66
+ for (const b of digest)
67
+ hex += b.toString(16).padStart(2, '0');
68
+ return hex;
69
+ }
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ids/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAa1D,MAAM,SAAS,GAAG,qBAAqB,CAAC;AACxC,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAClC,MAAM,UAAU,GAAG,iBAAiB,CAAC;AACrC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAEpC;;;GAGG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,WAAW;IACzB,OAAO,WAAW,EAAc,CAAC;AACnC,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,QAAQ;IACtB,OAAO,WAAW,EAAW,CAAC;AAChC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,IACE,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,CAAC,MAAM,KAAK,CAAC;QAChB,GAAG,CAAC,MAAM,GAAG,sBAAsB;QACnC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EACpB,CAAC;QACD,MAAM,IAAI,cAAc,CAAC,0BAA0B,EAAE,sBAAsB,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,GAAiB,CAAC;AAC3B,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,UAAU,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,OAAO,CAAC,CAAU;IAChC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,SAAS,CAAC,CAAU;IAClC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAAiB;IACpD,iGAAiG;IACjG,yDAAyD;IACzD,MAAM,IAAI,GAA4B,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACtF,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,CAAC,IAAI,MAAM;QAAE,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC/D,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * `@open-docex/shared`: isomorphic contracts used by `@open-docex/server` and
3
+ * `@open-docex/client` (LLD Part 1 §2). It runs in browsers and in Node.js, so it
4
+ * uses no Node or DOM APIs beyond those declared in `env.d.ts`.
5
+ *
6
+ * The root re-exports every public module (LLD Part 1 §2). Main-process code imports only
7
+ * the `/protocol`, `/errors` and `/ids` subpaths (N4). Modules not yet implemented
8
+ * (`/sheet`) is added by a later task (V2).
9
+ */
10
+ export * from './util/index.js';
11
+ export * from './ids/index.js';
12
+ export * from './errors/index.js';
13
+ export * from './protocol/index.js';
14
+ export * from './ot/index.js';
15
+ export * from './text/index.js';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}