@hydranium/protocol 1.0.0-next.39 → 1.0.0-next.390
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/debouncer.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { type Clock } from './clock';
|
|
9
|
+
import { type Clock, type Stopwatch } from './clock';
|
|
10
10
|
import { ObservableValue, type MaybeObservableValue } from './observable-value';
|
|
11
11
|
import { type Disposable } from './util';
|
|
12
12
|
/** Construction options for {@link Debouncer}. */
|
|
@@ -49,11 +49,13 @@ export interface DebouncerOptions {
|
|
|
49
49
|
export declare class Debouncer implements Disposable {
|
|
50
50
|
protected readonly clock: Clock;
|
|
51
51
|
protected readonly fn: () => void;
|
|
52
|
+
/** {@link DebouncerOptions.delayMs}, read at each {@link schedule}. An armed timer keeps the delay it was armed with. */
|
|
52
53
|
protected readonly delay: ObservableValue<number>;
|
|
54
|
+
/** {@link DebouncerOptions.maxWaitMs}, fixed at construction unlike {@link delay}. */
|
|
53
55
|
protected readonly maxWaitMs?: number;
|
|
54
56
|
protected timer?: Disposable;
|
|
55
|
-
/**
|
|
56
|
-
protected
|
|
57
|
+
/** Running since the first {@link schedule} of the current pending window; drives {@link DebouncerOptions.maxWaitMs}. */
|
|
58
|
+
protected sinceFirstSchedule?: Stopwatch;
|
|
57
59
|
constructor(clock: Clock, fn: () => void, options: DebouncerOptions);
|
|
58
60
|
/** True while a fire is armed (scheduled, not yet fired or cancelled). */
|
|
59
61
|
get pending(): boolean;
|
|
@@ -64,12 +66,13 @@ export declare class Debouncer implements Disposable {
|
|
|
64
66
|
* elapses since the first pending call.
|
|
65
67
|
*/
|
|
66
68
|
schedule(): void;
|
|
67
|
-
/**
|
|
69
|
+
/** Run {@link fn} now if a fire is pending, clearing the window first, and do nothing otherwise. */
|
|
68
70
|
flush(): void;
|
|
69
71
|
/** Drop a pending fire without running {@link fn}. */
|
|
70
72
|
cancel(): void;
|
|
71
73
|
/** Cancel any pending fire and release. */
|
|
72
74
|
dispose(): void;
|
|
75
|
+
/** Clears the window before it runs {@link fn}, so a {@link schedule} from inside `fn` opens a new one. */
|
|
73
76
|
protected fire(): void;
|
|
74
77
|
}
|
|
75
78
|
//# sourceMappingURL=debouncer.d.ts.map
|
package/lib/debouncer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debouncer.d.ts","sourceRoot":"","sources":["../src/debouncer.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"debouncer.d.ts","sourceRoot":"","sources":["../src/debouncer.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC,kDAAkD;AAClD,MAAM,WAAW,gBAAgB;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC/C;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,SAAU,YAAW,UAAU;IAUtC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK;IAC/B,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI;IAVpC,yHAAyH;IACzH,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAClD,sFAAsF;IACtF,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IACtC,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC7B,yHAAyH;IACzH,SAAS,CAAC,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAEzC,YACsB,KAAK,EAAE,KAAK,EACZ,EAAE,EAAE,MAAM,IAAI,EACjC,OAAO,EAAE,gBAAgB,EAI3B;IAED,0EAA0E;IAC1E,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;;;OAKG;IACH,QAAQ,IAAI,IAAI,CASf;IAED,oGAAoG;IACpG,KAAK,IAAI,IAAI,CAIZ;IAED,sDAAsD;IACtD,MAAM,IAAI,IAAI,CAIb;IAED,2CAA2C;IAC3C,OAAO,IAAI,IAAI,CAEd;IAED,2GAA2G;IAC3G,SAAS,CAAC,IAAI,IAAI,IAAI,CAKrB;CACH"}
|
package/lib/debouncer.js
CHANGED
|
@@ -30,11 +30,13 @@ const observable_value_1 = require("./observable-value");
|
|
|
30
30
|
class Debouncer {
|
|
31
31
|
clock;
|
|
32
32
|
fn;
|
|
33
|
+
/** {@link DebouncerOptions.delayMs}, read at each {@link schedule}. An armed timer keeps the delay it was armed with. */
|
|
33
34
|
delay;
|
|
35
|
+
/** {@link DebouncerOptions.maxWaitMs}, fixed at construction unlike {@link delay}. */
|
|
34
36
|
maxWaitMs;
|
|
35
37
|
timer;
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
+
/** Running since the first {@link schedule} of the current pending window; drives {@link DebouncerOptions.maxWaitMs}. */
|
|
39
|
+
sinceFirstSchedule;
|
|
38
40
|
constructor(clock, fn, options) {
|
|
39
41
|
this.clock = clock;
|
|
40
42
|
this.fn = fn;
|
|
@@ -52,19 +54,16 @@ class Debouncer {
|
|
|
52
54
|
* elapses since the first pending call.
|
|
53
55
|
*/
|
|
54
56
|
schedule() {
|
|
55
|
-
|
|
56
|
-
if (this.firstScheduledAt === undefined) {
|
|
57
|
-
this.firstScheduledAt = now;
|
|
58
|
-
}
|
|
57
|
+
this.sinceFirstSchedule ??= this.clock.stopwatch();
|
|
59
58
|
let wait = Math.max(0, this.delay.value);
|
|
60
59
|
if (this.maxWaitMs !== undefined) {
|
|
61
|
-
const untilCeiling = this.
|
|
60
|
+
const untilCeiling = this.maxWaitMs - this.sinceFirstSchedule.elapsedMs;
|
|
62
61
|
wait = Math.min(wait, Math.max(0, untilCeiling));
|
|
63
62
|
}
|
|
64
63
|
this.timer?.dispose();
|
|
65
64
|
this.timer = this.clock.setTimer(() => this.fire(), wait);
|
|
66
65
|
}
|
|
67
|
-
/**
|
|
66
|
+
/** Run {@link fn} now if a fire is pending, clearing the window first, and do nothing otherwise. */
|
|
68
67
|
flush() {
|
|
69
68
|
if (this.timer !== undefined) {
|
|
70
69
|
this.fire();
|
|
@@ -74,16 +73,17 @@ class Debouncer {
|
|
|
74
73
|
cancel() {
|
|
75
74
|
this.timer?.dispose();
|
|
76
75
|
this.timer = undefined;
|
|
77
|
-
this.
|
|
76
|
+
this.sinceFirstSchedule = undefined;
|
|
78
77
|
}
|
|
79
78
|
/** Cancel any pending fire and release. */
|
|
80
79
|
dispose() {
|
|
81
80
|
this.cancel();
|
|
82
81
|
}
|
|
82
|
+
/** Clears the window before it runs {@link fn}, so a {@link schedule} from inside `fn` opens a new one. */
|
|
83
83
|
fire() {
|
|
84
84
|
this.timer?.dispose();
|
|
85
85
|
this.timer = undefined;
|
|
86
|
-
this.
|
|
86
|
+
this.sinceFirstSchedule = undefined;
|
|
87
87
|
this.fn();
|
|
88
88
|
}
|
|
89
89
|
}
|
package/lib/debouncer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debouncer.js","sourceRoot":"","sources":["../src/debouncer.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAGlF,yDAAgF;AAwBhF;;;;;;;;;;;;;;;;GAgBG;AACH,
|
|
1
|
+
{"version":3,"file":"debouncer.js","sourceRoot":"","sources":["../src/debouncer.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAGlF,yDAAgF;AAwBhF;;;;;;;;;;;;;;;;GAgBG;AACH;IAUyB,KAAK;IACL,EAAE;IAVxB,yHAAyH;IACtG,KAAK,CAA0B;IAClD,sFAAsF;IACnE,SAAS,CAAU;IAC5B,KAAK,CAAc;IAC7B,yHAAyH;IAC/G,kBAAkB,CAAa;IAEzC,YACsB,KAAY,EACZ,EAAc,EACjC,OAAyB;qBAFN,KAAK;kBACL,EAAE;QAGrB,IA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O;QACJ,IAAI,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;IAED,2GAA2G;IACjG,IAAI;QACX,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;QACpC,IAAI,CAAC,EAAE,EAAE,CAAC;IACb,CAAC;CACH"}
|
package/lib/errors.d.ts
CHANGED
|
@@ -8,55 +8,80 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { ResponseError } from 'vscode-jsonrpc';
|
|
10
10
|
import { type HydraniumMessageData } from './messages/primitives';
|
|
11
|
+
import { type ModelVersion, type TextVersion } from './model-service/base-version';
|
|
11
12
|
/**
|
|
12
|
-
* The catalogue declaration behind {@link ConflictError}'s sentence.
|
|
13
|
+
* The catalogue declaration behind {@link ConflictError}'s sentence. It words
|
|
14
|
+
* the version mismatch rather than stating it: the two numbers mean nothing to
|
|
15
|
+
* an end user, and they stay in {@link ConflictErrorData}.
|
|
16
|
+
*/
|
|
17
|
+
export declare const STALE_BASE_VERSION_UPDATE: import("./messages/primitives").MessageDefinition<"The edit to {uri} was not applied: it was made to an older version of the document.">;
|
|
18
|
+
/**
|
|
19
|
+
* {@link STALE_BASE_VERSION_UPDATE}'s counterpart for an editor's save the
|
|
20
|
+
* server refused, since the editor's buffer is not the text it holds.
|
|
21
|
+
*/
|
|
22
|
+
export declare const STALE_BASE_VERSION_SAVE: import("./messages/primitives").MessageDefinition<"The save of {uri} was not applied: it was made to an older version of the document.">;
|
|
23
|
+
/**
|
|
24
|
+
* Every JSON-RPC error code the framework raises, from any package, keyed by
|
|
25
|
+
* the error it identifies.
|
|
13
26
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
27
|
+
* The framework reserves the block 42000 to 42999 for these, and an adopter's
|
|
28
|
+
* own codes stay outside it: after an RPC the proxy revives an error by its
|
|
29
|
+
* code, so an adopter's error carrying one of these can read as the
|
|
30
|
+
* framework's. A new code takes the next unused number in the block, whichever
|
|
31
|
+
* package raises it, and is declared here, where tests hold every code distinct
|
|
32
|
+
* and inside the block.
|
|
33
|
+
* The block sits clear of the range JSON-RPC 2.0 reserves for itself, -32768
|
|
34
|
+
* to -32000.
|
|
18
35
|
*/
|
|
19
|
-
export declare const
|
|
36
|
+
export declare const HYDRANIUM_ERROR_CODES: {
|
|
37
|
+
readonly conflict: 42001;
|
|
38
|
+
readonly noActiveProfile: 42002;
|
|
39
|
+
readonly referenceSettleTimeout: 42003;
|
|
40
|
+
readonly sessionClosed: 42004;
|
|
41
|
+
readonly documentNotOpen: 42005;
|
|
42
|
+
readonly duplicateClientId: 42006;
|
|
43
|
+
readonly reservedClientId: 42007;
|
|
44
|
+
readonly saveFailed: 42008;
|
|
45
|
+
readonly documentSyntaxError: 42009;
|
|
46
|
+
};
|
|
20
47
|
/**
|
|
21
|
-
*
|
|
22
|
-
* Outside the reserved range (-32768 .. -32000) per JSON-RPC 2.0.
|
|
48
|
+
* JSON-RPC error code for {@link ConflictError}.
|
|
23
49
|
*
|
|
24
50
|
* The code is the load-bearing identifier across realm boundaries —
|
|
25
51
|
* `code` is a first-class field on the JSON-RPC error envelope and
|
|
26
52
|
* survives wire reconstruction; the custom `Error` subclass name does
|
|
27
53
|
* not.
|
|
28
54
|
*/
|
|
29
|
-
export declare const CONFLICT_ERROR_CODE
|
|
30
|
-
/**
|
|
31
|
-
* Structured payload carried in {@link ConflictError.data}, and the only place
|
|
32
|
-
* a post-RPC caller can read the version mismatch from.
|
|
33
|
-
*/
|
|
55
|
+
export declare const CONFLICT_ERROR_CODE: 42001;
|
|
56
|
+
/** Structured payload carried in {@link ConflictError.data}. */
|
|
34
57
|
export interface ConflictErrorData extends HydraniumMessageData {
|
|
58
|
+
/**
|
|
59
|
+
* The document whose version moved. A write of several documents names
|
|
60
|
+
* the first stale one in request order, and others may be stale too.
|
|
61
|
+
*/
|
|
35
62
|
readonly uri: string;
|
|
36
|
-
/** The
|
|
37
|
-
readonly
|
|
63
|
+
/** The base version the caller authored against. */
|
|
64
|
+
readonly baseVersion: ModelVersion;
|
|
38
65
|
/** The server's current text-document version at the time of the throw. */
|
|
39
|
-
readonly actualVersion:
|
|
66
|
+
readonly actualVersion: TextVersion;
|
|
40
67
|
}
|
|
41
68
|
/**
|
|
42
|
-
* Thrown by `
|
|
43
|
-
* supplied
|
|
69
|
+
* Thrown by a client session's `update` / `save` when the caller-
|
|
70
|
+
* supplied base version no longer matches the server's current text-
|
|
44
71
|
* document version for the same URI — i.e. the snapshot the caller
|
|
45
72
|
* authored against has been superseded by an intervening edit.
|
|
46
73
|
*
|
|
47
74
|
* Extends vscode-jsonrpc's {@link ResponseError} so the typed
|
|
48
75
|
* {@link ConflictErrorData} payload rides on the standard JSON-RPC
|
|
49
76
|
* error envelope (`code`, `message`, `data`) — all three fields are
|
|
50
|
-
* preserved by RPC reconstruction.
|
|
51
|
-
* the receiving side
|
|
52
|
-
* `err.data`
|
|
53
|
-
*
|
|
77
|
+
* preserved by RPC reconstruction. `createRpcProxy` revives it into
|
|
78
|
+
* this class on the receiving side; a path that does not leaves a
|
|
79
|
+
* plain `ResponseError`, readable through `err.data` only and refused
|
|
80
|
+
* by {@link isConflictError}.
|
|
54
81
|
*
|
|
55
|
-
* Detection is
|
|
56
|
-
*
|
|
57
|
-
* no gating.
|
|
58
|
-
* posture, so headless / CLI / batch tooling with no meaningful based-on
|
|
59
|
-
* version can opt out explicitly.
|
|
82
|
+
* Detection is driven by the required `baseVersion` field of every write
|
|
83
|
+
* request; a caller with no meaningful base version passes
|
|
84
|
+
* `'any'` and gets no gating.
|
|
60
85
|
*
|
|
61
86
|
* Three reasonable adopter recovery strategies:
|
|
62
87
|
*
|
|
@@ -70,34 +95,202 @@ export interface ConflictErrorData extends HydraniumMessageData {
|
|
|
70
95
|
* No auto-retry or auto-merge ships by default.
|
|
71
96
|
*/
|
|
72
97
|
export declare class ConflictError extends ResponseError<ConflictErrorData> {
|
|
73
|
-
|
|
98
|
+
/** `message` words what was refused: an edit, or with {@link STALE_BASE_VERSION_SAVE} a save. */
|
|
99
|
+
constructor(uri: string, baseVersion: ModelVersion, actualVersion: TextVersion, message?: typeof STALE_BASE_VERSION_UPDATE | typeof STALE_BASE_VERSION_SAVE);
|
|
100
|
+
/** The document whose version moved, see {@link ConflictErrorData.uri}. */
|
|
74
101
|
get uri(): string;
|
|
75
102
|
/**
|
|
76
|
-
* The
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
103
|
+
* The base version the caller authored against. Not `expected`, and its
|
|
104
|
+
* sibling not `actual`: a test reporter reads that pair as an assertion
|
|
105
|
+
* failure and reports nothing of the real one.
|
|
106
|
+
*/
|
|
107
|
+
get baseVersion(): ModelVersion;
|
|
108
|
+
/** The server's version at the time of the throw. Not `actual`, see {@link baseVersion}. */
|
|
109
|
+
get actualVersion(): TextVersion;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* JSON-RPC code for {@link SessionClosedError}, beside {@link CONFLICT_ERROR_CODE}
|
|
113
|
+
* and for the same reason: the code survives reconstruction, the class does not.
|
|
114
|
+
*/
|
|
115
|
+
export declare const SESSION_CLOSED_ERROR_CODE: 42004;
|
|
116
|
+
/** JSON-RPC code for {@link DocumentNotOpenError}. */
|
|
117
|
+
export declare const DOCUMENT_NOT_OPEN_ERROR_CODE: 42005;
|
|
118
|
+
/** JSON-RPC code for {@link DuplicateClientIdError}. */
|
|
119
|
+
export declare const DUPLICATE_CLIENT_ID_ERROR_CODE: 42006;
|
|
120
|
+
/** JSON-RPC code for {@link ReservedClientIdError}. */
|
|
121
|
+
export declare const RESERVED_CLIENT_ID_ERROR_CODE: 42007;
|
|
122
|
+
/** JSON-RPC code for {@link SaveFailedError}. */
|
|
123
|
+
export declare const SAVE_FAILED_ERROR_CODE: 42008;
|
|
124
|
+
/** JSON-RPC code for {@link DocumentSyntaxError}. */
|
|
125
|
+
export declare const DOCUMENT_SYNTAX_ERROR_CODE: 42009;
|
|
126
|
+
/**
|
|
127
|
+
* The catalogue declaration behind {@link SessionClosedError}'s default
|
|
128
|
+
* sentence. It names no client id: the sentence can reach an end user, and the
|
|
129
|
+
* id stays in {@link SessionClosedErrorData.clientId} for whoever needs it.
|
|
130
|
+
*/
|
|
131
|
+
export declare const SESSION_CLOSED: import("./messages/primitives").MessageDefinition<"The editing session has ended.">;
|
|
132
|
+
/** Structured payload carried in {@link SessionClosedError.data}. */
|
|
133
|
+
export interface SessionClosedErrorData extends HydraniumMessageData {
|
|
134
|
+
readonly clientId: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Thrown by every call on a client session after it ended, and by an open that
|
|
138
|
+
* was still in flight when its session ended: by the server for its sessions,
|
|
139
|
+
* and by a client-side `DataSession` once disposed, so a caller handles both
|
|
140
|
+
* the same way. A caller recognises it with {@link isSessionClosedError}, never
|
|
141
|
+
* by its sentence.
|
|
142
|
+
*/
|
|
143
|
+
export declare class SessionClosedError extends ResponseError<SessionClosedErrorData> {
|
|
144
|
+
/**
|
|
145
|
+
* `message` replaces the default English, for a caller that knows more than
|
|
146
|
+
* that the session is gone. The identity stays {@link SESSION_CLOSED}'s, so a
|
|
147
|
+
* translating renderer renders the catalogue sentence in its place.
|
|
82
148
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
149
|
+
constructor(clientId: string, message?: string);
|
|
150
|
+
get clientId(): string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* The catalogue declaration behind {@link DocumentNotOpenError}'s sentence. The
|
|
154
|
+
* client id stays in {@link DocumentNotOpenErrorData.clientId}.
|
|
155
|
+
*/
|
|
156
|
+
export declare const DOCUMENT_NOT_OPEN: import("./messages/primitives").MessageDefinition<"The document {uri} is not open in this editing session.">;
|
|
157
|
+
/** Structured payload carried in {@link DocumentNotOpenError.data}. */
|
|
158
|
+
export interface DocumentNotOpenErrorData extends HydraniumMessageData {
|
|
159
|
+
readonly uri: string;
|
|
160
|
+
readonly clientId: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Thrown when a client session writes a document it does not have open.
|
|
164
|
+
*
|
|
165
|
+
* A session writes only what it has open, so this is the answer both to a write
|
|
166
|
+
* that never opened and to one whose open was closed underneath it — by the
|
|
167
|
+
* session itself, or by the document being deleted.
|
|
168
|
+
*/
|
|
169
|
+
export declare class DocumentNotOpenError extends ResponseError<DocumentNotOpenErrorData> {
|
|
170
|
+
constructor(uri: string, clientId: string);
|
|
171
|
+
get uri(): string;
|
|
172
|
+
get clientId(): string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The catalogue declaration behind {@link DuplicateClientIdError}'s sentence.
|
|
176
|
+
* The client id stays in {@link DuplicateClientIdErrorData.clientId}.
|
|
177
|
+
*/
|
|
178
|
+
export declare const DUPLICATE_CLIENT_ID: import("./messages/primitives").MessageDefinition<"Could not start an editing session: its identifier is still in use by another editor.">;
|
|
179
|
+
/** Structured payload carried in {@link DuplicateClientIdError.data}. */
|
|
180
|
+
export interface DuplicateClientIdErrorData extends HydraniumMessageData {
|
|
181
|
+
readonly clientId: string;
|
|
86
182
|
}
|
|
87
183
|
/**
|
|
88
|
-
*
|
|
184
|
+
* Thrown when a client session is started under an id that is already live in
|
|
185
|
+
* the process. The id frees up once its holder ends or closes its last
|
|
186
|
+
* document, so a caller may retry.
|
|
89
187
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
188
|
+
* Ids are unique process-wide because the id is also the author label on every
|
|
189
|
+
* version and the key a client recognises its own echoes by; two participants
|
|
190
|
+
* sharing one would each take the other's writes for their own.
|
|
191
|
+
*/
|
|
192
|
+
export declare class DuplicateClientIdError extends ResponseError<DuplicateClientIdErrorData> {
|
|
193
|
+
constructor(clientId: string);
|
|
194
|
+
get clientId(): string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Thrown when a client session is started under an id the framework reserves
|
|
198
|
+
* for one of its own participants. A reserved id never frees up, so a caller
|
|
199
|
+
* that retries on {@link DuplicateClientIdError} stops on this one.
|
|
98
200
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
201
|
+
* It carries no message identity: a host that picks a reserved id has a bug,
|
|
202
|
+
* and no sentence addressed to an end user is true for it.
|
|
203
|
+
*/
|
|
204
|
+
export declare class ReservedClientIdError extends ResponseError<{
|
|
205
|
+
readonly clientId: string;
|
|
206
|
+
}> {
|
|
207
|
+
constructor(clientId: string);
|
|
208
|
+
get clientId(): string;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* The catalogue declaration behind {@link SaveFailedError}'s message. Its
|
|
212
|
+
* `failures` names each document with the writer's own reason, which stays as
|
|
213
|
+
* written.
|
|
214
|
+
*/
|
|
215
|
+
export declare const SAVE_FAILED: import("./messages/primitives").MessageDefinition<"Could not save {failures}.">;
|
|
216
|
+
/** One document a save could not write, and why. */
|
|
217
|
+
export interface SaveFailure {
|
|
218
|
+
readonly uri: string;
|
|
219
|
+
readonly reason: string;
|
|
220
|
+
}
|
|
221
|
+
/** Structured payload carried in {@link SaveFailedError.data}. */
|
|
222
|
+
export interface SaveFailedErrorData extends HydraniumMessageData {
|
|
223
|
+
readonly failures: readonly SaveFailure[];
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Thrown by a save that could not write one or more of its documents. A save
|
|
227
|
+
* of several documents writes the others, so the files on disk can be a mix
|
|
228
|
+
* until a later save succeeds.
|
|
229
|
+
*/
|
|
230
|
+
export declare class SaveFailedError extends ResponseError<SaveFailedErrorData> {
|
|
231
|
+
constructor(failures: readonly SaveFailure[]);
|
|
232
|
+
get failures(): readonly SaveFailure[];
|
|
233
|
+
}
|
|
234
|
+
/** The catalogue declaration behind {@link DocumentSyntaxError}'s sentence. */
|
|
235
|
+
export declare const DOCUMENT_SYNTAX_ERROR: import("./messages/primitives").MessageDefinition<"The edit to {uri} was not applied: the document has a syntax error. Fix it in the text first.">;
|
|
236
|
+
/** Structured payload carried in {@link DocumentSyntaxError.data}. */
|
|
237
|
+
export interface DocumentSyntaxErrorData extends HydraniumMessageData {
|
|
238
|
+
readonly uri: string;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Thrown when a write would serialize a model over text that does not parse.
|
|
242
|
+
* A model read from a build with lexer or parser errors lacks what the parser
|
|
243
|
+
* skipped, so writing it would delete that text. A client session refuses a
|
|
244
|
+
* model write while the document's last build has such errors and its text
|
|
245
|
+
* is not blank, unless the write is a `restore`. A diagram refuses an edit,
|
|
246
|
+
* undo or redo that would write such a document, or whose merge or collision
|
|
247
|
+
* reads one. A client's write of text is not refused, since that is how the
|
|
248
|
+
* text is repaired.
|
|
249
|
+
*/
|
|
250
|
+
export declare class DocumentSyntaxError extends ResponseError<DocumentSyntaxErrorData> {
|
|
251
|
+
constructor(uri: string);
|
|
252
|
+
get uri(): string;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Whether `error` is a `ResponseError` from any copy of `vscode-jsonrpc`. An
|
|
256
|
+
* install holds several copies, and `instanceof` recognises only its own. An
|
|
257
|
+
* error that merely carries an integer `code` has no `toJson`, and is not one.
|
|
258
|
+
*/
|
|
259
|
+
export declare function isResponseError(error: unknown): error is ResponseError<unknown>;
|
|
260
|
+
/**
|
|
261
|
+
* `error` as an instance of the typed error class its code names, with its
|
|
262
|
+
* message, data and stack kept, or `error` itself when its code names none or
|
|
263
|
+
* its data lacks the fields that class reads.
|
|
264
|
+
* An RPC reconstructs every rejection as a plain `ResponseError`, which has
|
|
265
|
+
* none of the class getters.
|
|
266
|
+
*/
|
|
267
|
+
export declare function reviveProtocolError(error: unknown): unknown;
|
|
268
|
+
/**
|
|
269
|
+
* The error the JSON text `json` describes, as `JSON.stringify(error.toJson())`
|
|
270
|
+
* writes it, revived to its typed class as {@link reviveProtocolError} does, or
|
|
271
|
+
* `undefined` when `json` is not a JSON-RPC error envelope. For a transport
|
|
272
|
+
* that carries the error as text, such as a GLSP `RejectAction`'s `detail`.
|
|
273
|
+
*/
|
|
274
|
+
export declare function reviveProtocolErrorJson(json: string): ResponseError<unknown> | undefined;
|
|
275
|
+
/**
|
|
276
|
+
* Whether `error` is a {@link SessionClosedError} whose getters read valid
|
|
277
|
+
* fields: one thrown, or one {@link reviveProtocolError revived}, from any
|
|
278
|
+
* copy of this package, or a subclass. A bare `ResponseError` is not one,
|
|
279
|
+
* whatever its name and fields, since it lacks the class's brand.
|
|
280
|
+
* `createRpcProxy` revives every rejection, so only a caller on a connection
|
|
281
|
+
* of its own needs to revive first. Each guard below works the same way.
|
|
101
282
|
*/
|
|
283
|
+
export declare function isSessionClosedError(error: unknown): error is SessionClosedError;
|
|
284
|
+
/** Whether `error` is a {@link DocumentNotOpenError}. See {@link isSessionClosedError}. */
|
|
285
|
+
export declare function isDocumentNotOpenError(error: unknown): error is DocumentNotOpenError;
|
|
286
|
+
/** Whether `error` is a {@link DuplicateClientIdError}. See {@link isSessionClosedError}. */
|
|
287
|
+
export declare function isDuplicateClientIdError(error: unknown): error is DuplicateClientIdError;
|
|
288
|
+
/** Whether `error` is a {@link ReservedClientIdError}. See {@link isSessionClosedError}. */
|
|
289
|
+
export declare function isReservedClientIdError(error: unknown): error is ReservedClientIdError;
|
|
290
|
+
/** Whether `error` is a {@link SaveFailedError}. See {@link isSessionClosedError}. */
|
|
291
|
+
export declare function isSaveFailedError(error: unknown): error is SaveFailedError;
|
|
292
|
+
/** Whether `error` is a {@link DocumentSyntaxError}. See {@link isSessionClosedError}. */
|
|
293
|
+
export declare function isDocumentSyntaxError(error: unknown): error is DocumentSyntaxError;
|
|
294
|
+
/** Whether `error` is a {@link ConflictError}. See {@link isSessionClosedError}. */
|
|
102
295
|
export declare function isConflictError(error: unknown): error is ConflictError;
|
|
103
296
|
//# sourceMappingURL=errors.d.ts.map
|
package/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAiB,KAAK,oBAAoB,EAAe,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAiB,KAAK,oBAAoB,EAAe,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAcnG;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,0IAGrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,0IAGnC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB;aAC/B,QAAQ,EAAE,KAAK;aACf,eAAe,EAAE,KAAK;aACtB,sBAAsB,EAAE,KAAK;aAC7B,aAAa,EAAE,KAAK;aACpB,eAAe,EAAE,KAAK;aACtB,iBAAiB,EAAE,KAAK;aACxB,gBAAgB,EAAE,KAAK;aACvB,UAAU,EAAE,KAAK;aACjB,mBAAmB,EAAE,KAAK;CACnB,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,OAAiC,CAAC;AAElE,gEAAgE;AAChE,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;IAC5D;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC;IACnC,2EAA2E;IAC3E,QAAQ,CAAC,aAAa,EAAE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