@superglue/cli 1.1.11 → 1.1.13
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/.claude-plugin/plugin.json +9 -2
- package/dist/cli.js +162 -84
- package/dist/dist/cli.js +24072 -0
- package/dist/dist/skills/superglue/SKILL.md +667 -0
- package/dist/dist/skills/superglue/agents/openai.yaml +7 -0
- package/dist/dist/skills/superglue/assets/superglue.png +0 -0
- package/dist/dist/skills/superglue/references/databases.md +88 -0
- package/dist/dist/skills/superglue/references/file-servers.md +136 -0
- package/dist/dist/skills/superglue/references/integration.md +279 -0
- package/dist/dist/skills/superglue/references/redis.md +190 -0
- package/dist/dist/skills/superglue/references/transforms-and-output.md +92 -0
- package/dist/skills/superglue/SKILL.md +2 -2
- package/package.json +1 -2
- package/skills/superglue/SKILL.md +2 -2
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Transforms & Output Shaping
|
|
2
|
+
|
|
3
|
+
Covers transform steps, output transforms, and response filters.
|
|
4
|
+
|
|
5
|
+
## Three Transformation Points
|
|
6
|
+
|
|
7
|
+
| Point | When it runs | Purpose |
|
|
8
|
+
| -------------------------------- | ------------------------ | ------------------------------------ |
|
|
9
|
+
| `dataSelector` | Before step executes | Controls input + single vs loop mode |
|
|
10
|
+
| Transform step (`transformCode`) | As the step itself | Reshape data between request steps |
|
|
11
|
+
| `outputTransform` | After all steps complete | Shape final tool output |
|
|
12
|
+
|
|
13
|
+
## Transform Steps
|
|
14
|
+
|
|
15
|
+
Use when you need intermediate data reshaping that can't wait until outputTransform (because a subsequent request step needs the data).
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
{
|
|
19
|
+
id: "formatForInsert",
|
|
20
|
+
config: {
|
|
21
|
+
type: "transform",
|
|
22
|
+
transformCode: "(sourceData) => sourceData.getCustomers.data.map(c => ({ id: c.id, name: c.fullName }))"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Transform steps do NOT have: systemId, url, method, headers, body, queryParams, or pagination.
|
|
28
|
+
|
|
29
|
+
Results are wrapped in the **same envelope** as request steps:
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
sourceData.formatForInsert = { currentItem: <dataSelector output>, data: <transformCode result>, success: true }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If the step has a dataSelector returning an array, the transform runs once per item.
|
|
36
|
+
|
|
37
|
+
### When to Use
|
|
38
|
+
|
|
39
|
+
- Data needed by a subsequent request step (can't defer to outputTransform)
|
|
40
|
+
- Aggregating/combining results from multiple previous steps
|
|
41
|
+
- Complex filtering or restructuring between API calls
|
|
42
|
+
- Preparing data in a specific format for the next step
|
|
43
|
+
|
|
44
|
+
### When NOT to Use
|
|
45
|
+
|
|
46
|
+
- Simple input selection → use `dataSelector` instead
|
|
47
|
+
- Final output shaping → use `outputTransform` instead
|
|
48
|
+
- Simple filtering within a single step → use `dataSelector` returning a filtered array
|
|
49
|
+
- As the final step before the outputTransform → merge into outputTransform code
|
|
50
|
+
|
|
51
|
+
## Output Transform
|
|
52
|
+
|
|
53
|
+
Final transformation shaping the tool's output. Runs after all steps complete.
|
|
54
|
+
|
|
55
|
+
Access patterns depend on how the step was executed:
|
|
56
|
+
|
|
57
|
+
- **Object-selector step**: `sourceData.stepId.data` — single envelope
|
|
58
|
+
- **Array-selector (loop) step**: `sourceData.stepId.map(i => i.data)` — array of envelopes
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
// Object-selector step — single result
|
|
62
|
+
sourceData.getUsers.data; // the API response
|
|
63
|
+
sourceData.getUsers.data.results; // nested field
|
|
64
|
+
|
|
65
|
+
// Array-selector (loop) step — array of results
|
|
66
|
+
sourceData.fetchDetails.map((i) => i.data); // all responses
|
|
67
|
+
sourceData.fetchDetails.flatMap((i) => i.data.items); // nested arrays
|
|
68
|
+
sourceData.fetchDetails.filter((i) => i.success).map((i) => i.data); // only successes
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Payload fields are at root level — **NEVER** use `sourceData.payload.*`.
|
|
72
|
+
|
|
73
|
+
### Requirements
|
|
74
|
+
|
|
75
|
+
- Function signature: `(sourceData) => { ... }`
|
|
76
|
+
- **Must have a return statement**
|
|
77
|
+
- Pure synchronous — no async/await, no side effects
|
|
78
|
+
- Handle missing data with `?.` and defaults
|
|
79
|
+
- Validate arrays with `Array.isArray()` before array methods
|
|
80
|
+
- Throw when expected required data is missing (enables self-healing)
|
|
81
|
+
- NEVER include newlines or tabs in the code string
|
|
82
|
+
|
|
83
|
+
## JS Code Constraints (all transform points)
|
|
84
|
+
|
|
85
|
+
Runs in `isolated-vm` sandbox:
|
|
86
|
+
|
|
87
|
+
- 4096 MB memory limit, 10s timeout (transforms/selectors), 3s timeout (pagination stops)
|
|
88
|
+
- Synchronous only — no async/await, no Promises, no setTimeout
|
|
89
|
+
- No side effects — no network, filesystem, or console access
|
|
90
|
+
- No external dependencies — only standard JS built-ins (Array, Object, String, Math, Date, JSON, etc.)
|
|
91
|
+
- JSON-serializable I/O only
|
|
92
|
+
- Must return a value (undefined returns null)
|
|
@@ -550,7 +550,7 @@ Templates auto-populate endpoints and OAuth config. Use `sg system find` to disc
|
|
|
550
550
|
|
|
551
551
|
### OAuth Flow
|
|
552
552
|
|
|
553
|
-
**IMPORTANT:** For OAuth systems,
|
|
553
|
+
**IMPORTANT:** For OAuth systems, prefer `--template` when available because it auto-configures OAuth URLs and defaults. OAuth also works without a template if you provide required credentials (for example `client_id`, `auth_url`, and `token_url`) manually.
|
|
554
554
|
|
|
555
555
|
If you don't know the template ID, the CLI auto-detects it from the URL — but using `--template` explicitly is more reliable.
|
|
556
556
|
|
|
@@ -574,7 +574,7 @@ sg system oauth --system-id gmail --scopes "https://www.googleapis.com/auth/gmai
|
|
|
574
574
|
|
|
575
575
|
**Step 3:** User authenticates in browser → tokens saved automatically
|
|
576
576
|
|
|
577
|
-
**Common OAuth templates:** gmail,
|
|
577
|
+
**Common OAuth templates:** gmail, googleDrive, googleCalendar, googleSheets, slack, salesforce, github, jira, confluence, notion, airtable, hubspot, shopify, dropbox, zoom, microsoft
|
|
578
578
|
|
|
579
579
|
### System IDs
|
|
580
580
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superglue/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"bin": {
|
|
5
5
|
"sg": "./dist/cli.js"
|
|
6
6
|
},
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"fast-json-patch": "^3.1.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@superglue/shared": "file:../shared",
|
|
19
18
|
"@types/node": "^20.0.0",
|
|
20
19
|
"tsup": "^8.0.0",
|
|
21
20
|
"typescript": "^5.0.0"
|
|
@@ -550,7 +550,7 @@ Templates auto-populate endpoints and OAuth config. Use `sg system find` to disc
|
|
|
550
550
|
|
|
551
551
|
### OAuth Flow
|
|
552
552
|
|
|
553
|
-
**IMPORTANT:** For OAuth systems,
|
|
553
|
+
**IMPORTANT:** For OAuth systems, prefer `--template` when available because it auto-configures OAuth URLs and defaults. OAuth also works without a template if you provide required credentials (for example `client_id`, `auth_url`, and `token_url`) manually.
|
|
554
554
|
|
|
555
555
|
If you don't know the template ID, the CLI auto-detects it from the URL — but using `--template` explicitly is more reliable.
|
|
556
556
|
|
|
@@ -574,7 +574,7 @@ sg system oauth --system-id gmail --scopes "https://www.googleapis.com/auth/gmai
|
|
|
574
574
|
|
|
575
575
|
**Step 3:** User authenticates in browser → tokens saved automatically
|
|
576
576
|
|
|
577
|
-
**Common OAuth templates:** gmail,
|
|
577
|
+
**Common OAuth templates:** gmail, googleDrive, googleCalendar, googleSheets, slack, salesforce, github, jira, confluence, notion, airtable, hubspot, shopify, dropbox, zoom, microsoft
|
|
578
578
|
|
|
579
579
|
### System IDs
|
|
580
580
|
|