@base44-preview/platform 0.1.0-pr.312.2ef55e3 → 0.1.0-pr.316.21e960b
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.events.types.d.ts +1 -1
- package/dist/{modules → client/modules}/builder.types.d.ts +1 -1
- 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-socket.js +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.js +0 -0
- /package/dist/{modules → client/modules}/builder.js +0 -0
- /package/dist/{modules → client/modules}/builder.types.js +0 -0
package/README.md
CHANGED
|
@@ -116,7 +116,7 @@ redaction of generated prose or user content.
|
|
|
116
116
|
## Event types
|
|
117
117
|
|
|
118
118
|
The socket protocol is defined by the service's AsyncAPI document, committed as
|
|
119
|
-
`asyncapi.json`. `src/modules/builder.events.generated.ts` is generated from it with
|
|
119
|
+
`asyncapi.json`. `src/client/modules/builder.events.generated.ts` is generated from it with
|
|
120
120
|
`json-schema-to-typescript`: one type per schema, named after the backend model
|
|
121
121
|
(`Message`, `StatusObject`, `QueueState`, one `*Call` per tool, one `*Approval` per
|
|
122
122
|
guard), plus `ServerEventMap` and `ClientMessageMap`. Never edit it by hand.
|
|
@@ -14,7 +14,7 @@ export type PlatformEventMap = {
|
|
|
14
14
|
*
|
|
15
15
|
* Check `type` to narrow `data` to that event's payload. A key missing from `data` means the value
|
|
16
16
|
* is unchanged, and an explicit `null` clears it. For every event and its payload, see
|
|
17
|
-
* [Socket messages](/developers/references/
|
|
17
|
+
* [Socket messages](/developers/references/apps-api/sections/socket-messages).
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```typescript
|
|
@@ -134,7 +134,7 @@ export interface SubscriptionOptions {
|
|
|
134
134
|
* Called with each live event, a [`PlatformEvent`](#platformevent). Events for an app arrive one at a time, in order. If the callback
|
|
135
135
|
* throws or rejects, the subscription ends with `handler_failed`. New event types can be added at
|
|
136
136
|
* any time, so ignore types you don't handle. For every event and its payload,
|
|
137
|
-
* see [Socket messages](/developers/references/
|
|
137
|
+
* see [Socket messages](/developers/references/apps-api/sections/socket-messages).
|
|
138
138
|
*/
|
|
139
139
|
onEvent: (event: PlatformEvent) => void | Promise<void>;
|
|
140
140
|
/**
|
|
@@ -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.1.0-pr.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
3
|
+
"version": "0.1.0-pr.316.21e960b",
|
|
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
|