@superglue/cli 1.1.13 → 1.1.15

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.
@@ -1,6 +1,12 @@
1
- # Database Steps (PostgreSQL)
1
+ # Database Steps
2
2
 
3
- ## Step Configuration
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
- ## Batch Operations via Loop
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 `isolated-vm` sandbox:
85
+ Runs in Deno subprocess sandbox:
86
86
 
87
- - 4096 MB memory limit, 10s timeout (transforms/selectors), 3s timeout (pagination stops)
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.)