@dxos/edge-client 0.8.3 → 0.8.4-main.05e74ebcff
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/LICENSE +102 -5
- package/dist/lib/{browser/chunk-VHS3XEIX.mjs → neutral/chunk-ZIQ5T3A7.mjs} +20 -50
- package/dist/lib/{browser/chunk-VHS3XEIX.mjs.map → neutral/chunk-ZIQ5T3A7.mjs.map} +3 -3
- package/dist/lib/{browser → neutral}/edge-ws-muxer.mjs +1 -1
- package/dist/lib/neutral/index.mjs +1238 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/{browser → neutral}/testing/index.mjs +53 -33
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/auth.d.ts.map +1 -1
- package/dist/types/src/edge-client.d.ts +18 -15
- package/dist/types/src/edge-client.d.ts.map +1 -1
- package/dist/types/src/edge-http-client.d.ts +132 -37
- package/dist/types/src/edge-http-client.d.ts.map +1 -1
- package/dist/types/src/edge-http-client.test.d.ts +2 -0
- package/dist/types/src/edge-http-client.test.d.ts.map +1 -0
- package/dist/types/src/edge-identity.d.ts.map +1 -1
- package/dist/types/src/edge-ws-connection.d.ts +21 -0
- package/dist/types/src/edge-ws-connection.d.ts.map +1 -1
- package/dist/types/src/edge-ws-muxer.d.ts.map +1 -1
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/http-client.d.ts +25 -0
- package/dist/types/src/http-client.d.ts.map +1 -0
- package/dist/types/src/http-client.test.d.ts +2 -0
- package/dist/types/src/http-client.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +4 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/protocol.d.ts +1 -1
- package/dist/types/src/protocol.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-server.d.ts +9 -0
- package/dist/types/src/testing/test-server.d.ts.map +1 -0
- package/dist/types/src/testing/test-utils.d.ts +3 -3
- package/dist/types/src/testing/test-utils.d.ts.map +1 -1
- package/dist/types/src/utils.d.ts +1 -1
- package/dist/types/src/utils.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +34 -30
- package/src/edge-client.test.ts +20 -15
- package/src/edge-client.ts +90 -43
- package/src/edge-http-client.test.ts +23 -0
- package/src/edge-http-client.ts +606 -161
- package/src/edge-ws-connection.ts +131 -9
- package/src/edge-ws-muxer.ts +1 -1
- package/src/http-client.test.ts +58 -0
- package/src/http-client.ts +77 -0
- package/src/index.ts +4 -3
- package/src/testing/index.ts +1 -0
- package/src/testing/test-server.ts +45 -0
- package/src/testing/test-utils.ts +9 -9
- package/src/websocket.test.ts +1 -1
- package/dist/lib/browser/index.mjs +0 -1034
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node/chunk-XNHBUTNB.cjs +0 -317
- package/dist/lib/node/chunk-XNHBUTNB.cjs.map +0 -7
- package/dist/lib/node/edge-ws-muxer.cjs +0 -33
- package/dist/lib/node/edge-ws-muxer.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -1060
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/testing/index.cjs +0 -169
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-HGQUUFIJ.mjs +0 -299
- package/dist/lib/node-esm/chunk-HGQUUFIJ.mjs.map +0 -7
- package/dist/lib/node-esm/edge-ws-muxer.mjs +0 -12
- package/dist/lib/node-esm/edge-ws-muxer.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -1035
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -141
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- /package/dist/lib/{browser → neutral}/edge-ws-muxer.mjs.map +0 -0
|
@@ -1,37 +1,18 @@
|
|
|
1
1
|
import { Context } from '@dxos/context';
|
|
2
2
|
import { type PublicKey, type SpaceId } from '@dxos/keys';
|
|
3
|
-
import { type
|
|
3
|
+
import { type CreateAgentRequestBody, type CreateAgentResponseBody, type CreateSpaceRequest, type CreateSpaceResponseBody, type EdgeStatus, type ExecuteWorkflowResponseBody, type ExportBundleRequest, type ExportBundleResponse, type FeedProtocol, type GetAgentStatusResponseBody, type GetPluginVersionsResponseBody, type GetPluginsResponseBody, type GetNotarizationResponseBody, type ImportBundleRequest, type InitiateOAuthFlowRequest, type InitiateOAuthFlowResponse, type JoinSpaceRequest, type JoinSpaceResponseBody, type ObjectId, type PostNotarizationRequestBody, type RecoverIdentityRequest, type RecoverIdentityResponseBody, type UploadFunctionRequest, type UploadFunctionResponseBody } from '@dxos/protocols';
|
|
4
|
+
import { type QueryRequest as QueryRequestProto, type QueryResponse as QueryResponseProto } from '@dxos/protocols/proto/dxos/echo/query';
|
|
4
5
|
import { type EdgeIdentity } from './edge-identity';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
createAgent(body: CreateAgentRequestBody, args?: EdgeHttpGetArgs): Promise<CreateAgentResponseBody>;
|
|
16
|
-
getAgentStatus(request: {
|
|
17
|
-
ownerIdentityKey: PublicKey;
|
|
18
|
-
}, args?: EdgeHttpGetArgs): Promise<GetAgentStatusResponseBody>;
|
|
19
|
-
getCredentialsForNotarization(spaceId: SpaceId, args?: EdgeHttpGetArgs): Promise<GetNotarizationResponseBody>;
|
|
20
|
-
notarizeCredentials(spaceId: SpaceId, body: PostNotarizationRequestBody, args?: EdgeHttpGetArgs): Promise<void>;
|
|
21
|
-
joinSpaceByInvitation(spaceId: SpaceId, body: JoinSpaceRequest, args?: EdgeHttpGetArgs): Promise<JoinSpaceResponseBody>;
|
|
22
|
-
recoverIdentity(body: RecoverIdentityRequest, args?: EdgeHttpGetArgs): Promise<RecoverIdentityResponseBody>;
|
|
23
|
-
executeWorkflow(spaceId: SpaceId, graphId: ObjectId, input: any, args?: EdgeHttpGetArgs): Promise<ExecuteWorkflowResponseBody>;
|
|
24
|
-
uploadFunction(pathParts: {
|
|
25
|
-
functionId?: string;
|
|
26
|
-
}, body: UploadFunctionRequest, args?: EdgeHttpGetArgs): Promise<UploadFunctionResponseBody>;
|
|
27
|
-
initiateOAuthFlow(body: InitiateOAuthFlowRequest, args?: EdgeHttpGetArgs): Promise<InitiateOAuthFlowResponse>;
|
|
28
|
-
queryQueue(subspaceTag: string, spaceId: SpaceId, query: QueueQuery, args?: EdgeHttpGetArgs): Promise<QueryResult>;
|
|
29
|
-
insertIntoQueue(subspaceTag: string, spaceId: SpaceId, queueId: ObjectId, objects: unknown[], args?: EdgeHttpGetArgs): Promise<void>;
|
|
30
|
-
deleteFromQueue(subspaceTag: string, spaceId: SpaceId, queueId: ObjectId, objectIds: ObjectId[], args?: EdgeHttpGetArgs): Promise<void>;
|
|
31
|
-
createSpace(body: CreateSpaceRequest, args?: EdgeHttpGetArgs): Promise<CreateSpaceResponseBody>;
|
|
32
|
-
private _call;
|
|
33
|
-
private _handleUnauthorized;
|
|
34
|
-
}
|
|
6
|
+
/**
|
|
7
|
+
* HTTP wire shape returned by `/queue/.../query`. Unlike `FeedProtocol.QueryResult`
|
|
8
|
+
* (the RPC proto type, which transports object payloads as JSON strings), the edge
|
|
9
|
+
* HTTP endpoint embeds each object directly in the response JSON.
|
|
10
|
+
*/
|
|
11
|
+
export type EdgeQueryQueueResponse = {
|
|
12
|
+
objects?: unknown[];
|
|
13
|
+
nextCursor?: string;
|
|
14
|
+
prevCursor?: string;
|
|
15
|
+
};
|
|
35
16
|
export type RetryConfig = {
|
|
36
17
|
/**
|
|
37
18
|
* A number of call retries, not counting the initial request.
|
|
@@ -46,13 +27,127 @@ export type RetryConfig = {
|
|
|
46
27
|
*/
|
|
47
28
|
jitter?: number;
|
|
48
29
|
};
|
|
49
|
-
|
|
50
|
-
|
|
30
|
+
type EdgeHttpRequestArgs = {
|
|
31
|
+
method: string;
|
|
51
32
|
retry?: RetryConfig;
|
|
52
|
-
};
|
|
53
|
-
export type EdgeHttpPostArgs = {
|
|
54
|
-
context?: Context;
|
|
55
33
|
body?: any;
|
|
56
|
-
|
|
34
|
+
/**
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
json?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Force authentication.
|
|
40
|
+
* This should be used for requests with large bodies to avoid sending the body twice.
|
|
41
|
+
* The client will call /auth endpoint to generate the auth header.
|
|
42
|
+
*/
|
|
43
|
+
auth?: boolean;
|
|
57
44
|
};
|
|
45
|
+
export type EdgeHttpCallArgs = Pick<EdgeHttpRequestArgs, 'retry' | 'auth'>;
|
|
46
|
+
export type GetCronTriggersResponse = {
|
|
47
|
+
cronIds: string[];
|
|
48
|
+
};
|
|
49
|
+
export type EdgeHttpClientOptions = {
|
|
50
|
+
/**
|
|
51
|
+
* Tag included in the {@link EDGE_CLIENT_TAG_HEADER} header on every request.
|
|
52
|
+
* Used on Edge to classify traffic for metering (e.g. `ci-e2e`).
|
|
53
|
+
*/
|
|
54
|
+
clientTag?: string;
|
|
55
|
+
};
|
|
56
|
+
export declare class EdgeHttpClient {
|
|
57
|
+
private readonly _baseUrl;
|
|
58
|
+
private readonly _clientTag;
|
|
59
|
+
private _edgeIdentity;
|
|
60
|
+
/**
|
|
61
|
+
* Auth header is cached until receiving the next 401 from EDGE, at which point it gets refreshed.
|
|
62
|
+
*/
|
|
63
|
+
private _authHeader;
|
|
64
|
+
constructor(baseUrl: string, options?: EdgeHttpClientOptions);
|
|
65
|
+
get baseUrl(): string;
|
|
66
|
+
setIdentity(identity: EdgeIdentity): void;
|
|
67
|
+
getStatus(ctx: Context, args?: EdgeHttpCallArgs): Promise<EdgeStatus>;
|
|
68
|
+
createAgent(ctx: Context, body: CreateAgentRequestBody, args?: EdgeHttpCallArgs): Promise<CreateAgentResponseBody>;
|
|
69
|
+
getAgentStatus(ctx: Context, request: {
|
|
70
|
+
ownerIdentityKey: PublicKey;
|
|
71
|
+
}, args?: EdgeHttpCallArgs): Promise<GetAgentStatusResponseBody>;
|
|
72
|
+
getCredentialsForNotarization(ctx: Context, spaceId: SpaceId, args?: EdgeHttpCallArgs): Promise<GetNotarizationResponseBody>;
|
|
73
|
+
notarizeCredentials(ctx: Context, spaceId: SpaceId, body: PostNotarizationRequestBody, args?: EdgeHttpCallArgs): Promise<void>;
|
|
74
|
+
recoverIdentity(ctx: Context, body: RecoverIdentityRequest, args?: EdgeHttpCallArgs): Promise<RecoverIdentityResponseBody>;
|
|
75
|
+
joinSpaceByInvitation(ctx: Context, spaceId: SpaceId, body: JoinSpaceRequest, args?: EdgeHttpCallArgs): Promise<JoinSpaceResponseBody>;
|
|
76
|
+
initiateOAuthFlow(ctx: Context, body: InitiateOAuthFlowRequest, args?: EdgeHttpCallArgs): Promise<InitiateOAuthFlowResponse>;
|
|
77
|
+
createSpace(ctx: Context, body: CreateSpaceRequest, args?: EdgeHttpCallArgs): Promise<CreateSpaceResponseBody>;
|
|
78
|
+
queryQueue(ctx: Context, subspaceTag: string, spaceId: SpaceId, query: FeedProtocol.QueueQuery, args?: EdgeHttpCallArgs): Promise<EdgeQueryQueueResponse>;
|
|
79
|
+
insertIntoQueue(ctx: Context, subspaceTag: string, spaceId: SpaceId, queueId: ObjectId, objects: unknown[], args?: EdgeHttpCallArgs): Promise<void>;
|
|
80
|
+
deleteFromQueue(ctx: Context, subspaceTag: string, spaceId: SpaceId, queueId: ObjectId, objectIds: ObjectId[], args?: EdgeHttpCallArgs): Promise<void>;
|
|
81
|
+
uploadFunction(ctx: Context, pathParts: {
|
|
82
|
+
functionId?: string;
|
|
83
|
+
}, body: UploadFunctionRequest, args?: EdgeHttpCallArgs): Promise<UploadFunctionResponseBody>;
|
|
84
|
+
listFunctions(ctx: Context, args?: EdgeHttpCallArgs): Promise<any>;
|
|
85
|
+
invokeFunction(ctx: Context, params: {
|
|
86
|
+
functionId: string;
|
|
87
|
+
version?: string;
|
|
88
|
+
spaceId?: SpaceId;
|
|
89
|
+
cpuTimeLimit?: number;
|
|
90
|
+
subrequestsLimit?: number;
|
|
91
|
+
}, input: unknown, args?: EdgeHttpCallArgs): Promise<any>;
|
|
92
|
+
executeWorkflow(ctx: Context, spaceId: SpaceId, graphId: ObjectId, input: any, args?: EdgeHttpCallArgs): Promise<ExecuteWorkflowResponseBody>;
|
|
93
|
+
getCronTriggers(ctx: Context, spaceId: SpaceId): Promise<GetCronTriggersResponse>;
|
|
94
|
+
forceRunCronTrigger(ctx: Context, spaceId: SpaceId, triggerId: ObjectId): Promise<unknown>;
|
|
95
|
+
/**
|
|
96
|
+
* Execute a QueryAST query against a space.
|
|
97
|
+
*/
|
|
98
|
+
execQuery(ctx: Context, spaceId: SpaceId, body: QueryRequestProto, args?: EdgeHttpCallArgs): Promise<QueryResponseProto>;
|
|
99
|
+
/**
|
|
100
|
+
* Fetches the hydrated plugin directory from the Edge registry service.
|
|
101
|
+
* Unauthenticated; safe to call without an identity.
|
|
102
|
+
*/
|
|
103
|
+
getRegistryPlugins(ctx: Context, args?: EdgeHttpCallArgs): Promise<GetPluginsResponseBody>;
|
|
104
|
+
/**
|
|
105
|
+
* Fetches the available release versions for a given plugin repo. `repo` is the
|
|
106
|
+
* GitHub `owner/name` form; this method takes care of URL-encoding before issuing
|
|
107
|
+
* the request. Unauthenticated; same surface area as {@link getRegistryPlugins}.
|
|
108
|
+
*
|
|
109
|
+
* Versions are returned newest first, suitable for direct rendering in a picker.
|
|
110
|
+
*/
|
|
111
|
+
getRegistryPluginVersions(ctx: Context, repo: string, args?: EdgeHttpCallArgs): Promise<GetPluginVersionsResponseBody>;
|
|
112
|
+
importBundle(ctx: Context, spaceId: SpaceId, body: ImportBundleRequest, args?: EdgeHttpCallArgs): Promise<void>;
|
|
113
|
+
exportBundle(ctx: Context, spaceId: SpaceId, body: ExportBundleRequest, args?: EdgeHttpCallArgs): Promise<ExportBundleResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* Fetch through the edge proxy, used by integration plugins (Discord, ...)
|
|
116
|
+
* to call third-party REST APIs that don't set permissive CORS headers.
|
|
117
|
+
*
|
|
118
|
+
* `init.headers.Authorization` (caller-supplied) is preserved by prefixing
|
|
119
|
+
* with `X-Cors-Proxy-Authorization`, since the proxy strips `Authorization`
|
|
120
|
+
* on forwarding to avoid leaking the DXOS presentation upstream — the
|
|
121
|
+
* prefix carries the upstream's bot token / token through.
|
|
122
|
+
*
|
|
123
|
+
* TEMPORARY: routed through the legacy standalone proxy at
|
|
124
|
+
* `cors-proxy.dxos.workers.dev` (open, unauthenticated, path
|
|
125
|
+
* `/<host>/<path>`) so that integration plugins can be tested before the
|
|
126
|
+
* authenticated `/proxy/*` route on the main edge worker ships
|
|
127
|
+
* (https://github.com/dxos/edge/pull/576). When that PR deploys, restore
|
|
128
|
+
* the commented-out block below — it rewrites the target under
|
|
129
|
+
* `${this.baseUrl}/proxy/...` and signs the request with the cached
|
|
130
|
+
* verifiable presentation. The header-remap and `x-cors-proxy-*` override
|
|
131
|
+
* conventions are unchanged between the two paths.
|
|
132
|
+
*/
|
|
133
|
+
proxyFetch(target: URL, init?: RequestInit): Promise<Response>;
|
|
134
|
+
private _fetch;
|
|
135
|
+
private _call;
|
|
136
|
+
private _handleUnauthorized;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Fetch through the legacy standalone open proxy at `cors-proxy.dxos.workers.dev`.
|
|
140
|
+
*
|
|
141
|
+
* No DXOS auth, no `EdgeHttpClient` instance required — pure URL rewrite +
|
|
142
|
+
* header remap + `fetch`. Used by integration plugins from contexts that
|
|
143
|
+
* don't have an `EdgeHttpClient` in scope (e.g. plugin-integration's
|
|
144
|
+
* `credentialForm.onSubmit` and `onTokenCreated`, which run inside the
|
|
145
|
+
* coordinator's runtime that does not provide `Capability.Service`).
|
|
146
|
+
*
|
|
147
|
+
* TEMPORARY — see `LEGACY_CORS_PROXY_URL`. When the authenticated `/proxy/*`
|
|
148
|
+
* route on edge ships (https://github.com/dxos/edge/pull/576), delete this
|
|
149
|
+
* function and route everything through `EdgeHttpClient.proxyFetch` again.
|
|
150
|
+
*/
|
|
151
|
+
export declare const proxyFetchLegacy: (target: URL, init?: RequestInit, clientTag?: string) => Promise<Response>;
|
|
152
|
+
export {};
|
|
58
153
|
//# sourceMappingURL=edge-http-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-http-client.d.ts","sourceRoot":"","sources":["../../../src/edge-http-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edge-http-client.d.ts","sourceRoot":"","sources":["../../../src/edge-http-client.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAA+C,MAAM,eAAe,CAAC;AAGrF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAK5B,KAAK,UAAU,EACf,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,QAAQ,EACb,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC1B,KAAK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,EAAE,OAAO,EAChB,IAAI,EAAE,mBAAmB,EACzB,IAAI,CAAC,EAAE,gBAAgB,GACtB,OAAO,CAAC,oBAAoB,CAAC,CAM/B;IAMD;;;;;;;;;;;;;;;;;;OAkBG;IACU,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkC9E;YAMa,MAAM;YAaN,KAAK;YA8DL,mBAAmB;CASlC;AA6GD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,WAAY,GAAG,SAAQ,WAAW,cAAmB,MAAM,KAAG,OAAO,CAAC,QAAQ,CAU1G,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-http-client.test.d.ts","sourceRoot":"","sources":["../../../src/edge-http-client.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-identity.d.ts","sourceRoot":"","sources":["../../../src/edge-identity.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAEhF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACrF;AAED,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"edge-identity.d.ts","sourceRoot":"","sources":["../../../src/edge-identity.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAEhF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACrF;AAED,eAAO,MAAM,mBAAmB,mBAA0B,QAAQ,YAAY,YAAY,KAAG,OAAO,CAAC,UAAU,CAW9G,CAAC"}
|
|
@@ -13,19 +13,40 @@ export declare class EdgeWsConnection extends Resource {
|
|
|
13
13
|
private _inactivityTimeoutCtx;
|
|
14
14
|
private _ws;
|
|
15
15
|
private _wsMuxer;
|
|
16
|
+
private _lastReceivedMessageTimestamp;
|
|
17
|
+
private _openTimestamp;
|
|
18
|
+
private _pingTimestamp;
|
|
19
|
+
private _rtt;
|
|
20
|
+
private _uploadRate;
|
|
21
|
+
private _downloadRate;
|
|
22
|
+
private readonly _rateWindow;
|
|
23
|
+
private readonly _rateUpdateInterval;
|
|
24
|
+
private _bytesSamples;
|
|
25
|
+
private _messagesSent;
|
|
26
|
+
private _messagesReceived;
|
|
16
27
|
constructor(_identity: EdgeIdentity, _connectionInfo: {
|
|
17
28
|
url: URL;
|
|
18
29
|
protocolHeader?: string;
|
|
30
|
+
headers?: Record<string, string>;
|
|
19
31
|
}, _callbacks: EdgeWsConnectionCallbacks);
|
|
20
32
|
get info(): {
|
|
21
33
|
open: boolean;
|
|
22
34
|
identity: string;
|
|
23
35
|
device: string;
|
|
24
36
|
};
|
|
37
|
+
get rtt(): number;
|
|
38
|
+
get uptime(): number;
|
|
39
|
+
get uploadRate(): number;
|
|
40
|
+
get downloadRate(): number;
|
|
41
|
+
get messagesSent(): number;
|
|
42
|
+
get messagesReceived(): number;
|
|
25
43
|
send(message: Message): void;
|
|
26
44
|
protected _open(): Promise<void>;
|
|
27
45
|
protected _close(): Promise<void>;
|
|
28
46
|
private _scheduleHeartbeats;
|
|
29
47
|
private _rescheduleHeartbeatTimeout;
|
|
48
|
+
private _recordBytes;
|
|
49
|
+
private _scheduleRateCalculation;
|
|
50
|
+
private _calculateRates;
|
|
30
51
|
}
|
|
31
52
|
//# sourceMappingURL=edge-ws-connection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-ws-connection.d.ts","sourceRoot":"","sources":["../../../src/edge-ws-connection.ts"],"names":[],"mappings":"AAOA,OAAO,EAAW,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKlD,OAAO,
|
|
1
|
+
{"version":3,"file":"edge-ws-connection.d.ts","sourceRoot":"","sources":["../../../src/edge-ws-connection.ts"],"names":[],"mappings":"AAOA,OAAO,EAAW,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKlD,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,4CAA4C,CAAC;AAGzF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAOpD,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B,CAAC;AAEF,qBAAa,gBAAiB,SAAQ,QAAQ;IAuB1C,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAxB7B,OAAO,CAAC,qBAAqB,CAAsB;IACnD,OAAO,CAAC,GAAG,CAAwB;IACnC,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,6BAA6B,CAAc;IAEnD,OAAO,CAAC,cAAc,CAAqB;IAG3C,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,IAAI,CAAK;IAGjB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAQ;IAC5C,OAAO,CAAC,aAAa,CAAoE;IAEzF,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,iBAAiB,CAAK;IAE9B,YACmB,SAAS,EAAE,YAAY,EACvB,eAAe,EAAE;QAAE,GAAG,EAAE,GAAG,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,EACxF,UAAU,EAAE,yBAAyB,EAGvD;IAED,IACW,IAAI;QAEX,IAAI;QACJ,QAAQ;QACR,MAAM;MAET;IAED,IAAW,GAAG,IAAI,MAAM,CAEvB;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,UAAU,IAAI,MAAM,CAE9B;IAED,IAAW,YAAY,IAAI,MAAM,CAEhC;IAED,IAAW,YAAY,IAAI,MAAM,CAEhC;IAED,IAAW,gBAAgB,IAAI,MAAM,CAEpC;IAEM,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuBlC;IAED,UAAyB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAyE9C;IAED,UAAyB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAc/C;IAED,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,2BAA2B;IAwBnC,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,eAAe;CA4BxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-ws-muxer.d.ts","sourceRoot":"","sources":["../../../src/edge-ws-muxer.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"edge-ws-muxer.d.ts","sourceRoot":"","sources":["../../../src/edge-ws-muxer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,4CAA4C,CAAC;AAkBzF;;GAEG;AACH,eAAO,MAAM,4BAA4B,QAAc,CAAC;AACxD,eAAO,MAAM,wBAAwB,QAAmB,CAAC;AAMzD,qBAAa,cAAc;IAUvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IATtB,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAA+B;IACrE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAqC;IACvE,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAA6B;IAEzE,OAAO,CAAC,YAAY,CAAkB;IAEtC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IAEzC,YACmB,GAAG,EAAE,eAAe,EACrC,MAAM,CAAC,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,EAGpC;IAED;;OAEG;IACU,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CjD;IAEM,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,GAAG,SAAS,CAqBxD;IAEM,OAAO,IAAI,IAAI,CAWrB;IAED,OAAO,CAAC,oBAAoB;IA0C5B,OAAO,CAAC,eAAe;CAWxB;AAED,KAAK,eAAe,GAAG;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,OAAO,EAAE,CAAC,WAAW,GAAG,eAAe,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;CAC/D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAIA,qBAAa,yBAA0B,SAAQ,KAAK
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAIA,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,cAEC;CACF;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,cAEC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type * as HttpClient from '@effect/platform/HttpClient';
|
|
2
|
+
import type * as HttpClientError from '@effect/platform/HttpClientError';
|
|
3
|
+
import type * as HttpClientResponse from '@effect/platform/HttpClientResponse';
|
|
4
|
+
import * as Context from 'effect/Context';
|
|
5
|
+
import * as Duration from 'effect/Duration';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Layer from 'effect/Layer';
|
|
8
|
+
export type RetryOptions = {
|
|
9
|
+
timeout: Duration.Duration;
|
|
10
|
+
retryTimes: number;
|
|
11
|
+
retryBaseDelay: Duration.Duration;
|
|
12
|
+
};
|
|
13
|
+
declare const HttpConfig_base: Context.TagClass<HttpConfig, "HttpConfig", RetryOptions>;
|
|
14
|
+
export declare class HttpConfig extends HttpConfig_base {
|
|
15
|
+
static default: Layer.Layer<HttpConfig, never, never>;
|
|
16
|
+
}
|
|
17
|
+
export declare const withRetry: (effect: Effect.Effect<HttpClientResponse.HttpClientResponse, HttpClientError.HttpClientError, HttpClient.HttpClient>, { timeout, retryBaseDelay, retryTimes, }?: Partial<RetryOptions>) => Effect.Effect<unknown, Error | import("effect/Cause").TimeoutException | HttpClientError.HttpClientError, HttpClient.HttpClient>;
|
|
18
|
+
export declare const withRetryConfig: (effect: Effect.Effect<HttpClientResponse.HttpClientResponse, HttpClientError.HttpClientError, HttpClient.HttpClient>) => Effect.Effect<unknown, Error | HttpClientError.HttpClientError, HttpClient.HttpClient | HttpConfig>;
|
|
19
|
+
export declare const withLogging: <A extends HttpClientResponse.HttpClientResponse, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export declare const encodeAuthHeader: (challenge: Uint8Array) => string;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=http-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../src/http-client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,UAAU,M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
|
|
|
1
1
|
export * from '@dxos/protocols/buf/dxos/edge/messenger_pb';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './auth';
|
|
3
3
|
export * from './defs';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './edge-client';
|
|
5
5
|
export * from './errors';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './protocol';
|
|
7
7
|
export * from './edge-http-client';
|
|
8
8
|
export * from './edge-identity';
|
|
9
9
|
export * from './edge-ws-muxer';
|
|
10
|
+
export * from './http-client';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,4CAA4C,CAAC;AAE3D,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,4CAA4C,CAAC;AAE3D,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
|
|
@@ -21,7 +21,7 @@ export declare class Protocol {
|
|
|
21
21
|
/**
|
|
22
22
|
* Create a packed message.
|
|
23
23
|
*/
|
|
24
|
-
createMessage<Desc extends buf.DescMessage>(type: Desc, { source, target, payload, serviceId
|
|
24
|
+
createMessage<Desc extends buf.DescMessage>(type: Desc, { source, target, payload, serviceId }: {
|
|
25
25
|
source?: PeerData;
|
|
26
26
|
target?: PeerData[];
|
|
27
27
|
payload?: buf.MessageInitShape<Desc>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/protocol.ts"],"names":[],"mappings":"AA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M,CAAC,EAAE,QAAQ,EAAE,CAAC;QACpB,OAAO,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACrC,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAQT;CACF;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,SAAgB,GAAG,KAAG,OAAO,CAAC,UAAU,CAYhE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import http from 'node:http';
|
|
2
|
+
export type TestServer = {
|
|
3
|
+
url: string;
|
|
4
|
+
close: () => void;
|
|
5
|
+
};
|
|
6
|
+
export type ResponseHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void;
|
|
7
|
+
export declare const createTestServer: (responseHandler: ResponseHandler) => Promise<TestServer>;
|
|
8
|
+
export declare const responseHandler: (cb: (attempt: number) => false | object) => ResponseHandler;
|
|
9
|
+
//# sourceMappingURL=test-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-server.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-server.ts"],"names":[],"mappings":"AAIA,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC;AAE5F,eAAO,MAAM,gBAAgB,oBAAqB,eAAe,wBAahE,CAAC;AAEF,eAAO,MAAM,eAAe,OAAQ,CAAC,OAAO,EAAE,MAAM,KAAK,KAAK,GAAG,MAAM,KAAG,eAczE,CAAC"}
|
|
@@ -3,13 +3,13 @@ import { Trigger } from '@dxos/async';
|
|
|
3
3
|
import { type Message } from '@dxos/protocols/buf/dxos/edge/messenger_pb';
|
|
4
4
|
import { WebSocketMuxer } from '../edge-ws-muxer';
|
|
5
5
|
export declare const DEFAULT_PORT = 8080;
|
|
6
|
-
type
|
|
6
|
+
type TestEdgeWsServerProps = {
|
|
7
7
|
admitConnection?: Trigger;
|
|
8
8
|
payloadDecoder?: (payload: Uint8Array) => any;
|
|
9
9
|
messageHandler?: (payload: any) => Promise<Uint8Array | undefined>;
|
|
10
10
|
};
|
|
11
|
-
export declare const createTestEdgeWsServer: (port?: number, params?:
|
|
12
|
-
server: WebSocket.Server
|
|
11
|
+
export declare const createTestEdgeWsServer: (port?: number, params?: TestEdgeWsServerProps) => Promise<{
|
|
12
|
+
server: WebSocket.Server<typeof WebSocket, typeof import("http").IncomingMessage>;
|
|
13
13
|
messageSink: any[];
|
|
14
14
|
messageSourceLog: any[];
|
|
15
15
|
endpoint: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-utils.ts"],"names":[],"mappings":"AAIA,OAAO,SAAS,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,OAAO,
|
|
1
|
+
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-utils.ts"],"names":[],"mappings":"AAIA,OAAO,SAAS,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,OAAO,EAAE,KAAK,OAAO,EAAoC,MAAM,4CAA4C,CAAC;AAG5G,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,KAAK,qBAAqB,GAAG;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,GAAG,CAAC;IAC9C,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;CACpE,CAAC;AAEF,eAAO,MAAM,sBAAsB,2BAAwC,qBAAqB;;;;;;;YAOxE,SAAS;eAAS,cAAc;;mCAwErC,OAAO,mBAAmB,UAAU;uBA1BhC,OAAO;;EAS7B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const getEdgeUrlWithProtocol: (baseUrl: string, protocol:
|
|
1
|
+
export declare const getEdgeUrlWithProtocol: (baseUrl: string, protocol: 'http' | 'ws') => string;
|
|
2
2
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB,YAAa,MAAM,YAAY,MAAM,GAAG,IAAI,WAK9E,CAAC"}
|