@fluentcommerce/fc-connect-sdk 0.1.48 → 0.1.52

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 (47) hide show
  1. package/CHANGELOG.md +506 -379
  2. package/README.md +343 -0
  3. package/dist/cjs/clients/fluent-client.js +110 -14
  4. package/dist/cjs/data-sources/s3-data-source.js +1 -1
  5. package/dist/cjs/data-sources/sftp-data-source.js +1 -1
  6. package/dist/cjs/index.d.ts +1 -1
  7. package/dist/cjs/services/extraction/extraction-orchestrator.d.ts +4 -1
  8. package/dist/cjs/services/extraction/extraction-orchestrator.js +84 -11
  9. package/dist/cjs/types/index.d.ts +79 -10
  10. package/dist/cjs/versori/fluent-versori-client.d.ts +4 -1
  11. package/dist/cjs/versori/fluent-versori-client.js +131 -13
  12. package/dist/esm/clients/fluent-client.js +110 -14
  13. package/dist/esm/data-sources/s3-data-source.js +1 -1
  14. package/dist/esm/data-sources/sftp-data-source.js +1 -1
  15. package/dist/esm/index.d.ts +1 -1
  16. package/dist/esm/services/extraction/extraction-orchestrator.d.ts +4 -1
  17. package/dist/esm/services/extraction/extraction-orchestrator.js +84 -11
  18. package/dist/esm/types/index.d.ts +79 -10
  19. package/dist/esm/versori/fluent-versori-client.d.ts +4 -1
  20. package/dist/esm/versori/fluent-versori-client.js +131 -13
  21. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  22. package/dist/tsconfig.tsbuildinfo +1 -1
  23. package/dist/tsconfig.types.tsbuildinfo +1 -1
  24. package/dist/types/index.d.ts +1 -1
  25. package/dist/types/services/extraction/extraction-orchestrator.d.ts +4 -1
  26. package/dist/types/types/index.d.ts +79 -10
  27. package/dist/types/versori/fluent-versori-client.d.ts +4 -1
  28. package/docs/02-CORE-GUIDES/api-reference/event-api-input-output-reference.md +478 -18
  29. package/docs/02-CORE-GUIDES/api-reference/modules/api-reference-01-client-api.md +83 -0
  30. package/docs/02-CORE-GUIDES/api-reference/modules/api-reference-08-types.md +52 -0
  31. package/docs/02-CORE-GUIDES/api-reference/modules/api-reference-12-partial-responses.md +212 -0
  32. package/docs/02-CORE-GUIDES/api-reference/readme.md +1 -1
  33. package/docs/02-CORE-GUIDES/extraction/modules/02-core-guides-extraction-08-extraction-orchestrator.md +68 -4
  34. package/docs/02-CORE-GUIDES/mapping/modules/mapping-01-foundations.md +450 -448
  35. package/docs/02-CORE-GUIDES/mapping/modules/mapping-02-quick-start.md +476 -474
  36. package/docs/02-CORE-GUIDES/mapping/modules/mapping-03-schema-validation.md +464 -462
  37. package/docs/02-CORE-GUIDES/mapping/modules/mapping-05-advanced-patterns.md +1366 -1364
  38. package/docs/readme.md +245 -245
  39. package/package.json +17 -6
  40. package/docs/versori-apis/ACTIVATIONS-AND-VARIABLES-GUIDE.md +0 -60
  41. package/docs/versori-apis/JWT-GENERATION-GUIDE.md +0 -94
  42. package/docs/versori-apis/QUICK-WORKFLOW.md +0 -293
  43. package/docs/versori-apis/README.md +0 -73
  44. package/docs/versori-apis/VERSORI-PLATFORM-ARCHITECTURE.md +0 -880
  45. package/docs/versori-apis/Versori-Platform-API.postman_collection.json +0 -2925
  46. package/docs/versori-apis/Versori-Platform-API.postman_environment.example.json +0 -62
  47. package/docs/versori-apis/Versori-Platform-API.postman_environment.json +0 -178
@@ -1,94 +0,0 @@
1
- # Versori JWT Generation Guide
2
-
3
- This guide explains how to generate JWT tokens for the Versori Platform API using your private key.
4
-
5
- ## Prerequisites
6
-
7
- - **Private Key**: You need the RSA private key associated with your Signing Key ID.
8
- - **Signing Key ID**: The ID of the signing key in the Versori Platform.
9
-
10
- ## JWT Structure
11
-
12
- The JWT must be signed using `RS256` algorithm and contain the following claims:
13
-
14
- - **Header**:
15
- ```json
16
- {
17
- "alg": "RS256",
18
- "kid": "YOUR_SIGNING_KEY_ID"
19
- }
20
- ```
21
-
22
- - **Payload**:
23
- ```json
24
- {
25
- "sub": "api-access", // or End User ID
26
- "iss": "https://versori.com/sk/YOUR_SIGNING_KEY_ID",
27
- "iat": 1678886400, // Current timestamp (seconds)
28
- "exp": 1994446400 // Expiration timestamp (seconds)
29
- }
30
- ```
31
-
32
- ## Node.js Script
33
-
34
- You can use the following Node.js script to generate a token.
35
-
36
- **File:** `generate-versori-jwt.js`
37
-
38
- ```javascript
39
- const crypto = require('crypto');
40
-
41
- // YOUR PRIVATE KEY HERE
42
- const PRIVATE_KEY = `-----BEGIN PRIVATE KEY-----
43
- ...
44
- -----END PRIVATE KEY-----`;
45
-
46
- // YOUR SIGNING KEY ID HERE
47
- const SIGNING_KEY_ID = 'YOUR_SIGNING_KEY_ID_HERE';
48
-
49
- function generateJWT(subject = 'api-access', expiresInSeconds = 3600) {
50
- const header = {
51
- alg: 'RS256',
52
- kid: SIGNING_KEY_ID
53
- };
54
-
55
- const now = Math.floor(Date.now() / 1000);
56
- const payload = {
57
- sub: subject,
58
- iss: `https://versori.com/sk/${SIGNING_KEY_ID}`,
59
- iat: now,
60
- exp: now + expiresInSeconds
61
- };
62
-
63
- const encodedHeader = Buffer.from(JSON.stringify(header))
64
- .toString('base64url')
65
- .replace(/=/g, '');
66
-
67
- const encodedPayload = Buffer.from(JSON.stringify(payload))
68
- .toString('base64url')
69
- .replace(/=/g, '');
70
-
71
- const signatureInput = `${encodedHeader}.${encodedPayload}`;
72
- const signature = crypto
73
- .createSign('RSA-SHA256')
74
- .update(signatureInput)
75
- .sign(PRIVATE_KEY, 'base64url')
76
- .replace(/=/g, '');
77
-
78
- return `${encodedHeader}.${encodedPayload}.${signature}`;
79
- }
80
-
81
- console.log(generateJWT());
82
- ```
83
-
84
- ## Usage
85
-
86
- 1. **Generate Token**: Run the script to get your JWT.
87
- 2. **Use in Header**: Add the token to your API requests:
88
- ```
89
- Authorization: JWT <your_token>
90
- ```
91
-
92
- **Note**: The prefix is `JWT`, not `Bearer`.
93
-
94
-
@@ -1,293 +0,0 @@
1
- # Versori Platform API - Quick Workflow Guide
2
-
3
- **Common tasks using the Postman collection**
4
-
5
- ---
6
-
7
- ## 🚀 Quick Start: Add User to Project
8
-
9
- **Goal:** Activate a new user on a project with their specific variables
10
-
11
- ### Step 1: Get Project Details
12
- ```
13
- GET /o/{org_id}/projects/{project_id}
14
- ```
15
- **Save from response:**
16
- - `environments[0].id` → Use as `environment_id`
17
-
18
- ---
19
-
20
- ### Step 2: Get Connection Templates
21
- ```
22
- GET /o/{org_id}/projects/{project_id}/connection-templates
23
- ```
24
- **Save from response:**
25
- - Template IDs you need (e.g., for S3, Shopify, etc.)
26
-
27
- ---
28
-
29
- ### Step 3: Create User (if new)
30
- ```
31
- POST /o/{org_id}/users
32
- {
33
- "externalId": "customer-123",
34
- "displayName": "Customer Name"
35
- }
36
- ```
37
- **Save from response:**
38
- - `id` → Use as `user_id`
39
-
40
- ---
41
-
42
- ### Step 4: Get or Create Connection
43
- ```
44
- GET /o/{org_id}/connections
45
- ```
46
- Find existing connection OR create new:
47
- ```
48
- POST /o/{org_id}/connections
49
- {
50
- "name": "Customer S3 Connection",
51
- "type": "s3",
52
- "credentials": {
53
- "accessKeyId": "...",
54
- "secretAccessKey": "..."
55
- }
56
- }
57
- ```
58
- **Save from response:**
59
- - `id` → Use as `connection_id`
60
-
61
- ---
62
-
63
- ### Step 5: Activate User
64
- ```
65
- POST /o/{org_id}/activations
66
- {
67
- "userId": "{user_id}",
68
- "environmentId": "{environment_id}",
69
- "connections": [
70
- {
71
- "connectionTemplateId": "{template_id}",
72
- "existingConnectionId": "{connection_id}"
73
- }
74
- ],
75
- "dynamicVariables": {
76
- "apiKey": "customer-api-key",
77
- "accountId": "12345",
78
- "customSetting": "value"
79
- }
80
- }
81
- ```
82
- **Save from response:**
83
- - `id` → Use as `activation_id`
84
-
85
- ---
86
-
87
- ## 📋 View User's Current Setup
88
-
89
- ### Get Activation (includes variables!)
90
- ```
91
- GET /o/{org_id}/activations/{activation_id}
92
- ```
93
-
94
- **Response includes:**
95
- ```json
96
- {
97
- "id": "activation_id",
98
- "user": {
99
- "id": "...",
100
- "displayName": "Customer Name"
101
- },
102
- "environment": {
103
- "id": "...",
104
- "name": "production"
105
- },
106
- "connections": [...],
107
- "dynamicVariables": { ← Current variable values
108
- "apiKey": "customer-api-key",
109
- "accountId": "12345"
110
- }
111
- }
112
- ```
113
-
114
- ---
115
-
116
- ## ✏️ Update User Variables
117
-
118
- ### Update Multiple Variables
119
- ```
120
- PATCH /o/{org_id}/environments/{env_id}/activations/{activation_id}/variables
121
- {
122
- "apiKey": "new-api-key",
123
- "accountId": "67890"
124
- }
125
- ```
126
-
127
- ### Update Single Variable
128
- ```
129
- PUT /o/{org_id}/environments/{env_id}/activations/{activation_id}/variables/{variable_name}
130
- {
131
- "value": "new-value"
132
- }
133
- ```
134
-
135
- **⚠️ Important:** If any **required** variables are missing, you must include them even if not changing them.
136
-
137
- ---
138
-
139
- ## 🗂️ Manage Project Files
140
-
141
- ### Upload Files
142
- ```
143
- PUT /o/{org_id}/projects/{project_id}/files
144
- (multipart/form-data with your code files)
145
- ```
146
-
147
- ### Download Files
148
- ```
149
- GET /o/{org_id}/projects/{project_id}/files
150
- ```
151
-
152
- ---
153
-
154
- ## 📊 Get Project Logs
155
-
156
- ### Time-Based Logs
157
- ```
158
- GET /o/{org_id}/projects/{project_id}/logs?project_env=production&start=2025-01-01T00:00:00Z&end=2025-01-19T23:59:59Z&limit=500
159
- ```
160
-
161
- **Query Parameters:**
162
- - `project_env`: "production", "staging", etc.
163
- - `start`: ISO timestamp or Unix timestamp
164
- - `end`: ISO timestamp or Unix timestamp
165
- - `limit`: Number of logs (max varies)
166
- - `nextToken`: For pagination (from previous response)
167
-
168
- ---
169
-
170
- ## 🔍 List All Users and Activations
171
-
172
- ### List All Users
173
- ```
174
- GET /o/{org_id}/users
175
- ```
176
-
177
- ### List All Activations (Org-Wide)
178
- ```
179
- GET /o/{org_id}/activations
180
- ```
181
-
182
- ### List Activations for Specific Environment
183
- ```
184
- GET /o/{org_id}/environments/{env_id}/activations
185
- ```
186
-
187
- ---
188
-
189
- ## 🎯 Common Scenarios
190
-
191
- ### Scenario 1: Find Which Users Are Activated
192
-
193
- 1. Get all users: `GET /o/{org_id}/users`
194
- 2. Get all activations: `GET /o/{org_id}/activations`
195
- 3. Match `activation.userId` with `user.id`
196
-
197
- ### Scenario 2: Check What Variables a User Has
198
-
199
- 1. Get activation: `GET /o/{org_id}/activations/{activation_id}`
200
- 2. Look at `dynamicVariables` in response
201
- 3. Compare with schema: `GET /o/{org_id}/projects/{project_id}/variables`
202
-
203
- ### Scenario 3: Update Multiple Users' Variables
204
-
205
- For each activation:
206
- ```
207
- PATCH /o/{org_id}/environments/{env_id}/activations/{activation_id}/variables
208
- {
209
- "commonSetting": "new-value"
210
- }
211
- ```
212
-
213
- ---
214
-
215
- ## 🔐 Variable Schema Validation
216
-
217
- ### Get Variable Schema (What SHOULD exist)
218
- ```
219
- GET /o/{org_id}/projects/{project_id}/variables
220
- ```
221
-
222
- **Response:**
223
- ```json
224
- {
225
- "properties": {
226
- "apiKey": {
227
- "type": "string",
228
- "description": "API Key for external service"
229
- },
230
- "accountId": {
231
- "type": "string"
232
- }
233
- },
234
- "required": ["apiKey"] ← Must be present in activation!
235
- }
236
- ```
237
-
238
- ### Set/Update Variable Schema
239
- ```
240
- PUT /o/{org_id}/projects/{project_id}/variables
241
- {
242
- "properties": {
243
- "newVariable": {
244
- "type": "string",
245
- "description": "Description here"
246
- }
247
- },
248
- "required": ["newVariable"]
249
- }
250
- ```
251
-
252
- ---
253
-
254
- ## 💡 Pro Tips
255
-
256
- 1. **Get Connection Templates First**
257
- Always fetch `GET /projects/{id}/connection-templates` before activating users.
258
-
259
- 2. **Activation Includes Variables**
260
- Use `GET /activations/{id}` to see current variable values (no separate endpoint).
261
-
262
- 3. **Required Variables**
263
- When updating variables, if required vars are missing, include them in the PATCH.
264
-
265
- 4. **Pagination**
266
- Use `nextToken` from response for paginated endpoints (logs, lists).
267
-
268
- 5. **Environment Config**
269
- Update environment-level settings: `PATCH /o/{org_id}/environments/{env_id}/config`
270
-
271
- ---
272
-
273
- ## 📚 Related Guides
274
-
275
- - [ACTIVATIONS-AND-VARIABLES-GUIDE.md](./ACTIVATIONS-AND-VARIABLES-GUIDE.md) - Detailed activation concepts
276
- - [JWT-GENERATION-GUIDE.md](./JWT-GENERATION-GUIDE.md) - How to generate auth tokens
277
- - [README.md](./README.md) - Postman collection setup
278
-
279
- ---
280
-
281
- ## 🆘 Troubleshooting
282
-
283
- **Error: "connectionTemplateId is required"**
284
- → Get templates first: `GET /projects/{id}/connection-templates`
285
-
286
- **Error: "missing properties: 'apiKey'"**
287
- → Include all required variables from schema in your PATCH request
288
-
289
- **Error: "404 Not Found" on environments**
290
- → Environments are created on deployment, not manually
291
-
292
- **Error: "401 Unauthorized"**
293
- → Check JWT token in environment variables (see JWT-GENERATION-GUIDE.md)
@@ -1,73 +0,0 @@
1
- # Versori Platform API
2
-
3
- This directory contains the official Postman collection for the Versori Platform API, organized to match the [official documentation structure](https://docs.versori.com/latest/api-reference/platform-api/getting-started).
4
-
5
- > **⚠️ SECURITY:** Never commit credentials to version control. Use the `.example.json` template and keep your actual credentials local only.
6
-
7
- ## Contents
8
-
9
- - **`Versori-Platform-API.postman_collection.json`**: Complete Postman collection (104 requests).
10
- - **`Versori-Platform-API.postman_environment.example.json`**: Environment template (copy and rename to `.postman_environment.json`).
11
- - **`QUICK-WORKFLOW.md`**: Step-by-step workflows for common tasks.
12
- - **`ACTIVATIONS-AND-VARIABLES-GUIDE.md`**: Detailed guide on managing activations and variables.
13
- - **`JWT-GENERATION-GUIDE.md`**: How to generate authentication tokens.
14
-
15
- ## Structure
16
-
17
- The collection is organized into the following folders, matching the API reference:
18
-
19
- 1. **projects**: Manage projects and their configurations (Create, Read, Update, Delete).
20
- 2. **connections**: Manage connections to external systems.
21
- 3. **end_users**: Manage users within the organization.
22
- 4. **activations**: Manage activations and their dynamic variables.
23
- 5. **systems**: Manage systems and integrations.
24
-
25
- ## Quick Start
26
-
27
- 1. **Import Collection**:
28
- * Open Postman.
29
- * Click **Import**.
30
- * Drag and drop `Versori-Platform-API.postman_collection.json`.
31
-
32
- 2. **Setup Environment**:
33
- * Copy `Versori-Platform-API.postman_environment.example.json` to `Versori-Platform-API.postman_environment.json`
34
- * Fill in your actual credentials (the `.json` file is gitignored)
35
- * Import the configured file into Postman
36
-
37
- 3. **Configure Environment**:
38
- * Select "Versori Platform API - Environment" from the environment dropdown (top right).
39
- * Click the "Eye" icon to edit variables.
40
- * Set `jwt_token` (Required for all requests).
41
- * Set `organisation_id` (Required for all requests).
42
- * Set other IDs (`project_id`, `environment_id`, etc.) as needed for specific requests.
43
-
44
- ## Authentication
45
-
46
- All requests use **JWT Authentication**.
47
- The collection is configured to automatically add the `Authorization: JWT {{jwt_token}}` header to every request.
48
-
49
- **Important**: Ensure your `jwt_token` variable in the environment is valid and not expired.
50
-
51
- ## Common Workflows
52
-
53
- ### 1. Get Project Details
54
- * **Folder**: `projects`
55
- * **Request**: `Get Project`
56
- * **Requires**: `organisation_id`, `project_id`
57
-
58
- ### 2. Update Activation Variables
59
- * **Folder**: `activations`
60
- * **Request**: `Update Activation Variables`
61
- * **Requires**: `organisation_id`, `environment_id`, `activation_id`
62
- * **Body**: JSON object with variable key-value pairs.
63
-
64
- ### 3. List Users
65
- * **Folder**: `end_users`
66
- * **Request**: `List Users`
67
- * **Requires**: `organisation_id`
68
-
69
- ## 📚 Documentation
70
-
71
- - **[QUICK-WORKFLOW.md](./QUICK-WORKFLOW.md)** - Common workflows (add users, manage variables, get logs)
72
- - **[ACTIVATIONS-AND-VARIABLES-GUIDE.md](./ACTIVATIONS-AND-VARIABLES-GUIDE.md)** - Activation concepts and variable validation
73
- - **[JWT-GENERATION-GUIDE.md](./JWT-GENERATION-GUIDE.md)** - Generate authentication tokens