@base44-preview/platform 0.2.0-pr.319.2940c9d → 0.2.0-pr.319.6735b76

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
@@ -7,9 +7,9 @@ npm install @base44/platform
7
7
  The Platform SDK for white-label platforms built on Base44. It is independent of the app SDK
8
8
  (`@base44/sdk`) and has two entrypoints:
9
9
 
10
- - `@base44/platform`, for the browser: follow the AI chat of up to eight apps live over the
11
- platform's shared socket. It implements the read-only white-label socket contract. The
12
- workspace must have white-label sockets enabled; this SDK does not open sessions.
10
+ - `@base44/platform`, for the browser: implements the read-only white-label builder socket
11
+ contract. A partner's browser watches the builder chat of up to eight apps over the platform's
12
+ shared socket. The workspace must have white-label sockets enabled; this SDK does not open sessions.
13
13
  - `@base44/platform/server`, for your backend: verify the webhooks Base44 sends when apps are
14
14
  created, published, unpublished, trashed or restored. See
15
15
  [Receiving webhooks](#receiving-webhooks-server).
@@ -46,16 +46,14 @@ makes no network calls: pass your workspace's public keys (`whpk_…`) to each c
46
46
 
47
47
  The simplest route is `createHandler`. It reads the raw body, verifies it, answers the
48
48
  activation challenge and picks the status code: 400 for a delivery that fails verification,
49
- 500 when your keys are misconfigured or a callback throws (Base44 retries), 204 otherwise,
50
- including for event types you have no handler for.
49
+ 500 when your keys are misconfigured, the body can't be read or a callback throws, and 204
50
+ otherwise, including for event types you have no handler for. Base44 retries any answer that
51
+ isn't 2xx; the status only shows in its delivery log which side failed.
51
52
 
52
53
  ```ts
53
54
  import { createPlatformServer } from "@base44/platform/server";
54
55
 
55
- const platform = createPlatformServer({
56
- serverUrl: "https://base44.app",
57
- apiKey: process.env.BASE44_API_KEY!,
58
- });
56
+ const platform = createPlatformServer();
59
57
  const publicKeys = process.env.BASE44_WEBHOOK_PUBLIC_KEYS!; // two keys during a rotation
60
58
 
61
59
  export const POST = platform.webhooks.createHandler({
@@ -79,7 +77,7 @@ export async function POST(request: Request) {
79
77
  event = await platform.webhooks.verifyEvent(rawBody, request.headers, { publicKeys });
80
78
  } catch (error) {
81
79
  if (error instanceof WebhookVerificationError) return new Response(null, { status: 400 });
82
- throw error; // missing/malformed keys: a 500, so Base44 retries
80
+ throw error; // missing/malformed keys: a 500. Base44 retries any non-2xx answer
83
81
  }
84
82
  switch (event.type) {
85
83
  case "webhook.test.v1": return Response.json({ challenge: event.data.challenge }); // activates the endpoint
@@ -89,6 +87,10 @@ export async function POST(request: Request) {
89
87
  }
90
88
  ```
91
89
 
90
+ An event type added to Base44 after your SDK version arrives as `{ type: "unknown", name, data }`,
91
+ with its real type in `name` and an unchecked `data`, the same shape the client uses. After you
92
+ upgrade, it arrives under its own `type`.
93
+
92
94
  Delivery is at least once with no ordering guarantee: deduplicate on `event.id`, and answer
93
95
  2xx to event types you do not handle. Event types are generated from the schemas published at
94
96
  `https://base44.com/webhooks/schemas`; run `npm run generate:webhooks` to refresh them.
@@ -32,7 +32,7 @@ export declare class WebhookVerificationError extends Error {
32
32
  *
33
33
  * You don't create it. The [`verifyEvent()`](/developers/references/platform-sdk/docs/interfaces/webhooks#verifyevent) method rejects with
34
34
  * it, and [`createHandler()`](/developers/references/platform-sdk/docs/interfaces/webhooks#createhandler) answers it with a 500 and passes it
35
- * to your `onError`. Fix the keys, and Base44's retries then succeed.
35
+ * to your `onError`. Base44 retries the delivery, and the retries succeed once you fix the problem.
36
36
  *
37
37
  * @example
38
38
  * ```typescript
@@ -33,7 +33,7 @@ export class WebhookVerificationError extends Error {
33
33
  *
34
34
  * You don't create it. The [`verifyEvent()`](/developers/references/platform-sdk/docs/interfaces/webhooks#verifyevent) method rejects with
35
35
  * it, and [`createHandler()`](/developers/references/platform-sdk/docs/interfaces/webhooks#createhandler) answers it with a 500 and passes it
36
- * to your `onError`. Fix the keys, and Base44's retries then succeed.
36
+ * to your `onError`. Base44 retries the delivery, and the retries succeed once you fix the problem.
37
37
  *
38
38
  * @example
39
39
  * ```typescript
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Codes of errors for a delivery that can't be trusted. Answer these with a 400. Base44 treats the
3
- * request as failed and retries it, and a genuine delivery verifies on the retry.
2
+ * Codes of errors for a delivery that can't be trusted. Answer these with a 400. Base44 retries any
3
+ * answer that isn't 2xx, so a genuine delivery that failed because of a passing problem verifies on the retry.
4
4
  */
5
5
  export type WebhookVerificationErrorCode =
6
6
  /**
@@ -36,8 +36,8 @@ export type WebhookVerificationErrorCode =
36
36
  | "invalid_payload";
37
37
  /**
38
38
  * Codes of errors that stop verification before it starts, because the public keys you passed can't
39
- * be used. They're about your deployment, not the request, so let them surface as a 500. Base44 then
40
- * retries the delivery, and it succeeds once you fix the keys.
39
+ * be used. They're about your deployment, not the request, so answer them with a 500. Base44 retries
40
+ * the delivery, as it does for any answer that isn't 2xx, and it succeeds once you fix the problem.
41
41
  */
42
42
  export type WebhookConfigurationErrorCode =
43
43
  /**
@@ -51,4 +51,10 @@ export type WebhookConfigurationErrorCode =
51
51
  *
52
52
  * Copy the key again. A truncated key fails this way.
53
53
  */
54
- | "invalid_public_key";
54
+ | "invalid_public_key"
55
+ /**
56
+ * The runtime can't import Ed25519 keys with WebCrypto.
57
+ *
58
+ * Run your server on Node.js 20 or later, or on an edge runtime that supports Ed25519 in WebCrypto.
59
+ */
60
+ | "unsupported_runtime";
@@ -2,5 +2,5 @@
2
2
  export { createPlatformServer } from "./server.js";
3
3
  export { WebhookConfigurationError, WebhookVerificationError } from "./errors.js";
4
4
  export type { WebhookConfigurationErrorCode, WebhookVerificationErrorCode } from "./errors.types.js";
5
- export type { PlatformServer, PlatformServerOptions } from "./server.types.js";
6
- export type { AppCreatedV1Data, AppDeletedV1Data, AppPublishedV1Data, AppRestoredV1Data, AppUnpublishedV1Data, CloudEvent, CreateHandlerOptions, DeliveredWebhookEvent, VerifyEventOptions, WebhookEventHandlers, WebhookEvent, WebhookEventMap, WebhookEventType, WebhookHeaders, WebhookPublicKeys, WebhooksModule, WebhookTestV1Data, } from "./modules/webhooks.types.js";
5
+ export type { PlatformServer } from "./server.types.js";
6
+ export type { AppCreatedV1Data, AppDeletedV1Data, AppPublishedV1Data, AppRestoredV1Data, AppUnpublishedV1Data, CloudEvent, CreateHandlerOptions, DeliveredWebhookEvent, UnknownWebhookEvent, VerifyEventOptions, WebhookEventHandlers, WebhookEvent, WebhookEventMap, WebhookEventType, WebhookHeaders, WebhookPublicKeys, WebhooksModule, WebhookTestV1Data, } from "./modules/webhooks.types.js";
@@ -172,3 +172,5 @@ export interface WebhookEventMap {
172
172
  /** Carries no domain data — its only job is to be verifiable and echoed. */
173
173
  "webhook.test.v1": WebhookTestV1Data;
174
174
  }
175
+ /** Every event type in {@link WebhookEventMap}, so events from a newer Base44 can be told apart at runtime. @internal */
176
+ export declare const WEBHOOK_EVENT_TYPES: readonly ["app.created.v1", "app.published.v1", "app.unpublished.v1", "app.deleted.v1", "app.restored.v1", "webhook.test.v1"];
@@ -1,3 +1,4 @@
1
1
  // Generated by scripts/generate-webhook-types.mjs from the schemas published at
2
2
  // https://base44.com/webhooks/schemas. Do not edit by hand; run `npm run generate:webhooks`.
3
- export {};
3
+ /** Every event type in {@link WebhookEventMap}, so events from a newer Base44 can be told apart at runtime. @internal */
4
+ export const WEBHOOK_EVENT_TYPES = ["app.created.v1", "app.published.v1", "app.unpublished.v1", "app.deleted.v1", "app.restored.v1", "webhook.test.v1"];
@@ -1,5 +1,7 @@
1
1
  import { WebhookConfigurationError, WebhookVerificationError } from "../errors.js";
2
2
  import { anySignatureVerifies, importPublicKey, parsePublicKeys, parseSignatures, readHeader, signedPayload } from "./webhooks-signature.js";
3
+ import { WEBHOOK_EVENT_TYPES } from "./webhooks.events.generated.js";
4
+ const knownTypes = new Set(WEBHOOK_EVENT_TYPES);
3
5
  const DEFAULT_TOLERANCE_SECONDS = 300;
4
6
  /** Webhook receiving utilities. Verification is local: no network calls, no timers. */
5
7
  export function createWebhooks() {
@@ -7,8 +9,13 @@ export function createWebhooks() {
7
9
  const imported = new Map();
8
10
  const keysFor = (publicKeys) => Promise.all(parsePublicKeys(publicKeys).map(raw => {
9
11
  const id = raw.join(",");
10
- if (!imported.has(id))
11
- imported.set(id, importPublicKey(raw));
12
+ if (!imported.has(id)) {
13
+ imported.set(id, importPublicKey(raw).catch(() => {
14
+ // Evicted so a later call retries the import instead of replaying this failure.
15
+ imported.delete(id);
16
+ throw new WebhookConfigurationError("unsupported_runtime", "this runtime can't import Ed25519 keys with WebCrypto");
17
+ }));
18
+ }
12
19
  return imported.get(id);
13
20
  }));
14
21
  const verifyEvent = async (body, headers, verifyOptions) => {
@@ -42,23 +49,30 @@ export function createWebhooks() {
42
49
  if (typeof type !== "string" || typeof eventId !== "string" || typeof data !== "object" || data === null) {
43
50
  throw new WebhookVerificationError("invalid_payload");
44
51
  }
45
- return event;
52
+ // A type from a newer Base44 gets the client's unknown-event shape, so known types keep narrowing.
53
+ return (knownTypes.has(type) ? event : { ...event, type: "unknown", name: type });
46
54
  };
47
55
  return {
48
56
  verifyEvent,
49
57
  createHandler({ on = {}, onEvent, onSuccess, onError, ...verifyOptions }) {
50
- const fail = async (error, status, event) => {
51
- var _a;
52
- return (_a = (await (onError === null || onError === void 0 ? void 0 : onError(error, event)))) !== null && _a !== void 0 ? _a : Response.json({ error: error instanceof WebhookVerificationError ? error.code : error instanceof WebhookConfigurationError ? "receiver_misconfigured" : "handler_failed" }, { status });
53
- };
58
+ const fail = async (error, status, label, event) => { var _a; return (_a = (await (onError === null || onError === void 0 ? void 0 : onError(error, event)))) !== null && _a !== void 0 ? _a : Response.json({ error: label }, { status }); };
54
59
  return async (request) => {
55
60
  var _a, _b;
61
+ let body;
62
+ try {
63
+ body = new Uint8Array(await request.arrayBuffer());
64
+ }
65
+ catch (error) {
66
+ return fail(error, 500, "request_failed");
67
+ }
56
68
  let event;
57
69
  try {
58
- event = await verifyEvent(new Uint8Array(await request.arrayBuffer()), request.headers, verifyOptions);
70
+ event = await verifyEvent(body, request.headers, verifyOptions);
59
71
  }
60
72
  catch (error) {
61
- return fail(error, error instanceof WebhookVerificationError ? 400 : 500);
73
+ if (error instanceof WebhookVerificationError)
74
+ return fail(error, 400, error.code);
75
+ return fail(error, 500, error instanceof WebhookConfigurationError ? "receiver_misconfigured" : "request_failed");
62
76
  }
63
77
  // Activation probe: echo the challenge, only after the signature verified. Never reaches your callbacks.
64
78
  if (event.type === "webhook.test.v1")
@@ -69,7 +83,7 @@ export function createWebhooks() {
69
83
  return (_b = (await (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event)))) !== null && _b !== void 0 ? _b : new Response(null, { status: 204 });
70
84
  }
71
85
  catch (error) {
72
- return fail(error, 500, event);
86
+ return fail(error, 500, "handler_failed", event);
73
87
  }
74
88
  };
75
89
  },
@@ -31,15 +31,42 @@ export interface CloudEvent<TType extends string, TData> {
31
31
  /** The event's payload. Its shape depends on `type`. */
32
32
  data: TData;
33
33
  }
34
+ /**
35
+ * A webhook event whose type this version of the SDK doesn't know, such as one Base44 added later.
36
+ *
37
+ * The envelope is the same as for every event, but `type` is `"unknown"`, the event's real type is
38
+ * in `name`, and `data` isn't checked, so check a field before using it.
39
+ */
40
+ export interface UnknownWebhookEvent extends Omit<CloudEvent<string, Record<string, unknown>>, "type"> {
41
+ /** Always `"unknown"`. Narrows the event to this shape. */
42
+ type: "unknown";
43
+ /** The event's type as Base44 sent it, such as `app.renamed.v1`. */
44
+ name: string;
45
+ }
34
46
  /**
35
47
  * A verified webhook event.
36
48
  *
37
- * Check `type` to narrow `data` to that event's payload. Base44 can add event types later, so give a
38
- * `switch` a default branch that still answers 2xx. A non-2xx answer makes Base44 retry the delivery.
49
+ * Check `type` to narrow `data` to that event's payload. An event added to Base44 after this version
50
+ * of the SDK arrives with `type: "unknown"`, its type in `name` and an unchecked `data`, so check a
51
+ * field before using it. After you upgrade, it arrives under its own `type`. Answer it with a 2xx
52
+ * too: Base44 retries any answer that isn't 2xx.
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * // Narrow an event by type
57
+ * switch (event.type) {
58
+ * case 'app.deleted.v1':
59
+ * await removeApp(event.data.app_id);
60
+ * break;
61
+ * case 'unknown':
62
+ * console.log(`Skipping ${event.name}, which this SDK version doesn't know`);
63
+ * break;
64
+ * }
65
+ * ```
39
66
  */
40
67
  export type WebhookEvent = {
41
68
  [K in WebhookEventType]: CloudEvent<K, WebhookEventMap[K]>;
42
- }[WebhookEventType];
69
+ }[WebhookEventType] | UnknownWebhookEvent;
43
70
  /** Request headers, as a fetch `Headers` object or a Node.js-style object. Header names are case-insensitive. */
44
71
  export type WebhookHeaders = Headers | Record<string, string | string[] | undefined>;
45
72
  /** One Ed25519 public key, starting with `whpk_`, or several in an array or separated by commas or whitespace. */
@@ -58,7 +85,10 @@ export interface VerifyEventOptions {
58
85
  }
59
86
  /** An event your callbacks receive. Every event except the `webhook.test.v1` activation probe, which the handler answers itself. */
60
87
  export type DeliveredWebhookEvent = Exclude<WebhookEvent, CloudEvent<"webhook.test.v1", WebhookTestV1Data>>;
61
- /** Handlers keyed by event type. Each handler receives the event narrowed to its type. */
88
+ /**
89
+ * Handlers keyed by event type. Each handler receives the event narrowed to its type. The `unknown`
90
+ * key handles every event type this version of the SDK doesn't know.
91
+ */
62
92
  export type WebhookEventHandlers = {
63
93
  [K in DeliveredWebhookEvent["type"]]?: (event: Extract<DeliveredWebhookEvent, {
64
94
  type: K;
@@ -66,7 +96,7 @@ export type WebhookEventHandlers = {
66
96
  };
67
97
  /** Options for {@linkcode WebhooksModule.createHandler | createHandler()}. Every callback can be async. */
68
98
  export interface CreateHandlerOptions extends VerifyEventOptions {
69
- /** Handlers keyed by event type. Events without a handler are still answered 2xx, so Base44 doesn't retry them. */
99
+ /** Handlers keyed by event type. Events without a handler, including unknown ones, are still answered 2xx, so Base44 doesn't retry them. */
70
100
  on?: WebhookEventHandlers;
71
101
  /** Called for every verified event, before its handler in `on`. */
72
102
  onEvent?: (event: DeliveredWebhookEvent) => unknown;
@@ -79,9 +109,11 @@ export interface CreateHandlerOptions extends VerifyEventOptions {
79
109
  /**
80
110
  * Called when a delivery fails.
81
111
  *
82
- * The handler answers a `WebhookVerificationError` with a 400. It answers a `WebhookConfigurationError`,
83
- * or anything a callback throws, with a 500 so Base44 retries. The `event` argument is set when the
84
- * delivery verified and a callback failed. Return a `Response` to replace the default answer.
112
+ * The handler answers a `WebhookVerificationError` with a 400, and a `WebhookConfigurationError`, a
113
+ * failed body read or anything a callback throws with a 500. Base44 retries either way, because it
114
+ * retries any answer that isn't 2xx. The status only shows in its delivery log whether the delivery
115
+ * or your side failed. The `event` argument is set when the delivery verified and a callback failed.
116
+ * Return a `Response` to replace the default answer.
85
117
  */
86
118
  onError?: (error: unknown, event?: DeliveredWebhookEvent) => Response | void | Promise<Response | void>;
87
119
  }
@@ -115,7 +147,7 @@ export interface WebhooksModule {
115
147
  * @param options - Verification options, including your public keys.
116
148
  * @returns Promise resolving to the verified event.
117
149
  * @throws {WebhookVerificationError} When the delivery can't be trusted. Answer with a 400.
118
- * @throws {WebhookConfigurationError} When the public keys are missing or malformed. Let it surface as a 500.
150
+ * @throws {WebhookConfigurationError} When the public keys are missing or malformed, or the runtime can't use them. Answer with a 500.
119
151
  *
120
152
  * @example
121
153
  * ```typescript
@@ -153,9 +185,13 @@ export interface WebhooksModule {
153
185
  * `on`, and `onSuccess`, in that order.
154
186
  *
155
187
  * It answers with:
156
- * - 204 when the event was handled, including events with no handler.
157
- * - 400 when the delivery doesn't verify.
158
- * - 500 when the public keys are misconfigured or a callback throws. Base44 then retries.
188
+ * - 204 when the event was handled, including events with no handler and unknown events.
189
+ * - 400 when the delivery doesn't verify, with the error code in the body.
190
+ * - 500 when the public keys are misconfigured (`receiver_misconfigured`), the body can't be read
191
+ * (`request_failed`) or a callback throws (`handler_failed`).
192
+ *
193
+ * Base44 retries any answer that isn't 2xx, 400 and 500 alike. The status only shows in its delivery
194
+ * log whether the delivery or your side failed.
159
195
  *
160
196
  * Base44 can deliver the same event more than once, so make your handlers safe to run twice for the
161
197
  * same `event.id`.
@@ -1,25 +1,20 @@
1
- import type { PlatformServer, PlatformServerOptions } from "./server.types.js";
1
+ import type { PlatformServer } from "./server.types.js";
2
2
  /**
3
3
  * Creates a platform server client.
4
4
  *
5
5
  * This is the entry point of the Platform SDK on your backend. Import it from
6
6
  * `@base44/platform/server`. The client gives your server access to the platform's server modules,
7
- * such as [`webhooks`](/developers/references/platform-sdk/docs/interfaces/webhooks). Creating it
8
- * makes no network requests.
7
+ * such as [`webhooks`](/developers/references/platform-sdk/docs/interfaces/webhooks). It takes no
8
+ * options and makes no network requests. Each module takes what it needs when you call it.
9
9
  *
10
- * @param options - Configuration object for the client.
11
- * @returns A configured server client with access to the platform's server modules.
12
- * @throws {TypeError} When `serverUrl` isn't an HTTP or HTTPS origin, or `apiKey` is empty.
10
+ * @returns A server client with access to the platform's server modules.
13
11
  *
14
12
  * @example
15
13
  * ```typescript
16
14
  * // Create a server client on your backend
17
15
  * import { createPlatformServer } from '@base44/platform/server';
18
16
  *
19
- * const platform = createPlatformServer({
20
- * serverUrl: 'https://base44.app',
21
- * apiKey: process.env.BASE44_API_KEY,
22
- * });
17
+ * const platform = createPlatformServer();
23
18
  *
24
19
  * // Use the client to receive webhooks
25
20
  * export const POST = platform.webhooks.createHandler({
@@ -30,4 +25,4 @@ import type { PlatformServer, PlatformServerOptions } from "./server.types.js";
30
25
  * });
31
26
  * ```
32
27
  */
33
- export declare function createPlatformServer(options: PlatformServerOptions): PlatformServer;
28
+ export declare function createPlatformServer(): PlatformServer;
@@ -1,26 +1,20 @@
1
- import { normalizeServerUrl } from "./server-url.js";
2
1
  import { createWebhooks } from "./modules/webhooks.js";
3
2
  /**
4
3
  * Creates a platform server client.
5
4
  *
6
5
  * This is the entry point of the Platform SDK on your backend. Import it from
7
6
  * `@base44/platform/server`. The client gives your server access to the platform's server modules,
8
- * such as [`webhooks`](/developers/references/platform-sdk/docs/interfaces/webhooks). Creating it
9
- * makes no network requests.
7
+ * such as [`webhooks`](/developers/references/platform-sdk/docs/interfaces/webhooks). It takes no
8
+ * options and makes no network requests. Each module takes what it needs when you call it.
10
9
  *
11
- * @param options - Configuration object for the client.
12
- * @returns A configured server client with access to the platform's server modules.
13
- * @throws {TypeError} When `serverUrl` isn't an HTTP or HTTPS origin, or `apiKey` is empty.
10
+ * @returns A server client with access to the platform's server modules.
14
11
  *
15
12
  * @example
16
13
  * ```typescript
17
14
  * // Create a server client on your backend
18
15
  * import { createPlatformServer } from '@base44/platform/server';
19
16
  *
20
- * const platform = createPlatformServer({
21
- * serverUrl: 'https://base44.app',
22
- * apiKey: process.env.BASE44_API_KEY,
23
- * });
17
+ * const platform = createPlatformServer();
24
18
  *
25
19
  * // Use the client to receive webhooks
26
20
  * export const POST = platform.webhooks.createHandler({
@@ -31,10 +25,7 @@ import { createWebhooks } from "./modules/webhooks.js";
31
25
  * });
32
26
  * ```
33
27
  */
34
- export function createPlatformServer(options) {
35
- if (!options.apiKey)
36
- throw new TypeError("apiKey is required");
37
- normalizeServerUrl(options.serverUrl);
28
+ export function createPlatformServer() {
38
29
  return Object.freeze({
39
30
  webhooks: Object.freeze(createWebhooks()),
40
31
  });
@@ -1,24 +1,4 @@
1
1
  import type { WebhooksModule } from "./modules/webhooks.types.js";
2
- /**
3
- * Options for {@linkcode createPlatformServer | createPlatformServer()}.
4
- *
5
- * The server client runs on your backend and holds your workspace API key. Never pass these options
6
- * to code that runs in the browser.
7
- */
8
- export interface PlatformServerOptions {
9
- /**
10
- * Origin of the Base44 API, such as `https://base44.app`.
11
- *
12
- * It must be an origin with no path, query, fragment, or credentials.
13
- */
14
- serverUrl: string;
15
- /**
16
- * Your workspace API key.
17
- *
18
- * Keep it on your server. The browser client never needs it.
19
- */
20
- apiKey: string;
21
- }
22
2
  /**
23
3
  * The platform server client.
24
4
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@base44-preview/platform",
3
- "version": "0.2.0-pr.319.2940c9d",
4
- "description": "Base44 Platform SDK for white-label platforms: a browser client for live AI chat updates and a server entrypoint for webhooks",
3
+ "version": "0.2.0-pr.319.6735b76",
4
+ "description": "Base44 Platform SDK for white-label platforms: a browser client for watching the builder and a server entrypoint for webhooks",
5
5
  "main": "dist/client/index.js",
6
6
  "types": "dist/client/index.d.ts",
7
7
  "type": "module",
@@ -1,2 +0,0 @@
1
- /** Validate a platform origin and return it normalized. Used by the server entrypoint. */
2
- export declare function normalizeServerUrl(serverUrl: string): string;
@@ -1,8 +0,0 @@
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
- }