@quatrain/cloudwrapper-supabase 1.1.32 → 1.1.34

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 (2) hide show
  1. package/README.md +27 -50
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -1,70 +1,47 @@
1
- # Supabase Cloud Wrapper Package
1
+ # @quatrain/cloudwrapper-supabase
2
2
 
3
- ## Introduction
3
+ The Supabase ecosystem wrapper for `@quatrain/cloudwrapper`.
4
4
 
5
- This package provides a Cloud Wrapper for Supabase, enabling real-time database
6
- and storage triggers. It handles the WebSocket connection to Supabase's Realtime
7
- service, providing robust connection monitoring and configurable automatic reconnection logic.
5
+ ## Introduction
8
6
 
9
- ## Features
7
+ This package aggregates the initialization of:
8
+ - `@quatrain/backend-postgres` (Supabase uses standard Postgres)
9
+ - `@quatrain/storage-supabase`
10
+ - `@quatrain/auth-supabase`
10
11
 
11
- - Listens to database changes (`INSERT`, `UPDATE`, `DELETE`) on your Supabase Postgres database.
12
- - Listens to storage changes in Supabase Storage.
13
- - Monitors connection health with a heartbeat mechanism.
14
- - Provides a configurable strategy for handling disconnections (exit process or attempt to reconnect).
15
- - Consistent interface provided by `@quatrain/cloudwrapper`.
16
- - Works with both SaaS and self-hosted Supabase instances.
12
+ It provides a single configuration entry point to connect your entire Quatrain application to your Supabase project.
17
13
 
18
14
  ## Installation
19
15
 
20
16
  ```bash
21
- # With npm
22
- npm install @quatrain/cloudwrapper-supabase
23
-
24
- # With yarn
25
- yarn add @quatrain/cloudwrapper-supabase
17
+ npm install @quatrain/cloudwrapper-supabase @supabase/supabase-js pg
18
+ # or
19
+ yarn add @quatrain/cloudwrapper-supabase @supabase/supabase-js pg
26
20
  ```
27
21
 
28
- ## Usage
22
+ ## Configuration
23
+
24
+ Initialize the wrapper using your Supabase project URL, service role key, and database connection string.
29
25
 
30
26
  ```typescript
31
27
  import { CloudWrapper } from '@quatrain/cloudwrapper'
32
- import { SupabaseCloudWrapperAdapter } from '@quatrain/cloudwrapper-supabase'
33
- import { SupabaseCloudWrapper } from '@quatrain/cloudwrapper-supabase'
34
- import { BackendAction } from '@quatrain/backend'
35
-
36
- // Setup and use the adapter with the CloudWrapper singleton.
37
- const wrapper = new SupabaseCloudWrapper({
38
- url: process.env.SUPABASE_URL,
39
- key: process.env.SUPABASE_KEY,
40
- // Optional: Determines behavior on disconnection.
41
- // - `true` (default): Exits the process. Ideal for containerized
42
- // environments (e.g., Kubernetes) that will automatically restart the service.
43
- // - `false`: Attempts to reconnect internally.
44
- exitOnDisconnect: true,
28
+ import { SupabaseWrapper } from '@quatrain/cloudwrapper-supabase'
29
+
30
+ const supabaseEnv = new SupabaseWrapper({
31
+ config: {
32
+ url: process.env.SUPABASE_URL,
33
+ key: process.env.SUPABASE_SERVICE_ROLE_KEY,
34
+ connectionString: process.env.SUPABASE_DB_URL
35
+ }
45
36
  })
46
37
 
47
- // Example: Set up a trigger for new rows in a 'profiles' table
48
- wrapper.databaseTrigger({
49
- name: 'new-profile-trigger',
50
- model: 'profiles',
51
- event: BackendAction.CREATE,
52
- script: async ({ after }) => {
53
- console.log(`A new profile was created:`, after)
54
- // Add your business logic here
55
- },
56
- })
38
+ CloudWrapper.addAdapter('supabase', supabaseEnv, true)
57
39
  ```
58
40
 
59
- ### Callback Payload
41
+ ## Documentation
60
42
 
61
- The `script` callback for both `databaseTrigger` and `storageTrigger` receives
62
- an object with the following properties:
43
+ For concrete examples and usage guides, please refer to the [How-To Guide](HOWTO.md).
63
44
 
64
- - `after`: The new state of the record after the event. For `DELETE` events, this will be an empty object.
65
- - `before`: The state of the record before the event. For `INSERT` events, this will be an empty object.
66
- - `context`: An object containing additional metadata about the event, such as
67
- the schema, table, and commit timestamp provided by Supabase's Realtime service.
45
+ ## License
68
46
 
69
- For `storageTrigger`, the `before` and `after` properties are transformed into a
70
- `FileType` object, providing a standardized format for file metadata.
47
+ AGPL-3.0-only
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/cloudwrapper-supabase",
3
- "version": "1.1.32",
3
+ "version": "1.1.34",
4
4
  "license": "AGPL-3.0-only",
5
5
  "description": "Cloud Wrapper adapter for Supabase",
6
6
  "repository": {
@@ -19,13 +19,13 @@
19
19
  ],
20
20
  "author": "Quatrain Développement SAS <developers@quatrain.com>",
21
21
  "peerDependencies": {
22
- "@quatrain/core": "^1.1.48"
22
+ "@quatrain/core": "^1.1.49"
23
23
  },
24
24
  "dependencies": {
25
- "@quatrain/backend": "^1.1.34",
26
- "@quatrain/cloudwrapper": "^1.1.23",
27
- "@quatrain/core": "^1.1.48",
28
- "@quatrain/storage": "^1.1.29",
25
+ "@quatrain/backend": "^1.1.35",
26
+ "@quatrain/cloudwrapper": "^1.1.25",
27
+ "@quatrain/core": "^1.1.49",
28
+ "@quatrain/storage": "^1.1.31",
29
29
  "@supabase/supabase-js": "^2.87.3",
30
30
  "ws": "^8.18.3"
31
31
  },