@dxos/edge-client 0.9.0 → 0.9.1-staging.ee54ba693a
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/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/cors-proxy.mjs +1 -0
- package/dist/lib/neutral/edge-ws-muxer.mjs +1 -0
- package/dist/lib/neutral/index.mjs +111 -35
- package/dist/lib/neutral/index.mjs.map +3 -3
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/service/index.mjs +134 -0
- package/dist/lib/neutral/service/index.mjs.map +7 -0
- package/dist/lib/neutral/testing/index.mjs +2 -1
- package/dist/lib/neutral/testing/index.mjs.map +3 -3
- package/dist/types/src/auth.d.ts.map +1 -1
- package/dist/types/src/browser-rendering.d.ts +28 -0
- package/dist/types/src/browser-rendering.d.ts.map +1 -0
- package/dist/types/src/edge-ai-http-client.d.ts +39 -0
- package/dist/types/src/edge-ai-http-client.d.ts.map +1 -1
- package/dist/types/src/edge-ai-http-client.test.d.ts +2 -0
- package/dist/types/src/edge-ai-http-client.test.d.ts.map +1 -0
- package/dist/types/src/edge-client.d.ts +3 -2
- package/dist/types/src/edge-client.d.ts.map +1 -1
- package/dist/types/src/edge-http-client.d.ts +19 -4
- package/dist/types/src/edge-http-client.d.ts.map +1 -1
- package/dist/types/src/edge-identity.d.ts +5 -1
- package/dist/types/src/edge-identity.d.ts.map +1 -1
- package/dist/types/src/hub-http-client.d.ts +8 -1
- package/dist/types/src/hub-http-client.d.ts.map +1 -1
- package/dist/types/src/service/Image.d.ts +25 -0
- package/dist/types/src/service/Image.d.ts.map +1 -0
- package/dist/types/src/service/edge-service.d.ts +36 -0
- package/dist/types/src/service/edge-service.d.ts.map +1 -0
- package/dist/types/src/service/edge-service.test.d.ts +2 -0
- package/dist/types/src/service/edge-service.test.d.ts.map +1 -0
- package/dist/types/src/service/image-service.e2e.test.d.ts +2 -0
- package/dist/types/src/service/image-service.e2e.test.d.ts.map +1 -0
- package/dist/types/src/service/index.d.ts +3 -0
- package/dist/types/src/service/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -17
- package/src/auth.ts +6 -6
- package/src/base-http-client.ts +1 -1
- package/src/browser-rendering.ts +39 -0
- package/src/edge-ai-http-client.test.ts +37 -0
- package/src/edge-ai-http-client.ts +87 -2
- package/src/edge-client.test.ts +1 -1
- package/src/edge-client.ts +9 -7
- package/src/edge-http-client.ts +25 -10
- package/src/edge-identity.ts +5 -1
- package/src/edge-ws-connection.ts +1 -1
- package/src/edge-ws-muxer.test.ts +1 -1
- package/src/hub-http-client.ts +20 -0
- package/src/service/Image.ts +61 -0
- package/src/service/edge-service.test.ts +151 -0
- package/src/service/edge-service.ts +139 -0
- package/src/service/image-service.e2e.test.ts +53 -0
- package/src/service/index.ts +7 -0
- package/src/testing/test-utils.ts +1 -1
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type Presentation } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
2
2
|
export interface EdgeIdentity {
|
|
3
3
|
peerKey: string;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Identity DID (`did:halo:…`) — the public identity segment of the edge WebSocket path.
|
|
6
|
+
* The router keys connections by the DID.
|
|
7
|
+
*/
|
|
8
|
+
identityDid: string;
|
|
5
9
|
/**
|
|
6
10
|
* Returns credential presentation issued by the identity key.
|
|
7
11
|
* Presentation must have the provided challenge.
|
|
@@ -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,mBAA0B,QAAQ,YAAY,YAAY,KAAG,OAAO,CAAC,UAAU,CAW9G,CAAC"}
|
|
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;;;OAGG;IACH,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Context } from '@dxos/context';
|
|
2
|
-
import { type CheckEmailExistsResponse, type GetAccountResponse, type IssueInvitationResponse, type ListAccountInvitationsResponse, type LoginRequest, type LoginResponse, type RedeemInvitationCodeRequest, type RedeemInvitationCodeResponse, type RequestAccessRequest, type RequestAccessResponse, type ResendVerificationEmailResponse, type ValidateInvitationCodeResponse } from '@dxos/protocols';
|
|
2
|
+
import { type CheckEmailExistsResponse, type GetAccountResponse, type GetProfileUsageResponse, type IssueInvitationResponse, type ListAccountInvitationsResponse, type LoginRequest, type LoginResponse, type RedeemInvitationCodeRequest, type RedeemInvitationCodeResponse, type RequestAccessRequest, type RequestAccessResponse, type ResendVerificationEmailResponse, type ValidateInvitationCodeResponse } from '@dxos/protocols';
|
|
3
3
|
import { BaseHttpClient, type BaseHttpClientOptions, type EdgeHttpCallArgs } from './base-http-client';
|
|
4
4
|
/**
|
|
5
5
|
* HTTP client for the hub-service API (accounts, invitations, email verification).
|
|
@@ -35,5 +35,12 @@ export declare class HubHttpClient extends BaseHttpClient {
|
|
|
35
35
|
listAccountInvitations(ctx: Context, args?: EdgeHttpCallArgs): Promise<ListAccountInvitationsResponse>;
|
|
36
36
|
issueAccountInvitation(ctx: Context, args?: EdgeHttpCallArgs): Promise<IssueInvitationResponse>;
|
|
37
37
|
resendVerificationEmail(ctx: Context, args?: EdgeHttpCallArgs): Promise<ResendVerificationEmailResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Rolling-window usage and effective limits for the authenticated identity.
|
|
40
|
+
* Served from the per-user metering DO; optional `windowSeconds` defaults to the largest limit window.
|
|
41
|
+
*/
|
|
42
|
+
getProfileUsage(ctx: Context, query?: {
|
|
43
|
+
windowSeconds?: number;
|
|
44
|
+
}, args?: EdgeHttpCallArgs): Promise<GetProfileUsageResponse>;
|
|
38
45
|
}
|
|
39
46
|
//# sourceMappingURL=hub-http-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hub-http-client.d.ts","sourceRoot":"","sources":["../../../src/hub-http-client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACpC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"hub-http-client.d.ts","sourceRoot":"","sources":["../../../src/hub-http-client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,M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C,EAAE,gBAAgB,GACtB,OAAO,CAAC,qBAAqB,CAAC,CAEhC;IAMY,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAE1F;IAEY,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAE/F;IAEY,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAElH;IAEY,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAE3G;IAEY,uBAAuB,CAClC,GAAG,EAAE,OAAO,EACZ,IAAI,CAAC,EAAE,gBAAgB,GACtB,OAAO,CAAC,+BAA+B,CAAC,CAE1C;IAED;;;OAGG;IACU,eAAe,CAC1B,GAAG,EAAE,OAAO,EACZ,KAAK,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,EAClC,IAAI,CAAC,EAAE,gBAAgB,GACtB,OAAO,CAAC,uBAAuB,CAAC,CAQlC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import * as Schema from 'effect/Schema';
|
|
3
|
+
import { type EdgeServiceClient, type EdgeServiceError } from './edge-service';
|
|
4
|
+
/**
|
|
5
|
+
* Default Composer image-service base URL — the Cloudflare Worker used in
|
|
6
|
+
* production. Override per-environment via the client's `baseUrl`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_IMAGE_SERVICE_URL = "https://image-service-main.dxos.workers.dev";
|
|
9
|
+
/** Hosted image returned by the service: a CDN `url` and its storage `id`. */
|
|
10
|
+
export declare const Result: Schema.Struct<{
|
|
11
|
+
id: Schema.optional<typeof Schema.String>;
|
|
12
|
+
url: typeof Schema.String;
|
|
13
|
+
}>;
|
|
14
|
+
export type Result = typeof Result.Type;
|
|
15
|
+
export type UploadOptions = {
|
|
16
|
+
/** Multipart field name. */
|
|
17
|
+
field?: string;
|
|
18
|
+
/** Upload filename. */
|
|
19
|
+
filename?: string;
|
|
20
|
+
};
|
|
21
|
+
/** Store an image and return its hosted CDN URL (POST `/upload`). */
|
|
22
|
+
export declare const upload: (client: EdgeServiceClient, blob: Blob, opts?: UploadOptions) => Effect.Effect<Result, EdgeServiceError>;
|
|
23
|
+
/** Store an image and create a thumbnail, returning its hosted CDN URL (POST `/thumbnail`). */
|
|
24
|
+
export declare const thumbnail: (client: EdgeServiceClient, blob: Blob, opts?: UploadOptions) => Effect.Effect<Result, EdgeServiceError>;
|
|
25
|
+
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../src/service/Image.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE/E;;;GAGG;AAEH,eAAO,MAAM,yBAAyB,gDAAgD,CAAC;AAEvF,8EAA8E;AAC9E,eAAO,MAAM,MAAM;;;EAGjB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC;AAExC,MAAM,MAAM,aAAa,GAAG;IAC1B,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,MAAM,WACT,iBAAiB,QACnB,IAAI,SACH,aAAa,KACnB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAgD,CAAC;AAE1F,+FAA+F;AAC/F,eAAO,MAAM,SAAS,WACZ,iBAAiB,QACnB,IAAI,SACH,aAAa,KACnB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAmD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as Duration from 'effect/Duration';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
3
|
+
import * as Schema from 'effect/Schema';
|
|
4
|
+
export type EdgeServiceClientOptions = {
|
|
5
|
+
/** Base URL the service is hosted at; request paths resolve against it. */
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
/** Tag included in the {@link EDGE_CLIENT_TAG_HEADER} header for metering. */
|
|
8
|
+
clientTag?: string;
|
|
9
|
+
/** Per-request timeout. */
|
|
10
|
+
timeout?: Duration.DurationInput;
|
|
11
|
+
/** Injectable for deterministic tests; defaults to `globalThis.fetch`. */
|
|
12
|
+
fetch?: typeof globalThis.fetch;
|
|
13
|
+
/** Auth seam invoked per request; unused by the image service today. */
|
|
14
|
+
authHeaders?: () => Effect.Effect<Record<string, string>>;
|
|
15
|
+
};
|
|
16
|
+
declare const EdgeServiceError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
17
|
+
readonly _tag: "EdgeServiceError";
|
|
18
|
+
} & Readonly<A>;
|
|
19
|
+
/** Single failure type for every transport, status, and decode error. */
|
|
20
|
+
export declare class EdgeServiceError extends EdgeServiceError_base<{
|
|
21
|
+
message: string;
|
|
22
|
+
status?: number;
|
|
23
|
+
cause?: unknown;
|
|
24
|
+
}> {
|
|
25
|
+
}
|
|
26
|
+
export declare class EdgeServiceClient {
|
|
27
|
+
#private;
|
|
28
|
+
constructor(options: EdgeServiceClientOptions);
|
|
29
|
+
get baseUrl(): string;
|
|
30
|
+
/** POST a `FormData` (multipart) body and decode the JSON response. */
|
|
31
|
+
postForm<A>(path: string, form: FormData, schema: Schema.Schema<A>): Effect.Effect<A, EdgeServiceError>;
|
|
32
|
+
/** POST a JSON body and decode the JSON response. */
|
|
33
|
+
postJson<A>(path: string, body: unknown, schema: Schema.Schema<A>): Effect.Effect<A, EdgeServiceError>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=edge-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-service.d.ts","sourceRoot":"","sources":["../../../../src/service/edge-service.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAWxC,MAAM,MAAM,wBAAwB,GAAG;IACrC,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC;IACjC,0EAA0E;IAC1E,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3D,CAAC;;;;AAEF,yEAAyE;AACzE,qBAAa,gBAAiB,SAAQ,sBAAqC;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;CAAG;AAEL,qBAAa,iBAAiB;;IAO5B,YAAY,OAAO,EAAE,wBAAwB,EAQ5C;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,uEAAuE;IACvE,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAItG;IAED,qDAAqD;IACrD,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAerG;CAmDF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-service.test.d.ts","sourceRoot":"","sources":["../../../../src/service/edge-service.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-service.e2e.test.d.ts","sourceRoot":"","sources":["../../../../src/service/image-service.e2e.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/service/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAE/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC"}
|