@palbase/backend 39.0.0 → 39.1.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 +70 -40
- package/dist/bin/palbase-backend.cjs.map +1 -1
- package/dist/bin/palbase-backend.js +1 -1
- package/dist/{chunk-JJSR4BUX.js → chunk-C525N4OW.js} +71 -41
- package/dist/chunk-C525N4OW.js.map +1 -0
- package/dist/engine/index.cjs +70 -40
- 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-B0mjUnxy.d.cts → index-Brhp8cxj.d.cts} +9 -15
- package/dist/{index-yDno9Ju9.d.ts → index-Dlu2b9-f.d.ts} +9 -15
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -12
- package/dist/index.d.ts +45 -12
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/docs/auth.md +20 -0
- package/docs/database.md +50 -0
- package/docs/llms-full.txt +70 -0
- package/package.json +1 -1
- package/dist/chunk-JJSR4BUX.js.map +0 -1
package/dist/engine/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../index-pK2At5Yc.cjs';
|
|
2
|
-
export { A as App, g as AuthVerifier, B as BootRefused, h as COMMAND_EXECUTOR_DDL, j as CreateAppOptions, D as DECLARATION_REFUSAL, a as DeclarationRefused, E as EgressPolicy, k as EngineConfig, M as ModuleClients, R as RateLimiter, l as RequestDatabase, m as RouteEntry, n as RuntimeHooks, S as ScrubResult, o as SqlDriver, p as SqlTx, q as buildRouteTable, r as createApp, s as createLazyTransaction, t as createOps, u as createRequestDatabase, v as effectiveAuth, w as hostAllowed, x as installCommandExecutor, y as installEgressFence, i as isDeclarationRefused, z as loadConfig, F as makeMemoryCache, G as matchRoute, H as quoteIdent, I as scrubSecrets, J as setCursorKey, K as withQueryCancellation, L as withTables } from '../index-
|
|
2
|
+
export { A as App, g as AuthVerifier, B as BootRefused, h as COMMAND_EXECUTOR_DDL, j as CreateAppOptions, D as DECLARATION_REFUSAL, a as DeclarationRefused, E as EgressPolicy, k as EngineConfig, M as ModuleClients, R as RateLimiter, l as RequestDatabase, m as RouteEntry, n as RuntimeHooks, S as ScrubResult, o as SqlDriver, p as SqlTx, q as buildRouteTable, r as createApp, s as createLazyTransaction, t as createOps, u as createRequestDatabase, v as effectiveAuth, w as hostAllowed, x as installCommandExecutor, y as installEgressFence, i as isDeclarationRefused, z as loadConfig, F as makeMemoryCache, G as matchRoute, H as quoteIdent, I as scrubSecrets, J as setCursorKey, K as withQueryCancellation, L as withTables } from '../index-Brhp8cxj.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '../db/env.cjs';
|
|
5
5
|
import '../stack.cjs';
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../index-eN4KzGa5.js';
|
|
2
|
-
export { A as App, g as AuthVerifier, B as BootRefused, h as COMMAND_EXECUTOR_DDL, j as CreateAppOptions, D as DECLARATION_REFUSAL, a as DeclarationRefused, E as EgressPolicy, k as EngineConfig, M as ModuleClients, R as RateLimiter, l as RequestDatabase, m as RouteEntry, n as RuntimeHooks, S as ScrubResult, o as SqlDriver, p as SqlTx, q as buildRouteTable, r as createApp, s as createLazyTransaction, t as createOps, u as createRequestDatabase, v as effectiveAuth, w as hostAllowed, x as installCommandExecutor, y as installEgressFence, i as isDeclarationRefused, z as loadConfig, F as makeMemoryCache, G as matchRoute, H as quoteIdent, I as scrubSecrets, J as setCursorKey, K as withQueryCancellation, L as withTables } from '../index-
|
|
2
|
+
export { A as App, g as AuthVerifier, B as BootRefused, h as COMMAND_EXECUTOR_DDL, j as CreateAppOptions, D as DECLARATION_REFUSAL, a as DeclarationRefused, E as EgressPolicy, k as EngineConfig, M as ModuleClients, R as RateLimiter, l as RequestDatabase, m as RouteEntry, n as RuntimeHooks, S as ScrubResult, o as SqlDriver, p as SqlTx, q as buildRouteTable, r as createApp, s as createLazyTransaction, t as createOps, u as createRequestDatabase, v as effectiveAuth, w as hostAllowed, x as installCommandExecutor, y as installEgressFence, i as isDeclarationRefused, z as loadConfig, F as makeMemoryCache, G as matchRoute, H as quoteIdent, I as scrubSecrets, J as setCursorKey, K as withQueryCancellation, L as withTables } from '../index-Dlu2b9-f.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '../db/env.js';
|
|
5
5
|
import '../stack.js';
|
package/dist/engine/index.js
CHANGED
|
@@ -895,18 +895,6 @@ interface RouteMatch {
|
|
|
895
895
|
/** First match wins; the table is small and declaration order is the tiebreak. */
|
|
896
896
|
declare function matchRoute(table: readonly RouteEntry[], method: string, pathname: string): RouteMatch | null;
|
|
897
897
|
|
|
898
|
-
/**
|
|
899
|
-
* engine/auth.ts — verifying the stack's own access tokens.
|
|
900
|
-
*
|
|
901
|
-
* The engine does this itself rather than trusting a header stamped upstream.
|
|
902
|
-
* In the isolate architecture a gateway verified the token and the runtime read
|
|
903
|
-
* the result; a backend that boots on its own has no such upstream, so the
|
|
904
|
-
* verification lives here — against the keys the stack publishes.
|
|
905
|
-
*
|
|
906
|
-
* Deliberately narrow: ES256 over P-256, which is what palauth mints. An
|
|
907
|
-
* unrecognised `alg` is refused rather than accommodated, because the classic
|
|
908
|
-
* JWT break is a verifier that is helpful about algorithms.
|
|
909
|
-
*/
|
|
910
898
|
/** The claims the engine reads. Everything else rides along untyped. */
|
|
911
899
|
interface VerifiedClaims extends Record<string, unknown> {
|
|
912
900
|
sub?: string;
|
|
@@ -930,20 +918,26 @@ declare class AuthVerifier {
|
|
|
930
918
|
private keys;
|
|
931
919
|
private fetchedAt;
|
|
932
920
|
private inflight;
|
|
921
|
+
private nextRefreshAt;
|
|
922
|
+
private refreshFailed;
|
|
933
923
|
private readonly jwksUrl;
|
|
934
924
|
private readonly issuer?;
|
|
935
925
|
private readonly fetchImpl;
|
|
936
926
|
private readonly ttl;
|
|
937
927
|
constructor(opts: AuthVerifierOptions);
|
|
938
|
-
/** Fetch
|
|
928
|
+
/** Fetch once concurrently. Known keys use their trust TTL; misses and
|
|
929
|
+
* failures share a short cooldown so arbitrary kids cannot force a fetch
|
|
930
|
+
* per request, and recovery does not wait for an entire trust TTL. */
|
|
939
931
|
private refresh;
|
|
932
|
+
private fetchKeyset;
|
|
940
933
|
private key;
|
|
941
934
|
/**
|
|
942
935
|
* Verify an `Authorization` header value.
|
|
943
936
|
*
|
|
944
937
|
* @returns the verified claims, or `null` for absent / malformed / expired /
|
|
945
|
-
* wrong-issuer / bad-signature.
|
|
946
|
-
*
|
|
938
|
+
* wrong-issuer / bad-signature. Credential refusals deliberately share one
|
|
939
|
+
* result. An unavailable keyset throws 503 instead: no authentication
|
|
940
|
+
* decision was possible, and the caller's session must not be invalidated.
|
|
947
941
|
*/
|
|
948
942
|
verify(authorization: string | null | undefined): Promise<VerifiedClaims | null>;
|
|
949
943
|
}
|
|
@@ -895,18 +895,6 @@ interface RouteMatch {
|
|
|
895
895
|
/** First match wins; the table is small and declaration order is the tiebreak. */
|
|
896
896
|
declare function matchRoute(table: readonly RouteEntry[], method: string, pathname: string): RouteMatch | null;
|
|
897
897
|
|
|
898
|
-
/**
|
|
899
|
-
* engine/auth.ts — verifying the stack's own access tokens.
|
|
900
|
-
*
|
|
901
|
-
* The engine does this itself rather than trusting a header stamped upstream.
|
|
902
|
-
* In the isolate architecture a gateway verified the token and the runtime read
|
|
903
|
-
* the result; a backend that boots on its own has no such upstream, so the
|
|
904
|
-
* verification lives here — against the keys the stack publishes.
|
|
905
|
-
*
|
|
906
|
-
* Deliberately narrow: ES256 over P-256, which is what palauth mints. An
|
|
907
|
-
* unrecognised `alg` is refused rather than accommodated, because the classic
|
|
908
|
-
* JWT break is a verifier that is helpful about algorithms.
|
|
909
|
-
*/
|
|
910
898
|
/** The claims the engine reads. Everything else rides along untyped. */
|
|
911
899
|
interface VerifiedClaims extends Record<string, unknown> {
|
|
912
900
|
sub?: string;
|
|
@@ -930,20 +918,26 @@ declare class AuthVerifier {
|
|
|
930
918
|
private keys;
|
|
931
919
|
private fetchedAt;
|
|
932
920
|
private inflight;
|
|
921
|
+
private nextRefreshAt;
|
|
922
|
+
private refreshFailed;
|
|
933
923
|
private readonly jwksUrl;
|
|
934
924
|
private readonly issuer?;
|
|
935
925
|
private readonly fetchImpl;
|
|
936
926
|
private readonly ttl;
|
|
937
927
|
constructor(opts: AuthVerifierOptions);
|
|
938
|
-
/** Fetch
|
|
928
|
+
/** Fetch once concurrently. Known keys use their trust TTL; misses and
|
|
929
|
+
* failures share a short cooldown so arbitrary kids cannot force a fetch
|
|
930
|
+
* per request, and recovery does not wait for an entire trust TTL. */
|
|
939
931
|
private refresh;
|
|
932
|
+
private fetchKeyset;
|
|
940
933
|
private key;
|
|
941
934
|
/**
|
|
942
935
|
* Verify an `Authorization` header value.
|
|
943
936
|
*
|
|
944
937
|
* @returns the verified claims, or `null` for absent / malformed / expired /
|
|
945
|
-
* wrong-issuer / bad-signature.
|
|
946
|
-
*
|
|
938
|
+
* wrong-issuer / bad-signature. Credential refusals deliberately share one
|
|
939
|
+
* result. An unavailable keyset throws 503 instead: no authentication
|
|
940
|
+
* decision was possible, and the caller's session must not be invalidated.
|
|
947
941
|
*/
|
|
948
942
|
verify(authorization: string | null | undefined): Promise<VerifiedClaims | null>;
|
|
949
943
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -4456,12 +4456,13 @@ __name(sqlFragment, "sqlFragment");
|
|
|
4456
4456
|
// src/db/repository.ts
|
|
4457
4457
|
function defineRepository(table, opts) {
|
|
4458
4458
|
const tenantColumn = opts.tenant;
|
|
4459
|
+
const rowKey = opts.key ?? "id";
|
|
4459
4460
|
const scope = /* @__PURE__ */ __name((tenant) => ({
|
|
4460
4461
|
[tenantColumn]: tenant
|
|
4461
4462
|
}), "scope");
|
|
4462
4463
|
const scopeRow = /* @__PURE__ */ __name((tenant, id) => ({
|
|
4463
4464
|
[tenantColumn]: tenant,
|
|
4464
|
-
id
|
|
4465
|
+
[rowKey]: id
|
|
4465
4466
|
}), "scopeRow");
|
|
4466
4467
|
const scopedPayload = /* @__PURE__ */ __name((values, tenant) => ({
|
|
4467
4468
|
...values,
|
|
@@ -4489,7 +4490,7 @@ function defineRepository(table, opts) {
|
|
|
4489
4490
|
async update(tenant, id, patch) {
|
|
4490
4491
|
const row = await this.updateScoped(tenant, id, patch);
|
|
4491
4492
|
if (row === null) {
|
|
4492
|
-
throw new NotFound(`${String(tenantColumn)}=${String(tenant)} kapsam\u0131nda ${id} bulunamad\u0131`);
|
|
4493
|
+
throw new NotFound(`${String(tenantColumn)}=${String(tenant)} kapsam\u0131nda ${rowKey}=${String(id)} bulunamad\u0131`);
|
|
4493
4494
|
}
|
|
4494
4495
|
return row;
|
|
4495
4496
|
}
|