@dxos/edge-client 0.10.0 → 0.11.1
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/lib/chunk-edge-ws-muxer.mjs +322 -0
- package/dist/lib/chunk-edge-ws-muxer.mjs.map +1 -0
- package/dist/lib/cors-proxy.mjs +29 -0
- package/dist/lib/cors-proxy.mjs.map +1 -0
- package/dist/lib/edge-ws-muxer.mjs +2 -0
- package/dist/lib/index.mjs +1769 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/service.mjs +138 -0
- package/dist/lib/service.mjs.map +1 -0
- package/dist/lib/testing.mjs +160 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/types/src/base-http-client.d.ts +18 -0
- package/dist/types/src/base-http-client.d.ts.map +1 -1
- package/dist/types/src/browser-rendering.d.ts +0 -7
- package/dist/types/src/browser-rendering.d.ts.map +1 -1
- package/dist/types/src/edge-client.d.ts +22 -2
- package/dist/types/src/edge-client.d.ts.map +1 -1
- package/dist/types/src/edge-http-client.d.ts +86 -2
- package/dist/types/src/edge-http-client.d.ts.map +1 -1
- package/dist/types/src/edge-ws-connection.d.ts +19 -0
- package/dist/types/src/edge-ws-connection.d.ts.map +1 -1
- package/dist/types/src/edge-ws-connection.test.d.ts +2 -0
- package/dist/types/src/edge-ws-connection.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/protocol.d.ts +2 -1
- package/dist/types/src/protocol.d.ts.map +1 -1
- package/dist/types/src/testing/test-utils.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -20
- package/src/base-http-client.ts +71 -3
- package/src/browser-rendering.ts +0 -9
- package/src/edge-client.ts +21 -3
- package/src/edge-http-client.test.ts +121 -0
- package/src/edge-http-client.ts +156 -2
- package/src/edge-ws-connection.test.ts +219 -0
- package/src/edge-ws-connection.ts +97 -28
- package/src/index.ts +1 -0
- package/src/protocol.ts +11 -2
- package/src/testing/test-utils.ts +5 -1
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
- package/dist/lib/neutral/chunk-L5ZHLJ4B.mjs +0 -310
- package/dist/lib/neutral/chunk-L5ZHLJ4B.mjs.map +0 -7
- package/dist/lib/neutral/chunk-WQKMEZJR.mjs +0 -30
- package/dist/lib/neutral/chunk-WQKMEZJR.mjs.map +0 -7
- package/dist/lib/neutral/cors-proxy.mjs +0 -8
- package/dist/lib/neutral/cors-proxy.mjs.map +0 -7
- package/dist/lib/neutral/edge-ws-muxer.mjs +0 -12
- package/dist/lib/neutral/edge-ws-muxer.mjs.map +0 -7
- package/dist/lib/neutral/index.mjs +0 -1524
- package/dist/lib/neutral/index.mjs.map +0 -7
- package/dist/lib/neutral/meta.json +0 -1
- package/dist/lib/neutral/service/index.mjs +0 -134
- package/dist/lib/neutral/service/index.mjs.map +0 -7
- package/dist/lib/neutral/testing/index.mjs +0 -161
- package/dist/lib/neutral/testing/index.mjs.map +0 -7
|
@@ -32,6 +32,13 @@ type HttpRequestArgs = {
|
|
|
32
32
|
json?: boolean;
|
|
33
33
|
auth?: boolean;
|
|
34
34
|
};
|
|
35
|
+
export type RawHttpRequestArgs = {
|
|
36
|
+
method: string;
|
|
37
|
+
body?: BodyInit;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
retry?: RetryConfig;
|
|
40
|
+
auth?: boolean;
|
|
41
|
+
};
|
|
35
42
|
export declare abstract class BaseHttpClient {
|
|
36
43
|
protected readonly _baseUrl: string;
|
|
37
44
|
protected readonly _clientTag: string | undefined;
|
|
@@ -42,6 +49,17 @@ export declare abstract class BaseHttpClient {
|
|
|
42
49
|
get baseUrl(): string;
|
|
43
50
|
setIdentity(identity: EdgeIdentity): void;
|
|
44
51
|
protected _call<T>(ctx: Context, url: URL, args: HttpRequestArgs): Promise<T>;
|
|
52
|
+
/**
|
|
53
|
+
* Like {@link _call} but returns the raw `Response` instead of parsing a JSON envelope — for
|
|
54
|
+
* endpoints with binary or absent response bodies (e.g. blob storage). A 404 is returned to the
|
|
55
|
+
* caller rather than thrown, since "not found" is an expected outcome for lookups; all other
|
|
56
|
+
* non-ok, non-retryable statuses throw `EdgeCallFailedError`, mirroring `_call`.
|
|
57
|
+
*
|
|
58
|
+
* NOTE: Duplicates `_call`'s auth/retry loop rather than sharing it, to avoid touching `_call`'s
|
|
59
|
+
* broadly-depended-on JSON-envelope behavior. `EdgeHttpClient.anthropicAiRequest`'s separate
|
|
60
|
+
* duplicate loop is a follow-up candidate for consolidating onto this method.
|
|
61
|
+
*/
|
|
62
|
+
protected _callRaw(ctx: Context, url: URL, args: RawHttpRequestArgs): Promise<Response>;
|
|
45
63
|
protected _handleUnauthorized(response: Response): Promise<string>;
|
|
46
64
|
}
|
|
47
65
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-http-client.d.ts","sourceRoot":"","sources":["../../../src/base-http-client.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAA+C,MAAM,eAAe,CAAC;AAKrF,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,iBAAiB,CAAC;AASzE,MAAM,MAAM,WAAW,GAAG;IACxB,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,MA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,CAAC,CAOvE;CACF"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import * as Context from 'effect/Context';
|
|
2
1
|
import * as Schema from 'effect/Schema';
|
|
3
|
-
import { type EdgeHttpClient } from './edge-http-client';
|
|
4
2
|
/** Request body for EDGE `/ai/browser-rendering/markdown` (ai-service Browser Run markdown quick action). */
|
|
5
3
|
export declare const MarkdownRequest: Schema.Struct<{
|
|
6
4
|
url: Schema.optional<typeof Schema.String>;
|
|
@@ -20,9 +18,4 @@ export declare const MarkdownResponse: Schema.Struct<{
|
|
|
20
18
|
result: typeof Schema.String;
|
|
21
19
|
}>;
|
|
22
20
|
export type MarkdownResponse = Schema.Schema.Type<typeof MarkdownResponse>;
|
|
23
|
-
declare const EdgeHttpClientService_base: Context.TagClass<EdgeHttpClientService, "@dxos/edge-client/EdgeHttpClientService", EdgeHttpClient>;
|
|
24
|
-
/** Authenticated EDGE HTTP client for operation handlers (e.g. browser markdown fetch). */
|
|
25
|
-
export declare class EdgeHttpClientService extends EdgeHttpClientService_base {
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
28
21
|
//# sourceMappingURL=browser-rendering.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-rendering.d.ts","sourceRoot":"","sources":["../../../src/browser-rendering.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"browser-rendering.d.ts","sourceRoot":"","sources":["../../../src/browser-rendering.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,6GAA6G;AAC7G,eAAO,MAAM,eAAe;;;;;;;;;;EAY1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC;AAEzE,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB;;;EAG3B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as EffectContext from 'effect/Context';
|
|
1
2
|
import { Event } from '@dxos/async';
|
|
2
3
|
import { Context } from '@dxos/context';
|
|
3
4
|
import { type Lifecycle, Resource } from '@dxos/context';
|
|
@@ -26,7 +27,23 @@ export interface EdgeConnection extends Required<Lifecycle> {
|
|
|
26
27
|
setIdentity(identity: EdgeIdentity): void;
|
|
27
28
|
send(ctx: Context, message: Message): Promise<void>;
|
|
28
29
|
onMessage(listener: MessageListener): () => void;
|
|
29
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Subscribe to connection (re-)establishment.
|
|
32
|
+
*
|
|
33
|
+
* By default the listener also fires once immediately when the connection is already ready at
|
|
34
|
+
* subscription time — a current-state notification for late subscribers. Pass
|
|
35
|
+
* `emitCurrentState: false` for reconnect-reaction logic (e.g. restarting a session): reacting
|
|
36
|
+
* to the subscribe-time firing there causes restart loops, since each restart re-subscribes.
|
|
37
|
+
*/
|
|
38
|
+
onReconnected(listener: ReconnectListener, opts?: {
|
|
39
|
+
emitCurrentState?: boolean;
|
|
40
|
+
}): () => void;
|
|
41
|
+
}
|
|
42
|
+
declare const EdgeConnectionService_base: EffectContext.TagClass<EdgeConnectionService, "@dxos/edge-client/EdgeConnection", EdgeConnection>;
|
|
43
|
+
/**
|
|
44
|
+
* Effect service tag for {@link EdgeConnection}.
|
|
45
|
+
*/
|
|
46
|
+
export declare class EdgeConnectionService extends EdgeConnectionService_base {
|
|
30
47
|
}
|
|
31
48
|
/**
|
|
32
49
|
* Messenger client for EDGE:
|
|
@@ -62,7 +79,9 @@ export declare class EdgeClient extends Resource implements EdgeConnection {
|
|
|
62
79
|
*/
|
|
63
80
|
send(ctx: Context, message: Message): Promise<void>;
|
|
64
81
|
onMessage(listener: MessageListener): () => boolean;
|
|
65
|
-
onReconnected(listener: ReconnectListener
|
|
82
|
+
onReconnected(listener: ReconnectListener, opts?: {
|
|
83
|
+
emitCurrentState?: boolean;
|
|
84
|
+
}): () => boolean;
|
|
66
85
|
/**
|
|
67
86
|
* Open connection to messaging service.
|
|
68
87
|
*/
|
|
@@ -79,4 +98,5 @@ export declare class EdgeClient extends Resource implements EdgeConnection {
|
|
|
79
98
|
private _createAuthHeader;
|
|
80
99
|
private _isActive;
|
|
81
100
|
}
|
|
101
|
+
export {};
|
|
82
102
|
//# sourceMappingURL=edge-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-client.d.ts","sourceRoot":"","sources":["../../../src/edge-client.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,EAMN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAA+C,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,KAAK,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAGxE,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,iBAAiB,CAAC;AAGzE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQ3C,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AACzD,MAAM,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,cAAe,SAAQ,QAAQ,CAAC,SAAS,CAAC;IACzD,aAAa,EAAE,KAAK,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AAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,kBAAkB,CAAC,CAA+B;IAC1D,OAAO,CAAC,MAAM,CAAiB;IAE/B,YACU,SAAS,EAAE,YAAY,EACd,OAAO,EAAE,eAAe,EAK1C;IAED,IACW,IAAI;QAEX,IAAI;QACJ,MAAM;QACN,QAAQ;QACR,MAAM;MAET;IAED,IAAI,MAAM,IAAI,UAAU,CAavB;IAED,IAAI,WAAW,WAEd;IAED,IAAI,OAAO,WAEV;IAED,WAAW,CAAC,QAAQ,EAAE,YAAY,QAOjC;IAED;;;OAGG;IACU,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,iBA4B/C;IAEM,SAAS,CAAC,QAAQ,EAAE,eAAe,iBAGzC;IAEM,aAAa,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,iBAiBtF;IAED;;OAEG;IACH,UAAyB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAiB9C;IAED;;OAEG;IACH,UAAyB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAI/C;YAEa,QAAQ;YA4ER,WAAW;IAKzB,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,sBAAsB;YAUhB,iBAAiB;IAY/B,OAAO,CAAC,SAAS,CAA4E;CAC9F"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as EffectContext from 'effect/Context';
|
|
1
2
|
import { type Context } from '@dxos/context';
|
|
2
3
|
import { type SpaceId } from '@dxos/keys';
|
|
3
|
-
import { type CompleteOAuthRegistrationRequest, type CompleteOAuthRegistrationResponse, type CreateAgentRequestBody, type CreateAgentResponseBody, type CreateSpaceRequest, type CreateSpaceResponseBody, type EdgeStatus, type ExecuteWorkflowResponseBody, type ExportBundleRequest, type ExportBundleResponse, type FeedProtocol, type GetAgentStatusResponseBody, type GetNotarizationResponseBody, type GetPluginsResponseBody, 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 CompleteOAuthRegistrationRequest, type CompleteOAuthRegistrationResponse, type CreateAgentRequestBody, type CreateAgentResponseBody, type CreateSpaceRequest, type CreateSpaceResponseBody, type EdgeStatus, type ExecuteWorkflowResponseBody, type ExportBundleRequest, type ExportBundleResponse, type FeedProtocol, type GetAccessTokenRequest, type GetAccessTokenResponseBody, type GetAgentStatusResponseBody, type GetNotarizationResponseBody, type GetPluginsResponseBody, type ImportBundleRequest, type InitiateOAuthFlowRequest, type InitiateOAuthFlowResponse, type JoinSpaceRequest, type JoinSpaceResponseBody, type ObjectId, type PostNotarizationRequestBody, type RecoverIdentityRequest, type RecoverIdentityResponseBody, type SerializedError, type UploadFunctionRequest, type UploadFunctionResponseBody } from '@dxos/protocols';
|
|
4
5
|
import { type QueryRequest as QueryRequestProto, type QueryResponse as QueryResponseProto } from '@dxos/protocols/proto/dxos/echo/query';
|
|
5
6
|
import { BaseHttpClient, type BaseHttpClientOptions, type EdgeHttpCallArgs } from './base-http-client';
|
|
6
7
|
export type { EdgeHttpCallArgs, RetryConfig } from './base-http-client';
|
|
@@ -31,7 +32,47 @@ export type TriggersDispatcherStatus = {
|
|
|
31
32
|
export type GetCronTriggersResponse = {
|
|
32
33
|
cronIds: string[];
|
|
33
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Per-trigger runtime status reported by the EDGE dispatcher, keyed to the
|
|
37
|
+
* trigger's ECHO object id so a client can correlate it with the replicated
|
|
38
|
+
* `Trigger` object in its local database.
|
|
39
|
+
*
|
|
40
|
+
* TODO(edge): The backing endpoint (`GET /triggers/{spaceId}`, see
|
|
41
|
+
* {@link EdgeHttpClient.getSpaceTriggers}) is a proposal and is not yet
|
|
42
|
+
* implemented server-side.
|
|
43
|
+
*/
|
|
44
|
+
export type EdgeTriggerStatus = {
|
|
45
|
+
/** ECHO object id of the trigger. */
|
|
46
|
+
triggerId: ObjectId;
|
|
47
|
+
/** Whether the EDGE dispatcher currently has this trigger registered. */
|
|
48
|
+
registered: boolean;
|
|
49
|
+
kind: 'timer' | 'subscription' | 'email' | 'webhook' | 'feed' | 'direct';
|
|
50
|
+
/** Next scheduled cron execution (epoch ms). Set only for `timer` triggers. */
|
|
51
|
+
nextExecutionTimestamp?: number;
|
|
52
|
+
/** Cooldown expiry after a failure (epoch ms). */
|
|
53
|
+
cooldownUntilTimestamp?: number;
|
|
54
|
+
/** Outcome of the most recent invocation on the edge. */
|
|
55
|
+
lastResult?: {
|
|
56
|
+
status: 'success' | 'failure';
|
|
57
|
+
/** Completion time (epoch ms). */
|
|
58
|
+
timestamp: number;
|
|
59
|
+
error?: SerializedError;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Response of the proposed `GET /triggers/{spaceId}` endpoint: the full list of
|
|
64
|
+
* triggers registered on a space's EDGE dispatcher, with runtime status. Polled
|
|
65
|
+
* by the remote trigger monitor to surface edge trigger state.
|
|
66
|
+
*/
|
|
67
|
+
export type GetSpaceTriggersResponse = {
|
|
68
|
+
/** Whether the space's edge dispatcher is active. */
|
|
69
|
+
isActive: boolean;
|
|
70
|
+
triggers: EdgeTriggerStatus[];
|
|
71
|
+
};
|
|
34
72
|
export type EdgeHttpClientOptions = BaseHttpClientOptions;
|
|
73
|
+
declare const EdgeHttpClientService_base: EffectContext.TagClass<EdgeHttpClientService, "@dxos/edge-client/EdgeHttpClient", EdgeHttpClient>;
|
|
74
|
+
export declare class EdgeHttpClientService extends EdgeHttpClientService_base {
|
|
75
|
+
}
|
|
35
76
|
/**
|
|
36
77
|
* HTTP client for the edge worker API (spaces, queues, functions, agents, etc.).
|
|
37
78
|
*
|
|
@@ -51,10 +92,41 @@ export declare class EdgeHttpClient extends BaseHttpClient {
|
|
|
51
92
|
joinSpaceByInvitation(ctx: Context, spaceId: SpaceId, body: JoinSpaceRequest, args?: EdgeHttpCallArgs): Promise<JoinSpaceResponseBody>;
|
|
52
93
|
initiateOAuthFlow(ctx: Context, body: InitiateOAuthFlowRequest, args?: EdgeHttpCallArgs): Promise<InitiateOAuthFlowResponse>;
|
|
53
94
|
completeOAuthRegistration(ctx: Context, body: CompleteOAuthRegistrationRequest, args?: EdgeHttpCallArgs): Promise<CompleteOAuthRegistrationResponse>;
|
|
95
|
+
/**
|
|
96
|
+
* Resolves the live access token behind a `MANAGED_ACCESS_TOKEN` placeholder. Authorized by the
|
|
97
|
+
* caller's presentation: EDGE serves it only to members of the owning space.
|
|
98
|
+
*/
|
|
99
|
+
getAccessToken(ctx: Context, body: GetAccessTokenRequest, args?: EdgeHttpCallArgs): Promise<GetAccessTokenResponseBody>;
|
|
54
100
|
createSpace(ctx: Context, body: CreateSpaceRequest, args?: EdgeHttpCallArgs): Promise<CreateSpaceResponseBody>;
|
|
55
|
-
queryQueue(ctx: Context, subspaceTag: string, spaceId: SpaceId, query: FeedProtocol.
|
|
101
|
+
queryQueue(ctx: Context, subspaceTag: string, spaceId: SpaceId, query: FeedProtocol.FeedQuery, args?: EdgeHttpCallArgs): Promise<EdgeQueryQueueResponse>;
|
|
56
102
|
insertIntoQueue(ctx: Context, subspaceTag: string, spaceId: SpaceId, queueId: ObjectId, objects: unknown[], args?: EdgeHttpCallArgs): Promise<void>;
|
|
57
103
|
deleteFromQueue(ctx: Context, subspaceTag: string, spaceId: SpaceId, queueId: ObjectId, objectIds: ObjectId[], args?: EdgeHttpCallArgs): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Builds the URL for the blob stored under `key`. `key` is URL-encoded for defense in depth —
|
|
106
|
+
* callers pass a lowercase hex SHA-256 digest (extracted from an `ni:` URI by the edge backend).
|
|
107
|
+
*/
|
|
108
|
+
getBlobUrl(key: string): URL;
|
|
109
|
+
/**
|
|
110
|
+
* Uploads bytes to the edge blob service, keyed by content hash. Pre-fetches `/auth` (`auth:
|
|
111
|
+
* true`) so large bodies aren't sent twice on an auth challenge.
|
|
112
|
+
*/
|
|
113
|
+
putBlob(ctx: Context, key: string, data: Uint8Array, args?: EdgeHttpCallArgs & {
|
|
114
|
+
contentType?: string;
|
|
115
|
+
}): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Downloads bytes previously stored with {@link putBlob}. Returns `undefined` if `key` is not
|
|
118
|
+
* found.
|
|
119
|
+
*/
|
|
120
|
+
getBlob(ctx: Context, key: string, args?: EdgeHttpCallArgs): Promise<Uint8Array | undefined>;
|
|
121
|
+
/**
|
|
122
|
+
* Checks whether bytes are stored under `key`, without downloading them.
|
|
123
|
+
*/
|
|
124
|
+
hasBlob(ctx: Context, key: string, args?: EdgeHttpCallArgs): Promise<boolean>;
|
|
125
|
+
/**
|
|
126
|
+
* Deletes bytes stored under `key`. Not called by any core `Blob.remove` path in v1 (deletion is
|
|
127
|
+
* deferred), provided for completeness.
|
|
128
|
+
*/
|
|
129
|
+
deleteBlob(ctx: Context, key: string, args?: EdgeHttpCallArgs): Promise<void>;
|
|
58
130
|
uploadFunction(ctx: Context, pathParts: {
|
|
59
131
|
functionId?: string;
|
|
60
132
|
}, body: UploadFunctionRequest, args?: EdgeHttpCallArgs): Promise<UploadFunctionResponseBody>;
|
|
@@ -70,6 +142,18 @@ export declare class EdgeHttpClient extends BaseHttpClient {
|
|
|
70
142
|
getCronTriggers(ctx: Context, spaceId: SpaceId): Promise<GetCronTriggersResponse>;
|
|
71
143
|
getTriggersDispatcherStatus(ctx: Context, spaceId: SpaceId, args?: EdgeHttpCallArgs): Promise<TriggersDispatcherStatus>;
|
|
72
144
|
forceRunCronTrigger(ctx: Context, spaceId: SpaceId, triggerId: ObjectId): Promise<unknown>;
|
|
145
|
+
/**
|
|
146
|
+
* Cancels the current run of a cron trigger on the EDGE dispatcher — its in-flight execution and
|
|
147
|
+
* `runAgain` continuation chain. The trigger stays enabled, so its schedule keeps firing.
|
|
148
|
+
*/
|
|
149
|
+
cancelTriggerRun(ctx: Context, spaceId: SpaceId, triggerId: ObjectId): Promise<unknown>;
|
|
150
|
+
/**
|
|
151
|
+
* Returns the full list of triggers registered on a space's EDGE dispatcher, with per-trigger
|
|
152
|
+
* runtime status. Polled by the remote trigger monitor to surface edge trigger state.
|
|
153
|
+
*
|
|
154
|
+
* TODO(edge): Proposed endpoint; not yet implemented server-side.
|
|
155
|
+
*/
|
|
156
|
+
getSpaceTriggers(ctx: Context, spaceId: SpaceId, args?: EdgeHttpCallArgs): Promise<GetSpaceTriggersResponse>;
|
|
73
157
|
execQuery(ctx: Context, spaceId: SpaceId, body: QueryRequestProto, args?: EdgeHttpCallArgs): Promise<QueryResponseProto>;
|
|
74
158
|
getRegistryPlugins(ctx: Context, args?: EdgeHttpCallArgs): Promise<GetPluginsResponseBody>;
|
|
75
159
|
/**
|
|
@@ -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":"AAOA,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AAIhD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,iCAAiC,EACtC,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAE5B,KAAK,UAAU,EACf,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAA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IAGU,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqCnE;IAMY,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAUtE;CACF"}
|
|
@@ -16,6 +16,7 @@ export declare class EdgeWsConnection extends Resource {
|
|
|
16
16
|
private _lastReceivedMessageTimestamp;
|
|
17
17
|
private _openTimestamp;
|
|
18
18
|
private _pingTimestamp;
|
|
19
|
+
private _lastPingSentTimestamp;
|
|
19
20
|
private _rtt;
|
|
20
21
|
private _uploadRate;
|
|
21
22
|
private _downloadRate;
|
|
@@ -24,6 +25,14 @@ export declare class EdgeWsConnection extends Resource {
|
|
|
24
25
|
private _bytesSamples;
|
|
25
26
|
private _messagesSent;
|
|
26
27
|
private _messagesReceived;
|
|
28
|
+
/**
|
|
29
|
+
* WebSocket frames arrive in order, but converting frame data to bytes is async
|
|
30
|
+
* (the `Blob` fallback path awaits `blob.arrayBuffer()`), and concurrent conversions
|
|
31
|
+
* are not guaranteed to complete in arrival order. Segmented-message reassembly in
|
|
32
|
+
* `WebSocketMuxer` requires chunks to reach `receiveData` in arrival order, so message
|
|
33
|
+
* processing is serialized through this lock.
|
|
34
|
+
*/
|
|
35
|
+
private readonly _receiveMutex;
|
|
27
36
|
constructor(_identity: EdgeIdentity, _connectionInfo: {
|
|
28
37
|
url: URL;
|
|
29
38
|
protocolHeader?: string;
|
|
@@ -42,8 +51,18 @@ export declare class EdgeWsConnection extends Resource {
|
|
|
42
51
|
get messagesReceived(): number;
|
|
43
52
|
send(message: Message): void;
|
|
44
53
|
protected _open(): Promise<void>;
|
|
54
|
+
private _receiveMessage;
|
|
45
55
|
protected _close(): Promise<void>;
|
|
46
56
|
private _scheduleHeartbeats;
|
|
57
|
+
private _sendPing;
|
|
58
|
+
/**
|
|
59
|
+
* Inactivity watchdog. Restarts the connection only after a fair trial: pings were actually
|
|
60
|
+
* flowing (a recent send), the timer fired on schedule (the local event loop was alive to
|
|
61
|
+
* process an answer), and still nothing was received for the full window. Wall-clock silence
|
|
62
|
+
* alone is not evidence — sync compute can pin the event loop for seconds, during which the
|
|
63
|
+
* ping sender does not run and arrived pongs are not processed; restarting a healthy
|
|
64
|
+
* connection on that basis costs a re-handshake and fails in-flight sync rounds.
|
|
65
|
+
*/
|
|
47
66
|
private _rescheduleHeartbeatTimeout;
|
|
48
67
|
private _recordBytes;
|
|
49
68
|
private _scheduleRateCalculation;
|
|
@@ -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,EAAE,KAAK,OAAO,EAAiB,MAAM,4CAA4C,CAAC;AAGzF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
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;AAcpD,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;IAiC1C,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAl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IAAI,CAAC,CAc/C;IAED,OAAO,CAAC,mBAAmB;IAe3B,OAAO,CAAC,SAAS;IASjB;;;;;;;OAOG;IACH,OAAO,CAAC,2BAA2B;IA8CnC,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,eAAe;CA4BxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-ws-connection.test.d.ts","sourceRoot":"","sources":["../../../src/edge-ws-connection.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,4CAA4C,CAAC;AAE3D,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,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,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
|
|
@@ -21,9 +21,10 @@ 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, tags, payload, serviceId }: {
|
|
25
25
|
source?: PeerData;
|
|
26
26
|
target?: PeerData[];
|
|
27
|
+
tags?: string[];
|
|
27
28
|
payload?: buf.MessageInitShape<Desc>;
|
|
28
29
|
serviceId?: string;
|
|
29
30
|
}): Message;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/protocol.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAG1G,MAAM,MAAM,QAAQ,GAAG,GAAG,CAAC,gBAAgB,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/D,eAAO,MAAM,WAAW,aAAc,MAAM,WAAsC,CAAC;AAEnF;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;IAE7C,YAAY,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,EAEnC;IAED,IAAI,YAAY,IAAI,GAAG,CAAC,QAAQ,CAE/B;IAED,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAM5B;IAED;;OAEG;IACH,UAAU,CAAC,IAAI,SAAS,GAAG,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,CAW7F;IAED;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAOnD;IAED;;OAEG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AAE,QAAQ,EAAE,CAAC;QAEpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACrC,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAST;CACF;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,SAAgB,GAAG,KAAG,OAAO,CAAC,UAAU,CAiBhE,CAAC"}
|
|
@@ -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,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;;
|
|
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;AA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