@quatrain/cloudwrapper-supabase 1.1.36 → 1.2.2

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.
@@ -12,17 +12,33 @@ export declare const eventMap: {
12
12
  update: string;
13
13
  delete: string;
14
14
  };
15
+ /**
16
+ * Concrete implementation adapting Supabase realtime channels and functions.
17
+ */
15
18
  export declare class SupabaseCloudWrapper extends AbstractCloudWrapper {
16
19
  protected _supabaseClient: SupabaseClient | undefined;
17
20
  protected _isInitialized: boolean;
18
21
  protected _heartbeatOkReceived: boolean;
19
22
  protected _connectionTimeout: NodeJS.Timeout | undefined;
20
23
  constructor(params: SupabaseParams);
24
+ /**
25
+ * Binds a PostgreSQL Realtime subscription to track CRUD events on tables.
26
+ *
27
+ * @param trigger - Configuration defining the targeted table, event, and callback script.
28
+ * @returns Event subscription payload params.
29
+ * @throws {TypeError} If script or client is improperly configured.
30
+ */
21
31
  databaseTrigger(trigger: DatabaseTriggerType): void | {
22
32
  event: any;
23
33
  schema: string;
24
34
  table: string;
25
35
  };
36
+ /**
37
+ * Binds a Storage object modification realtime subscription.
38
+ *
39
+ * @param trigger - Configuration specifying file bucket logic constraints.
40
+ * @returns Event subscription payload params.
41
+ */
26
42
  storageTrigger(trigger: StorageTriggerType): void | {
27
43
  event: any;
28
44
  schema: string;
@@ -33,6 +33,9 @@ exports.eventMap = {
33
33
  [backend_1.BackendAction.UPDATE]: 'UPDATE',
34
34
  [backend_1.BackendAction.DELETE]: 'DELETE',
35
35
  };
36
+ /**
37
+ * Concrete implementation adapting Supabase realtime channels and functions.
38
+ */
36
39
  class SupabaseCloudWrapper extends cloudwrapper_1.AbstractCloudWrapper {
37
40
  constructor(params) {
38
41
  super(params);
@@ -40,6 +43,13 @@ class SupabaseCloudWrapper extends cloudwrapper_1.AbstractCloudWrapper {
40
43
  this._heartbeatOkReceived = false;
41
44
  this._initialize();
42
45
  }
46
+ /**
47
+ * Binds a PostgreSQL Realtime subscription to track CRUD events on tables.
48
+ *
49
+ * @param trigger - Configuration defining the targeted table, event, and callback script.
50
+ * @returns Event subscription payload params.
51
+ * @throws {TypeError} If script or client is improperly configured.
52
+ */
43
53
  databaseTrigger(trigger) {
44
54
  var _a;
45
55
  this._initialize();
@@ -81,6 +91,12 @@ class SupabaseCloudWrapper extends cloudwrapper_1.AbstractCloudWrapper {
81
91
  throw new Error(`Realtime channel subscription failed`);
82
92
  }
83
93
  }
94
+ /**
95
+ * Binds a Storage object modification realtime subscription.
96
+ *
97
+ * @param trigger - Configuration specifying file bucket logic constraints.
98
+ * @returns Event subscription payload params.
99
+ */
84
100
  storageTrigger(trigger) {
85
101
  var _a;
86
102
  this._initialize();
@@ -113,8 +113,7 @@ describe('SupabaseCloudWrapper', () => {
113
113
  expect(wrapper._connectionTimeout).toBe(initialTimeout);
114
114
  });
115
115
  it('should handle "timeout" status', () => {
116
- // Should not throw or exit
117
- expect(() => heartbeatCallback('timeout')).not.toThrow();
116
+ expect(() => heartbeatCallback('timeout')).toThrow('process.exit called');
118
117
  });
119
118
  it('should reconnect on "disconnected" when exitOnDisconnect is false', () => {
120
119
  wrapper = new SupabaseCloudWrapper_1.SupabaseCloudWrapper({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/cloudwrapper-supabase",
3
- "version": "1.1.36",
3
+ "version": "1.2.2",
4
4
  "license": "AGPL-3.0-only",
5
5
  "description": "Cloud Wrapper adapter for Supabase",
6
6
  "repository": {
@@ -20,13 +20,13 @@
20
20
  ],
21
21
  "author": "Quatrain Développement SAS <developers@quatrain.com>",
22
22
  "peerDependencies": {
23
- "@quatrain/core": "^1.1.51"
23
+ "@quatrain/core": "^1.2.8"
24
24
  },
25
25
  "dependencies": {
26
- "@quatrain/backend": "^1.1.37",
27
- "@quatrain/cloudwrapper": "^1.1.27",
28
- "@quatrain/core": "^1.1.51",
29
- "@quatrain/storage": "^1.1.33",
26
+ "@quatrain/backend": "^1.2.7",
27
+ "@quatrain/cloudwrapper": "^1.2.1",
28
+ "@quatrain/core": "^1.2.8",
29
+ "@quatrain/storage": "^1.2.8",
30
30
  "@supabase/supabase-js": "^2.87.3",
31
31
  "ws": "^8.18.3"
32
32
  },
@@ -48,5 +48,8 @@
48
48
  "build": "tsc",
49
49
  "wbuild": "tsc --watch",
50
50
  "bump-to": "yarn version"
51
+ },
52
+ "typedoc": {
53
+ "entryPoint": "src/index.ts"
51
54
  }
52
55
  }
@@ -132,8 +132,7 @@ describe('SupabaseCloudWrapper', () => {
132
132
  })
133
133
 
134
134
  it('should handle "timeout" status', () => {
135
- // Should not throw or exit
136
- expect(() => heartbeatCallback('timeout')).not.toThrow()
135
+ expect(() => heartbeatCallback('timeout')).toThrow('process.exit called')
137
136
  })
138
137
 
139
138
  it('should reconnect on "disconnected" when exitOnDisconnect is false', () => {
@@ -25,6 +25,9 @@ export const eventMap = {
25
25
  [BackendAction.DELETE]: 'DELETE',
26
26
  }
27
27
 
28
+ /**
29
+ * Concrete implementation adapting Supabase realtime channels and functions.
30
+ */
28
31
  export class SupabaseCloudWrapper extends AbstractCloudWrapper {
29
32
  protected _supabaseClient: SupabaseClient | undefined
30
33
  protected _isInitialized = false
@@ -36,6 +39,13 @@ export class SupabaseCloudWrapper extends AbstractCloudWrapper {
36
39
  this._initialize()
37
40
  }
38
41
 
42
+ /**
43
+ * Binds a PostgreSQL Realtime subscription to track CRUD events on tables.
44
+ *
45
+ * @param trigger - Configuration defining the targeted table, event, and callback script.
46
+ * @returns Event subscription payload params.
47
+ * @throws {TypeError} If script or client is improperly configured.
48
+ */
39
49
  databaseTrigger(trigger: DatabaseTriggerType) {
40
50
  this._initialize()
41
51
 
@@ -95,6 +105,12 @@ export class SupabaseCloudWrapper extends AbstractCloudWrapper {
95
105
  }
96
106
  }
97
107
 
108
+ /**
109
+ * Binds a Storage object modification realtime subscription.
110
+ *
111
+ * @param trigger - Configuration specifying file bucket logic constraints.
112
+ * @returns Event subscription payload params.
113
+ */
98
114
  storageTrigger(trigger: StorageTriggerType) {
99
115
  this._initialize()
100
116