@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
|
@@ -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;AAIhF,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,
|
|
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;AAIhF,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"}
|