@palbase/backend 22.0.1 → 22.1.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 (42) hide show
  1. package/dist/bin/palbase-backend.cjs +340 -22
  2. package/dist/bin/palbase-backend.cjs.map +1 -1
  3. package/dist/bin/palbase-backend.js +2 -2
  4. package/dist/{chunk-QYOHMVUW.js → chunk-74XDEF5J.js} +338 -22
  5. package/dist/chunk-74XDEF5J.js.map +1 -0
  6. package/dist/{chunk-SSGAMC26.js → chunk-I3ON7MYF.js} +57 -5
  7. package/dist/chunk-I3ON7MYF.js.map +1 -0
  8. package/dist/{chunk-POYAFBLF.js → chunk-SQC5EIWY.js} +5 -3
  9. package/dist/chunk-SQC5EIWY.js.map +1 -0
  10. package/dist/db/index.cjs +60 -6
  11. package/dist/db/index.cjs.map +1 -1
  12. package/dist/db/index.d.cts +2 -2
  13. package/dist/db/index.d.ts +2 -2
  14. package/dist/db/index.js +7 -3
  15. package/dist/{endpoint-B0LpZixz.d.cts → endpoint-BVT6jcVW.d.cts} +39 -7
  16. package/dist/{endpoint-B0LpZixz.d.ts → endpoint-BVT6jcVW.d.ts} +39 -7
  17. package/dist/engine/index.cjs +340 -22
  18. package/dist/engine/index.cjs.map +1 -1
  19. package/dist/engine/index.d.cts +4 -4
  20. package/dist/engine/index.d.ts +4 -4
  21. package/dist/engine/index.js +2 -2
  22. package/dist/{index-B4W6d2VJ.d.cts → index-BS1gW4nV.d.cts} +24 -25
  23. package/dist/{index-BGSCWlUa.d.cts → index-BqCiHao8.d.cts} +97 -7
  24. package/dist/{index-BCNtlG1w.d.ts → index-CCZqzych.d.ts} +24 -25
  25. package/dist/{index-g-EzitI-.d.ts → index-vwHoS0l2.d.ts} +97 -7
  26. package/dist/index.cjs +244 -6
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +124 -9
  29. package/dist/index.d.ts +124 -9
  30. package/dist/index.js +186 -3
  31. package/dist/index.js.map +1 -1
  32. package/dist/openapi/index.d.cts +2 -2
  33. package/dist/openapi/index.d.ts +2 -2
  34. package/dist/{registry-Cw0YEYCg.d.cts → registry-BWttGlaT.d.cts} +1 -1
  35. package/dist/{registry-3BLYv4si.d.ts → registry-Bsuf-orT.d.ts} +1 -1
  36. package/docs/endpoints.md +1 -1
  37. package/docs/errors.md +9 -0
  38. package/docs/llms-full.txt +10 -1
  39. package/package.json +2 -2
  40. package/dist/chunk-POYAFBLF.js.map +0 -1
  41. package/dist/chunk-QYOHMVUW.js.map +0 -1
  42. package/dist/chunk-SSGAMC26.js.map +0 -1
@@ -1562,6 +1562,22 @@ interface PalbaseFlagsClient {
1562
1562
  * await Realtime.broadcast("room:42", "message", { text, from: user.id });
1563
1563
  */
1564
1564
  interface PalbaseRealtimeClient {
1565
+ /**
1566
+ * A channel's SHARED STATE — a keyed map every subscriber sees, including
1567
+ * the ones that join later.
1568
+ *
1569
+ * That is the whole difference from `broadcast`: a broadcast reaches whoever
1570
+ * is listening at that instant, and a client connecting a second afterwards
1571
+ * learns nothing until the next one. State is handed to every joiner in the
1572
+ * snapshot they get, so "the score is 3-1" or "this flag is now on" arrives
1573
+ * even for a client that was not there when it changed.
1574
+ */
1575
+ state: {
1576
+ /** Write one entry. Fire-and-forget, like `broadcast`. */
1577
+ set(topic: string, key: string, value: Record<string, unknown>): Promise<PalbaseResult<void>>;
1578
+ /** Remove one entry. */
1579
+ clear(topic: string, key: string): Promise<PalbaseResult<void>>;
1580
+ };
1565
1581
  /**
1566
1582
  * Broadcast `event` with `payload` to everyone subscribed to `channel`.
1567
1583
  *
@@ -1811,6 +1827,15 @@ interface DBOps {
1811
1827
  update(table: string, id: string, data: Record<string, unknown>): Promise<Record<string, unknown> | null>;
1812
1828
  delete(table: string, id: string): Promise<void>;
1813
1829
  findById(table: string, id: string): Promise<Record<string, unknown> | null>;
1830
+ /** Hibrit arama (FR-013/014) — tek SQL, RRF; engine implement eder (T017). */
1831
+ search(table: string, params?: {
1832
+ query?: string;
1833
+ vector?: number[];
1834
+ where?: Record<string, unknown>;
1835
+ limit?: number;
1836
+ using?: string;
1837
+ mode?: "hybrid" | "text" | "vector";
1838
+ }): Promise<Record<string, unknown>[]>;
1814
1839
  findMany(table: string, query?: Record<string, unknown>): Promise<Record<string, unknown>[]>;
1815
1840
  }
1816
1841
  /** Database client interface injected into endpoint context. */
@@ -1963,19 +1988,26 @@ interface PalbaseDocsClient {
1963
1988
  }
1964
1989
  /** Calling-client metadata, derived from request headers.
1965
1990
  *
1966
- * Populated from the `X-Palbase-*-Version` / platform headers the client SDKs
1967
- * send. All fields are nullable: a request may come from a non-SDK caller
1968
- * (curl, server-to-server) that sends none of them. The semver comparison
1969
- * helpers (`appVersionAtLeast`, …) arrive in Phase 2 Phase 1 surfaces only
1970
- * the raw data fields. */
1991
+ * Every header is named here, because the previous version of this comment named
1992
+ * only two of the four and the next reader invented `X-Palbase-Platform` for the
1993
+ * third. The four are canonical across the platform the same names the Go
1994
+ * side reads in user-flags/internal/middleware/clientcontext.goand the deploy
1995
+ * gate REFUSES an `@Headers` schema that declares an `x-palbase-*` key, which
1996
+ * makes `@Client()` the only sanctioned way to read them.
1997
+ *
1998
+ * All fields are nullable: a request may come from a non-SDK caller (curl,
1999
+ * server-to-server) that sends none of them. Note that the web SDK does not
2000
+ * send `X-Palbase-Sdk-Version` at all, so `sdkVersion` is null for every browser
2001
+ * caller. The semver comparison helpers (`appVersionAtLeast`, …) arrive in
2002
+ * Phase 2 — Phase 1 surfaces only the raw data fields. */
1971
2003
  interface ClientInfo {
1972
2004
  /** Palbase SDK version (`X-Palbase-Sdk-Version`), or null. */
1973
2005
  sdkVersion: string | null;
1974
2006
  /** Calling app's own version (`X-Palbase-Client-Version`), or null. */
1975
2007
  appVersion: string | null;
1976
- /** Platform identifier (e.g. "ios", "android", "web"), or null. */
2008
+ /** Platform identifier (`X-Platform`, e.g. "ios", "android", "web"), or null. */
1977
2009
  platform: string | null;
1978
- /** OS version string, or null. */
2010
+ /** OS version string (`X-OS-Version`), or null. */
1979
2011
  osVersion: string | null;
1980
2012
  }
1981
2013
  /** Palbase module clients, as a structural bundle.
@@ -1562,6 +1562,22 @@ interface PalbaseFlagsClient {
1562
1562
  * await Realtime.broadcast("room:42", "message", { text, from: user.id });
1563
1563
  */
1564
1564
  interface PalbaseRealtimeClient {
1565
+ /**
1566
+ * A channel's SHARED STATE — a keyed map every subscriber sees, including
1567
+ * the ones that join later.
1568
+ *
1569
+ * That is the whole difference from `broadcast`: a broadcast reaches whoever
1570
+ * is listening at that instant, and a client connecting a second afterwards
1571
+ * learns nothing until the next one. State is handed to every joiner in the
1572
+ * snapshot they get, so "the score is 3-1" or "this flag is now on" arrives
1573
+ * even for a client that was not there when it changed.
1574
+ */
1575
+ state: {
1576
+ /** Write one entry. Fire-and-forget, like `broadcast`. */
1577
+ set(topic: string, key: string, value: Record<string, unknown>): Promise<PalbaseResult<void>>;
1578
+ /** Remove one entry. */
1579
+ clear(topic: string, key: string): Promise<PalbaseResult<void>>;
1580
+ };
1565
1581
  /**
1566
1582
  * Broadcast `event` with `payload` to everyone subscribed to `channel`.
1567
1583
  *
@@ -1811,6 +1827,15 @@ interface DBOps {
1811
1827
  update(table: string, id: string, data: Record<string, unknown>): Promise<Record<string, unknown> | null>;
1812
1828
  delete(table: string, id: string): Promise<void>;
1813
1829
  findById(table: string, id: string): Promise<Record<string, unknown> | null>;
1830
+ /** Hibrit arama (FR-013/014) — tek SQL, RRF; engine implement eder (T017). */
1831
+ search(table: string, params?: {
1832
+ query?: string;
1833
+ vector?: number[];
1834
+ where?: Record<string, unknown>;
1835
+ limit?: number;
1836
+ using?: string;
1837
+ mode?: "hybrid" | "text" | "vector";
1838
+ }): Promise<Record<string, unknown>[]>;
1814
1839
  findMany(table: string, query?: Record<string, unknown>): Promise<Record<string, unknown>[]>;
1815
1840
  }
1816
1841
  /** Database client interface injected into endpoint context. */
@@ -1963,19 +1988,26 @@ interface PalbaseDocsClient {
1963
1988
  }
1964
1989
  /** Calling-client metadata, derived from request headers.
1965
1990
  *
1966
- * Populated from the `X-Palbase-*-Version` / platform headers the client SDKs
1967
- * send. All fields are nullable: a request may come from a non-SDK caller
1968
- * (curl, server-to-server) that sends none of them. The semver comparison
1969
- * helpers (`appVersionAtLeast`, …) arrive in Phase 2 Phase 1 surfaces only
1970
- * the raw data fields. */
1991
+ * Every header is named here, because the previous version of this comment named
1992
+ * only two of the four and the next reader invented `X-Palbase-Platform` for the
1993
+ * third. The four are canonical across the platform the same names the Go
1994
+ * side reads in user-flags/internal/middleware/clientcontext.goand the deploy
1995
+ * gate REFUSES an `@Headers` schema that declares an `x-palbase-*` key, which
1996
+ * makes `@Client()` the only sanctioned way to read them.
1997
+ *
1998
+ * All fields are nullable: a request may come from a non-SDK caller (curl,
1999
+ * server-to-server) that sends none of them. Note that the web SDK does not
2000
+ * send `X-Palbase-Sdk-Version` at all, so `sdkVersion` is null for every browser
2001
+ * caller. The semver comparison helpers (`appVersionAtLeast`, …) arrive in
2002
+ * Phase 2 — Phase 1 surfaces only the raw data fields. */
1971
2003
  interface ClientInfo {
1972
2004
  /** Palbase SDK version (`X-Palbase-Sdk-Version`), or null. */
1973
2005
  sdkVersion: string | null;
1974
2006
  /** Calling app's own version (`X-Palbase-Client-Version`), or null. */
1975
2007
  appVersion: string | null;
1976
- /** Platform identifier (e.g. "ios", "android", "web"), or null. */
2008
+ /** Platform identifier (`X-Platform`, e.g. "ios", "android", "web"), or null. */
1977
2009
  platform: string | null;
1978
- /** OS version string, or null. */
2010
+ /** OS version string (`X-OS-Version`), or null. */
1979
2011
  osVersion: string | null;
1980
2012
  }
1981
2013
  /** Palbase module clients, as a structural bundle.