@dxos/protocols 0.8.4-main.e8ec1fe → 0.8.4-main.ef1bc66f44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/FeedProtocol.d.ts +528 -0
- package/dist/src/FeedProtocol.d.ts.map +1 -0
- package/dist/src/FeedProtocol.js +237 -0
- package/dist/src/FeedProtocol.js.map +1 -0
- package/dist/src/FunctionProtocol.d.ts +8 -2
- package/dist/src/FunctionProtocol.d.ts.map +1 -1
- package/dist/src/buf/proto/gen/dxos/client/queue_pb.d.ts +189 -0
- package/dist/src/buf/proto/gen/dxos/client/queue_pb.d.ts.map +1 -0
- package/dist/src/buf/proto/gen/dxos/client/queue_pb.js +39 -0
- package/dist/src/buf/proto/gen/dxos/client/queue_pb.js.map +1 -0
- package/dist/src/buf/proto/gen/dxos/client/services_pb.d.ts +5 -1
- package/dist/src/buf/proto/gen/dxos/client/services_pb.d.ts.map +1 -1
- package/dist/src/buf/proto/gen/dxos/client/services_pb.js +5 -1
- package/dist/src/buf/proto/gen/dxos/client/services_pb.js.map +1 -1
- package/dist/src/buf/proto/gen/dxos/config_pb.d.ts +4 -0
- package/dist/src/buf/proto/gen/dxos/config_pb.d.ts.map +1 -1
- package/dist/src/buf/proto/gen/dxos/config_pb.js +1 -1
- package/dist/src/buf/proto/gen/dxos/config_pb.js.map +1 -1
- package/dist/src/buf/proto/gen/dxos/echo/query_pb.d.ts +12 -2
- package/dist/src/buf/proto/gen/dxos/echo/query_pb.d.ts.map +1 -1
- package/dist/src/buf/proto/gen/dxos/echo/query_pb.js +1 -1
- package/dist/src/buf/proto/gen/dxos/echo/query_pb.js.map +1 -1
- package/dist/src/buf/proto/gen/dxos/echo/service_pb.d.ts +55 -9
- package/dist/src/buf/proto/gen/dxos/echo/service_pb.d.ts.map +1 -1
- package/dist/src/buf/proto/gen/dxos/echo/service_pb.js +15 -5
- package/dist/src/buf/proto/gen/dxos/echo/service_pb.js.map +1 -1
- package/dist/src/buf/proto/gen/dxos/google_pb.js +1 -1
- package/dist/src/buf/proto/gen/dxos/google_pb.js.map +1 -1
- package/dist/src/buf/proto/gen/dxos/iframe_pb.d.ts +1 -0
- package/dist/src/buf/proto/gen/dxos/iframe_pb.d.ts.map +1 -1
- package/dist/src/buf/proto/gen/dxos/iframe_pb.js.map +1 -1
- package/dist/src/buf/proto/gen/dxos/tracing_pb.js +1 -1
- package/dist/src/buf/proto/gen/dxos/tracing_pb.js.map +1 -1
- package/dist/src/codec.test.js +1 -1
- package/dist/src/edge/EdgeFunctionEnv.d.ts +120 -0
- package/dist/src/edge/EdgeFunctionEnv.d.ts.map +1 -0
- package/dist/src/edge/EdgeFunctionEnv.js +4 -0
- package/dist/src/edge/EdgeFunctionEnv.js.map +1 -0
- package/dist/src/{edge.d.ts → edge/edge.d.ts} +46 -26
- package/dist/src/edge/edge.d.ts.map +1 -0
- package/dist/src/{edge.js → edge/edge.js} +28 -14
- package/dist/src/edge/edge.js.map +1 -0
- package/dist/src/{edge-error.d.ts → edge/errors.d.ts} +6 -7
- package/dist/src/edge/errors.d.ts.map +1 -0
- package/dist/src/{edge-error.js → edge/errors.js} +14 -15
- package/dist/src/edge/errors.js.map +1 -0
- package/dist/src/edge/index.d.ts +4 -0
- package/dist/src/edge/index.d.ts.map +1 -0
- package/dist/src/edge/index.js +7 -0
- package/dist/src/edge/index.js.map +1 -0
- package/dist/src/errors/base-errors.d.ts +86 -8
- package/dist/src/errors/base-errors.d.ts.map +1 -1
- package/dist/src/errors/base-errors.js +4 -20
- package/dist/src/errors/base-errors.js.map +1 -1
- package/dist/src/errors/encoding.d.ts +2 -2
- package/dist/src/errors/encoding.d.ts.map +1 -1
- package/dist/src/errors/encoding.js +1 -1
- package/dist/src/errors/errors.d.ts +619 -42
- package/dist/src/errors/errors.d.ts.map +1 -1
- package/dist/src/errors/errors.js +50 -104
- package/dist/src/errors/errors.js.map +1 -1
- package/dist/src/errors/errors.test.js +2 -2
- package/dist/src/errors/errors.test.js.map +1 -1
- package/dist/src/errors/helpers.d.ts +9 -5
- package/dist/src/errors/helpers.d.ts.map +1 -1
- package/dist/src/errors/helpers.js +3 -3
- package/dist/src/errors/helpers.js.map +1 -1
- package/dist/src/errors/index.d.ts +5 -5
- package/dist/src/errors/index.js +5 -5
- package/dist/src/feed-replication.d.ts.map +1 -1
- package/dist/src/index.d.ts +12 -13
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -12
- package/dist/src/index.js.map +1 -1
- package/dist/src/indexing.test.js +1 -1
- package/dist/src/messenger.d.ts +16 -0
- package/dist/src/messenger.d.ts.map +1 -0
- package/dist/src/messenger.js +4 -0
- package/dist/src/messenger.js.map +1 -0
- package/dist/src/proto/gen/dxos/client/services.d.ts +105 -1
- package/dist/src/proto/gen/dxos/client/services.d.ts.map +1 -1
- package/dist/src/proto/gen/dxos/client/services.js +1 -0
- package/dist/src/proto/gen/dxos/client/services.js.map +1 -1
- package/dist/src/proto/gen/dxos/config.d.ts +5 -0
- package/dist/src/proto/gen/dxos/config.d.ts.map +1 -1
- package/dist/src/proto/gen/dxos/config.js.map +1 -1
- package/dist/src/proto/gen/dxos/echo/query.d.ts +17 -1
- package/dist/src/proto/gen/dxos/echo/query.d.ts.map +1 -1
- package/dist/src/proto/gen/dxos/echo/query.js.map +1 -1
- package/dist/src/proto/gen/dxos/echo/service.d.ts +34 -8
- package/dist/src/proto/gen/dxos/echo/service.d.ts.map +1 -1
- package/dist/src/proto/gen/index.d.ts +8 -0
- package/dist/src/proto/gen/index.d.ts.map +1 -1
- package/dist/src/proto/gen/index.js +1 -1
- package/dist/src/proto/gen/index.js.map +1 -1
- package/dist/src/proto/index.d.ts +2 -2
- package/dist/src/proto/index.js +1 -1
- package/dist/src/proto/types.d.ts +1 -1
- package/dist/src/types.d.ts +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -15
- package/src/FeedProtocol.ts +319 -0
- package/src/FunctionProtocol.ts +8 -4
- package/src/buf/proto/gen/dxos/agent/dashboard_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/agent/echo-proxy_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/agent/epoch_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/agent/functions_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/bot_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/client/invitation_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/client/logging_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/client/queue_pb.ts +231 -0
- package/src/buf/proto/gen/dxos/client/services_pb.ts +7 -2
- package/src/buf/proto/gen/dxos/config_pb.ts +7 -2
- package/src/buf/proto/gen/dxos/devtools/diagnostics_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/devtools/host_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/devtools/swarm_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/echo/blob_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/echo/feed_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/echo/filter_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/echo/indexing_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/echo/metadata_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/echo/model/document_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/echo/model/messenger_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/echo/model/text_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/echo/object_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/echo/query_pb.ts +16 -4
- package/src/buf/proto/gen/dxos/echo/service_pb.ts +68 -16
- package/src/buf/proto/gen/dxos/echo/snapshot_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/echo/timeframe_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/edge/calls_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/edge/messenger_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/edge/signal_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/error_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/field_options_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/google_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/gravity_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/halo/credentials/auth_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/halo/credentials/greet_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/halo/credentials/identity_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/halo/credentials_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/halo/invitations_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/halo/keyring_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/halo/keys_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/halo/signed_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/iframe_pb.ts +2 -1
- package/src/buf/proto/gen/dxos/keys_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/bridge_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/broadcast_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/messaging_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/muxer_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/presence_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/protocol_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/replicator_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/signal_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/swarm_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/teleport/admission-discovery_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/teleport/auth_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/teleport/automerge_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/teleport/blobsync_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/teleport/control_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/teleport/gossip_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/teleport/notarization_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/mesh/teleport/replicator_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/registry_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/rpc_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/service/agentmanager_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/service/publisher_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/service/supervisor_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/service/tunnel_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/tracing_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/type_pb.ts +1 -1
- package/src/buf/proto/gen/dxos/value_pb.ts +1 -1
- package/src/buf/proto/gen/example/testing/data_pb.ts +1 -1
- package/src/buf/proto/gen/example/testing/rpc_pb.ts +1 -1
- package/src/codec.test.ts +1 -1
- package/src/edge/EdgeFunctionEnv.ts +193 -0
- package/src/{edge.ts → edge/edge.ts} +55 -39
- package/src/{edge-error.ts → edge/errors.ts} +15 -16
- package/src/edge/index.ts +7 -0
- package/src/errors/base-errors.ts +4 -22
- package/src/errors/encoding.ts +2 -2
- package/src/errors/errors.test.ts +2 -2
- package/src/errors/errors.ts +57 -123
- package/src/errors/helpers.ts +6 -7
- package/src/errors/index.ts +5 -5
- package/src/feed-replication.ts +1 -0
- package/src/index.ts +12 -13
- package/src/indexing.test.ts +1 -1
- package/src/messenger.ts +22 -0
- package/src/proto/dxos/client/queue.proto +67 -0
- package/src/proto/dxos/client/services.proto +1 -0
- package/src/proto/dxos/config.proto +2 -0
- package/src/proto/dxos/echo/query.proto +4 -1
- package/src/proto/dxos/echo/service.proto +27 -6
- package/src/proto/dxos/iframe.proto +1 -0
- package/src/proto/gen/dxos/client/services.ts +105 -1
- package/src/proto/gen/dxos/config.ts +5 -0
- package/src/proto/gen/dxos/echo/query.ts +17 -1
- package/src/proto/gen/dxos/echo/service.ts +33 -8
- package/src/proto/gen/index.ts +9 -1
- package/src/proto/index.ts +2 -2
- package/src/proto/types.ts +1 -1
- package/src/types.ts +2 -2
- package/dist/src/edge-error.d.ts.map +0 -1
- package/dist/src/edge-error.js.map +0 -1
- package/dist/src/edge.d.ts.map +0 -1
- package/dist/src/edge.js.map +0 -1
- package/dist/src/query.d.ts +0 -5
- package/dist/src/query.d.ts.map +0 -1
- package/dist/src/query.js +0 -8
- package/dist/src/query.js.map +0 -1
- package/dist/src/queue.d.ts +0 -37
- package/dist/src/queue.d.ts.map +0 -1
- package/dist/src/queue.js +0 -8
- package/dist/src/queue.js.map +0 -1
- package/src/query.ts +0 -8
- package/src/queue.ts +0 -51
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors/errors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors/errors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;;;;;;;;;;;;;qBA8BH,CAAC;;;;;;;;;;;;;;;AA1B1C;;GAEG;AACH,qBAAa,cAAe,SAAQ,mBAGnC;CAAG;;;;;;;;;;;;;qBAoBqC,CAAC;;;;;;;;;;;;;;;AAhB1C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,oBAA+D;CAAG;;;;;;;;;;;;;qBAa9D,CAAC;;;;;;;;;;;;;;;AAT1C,qBAAa,cAAe,SAAQ,mBAAkC;CAAG;;;;;;;;;;;;;qBAShC,CAAC;;;;;;;;;;;;;;;AAL1C,qBAAa,kBAAmB,SAAQ,uBAAsC;CAAG;;;;;;;;;;;;;qB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;;;;;;;;AA4D1C,qBAAa,0BAA2B,SAAQ,+BAG/C;gBACa,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAG7C;;;;;;;;;;;;;qBAnEwC,CAAC;;;;;;;;;;;;;;;AAyE1C,qBAAa,kBAAmB,SAAQ,uBAA0D;gBACpF,QAAQ,EAAE,SAAS;CAGhC;;;;;;;;;;;;;qBA7EwC,CAAC;;;;;;;;;;;;;;;AAmF1C,qBAAa,mBAAoB,SAAQ,wBAA0D;gBACrF,QAAQ,EAAE,QAAQ;CAG/B;;;;;;;;;;;;;qBAvFwC,CAAC;;;;;;;;;;;;;;;AA6F1C,qBAAa,iBAAkB,SAAQ,sBAAuD;gBAChF,KAAK,EAAE,MAAM;CAG1B;;;;;;;;;;;;;qBAjGwC,CAAC;;;;;;;;;;;;;;;AAuG1C,qBAAa,kBAAmB,SAAQ,uBAAsC;CAAG"}
|
|
@@ -1,162 +1,108 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Copyright 2021 DXOS.org
|
|
3
3
|
//
|
|
4
|
+
import { BaseError } from '@dxos/errors';
|
|
4
5
|
import { PublicKey } from '@dxos/keys';
|
|
5
|
-
import {
|
|
6
|
-
import { registerError, registerErrorMessageContext, registerErrorNoArgs } from './helpers.js';
|
|
6
|
+
import { registerError, registerErrorMessageContext, registerErrorNoArgs } from "./helpers.js";
|
|
7
7
|
/**
|
|
8
8
|
* Thrown when request was terminated because the RPC endpoint has been closed.
|
|
9
9
|
*/
|
|
10
|
-
export class RpcClosedError extends
|
|
11
|
-
constructor() {
|
|
12
|
-
super('RPC_CLOSED', 'Request was terminated because the RPC endpoint is closed.');
|
|
13
|
-
}
|
|
10
|
+
export class RpcClosedError extends BaseError.extend('RpcClosedError', 'Request was terminated because the RPC endpoint is closed.') {
|
|
14
11
|
}
|
|
15
|
-
registerErrorNoArgs('
|
|
12
|
+
registerErrorNoArgs('RpcClosedError', RpcClosedError);
|
|
16
13
|
/**
|
|
17
14
|
* Thrown when `request` is called when RPC has not been opened.
|
|
18
15
|
*/
|
|
19
|
-
export class RpcNotOpenError extends
|
|
20
|
-
constructor() {
|
|
21
|
-
super('RPC_NOT_OPEN', 'RPC has not been opened.');
|
|
22
|
-
}
|
|
16
|
+
export class RpcNotOpenError extends BaseError.extend('RpcNotOpenError', 'RPC has not been opened.') {
|
|
23
17
|
}
|
|
24
|
-
registerErrorNoArgs('
|
|
25
|
-
export class CancelledError extends
|
|
26
|
-
constructor(message, context) {
|
|
27
|
-
super('CANCELLED', message, context);
|
|
28
|
-
}
|
|
18
|
+
registerErrorNoArgs('RpcNotOpenError', RpcNotOpenError);
|
|
19
|
+
export class CancelledError extends BaseError.extend('CancelledError') {
|
|
29
20
|
}
|
|
30
|
-
registerErrorMessageContext('
|
|
31
|
-
export class InvalidConfigError extends
|
|
32
|
-
constructor(message, context) {
|
|
33
|
-
super('INVALID_CONFIG', message, context);
|
|
34
|
-
}
|
|
21
|
+
registerErrorMessageContext('CancelledError', CancelledError);
|
|
22
|
+
export class InvalidConfigError extends BaseError.extend('InvalidConfigError') {
|
|
35
23
|
}
|
|
36
|
-
registerErrorMessageContext('
|
|
24
|
+
registerErrorMessageContext('InvalidConfigError', InvalidConfigError);
|
|
37
25
|
/**
|
|
38
26
|
* Explicit failure to connect with remote client services.
|
|
39
27
|
*/
|
|
40
|
-
export class RemoteServiceConnectionError extends
|
|
41
|
-
constructor(message, context) {
|
|
42
|
-
super('REMOTE_SERVICE_CONNECTION_ERROR', message, context);
|
|
43
|
-
}
|
|
28
|
+
export class RemoteServiceConnectionError extends BaseError.extend('RemoteServiceConnectionError') {
|
|
44
29
|
}
|
|
45
|
-
registerErrorMessageContext('
|
|
30
|
+
registerErrorMessageContext('RemoteServiceConnectionError', RemoteServiceConnectionError);
|
|
46
31
|
/**
|
|
47
32
|
* Failed to open a connection to remote client services.
|
|
48
33
|
*/
|
|
49
|
-
export class RemoteServiceConnectionTimeout extends
|
|
50
|
-
constructor(message, context) {
|
|
51
|
-
super('REMOTE_SERVICE_CONNECTION_TIMEOUT', message, context);
|
|
52
|
-
}
|
|
34
|
+
export class RemoteServiceConnectionTimeout extends BaseError.extend('RemoteServiceConnectionTimeout') {
|
|
53
35
|
}
|
|
54
|
-
registerErrorMessageContext('
|
|
55
|
-
export class DataCorruptionError extends
|
|
56
|
-
constructor(message, context) {
|
|
57
|
-
super('DATA_CORRUPTION', message, context);
|
|
58
|
-
}
|
|
36
|
+
registerErrorMessageContext('RemoteServiceConnectionTimeout', RemoteServiceConnectionTimeout);
|
|
37
|
+
export class DataCorruptionError extends BaseError.extend('DataCorruptionError') {
|
|
59
38
|
}
|
|
60
|
-
registerErrorMessageContext('
|
|
61
|
-
export class InvalidInvitationExtensionRoleError extends
|
|
62
|
-
constructor(message, context) {
|
|
63
|
-
super('INVALID_INVITATION_EXTENSION_ROLE', message, context);
|
|
64
|
-
}
|
|
39
|
+
registerErrorMessageContext('DataCorruptionError', DataCorruptionError);
|
|
40
|
+
export class InvalidInvitationExtensionRoleError extends BaseError.extend('InvalidInvitationExtensionRoleError') {
|
|
65
41
|
}
|
|
66
|
-
registerErrorMessageContext('
|
|
67
|
-
export class IdentityNotInitializedError extends
|
|
68
|
-
constructor(message, context) {
|
|
69
|
-
super('IDENTITY_NOT_INITIALIZED', message, context);
|
|
70
|
-
}
|
|
42
|
+
registerErrorMessageContext('InvalidInvitationExtensionRoleError', InvalidInvitationExtensionRoleError);
|
|
43
|
+
export class IdentityNotInitializedError extends BaseError.extend('IdentityNotInitializedError') {
|
|
71
44
|
}
|
|
72
|
-
registerErrorMessageContext('
|
|
73
|
-
export class InvalidInvitationError extends
|
|
74
|
-
constructor(message, context) {
|
|
75
|
-
super('INVALID_INVITATION', message, context);
|
|
76
|
-
}
|
|
45
|
+
registerErrorMessageContext('IdentityNotInitializedError', IdentityNotInitializedError);
|
|
46
|
+
export class InvalidInvitationError extends BaseError.extend('InvalidInvitationError') {
|
|
77
47
|
}
|
|
78
|
-
registerErrorMessageContext('
|
|
79
|
-
export class AlreadyJoinedError extends
|
|
80
|
-
constructor(message, context) {
|
|
81
|
-
super('ALREADY_JOINED', message, context);
|
|
82
|
-
}
|
|
48
|
+
registerErrorMessageContext('InvalidInvitationError', InvalidInvitationError);
|
|
49
|
+
export class AlreadyJoinedError extends BaseError.extend('AlreadyJoinedError') {
|
|
83
50
|
}
|
|
84
|
-
registerErrorMessageContext('
|
|
85
|
-
export class ConnectionResetError extends BaseError {
|
|
86
|
-
constructor(message, context) {
|
|
87
|
-
super('CONNECTION_RESET', message, context);
|
|
88
|
-
}
|
|
51
|
+
registerErrorMessageContext('AlreadyJoinedError', AlreadyJoinedError);
|
|
52
|
+
export class ConnectionResetError extends BaseError.extend('ConnectionResetError') {
|
|
89
53
|
}
|
|
90
|
-
registerErrorMessageContext('
|
|
91
|
-
export class TimeoutError extends BaseError {
|
|
92
|
-
constructor(message, context) {
|
|
93
|
-
super('TIMEOUT', message, context);
|
|
94
|
-
}
|
|
54
|
+
registerErrorMessageContext('ConnectionResetError', ConnectionResetError);
|
|
55
|
+
export class TimeoutError extends BaseError.extend('TimeoutError') {
|
|
95
56
|
}
|
|
96
|
-
registerErrorMessageContext('
|
|
57
|
+
registerErrorMessageContext('TimeoutError', TimeoutError);
|
|
97
58
|
// General protocol error.
|
|
98
|
-
export class ProtocolError extends BaseError {
|
|
99
|
-
constructor(message, context) {
|
|
100
|
-
super('PROTOCOL_ERROR', message, context);
|
|
101
|
-
}
|
|
59
|
+
export class ProtocolError extends BaseError.extend('ProtocolError') {
|
|
102
60
|
}
|
|
103
|
-
registerErrorMessageContext(
|
|
61
|
+
registerErrorMessageContext(ProtocolError.name, ProtocolError);
|
|
104
62
|
// General connectivity errors.
|
|
105
|
-
export class ConnectivityError extends BaseError {
|
|
106
|
-
constructor(message, context) {
|
|
107
|
-
super('CONNECTIVITY_ERROR', message, context);
|
|
108
|
-
}
|
|
63
|
+
export class ConnectivityError extends BaseError.extend('ConnectivityError') {
|
|
109
64
|
}
|
|
110
|
-
registerErrorMessageContext('
|
|
111
|
-
export class RateLimitExceededError extends BaseError {
|
|
112
|
-
constructor(message, context) {
|
|
113
|
-
super('RATE_LIMIT_EXCEEDED', message, context);
|
|
114
|
-
}
|
|
65
|
+
registerErrorMessageContext('ConnectivityError', ConnectivityError);
|
|
66
|
+
export class RateLimitExceededError extends BaseError.extend('RateLimitExceededError') {
|
|
115
67
|
}
|
|
116
|
-
registerErrorMessageContext('
|
|
68
|
+
registerErrorMessageContext('RateLimitExceededError', RateLimitExceededError);
|
|
117
69
|
// TODO(nf): Rename? the protocol isn't what's unknown...
|
|
118
|
-
export class UnknownProtocolError extends BaseError {
|
|
119
|
-
constructor(message, innerError) {
|
|
120
|
-
super('UNKNOWN_PROTOCOL_ERROR', message, innerError);
|
|
121
|
-
}
|
|
70
|
+
export class UnknownProtocolError extends BaseError.extend('UnknownProtocolError') {
|
|
122
71
|
}
|
|
123
|
-
|
|
124
|
-
export class InvalidStorageVersionError extends
|
|
72
|
+
registerError(UnknownProtocolError.name, (message, context) => new UnknownProtocolError({ message, context }));
|
|
73
|
+
export class InvalidStorageVersionError extends BaseError.extend('InvalidStorageVersionError', 'Invalid storage version.') {
|
|
125
74
|
constructor(expected, actual) {
|
|
126
|
-
super(
|
|
75
|
+
super({ context: { expected, actual } });
|
|
127
76
|
}
|
|
128
77
|
}
|
|
129
|
-
registerError('
|
|
78
|
+
registerError('InvalidStorageVersionError', (_, context) => {
|
|
130
79
|
return new InvalidStorageVersionError(context.expected ?? NaN, context.actual ?? NaN);
|
|
131
80
|
});
|
|
132
|
-
export class SpaceNotFoundError extends
|
|
81
|
+
export class SpaceNotFoundError extends BaseError.extend('SpaceNotFoundError', 'Space not found.') {
|
|
133
82
|
constructor(spaceKey) {
|
|
134
|
-
super(
|
|
83
|
+
super({ context: { spaceKey } });
|
|
135
84
|
}
|
|
136
85
|
}
|
|
137
|
-
registerError('
|
|
86
|
+
registerError('SpaceNotFoundError', (_, context) => {
|
|
138
87
|
return new SpaceNotFoundError(PublicKey.safeFrom(context.spaceKey) ?? PublicKey.from('00'));
|
|
139
88
|
});
|
|
140
|
-
export class EntityNotFoundError extends
|
|
89
|
+
export class EntityNotFoundError extends BaseError.extend('EntityNotFoundError', 'Item not found.') {
|
|
141
90
|
constructor(entityId) {
|
|
142
|
-
super(
|
|
91
|
+
super({ context: { entityId } });
|
|
143
92
|
}
|
|
144
93
|
}
|
|
145
|
-
registerError('
|
|
94
|
+
registerError('EntityNotFoundError', (_, context) => {
|
|
146
95
|
return new EntityNotFoundError(context.entityId);
|
|
147
96
|
});
|
|
148
|
-
export class UnknownModelError extends
|
|
97
|
+
export class UnknownModelError extends BaseError.extend('UnknownModelError', 'Unknown model.') {
|
|
149
98
|
constructor(model) {
|
|
150
|
-
super(
|
|
99
|
+
super({ context: { model } });
|
|
151
100
|
}
|
|
152
101
|
}
|
|
153
|
-
registerError('
|
|
102
|
+
registerError('UnknownModelError', (_, context) => {
|
|
154
103
|
return new UnknownModelError(context.model);
|
|
155
104
|
});
|
|
156
|
-
export class AuthorizationError extends
|
|
157
|
-
constructor(message, context) {
|
|
158
|
-
super('AUTHORIZATION_ERROR', message, context);
|
|
159
|
-
}
|
|
105
|
+
export class AuthorizationError extends BaseError.extend('AuthorizationError') {
|
|
160
106
|
}
|
|
161
|
-
registerErrorMessageContext('
|
|
107
|
+
registerErrorMessageContext('AuthorizationError', AuthorizationError);
|
|
162
108
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/errors/errors.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/errors/errors.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;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CAAC,qBAAqB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE;IAClD,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC;AAEH,MAAM,OAAO,iBAAkB,SAAQ,SAAS,CAAC,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC;IAC5F,YAAY,KAAa;QACvB,KAAK,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IAChC,CAAC;CACF;AAED,aAAa,CAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE;IAChD,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC,CAAC;AAEH,MAAM,OAAO,kBAAmB,SAAQ,SAAS,CAAC,MAAM,CAAC,oBAAoB,CAAC;CAAG;AAEjF,2BAA2B,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAC"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
import { describe, expect, test } from 'vitest';
|
|
5
|
-
import { ApiError } from
|
|
5
|
+
import { ApiError } from "./base-errors.js";
|
|
6
6
|
describe('Errors', () => {
|
|
7
7
|
test('test', async () => {
|
|
8
8
|
const runTest = async () => {
|
|
9
|
-
throw new ApiError('Test error');
|
|
9
|
+
throw new ApiError({ message: 'Test error' });
|
|
10
10
|
};
|
|
11
11
|
await expect(runTest()).rejects.toThrowError('Test error');
|
|
12
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.test.js","sourceRoot":"","sources":["../../../src/errors/errors.test.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE;QACtB,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE;YACzB,MAAM,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.test.js","sourceRoot":"","sources":["../../../src/errors/errors.test.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE;QACtB,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE;YACzB,MAAM,IAAI,QAAQ,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;QAChD,CAAC,CAAC;QAEF,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { BaseError } from '@dxos/errors';
|
|
2
|
+
import { type Error as SerializedErrorProto } from '../proto/gen/dxos/error.ts';
|
|
3
|
+
export declare const reconstructError: (error: SerializedErrorProto) => Error | BaseError<string>;
|
|
3
4
|
export declare const registerError: (code: string, make: (message?: string, context?: any) => Error) => void;
|
|
4
5
|
export declare const registerErrorNoArgs: (code: string, Constructor: {
|
|
5
|
-
new (): Error;
|
|
6
|
+
new (options?: any): Error;
|
|
6
7
|
}) => void;
|
|
7
8
|
export declare const registerErrorMessageContext: (code: string, Constructor: {
|
|
8
|
-
new (
|
|
9
|
+
new (options?: {
|
|
10
|
+
message?: string;
|
|
11
|
+
context?: any;
|
|
12
|
+
}): Error;
|
|
9
13
|
}) => void;
|
|
10
|
-
export declare const errorFromCode: (code?: string, message?: string, context?: any) => Error
|
|
14
|
+
export declare const errorFromCode: (code?: string, message?: string, context?: any) => Error | BaseError<string>;
|
|
11
15
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/errors/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/errors/helpers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,KAAK,KAAK,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEhF,eAAO,MAAM,gBAAgB,GAAI,OAAO,oBAAoB,8BAG3D,CAAC;AAIF,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,KAAK,SAG3F,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,aAAa;IAAE,KAAK,OAAO,CAAC,EAAE,GAAG,GAAG,KAAK,CAAA;CAAE,SAE5F,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,MAAM,MAAM,EACZ,aAAa;IAAE,KAAK,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,GAAG,KAAK,CAAA;CAAE,SAG5E,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,UAAU,MAAM,EAAE,UAAU,GAAG,8BAM3E,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
|
+
import { BaseError } from '@dxos/errors';
|
|
4
5
|
import { invariant } from '@dxos/invariant';
|
|
5
|
-
import { SystemError } from './base-errors.js';
|
|
6
6
|
export const reconstructError = (error) => {
|
|
7
7
|
const { name, message, context } = error;
|
|
8
8
|
return errorFromCode(name, message, context);
|
|
@@ -16,14 +16,14 @@ export const registerErrorNoArgs = (code, Constructor) => {
|
|
|
16
16
|
registerError(code, () => new Constructor());
|
|
17
17
|
};
|
|
18
18
|
export const registerErrorMessageContext = (code, Constructor) => {
|
|
19
|
-
registerError(code, (message, context) => new Constructor(message, context));
|
|
19
|
+
registerError(code, (message, context) => new Constructor({ message, context }));
|
|
20
20
|
};
|
|
21
21
|
export const errorFromCode = (code, message, context) => {
|
|
22
22
|
if (code && errorRegistry.has(code)) {
|
|
23
23
|
return errorRegistry.get(code)(message, context);
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
return new
|
|
26
|
+
return new BaseError(code ?? 'Error', { message, context });
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/errors/helpers.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/errors/helpers.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAA2B,EAAE,EAAE;IAC9D,MAAM,EAAE,IAAI,EAAE,OAAO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
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './encoding.
|
|
2
|
-
export * from './errors.
|
|
3
|
-
export * from './helpers.
|
|
4
|
-
export * from './base-errors.
|
|
5
|
-
export * from './parameter.
|
|
1
|
+
export * from './encoding.ts';
|
|
2
|
+
export * from './errors.ts';
|
|
3
|
+
export * from './helpers.ts';
|
|
4
|
+
export * from './base-errors.ts';
|
|
5
|
+
export * from './parameter.ts';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/errors/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
4
|
+
export * from "./encoding.js";
|
|
5
|
+
export * from "./errors.js";
|
|
6
|
+
export * from "./helpers.js";
|
|
7
|
+
export * from "./base-errors.js";
|
|
8
|
+
export * from "./parameter.js";
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feed-replication.d.ts","sourceRoot":"","sources":["../../src/feed-replication.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,UAAU,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;IACJ,SAAS,EAAE,UAAU,CAAC;CACvB,CAAC;
|
|
1
|
+
{"version":3,"file":"feed-replication.d.ts","sourceRoot":"","sources":["../../src/feed-replication.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,UAAU,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;IACJ,SAAS,EAAE,UAAU,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,eAAe,GACvB,0BAA0B,GAC1B,uBAAuB,GACvB,sBAAsB,GACtB,mBAAmB,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
export * from './automerge.
|
|
2
|
-
export * from './edge
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './profile-archive.
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export
|
|
13
|
-
export * as FunctionProtocol from './FunctionProtocol.js';
|
|
1
|
+
export * from './automerge.ts';
|
|
2
|
+
export * from './edge/index.ts';
|
|
3
|
+
export * from './errors/index.ts';
|
|
4
|
+
export * from './indexing.ts';
|
|
5
|
+
export * from './messenger.ts';
|
|
6
|
+
export * from './profile-archive.ts';
|
|
7
|
+
export * from './space-archive.ts';
|
|
8
|
+
export * from './storage.ts';
|
|
9
|
+
export * from './tracing.ts';
|
|
10
|
+
export type * from './types.ts';
|
|
11
|
+
export * as FunctionProtocol from './FunctionProtocol.ts';
|
|
12
|
+
export * as FeedProtocol from './FeedProtocol.ts';
|
|
14
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,mBAAmB,YAAY,CAAC;AAChC,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Copyright 2021 DXOS.org
|
|
3
3
|
//
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * as FunctionProtocol from './FunctionProtocol.js';
|
|
4
|
+
export * from "./automerge.js";
|
|
5
|
+
export * from "./edge/index.js";
|
|
6
|
+
export * from "./errors/index.js";
|
|
7
|
+
export * from "./indexing.js";
|
|
8
|
+
export * from "./messenger.js";
|
|
9
|
+
export * from "./profile-archive.js";
|
|
10
|
+
export * from "./space-archive.js";
|
|
11
|
+
export * from "./storage.js";
|
|
12
|
+
export * from "./tracing.js";
|
|
13
|
+
export * as FunctionProtocol from "./FunctionProtocol.js";
|
|
14
|
+
export * as FeedProtocol from "./FeedProtocol.js";
|
|
16
15
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAE7B,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
import { describe, expect, test } from 'vitest';
|
|
5
|
-
import { ObjectPointerVersion, objectPointerCodec } from
|
|
5
|
+
import { ObjectPointerVersion, objectPointerCodec } from "./indexing.js";
|
|
6
6
|
describe('Indexing object pointer codec', () => {
|
|
7
7
|
test('getVersion', async () => {
|
|
8
8
|
expect(objectPointerCodec.getVersion('aaaa|bbbb')).to.eq(ObjectPointerVersion.V0);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type CleanupFn } from '@dxos/async';
|
|
2
|
+
import { type GossipMessage } from './proto/gen/dxos/mesh/teleport/gossip';
|
|
3
|
+
/**
|
|
4
|
+
* Message passing abstraction.
|
|
5
|
+
*/
|
|
6
|
+
export interface Messenger {
|
|
7
|
+
/**
|
|
8
|
+
* Register channel listener.
|
|
9
|
+
*/
|
|
10
|
+
listen: (channel: string, callback: (message: GossipMessage) => void) => CleanupFn;
|
|
11
|
+
/**
|
|
12
|
+
* Send message to channel.
|
|
13
|
+
*/
|
|
14
|
+
postMessage: (channel: string, message: any) => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=messenger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messenger.d.ts","sourceRoot":"","sources":["../../src/messenger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,KAAK,SAAS,CAAC;IAEnF;;OAEG;IACH,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messenger.js","sourceRoot":"","sources":["../../src/messenger.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE"}
|
|
@@ -381,6 +381,109 @@ export interface LoggingService {
|
|
|
381
381
|
queryMetrics: (request: QueryMetricsRequest, options?: RequestOptions) => Stream<QueryMetricsResponse>;
|
|
382
382
|
queryLogs: (request: QueryLogsRequest, options?: RequestOptions) => Stream<LogEntry>;
|
|
383
383
|
}
|
|
384
|
+
/**
|
|
385
|
+
* Defined in:
|
|
386
|
+
* {@link file://./../../../dxos/client/queue.proto}
|
|
387
|
+
*/
|
|
388
|
+
export interface QueueQuery {
|
|
389
|
+
spaceId: string;
|
|
390
|
+
/**
|
|
391
|
+
* Options:
|
|
392
|
+
* - proto3_optional = true
|
|
393
|
+
*/
|
|
394
|
+
queuesNamespace?: string;
|
|
395
|
+
/**
|
|
396
|
+
* Queries the whole space if missing.
|
|
397
|
+
*/
|
|
398
|
+
queueIds?: string[];
|
|
399
|
+
/**
|
|
400
|
+
* Filter items after this cursor. Exclusive.
|
|
401
|
+
*
|
|
402
|
+
* Options:
|
|
403
|
+
* - proto3_optional = true
|
|
404
|
+
*/
|
|
405
|
+
after?: string;
|
|
406
|
+
/**
|
|
407
|
+
* Filter items before this cursor. Exclusive.
|
|
408
|
+
*
|
|
409
|
+
* Options:
|
|
410
|
+
* - proto3_optional = true
|
|
411
|
+
*/
|
|
412
|
+
before?: string;
|
|
413
|
+
/**
|
|
414
|
+
* Filter items after this position. Inclusive.
|
|
415
|
+
*
|
|
416
|
+
* Options:
|
|
417
|
+
* - proto3_optional = true
|
|
418
|
+
*/
|
|
419
|
+
beginPosition?: string;
|
|
420
|
+
/**
|
|
421
|
+
* Filter items before this position. Exclusive.
|
|
422
|
+
*
|
|
423
|
+
* Options:
|
|
424
|
+
* - proto3_optional = true
|
|
425
|
+
*/
|
|
426
|
+
endPosition?: string;
|
|
427
|
+
/**
|
|
428
|
+
* Options:
|
|
429
|
+
* - proto3_optional = true
|
|
430
|
+
*/
|
|
431
|
+
limit?: number;
|
|
432
|
+
/**
|
|
433
|
+
* Options:
|
|
434
|
+
* - proto3_optional = true
|
|
435
|
+
*/
|
|
436
|
+
reverse?: boolean;
|
|
437
|
+
objectIds?: string[];
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Defined in:
|
|
441
|
+
* {@link file://./../../../dxos/client/queue.proto}
|
|
442
|
+
*/
|
|
443
|
+
export interface QueueQueryResult {
|
|
444
|
+
objects?: ReturnType<(typeof substitutions)["google.protobuf.Struct"]["decode"]>[];
|
|
445
|
+
/**
|
|
446
|
+
* Cursor to query the next items. Can be passed to `after` in query to keep querying.
|
|
447
|
+
*/
|
|
448
|
+
nextCursor: string;
|
|
449
|
+
prevCursor: string;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Defined in:
|
|
453
|
+
* {@link file://./../../../dxos/client/queue.proto}
|
|
454
|
+
*/
|
|
455
|
+
export interface QueryQueueRequest {
|
|
456
|
+
query: QueueQuery;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Defined in:
|
|
460
|
+
* {@link file://./../../../dxos/client/queue.proto}
|
|
461
|
+
*/
|
|
462
|
+
export interface InsertIntoQueueRequest {
|
|
463
|
+
subspaceTag: string;
|
|
464
|
+
spaceId: string;
|
|
465
|
+
queueId: string;
|
|
466
|
+
objects?: ReturnType<(typeof substitutions)["google.protobuf.Struct"]["decode"]>[];
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Defined in:
|
|
470
|
+
* {@link file://./../../../dxos/client/queue.proto}
|
|
471
|
+
*/
|
|
472
|
+
export interface DeleteFromQueueRequest {
|
|
473
|
+
subspaceTag: string;
|
|
474
|
+
spaceId: string;
|
|
475
|
+
queueId: string;
|
|
476
|
+
objectIds?: string[];
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Defined in:
|
|
480
|
+
* {@link file://./../../../dxos/client/queue.proto}
|
|
481
|
+
*/
|
|
482
|
+
export interface QueueService {
|
|
483
|
+
queryQueue: (request: QueryQueueRequest, options?: RequestOptions) => Promise<QueueQueryResult>;
|
|
484
|
+
insertIntoQueue: (request: InsertIntoQueueRequest, options?: RequestOptions) => Promise<void>;
|
|
485
|
+
deleteFromQueue: (request: DeleteFromQueueRequest, options?: RequestOptions) => Promise<void>;
|
|
486
|
+
}
|
|
384
487
|
/**
|
|
385
488
|
* Defined in:
|
|
386
489
|
* {@link file://./../../../dxos/client/services.proto}
|
|
@@ -501,7 +604,8 @@ export declare namespace Platform {
|
|
|
501
604
|
enum PLATFORM_TYPE {
|
|
502
605
|
BROWSER = 0,
|
|
503
606
|
SHARED_WORKER = 1,
|
|
504
|
-
NODE = 2
|
|
607
|
+
NODE = 2,
|
|
608
|
+
DEDICATED_WORKER = 3
|
|
505
609
|
}
|
|
506
610
|
}
|
|
507
611
|
/**
|