@base44-preview/platform 0.1.0-pr.316.56344d6 → 0.1.0-pr.316.f75d775

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 CHANGED
@@ -10,9 +10,9 @@ shared socket. It is independent of the app SDK (`@base44/sdk`).
10
10
  The workspace must have white-label sockets enabled; this SDK does not open sessions.
11
11
 
12
12
  ```ts
13
- import { Base44PlatformClient } from "@base44/platform";
13
+ import { createBase44PlatformClient } from "@base44/platform";
14
14
 
15
- const client = new Base44PlatformClient({
15
+ const client = createBase44PlatformClient({
16
16
  serverUrl: "https://base44.app",
17
17
  async getSessionToken() {
18
18
  const response = await fetch("/api/builder-socket-session", { method: "POST" });
@@ -55,7 +55,7 @@ older one, which stops with `session_replaced`. Open one session per page.
55
55
 
56
56
  ## Lifecycle
57
57
 
58
- `new Base44PlatformClient({ serverUrl, getSessionToken })` creates a lightweight module
58
+ `createBase44PlatformClient({ serverUrl, getSessionToken })` returns a lightweight module
59
59
  container: no Socket.IO instance, timers, token request or network activity. Its
60
60
  `builder` module follows the server SDK's module-factory pattern.
61
61
 
@@ -1,9 +1,3 @@
1
- import type { PlatformClientOptions } from "./client.types.js";
2
- import type { BuilderModule } from "./modules/builder.types.js";
3
- /** Browser platform client. Construction creates no sockets, timers or network requests. */
4
- export declare class Base44PlatformClient {
5
- /** Lazy builder subscriptions with independent session lifecycles. */
6
- readonly builder: BuilderModule;
7
- /** Configure shared service/auth settings; each module initializes its own resources. */
8
- constructor(options: PlatformClientOptions);
9
- }
1
+ import type { Base44PlatformClient, PlatformClientOptions } from "./client.types.js";
2
+ /** Create a browser platform client. Creates no sockets, timers or network requests; each module initializes its own resources. */
3
+ export declare function createBase44PlatformClient(options: PlatformClientOptions): Base44PlatformClient;
@@ -1,9 +1,8 @@
1
1
  import { normalizeServerUrl } from "../shared/server-url.js";
2
2
  import { createBuilder } from "./modules/builder.js";
3
- /** Browser platform client. Construction creates no sockets, timers or network requests. */
4
- export class Base44PlatformClient {
5
- /** Configure shared service/auth settings; each module initializes its own resources. */
6
- constructor(options) {
7
- this.builder = Object.freeze(createBuilder({ ...options, serverUrl: normalizeServerUrl(options.serverUrl) }));
8
- }
3
+ /** Create a browser platform client. Creates no sockets, timers or network requests; each module initializes its own resources. */
4
+ export function createBase44PlatformClient(options) {
5
+ return Object.freeze({
6
+ builder: Object.freeze(createBuilder({ ...options, serverUrl: normalizeServerUrl(options.serverUrl) })),
7
+ });
9
8
  }
@@ -1,3 +1,4 @@
1
+ import type { BuilderModule } from "./modules/builder.types.js";
1
2
  /** Shared configuration for browser platform modules. Never supply an API key. */
2
3
  export interface PlatformClientOptions {
3
4
  /** Origin of the platform service, e.g. https://base44.app. No path/query/credentials. */
@@ -10,3 +11,8 @@ export interface PlatformClientOptions {
10
11
  */
11
12
  getSessionToken: () => string | Promise<string>;
12
13
  }
14
+ /** Browser platform client, returned by `createBase44PlatformClient`. */
15
+ export interface Base44PlatformClient {
16
+ /** Lazy builder subscriptions with independent session lifecycles. */
17
+ readonly builder: BuilderModule;
18
+ }
@@ -1,7 +1,7 @@
1
1
  /** Browser platform modules, separate from the runtime and server SDKs. */
2
- export { Base44PlatformClient } from "./client.js";
2
+ export { createBase44PlatformClient } from "./client.js";
3
3
  export { PlatformSocketError } from "./errors.js";
4
4
  export type { PlatformSocketErrorCode } from "./errors.types.js";
5
- export type { PlatformClientOptions } from "./client.types.js";
5
+ export type { Base44PlatformClient, PlatformClientOptions } from "./client.types.js";
6
6
  export type { BuilderModule, BuilderInitOptions, BuilderSession, PlatformSubscription, SubscriptionOptions } from "./modules/builder.types.js";
7
7
  export type { AppStatus, AppStatusChanged, BranchScoped, ChatMessage, ImageResolved, MessageParams, MessageRemoved, MessageUpdated, PlatformEvent, PlatformEventMap, PreviewNavigationRequested, QueueItem, QueueUpdated, Snapshot, SnapshotQueue, TaskProgressed, ToolArguments, ToolCall, ToolDisplay, ToolEntityMutationArguments, ToolGuardApproval, ToolMediaArguments, ToolMediaResult, ToolPackageArguments, ToolPackageOperation, ToolPlanArguments, ToolPlanUpdate, ToolPrdArguments, ToolQuestion, ToolQuestionAnswer, ToolQuestionArguments, ToolQuestionInput, ToolQuestionOption, ToolSecretArguments, ToolSecretField, } from "./modules/builder.events.types.js";
@@ -1,3 +1,3 @@
1
1
  /** Browser platform modules, separate from the runtime and server SDKs. */
2
- export { Base44PlatformClient } from "./client.js";
2
+ export { createBase44PlatformClient } from "./client.js";
3
3
  export { PlatformSocketError } from "./errors.js";
@@ -1,3 +1,3 @@
1
1
  /** Server platform modules, authenticated with a workspace API key. */
2
- export { Base44PlatformServer } from "./server.js";
3
- export type { PlatformServerOptions } from "./server.types.js";
2
+ export { createBase44PlatformServer } from "./server.js";
3
+ export type { Base44PlatformServer, PlatformServerOptions } from "./server.types.js";
@@ -1,2 +1,2 @@
1
1
  /** Server platform modules, authenticated with a workspace API key. */
2
- export { Base44PlatformServer } from "./server.js";
2
+ export { createBase44PlatformServer } from "./server.js";
@@ -1,7 +1,3 @@
1
- import type { PlatformServerOptions } from "./server.types.js";
2
- /** Server platform client, authenticated with a workspace API key. Construction performs no network requests. */
3
- export declare class Base44PlatformServer {
4
- #private;
5
- /** Configure shared service/auth settings; modules are added on top of this. */
6
- constructor(options: PlatformServerOptions);
7
- }
1
+ import type { Base44PlatformServer, 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 createBase44PlatformServer(options: PlatformServerOptions): Base44PlatformServer;
@@ -1,21 +1,8 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var _Base44PlatformServer_serverUrl, _Base44PlatformServer_apiKey;
8
1
  import { normalizeServerUrl } from "../shared/server-url.js";
9
- /** Server platform client, authenticated with a workspace API key. Construction performs no network requests. */
10
- export class Base44PlatformServer {
11
- /** Configure shared service/auth settings; modules are added on top of this. */
12
- constructor(options) {
13
- _Base44PlatformServer_serverUrl.set(this, void 0);
14
- _Base44PlatformServer_apiKey.set(this, void 0);
15
- if (!options.apiKey)
16
- throw new TypeError("apiKey is required");
17
- __classPrivateFieldSet(this, _Base44PlatformServer_serverUrl, normalizeServerUrl(options.serverUrl), "f");
18
- __classPrivateFieldSet(this, _Base44PlatformServer_apiKey, options.apiKey, "f");
19
- }
2
+ /** Create a server platform client, authenticated with a workspace API key. Performs no network requests. */
3
+ export function createBase44PlatformServer(options) {
4
+ if (!options.apiKey)
5
+ throw new TypeError("apiKey is required");
6
+ normalizeServerUrl(options.serverUrl);
7
+ return Object.freeze({});
20
8
  }
21
- _Base44PlatformServer_serverUrl = new WeakMap(), _Base44PlatformServer_apiKey = new WeakMap();
@@ -5,3 +5,6 @@ export interface PlatformServerOptions {
5
5
  /** Workspace API key. Keep it on your server; never ship it to a browser. */
6
6
  apiKey: string;
7
7
  }
8
+ /** Server platform client, returned by `createBase44PlatformServer`. Modules are added as properties. */
9
+ export interface Base44PlatformServer {
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/platform",
3
- "version": "0.1.0-pr.316.56344d6",
3
+ "version": "0.1.0-pr.316.f75d775",
4
4
  "description": "Client and server SDK for building on the Base44 platform",
5
5
  "main": "dist/client/index.js",
6
6
  "types": "dist/client/index.d.ts",