@palbase/backend 34.1.0 → 35.0.0

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.
Files changed (40) hide show
  1. package/LICENSE +21 -0
  2. package/dist/bin/palbase-backend.cjs +0 -0
  3. package/dist/bin/palbase-backend.cjs.map +1 -1
  4. package/dist/bin/palbase-backend.js +2 -2
  5. package/dist/{chunk-X2UYIXDS.js → chunk-6FEHCEB7.js} +4 -2
  6. package/dist/chunk-6FEHCEB7.js.map +1 -0
  7. package/dist/{chunk-XZPDPYVY.js → chunk-BOD3DT6D.js} +2 -2
  8. package/dist/{chunk-5UGPXKMJ.js → chunk-L4R7WXLH.js} +4 -1
  9. package/dist/chunk-L4R7WXLH.js.map +1 -0
  10. package/dist/db/index.cjs.map +1 -1
  11. package/dist/db/index.d.cts +2 -2
  12. package/dist/db/index.d.ts +2 -2
  13. package/dist/db/index.js +1 -1
  14. package/dist/{endpoint-BXPdsTA5.d.ts → endpoint-BI0yGuEL.d.ts} +61 -2
  15. package/dist/{endpoint-DqhUP7RT.d.cts → endpoint-DaGnjt42.d.cts} +61 -2
  16. package/dist/engine/index.cjs.map +1 -1
  17. package/dist/engine/index.d.cts +3 -3
  18. package/dist/engine/index.d.ts +3 -3
  19. package/dist/engine/index.js +2 -2
  20. package/dist/{index-Co0Hj_aO.d.cts → index-DllNjpTl.d.cts} +2 -2
  21. package/dist/{index-MhCL7ll4.d.ts → index-E8Sd6NFy.d.ts} +2 -2
  22. package/dist/index.cjs +36 -2
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +13 -8
  25. package/dist/index.d.ts +13 -8
  26. package/dist/index.js +32 -3
  27. package/dist/index.js.map +1 -1
  28. package/dist/openapi/index.d.cts +2 -2
  29. package/dist/openapi/index.d.ts +2 -2
  30. package/dist/{registry-BkIVHPzB.d.cts → registry-BnKvIyve.d.cts} +1 -1
  31. package/dist/{registry-CvGLR5j1.d.ts → registry-zDCj0eOU.d.ts} +1 -1
  32. package/dist/test/index.d.cts +1 -1
  33. package/dist/test/index.d.ts +1 -1
  34. package/package.json +15 -15
  35. package/stager/generics.js +12 -4
  36. package/stager/stage.js +38 -3
  37. package/template/scripts/test.sh +0 -0
  38. package/dist/chunk-5UGPXKMJ.js.map +0 -1
  39. package/dist/chunk-X2UYIXDS.js.map +0 -1
  40. /package/dist/{chunk-XZPDPYVY.js.map → chunk-BOD3DT6D.js.map} +0 -0
@@ -1,8 +1,8 @@
1
- import '../endpoint-DqhUP7RT.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-Co0Hj_aO.cjs';
1
+ import '../endpoint-DaGnjt42.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-DllNjpTl.cjs';
3
3
  import 'zod';
4
4
  import '../stack.cjs';
5
5
  import '../db/env.cjs';
6
6
  import 'node:async_hooks';
7
7
  import '../module-Dl1KFVtc.cjs';
8
- import '../registry-BkIVHPzB.cjs';
8
+ import '../registry-BnKvIyve.cjs';
@@ -1,8 +1,8 @@
1
- import '../endpoint-BXPdsTA5.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-MhCL7ll4.js';
1
+ import '../endpoint-BI0yGuEL.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-E8Sd6NFy.js';
3
3
  import 'zod';
4
4
  import '../stack.js';
5
5
  import '../db/env.js';
6
6
  import 'node:async_hooks';
7
7
  import '../module-Dl1KFVtc.js';
8
- import '../registry-CvGLR5j1.js';
8
+ import '../registry-zDCj0eOU.js';
@@ -20,12 +20,12 @@ import {
20
20
  setCursorKey,
21
21
  withQueryCancellation,
22
22
  withTables
23
- } from "../chunk-XZPDPYVY.js";
23
+ } from "../chunk-BOD3DT6D.js";
24
24
  import {
25
25
  DECLARATION_REFUSAL,
26
26
  DeclarationRefused,
27
27
  isDeclarationRefused
28
- } from "../chunk-X2UYIXDS.js";
28
+ } from "../chunk-6FEHCEB7.js";
29
29
  import "../chunk-GHNC2UHS.js";
30
30
  import "../chunk-YO5GYM73.js";
31
31
  import "../chunk-PRH45NZU.js";
@@ -1,6 +1,6 @@
1
- import { c as DatabaseDiagnosticsOptions, d as DatabaseDiagnostics, a as DBClient, T as TransactionIsolation, e as DBOps, P as PreparedRead, C as CompiledRead, f as RawPageOptions, g as Page, h as TxPlanBody, i as CommandOptions, j as TxPlanResponse, A as AuthSpec, k as CacheClient, b as RuntimeServices, _ as __runWithRuntime, l as __requestALS } from './endpoint-DqhUP7RT.cjs';
1
+ import { c as DatabaseDiagnosticsOptions, d as DatabaseDiagnostics, a as DBClient, T as TransactionIsolation, e as DBOps, P as PreparedRead, C as CompiledRead, f as RawPageOptions, g as Page, h as TxPlanBody, i as CommandOptions, j as TxPlanResponse, A as AuthSpec, k as CacheClient, b as RuntimeServices, _ as __runWithRuntime, l as __requestALS } from './endpoint-DaGnjt42.cjs';
2
2
  import { T as Token } from './module-Dl1KFVtc.cjs';
3
- import { R as RouteMeta } from './registry-BkIVHPzB.cjs';
3
+ import { R as RouteMeta } from './registry-BnKvIyve.cjs';
4
4
 
5
5
  /**
6
6
  * engine/config.ts — settings from the environment, and the gate that refuses
@@ -1,6 +1,6 @@
1
- import { c as DatabaseDiagnosticsOptions, d as DatabaseDiagnostics, a as DBClient, T as TransactionIsolation, e as DBOps, P as PreparedRead, C as CompiledRead, f as RawPageOptions, g as Page, h as TxPlanBody, i as CommandOptions, j as TxPlanResponse, A as AuthSpec, k as CacheClient, b as RuntimeServices, _ as __runWithRuntime, l as __requestALS } from './endpoint-BXPdsTA5.js';
1
+ import { c as DatabaseDiagnosticsOptions, d as DatabaseDiagnostics, a as DBClient, T as TransactionIsolation, e as DBOps, P as PreparedRead, C as CompiledRead, f as RawPageOptions, g as Page, h as TxPlanBody, i as CommandOptions, j as TxPlanResponse, A as AuthSpec, k as CacheClient, b as RuntimeServices, _ as __runWithRuntime, l as __requestALS } from './endpoint-BI0yGuEL.js';
2
2
  import { T as Token } from './module-Dl1KFVtc.js';
3
- import { R as RouteMeta } from './registry-CvGLR5j1.js';
3
+ import { R as RouteMeta } from './registry-zDCj0eOU.js';
4
4
 
5
5
  /**
6
6
  * engine/config.ts — settings from the environment, and the gate that refuses
package/dist/index.cjs CHANGED
@@ -2095,6 +2095,27 @@ function buildNotificationsClient(http) {
2095
2095
  });
2096
2096
  }
2097
2097
  };
2098
+ const whatsapp = {
2099
+ async send(params) {
2100
+ const { templateSlug, userId, ...rest } = params;
2101
+ const body = {
2102
+ ...rest,
2103
+ ...templateSlug === void 0 ? {} : {
2104
+ template_slug: templateSlug
2105
+ },
2106
+ ...userId === void 0 ? {} : {
2107
+ user_id: userId
2108
+ }
2109
+ };
2110
+ return http.request("POST", "/v1/notifications/whatsapp", {
2111
+ body
2112
+ });
2113
+ },
2114
+ async events(options = {}) {
2115
+ const query = options.limit === void 0 ? "" : `?limit=${encodeURIComponent(String(options.limit))}`;
2116
+ return http.request("GET", `/v1/notifications/whatsapp/events${query}`);
2117
+ }
2118
+ };
2098
2119
  const verifications = {
2099
2120
  async start(params) {
2100
2121
  return http.request("POST", "/v1/notifications/verifications", {
@@ -2221,6 +2242,7 @@ function buildNotificationsClient(http) {
2221
2242
  push,
2222
2243
  email,
2223
2244
  sms,
2245
+ whatsapp,
2224
2246
  verifications,
2225
2247
  inbox,
2226
2248
  preferences,
@@ -2825,6 +2847,9 @@ function policy(name) {
2825
2847
  }
2826
2848
  __name(policy, "policy");
2827
2849
  function can(table) {
2850
+ if (table === void 0 || table === null) {
2851
+ throw new Error("can(<table>): received " + String(table) + " \u2014 the schema declares no such table (check the name against db/*.ts; can(publicSchema.tables.<name>))");
2852
+ }
2828
2853
  const def = table;
2829
2854
  if (typeof def.name !== "string" || def.columns === null || typeof def.columns !== "object" || !Array.isArray(def.policies)) {
2830
2855
  throw new Error("can(<table>): expects the schema's table definition \u2014 can(publicSchema.tables.notes) \u2014 not the defineTable handle (`notes`)");
@@ -4131,7 +4156,9 @@ function tableBlock(table, relations, indent) {
4131
4156
  });
4132
4157
  const hasCanColumn = Object.prototype.hasOwnProperty.call(table.columns, "can") || relations.some((r) => r.name === "can");
4133
4158
  const canNames = (table.policies ?? []).filter((p) => p.command === "update" && p.permissive !== false && Buffer.byteLength(`can:${p.name}`, "utf8") <= 63).map((p) => JSON.stringify(p.name));
4134
- const canLine = hasCanColumn ? null : `${indent} can: ${canNames.length === 0 ? "never[]" : `(${canNames.join(" | ")})[]`};`;
4159
+ const canDoc = `${indent} /** Names of this table's UPDATE policies whose \`using\` is true for THIS row and caller \u2014 an AFFORDANCE for the interface (draw or hide a control); never an authorization decision, may be incomplete, the server decides again on every request. */`;
4160
+ const canLine = hasCanColumn ? null : `${canDoc}
4161
+ ${indent} can: ${canNames.length === 0 ? "never[]" : `(${canNames.join(" | ")})[]`};`;
4135
4162
  const insertLines = cols.map(([col2, builder]) => {
4136
4163
  const def = builder._def;
4137
4164
  const opt = optionalOnInsert(def) ? "?" : "";
@@ -4543,7 +4570,14 @@ function makeMethodDecorator(method) {
4543
4570
  if (typeof subpath !== "string") {
4544
4571
  throw new Error(`@${method[0]}${method.slice(1).toLowerCase()}(subpath) expects a string subpath, got ${typeof subpath}.` + (method === "QUERY" ? " If this is a zod schema on a method parameter: the query-string param decorator was renamed @QueryParams(schema) in @palbase/backend 9.0.0." : ""));
4545
4572
  }
4546
- return function(target, propertyKey) {
4573
+ return function(target, propertyKey, descriptor) {
4574
+ const verb = `${method[0]}${method.slice(1).toLowerCase()}`;
4575
+ if (typeof descriptor === "number") {
4576
+ throw new Error(`@${verb}(...) is a ROUTE decorator and was applied to parameter #${descriptor} of ${propertyKey === void 0 ? "the constructor" : String(propertyKey)}; for query-string params use @QueryParams(schema), for the body @Body(schema), for a path segment @Param(name)`);
4577
+ }
4578
+ if (propertyKey === void 0) {
4579
+ throw new Error(`@${verb}(...) goes on a METHOD, not on a class; put it on the handler method inside @Controller`);
4580
+ }
4547
4581
  recordRoute(target, String(propertyKey), method, subpath, options);
4548
4582
  };
4549
4583
  };