krisspy-sdk 0.9.2 → 1.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.
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Krisspy SDK Types
3
3
  */
4
4
  interface KrisspyClientOptions {
5
- /** Base URL of the Krisspy API (default: https://krisspy-cloud-backend.thankfulhill-66fc9e74.westeurope.azurecontainerapps.io) */
5
+ /** Base URL of the Krisspy API (default: https://api.prod.krisspy.ai) */
6
6
  url?: string;
7
7
  /** Backend ID for this client */
8
8
  backendId: string;
@@ -640,13 +640,19 @@ interface RealtimePayload<T = any> {
640
640
  }
641
641
  type RealtimeCallback<T = any> = (payload: RealtimePayload<T>) => void;
642
642
  type ChannelState = 'closed' | 'connecting' | 'connected' | 'error';
643
+ interface ChannelSubscription {
644
+ type: 'postgres_changes';
645
+ config: PostgresChangesConfig;
646
+ callback: RealtimeCallback;
647
+ }
643
648
  /**
644
649
  * Realtime Channel - represents a subscription to database changes
645
650
  */
646
651
  declare class RealtimeChannel {
647
652
  private name;
648
653
  private realtime;
649
- private subscriptions;
654
+ /** @internal — read by KrisspyRealtime to re-subscribe after reconnect */
655
+ subscriptions: ChannelSubscription[];
650
656
  private _state;
651
657
  constructor(name: string, realtime: KrisspyRealtime);
652
658
  /**
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Krisspy SDK Types
3
3
  */
4
4
  interface KrisspyClientOptions {
5
- /** Base URL of the Krisspy API (default: https://krisspy-cloud-backend.thankfulhill-66fc9e74.westeurope.azurecontainerapps.io) */
5
+ /** Base URL of the Krisspy API (default: https://api.prod.krisspy.ai) */
6
6
  url?: string;
7
7
  /** Backend ID for this client */
8
8
  backendId: string;
@@ -640,13 +640,19 @@ interface RealtimePayload<T = any> {
640
640
  }
641
641
  type RealtimeCallback<T = any> = (payload: RealtimePayload<T>) => void;
642
642
  type ChannelState = 'closed' | 'connecting' | 'connected' | 'error';
643
+ interface ChannelSubscription {
644
+ type: 'postgres_changes';
645
+ config: PostgresChangesConfig;
646
+ callback: RealtimeCallback;
647
+ }
643
648
  /**
644
649
  * Realtime Channel - represents a subscription to database changes
645
650
  */
646
651
  declare class RealtimeChannel {
647
652
  private name;
648
653
  private realtime;
649
- private subscriptions;
654
+ /** @internal — read by KrisspyRealtime to re-subscribe after reconnect */
655
+ subscriptions: ChannelSubscription[];
650
656
  private _state;
651
657
  constructor(name: string, realtime: KrisspyRealtime);
652
658
  /**
package/dist/index.js CHANGED
@@ -1018,6 +1018,7 @@ var KrisspyStorage = class {
1018
1018
  // src/realtime.ts
1019
1019
  var RealtimeChannel = class {
1020
1020
  constructor(name, realtime) {
1021
+ /** @internal — read by KrisspyRealtime to re-subscribe after reconnect */
1021
1022
  this.subscriptions = [];
1022
1023
  this._state = "closed";
1023
1024
  this.name = name;
@@ -1286,8 +1287,14 @@ var KrisspyRealtime = class {
1286
1287
  this.log(`Reconnecting in ${delay}ms (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts})`);
1287
1288
  setTimeout(() => {
1288
1289
  this.connect().then(() => {
1290
+ if (this.token) {
1291
+ this.send({ type: "auth", token: this.token });
1292
+ }
1289
1293
  for (const [name, channel] of this.channels) {
1290
1294
  this.log(`Re-subscribing to channel: ${name}`);
1295
+ for (const sub of channel.subscriptions) {
1296
+ this.sendSubscribe(name, sub.config);
1297
+ }
1291
1298
  }
1292
1299
  }).catch((error) => {
1293
1300
  console.error("[Krisspy Realtime] Reconnect failed:", error);
@@ -2099,7 +2106,7 @@ var QueryBuilder = class {
2099
2106
  var KrisspyClient = class {
2100
2107
  constructor(options) {
2101
2108
  var _a;
2102
- this.baseUrl = options.url || "https://krisspy-cloud-backend.thankfulhill-66fc9e74.westeurope.azurecontainerapps.io";
2109
+ this.baseUrl = options.url || "https://api.prod.krisspy.ai";
2103
2110
  this.backendId = options.backendId;
2104
2111
  this.debug = options.debug || false;
2105
2112
  this.functionsUrl = ((_a = options.functionsUrl) == null ? void 0 : _a.replace(/\/$/, "")) || null;
package/dist/index.mjs CHANGED
@@ -973,6 +973,7 @@ var KrisspyStorage = class {
973
973
  // src/realtime.ts
974
974
  var RealtimeChannel = class {
975
975
  constructor(name, realtime) {
976
+ /** @internal — read by KrisspyRealtime to re-subscribe after reconnect */
976
977
  this.subscriptions = [];
977
978
  this._state = "closed";
978
979
  this.name = name;
@@ -1241,8 +1242,14 @@ var KrisspyRealtime = class {
1241
1242
  this.log(`Reconnecting in ${delay}ms (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts})`);
1242
1243
  setTimeout(() => {
1243
1244
  this.connect().then(() => {
1245
+ if (this.token) {
1246
+ this.send({ type: "auth", token: this.token });
1247
+ }
1244
1248
  for (const [name, channel] of this.channels) {
1245
1249
  this.log(`Re-subscribing to channel: ${name}`);
1250
+ for (const sub of channel.subscriptions) {
1251
+ this.sendSubscribe(name, sub.config);
1252
+ }
1246
1253
  }
1247
1254
  }).catch((error) => {
1248
1255
  console.error("[Krisspy Realtime] Reconnect failed:", error);
@@ -2054,7 +2061,7 @@ var QueryBuilder = class {
2054
2061
  var KrisspyClient = class {
2055
2062
  constructor(options) {
2056
2063
  var _a;
2057
- this.baseUrl = options.url || "https://krisspy-cloud-backend.thankfulhill-66fc9e74.westeurope.azurecontainerapps.io";
2064
+ this.baseUrl = options.url || "https://api.prod.krisspy.ai";
2058
2065
  this.backendId = options.backendId;
2059
2066
  this.debug = options.debug || false;
2060
2067
  this.functionsUrl = ((_a = options.functionsUrl) == null ? void 0 : _a.replace(/\/$/, "")) || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "krisspy-sdk",
3
- "version": "0.9.2",
3
+ "version": "1.0.0",
4
4
  "description": "Krisspy Cloud SDK - Database, Auth, Storage, and Functions for your apps",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",