@hydranium/protocol 1.0.0-next.39 → 1.0.0-next.391
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -83
- package/lib/abstract-logger.d.ts +11 -0
- package/lib/abstract-logger.d.ts.map +1 -1
- package/lib/abstract-logger.js +16 -0
- package/lib/abstract-logger.js.map +1 -1
- package/lib/client/data-connection.d.ts +303 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +534 -0
- package/lib/client/data-connection.js.map +1 -0
- package/lib/client/data-events.d.ts +11 -2
- package/lib/client/data-events.d.ts.map +1 -1
- package/lib/client/data-events.js +13 -1
- package/lib/client/data-events.js.map +1 -1
- package/lib/client/data-port.d.ts +34 -24
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +762 -89
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +1253 -115
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/index.d.ts +16 -9
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +16 -9
- package/lib/client/index.js.map +1 -1
- package/lib/client/message-relay.d.ts +6 -4
- package/lib/client/message-relay.d.ts.map +1 -1
- package/lib/client/message-relay.js +4 -4
- package/lib/client/message-relay.js.map +1 -1
- package/lib/client/post-message-transport.d.ts +69 -3
- package/lib/client/post-message-transport.d.ts.map +1 -1
- package/lib/client/post-message-transport.js +175 -1
- package/lib/client/post-message-transport.js.map +1 -1
- package/lib/client/rpc-connection.d.ts +173 -0
- package/lib/client/rpc-connection.d.ts.map +1 -0
- package/lib/client/rpc-connection.js +225 -0
- package/lib/client/rpc-connection.js.map +1 -0
- package/lib/client/worker-handshake.d.ts +94 -0
- package/lib/client/worker-handshake.d.ts.map +1 -0
- package/lib/client/worker-handshake.js +51 -0
- package/lib/client/worker-handshake.js.map +1 -0
- package/lib/client/working-copy.d.ts +420 -0
- package/lib/client/working-copy.d.ts.map +1 -0
- package/lib/client/working-copy.js +958 -0
- package/lib/client/working-copy.js.map +1 -0
- package/lib/client-ids.d.ts +45 -0
- package/lib/client-ids.d.ts.map +1 -0
- package/lib/client-ids.js +48 -0
- package/lib/client-ids.js.map +1 -0
- package/lib/clock.d.ts +50 -10
- package/lib/clock.d.ts.map +1 -1
- package/lib/clock.js +36 -1
- package/lib/clock.js.map +1 -1
- package/lib/console-logger.d.ts +23 -0
- package/lib/console-logger.d.ts.map +1 -0
- package/lib/console-logger.js +39 -0
- package/lib/console-logger.js.map +1 -0
- package/lib/data/data-protocol-methods.d.ts +4 -4
- package/lib/data/data-protocol-methods.d.ts.map +1 -1
- package/lib/data/data-protocol-methods.js +7 -0
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +160 -50
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/events.d.ts +75 -31
- package/lib/data/events.d.ts.map +1 -1
- package/lib/data/requests.d.ts +84 -11
- package/lib/data/requests.d.ts.map +1 -1
- package/lib/debouncer.d.ts +7 -4
- package/lib/debouncer.d.ts.map +1 -1
- package/lib/debouncer.js +10 -10
- package/lib/debouncer.js.map +1 -1
- package/lib/errors.d.ts +241 -48
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +395 -60
- package/lib/errors.js.map +1 -1
- package/lib/format-log-arg.d.ts +33 -0
- package/lib/format-log-arg.d.ts.map +1 -0
- package/lib/format-log-arg.js +158 -0
- package/lib/format-log-arg.js.map +1 -0
- package/lib/glsp-edits-settled-actions.d.ts +54 -0
- package/lib/glsp-edits-settled-actions.d.ts.map +1 -0
- package/lib/glsp-edits-settled-actions.js +28 -0
- package/lib/glsp-edits-settled-actions.js.map +1 -0
- package/lib/glsp-request-model-args.d.ts +16 -0
- package/lib/glsp-request-model-args.d.ts.map +1 -0
- package/lib/glsp-request-model-args.js +19 -0
- package/lib/glsp-request-model-args.js.map +1 -0
- package/lib/glsp-save-model-actions.d.ts +55 -0
- package/lib/glsp-save-model-actions.d.ts.map +1 -0
- package/lib/glsp-save-model-actions.js +28 -0
- package/lib/glsp-save-model-actions.js.map +1 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -1
- package/lib/latency-collector.d.ts +10 -4
- package/lib/latency-collector.d.ts.map +1 -1
- package/lib/latency-collector.js +2 -0
- package/lib/latency-collector.js.map +1 -1
- package/lib/logger.d.ts +38 -7
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +42 -4
- package/lib/logger.js.map +1 -1
- package/lib/messages/index.d.ts +4 -2
- package/lib/messages/index.d.ts.map +1 -1
- package/lib/messages/index.js +17 -4
- package/lib/messages/index.js.map +1 -1
- package/lib/messages/primitives.d.ts +59 -4
- package/lib/messages/primitives.d.ts.map +1 -1
- package/lib/messages/primitives.js +97 -4
- package/lib/messages/primitives.js.map +1 -1
- package/lib/model-server.d.ts +58 -11
- package/lib/model-server.d.ts.map +1 -1
- package/lib/model-server.js +4 -2
- package/lib/model-server.js.map +1 -1
- package/lib/model-service/base-version.d.ts +67 -0
- package/lib/model-service/base-version.d.ts.map +1 -0
- package/lib/model-service/base-version.js +44 -0
- package/lib/model-service/base-version.js.map +1 -0
- package/lib/model-service/index.d.ts +1 -1
- package/lib/model-service/index.d.ts.map +1 -1
- package/lib/model-service/index.js +4 -5
- package/lib/model-service/index.js.map +1 -1
- package/lib/model-service/reference-candidate.d.ts +5 -3
- package/lib/model-service/reference-candidate.d.ts.map +1 -1
- package/lib/node/index.d.ts +10 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +29 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/process-memory.d.ts +66 -0
- package/lib/node/process-memory.d.ts.map +1 -0
- package/lib/node/process-memory.js +291 -0
- package/lib/node/process-memory.js.map +1 -0
- package/lib/noop-logger.d.ts.map +1 -1
- package/lib/noop-logger.js.map +1 -1
- package/lib/observable-value.js.map +1 -1
- package/lib/patch-merge.d.ts +63 -35
- package/lib/patch-merge.d.ts.map +1 -1
- package/lib/patch-merge.js +171 -25
- package/lib/patch-merge.js.map +1 -1
- package/lib/pending-work-tracker.d.ts +33 -0
- package/lib/pending-work-tracker.d.ts.map +1 -0
- package/lib/pending-work-tracker.js +48 -0
- package/lib/pending-work-tracker.js.map +1 -0
- package/lib/profile-session.d.ts +24 -8
- package/lib/profile-session.d.ts.map +1 -1
- package/lib/profile-session.js +13 -4
- package/lib/profile-session.js.map +1 -1
- package/lib/profiling.d.ts +15 -2
- package/lib/profiling.d.ts.map +1 -1
- package/lib/profiling.js.map +1 -1
- package/lib/project.d.ts +6 -2
- package/lib/project.d.ts.map +1 -1
- package/lib/project.js.map +1 -1
- package/lib/random-uuid.d.ts +14 -0
- package/lib/random-uuid.d.ts.map +1 -0
- package/lib/random-uuid.js +24 -0
- package/lib/random-uuid.js.map +1 -0
- package/lib/reconcile-write.d.ts +70 -0
- package/lib/reconcile-write.d.ts.map +1 -0
- package/lib/reconcile-write.js +69 -0
- package/lib/reconcile-write.js.map +1 -0
- package/lib/rpc/bind-rpc-methods.d.ts +6 -2
- package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.js +17 -7
- package/lib/rpc/bind-rpc-methods.js.map +1 -1
- package/lib/rpc/create-rpc-proxy.d.ts +3 -0
- package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
- package/lib/rpc/create-rpc-proxy.js +6 -1
- package/lib/rpc/create-rpc-proxy.js.map +1 -1
- package/lib/rpc/index.d.ts +1 -0
- package/lib/rpc/index.d.ts.map +1 -1
- package/lib/rpc/index.js +1 -0
- package/lib/rpc/index.js.map +1 -1
- package/lib/rpc/send-by-method-name.d.ts +76 -0
- package/lib/rpc/send-by-method-name.d.ts.map +1 -0
- package/lib/rpc/send-by-method-name.js +120 -0
- package/lib/rpc/send-by-method-name.js.map +1 -0
- package/lib/rpc/wire-prefix.js.map +1 -1
- package/lib/save-text-document.d.ts +40 -0
- package/lib/save-text-document.d.ts.map +1 -0
- package/lib/save-text-document.js +34 -0
- package/lib/save-text-document.js.map +1 -0
- package/lib/testing/catalogue-audit.js.map +1 -1
- package/lib/testing/data-doubles.d.ts +36 -11
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +47 -9
- package/lib/testing/data-doubles.js.map +1 -1
- package/lib/testing/fake-clock.d.ts +17 -2
- package/lib/testing/fake-clock.d.ts.map +1 -1
- package/lib/testing/fake-clock.js +61 -46
- package/lib/testing/fake-clock.js.map +1 -1
- package/lib/testing/harness.d.ts +9 -0
- package/lib/testing/harness.d.ts.map +1 -1
- package/lib/testing/index.d.ts +1 -0
- package/lib/testing/index.d.ts.map +1 -1
- package/lib/testing/index.js +4 -3
- package/lib/testing/index.js.map +1 -1
- package/lib/testing/node/duplex-connection.d.ts.map +1 -1
- package/lib/testing/node/duplex-connection.js +3 -2
- package/lib/testing/node/duplex-connection.js.map +1 -1
- package/lib/testing/node/duplex-stream.js.map +1 -1
- package/lib/testing/node/index.d.ts +2 -0
- package/lib/testing/node/index.d.ts.map +1 -1
- package/lib/testing/node/index.js +3 -2
- package/lib/testing/node/index.js.map +1 -1
- package/lib/testing/node/message-port-pair.d.ts +25 -0
- package/lib/testing/node/message-port-pair.d.ts.map +1 -0
- package/lib/testing/node/message-port-pair.js +26 -0
- package/lib/testing/node/message-port-pair.js.map +1 -0
- package/lib/testing/node/unhandled-rejections.d.ts +20 -0
- package/lib/testing/node/unhandled-rejections.d.ts.map +1 -0
- package/lib/testing/node/unhandled-rejections.js +35 -0
- package/lib/testing/node/unhandled-rejections.js.map +1 -0
- package/lib/testing/transfer-node-builder.d.ts +81 -0
- package/lib/testing/transfer-node-builder.d.ts.map +1 -0
- package/lib/testing/transfer-node-builder.js +47 -0
- package/lib/testing/transfer-node-builder.js.map +1 -0
- package/lib/testing/wait-for.d.ts +9 -3
- package/lib/testing/wait-for.d.ts.map +1 -1
- package/lib/testing/wait-for.js +57 -11
- package/lib/testing/wait-for.js.map +1 -1
- package/lib/tracer.d.ts.map +1 -1
- package/lib/tracer.js +5 -9
- package/lib/tracer.js.map +1 -1
- package/lib/transfer-diagnostic.d.ts +11 -0
- package/lib/transfer-diagnostic.d.ts.map +1 -1
- package/lib/transfer-diagnostic.js +17 -0
- package/lib/transfer-diagnostic.js.map +1 -1
- package/lib/transfer-document.d.ts +108 -32
- package/lib/transfer-document.d.ts.map +1 -1
- package/lib/transfer-document.js +17 -9
- package/lib/transfer-document.js.map +1 -1
- package/lib/transfer-element.d.ts +4 -4
- package/lib/types.d.ts +32 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/{model-service/args.js → types.js} +2 -2
- package/lib/types.js.map +1 -0
- package/lib/uri.d.ts.map +1 -1
- package/lib/uri.js.map +1 -1
- package/lib/util.d.ts +8 -2
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js +32 -4
- package/lib/util.js.map +1 -1
- package/package.json +24 -40
- package/src/abstract-logger.ts +18 -0
- package/src/client/data-connection.ts +654 -0
- package/src/client/data-events.ts +15 -1
- package/src/client/data-port.ts +36 -25
- package/src/client/data-session.ts +1606 -137
- package/src/client/index.ts +16 -9
- package/src/client/message-relay.ts +6 -4
- package/src/client/post-message-transport.ts +224 -4
- package/src/client/rpc-connection.ts +302 -0
- package/src/client/worker-handshake.ts +121 -0
- package/src/client/working-copy.ts +1116 -0
- package/src/client-ids.ts +49 -0
- package/src/clock.ts +68 -10
- package/src/console-logger.ts +39 -0
- package/src/data/data-protocol-methods.ts +8 -1
- package/src/data/data-server-protocol.ts +184 -49
- package/src/data/events.ts +77 -31
- package/src/data/requests.ts +90 -11
- package/src/debouncer.ts +11 -11
- package/src/errors.ts +496 -71
- package/src/format-log-arg.ts +176 -0
- package/src/glsp-edits-settled-actions.ts +62 -0
- package/src/glsp-request-model-args.ts +16 -0
- package/src/glsp-save-model-actions.ts +64 -0
- package/src/index.ts +11 -0
- package/src/latency-collector.ts +10 -3
- package/src/logger.ts +44 -8
- package/src/messages/index.ts +12 -2
- package/src/messages/primitives.ts +129 -5
- package/src/model-server.ts +62 -17
- package/src/model-service/base-version.ts +75 -0
- package/src/model-service/index.ts +4 -5
- package/src/model-service/reference-candidate.ts +5 -3
- package/src/node/index.ts +14 -0
- package/src/node/process-memory.ts +299 -0
- package/src/patch-merge.ts +230 -45
- package/src/pending-work-tracker.ts +48 -0
- package/src/profile-session.ts +31 -11
- package/src/profiling.ts +15 -2
- package/src/project.ts +6 -2
- package/src/random-uuid.ts +21 -0
- package/src/reconcile-write.ts +131 -0
- package/src/rpc/README.md +6 -6
- package/src/rpc/bind-rpc-methods.ts +18 -8
- package/src/rpc/create-rpc-proxy.ts +6 -1
- package/src/rpc/index.ts +1 -0
- package/src/rpc/send-by-method-name.ts +140 -0
- package/src/save-text-document.ts +39 -0
- package/src/testing/data-doubles.ts +119 -19
- package/src/testing/fake-clock.ts +76 -48
- package/src/testing/harness.ts +10 -0
- package/src/testing/index.ts +4 -3
- package/src/testing/node/duplex-connection.ts +3 -2
- package/src/testing/node/index.ts +3 -2
- package/src/testing/node/message-port-pair.ts +40 -0
- package/src/testing/node/unhandled-rejections.ts +31 -0
- package/src/testing/transfer-node-builder.ts +107 -0
- package/src/testing/wait-for.ts +61 -13
- package/src/tracer.ts +5 -9
- package/src/transfer-diagnostic.ts +17 -0
- package/src/transfer-document.ts +130 -34
- package/src/transfer-element.ts +4 -4
- package/src/types.ts +30 -0
- package/src/util.ts +33 -6
- package/lib/model-service/args.d.ts +0 -64
- package/lib/model-service/args.d.ts.map +0 -1
- package/lib/model-service/args.js.map +0 -1
- package/src/model-service/args.ts +0 -67
package/lib/logger.d.ts
CHANGED
|
@@ -24,15 +24,15 @@ export declare const LEVEL_LABELS: Record<LogLevel, string>;
|
|
|
24
24
|
* and every `for` / `sub` / `with` derivation preserves the implementation type.
|
|
25
25
|
*/
|
|
26
26
|
export interface Logger {
|
|
27
|
-
/**
|
|
27
|
+
/** Requested work failed; logged once, by the code that ends the failure, not by one that rethrows it. */
|
|
28
28
|
error(message?: string, ...args: unknown[]): this;
|
|
29
|
-
/**
|
|
29
|
+
/** An anomaly that was handled, or work declined by design, such as a conflict or a cap; a clean run logs none. */
|
|
30
30
|
warn(message?: string, ...args: unknown[]): this;
|
|
31
|
-
/**
|
|
31
|
+
/** A milestone the person running the server would recognise without knowing the internals. */
|
|
32
32
|
info(message?: string, ...args: unknown[]): this;
|
|
33
|
-
/**
|
|
33
|
+
/** Diagnosis; its level decides whether the line is built, never which code runs. */
|
|
34
34
|
debug(message?: string, ...args: unknown[]): this;
|
|
35
|
-
/** High-volume
|
|
35
|
+
/** High-volume diagnosis, emitted only at the `'trace'` threshold; as for `debug`, no code runs only for it. */
|
|
36
36
|
trace(message?: string, ...args: unknown[]): this;
|
|
37
37
|
/** Log a message at info-level threshold with a `Log` label (rather than `Info`). */
|
|
38
38
|
log(message?: string, ...args: unknown[]): this;
|
|
@@ -74,7 +74,23 @@ export declare namespace Logger {
|
|
|
74
74
|
/** Read the current process-wide log threshold. */
|
|
75
75
|
function getLevel(): LogThreshold;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* Set the log file's own threshold, which {@link setLevel} does not move;
|
|
78
|
+
* `undefined` makes the file follow {@link getLevel}. A file sink compares
|
|
79
|
+
* against `getFileLevel() ?? getLevel()`, every other sink against
|
|
80
|
+
* {@link getLevel}.
|
|
81
|
+
*
|
|
82
|
+
* Set it through the file sink's own configuration, which clears it with
|
|
83
|
+
* the file: set here with no file configured, it widens
|
|
84
|
+
* {@link isLevelEnabled} for lines nothing writes.
|
|
85
|
+
*/
|
|
86
|
+
function setFileLevel(level: LogThreshold | undefined): void;
|
|
87
|
+
/** Read the log file's own threshold, `undefined` while it follows {@link getLevel}. */
|
|
88
|
+
function getFileLevel(): LogThreshold | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Whether any sink takes a message at `level`: the more verbose of
|
|
91
|
+
* {@link getLevel} and {@link getFileLevel} decides. A sink that admits less
|
|
92
|
+
* re-checks its own threshold before writing.
|
|
93
|
+
*
|
|
78
94
|
* Use to guard expensive log-line construction:
|
|
79
95
|
* `if (Logger.isLevelEnabled('trace')) logger.trace(buildPayload())`.
|
|
80
96
|
*/
|
|
@@ -103,8 +119,23 @@ export declare function parseLogLevel(value: unknown): LogThreshold | undefined;
|
|
|
103
119
|
* instead of duplicating the literal string.
|
|
104
120
|
*/
|
|
105
121
|
export declare const DEFAULT_LOG_LEVEL_ENV = "HYDRANIUM_LOG_LEVEL";
|
|
106
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* Env var the server reads its log file-tee target from. The path may hold
|
|
124
|
+
* `{workspace}`, filled in once the server knows its workspace, and `{pid}`.
|
|
125
|
+
* See {@link DEFAULT_LOG_LEVEL_ENV}.
|
|
126
|
+
*/
|
|
107
127
|
export declare const DEFAULT_LOG_FILE_ENV = "HYDRANIUM_LOG_FILE";
|
|
128
|
+
/**
|
|
129
|
+
* Env var the server reads the file tee's own threshold from, which the LSP
|
|
130
|
+
* log-level setting does not change. See {@link Logger.setFileLevel}.
|
|
131
|
+
*/
|
|
132
|
+
export declare const DEFAULT_LOG_FILE_LEVEL_ENV = "HYDRANIUM_LOG_FILE_LEVEL";
|
|
133
|
+
/**
|
|
134
|
+
* Env var naming the file a Node server writes its CPU profile to when it
|
|
135
|
+
* ends. Takes `{workspace}` and `{pid}` as {@link DEFAULT_LOG_FILE_ENV} does;
|
|
136
|
+
* the write replaces the file, so `{pid}` keeps one per server.
|
|
137
|
+
*/
|
|
138
|
+
export declare const DEFAULT_CPU_PROFILE_FILE_ENV = "HYDRANIUM_CPU_PROFILE_FILE";
|
|
108
139
|
/**
|
|
109
140
|
* Human-readable formatting helpers used in log lines and diagnostic output.
|
|
110
141
|
*/
|
package/lib/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFA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GAAG,YAAY,GAAG,SAAS,CAGtE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAC3D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AACzD;;;GAGG;AACH,eAAO,MAAM,0BAA0B,6BAA6B,CAAC;AACrE;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,+BAA+B,CAAC;AAEzE;;GAEG;AACH,yBAAiB,MAAM,CAAC;IACrB,0DAA0D;IAC1D,SAAgB,SAAS,CAAC,CAAC,GAAE,IAAiB,GAAG,MAAM,CAMtD;IAED,wEAAwE;IACxE,SAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE1C;IAED,6EAA6E;IAC7E,SAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAY3C;CACH"}
|
package/lib/logger.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* SPDX-License-Identifier: MIT
|
|
9
9
|
********************************************************************************/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.Format = exports.DEFAULT_LOG_FILE_ENV = exports.DEFAULT_LOG_LEVEL_ENV = exports.Logger = exports.LEVEL_LABELS = exports.LEVEL_ORDER = void 0;
|
|
11
|
+
exports.Format = exports.DEFAULT_CPU_PROFILE_FILE_ENV = exports.DEFAULT_LOG_FILE_LEVEL_ENV = exports.DEFAULT_LOG_FILE_ENV = exports.DEFAULT_LOG_LEVEL_ENV = exports.Logger = exports.LEVEL_LABELS = exports.LEVEL_ORDER = void 0;
|
|
12
12
|
exports.isLogThreshold = isLogThreshold;
|
|
13
13
|
exports.parseLogLevel = parseLogLevel;
|
|
14
14
|
exports.LEVEL_ORDER = { off: 0, error: 1, warn: 2, info: 3, debug: 4, trace: 5 };
|
|
@@ -23,6 +23,7 @@ exports.LEVEL_LABELS = {
|
|
|
23
23
|
/** Module-global threshold; shared by every `AbstractLogger` instance so derived child
|
|
24
24
|
* loggers pick up live updates without each having to subscribe to a configuration source. */
|
|
25
25
|
let currentLevel = 'info';
|
|
26
|
+
let fileLevel;
|
|
26
27
|
/**
|
|
27
28
|
* Companion namespace for the {@link Logger} interface holding global
|
|
28
29
|
* threshold configuration.
|
|
@@ -46,12 +47,34 @@ var Logger;
|
|
|
46
47
|
}
|
|
47
48
|
Logger.getLevel = getLevel;
|
|
48
49
|
/**
|
|
49
|
-
*
|
|
50
|
+
* Set the log file's own threshold, which {@link setLevel} does not move;
|
|
51
|
+
* `undefined` makes the file follow {@link getLevel}. A file sink compares
|
|
52
|
+
* against `getFileLevel() ?? getLevel()`, every other sink against
|
|
53
|
+
* {@link getLevel}.
|
|
54
|
+
*
|
|
55
|
+
* Set it through the file sink's own configuration, which clears it with
|
|
56
|
+
* the file: set here with no file configured, it widens
|
|
57
|
+
* {@link isLevelEnabled} for lines nothing writes.
|
|
58
|
+
*/
|
|
59
|
+
function setFileLevel(level) {
|
|
60
|
+
fileLevel = level;
|
|
61
|
+
}
|
|
62
|
+
Logger.setFileLevel = setFileLevel;
|
|
63
|
+
/** Read the log file's own threshold, `undefined` while it follows {@link getLevel}. */
|
|
64
|
+
function getFileLevel() {
|
|
65
|
+
return fileLevel;
|
|
66
|
+
}
|
|
67
|
+
Logger.getFileLevel = getFileLevel;
|
|
68
|
+
/**
|
|
69
|
+
* Whether any sink takes a message at `level`: the more verbose of
|
|
70
|
+
* {@link getLevel} and {@link getFileLevel} decides. A sink that admits less
|
|
71
|
+
* re-checks its own threshold before writing.
|
|
72
|
+
*
|
|
50
73
|
* Use to guard expensive log-line construction:
|
|
51
74
|
* `if (Logger.isLevelEnabled('trace')) logger.trace(buildPayload())`.
|
|
52
75
|
*/
|
|
53
76
|
function isLevelEnabled(level) {
|
|
54
|
-
return exports.LEVEL_ORDER[level] <= exports.LEVEL_ORDER[currentLevel];
|
|
77
|
+
return exports.LEVEL_ORDER[level] <= Math.max(exports.LEVEL_ORDER[currentLevel], fileLevel ? exports.LEVEL_ORDER[fileLevel] : 0);
|
|
55
78
|
}
|
|
56
79
|
Logger.isLevelEnabled = isLevelEnabled;
|
|
57
80
|
/**
|
|
@@ -86,8 +109,23 @@ function parseLogLevel(value) {
|
|
|
86
109
|
* instead of duplicating the literal string.
|
|
87
110
|
*/
|
|
88
111
|
exports.DEFAULT_LOG_LEVEL_ENV = 'HYDRANIUM_LOG_LEVEL';
|
|
89
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Env var the server reads its log file-tee target from. The path may hold
|
|
114
|
+
* `{workspace}`, filled in once the server knows its workspace, and `{pid}`.
|
|
115
|
+
* See {@link DEFAULT_LOG_LEVEL_ENV}.
|
|
116
|
+
*/
|
|
90
117
|
exports.DEFAULT_LOG_FILE_ENV = 'HYDRANIUM_LOG_FILE';
|
|
118
|
+
/**
|
|
119
|
+
* Env var the server reads the file tee's own threshold from, which the LSP
|
|
120
|
+
* log-level setting does not change. See {@link Logger.setFileLevel}.
|
|
121
|
+
*/
|
|
122
|
+
exports.DEFAULT_LOG_FILE_LEVEL_ENV = 'HYDRANIUM_LOG_FILE_LEVEL';
|
|
123
|
+
/**
|
|
124
|
+
* Env var naming the file a Node server writes its CPU profile to when it
|
|
125
|
+
* ends. Takes `{workspace}` and `{pid}` as {@link DEFAULT_LOG_FILE_ENV} does;
|
|
126
|
+
* the write replaces the file, so `{pid}` keeps one per server.
|
|
127
|
+
*/
|
|
128
|
+
exports.DEFAULT_CPU_PROFILE_FILE_ENV = 'HYDRANIUM_CPU_PROFILE_FILE';
|
|
91
129
|
/**
|
|
92
130
|
* Human-readable formatting helpers used in log lines and diagnostic output.
|
|
93
131
|
*/
|
package/lib/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAA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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;IACnF,CAAC;IAZe,OAAA,KAAK,QAYpB,CAAA;AACJ,CAAC,EA7BgB,MAAM,aAAN,MAAM,GAAN,MAAM,QA6BtB"}
|
package/lib/messages/index.d.ts
CHANGED
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
* The English is a fallback, not a contract; the code is the contract.
|
|
23
23
|
*/
|
|
24
24
|
export * from './primitives';
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
25
|
+
export { DOCUMENT_NOT_OPEN, DOCUMENT_SYNTAX_ERROR, DUPLICATE_CLIENT_ID, SAVE_FAILED, SESSION_CLOSED, STALE_BASE_VERSION_SAVE, STALE_BASE_VERSION_UPDATE } from '../errors';
|
|
26
|
+
export { DATA_CONNECTION_SESSION_RESTORE_FAILED, DATA_CONNECTION_WATCH_RESTORE_FAILED } from '../client/data-connection';
|
|
27
|
+
export { DATA_SERVER_CONNECT_FAILED, DATA_SERVER_NOT_READY } from '../client/rpc-connection';
|
|
28
|
+
export { DATA_SESSION_ANSWER_WITHOUT_MODEL, DATA_SESSION_RESTORE_FAILED, DATA_SESSION_UNSAVED_LOST } from '../client/data-session';
|
|
27
29
|
export { RELAY_REPLAY_FAILED, RELAY_TRANSPORT_OPEN_FAILED, RELAY_TRANSPORT_READ_FAILED, RELAY_TRANSPORT_WRITE_FAILED } from '../client/message-relay';
|
|
28
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;GAcG;AAEH,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;GAcG;AAEH,cAAc,cAAc,CAAC;AAE7B,OAAO,EACJ,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,uBAAuB,EACvB,yBAAyB,EAC3B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,sCAAsC,EAAE,oCAAoC,EAAE,MAAM,2BAA2B,CAAC;AACzH,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,iCAAiC,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnI,OAAO,EACJ,mBAAmB,EACnB,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC9B,MAAM,yBAAyB,CAAC"}
|
package/lib/messages/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
22
22
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.RELAY_TRANSPORT_WRITE_FAILED = exports.RELAY_TRANSPORT_READ_FAILED = exports.RELAY_TRANSPORT_OPEN_FAILED = exports.RELAY_REPLAY_FAILED = exports.DATA_SERVER_NOT_READY = exports.DATA_SERVER_CONNECT_FAILED = exports.
|
|
25
|
+
exports.RELAY_TRANSPORT_WRITE_FAILED = exports.RELAY_TRANSPORT_READ_FAILED = exports.RELAY_TRANSPORT_OPEN_FAILED = exports.RELAY_REPLAY_FAILED = exports.DATA_SESSION_UNSAVED_LOST = exports.DATA_SESSION_RESTORE_FAILED = exports.DATA_SESSION_ANSWER_WITHOUT_MODEL = exports.DATA_SERVER_NOT_READY = exports.DATA_SERVER_CONNECT_FAILED = exports.DATA_CONNECTION_WATCH_RESTORE_FAILED = exports.DATA_CONNECTION_SESSION_RESTORE_FAILED = exports.STALE_BASE_VERSION_UPDATE = exports.STALE_BASE_VERSION_SAVE = exports.SESSION_CLOSED = exports.SAVE_FAILED = exports.DUPLICATE_CLIENT_ID = exports.DOCUMENT_SYNTAX_ERROR = exports.DOCUMENT_NOT_OPEN = void 0;
|
|
26
26
|
/**
|
|
27
27
|
* The message-externalization mechanism, plus every user-facing message
|
|
28
28
|
* `@hydranium/protocol` itself raises.
|
|
@@ -40,10 +40,23 @@ exports.RELAY_TRANSPORT_WRITE_FAILED = exports.RELAY_TRANSPORT_READ_FAILED = exp
|
|
|
40
40
|
*/
|
|
41
41
|
__exportStar(require("./primitives"), exports);
|
|
42
42
|
var errors_1 = require("../errors");
|
|
43
|
-
Object.defineProperty(exports, "
|
|
43
|
+
Object.defineProperty(exports, "DOCUMENT_NOT_OPEN", { enumerable: true, get: function () { return errors_1.DOCUMENT_NOT_OPEN; } });
|
|
44
|
+
Object.defineProperty(exports, "DOCUMENT_SYNTAX_ERROR", { enumerable: true, get: function () { return errors_1.DOCUMENT_SYNTAX_ERROR; } });
|
|
45
|
+
Object.defineProperty(exports, "DUPLICATE_CLIENT_ID", { enumerable: true, get: function () { return errors_1.DUPLICATE_CLIENT_ID; } });
|
|
46
|
+
Object.defineProperty(exports, "SAVE_FAILED", { enumerable: true, get: function () { return errors_1.SAVE_FAILED; } });
|
|
47
|
+
Object.defineProperty(exports, "SESSION_CLOSED", { enumerable: true, get: function () { return errors_1.SESSION_CLOSED; } });
|
|
48
|
+
Object.defineProperty(exports, "STALE_BASE_VERSION_SAVE", { enumerable: true, get: function () { return errors_1.STALE_BASE_VERSION_SAVE; } });
|
|
49
|
+
Object.defineProperty(exports, "STALE_BASE_VERSION_UPDATE", { enumerable: true, get: function () { return errors_1.STALE_BASE_VERSION_UPDATE; } });
|
|
50
|
+
var data_connection_1 = require("../client/data-connection");
|
|
51
|
+
Object.defineProperty(exports, "DATA_CONNECTION_SESSION_RESTORE_FAILED", { enumerable: true, get: function () { return data_connection_1.DATA_CONNECTION_SESSION_RESTORE_FAILED; } });
|
|
52
|
+
Object.defineProperty(exports, "DATA_CONNECTION_WATCH_RESTORE_FAILED", { enumerable: true, get: function () { return data_connection_1.DATA_CONNECTION_WATCH_RESTORE_FAILED; } });
|
|
53
|
+
var rpc_connection_1 = require("../client/rpc-connection");
|
|
54
|
+
Object.defineProperty(exports, "DATA_SERVER_CONNECT_FAILED", { enumerable: true, get: function () { return rpc_connection_1.DATA_SERVER_CONNECT_FAILED; } });
|
|
55
|
+
Object.defineProperty(exports, "DATA_SERVER_NOT_READY", { enumerable: true, get: function () { return rpc_connection_1.DATA_SERVER_NOT_READY; } });
|
|
44
56
|
var data_session_1 = require("../client/data-session");
|
|
45
|
-
Object.defineProperty(exports, "
|
|
46
|
-
Object.defineProperty(exports, "
|
|
57
|
+
Object.defineProperty(exports, "DATA_SESSION_ANSWER_WITHOUT_MODEL", { enumerable: true, get: function () { return data_session_1.DATA_SESSION_ANSWER_WITHOUT_MODEL; } });
|
|
58
|
+
Object.defineProperty(exports, "DATA_SESSION_RESTORE_FAILED", { enumerable: true, get: function () { return data_session_1.DATA_SESSION_RESTORE_FAILED; } });
|
|
59
|
+
Object.defineProperty(exports, "DATA_SESSION_UNSAVED_LOST", { enumerable: true, get: function () { return data_session_1.DATA_SESSION_UNSAVED_LOST; } });
|
|
47
60
|
var message_relay_1 = require("../client/message-relay");
|
|
48
61
|
Object.defineProperty(exports, "RELAY_REPLAY_FAILED", { enumerable: true, get: function () { return message_relay_1.RELAY_REPLAY_FAILED; } });
|
|
49
62
|
Object.defineProperty(exports, "RELAY_TRANSPORT_OPEN_FAILED", { enumerable: true, get: function () { return message_relay_1.RELAY_TRANSPORT_OPEN_FAILED; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;;AAElF;;;;;;;;;;;;;;GAcG;AAEH,+CAA6B;AAE7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;;AAElF;;;;;;;;;;;;;;GAcG;AAEH,+CAA6B;AAE7B,oCAQmB;AAPhB,2GAAA,iBAAiB,OAAA;AACjB,+GAAA,qBAAqB,OAAA;AACrB,6GAAA,mBAAmB,OAAA;AACnB,qGAAA,WAAW,OAAA;AACX,wGAAA,cAAc,OAAA;AACd,iHAAA,uBAAuB,OAAA;AACvB,mHAAA,yBAAyB,OAAA;AAE5B,6DAAyH;AAAhH,yIAAA,sCAAsC,OAAA;AAAE,uIAAA,oCAAoC,OAAA;AACrF,2DAA6F;AAApF,4HAAA,0BAA0B,OAAA;AAAE,uHAAA,qBAAqB,OAAA;AAC1D,uDAAmI;AAA1H,iIAAA,iCAAiC,OAAA;AAAE,2HAAA,2BAA2B,OAAA;AAAE,yHAAA,yBAAyB,OAAA;AAClG,yDAKiC;AAJ9B,oHAAA,mBAAmB,OAAA;AACnB,4HAAA,2BAA2B,OAAA;AAC3B,4HAAA,2BAA2B,OAAA;AAC3B,6HAAA,4BAA4B,OAAA"}
|
|
@@ -108,19 +108,74 @@ export type HydraniumResponseError = ResponseError<HydraniumMessageData>;
|
|
|
108
108
|
*/
|
|
109
109
|
export declare function messageError<S extends string>(code: number, message: MessageDefinition<S>, ...params: ParamsArg<S>): HydraniumResponseError;
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
111
|
+
* The reading user's language, as the tag a client declared.
|
|
112
|
+
*
|
|
113
|
+
* Neither validated nor normalised anywhere: rejecting an unfamiliar tag would
|
|
114
|
+
* be selecting a locale, which the framework does not do.
|
|
115
|
+
*
|
|
116
|
+
* NOT a Langium language id, which names a grammar. The two are strings of the
|
|
117
|
+
* same shape reachable from the same services, so one used where the other
|
|
118
|
+
* belongs misses every lookup rather than failing.
|
|
119
|
+
*/
|
|
120
|
+
export type Locale = string;
|
|
121
|
+
/**
|
|
122
|
+
* A host's templates for one locale, keyed by the whole message code.
|
|
123
|
+
*
|
|
124
|
+
* **Flat, not nested.** A code is one key here, `/` separators included; a host
|
|
125
|
+
* whose own catalogue format nests — Theia's does — flattens on the way in. A
|
|
126
|
+
* map that nests instead misses every lookup while type-checking, because the
|
|
127
|
+
* value this is indexed by is `ResolvedMessage.code`.
|
|
128
|
+
*
|
|
129
|
+
* **Partial by nature rather than by convention.** A code with no entry renders
|
|
130
|
+
* its English default, so a catalogue covering none of a package's codes is a
|
|
131
|
+
* valid catalogue and not a broken one — which is what lets an adopter translate
|
|
132
|
+
* as much or as little as they like.
|
|
133
|
+
*
|
|
134
|
+
* Deliberately NOT narrowed to the codes that exist, and a `Code extends string`
|
|
135
|
+
* parameter would not buy what it appears to: a catalogue is loaded as JSON, so
|
|
136
|
+
* it reaches a checked position as a variable rather than as an object literal,
|
|
137
|
+
* and excess-property checking — the only thing that would reject a mistyped
|
|
138
|
+
* key — does not run there. The gain is a compile error for a catalogue with no
|
|
139
|
+
* correct key at all; the cost is a code union to maintain by hand, since a
|
|
140
|
+
* declaration does not carry its code as a literal type.
|
|
114
141
|
*/
|
|
115
|
-
export
|
|
142
|
+
export type MessageCatalogue = Readonly<Record<string, string>>;
|
|
143
|
+
export declare namespace MessageCatalogue {
|
|
144
|
+
/**
|
|
145
|
+
* One catalogue from several, for a renderer whose override supplies entries
|
|
146
|
+
* over the ones it inherits.
|
|
147
|
+
*
|
|
148
|
+
* **Later wins**, so a caller passes the inherited answer before its own.
|
|
149
|
+
*
|
|
150
|
+
* **No source at all answers `undefined`, not `{}`.** A renderer holds that
|
|
151
|
+
* answer as the locale having no catalogue and renders straight through; an
|
|
152
|
+
* empty object is a catalogue that misses every lookup, so returning one
|
|
153
|
+
* turns the opt-out into a per-message search that yields the same English.
|
|
154
|
+
*/
|
|
155
|
+
function merge(...catalogues: ReadonlyArray<MessageCatalogue | undefined>): MessageCatalogue | undefined;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Render on the side that knows the reading user's locale. Omitting
|
|
159
|
+
* `translations` is how an adopter without i18n opts out, and yields the
|
|
160
|
+
* English.
|
|
161
|
+
*/
|
|
162
|
+
export declare function renderFrameworkMessage(message: ResolvedMessage, translations?: MessageCatalogue): string;
|
|
116
163
|
export declare function resolvedFromResponseError(error: ResponseError<unknown>): ResolvedMessage | undefined;
|
|
117
164
|
/**
|
|
118
165
|
* The detail half of a `{detail}` placeholder. A technical error string is safe
|
|
119
166
|
* to pass as a parameter for the same reason a number is: it is not itself
|
|
120
167
|
* translatable text, so it needs no code of its own. A PROSE fragment is not,
|
|
121
168
|
* and must become one code per value instead.
|
|
169
|
+
*
|
|
170
|
+
* For a reader of the client; the log takes {@link describeErrorWithStack}.
|
|
122
171
|
*/
|
|
123
172
|
export declare function describeError(error: unknown): string;
|
|
173
|
+
/**
|
|
174
|
+
* An error for the log: its stack where it has one, which names where it was
|
|
175
|
+
* thrown, and its causes, which name what failed when an error wraps another.
|
|
176
|
+
* Never for the client, whose reader cannot act on a stack.
|
|
177
|
+
*/
|
|
178
|
+
export declare function describeErrorWithStack(error: unknown): string;
|
|
124
179
|
/**
|
|
125
180
|
* Recognises a declaration among a barrel's exports. The `format` check is what
|
|
126
181
|
* discriminates: a `code` + `text` pair alone admits any object that happens to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../src/messages/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;AAEtE,KAAK,WAAW,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MA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C,CAAC;AAEhE,yBAAiB,gBAAgB,CAAC;IAC/B;;;;;;;;;;OAUG;IACH,SAAgB,KAAK,CAAC,GAAG,UAAU,EAAE,aAAa,CAAC,gBAAgB,GAAG,SAAS,CAAC,GAAG,gBAAgB,GAAG,SAAS,CAM9G;CACH;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,EAAE,YAAY,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAGxG;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,eAAe,GAAG,SAAS,CAEpG;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAG7D;AA0DD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAAC,MAAM,CAAC,CASvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAE3E"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* SPDX-License-Identifier: MIT
|
|
9
9
|
********************************************************************************/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.MessageCatalogue = void 0;
|
|
11
12
|
exports.defineMessage = defineMessage;
|
|
12
13
|
exports.interpolate = interpolate;
|
|
13
14
|
exports.messageData = messageData;
|
|
@@ -17,6 +18,7 @@ exports.messageError = messageError;
|
|
|
17
18
|
exports.renderFrameworkMessage = renderFrameworkMessage;
|
|
18
19
|
exports.resolvedFromResponseError = resolvedFromResponseError;
|
|
19
20
|
exports.describeError = describeError;
|
|
21
|
+
exports.describeErrorWithStack = describeErrorWithStack;
|
|
20
22
|
exports.isMessageDeclaration = isMessageDeclaration;
|
|
21
23
|
exports.collectMessages = collectMessages;
|
|
22
24
|
const vscode_jsonrpc_1 = require("vscode-jsonrpc");
|
|
@@ -89,10 +91,32 @@ function hasMessageIdentity(data) {
|
|
|
89
91
|
function messageError(code, message, ...params) {
|
|
90
92
|
return new vscode_jsonrpc_1.ResponseError(code, message.format(...params), messageData(message, ...params));
|
|
91
93
|
}
|
|
94
|
+
var MessageCatalogue;
|
|
95
|
+
(function (MessageCatalogue) {
|
|
96
|
+
/**
|
|
97
|
+
* One catalogue from several, for a renderer whose override supplies entries
|
|
98
|
+
* over the ones it inherits.
|
|
99
|
+
*
|
|
100
|
+
* **Later wins**, so a caller passes the inherited answer before its own.
|
|
101
|
+
*
|
|
102
|
+
* **No source at all answers `undefined`, not `{}`.** A renderer holds that
|
|
103
|
+
* answer as the locale having no catalogue and renders straight through; an
|
|
104
|
+
* empty object is a catalogue that misses every lookup, so returning one
|
|
105
|
+
* turns the opt-out into a per-message search that yields the same English.
|
|
106
|
+
*/
|
|
107
|
+
function merge(...catalogues) {
|
|
108
|
+
const present = catalogues.filter((catalogue) => catalogue !== undefined);
|
|
109
|
+
if (present.length <= 1) {
|
|
110
|
+
return present[0];
|
|
111
|
+
}
|
|
112
|
+
return Object.assign({}, ...present);
|
|
113
|
+
}
|
|
114
|
+
MessageCatalogue.merge = merge;
|
|
115
|
+
})(MessageCatalogue || (exports.MessageCatalogue = MessageCatalogue = {}));
|
|
92
116
|
/**
|
|
93
|
-
* Render on the side that knows the reading user's locale.
|
|
94
|
-
*
|
|
95
|
-
*
|
|
117
|
+
* Render on the side that knows the reading user's locale. Omitting
|
|
118
|
+
* `translations` is how an adopter without i18n opts out, and yields the
|
|
119
|
+
* English.
|
|
96
120
|
*/
|
|
97
121
|
function renderFrameworkMessage(message, translations) {
|
|
98
122
|
const template = translations?.[message.code];
|
|
@@ -106,9 +130,78 @@ function resolvedFromResponseError(error) {
|
|
|
106
130
|
* to pass as a parameter for the same reason a number is: it is not itself
|
|
107
131
|
* translatable text, so it needs no code of its own. A PROSE fragment is not,
|
|
108
132
|
* and must become one code per value instead.
|
|
133
|
+
*
|
|
134
|
+
* For a reader of the client; the log takes {@link describeErrorWithStack}.
|
|
109
135
|
*/
|
|
110
136
|
function describeError(error) {
|
|
111
|
-
return error instanceof Error ? error.message :
|
|
137
|
+
return describeSafely(error, () => (error instanceof Error ? error.message : error));
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* An error for the log: its stack where it has one, which names where it was
|
|
141
|
+
* thrown, and its causes, which name what failed when an error wraps another.
|
|
142
|
+
* Never for the client, whose reader cannot act on a stack.
|
|
143
|
+
*/
|
|
144
|
+
function describeErrorWithStack(error) {
|
|
145
|
+
// A cause chain may loop back on itself.
|
|
146
|
+
return describeChain(error, new Set());
|
|
147
|
+
}
|
|
148
|
+
function describeChain(error, seen) {
|
|
149
|
+
const lines = [];
|
|
150
|
+
let current = error;
|
|
151
|
+
let prefix = '';
|
|
152
|
+
try {
|
|
153
|
+
do {
|
|
154
|
+
seen.add(current);
|
|
155
|
+
const described = current;
|
|
156
|
+
lines.push(prefix + describeSafely(described, () => (described instanceof Error ? stackOrMessage(described) : described)));
|
|
157
|
+
// Node fails a connect to several addresses with one, whose own message is empty.
|
|
158
|
+
if (current instanceof AggregateError) {
|
|
159
|
+
try {
|
|
160
|
+
const errors = current.errors;
|
|
161
|
+
lines.push(...errors.filter(inner => !seen.has(inner)).map(inner => `Including: ${describeChain(inner, seen)}`));
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
// An `errors` that is no list, or throws when read; the cause still follows.
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
current = current instanceof Error ? current.cause : undefined;
|
|
168
|
+
prefix = 'Caused by: ';
|
|
169
|
+
} while (current !== undefined && current !== null && !seen.has(current));
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
// A getter or proxy trap threw while walking the chain; keep what was described.
|
|
173
|
+
}
|
|
174
|
+
return lines.join('\n');
|
|
175
|
+
}
|
|
176
|
+
/** `error`'s stack as a string, or its message where reading or converting the stack throws. */
|
|
177
|
+
function stackOrMessage(error) {
|
|
178
|
+
try {
|
|
179
|
+
return String(error.stack ?? error.message);
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
return String(error.message);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* What `select()` picks from `value`, as a string, or where selecting or
|
|
187
|
+
* converting it throws, as `String` does for an object without a prototype,
|
|
188
|
+
* the `[object Type]` tag, or where reading the tag throws too, the value's
|
|
189
|
+
* type. Describing an error must not throw, or the failure it reports is lost;
|
|
190
|
+
* the conversion sits inside the guard because a thrown value's `message` or
|
|
191
|
+
* `stack` need not be a string.
|
|
192
|
+
*/
|
|
193
|
+
function describeSafely(value, select) {
|
|
194
|
+
try {
|
|
195
|
+
return String(select());
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
try {
|
|
199
|
+
return Object.prototype.toString.call(value);
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
return `[${typeof value}]`;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
112
205
|
}
|
|
113
206
|
/**
|
|
114
207
|
* Recognises a declaration among a barrel's exports. The `format` check is what
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.js","sourceRoot":"","sources":["../../src/messages/primitives.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"primitives.js","sourceRoot":"","sources":["../../src/messages/primitives.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;AAElF,mDAA+C;AAgD/C;;;;;GAKG;AACH,uBAAgD,IAAY,EAAE,IAAoB;IAC/E,MAAM,OAAO,GAAG,IAAS,CAAC;IAC1B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,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C,IAAI,CAAC,KAAK,CAAC,CAAC;QAChD,CAAC;QAAC,MAAM,CAAC;YACN,OAAO,IAAI,OAAO,KAAK,GAAG,CAAC;QAC9B,CAAC;IACJ,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,8BAAqC,KAAc;IAChD,MAAM,SAAS,GAAG,KAAoE,CAAC;IACvF,OAAO,CACJ,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,KAAK,IAAI;QAClB,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ;QAClC,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ;QAClC,OAAO,SAAS,CAAC,MAAM,KAAK,UAAU,CACxC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,yBAAgC,MAAc;IAC3C,OAAQ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAe,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAC5E,CAAC"}
|
package/lib/model-server.d.ts
CHANGED
|
@@ -12,8 +12,14 @@
|
|
|
12
12
|
* language identifier — consumers parameterise the document/root types
|
|
13
13
|
* over `TRoot`.
|
|
14
14
|
*/
|
|
15
|
-
import type { TransferClientArgs } from './model-service/args';
|
|
16
15
|
import type { ReferenceCandidate } from './model-service/reference-candidate';
|
|
16
|
+
/** Identifies a client-document binding. */
|
|
17
|
+
export interface TransferClientArgs {
|
|
18
|
+
/** Document URI. */
|
|
19
|
+
uri: string;
|
|
20
|
+
/** Stable identifier for the client invoking the operation. */
|
|
21
|
+
clientId: string;
|
|
22
|
+
}
|
|
17
23
|
/** Open a document on behalf of a client. */
|
|
18
24
|
export interface OpenModelArgs extends TransferClientArgs {
|
|
19
25
|
/**
|
|
@@ -35,19 +41,43 @@ export interface OpenModelArgs extends TransferClientArgs {
|
|
|
35
41
|
* means read from the filesystem, which is the normal case.
|
|
36
42
|
*
|
|
37
43
|
* Honoured only on the first open of a URI: opening an already-open document
|
|
38
|
-
*
|
|
39
|
-
* through the update path instead.
|
|
44
|
+
* attaches the caller to the existing shared entry and does not replace its
|
|
45
|
+
* content with this seed. Write through the update path instead. The open
|
|
46
|
+
* response reads the current shared content after registration; a textual
|
|
47
|
+
* `didOpen` attach may separately refresh the build.
|
|
40
48
|
*/
|
|
41
49
|
text?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Kept on the server for this client's open until it closes, for the
|
|
52
|
+
* server's own open path to read. Only a client session's open keeps them,
|
|
53
|
+
* and a repeat open keeps the first open's.
|
|
54
|
+
*/
|
|
55
|
+
options?: object;
|
|
42
56
|
}
|
|
43
57
|
/** Close a previously-opened document for the client. */
|
|
44
58
|
export interface CloseModelArgs extends TransferClientArgs {
|
|
45
59
|
}
|
|
46
60
|
export interface TransferUpdatedEvent<TDocument> {
|
|
47
61
|
document: TDocument;
|
|
62
|
+
/**
|
|
63
|
+
* The client whose write this event echoes: the author of the version on a
|
|
64
|
+
* `'changed'`, and the unknown-client id on a `'rebuilt'`, which echoes no
|
|
65
|
+
* write. A recipient compares it against its own id to recognise its echo.
|
|
66
|
+
*/
|
|
48
67
|
sourceClientId: string;
|
|
49
68
|
/** See `TransferDocumentUpdateReason` in `./data/events` for the canonical reason set + semantics. */
|
|
50
69
|
reason: 'changed' | 'rebuilt' | 'saved';
|
|
70
|
+
/**
|
|
71
|
+
* The client whose write caused the build that produced this event, or the
|
|
72
|
+
* unknown-client id when no single client's did. On a `'changed'` it is the
|
|
73
|
+
* version's author. A `'rebuilt'` names the writer of another document, so
|
|
74
|
+
* it is a cause, never an echo: its diagnostics and references are new to
|
|
75
|
+
* that writer too.
|
|
76
|
+
*
|
|
77
|
+
* In-process only: the data head does not send it, and an event built
|
|
78
|
+
* elsewhere may leave it out, which a reader takes as "not known".
|
|
79
|
+
*/
|
|
80
|
+
causedBy?: string;
|
|
51
81
|
}
|
|
52
82
|
export interface TransferSavedEvent<TDocument> {
|
|
53
83
|
/** The document as persisted — the state that reached disk, not the state at request time. */
|
|
@@ -114,10 +144,10 @@ export declare function isElementSource(object: unknown): object is ElementSourc
|
|
|
114
144
|
/** An element of a document that does not yet exist on disk — used during element creation flows. */
|
|
115
145
|
export interface SyntheticSource {
|
|
116
146
|
/**
|
|
117
|
-
* The document the element would belong to.
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
147
|
+
* The document the element would belong to. It need not be loaded, or
|
|
148
|
+
* exist — an unloaded URI materialises a transient empty document, so a
|
|
149
|
+
* folder is a valid anchor. A URI that IS loaded contributes that
|
|
150
|
+
* document's parse root as the container, putting its contents in scope.
|
|
121
151
|
*/
|
|
122
152
|
uri: string;
|
|
123
153
|
/**
|
|
@@ -126,6 +156,16 @@ export interface SyntheticSource {
|
|
|
126
156
|
* it is what scoping filters candidates against.
|
|
127
157
|
*/
|
|
128
158
|
type: string;
|
|
159
|
+
/**
|
|
160
|
+
* The grammar the element will belong to, as a language id.
|
|
161
|
+
*
|
|
162
|
+
* Optional because `uri` and `type` each answer on their own when
|
|
163
|
+
* unambiguous. Set it when neither is: a URI naming no file carries no
|
|
164
|
+
* extension to route on, and a `type` two grammars can produce identifies
|
|
165
|
+
* neither. Unset, such a source reaches the server's own policy, which
|
|
166
|
+
* answers the same way for every caller.
|
|
167
|
+
*/
|
|
168
|
+
language?: string;
|
|
129
169
|
}
|
|
130
170
|
export declare function isSyntheticSource(object: unknown): object is SyntheticSource;
|
|
131
171
|
/**
|
|
@@ -135,7 +175,7 @@ export declare function isSyntheticSource(object: unknown): object is SyntheticS
|
|
|
135
175
|
export declare namespace ReferenceSource {
|
|
136
176
|
function document(uri: string): DocumentSource;
|
|
137
177
|
function element(name: string, type?: string): ElementSource;
|
|
138
|
-
function synthetic(uri: string, type: string): SyntheticSource;
|
|
178
|
+
function synthetic(uri: string, type: string, language?: string): SyntheticSource;
|
|
139
179
|
}
|
|
140
180
|
/**
|
|
141
181
|
* One step in a synthetic navigation path from a {@link ReferenceSource}
|
|
@@ -329,9 +369,10 @@ export interface FindNextNameArgs {
|
|
|
329
369
|
*/
|
|
330
370
|
uri: string;
|
|
331
371
|
/**
|
|
332
|
-
* The AST `$type` of the element being named. Collisions are
|
|
333
|
-
* among elements of that
|
|
334
|
-
*
|
|
372
|
+
* The AST `$type` of the element being named. Collisions are looked for
|
|
373
|
+
* among elements of that type and of any subtype of it, so a supertype
|
|
374
|
+
* names a uniqueness scope its concrete types share; the returned name may
|
|
375
|
+
* still be taken by an element outside that hierarchy.
|
|
335
376
|
*/
|
|
336
377
|
type: string;
|
|
337
378
|
/**
|
|
@@ -348,5 +389,11 @@ export interface FindNextNameArgs {
|
|
|
348
389
|
* See {@link NameTier} for what each tier covers.
|
|
349
390
|
*/
|
|
350
391
|
tier?: NameTier;
|
|
392
|
+
/**
|
|
393
|
+
* The grammar to name under, routed as {@link SyntheticSource.language} —
|
|
394
|
+
* this call builds one. A caller that sets it there must set it here, or
|
|
395
|
+
* candidates and the name it proposes come from different grammars.
|
|
396
|
+
*/
|
|
397
|
+
language?: string;
|
|
351
398
|
}
|
|
352
399
|
//# sourceMappingURL=model-server.d.ts.map
|