@base44-preview/platform 0.2.0-pr.329.cce6621 → 0.2.0-pr.334.161944e
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/README.md +1 -1
- package/dist/{modules → client/modules}/builder-socket.js +5 -2
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +2 -0
- package/dist/server/server-url.d.ts +2 -0
- package/dist/server/server-url.js +8 -0
- package/dist/server/server.d.ts +3 -0
- package/dist/server/server.js +8 -0
- package/dist/server/server.types.d.ts +10 -0
- package/dist/server/server.types.js +1 -0
- package/package.json +17 -6
- /package/dist/{client.d.ts → client/client.d.ts} +0 -0
- /package/dist/{client.js → client/client.js} +0 -0
- /package/dist/{client.types.d.ts → client/client.types.d.ts} +0 -0
- /package/dist/{client.types.js → client/client.types.js} +0 -0
- /package/dist/{errors.d.ts → client/errors.d.ts} +0 -0
- /package/dist/{errors.js → client/errors.js} +0 -0
- /package/dist/{errors.types.d.ts → client/errors.types.d.ts} +0 -0
- /package/dist/{errors.types.js → client/errors.types.js} +0 -0
- /package/dist/{index.d.ts → client/index.d.ts} +0 -0
- /package/dist/{index.js → client/index.js} +0 -0
- /package/dist/{modules → client/modules}/builder-protocol.d.ts +0 -0
- /package/dist/{modules → client/modules}/builder-protocol.js +0 -0
- /package/dist/{modules → client/modules}/builder-socket.d.ts +0 -0
- /package/dist/{modules → client/modules}/builder-subscription.d.ts +0 -0
- /package/dist/{modules → client/modules}/builder-subscription.js +0 -0
- /package/dist/{modules → client/modules}/builder.d.ts +0 -0
- /package/dist/{modules → client/modules}/builder.events.generated.d.ts +0 -0
- /package/dist/{modules → client/modules}/builder.events.generated.js +0 -0
- /package/dist/{modules → client/modules}/builder.events.types.d.ts +0 -0
- /package/dist/{modules → client/modules}/builder.events.types.js +0 -0
- /package/dist/{modules → client/modules}/builder.js +0 -0
- /package/dist/{modules → client/modules}/builder.types.d.ts +0 -0
- /package/dist/{modules → client/modules}/builder.types.js +0 -0
package/README.md
CHANGED
|
@@ -124,7 +124,7 @@ redaction of generated prose or user content.
|
|
|
124
124
|
## Event types
|
|
125
125
|
|
|
126
126
|
The socket protocol is defined by the service's AsyncAPI document, committed as
|
|
127
|
-
`asyncapi.json`. `src/modules/builder.events.generated.ts` is generated from it with
|
|
127
|
+
`asyncapi.json`. `src/client/modules/builder.events.generated.ts` is generated from it with
|
|
128
128
|
`json-schema-to-typescript`: one type per schema, named after the backend model
|
|
129
129
|
(`Message`, `StatusObject`, `QueueState`, one `*Call` per tool, one `*Approval` per
|
|
130
130
|
guard), plus `ServerEventMap` and `ClientMessageMap`. Never edit it by hand.
|
|
@@ -123,8 +123,11 @@ export class BuilderSocket {
|
|
|
123
123
|
socket.on(name, (raw) => this.roomNotice(code, raw));
|
|
124
124
|
for (const name of eventNames)
|
|
125
125
|
socket.on(name, (raw) => this.appEvent(name, raw));
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
// An unknown event with no app room (a future session-wide event) has nowhere to go: ignore it.
|
|
127
|
+
socket.onAny((name, raw) => {
|
|
128
|
+
if (isUnknownEvent(name) && appFromRoom(raw === null || raw === void 0 ? void 0 : raw.room))
|
|
129
|
+
this.appEvent(name, raw);
|
|
130
|
+
});
|
|
128
131
|
socket.connect();
|
|
129
132
|
}
|
|
130
133
|
appEvent(name, raw) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Validate a platform origin and return it normalized. Used by the server entrypoint. */
|
|
2
|
+
export function normalizeServerUrl(serverUrl) {
|
|
3
|
+
const url = new URL(serverUrl);
|
|
4
|
+
if (!["https:", "http:"].includes(url.protocol) || url.username || url.password || url.search || url.hash || url.pathname !== "/") {
|
|
5
|
+
throw new TypeError("serverUrl must be an HTTP(S) origin without credentials, path, query or fragment");
|
|
6
|
+
}
|
|
7
|
+
return url.origin;
|
|
8
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { PlatformServer, PlatformServerOptions } from "./server.types.js";
|
|
2
|
+
/** Create a server platform client, authenticated with a workspace API key. Performs no network requests. */
|
|
3
|
+
export declare function createPlatformServer(options: PlatformServerOptions): PlatformServer;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { normalizeServerUrl } from "./server-url.js";
|
|
2
|
+
/** Create a server platform client, authenticated with a workspace API key. Performs no network requests. */
|
|
3
|
+
export function createPlatformServer(options) {
|
|
4
|
+
if (!options.apiKey)
|
|
5
|
+
throw new TypeError("apiKey is required");
|
|
6
|
+
normalizeServerUrl(options.serverUrl);
|
|
7
|
+
return Object.freeze({});
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Shared configuration for server platform modules. */
|
|
2
|
+
export interface PlatformServerOptions {
|
|
3
|
+
/** Origin of the platform service, e.g. https://base44.app. No path/query/credentials. */
|
|
4
|
+
serverUrl: string;
|
|
5
|
+
/** Workspace API key. Keep it on your server; never ship it to a browser. */
|
|
6
|
+
apiKey: string;
|
|
7
|
+
}
|
|
8
|
+
/** Server platform client, returned by `createPlatformServer`. Modules are added as properties. */
|
|
9
|
+
export interface PlatformServer {
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base44-preview/platform",
|
|
3
|
-
"version": "0.2.0-pr.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
3
|
+
"version": "0.2.0-pr.334.161944e",
|
|
4
|
+
"description": "Client and server SDK for building on the Base44 platform",
|
|
5
|
+
"main": "dist/client/index.js",
|
|
6
|
+
"types": "dist/client/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"default": "./dist/index.js"
|
|
10
|
+
"types": "./dist/client/index.d.ts",
|
|
11
|
+
"default": "./dist/client/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./server": {
|
|
14
|
+
"types": "./dist/server/index.d.ts",
|
|
15
|
+
"default": "./dist/server/index.js"
|
|
12
16
|
},
|
|
13
17
|
"./package.json": "./package.json"
|
|
14
18
|
},
|
|
19
|
+
"typesVersions": {
|
|
20
|
+
"*": {
|
|
21
|
+
"server": [
|
|
22
|
+
"dist/server/index.d.ts"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
15
26
|
"files": [
|
|
16
27
|
"dist"
|
|
17
28
|
],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|