Skip to content

Add @base44/sdk/platform/server entry point - #283

Open
ozsay wants to merge 1 commit into
mainfrom
codex/platform-server-entry
Open

ozsay wants to merge 1 commit into
mainfrom
codex/platform-server-entry

Conversation

@ozsay

@ozsay ozsay commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Add @base44/sdk/platform/server to the existing npm package for provisioning users and managing their apps. Move the reusable implementation from starter PR #30 into platform-src/server, with a separate declaration-emitting build under dist/platform/server.

import { Base44PlatformClient } from "@base44/sdk/platform/server";

const platform = new Base44PlatformClient({ apiKey, workspaceId });
await platform.users.provision({ externalId: "customer_42" });
const apps = await platform.asUser("customer_42").apps.list();
  • One API key; optional token storage defaults to memory. Preserve explicit provisioning, immutable asUser, token lifecycle behavior, and projected public responses.
  • Document every public shape with field-level JSDoc, an API reference, a token guide, compilable examples, and a separate validated TypeDoc target.
  • Keep runtime output paths and root exports intact. The new exports map preserves legacy runtime deep imports with and without .js; declaration mappings also support legacy Node resolution.
  • Add platform coverage and packed-package checks to CI. No runtime source, dependency, lockfile, or package-version changes.

Testing

  • npm run test:types — passed, including platform examples and negative type assertions.
  • npm run test:unit — 320 tests passed, including 19 platform contract/documentation tests.
  • npm run test:package — both builds and seven tarball checks passed: entry points, legacy deep imports, entry-point isolation, and NodeNext/Bundler/Node declaration resolution.
  • npm run lint, npm run docs:platform, and git diff --check — passed.
  • HTTP behavior uses mocked responses. No live provisioning, builds, deployments, or database operations were performed.

Intent (for reviewers & PR Autofix)

What this PR does

Ship the platform client as a separate server entry point in the existing SDK package. Documentation and typed contracts are first-class parts of the API.

Key decisions & why

  • Separate platform-src and compilation preserve the runtime layout and keep the entry points independent.
  • Keep the existing single-key, optional-store API and behavior; this is a package relocation, not a token redesign.
  • Preserve legacy deep imports because existing consumers rely on them before this exports map exists.

What NOT to touch

  • Retaining legacy deep-import compatibility is intentional; tightening exports would break current consumers.
  • Keeping starter adapters and routes out of this repository is intentional. Starter PR Change redirectToLogin to absolute path #30 remains unchanged.
  • Keeping chat and sockets out of this entry point is intentional; they are a later phase.

Tradeoffs / follow-ups

  • Adopt the forthcoming token solution separately. Current token serialization is per client instance, not distributed locking.
  • Switch the starter to the package entry point in a follow-up. Stable publication and external documentation-site deployment use their normal release processes.

@github-actions

Copy link
Copy Markdown

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/sdk@0.8.48-pr.283.2de4c8a

Prefer not to change any import paths? Install using npm alias so your code still imports @base44/sdk:

npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.48-pr.283.2de4c8a"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "@base44/sdk": "npm:@base44-preview/sdk@0.8.48-pr.283.2de4c8a"
  }
}

Preview published to npm registry — try new features instantly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant