@dataferry/sdk 0.1.0 → 0.1.1

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 +15 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -21,6 +21,7 @@ const ferry = new Ferry({
21
21
 
22
22
  // Create a portal session for an end user
23
23
  const session = await ferry.createPortalSession({
24
+ profile: 'default',
24
25
  scopeId: 'user_123',
25
26
  returnUrl: 'https://app.example.com/settings',
26
27
  });
@@ -36,23 +37,26 @@ const session = await ferry.createPortalSession({
36
37
  The simplest way to let users export their data is through the portal:
37
38
 
38
39
  ```typescript
39
- // Multi-tenant: specify the scope ID (typically user ID)
40
+ // With a scope ID (filters exported data to this user)
40
41
  const session = await ferry.createPortalSession({
42
+ profile: 'default',
41
43
  scopeId: 'user_123',
42
44
  returnUrl: 'https://app.example.com/settings',
43
45
  });
44
46
 
45
- // Single-tenant: no scopeId needed
47
+ // Without a scope ID (exports all data)
46
48
  const session = await ferry.createPortalSession({
49
+ profile: 'default',
47
50
  returnUrl: 'https://app.example.com/settings',
48
51
  });
49
52
 
50
53
  // With all options
51
54
  const session = await ferry.createPortalSession({
55
+ profile: 'default',
52
56
  scopeId: 'user_123',
53
- connectionId: 'conn_abc', // Use a specific database connection
54
57
  returnUrl: 'https://...', // Where to redirect after export
55
58
  expiresIn: 3600, // Session duration in seconds
59
+ email: 'user@example.com', // Notify when export completes
56
60
  metadata: { plan: 'pro' }, // Custom metadata
57
61
  });
58
62
 
@@ -105,7 +109,6 @@ const result = await ferry.connections.test(connection.id);
105
109
  if (result.connected) {
106
110
  console.log(`Connected to ${result.database}`);
107
111
  }
108
-
109
112
  ```
110
113
 
111
114
  ## API Reference
@@ -128,10 +131,11 @@ Creates a portal session for an end user.
128
131
 
129
132
  | Parameter | Type | Description |
130
133
  |-----------|------|-------------|
131
- | `scopeId` | `string?` | The scope ID for data filtering (optional for single-tenant) |
132
- | `connectionId` | `string?` | Database connection ID (defaults to primary) |
134
+ | `profile` | `string` | Export profile name (required) |
135
+ | `scopeId` | `string?` | Scope ID for data filtering (omit to export all data) |
133
136
  | `returnUrl` | `string?` | URL to redirect after export |
134
- | `expiresIn` | `number?` | Session duration in seconds |
137
+ | `expiresIn` | `number?` | Session duration in seconds (default: 3600) |
138
+ | `email` | `string?` | End-user email for export completion notifications |
135
139
  | `metadata` | `object?` | Custom metadata |
136
140
 
137
141
  Returns: `{ id: string, url: string, expiresAt: Date }`
@@ -170,7 +174,10 @@ Portal session management (advanced).
170
174
  import { Ferry, FerryError } from '@dataferry/sdk';
171
175
 
172
176
  try {
173
- const session = await ferry.createPortalSession({ scopeId: 'user_123' });
177
+ const session = await ferry.createPortalSession({
178
+ profile: 'default',
179
+ scopeId: 'user_123',
180
+ });
174
181
  } catch (error) {
175
182
  if (error instanceof FerryError) {
176
183
  console.error(`API Error: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataferry/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Node.js SDK for DataFerry - data export infrastructure for SaaS companies",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",