@base44-preview/sdk 0.8.46-pr.272.8052da4 → 0.8.46-pr.272.f64ff62
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/actor.d.ts +4 -4
- package/dist/actor.js +3 -3
- package/dist/modules/actors.d.ts +1 -1
- package/dist/modules/actors.js +3 -3
- package/dist/modules/actors.types.d.ts +3 -3
- package/dist/modules/analytics.js +1 -1
- package/dist/modules/app.types.d.ts +3 -3
- package/dist/modules/connectors.types.d.ts +3 -3
- package/package.json +1 -1
package/dist/actor.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import type { Base44Client } from "./client";
|
|
12
12
|
/**
|
|
13
13
|
* A single client connection. `Send` is the message type this connection accepts
|
|
14
|
-
* via {@link send}
|
|
14
|
+
* via {@link send}, the actor's *outgoing* (server→client) messages.
|
|
15
15
|
*/
|
|
16
16
|
export interface Conn<Send = unknown> {
|
|
17
17
|
/** Unique per-connection id (one per socket/tab), the same value the client
|
|
@@ -33,9 +33,9 @@ export interface Storage {
|
|
|
33
33
|
* Base class for an Actor.
|
|
34
34
|
*
|
|
35
35
|
* @typeParam Incoming - messages this actor *receives* from clients
|
|
36
|
-
* (`handleMessage`'s `msg`)
|
|
36
|
+
* (`handleMessage`'s `msg`), the schema's `toServer` section.
|
|
37
37
|
* @typeParam Outgoing - messages this actor *sends* to clients
|
|
38
|
-
* (`conn.send`/`broadcast`)
|
|
38
|
+
* (`conn.send`/`broadcast`), the schema's `toClient` section.
|
|
39
39
|
*
|
|
40
40
|
* With a generated `schema.jsonc`, wire both from the registry so they can't drift
|
|
41
41
|
* from the client's types:
|
|
@@ -51,7 +51,7 @@ export declare abstract class Actor<Incoming = unknown, Outgoing = unknown> {
|
|
|
51
51
|
abstract handleTick(): void | Promise<void>;
|
|
52
52
|
/**
|
|
53
53
|
* Optional wake hook: runs once when the instance starts, before any
|
|
54
|
-
* connection is handled.
|
|
54
|
+
* connection is handled. It is safe to load persisted state here.
|
|
55
55
|
*/
|
|
56
56
|
handleStart(): void | Promise<void>;
|
|
57
57
|
/**
|
package/dist/actor.js
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* Base class for an Actor.
|
|
13
13
|
*
|
|
14
14
|
* @typeParam Incoming - messages this actor *receives* from clients
|
|
15
|
-
* (`handleMessage`'s `msg`)
|
|
15
|
+
* (`handleMessage`'s `msg`), the schema's `toServer` section.
|
|
16
16
|
* @typeParam Outgoing - messages this actor *sends* to clients
|
|
17
|
-
* (`conn.send`/`broadcast`)
|
|
17
|
+
* (`conn.send`/`broadcast`), the schema's `toClient` section.
|
|
18
18
|
*
|
|
19
19
|
* With a generated `schema.jsonc`, wire both from the registry so they can't drift
|
|
20
20
|
* from the client's types:
|
|
@@ -39,7 +39,7 @@ export class Actor {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Optional wake hook: runs once when the instance starts, before any
|
|
42
|
-
* connection is handled.
|
|
42
|
+
* connection is handled. It is safe to load persisted state here.
|
|
43
43
|
*/
|
|
44
44
|
handleStart() { }
|
|
45
45
|
/**
|
package/dist/modules/actors.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ interface ActorsConfig {
|
|
|
35
35
|
* The legacy platform-proxy URL, byte-for-byte what PartySocket built before
|
|
36
36
|
* the direct path existed: same scheme swap (including its localhost-needs-a-
|
|
37
37
|
* port quirk), case-preserved party segment, `_pk` first in the query. The
|
|
38
|
-
* `handler` param is load-bearing
|
|
38
|
+
* `handler` param is load-bearing. The proxy reads it for the actor name.
|
|
39
39
|
*/
|
|
40
40
|
export declare function buildProxyActorUrl(rawHost: string, actorName: string, instanceId: string, connectionId: string, appId: string, token: string | null | undefined, functionsVersion?: string): string;
|
|
41
41
|
/**
|
package/dist/modules/actors.js
CHANGED
|
@@ -13,7 +13,7 @@ const DEAD_MS = 3000;
|
|
|
13
13
|
const PROXY_FALLBACK_STATUSES = new Set([405, 409, 422, 503]);
|
|
14
14
|
// Mint responses no retry can fix (bad request / forbidden / not found): the
|
|
15
15
|
// connection closes instead of re-minting forever; a fresh connect() re-probes.
|
|
16
|
-
// 401 is deliberately absent
|
|
16
|
+
// 401 is deliberately absent. The auth token is re-read on every attempt, so a
|
|
17
17
|
// login recovers on the next retry. Disjoint from PROXY_FALLBACK_STATUSES.
|
|
18
18
|
const TERMINAL_MINT_STATUSES = new Set([400, 403, 404]);
|
|
19
19
|
/** The mint's rejection can be anything; a `Base44Error` carries a numeric
|
|
@@ -29,7 +29,7 @@ function toError(err) {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* A live connection to an actor instance. Only obtainable from
|
|
32
|
-
* {@link ActorRef.connect}, so `subscribe`/`send` are always valid
|
|
32
|
+
* {@link ActorRef.connect}, so `subscribe`/`send` are always valid. The socket
|
|
33
33
|
* exists for this object's whole lifetime.
|
|
34
34
|
*/
|
|
35
35
|
class Connection {
|
|
@@ -172,7 +172,7 @@ function makeActorRef(actorName, instanceId, config, connections) {
|
|
|
172
172
|
* The legacy platform-proxy URL, byte-for-byte what PartySocket built before
|
|
173
173
|
* the direct path existed: same scheme swap (including its localhost-needs-a-
|
|
174
174
|
* port quirk), case-preserved party segment, `_pk` first in the query. The
|
|
175
|
-
* `handler` param is load-bearing
|
|
175
|
+
* `handler` param is load-bearing. The proxy reads it for the actor name.
|
|
176
176
|
*/
|
|
177
177
|
export function buildProxyActorUrl(rawHost, actorName, instanceId, connectionId, appId, token, functionsVersion) {
|
|
178
178
|
let host = rawHost.replace(/^(http|https|ws|wss):\/\//, "");
|
|
@@ -35,7 +35,7 @@ type ToServerFor<N extends string> = N extends keyof ActorRegistry ? ActorRegist
|
|
|
35
35
|
/** Options for {@link ActorRef.connect}. */
|
|
36
36
|
export interface ActorConnectOptions {
|
|
37
37
|
/**
|
|
38
|
-
* The connection id,
|
|
38
|
+
* The connection id, used as the actor's `conn.id`. Supply a stable value
|
|
39
39
|
* (e.g. persisted per tab) so a reconnect reuses the same server-side
|
|
40
40
|
* identity; omit for an auto-generated per-connection id.
|
|
41
41
|
*/
|
|
@@ -48,7 +48,7 @@ export interface ActorSubscription {
|
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* A live connection to an actor instance, returned by {@link ActorRef.connect}.
|
|
51
|
-
* `subscribe`/`send` are always valid
|
|
51
|
+
* `subscribe`/`send` are always valid. You only get a `Connection` once the
|
|
52
52
|
* socket has been opened, so there's no pre-connect state to guard against.
|
|
53
53
|
*/
|
|
54
54
|
export interface Connection<N extends string = string> {
|
|
@@ -62,7 +62,7 @@ export interface Connection<N extends string = string> {
|
|
|
62
62
|
/**
|
|
63
63
|
* Tear down the socket, heartbeat, and all listeners. Safe to call more
|
|
64
64
|
* than once. A connection also closes itself when it fails permanently.
|
|
65
|
-
*
|
|
65
|
+
* See {@link ActorRef.connect}.
|
|
66
66
|
*/
|
|
67
67
|
close(): void;
|
|
68
68
|
}
|
|
@@ -255,7 +255,7 @@ async function getSessionContext(userAuthModule) {
|
|
|
255
255
|
// With no token there is no identity to resolve: `me()` can only answer 401,
|
|
256
256
|
// which the browser logs to the console before any handler here sees it. On
|
|
257
257
|
// a public page that request is the sole reason an error appears, so skip
|
|
258
|
-
// it. This is not memoized
|
|
258
|
+
// it. This is not memoized. A visitor who logs in later must still resolve.
|
|
259
259
|
if (!userAuthModule.hasToken()) {
|
|
260
260
|
return { user_id: null, session_id: getAnalyticsSessionId() };
|
|
261
261
|
}
|
|
@@ -29,9 +29,9 @@ export interface AppModule {
|
|
|
29
29
|
* Get the app's public configuration.
|
|
30
30
|
*
|
|
31
31
|
* Rejects with a {@linkcode Base44Error} when the visitor may not open the app:
|
|
32
|
-
* `status` is `403` and `data.extra_data.reason` says why
|
|
33
|
-
* when the visitor must sign in,
|
|
34
|
-
* visitor has no access to this app.
|
|
32
|
+
* `status` is `403` and `data.extra_data.reason` says why. It is
|
|
33
|
+
* `"auth_required"` when the visitor must sign in, and
|
|
34
|
+
* `"user_not_registered"` when the signed-in visitor has no access to this app.
|
|
35
35
|
*
|
|
36
36
|
* @returns Promise resolving to the app's ID and access policy.
|
|
37
37
|
*
|
|
@@ -87,7 +87,7 @@ export interface ConnectorApiResponse<T = unknown> {
|
|
|
87
87
|
status: number | null;
|
|
88
88
|
/**
|
|
89
89
|
* The parsed upstream response body, or proxy error details when no response
|
|
90
|
-
* was received. `null` when the response was binary. See {@link dataBase64}.
|
|
90
|
+
* was received. It is `null` when the response was binary. See {@link dataBase64}.
|
|
91
91
|
*/
|
|
92
92
|
data: T | null;
|
|
93
93
|
/**
|
|
@@ -148,9 +148,9 @@ export interface ConnectorProxyRawResponse {
|
|
|
148
148
|
*
|
|
149
149
|
* ## Metered connectors
|
|
150
150
|
*
|
|
151
|
-
* A few [platform connectors](#shared-connectors) are backed by paid third-party APIs that charge Base44 per call. For those, the OAuth token is **not** available to your code, and {@linkcode getConnection | getConnection()} rejects with a `403`. Call them with {@linkcode callApi | callApi()} instead
|
|
151
|
+
* A few [platform connectors](#shared-connectors) are backed by paid third-party APIs that charge Base44 per call. For those, the OAuth token is **not** available to your code, and {@linkcode getConnection | getConnection()} rejects with a `403`. Call them with {@linkcode callApi | callApi()} instead. Base44 attaches the credential server-side, forwards the request, and bills your workspace's integration credits for the call.
|
|
152
152
|
*
|
|
153
|
-
* This applies to platform connectors only. A workspace-registered or app user connector runs on **your own** OAuth app, so the provider invoices you directly and there is nothing for Base44 to meter
|
|
153
|
+
* This applies to platform connectors only. A workspace-registered or app user connector runs on **your own** OAuth app, so the provider invoices you directly and there is nothing for Base44 to meter. Those keep normal token access via {@linkcode getWorkspaceConnection | getWorkspaceConnection()} and {@linkcode getCurrentAppUserConnection | getCurrentAppUserConnection()}.
|
|
154
154
|
*
|
|
155
155
|
* Two things to keep in mind when writing against a metered connector:
|
|
156
156
|
*
|