@dxos/protocols 0.8.4-main.72ec0f3 → 0.8.4-main.74a063c4e0
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 +1 -1
- 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 +231 -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 +44 -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 +33 -3
- 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 +46 -37
- package/dist/src/buf/proto/gen/dxos/client/services_pb.js.map +1 -1
- package/dist/src/buf/proto/gen/dxos/echo/metadata_pb.d.ts +6 -0
- package/dist/src/buf/proto/gen/dxos/echo/metadata_pb.d.ts.map +1 -1
- package/dist/src/buf/proto/gen/dxos/echo/metadata_pb.js +1 -1
- package/dist/src/buf/proto/gen/dxos/echo/metadata_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/edge/messenger_pb.d.ts +28 -0
- package/dist/src/buf/proto/gen/dxos/edge/messenger_pb.d.ts.map +1 -1
- package/dist/src/buf/proto/gen/dxos/edge/messenger_pb.js +10 -5
- package/dist/src/buf/proto/gen/dxos/edge/messenger_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/halo/credentials_pb.d.ts +39 -0
- package/dist/src/buf/proto/gen/dxos/halo/credentials_pb.d.ts.map +1 -1
- package/dist/src/buf/proto/gen/dxos/halo/credentials_pb.js +27 -2
- package/dist/src/buf/proto/gen/dxos/halo/credentials_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 +108 -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} +204 -26
- package/dist/src/edge/edge.d.ts.map +1 -0
- package/dist/src/{edge.js → edge/edge.js} +32 -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/encoding.js.map +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 +990 -852
- package/dist/src/proto/gen/dxos/client/services.d.ts.map +1 -1
- package/dist/src/proto/gen/dxos/client/services.js +95 -94
- package/dist/src/proto/gen/dxos/client/services.js.map +1 -1
- package/dist/src/proto/gen/dxos/devtools/host.d.ts +31 -31
- package/dist/src/proto/gen/dxos/devtools/host.d.ts.map +1 -1
- package/dist/src/proto/gen/dxos/echo/metadata.d.ts +4 -0
- package/dist/src/proto/gen/dxos/echo/metadata.d.ts.map +1 -1
- package/dist/src/proto/gen/dxos/echo/metadata.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/dxos/edge/messenger.d.ts +24 -0
- package/dist/src/proto/gen/dxos/edge/messenger.d.ts.map +1 -1
- package/dist/src/proto/gen/dxos/edge/messenger.js.map +1 -1
- package/dist/src/proto/gen/dxos/halo/credentials.d.ts +15 -1
- package/dist/src/proto/gen/dxos/halo/credentials.d.ts.map +1 -1
- package/dist/src/proto/gen/dxos/halo/credentials.js +9 -0
- package/dist/src/proto/gen/dxos/halo/credentials.js.map +1 -1
- package/dist/src/proto/gen/google/protobuf.d.ts +326 -40
- package/dist/src/proto/gen/google/protobuf.d.ts.map +1 -1
- package/dist/src/proto/gen/google/protobuf.js +127 -1
- package/dist/src/proto/gen/google/protobuf.js.map +1 -1
- package/dist/src/proto/gen/index.d.ts +36 -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/space-archive.d.ts +60 -1
- package/dist/src/space-archive.d.ts.map +1 -1
- package/dist/src/space-archive.js +13 -1
- package/dist/src/space-archive.js.map +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 +320 -0
- package/src/FunctionProtocol.ts +8 -6
- 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 +280 -0
- package/src/buf/proto/gen/dxos/client/services_pb.ts +77 -40
- package/src/buf/proto/gen/dxos/config_pb.ts +1 -1
- 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 +9 -2
- 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 +39 -6
- 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 +49 -3
- 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 +187 -0
- package/src/{edge.ts → edge/edge.ts} +166 -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 -3
- package/src/errors/errors.test.ts +2 -2
- package/src/errors/errors.ts +57 -124
- 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 +78 -0
- package/src/proto/dxos/client/services.proto +9 -1
- package/src/proto/dxos/config.proto +1 -1
- package/src/proto/dxos/echo/metadata.proto +3 -0
- package/src/proto/dxos/echo/query.proto +4 -1
- package/src/proto/dxos/echo/service.proto +27 -6
- package/src/proto/dxos/edge/messenger.proto +10 -0
- package/src/proto/dxos/halo/credentials.proto +15 -0
- package/src/proto/dxos/iframe.proto +1 -0
- package/src/proto/gen/dxos/client/services.ts +990 -852
- package/src/proto/gen/dxos/devtools/host.ts +31 -31
- package/src/proto/gen/dxos/echo/metadata.ts +4 -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/dxos/edge/messenger.ts +24 -0
- package/src/proto/gen/dxos/halo/credentials.ts +15 -1
- package/src/proto/gen/google/protobuf.ts +326 -40
- package/src/proto/gen/index.ts +37 -1
- package/src/proto/index.ts +2 -2
- package/src/proto/types.ts +1 -1
- package/src/space-archive.ts +70 -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,7 +1,7 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
|
-
import { EdgeHttpErrorCodec, ErrorCodec } from
|
|
4
|
+
import { EdgeHttpErrorCodec, ErrorCodec } from "./edge.js";
|
|
5
5
|
// TODO(burdon): Reconcile with @dxos/errors.
|
|
6
6
|
/**
|
|
7
7
|
* Error thrown when a call to the Edge service fails.
|
|
@@ -14,17 +14,17 @@ import { EdgeHttpErrorCodec, ErrorCodec } from './edge.js';
|
|
|
14
14
|
export class EdgeCallFailedError extends Error {
|
|
15
15
|
static fromUnsuccessfulResponse(response, body) {
|
|
16
16
|
const error = new EdgeCallFailedError({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
isRetryable: body.
|
|
17
|
+
message: body.message,
|
|
18
|
+
data: body.data,
|
|
19
|
+
isRetryable: body.data == null && response.headers.has('Retry-After'),
|
|
20
20
|
retryAfterMs: getRetryAfterMillis(response),
|
|
21
|
-
cause: body.
|
|
21
|
+
cause: body.error ? ErrorCodec.decode(body.error) : undefined,
|
|
22
22
|
});
|
|
23
23
|
return error;
|
|
24
24
|
}
|
|
25
25
|
static async fromHttpFailure(response) {
|
|
26
26
|
return new EdgeCallFailedError({
|
|
27
|
-
|
|
27
|
+
message: `HTTP code ${response.status}: ${response.statusText}.`,
|
|
28
28
|
isRetryable: isRetryableCode(response.status),
|
|
29
29
|
retryAfterMs: getRetryAfterMillis(response),
|
|
30
30
|
cause: await EdgeHttpErrorCodec.decode(response),
|
|
@@ -32,27 +32,26 @@ export class EdgeCallFailedError extends Error {
|
|
|
32
32
|
}
|
|
33
33
|
static fromProcessingFailureCause(cause) {
|
|
34
34
|
return new EdgeCallFailedError({
|
|
35
|
-
|
|
35
|
+
message: 'Error processing request.',
|
|
36
36
|
isRetryable: true,
|
|
37
37
|
cause,
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
errorData;
|
|
40
|
+
data;
|
|
42
41
|
isRetryable;
|
|
43
42
|
retryAfterMs;
|
|
44
43
|
constructor(args) {
|
|
45
|
-
super(args.
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
44
|
+
super(args.message, { cause: args.cause });
|
|
45
|
+
this.message = args.message;
|
|
46
|
+
this.data = args.data;
|
|
48
47
|
this.retryAfterMs = args.retryAfterMs;
|
|
49
48
|
this.isRetryable = Boolean(args.isRetryable);
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
export class EdgeAuthChallengeError extends EdgeCallFailedError {
|
|
53
52
|
challenge;
|
|
54
|
-
constructor(challenge,
|
|
55
|
-
super({
|
|
53
|
+
constructor(challenge, data) {
|
|
54
|
+
super({ message: 'Auth challenge.', data, isRetryable: false });
|
|
56
55
|
this.challenge = challenge;
|
|
57
56
|
}
|
|
58
57
|
}
|
|
@@ -67,4 +66,4 @@ const isRetryableCode = (status) => {
|
|
|
67
66
|
}
|
|
68
67
|
return !(status >= 400 && status < 500);
|
|
69
68
|
};
|
|
70
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,CAAC,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/edge/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/edge/index.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,cAAc,WAAW,CAAC;AAC1B,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,cAAc,aAAa,CAAC"}
|
|
@@ -2,26 +2,104 @@
|
|
|
2
2
|
* NOTE: Messages should be sentences (Start with a capital letter and end with a period).
|
|
3
3
|
* Errors can optionally include a JSON context object.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { BaseError } from '@dxos/errors';
|
|
6
|
+
declare const ApiError_base: {
|
|
7
|
+
new (options?: import("@dxos/errors").BaseErrorOptions): {
|
|
8
|
+
name: "ApiError";
|
|
9
|
+
context: Record<string, unknown>;
|
|
10
|
+
readonly message: string;
|
|
11
|
+
readonly _tag: "ApiError";
|
|
12
|
+
stack?: string;
|
|
13
|
+
cause?: unknown;
|
|
14
|
+
};
|
|
15
|
+
name: "ApiError";
|
|
16
|
+
is(error: unknown): error is BaseError;
|
|
17
|
+
wrap(options?: Omit<import("@dxos/errors").BaseErrorOptions, "cause"> & {
|
|
18
|
+
ifTypeDiffers?: boolean;
|
|
19
|
+
}): (error: unknown) => {
|
|
20
|
+
name: "ApiError";
|
|
21
|
+
context: Record<string, unknown>;
|
|
22
|
+
readonly message: string;
|
|
23
|
+
readonly _tag: "ApiError";
|
|
24
|
+
stack?: string;
|
|
25
|
+
cause?: unknown;
|
|
26
|
+
};
|
|
27
|
+
extend<Name extends string = string>(name: Name, message?: string): any;
|
|
28
|
+
isError(error: unknown): error is Error;
|
|
29
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
30
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
31
|
+
stackTraceLimit: number;
|
|
32
|
+
};
|
|
10
33
|
/**
|
|
11
34
|
* User facing API Errors.
|
|
12
35
|
* E.g., something was misconfigured.
|
|
13
36
|
*/
|
|
14
|
-
export declare class ApiError extends
|
|
37
|
+
export declare class ApiError extends ApiError_base {
|
|
15
38
|
}
|
|
39
|
+
declare const SystemError_base: {
|
|
40
|
+
new (options?: import("@dxos/errors").BaseErrorOptions): {
|
|
41
|
+
name: "SystemError";
|
|
42
|
+
context: Record<string, unknown>;
|
|
43
|
+
readonly message: string;
|
|
44
|
+
readonly _tag: "SystemError";
|
|
45
|
+
stack?: string;
|
|
46
|
+
cause?: unknown;
|
|
47
|
+
};
|
|
48
|
+
name: "SystemError";
|
|
49
|
+
is(error: unknown): error is BaseError;
|
|
50
|
+
wrap(options?: Omit<import("@dxos/errors").BaseErrorOptions, "cause"> & {
|
|
51
|
+
ifTypeDiffers?: boolean;
|
|
52
|
+
}): (error: unknown) => {
|
|
53
|
+
name: "SystemError";
|
|
54
|
+
context: Record<string, unknown>;
|
|
55
|
+
readonly message: string;
|
|
56
|
+
readonly _tag: "SystemError";
|
|
57
|
+
stack?: string;
|
|
58
|
+
cause?: unknown;
|
|
59
|
+
};
|
|
60
|
+
extend<Name extends string = string>(name: Name, message?: string): any;
|
|
61
|
+
isError(error: unknown): error is Error;
|
|
62
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
63
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
64
|
+
stackTraceLimit: number;
|
|
65
|
+
};
|
|
16
66
|
/**
|
|
17
67
|
* Internal system errors.
|
|
18
68
|
* E.g., unexpected/unrecoverable runtime error.
|
|
19
69
|
*/
|
|
20
|
-
export declare class SystemError extends
|
|
70
|
+
export declare class SystemError extends SystemError_base {
|
|
21
71
|
}
|
|
72
|
+
declare const DatabaseError_base: {
|
|
73
|
+
new (options?: import("@dxos/errors").BaseErrorOptions): {
|
|
74
|
+
name: "DatabaseError";
|
|
75
|
+
context: Record<string, unknown>;
|
|
76
|
+
readonly message: string;
|
|
77
|
+
readonly _tag: "DatabaseError";
|
|
78
|
+
stack?: string;
|
|
79
|
+
cause?: unknown;
|
|
80
|
+
};
|
|
81
|
+
name: "DatabaseError";
|
|
82
|
+
is(error: unknown): error is BaseError;
|
|
83
|
+
wrap(options?: Omit<import("@dxos/errors").BaseErrorOptions, "cause"> & {
|
|
84
|
+
ifTypeDiffers?: boolean;
|
|
85
|
+
}): (error: unknown) => {
|
|
86
|
+
name: "DatabaseError";
|
|
87
|
+
context: Record<string, unknown>;
|
|
88
|
+
readonly message: string;
|
|
89
|
+
readonly _tag: "DatabaseError";
|
|
90
|
+
stack?: string;
|
|
91
|
+
cause?: unknown;
|
|
92
|
+
};
|
|
93
|
+
extend<Name extends string = string>(name: Name, message?: string): any;
|
|
94
|
+
isError(error: unknown): error is Error;
|
|
95
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
96
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
97
|
+
stackTraceLimit: number;
|
|
98
|
+
};
|
|
22
99
|
/**
|
|
23
100
|
* Database errors.
|
|
24
101
|
*/
|
|
25
|
-
export declare class DatabaseError extends
|
|
102
|
+
export declare class DatabaseError extends DatabaseError_base {
|
|
26
103
|
}
|
|
104
|
+
export {};
|
|
27
105
|
//# sourceMappingURL=base-errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-errors.d.ts","sourceRoot":"","sources":["../../../src/errors/base-errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-errors.d.ts","sourceRoot":"","sources":["../../../src/errors/base-errors.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;;;;;;;;;;;;;qBAkB6c,CAAC;;;;;;;;;;;;;;;AAhBvf;;;GAGG;AACH,qBAAa,QAAS,SAAQ,aAA4B;CAAG;;;;;;;;;;;;;qBAYyb,CAAC;;;;;;;;;;;;;;;AAVvf;;;GAGG;AACH,qBAAa,WAAY,SAAQ,gBAA+B;CAAG;;;;;;;;;;;;;qBAMmb,CAAC;;;;;;;;;;;;;;;AAJvf;;GAEG;AACH,qBAAa,aAAc,SAAQ,kBAAiC;CAAG"}
|
|
@@ -1,42 +1,26 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Copyright 2021 DXOS.org
|
|
3
3
|
//
|
|
4
|
-
// TODO(dmaretskyi): Reconcile with @dxos/errors
|
|
5
4
|
/**
|
|
6
5
|
* NOTE: Messages should be sentences (Start with a capital letter and end with a period).
|
|
7
6
|
* Errors can optionally include a JSON context object.
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
code;
|
|
11
|
-
context;
|
|
12
|
-
constructor(code, message, context) {
|
|
13
|
-
// TODO(dmaretskyi): Error.cause.
|
|
14
|
-
super(message ?? code);
|
|
15
|
-
this.code = code;
|
|
16
|
-
this.context = context;
|
|
17
|
-
this.name = code;
|
|
18
|
-
// NOTE: Restores prototype chain (https://stackoverflow.com/a/48342359).
|
|
19
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
// TODO(dmaretskyi): Consider common error classes with error codes:
|
|
23
|
-
// throw new SystemError(ERROR_CODE_OUT_OF_MEMORY, 'Out of memory', { a: 1, b: 2 });
|
|
8
|
+
import { BaseError } from '@dxos/errors';
|
|
24
9
|
/**
|
|
25
10
|
* User facing API Errors.
|
|
26
11
|
* E.g., something was misconfigured.
|
|
27
12
|
*/
|
|
28
|
-
export class ApiError extends BaseError {
|
|
13
|
+
export class ApiError extends BaseError.extend('ApiError') {
|
|
29
14
|
}
|
|
30
15
|
/**
|
|
31
16
|
* Internal system errors.
|
|
32
17
|
* E.g., unexpected/unrecoverable runtime error.
|
|
33
18
|
*/
|
|
34
|
-
export class SystemError extends BaseError {
|
|
19
|
+
export class SystemError extends BaseError.extend('SystemError') {
|
|
35
20
|
}
|
|
36
21
|
/**
|
|
37
22
|
* Database errors.
|
|
38
23
|
*/
|
|
39
|
-
|
|
40
|
-
export class DatabaseError extends BaseError {
|
|
24
|
+
export class DatabaseError extends BaseError.extend('DatabaseError') {
|
|
41
25
|
}
|
|
42
26
|
//# sourceMappingURL=base-errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-errors.js","sourceRoot":"","sources":["../../../src/errors/base-errors.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF
|
|
1
|
+
{"version":3,"file":"base-errors.js","sourceRoot":"","sources":["../../../src/errors/base-errors.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC;CAAG;AAE7D;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC;CAAG;AAEnE;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS,CAAC,MAAM,CAAC,eAAe,CAAC;CAAG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type Error as SerializedErrorProto } from '../proto/gen/dxos/error.
|
|
1
|
+
import { type Error as SerializedErrorProto } from '../proto/gen/dxos/error.ts';
|
|
2
2
|
export declare const encodeError: (err: any) => SerializedErrorProto;
|
|
3
3
|
export type DecodeOptions = {
|
|
4
4
|
appendStack?: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const decodeError: (err: SerializedErrorProto, { appendStack }?: DecodeOptions) => Error
|
|
6
|
+
export declare const decodeError: (err: SerializedErrorProto, { appendStack }?: DecodeOptions) => Error | import("@dxos/errors").BaseError<string>;
|
|
7
7
|
//# sourceMappingURL=encoding.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../../src/errors/encoding.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../../src/errors/encoding.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGhF,eAAO,MAAM,WAAW,GAAI,KAAK,GAAG,KAAG,oBAiBtC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,KAAK,oBAAoB,EAAE,kBAAiB,aAAkB,qDASzF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../../src/errors/encoding.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;
|
|
1
|
+
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../../src/errors/encoding.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAGF,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAwB,EAAE;IAC5D,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,EAAE,OAAO,EAAE,CAAC;QAC5C,OAAO;YACL,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,KAAK,EAAE,GAAG,CAAC,KAAK;SACjB,CAAC;IACJ,CAAC;SAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO;YACL,OAAO,EAAE,GAAG;SACb,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;SAC7B,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAMF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAyB,EAAE,EAAE,WAAW,KAAoB,EAAE,EAAE,EAAE;IAC5F,MAAM,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,WAAW,EAAE,CAAC;QAChB,KAAK,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,GAAG,WAAW,CAAC;IAClE,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|