@superglue/cli 1.1.21 → 1.1.22

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 (32) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +1 -7
  3. package/dist/cli.js +300 -77
  4. package/dist/skills/superglue/SKILL.md +312 -631
  5. package/dist/skills/superglue/references/file-handling.md +116 -90
  6. package/dist/skills/superglue/references/graphql.md +131 -0
  7. package/dist/skills/superglue/references/http.md +246 -0
  8. package/dist/skills/superglue/references/integration.md +4 -2
  9. package/dist/skills/superglue/references/mssql.md +207 -0
  10. package/dist/skills/superglue/references/postgres.md +154 -0
  11. package/dist/skills/superglue/references/redis.md +68 -118
  12. package/dist/skills/superglue/references/sftp-smb.md +156 -0
  13. package/dist/skills/superglue/references/superglue-info.md +91 -0
  14. package/package.json +1 -1
  15. package/skills/superglue/SKILL.md +312 -631
  16. package/skills/superglue/references/file-handling.md +116 -90
  17. package/skills/superglue/references/graphql.md +131 -0
  18. package/skills/superglue/references/http.md +246 -0
  19. package/skills/superglue/references/integration.md +4 -2
  20. package/skills/superglue/references/mssql.md +207 -0
  21. package/skills/superglue/references/postgres.md +154 -0
  22. package/skills/superglue/references/redis.md +68 -118
  23. package/skills/superglue/references/sftp-smb.md +156 -0
  24. package/skills/superglue/references/superglue-info.md +91 -0
  25. package/dist/skills/superglue/references/data-handling.md +0 -303
  26. package/dist/skills/superglue/references/databases.md +0 -253
  27. package/dist/skills/superglue/references/file-servers.md +0 -112
  28. package/dist/skills/superglue/references/http-apis.md +0 -248
  29. package/skills/superglue/references/data-handling.md +0 -303
  30. package/skills/superglue/references/databases.md +0 -253
  31. package/skills/superglue/references/file-servers.md +0 -112
  32. package/skills/superglue/references/http-apis.md +0 -248
@@ -1,248 +0,0 @@
1
- # HTTP APIs
2
-
3
- Covers REST APIs, GraphQL, webhooks, and any HTTP-based service.
4
-
5
- ## Step Configuration
6
-
7
- ```typescript
8
- {
9
- type: "request",
10
- systemId: "my_api",
11
- url: "<<my_api_url>>/v1/users", // RECOMMENDED: use system URL variable for base URL
12
- method: "GET", // GET, POST, PUT, DELETE, PATCH
13
- headers: { "Authorization": "Bearer <<my_api_access_token>>" }, // supports <<variables>> and JS expressions
14
- queryParams: { "limit": "<<limit>>", "status": "active" }, // supports <<variables>> and JS expressions
15
- body: '{"name": "<<(sourceData) => sourceData.currentItem.name>>"}', // supports <<variables>> and JS expressions
16
- pagination: { ... } // optional
17
- }
18
- ```
19
-
20
- ### URL Best Practices
21
-
22
- **Prefer system URL variables over hardcoded URLs:**
23
-
24
- ```typescript
25
- // RECOMMENDED: Environment-agnostic (works with dev/prod switching)
26
- { "url": "<<salesforce_url>>/services/data/v58.0/sobjects/Account" }
27
-
28
- // ACCEPTABLE: When URL differs significantly from system base URL
29
- { "url": "https://api.stripe.com/v1/customers" }
30
-
31
- // AVOID: Hardcoding URLs that match the system's base URL
32
- { "url": "https://mycompany.salesforce.com/services/data/v58.0/sobjects/Account" }
33
- ```
34
-
35
- Using `<<systemId_url>>` enables the same tool to work across different environments (dev/prod) without modification. The URL resolves dynamically based on execution mode.
36
-
37
- ## Authentication Patterns
38
-
39
- ```javascript
40
- // Bearer token
41
- { "Authorization": "Bearer <<systemId_access_token>>" }
42
-
43
- // API key in header
44
- { "X-API-Key": "<<systemId_api_key>>" }
45
-
46
- // Basic Auth — auto-encoded to Base64, do NOT manually encode
47
- { "Authorization": "Basic <<systemId_username>>:<<systemId_password>>" }
48
-
49
- // Runtime credentials from payload
50
- { "Authorization": "Bearer <<(sourceData) => sourceData.user_access_token>>" }
51
- ```
52
-
53
- Headers starting with `x-` are treated as custom headers.
54
- Modern APIs expect auth in headers, NOT query parameters, unless docs explicitly say otherwise.
55
-
56
- ## Request Behavior
57
-
58
- - **GET, HEAD, DELETE, OPTIONS**: Body is always stripped
59
- - **POST, PUT, PATCH**: Body with leading `{` is JSON-parsed; empty body becomes undefined
60
- - Default headers: `Accept: */*`, Chrome-like `User-Agent`
61
- - HTTPS: `rejectUnauthorized: false` (accepts self-signed certs)
62
-
63
- ### Response Handling
64
-
65
- All HTTP responses are read as raw bytes, then classified by `detectFileType` (byte-level detection). See the file-handling skill for the full detection logic and file type reference.
66
-
67
- - **Binary types** (PDF, Excel, DOCX, ZIP, GZIP): treated as files. Parsed content also becomes `data`. Later steps can reference the file via `file::<stepId>.raw/base64/extracted`.
68
- - **`application/octet-stream`**: always treated as a file, even if byte-level detection falls back to `RAW`.
69
- - **Large responses over 25 MB**: treated as files as a safety fallback so the runtime does not try to parse a huge unknown blob as RAW text/JSON.
70
- - **RAW + Content-Disposition attachment**: treated as a file.
71
- - **Smaller structured/text responses** (JSON, XML, CSV, YAML, HTML, plain text under the size limit): parsed inline to `data` only.
72
-
73
- This means an HTTP step downloading a PDF or large `.bin` file will expose `stepFileKeys` and populate `sourceData.__files__`, while an ordinary JSON API response will usually just populate `sourceData.stepId.data`.
74
-
75
- ### Body Resolution Order
76
-
77
- For HTTP request steps, the runtime processes the body in this order:
78
-
79
- 1. `<<>>` template variables are resolved via `replaceVariables`
80
- 2. The resulting body string is JSON-parsed when possible
81
- 3. `file::...` references are resolved on the parsed body object
82
- 4. The HTTP strategy decides how to send the final body:
83
- - raw bytes for `file::<key>.raw` when the **entire body** is a file ref
84
- - base64 string content for `file::<key>.base64` when the API expects base64 inside JSON/XML
85
- - `multipart/form-data` when the `Content-Type` header requests it and the body resolves to an object
86
- - plain string body for strings
87
- - `JSON.stringify(...)` for ordinary objects
88
-
89
- File references are resolved **only in the body**, not in headers, query params, or URLs.
90
-
91
- **Avoiding double-encoding:** The runtime stringifies objects at both step 1 (expression → template) and step 4 (object → fetch body). When the body contains nested JSON (e.g. LLM APIs), have `<<>>` expressions return a string via `JSON.stringify(...)`, or use a preceding transform step.
92
-
93
- ### File Uploads
94
-
95
- #### Raw Body Uploads
96
-
97
- If the endpoint expects the file as the entire HTTP body, use:
98
-
99
- ```typescript
100
- {
101
- method: "PUT",
102
- headers: { "Content-Type": "application/pdf" },
103
- body: "file::document.raw"
104
- }
105
- ```
106
-
107
- This sends the exact original file bytes as the request body.
108
-
109
- #### Base64-In-JSON/XML Uploads
110
-
111
- If the endpoint expects the file encoded as base64 inside a structured payload, use:
112
-
113
- ```typescript
114
- {
115
- method: "POST",
116
- headers: { "Content-Type": "application/json" },
117
- body: '{"fileBase64":"file::document.base64"}'
118
- }
119
- ```
120
-
121
- This resolves the file bytes to a base64 string before the final `JSON.stringify(...)`.
122
-
123
- #### Automatic Multipart Uploads
124
-
125
- If the endpoint expects `multipart/form-data`, set the header and make the body a JSON object of form fields:
126
-
127
- ```typescript
128
- {
129
- method: "POST",
130
- headers: { "Content-Type": "multipart/form-data" },
131
- body: '{"file":"file::report.raw","description":"monthly export"}'
132
- }
133
- ```
134
-
135
- The runtime will:
136
-
137
- - build a real `FormData` request
138
- - turn `file::...raw` values into file parts using the stored filename and content type
139
- - turn scalar values into text parts
140
- - JSON-stringify non-file objects/arrays into text parts
141
- - remove the user-supplied `Content-Type` header and let `fetch` set the multipart boundary automatically
142
-
143
- Restrictions:
144
-
145
- - the multipart body must resolve to an object of top-level form fields
146
- - nested file refs inside objects are not supported
147
- - do **not** manually include a multipart boundary in the header
148
- - use `.raw` for file parts, `.base64` for base64 text fields, and `.extracted` only for text fields that should contain parsed content
149
-
150
- ## Error Detection
151
-
152
- ### HTTP Status Errors
153
-
154
- Non-2xx responses throw with: method, URL, response body preview (1000 chars), masked config, retry count.
155
-
156
- ### Smart Error Detection in 2xx Responses
157
-
158
- Even successful responses are scanned for error indicators:
159
-
160
- - `response.code` or `response.status` is 400-599 → throws
161
- - Keys matching `error`, `errors`, `error_message`, `failure_reason`, `failure`, `failed` (up to depth 2) with non-empty values → throws
162
- - Error message includes: _"To prevent this from happening, enable 'Continue on failure' in the step's Advanced Settings."_
163
-
164
- Bypass: `failureBehavior: "continue"` skips all error checking. Can be set in the tool playground.
165
-
166
- ## Retry Logic
167
-
168
- ### Connection/Server Errors
169
-
170
- - Default 1 retry (3 if keep-alive disabled), capped at server max
171
- - Only retries if response was fast (under quick-retry threshold)
172
- - Configurable delay between retries
173
-
174
- ### Rate Limiting (429)
175
-
176
- - Respects `Retry-After` header (seconds or date)
177
- - Without header: exponential backoff `10^n * 1000ms + jitter` (max 1hr per wait)
178
- - Total wait capped at `MAX_RATE_LIMIT_WAIT_MS`
179
- - Separate from general retry count
180
-
181
- ## Pagination
182
-
183
- Makes multiple requests in a loop, merging results. Only configure if you've verified the exact API pagination mechanism from docs.
184
-
185
- ### Configuration
186
-
187
- ```typescript
188
- pagination: {
189
- type: "offsetBased" | "pageBased" | "cursorBased",
190
- pageSize: "50",
191
- cursorPath: "meta.next_cursor", // cursorBased only — JSONPath to cursor
192
- stopCondition: "(response, pageInfo) => !response.data.meta.next_cursor"
193
- }
194
- ```
195
-
196
- ### Variables (auto-injected)
197
-
198
- | Type | Variable | Starts at | Increments by |
199
- | ----------- | ---------------------------- | --------- | ------------------------ |
200
- | pageBased | `<<page>>` | 1 | 1 |
201
- | offsetBased | `<<offset>>` | 0 | pageSize |
202
- | cursorBased | `<<cursor>>` | null | extracted via cursorPath |
203
- | all | `<<limit>>` / `<<pageSize>>` | pageSize | — |
204
-
205
- **CRITICAL**: The matching pagination variable MUST appear in the request (URL, queryParams, headers, or body). Throws if missing.
206
-
207
- ### Stop Conditions
208
-
209
- JS expression evaluated in sandbox. Receives `(response, pageInfo)`:
210
-
211
- - `response.data` = parsed API response body
212
- - `response.headers` = response headers
213
- - `pageInfo = { page, offset, cursor, totalFetched }`
214
- - Return `true` to **STOP**
215
-
216
- Examples:
217
-
218
- ```javascript
219
- "!response.data.meta.next_cursor"; // no next cursor
220
- "response.data.items.length === 0"; // empty page
221
- "response.data.hasMore === false"; // explicit flag
222
- "pageInfo.totalFetched >= 1000"; // item cap
223
- ```
224
-
225
- ### Safety Checks (only when stopCondition is set)
226
-
227
- 1. **Identical pages 1 & 2** (both with data): Throws — pagination params aren't being applied
228
- 2. **Both pages empty + stop didn't trigger**: Throws — broken stop condition
229
- 3. **Duplicate consecutive response (after page 2)**: Auto-stops
230
-
231
- ### Without stopCondition (fallback)
232
-
233
- - Array shorter than pageSize → stop
234
- - Duplicate response hash (against any previously seen page) → stop
235
- - Non-array response → stop after first request
236
- - Max 500 requests (vs 1000 max with a stopCondition)
237
-
238
- ### Cursor Extraction
239
-
240
- `cursorPath` is a JSONPath expression (auto-prefixed with `$.` if needed). Extracted via `jsonpath-plus`. Null cursor → stop.
241
-
242
- **Special characters in cursorPath:** For property names containing `@` (e.g. OData's `@odata.nextLink`), use the property name directly as the cursorPath: `cursorPath: "@odata.nextLink"`. The engine handles `@`-prefixed paths automatically.
243
-
244
- ## Output
245
-
246
- Paginated steps merge all pages into a **single** result object. The step result is always accessed via `sourceData.stepId.data` — it is NOT an array of per-page results. Do NOT call `.map()` on a paginated step result.
247
-
248
- Returns single object if one result, array if multiple (unwrapped from single-element array).