@palbase/backend 21.0.1 → 22.0.1
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/dist/bin/palbase-backend.cjs +1 -0
- package/dist/bin/palbase-backend.cjs.map +1 -1
- package/dist/bin/palbase-backend.js +1 -1
- package/dist/{chunk-PFQJYW6C.js → chunk-QYOHMVUW.js} +2 -1
- package/dist/chunk-QYOHMVUW.js.map +1 -0
- package/dist/engine/index.cjs +1 -0
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.cts +1 -1
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +1 -1
- package/dist/{index-Br9P7yRu.d.cts → index-B4W6d2VJ.d.cts} +14 -0
- package/dist/{index-BeHLq2i-.d.ts → index-BCNtlG1w.d.ts} +14 -0
- package/dist/index.cjs +10 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/docs/README.md +12 -7
- package/docs/llms-full.txt +12 -7
- package/package.json +2 -2
- package/template/package.json +1 -1
- package/dist/chunk-PFQJYW6C.js.map +0 -1
package/dist/engine/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as App, l as AuthVerifier, B as BootRefused, m as CreateAppOptions, E as EgressPolicy, n as EngineConfig, M as ModuleClients, o as RateLimiter, p as RequestDatabase, q as RouteEntry, r as RuntimeHooks, s as ScrubResult, t as SqlDriver, u as SqlTx, v as buildRouteTable, w as createApp, x as createLazyTransaction, y as createOps, z as createRequestDatabase, G as effectiveAuth, H as hostAllowed, I as installEgressFence, J as loadConfig, K as makeMemoryCache, O as matchRoute, Q as quoteIdent, T as scrubSecrets, U as withTables } from '../index-
|
|
1
|
+
export { A as App, l as AuthVerifier, B as BootRefused, m as CreateAppOptions, E as EgressPolicy, n as EngineConfig, M as ModuleClients, o as RateLimiter, p as RequestDatabase, q as RouteEntry, r as RuntimeHooks, s as ScrubResult, t as SqlDriver, u as SqlTx, v as buildRouteTable, w as createApp, x as createLazyTransaction, y as createOps, z as createRequestDatabase, G as effectiveAuth, H as hostAllowed, I as installEgressFence, J as loadConfig, K as makeMemoryCache, O as matchRoute, Q as quoteIdent, T as scrubSecrets, U as withTables } from '../index-B4W6d2VJ.cjs';
|
|
2
2
|
import '../endpoint-B0LpZixz.cjs';
|
|
3
3
|
import '../db/env.cjs';
|
|
4
4
|
import 'node:async_hooks';
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as App, l as AuthVerifier, B as BootRefused, m as CreateAppOptions, E as EgressPolicy, n as EngineConfig, M as ModuleClients, o as RateLimiter, p as RequestDatabase, q as RouteEntry, r as RuntimeHooks, s as ScrubResult, t as SqlDriver, u as SqlTx, v as buildRouteTable, w as createApp, x as createLazyTransaction, y as createOps, z as createRequestDatabase, G as effectiveAuth, H as hostAllowed, I as installEgressFence, J as loadConfig, K as makeMemoryCache, O as matchRoute, Q as quoteIdent, T as scrubSecrets, U as withTables } from '../index-
|
|
1
|
+
export { A as App, l as AuthVerifier, B as BootRefused, m as CreateAppOptions, E as EgressPolicy, n as EngineConfig, M as ModuleClients, o as RateLimiter, p as RequestDatabase, q as RouteEntry, r as RuntimeHooks, s as ScrubResult, t as SqlDriver, u as SqlTx, v as buildRouteTable, w as createApp, x as createLazyTransaction, y as createOps, z as createRequestDatabase, G as effectiveAuth, H as hostAllowed, I as installEgressFence, J as loadConfig, K as makeMemoryCache, O as matchRoute, Q as quoteIdent, T as scrubSecrets, U as withTables } from '../index-BCNtlG1w.js';
|
|
2
2
|
import '../endpoint-B0LpZixz.js';
|
|
3
3
|
import '../db/env.js';
|
|
4
4
|
import 'node:async_hooks';
|
package/dist/engine/index.js
CHANGED
|
@@ -304,6 +304,20 @@ interface EngineConfig {
|
|
|
304
304
|
/** Base URL of the module surface (`/v1/*`, `/auth/*`). Empty ⇒ module
|
|
305
305
|
* singletons throw a named error on first use rather than silently no-op. */
|
|
306
306
|
moduleBaseUrl: string;
|
|
307
|
+
/**
|
|
308
|
+
* The address CLIENTS reach this stack at — `https://<ref>.palbase.studio` in
|
|
309
|
+
* the cloud, whatever domain the certificate is for when self-hosted.
|
|
310
|
+
*
|
|
311
|
+
* NOT `moduleBaseUrl`, and the distinction is the whole point: that one is
|
|
312
|
+
* this process's internal route to palsvc (`http://127.0.0.1:8080`), which
|
|
313
|
+
* resolves nowhere outside the pod. A public object URL has to survive
|
|
314
|
+
* leaving the response body, so it cannot be built from the internal one.
|
|
315
|
+
*
|
|
316
|
+
* Only the operator knows this value, so only the operator sets it
|
|
317
|
+
* (`PALBASE_PUBLIC_ORIGIN`). Empty ⇒ `Storage…getPublicUrl()` throws a named
|
|
318
|
+
* error, the same way an unconfigured module does.
|
|
319
|
+
*/
|
|
320
|
+
publicOrigin: string;
|
|
307
321
|
/** Shared secret storage signs its internal upload calls with. Empty means
|
|
308
322
|
* uploads are not wired, and those calls are refused. */
|
|
309
323
|
uploadSecret: string;
|
|
@@ -304,6 +304,20 @@ interface EngineConfig {
|
|
|
304
304
|
/** Base URL of the module surface (`/v1/*`, `/auth/*`). Empty ⇒ module
|
|
305
305
|
* singletons throw a named error on first use rather than silently no-op. */
|
|
306
306
|
moduleBaseUrl: string;
|
|
307
|
+
/**
|
|
308
|
+
* The address CLIENTS reach this stack at — `https://<ref>.palbase.studio` in
|
|
309
|
+
* the cloud, whatever domain the certificate is for when self-hosted.
|
|
310
|
+
*
|
|
311
|
+
* NOT `moduleBaseUrl`, and the distinction is the whole point: that one is
|
|
312
|
+
* this process's internal route to palsvc (`http://127.0.0.1:8080`), which
|
|
313
|
+
* resolves nowhere outside the pod. A public object URL has to survive
|
|
314
|
+
* leaving the response body, so it cannot be built from the internal one.
|
|
315
|
+
*
|
|
316
|
+
* Only the operator knows this value, so only the operator sets it
|
|
317
|
+
* (`PALBASE_PUBLIC_ORIGIN`). Empty ⇒ `Storage…getPublicUrl()` throws a named
|
|
318
|
+
* error, the same way an unconfigured module does.
|
|
319
|
+
*/
|
|
320
|
+
publicOrigin: string;
|
|
307
321
|
/** Shared secret storage signs its internal upload calls with. Empty means
|
|
308
322
|
* uploads are not wired, and those calls are refused. */
|
|
309
323
|
uploadSecret: string;
|
package/dist/index.cjs
CHANGED
|
@@ -1658,7 +1658,7 @@ function mapResponse(res, map) {
|
|
|
1658
1658
|
}
|
|
1659
1659
|
return { data: map(res.data), error: null, status: res.status };
|
|
1660
1660
|
}
|
|
1661
|
-
function buildBucketClient(http, bucketName) {
|
|
1661
|
+
function buildBucketClient(http, bucketName, publicOrigin) {
|
|
1662
1662
|
const objectPath = (path) => `/v1/storage/object/${bucketName}/${path}`;
|
|
1663
1663
|
return {
|
|
1664
1664
|
async upload(path, file, options) {
|
|
@@ -1681,7 +1681,12 @@ function buildBucketClient(http, bucketName) {
|
|
|
1681
1681
|
getPublicUrl(path, options) {
|
|
1682
1682
|
validateStoragePath(path);
|
|
1683
1683
|
const variant = options?.variant ? `?variant=${encodeURIComponent(options.variant)}` : "";
|
|
1684
|
-
|
|
1684
|
+
if (!publicOrigin) {
|
|
1685
|
+
throw new Error(
|
|
1686
|
+
`Storage.bucket("${bucketName}").getPublicUrl() needs this stack's public origin, and it was not configured. Set PALBASE_PUBLIC_ORIGIN to the address clients reach this stack at (e.g. https://myproject.palbase.studio).`
|
|
1687
|
+
);
|
|
1688
|
+
}
|
|
1689
|
+
return `${publicOrigin}/v1/files/${bucketName}/${path}${variant}`;
|
|
1685
1690
|
},
|
|
1686
1691
|
async createSignedUrl(path, options) {
|
|
1687
1692
|
validateStoragePath(path);
|
|
@@ -1723,13 +1728,13 @@ function buildBucketClient(http, bucketName) {
|
|
|
1723
1728
|
}
|
|
1724
1729
|
};
|
|
1725
1730
|
}
|
|
1726
|
-
function buildStorageClient(http) {
|
|
1731
|
+
function buildStorageClient(http, publicOrigin) {
|
|
1727
1732
|
return {
|
|
1728
1733
|
bucket(name) {
|
|
1729
1734
|
if (!BUCKET_NAME_RE.test(name)) {
|
|
1730
1735
|
throw new Error(`Invalid bucket name: "${name}". Bucket names must match ${BUCKET_NAME_RE.source}`);
|
|
1731
1736
|
}
|
|
1732
|
-
return buildBucketClient(http, name);
|
|
1737
|
+
return buildBucketClient(http, name, publicOrigin.replace(/\/+$/, ""));
|
|
1733
1738
|
}
|
|
1734
1739
|
};
|
|
1735
1740
|
}
|
|
@@ -1742,7 +1747,7 @@ function buildModuleClients(cfg) {
|
|
|
1742
1747
|
const http = makeHttpClient({ baseUrl, apiKey, fetchImpl: cfg.fetchImpl });
|
|
1743
1748
|
return {
|
|
1744
1749
|
Documents: buildDocumentsClient(http),
|
|
1745
|
-
Storage: buildStorageClient(http),
|
|
1750
|
+
Storage: buildStorageClient(http, cfg.publicOrigin),
|
|
1746
1751
|
Notifications: buildNotificationsClient(http),
|
|
1747
1752
|
Flags: buildFlagsClient(http, { getCurrentUserId: cfg.getCurrentUserId }),
|
|
1748
1753
|
Realtime: buildRealtimeClient({
|