@superglue/cli 1.1.13 → 1.1.14
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/dist/cli.js +125 -77
- package/dist/dist/cli.js +125 -77
- package/dist/dist/skills/superglue/SKILL.md +11 -11
- package/dist/dist/skills/superglue/references/databases.md +164 -3
- package/dist/dist/skills/superglue/references/transforms-and-output.md +2 -2
- package/dist/skills/superglue/SKILL.md +11 -11
- package/dist/skills/superglue/references/databases.md +164 -3
- package/dist/skills/superglue/references/transforms-and-output.md +2 -2
- package/package.json +6 -6
- package/skills/superglue/SKILL.md +11 -11
- package/skills/superglue/references/databases.md +164 -3
- package/skills/superglue/references/transforms-and-output.md +2 -2
|
@@ -246,15 +246,15 @@ sg system call --url "sftp://<<my_sftp_host>>:22/data" \
|
|
|
246
246
|
--body '{"operation":"list","path":"/"}'
|
|
247
247
|
```
|
|
248
248
|
|
|
249
|
-
| Flag | Description
|
|
250
|
-
| ------------------- |
|
|
251
|
-
| `--url <url>` | Full URL with protocol (http/https/postgres/redis/rediss/sftp/ftp/smb) |
|
|
252
|
-
| `--system-id <id>` | System ID for credential injection
|
|
253
|
-
| `--method <method>` | HTTP method (GET, POST, PUT, DELETE, PATCH)
|
|
254
|
-
| `--headers <json>` | HTTP headers JSON with credential placeholders
|
|
255
|
-
| `--body <string>` | Request body (JSON string)
|
|
256
|
-
| `--env <env>` | Environment: `dev` or `prod`
|
|
257
|
-
| `--file <key=path>` | File references (repeatable)
|
|
249
|
+
| Flag | Description |
|
|
250
|
+
| ------------------- | ------------------------------------------------------------------------------------------------- |
|
|
251
|
+
| `--url <url>` | Full URL with protocol (http/https/postgres/postgresql/mssql/sqlserver/redis/rediss/sftp/ftp/smb) |
|
|
252
|
+
| `--system-id <id>` | System ID for credential injection |
|
|
253
|
+
| `--method <method>` | HTTP method (GET, POST, PUT, DELETE, PATCH) |
|
|
254
|
+
| `--headers <json>` | HTTP headers JSON with credential placeholders |
|
|
255
|
+
| `--body <string>` | Request body (JSON string) |
|
|
256
|
+
| `--env <env>` | Environment: `dev` or `prod` |
|
|
257
|
+
| `--file <key=path>` | File references (repeatable) |
|
|
258
258
|
|
|
259
259
|
**`sg system search-docs`** — Search system documentation.
|
|
260
260
|
|
|
@@ -458,7 +458,7 @@ Empty arrays are valid — the step simply skips execution.
|
|
|
458
458
|
|
|
459
459
|
### Two Step Types
|
|
460
460
|
|
|
461
|
-
**Request step** (HTTP,
|
|
461
|
+
**Request step** (HTTP, PostgreSQL, MSSQL, Redis, FTP/SFTP/SMB) — makes an API call:
|
|
462
462
|
|
|
463
463
|
```json
|
|
464
464
|
{
|
|
@@ -645,7 +645,7 @@ For detailed documentation on specific topics, read these files in the `referenc
|
|
|
645
645
|
| File | When to read |
|
|
646
646
|
| ------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
647
647
|
| `references/integration.md` | **READ THIS** when deploying tools to production - SDK usage, REST API, webhooks, error handling |
|
|
648
|
-
| `references/databases.md` | Building tools that query PostgreSQL
|
|
648
|
+
| `references/databases.md` | Building tools that query PostgreSQL or Microsoft SQL Server (Azure SQL) databases |
|
|
649
649
|
| `references/redis.md` | Building tools that interact with Redis (commands, pipelines, data types) |
|
|
650
650
|
| `references/file-servers.md` | Building tools that interact with FTP/SFTP/SMB file servers |
|
|
651
651
|
| `references/transforms-and-output.md` | Complex data transformations, output shaping, JS sandbox constraints |
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
# Database Steps
|
|
1
|
+
# Database Steps
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Superglue supports both PostgreSQL and Microsoft SQL Server (including Azure SQL).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## PostgreSQL
|
|
8
|
+
|
|
9
|
+
### Step Configuration
|
|
4
10
|
|
|
5
11
|
```typescript
|
|
6
12
|
{
|
|
@@ -78,7 +84,7 @@ Returns `result.rows` — array of row objects with column names as keys.
|
|
|
78
84
|
- `INSERT/UPDATE/DELETE` with `RETURNING`: array of returned rows
|
|
79
85
|
- Mutations without `RETURNING`: empty array
|
|
80
86
|
|
|
81
|
-
|
|
87
|
+
### Batch Operations via Loop
|
|
82
88
|
|
|
83
89
|
Use a data selector returning an array to execute a query per item:
|
|
84
90
|
|
|
@@ -86,3 +92,158 @@ Use a data selector returning an array to execute a query per item:
|
|
|
86
92
|
// dataSelector: (sourceData) => sourceData.newUsers
|
|
87
93
|
// body: {"query": "INSERT INTO users (name) VALUES ($1)", "params": ["<<(sourceData) => sourceData.currentItem.name>>"]}
|
|
88
94
|
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Microsoft SQL Server / Azure SQL
|
|
99
|
+
|
|
100
|
+
### Step Configuration
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
{
|
|
104
|
+
type: "request",
|
|
105
|
+
systemId: "my_azure_sql",
|
|
106
|
+
url: "mssql://<<my_azure_sql_user>>:<<my_azure_sql_password>>@<<my_azure_sql_host>>:<<my_azure_sql_port>>/<<my_azure_sql_database>>",
|
|
107
|
+
method: "POST", // ignored for MSSQL but required by schema
|
|
108
|
+
body: '{"query": "SELECT * FROM users WHERE id = @param1", "params": [<<userId>>]}'
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Configure the connection url depending on which credentials are saved in the stored db system - reference them accordingly.
|
|
113
|
+
|
|
114
|
+
### URL Format
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
mssql://user:password@host:port/database
|
|
118
|
+
sqlserver://user:password@host:port/database
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Both `mssql://` and `sqlserver://` protocols are supported. All credential variables are resolved before connecting.
|
|
122
|
+
|
|
123
|
+
#### Azure SQL Database Connection
|
|
124
|
+
|
|
125
|
+
For Azure SQL Database, use the fully qualified server name:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
mssql://myuser@myserver:mypassword@myserver.database.windows.net:1433/mydatabase
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
You can include connection parameters as query strings:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
mssql://user:password@host:port/database?encrypt=true&trustServerCertificate=false
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Connection Parameters:**
|
|
138
|
+
|
|
139
|
+
- `encrypt` (default: `true`) - Enable/disable encryption (required for Azure SQL)
|
|
140
|
+
- `trustServerCertificate` (default: `false`) - Whether to trust the server certificate
|
|
141
|
+
- `database` - Database name (can be in URL path or query parameter)
|
|
142
|
+
|
|
143
|
+
### Body Format
|
|
144
|
+
|
|
145
|
+
JSON string with `query` and optional `params` (or `values`):
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"query": "SELECT * FROM users WHERE age > @param1 AND status = @param2",
|
|
150
|
+
"params": [25, "active"]
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Parameterized Queries
|
|
155
|
+
|
|
156
|
+
**Always use parameterized queries** with `@param1`, `@param2`, etc. — prevents SQL injection.
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{ "query": "SELECT * FROM orders WHERE customer_id = @param1", "params": ["<<customerId>>"] }
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
With expressions:
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"query": "INSERT INTO logs (message, level) VALUES (@param1, @param2)",
|
|
167
|
+
"params": ["<<(sourceData) => sourceData.message>>", "error"]
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
With OUTPUT (MSSQL equivalent of RETURNING):
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"query": "INSERT INTO users (name, email) OUTPUT INSERTED.* VALUES (@param1, @param2)",
|
|
176
|
+
"params": [
|
|
177
|
+
"<<(sourceData) => sourceData.currentItem.name>>",
|
|
178
|
+
"<<(sourceData) => sourceData.currentItem.email>>"
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Parameter Naming**: MSSQL uses named parameters with `@` prefix. The params array maps positionally: `params[0]` → `@param1`, `params[1]` → `@param2`, etc.
|
|
184
|
+
|
|
185
|
+
### Connection Pooling
|
|
186
|
+
|
|
187
|
+
- Pools cached by connection string, max 10 clients per pool
|
|
188
|
+
- 5s connection timeout, configurable request timeout
|
|
189
|
+
- Idle pools cleaned up automatically
|
|
190
|
+
- SSL/TLS encryption enabled by default for Azure SQL
|
|
191
|
+
|
|
192
|
+
### Retry Logic
|
|
193
|
+
|
|
194
|
+
Default retries from server config. On final failure, error includes query text and params.
|
|
195
|
+
|
|
196
|
+
### Return Value
|
|
197
|
+
|
|
198
|
+
Returns the recordset — array of row objects with column names as keys.
|
|
199
|
+
|
|
200
|
+
- `SELECT`: array of matching rows
|
|
201
|
+
- `INSERT/UPDATE/DELETE` with `OUTPUT`: array of returned rows
|
|
202
|
+
- Mutations without `OUTPUT`: empty array
|
|
203
|
+
|
|
204
|
+
### Batch Operations via Loop
|
|
205
|
+
|
|
206
|
+
Use a data selector returning an array to execute a query per item:
|
|
207
|
+
|
|
208
|
+
```javascript
|
|
209
|
+
// dataSelector: (sourceData) => sourceData.newUsers
|
|
210
|
+
// body: {"query": "INSERT INTO users (name) VALUES (@param1)", "params": ["<<(sourceData) => sourceData.currentItem.name>>"]}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Common Patterns
|
|
214
|
+
|
|
215
|
+
**Simple SELECT:**
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"query": "SELECT id, name, email FROM users WHERE status = @param1",
|
|
220
|
+
"params": ["active"]
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**INSERT with OUTPUT:**
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"query": "INSERT INTO users (name, email, created_at) OUTPUT INSERTED.id, INSERTED.created_at VALUES (@param1, @param2, GETUTCDATE())",
|
|
229
|
+
"params": ["John Doe", "john@example.com"]
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**UPDATE with OUTPUT:**
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"query": "UPDATE users SET last_login = GETUTCDATE() OUTPUT INSERTED.id, INSERTED.last_login WHERE id = @param1",
|
|
238
|
+
"params": [123]
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Stored Procedure Call:**
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"query": "EXEC dbo.GetUserById @param1",
|
|
247
|
+
"params": [123]
|
|
248
|
+
}
|
|
249
|
+
```
|
|
@@ -82,9 +82,9 @@ Payload fields are at root level — **NEVER** use `sourceData.payload.*`.
|
|
|
82
82
|
|
|
83
83
|
## JS Code Constraints (all transform points)
|
|
84
84
|
|
|
85
|
-
Runs in
|
|
85
|
+
Runs in Deno subprocess sandbox:
|
|
86
86
|
|
|
87
|
-
-
|
|
87
|
+
- 8192 MB memory limit, 10 minute timeout per transform
|
|
88
88
|
- Synchronous only — no async/await, no Promises, no setTimeout
|
|
89
89
|
- No side effects — no network, filesystem, or console access
|
|
90
90
|
- No external dependencies — only standard JS built-ins (Array, Object, String, Math, Date, JSON, etc.)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superglue/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"bin": {
|
|
5
5
|
"sg": "./dist/cli.js"
|
|
6
6
|
},
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"LICENSE"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"commander": "
|
|
15
|
-
"fast-json-patch": "
|
|
14
|
+
"commander": "15.0.0-0",
|
|
15
|
+
"fast-json-patch": "3.1.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/node": "
|
|
19
|
-
"tsup": "
|
|
20
|
-
"typescript": "
|
|
18
|
+
"@types/node": "25.5.0",
|
|
19
|
+
"tsup": "8.5.1",
|
|
20
|
+
"typescript": "5.8.3"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsup && (cp -r skills dist/ 2>/dev/null || true)",
|
|
@@ -246,15 +246,15 @@ sg system call --url "sftp://<<my_sftp_host>>:22/data" \
|
|
|
246
246
|
--body '{"operation":"list","path":"/"}'
|
|
247
247
|
```
|
|
248
248
|
|
|
249
|
-
| Flag | Description
|
|
250
|
-
| ------------------- |
|
|
251
|
-
| `--url <url>` | Full URL with protocol (http/https/postgres/redis/rediss/sftp/ftp/smb) |
|
|
252
|
-
| `--system-id <id>` | System ID for credential injection
|
|
253
|
-
| `--method <method>` | HTTP method (GET, POST, PUT, DELETE, PATCH)
|
|
254
|
-
| `--headers <json>` | HTTP headers JSON with credential placeholders
|
|
255
|
-
| `--body <string>` | Request body (JSON string)
|
|
256
|
-
| `--env <env>` | Environment: `dev` or `prod`
|
|
257
|
-
| `--file <key=path>` | File references (repeatable)
|
|
249
|
+
| Flag | Description |
|
|
250
|
+
| ------------------- | ------------------------------------------------------------------------------------------------- |
|
|
251
|
+
| `--url <url>` | Full URL with protocol (http/https/postgres/postgresql/mssql/sqlserver/redis/rediss/sftp/ftp/smb) |
|
|
252
|
+
| `--system-id <id>` | System ID for credential injection |
|
|
253
|
+
| `--method <method>` | HTTP method (GET, POST, PUT, DELETE, PATCH) |
|
|
254
|
+
| `--headers <json>` | HTTP headers JSON with credential placeholders |
|
|
255
|
+
| `--body <string>` | Request body (JSON string) |
|
|
256
|
+
| `--env <env>` | Environment: `dev` or `prod` |
|
|
257
|
+
| `--file <key=path>` | File references (repeatable) |
|
|
258
258
|
|
|
259
259
|
**`sg system search-docs`** — Search system documentation.
|
|
260
260
|
|
|
@@ -458,7 +458,7 @@ Empty arrays are valid — the step simply skips execution.
|
|
|
458
458
|
|
|
459
459
|
### Two Step Types
|
|
460
460
|
|
|
461
|
-
**Request step** (HTTP,
|
|
461
|
+
**Request step** (HTTP, PostgreSQL, MSSQL, Redis, FTP/SFTP/SMB) — makes an API call:
|
|
462
462
|
|
|
463
463
|
```json
|
|
464
464
|
{
|
|
@@ -645,7 +645,7 @@ For detailed documentation on specific topics, read these files in the `referenc
|
|
|
645
645
|
| File | When to read |
|
|
646
646
|
| ------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
647
647
|
| `references/integration.md` | **READ THIS** when deploying tools to production - SDK usage, REST API, webhooks, error handling |
|
|
648
|
-
| `references/databases.md` | Building tools that query PostgreSQL
|
|
648
|
+
| `references/databases.md` | Building tools that query PostgreSQL or Microsoft SQL Server (Azure SQL) databases |
|
|
649
649
|
| `references/redis.md` | Building tools that interact with Redis (commands, pipelines, data types) |
|
|
650
650
|
| `references/file-servers.md` | Building tools that interact with FTP/SFTP/SMB file servers |
|
|
651
651
|
| `references/transforms-and-output.md` | Complex data transformations, output shaping, JS sandbox constraints |
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
# Database Steps
|
|
1
|
+
# Database Steps
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Superglue supports both PostgreSQL and Microsoft SQL Server (including Azure SQL).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## PostgreSQL
|
|
8
|
+
|
|
9
|
+
### Step Configuration
|
|
4
10
|
|
|
5
11
|
```typescript
|
|
6
12
|
{
|
|
@@ -78,7 +84,7 @@ Returns `result.rows` — array of row objects with column names as keys.
|
|
|
78
84
|
- `INSERT/UPDATE/DELETE` with `RETURNING`: array of returned rows
|
|
79
85
|
- Mutations without `RETURNING`: empty array
|
|
80
86
|
|
|
81
|
-
|
|
87
|
+
### Batch Operations via Loop
|
|
82
88
|
|
|
83
89
|
Use a data selector returning an array to execute a query per item:
|
|
84
90
|
|
|
@@ -86,3 +92,158 @@ Use a data selector returning an array to execute a query per item:
|
|
|
86
92
|
// dataSelector: (sourceData) => sourceData.newUsers
|
|
87
93
|
// body: {"query": "INSERT INTO users (name) VALUES ($1)", "params": ["<<(sourceData) => sourceData.currentItem.name>>"]}
|
|
88
94
|
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Microsoft SQL Server / Azure SQL
|
|
99
|
+
|
|
100
|
+
### Step Configuration
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
{
|
|
104
|
+
type: "request",
|
|
105
|
+
systemId: "my_azure_sql",
|
|
106
|
+
url: "mssql://<<my_azure_sql_user>>:<<my_azure_sql_password>>@<<my_azure_sql_host>>:<<my_azure_sql_port>>/<<my_azure_sql_database>>",
|
|
107
|
+
method: "POST", // ignored for MSSQL but required by schema
|
|
108
|
+
body: '{"query": "SELECT * FROM users WHERE id = @param1", "params": [<<userId>>]}'
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Configure the connection url depending on which credentials are saved in the stored db system - reference them accordingly.
|
|
113
|
+
|
|
114
|
+
### URL Format
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
mssql://user:password@host:port/database
|
|
118
|
+
sqlserver://user:password@host:port/database
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Both `mssql://` and `sqlserver://` protocols are supported. All credential variables are resolved before connecting.
|
|
122
|
+
|
|
123
|
+
#### Azure SQL Database Connection
|
|
124
|
+
|
|
125
|
+
For Azure SQL Database, use the fully qualified server name:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
mssql://myuser@myserver:mypassword@myserver.database.windows.net:1433/mydatabase
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
You can include connection parameters as query strings:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
mssql://user:password@host:port/database?encrypt=true&trustServerCertificate=false
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Connection Parameters:**
|
|
138
|
+
|
|
139
|
+
- `encrypt` (default: `true`) - Enable/disable encryption (required for Azure SQL)
|
|
140
|
+
- `trustServerCertificate` (default: `false`) - Whether to trust the server certificate
|
|
141
|
+
- `database` - Database name (can be in URL path or query parameter)
|
|
142
|
+
|
|
143
|
+
### Body Format
|
|
144
|
+
|
|
145
|
+
JSON string with `query` and optional `params` (or `values`):
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"query": "SELECT * FROM users WHERE age > @param1 AND status = @param2",
|
|
150
|
+
"params": [25, "active"]
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Parameterized Queries
|
|
155
|
+
|
|
156
|
+
**Always use parameterized queries** with `@param1`, `@param2`, etc. — prevents SQL injection.
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{ "query": "SELECT * FROM orders WHERE customer_id = @param1", "params": ["<<customerId>>"] }
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
With expressions:
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"query": "INSERT INTO logs (message, level) VALUES (@param1, @param2)",
|
|
167
|
+
"params": ["<<(sourceData) => sourceData.message>>", "error"]
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
With OUTPUT (MSSQL equivalent of RETURNING):
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"query": "INSERT INTO users (name, email) OUTPUT INSERTED.* VALUES (@param1, @param2)",
|
|
176
|
+
"params": [
|
|
177
|
+
"<<(sourceData) => sourceData.currentItem.name>>",
|
|
178
|
+
"<<(sourceData) => sourceData.currentItem.email>>"
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Parameter Naming**: MSSQL uses named parameters with `@` prefix. The params array maps positionally: `params[0]` → `@param1`, `params[1]` → `@param2`, etc.
|
|
184
|
+
|
|
185
|
+
### Connection Pooling
|
|
186
|
+
|
|
187
|
+
- Pools cached by connection string, max 10 clients per pool
|
|
188
|
+
- 5s connection timeout, configurable request timeout
|
|
189
|
+
- Idle pools cleaned up automatically
|
|
190
|
+
- SSL/TLS encryption enabled by default for Azure SQL
|
|
191
|
+
|
|
192
|
+
### Retry Logic
|
|
193
|
+
|
|
194
|
+
Default retries from server config. On final failure, error includes query text and params.
|
|
195
|
+
|
|
196
|
+
### Return Value
|
|
197
|
+
|
|
198
|
+
Returns the recordset — array of row objects with column names as keys.
|
|
199
|
+
|
|
200
|
+
- `SELECT`: array of matching rows
|
|
201
|
+
- `INSERT/UPDATE/DELETE` with `OUTPUT`: array of returned rows
|
|
202
|
+
- Mutations without `OUTPUT`: empty array
|
|
203
|
+
|
|
204
|
+
### Batch Operations via Loop
|
|
205
|
+
|
|
206
|
+
Use a data selector returning an array to execute a query per item:
|
|
207
|
+
|
|
208
|
+
```javascript
|
|
209
|
+
// dataSelector: (sourceData) => sourceData.newUsers
|
|
210
|
+
// body: {"query": "INSERT INTO users (name) VALUES (@param1)", "params": ["<<(sourceData) => sourceData.currentItem.name>>"]}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Common Patterns
|
|
214
|
+
|
|
215
|
+
**Simple SELECT:**
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"query": "SELECT id, name, email FROM users WHERE status = @param1",
|
|
220
|
+
"params": ["active"]
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**INSERT with OUTPUT:**
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"query": "INSERT INTO users (name, email, created_at) OUTPUT INSERTED.id, INSERTED.created_at VALUES (@param1, @param2, GETUTCDATE())",
|
|
229
|
+
"params": ["John Doe", "john@example.com"]
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**UPDATE with OUTPUT:**
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"query": "UPDATE users SET last_login = GETUTCDATE() OUTPUT INSERTED.id, INSERTED.last_login WHERE id = @param1",
|
|
238
|
+
"params": [123]
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Stored Procedure Call:**
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"query": "EXEC dbo.GetUserById @param1",
|
|
247
|
+
"params": [123]
|
|
248
|
+
}
|
|
249
|
+
```
|
|
@@ -82,9 +82,9 @@ Payload fields are at root level — **NEVER** use `sourceData.payload.*`.
|
|
|
82
82
|
|
|
83
83
|
## JS Code Constraints (all transform points)
|
|
84
84
|
|
|
85
|
-
Runs in
|
|
85
|
+
Runs in Deno subprocess sandbox:
|
|
86
86
|
|
|
87
|
-
-
|
|
87
|
+
- 8192 MB memory limit, 10 minute timeout per transform
|
|
88
88
|
- Synchronous only — no async/await, no Promises, no setTimeout
|
|
89
89
|
- No side effects — no network, filesystem, or console access
|
|
90
90
|
- No external dependencies — only standard JS built-ins (Array, Object, String, Math, Date, JSON, etc.)
|