@base44-preview/platform 0.1.0-pr.312.56b7984 → 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.
Files changed (34) hide show
  1. package/README.md +4 -4
  2. package/dist/{modules → client/modules}/builder.events.types.d.ts +2 -2
  3. package/dist/{modules → client/modules}/builder.types.d.ts +1 -1
  4. package/dist/server/index.d.ts +3 -0
  5. package/dist/server/index.js +2 -0
  6. package/dist/server/server-url.d.ts +2 -0
  7. package/dist/server/server-url.js +8 -0
  8. package/dist/server/server.d.ts +3 -0
  9. package/dist/server/server.js +8 -0
  10. package/dist/server/server.types.d.ts +10 -0
  11. package/dist/server/server.types.js +1 -0
  12. package/package.json +19 -9
  13. /package/dist/{client.d.ts → client/client.d.ts} +0 -0
  14. /package/dist/{client.js → client/client.js} +0 -0
  15. /package/dist/{client.types.d.ts → client/client.types.d.ts} +0 -0
  16. /package/dist/{client.types.js → client/client.types.js} +0 -0
  17. /package/dist/{errors.d.ts → client/errors.d.ts} +0 -0
  18. /package/dist/{errors.js → client/errors.js} +0 -0
  19. /package/dist/{errors.types.d.ts → client/errors.types.d.ts} +0 -0
  20. /package/dist/{errors.types.js → client/errors.types.js} +0 -0
  21. /package/dist/{index.d.ts → client/index.d.ts} +0 -0
  22. /package/dist/{index.js → client/index.js} +0 -0
  23. /package/dist/{modules → client/modules}/builder-protocol.d.ts +0 -0
  24. /package/dist/{modules → client/modules}/builder-protocol.js +0 -0
  25. /package/dist/{modules → client/modules}/builder-socket.d.ts +0 -0
  26. /package/dist/{modules → client/modules}/builder-socket.js +0 -0
  27. /package/dist/{modules → client/modules}/builder-subscription.d.ts +0 -0
  28. /package/dist/{modules → client/modules}/builder-subscription.js +0 -0
  29. /package/dist/{modules → client/modules}/builder.d.ts +0 -0
  30. /package/dist/{modules → client/modules}/builder.events.generated.d.ts +0 -0
  31. /package/dist/{modules → client/modules}/builder.events.generated.js +0 -0
  32. /package/dist/{modules → client/modules}/builder.events.types.js +0 -0
  33. /package/dist/{modules → client/modules}/builder.js +0 -0
  34. /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.
@@ -136,11 +136,11 @@ generated file differs from what `asyncapi.json` produces.
136
136
  ## Reference docs
137
137
 
138
138
  Every exported shape and field has JSDoc. `npm run docs` validates it into `docs`.
139
- `npm run create-docs` runs the app SDK's TypeDoc and Mintlify pipeline for this package, then renders
140
- the builder events page from `asyncapi.json` with `scripts/events-to-mdx.mjs`,
139
+ `npm run create-docs` runs the app SDK's TypeDoc and Mintlify pipeline for this package,
141
140
  and `npm run copy-docs-local -- --target <mintlify-docs>` copies the result into
142
141
  `developers/references/platform-sdk/docs`. The pipeline's config for this package lives
143
- in `scripts/mintlify-post-processing/`.
142
+ in `scripts/mintlify-post-processing/`. The Socket messages page is built in mintlify-docs from
143
+ the service's AsyncAPI document, not here.
144
144
 
145
145
  `PlatformSocketError` extends `Error` with `code` and optional `appId`. Original
146
146
  exceptions, payloads and credentials are never attached.
@@ -13,8 +13,8 @@ export type PlatformEventMap = {
13
13
  * One live event for a subscribed app.
14
14
  *
15
15
  * Check `type` to narrow `data` to that event's payload. A key missing from `data` means the value
16
- * is unchanged, and an explicit `null` clears it. For every event and its payload, see the
17
- * [events reference](/developers/references/platform-sdk/docs/events/builder-events).
16
+ * is unchanged, and an explicit `null` clears it. For every event and its payload, see
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 the [events reference](/developers/references/platform-sdk/docs/events/builder-events).
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,3 @@
1
+ /** Server platform modules, authenticated with a workspace API key. */
2
+ export { createPlatformServer } from "./server.js";
3
+ export type { PlatformServer, PlatformServerOptions } from "./server.types.js";
@@ -0,0 +1,2 @@
1
+ /** Server platform modules, authenticated with a workspace API key. */
2
+ export { createPlatformServer } from "./server.js";
@@ -0,0 +1,2 @@
1
+ /** Validate a platform origin and return it normalized. Used by the server entrypoint. */
2
+ export declare function normalizeServerUrl(serverUrl: string): string;
@@ -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.312.56b7984",
4
- "description": "Browser client for building on the Base44 platform",
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
  ],
@@ -29,12 +40,11 @@
29
40
  "test:unit": "vitest run",
30
41
  "test:package": "npm run build && node --test tests/package.test.mjs",
31
42
  "prepublishOnly": "npm run build",
32
- "create-docs": "npm run create-docs:generate && npm run create-docs:process && npm run create-docs:events",
43
+ "create-docs": "npm run create-docs:generate && npm run create-docs:process",
33
44
  "create-docs-local": "npm run create-docs && npm run copy-docs-local",
34
45
  "copy-docs-local": "node ../sdk/scripts/mintlify-post-processing/copy-to-local-docs.js --package-dir .",
35
46
  "create-docs:generate": "node -e \"fs.rmSync('docs',{recursive:true,force:true})\" && typedoc --options typedoc.mintlify.json",
36
- "create-docs:process": "node ../sdk/scripts/mintlify-post-processing/file-processing/file-processing.js --package-dir .",
37
- "create-docs:events": "tsc && node scripts/events-to-mdx.mjs"
47
+ "create-docs:process": "node ../sdk/scripts/mintlify-post-processing/file-processing/file-processing.js --package-dir ."
38
48
  },
39
49
  "dependencies": {
40
50
  "socket.io-client": "^4.8.3"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes