Skip to content

Commit 85561ac

Browse files
committed
Merge remote-tracking branch 'origin/main' into di/toast-alternatives-on-timeout
2 parents 8f7c95e + 073ddba commit 85561ac

File tree

9 files changed

+128
-130
lines changed

9 files changed

+128
-130
lines changed

backend/rust-best-practices.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ When generating code, especially involving `serde`, `sqlx`, and `tokio`, priorit
6565

6666
### SQLx Optimizations (Database Interaction)
6767

68+
- **CRITICAL - Never Use `SELECT *` in Worker-Executed Queries:** For any query that can potentially be executed by workers, **always** explicitly list the specific columns you need instead of using `SELECT *`. This is essential for backwards compatibility: when workers are running behind the API server version (common in distributed deployments), adding new columns to database tables will cause outdated workers to fail when they try to deserialize rows with unexpected columns. Always use explicit column lists like `SELECT id, workspace_id, path, created_at FROM table` instead of `SELECT * FROM table`.
6869
- **Select Only Necessary Columns:** In `SELECT` queries, list specific column names rather than using `SELECT *`. This reduces data transferred from the database and the work needed for hydration/deserialization.
6970
- **Batch Operations:** For multiple `INSERT`, `UPDATE`, or `DELETE` statements, prefer executing them in a single query if the database and driver support it efficiently (e.g., `INSERT INTO ... VALUES (...), (...), ...`). This minimizes round trips to the database.
7071
- **Avoid N+1 Queries:** Do not loop through results of one query and execute a separate query for each item (e.g., fetching users, then querying for each user's profile in a loop). Instead, use JOINs or a single query with an `IN` clause to fetch related data efficiently.

cli/wasm/ts/windmill_parser_wasm.js

Lines changed: 88 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11

22

3+
let cachedUint8ArrayMemory0 = null;
4+
5+
function getUint8ArrayMemory0() {
6+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
7+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
8+
}
9+
return cachedUint8ArrayMemory0;
10+
}
11+
12+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13+
14+
cachedTextDecoder.decode();
15+
16+
function decodeText(ptr, len) {
17+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
18+
}
19+
20+
function getStringFromWasm0(ptr, len) {
21+
ptr = ptr >>> 0;
22+
return decodeText(ptr, len);
23+
}
24+
325
function addToExternrefTable0(obj) {
426
const idx = wasm.__externref_table_alloc();
527
wasm.__wbindgen_export_2.set(idx, obj);
@@ -15,22 +37,9 @@ function handleError(f, args) {
1537
}
1638
}
1739

18-
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
19-
20-
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
21-
22-
let cachedUint8ArrayMemory0 = null;
23-
24-
function getUint8ArrayMemory0() {
25-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
26-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
27-
}
28-
return cachedUint8ArrayMemory0;
29-
}
30-
31-
function getStringFromWasm0(ptr, len) {
40+
function getArrayU8FromWasm0(ptr, len) {
3241
ptr = ptr >>> 0;
33-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
42+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
3443
}
3544

3645
function isLikeNone(x) {
@@ -113,11 +122,7 @@ function debugString(val) {
113122

114123
let WASM_VECTOR_LEN = 0;
115124

116-
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
117-
118-
const encodeString = function (arg, view) {
119-
return cachedTextEncoder.encodeInto(arg, view);
120-
};
125+
const cachedTextEncoder = new TextEncoder();
121126

122127
function passStringToWasm0(arg, malloc, realloc) {
123128

@@ -148,7 +153,7 @@ function passStringToWasm0(arg, malloc, realloc) {
148153
}
149154
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
150155
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
151-
const ret = encodeString(arg, view);
156+
const ret = cachedTextEncoder.encodeInto(arg, view);
152157

153158
offset += ret.written;
154159
ptr = realloc(ptr, len, offset, 1) >>> 0;
@@ -238,35 +243,35 @@ export function parse_assets_ts(code) {
238243

239244
const imports = {
240245
__wbindgen_placeholder__: {
241-
__wbg_buffer_609cc3eee51ed158: function(arg0) {
242-
const ret = arg0.buffer;
246+
__wbg_Error_e17e777aac105295: function(arg0, arg1) {
247+
const ret = Error(getStringFromWasm0(arg0, arg1));
243248
return ret;
244249
},
245-
__wbg_call_672a4d21634d4a24: function() { return handleError(function (arg0, arg1) {
250+
__wbg_call_13410aac570ffff7: function() { return handleError(function (arg0, arg1) {
246251
const ret = arg0.call(arg1);
247252
return ret;
248253
}, arguments) },
249-
__wbg_done_769e5ede4b31c67b: function(arg0) {
254+
__wbg_done_75ed0ee6dd243d9d: function(arg0) {
250255
const ret = arg0.done;
251256
return ret;
252257
},
253-
__wbg_entries_3265d4158b33e5dc: function(arg0) {
258+
__wbg_entries_2be2f15bd5554996: function(arg0) {
254259
const ret = Object.entries(arg0);
255260
return ret;
256261
},
257-
__wbg_eval_d0dfcbbfaeff4b3c: function(arg0, arg1) {
262+
__wbg_eval_5088487c29e8df77: function(arg0, arg1) {
258263
const ret = eval(getStringFromWasm0(arg0, arg1));
259264
return ret;
260265
},
261-
__wbg_get_67b2ba62fc30de12: function() { return handleError(function (arg0, arg1) {
262-
const ret = Reflect.get(arg0, arg1);
263-
return ret;
264-
}, arguments) },
265-
__wbg_get_b9b93047fe3cf45b: function(arg0, arg1) {
266+
__wbg_get_0da715ceaecea5c8: function(arg0, arg1) {
266267
const ret = arg0[arg1 >>> 0];
267268
return ret;
268269
},
269-
__wbg_instanceof_ArrayBuffer_e14585432e3737fc: function(arg0) {
270+
__wbg_get_458e874b43b18b25: function() { return handleError(function (arg0, arg1) {
271+
const ret = Reflect.get(arg0, arg1);
272+
return ret;
273+
}, arguments) },
274+
__wbg_instanceof_ArrayBuffer_67f3012529f6a2dd: function(arg0) {
270275
let result;
271276
try {
272277
result = arg0 instanceof ArrayBuffer;
@@ -276,7 +281,7 @@ const imports = {
276281
const ret = result;
277282
return ret;
278283
},
279-
__wbg_instanceof_Map_f3469ce2244d2430: function(arg0) {
284+
__wbg_instanceof_Map_ebb01a5b6b5ffd0b: function(arg0) {
280285
let result;
281286
try {
282287
result = arg0 instanceof Map;
@@ -286,7 +291,7 @@ const imports = {
286291
const ret = result;
287292
return ret;
288293
},
289-
__wbg_instanceof_Uint8Array_17156bcf118086a9: function(arg0) {
294+
__wbg_instanceof_Uint8Array_9a8378d955933db7: function(arg0) {
290295
let result;
291296
try {
292297
result = arg0 instanceof Uint8Array;
@@ -296,152 +301,132 @@ const imports = {
296301
const ret = result;
297302
return ret;
298303
},
299-
__wbg_isArray_a1eab7e0d067391b: function(arg0) {
304+
__wbg_isArray_030cce220591fb41: function(arg0) {
300305
const ret = Array.isArray(arg0);
301306
return ret;
302307
},
303-
__wbg_isSafeInteger_343e2beeeece1bb0: function(arg0) {
308+
__wbg_isSafeInteger_1c0d1af5542e102a: function(arg0) {
304309
const ret = Number.isSafeInteger(arg0);
305310
return ret;
306311
},
307-
__wbg_iterator_9a24c88df860dc65: function() {
312+
__wbg_iterator_f370b34483c71a1c: function() {
308313
const ret = Symbol.iterator;
309314
return ret;
310315
},
311-
__wbg_length_a446193dc22c12f8: function(arg0) {
316+
__wbg_length_186546c51cd61acd: function(arg0) {
312317
const ret = arg0.length;
313318
return ret;
314319
},
315-
__wbg_length_e2d2a49132c1b256: function(arg0) {
320+
__wbg_length_6bb7e81f9d7713e4: function(arg0) {
316321
const ret = arg0.length;
317322
return ret;
318323
},
319-
__wbg_new_a12002a7f91c75be: function(arg0) {
324+
__wbg_new_638ebfaedbf32a5e: function(arg0) {
320325
const ret = new Uint8Array(arg0);
321326
return ret;
322327
},
323-
__wbg_next_25feadfc0913fea9: function(arg0) {
328+
__wbg_next_5b3530e612fde77d: function(arg0) {
324329
const ret = arg0.next;
325330
return ret;
326331
},
327-
__wbg_next_6574e1a8a62d1055: function() { return handleError(function (arg0) {
332+
__wbg_next_692e82279131b03c: function() { return handleError(function (arg0) {
328333
const ret = arg0.next();
329334
return ret;
330335
}, arguments) },
331-
__wbg_set_65595bdd868b3009: function(arg0, arg1, arg2) {
332-
arg0.set(arg1, arg2 >>> 0);
336+
__wbg_prototypesetcall_3d4a26c1ed734349: function(arg0, arg1, arg2) {
337+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
333338
},
334-
__wbg_value_cd1ffa7b1ab794f1: function(arg0) {
339+
__wbg_value_dd9372230531eade: function(arg0) {
335340
const ret = arg0.value;
336341
return ret;
337342
},
338-
__wbindgen_bigint_from_i64: function(arg0) {
339-
const ret = arg0;
340-
return ret;
341-
},
342-
__wbindgen_bigint_from_u64: function(arg0) {
343-
const ret = BigInt.asUintN(64, arg0);
344-
return ret;
345-
},
346-
__wbindgen_bigint_get_as_i64: function(arg0, arg1) {
343+
__wbg_wbindgenbigintgetasi64_ac743ece6ab9bba1: function(arg0, arg1) {
347344
const v = arg1;
348345
const ret = typeof(v) === 'bigint' ? v : undefined;
349346
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
350347
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
351348
},
352-
__wbindgen_boolean_get: function(arg0) {
349+
__wbg_wbindgenbooleanget_3fe6f642c7d97746: function(arg0) {
353350
const v = arg0;
354-
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
355-
return ret;
351+
const ret = typeof(v) === 'boolean' ? v : undefined;
352+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
356353
},
357-
__wbindgen_debug_string: function(arg0, arg1) {
354+
__wbg_wbindgendebugstring_99ef257a3ddda34d: function(arg0, arg1) {
358355
const ret = debugString(arg1);
359356
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
360357
const len1 = WASM_VECTOR_LEN;
361358
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
362359
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
363360
},
364-
__wbindgen_error_new: function(arg0, arg1) {
365-
const ret = new Error(getStringFromWasm0(arg0, arg1));
366-
return ret;
367-
},
368-
__wbindgen_in: function(arg0, arg1) {
361+
__wbg_wbindgenin_d7a1ee10933d2d55: function(arg0, arg1) {
369362
const ret = arg0 in arg1;
370363
return ret;
371364
},
372-
__wbindgen_init_externref_table: function() {
373-
const table = wasm.__wbindgen_export_2;
374-
const offset = table.grow(4);
375-
table.set(0, undefined);
376-
table.set(offset + 0, undefined);
377-
table.set(offset + 1, null);
378-
table.set(offset + 2, true);
379-
table.set(offset + 3, false);
380-
;
381-
},
382-
__wbindgen_is_bigint: function(arg0) {
365+
__wbg_wbindgenisbigint_ecb90cc08a5a9154: function(arg0) {
383366
const ret = typeof(arg0) === 'bigint';
384367
return ret;
385368
},
386-
__wbindgen_is_function: function(arg0) {
369+
__wbg_wbindgenisfunction_8cee7dce3725ae74: function(arg0) {
387370
const ret = typeof(arg0) === 'function';
388371
return ret;
389372
},
390-
__wbindgen_is_object: function(arg0) {
373+
__wbg_wbindgenisobject_307a53c6bd97fbf8: function(arg0) {
391374
const val = arg0;
392375
const ret = typeof(val) === 'object' && val !== null;
393376
return ret;
394377
},
395-
__wbindgen_jsval_eq: function(arg0, arg1) {
378+
__wbg_wbindgenjsvaleq_e6f2ad59ccae1b58: function(arg0, arg1) {
396379
const ret = arg0 === arg1;
397380
return ret;
398381
},
399-
__wbindgen_jsval_loose_eq: function(arg0, arg1) {
382+
__wbg_wbindgenjsvallooseeq_9bec8c9be826bed1: function(arg0, arg1) {
400383
const ret = arg0 == arg1;
401384
return ret;
402385
},
403-
__wbindgen_memory: function() {
404-
const ret = wasm.memory;
405-
return ret;
406-
},
407-
__wbindgen_number_get: function(arg0, arg1) {
386+
__wbg_wbindgennumberget_f74b4c7525ac05cb: function(arg0, arg1) {
408387
const obj = arg1;
409388
const ret = typeof(obj) === 'number' ? obj : undefined;
410389
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
411390
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
412391
},
413-
__wbindgen_string_get: function(arg0, arg1) {
392+
__wbg_wbindgenstringget_0f16a6ddddef376f: function(arg0, arg1) {
414393
const obj = arg1;
415394
const ret = typeof(obj) === 'string' ? obj : undefined;
416395
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
417396
var len1 = WASM_VECTOR_LEN;
418397
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
419398
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
420399
},
421-
__wbindgen_throw: function(arg0, arg1) {
400+
__wbg_wbindgenthrow_451ec1a8469d7eb6: function(arg0, arg1) {
422401
throw new Error(getStringFromWasm0(arg0, arg1));
423402
},
403+
__wbindgen_cast_4625c577ab2ec9ee: function(arg0) {
404+
// Cast intrinsic for `U64 -> Externref`.
405+
const ret = BigInt.asUintN(64, arg0);
406+
return ret;
407+
},
408+
__wbindgen_cast_9ae0607507abb057: function(arg0) {
409+
// Cast intrinsic for `I64 -> Externref`.
410+
const ret = arg0;
411+
return ret;
412+
},
413+
__wbindgen_init_externref_table: function() {
414+
const table = wasm.__wbindgen_export_2;
415+
const offset = table.grow(4);
416+
table.set(0, undefined);
417+
table.set(offset + 0, undefined);
418+
table.set(offset + 1, null);
419+
table.set(offset + 2, true);
420+
table.set(offset + 3, false);
421+
;
422+
},
424423
},
425424

426425
};
427426

428-
const wasm_url = new URL('windmill_parser_wasm_bg.wasm', import.meta.url);
429-
let wasmCode = '';
430-
switch (wasm_url.protocol) {
431-
case 'file:':
432-
wasmCode = await Deno.readFile(wasm_url);
433-
break
434-
case 'https:':
435-
case 'http:':
436-
wasmCode = await (await fetch(wasm_url)).arrayBuffer();
437-
break
438-
default:
439-
throw new Error(`Unsupported protocol: ${wasm_url.protocol}`);
440-
}
441-
442-
const wasmInstance = (await WebAssembly.instantiate(wasmCode, imports)).instance;
443-
const wasm = wasmInstance.exports;
444-
export const __wasm = wasm;
427+
const wasmUrl = new URL('windmill_parser_wasm_bg.wasm', import.meta.url);
428+
const wasm = (await WebAssembly.instantiateStreaming(fetch(wasmUrl), imports)).instance.exports;
429+
export { wasm as __wasm };
445430

446431
wasm.__wbindgen_start();
447432

4.49 KB
Binary file not shown.

frontend/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
"windmill-parser-wasm-regex": "1.565.0",
148148
"windmill-parser-wasm-ruby": "1.526.1",
149149
"windmill-parser-wasm-rust": "1.558.1",
150-
"windmill-parser-wasm-ts": "1.538.0",
150+
"windmill-parser-wasm-ts": "1.565.0",
151151
"windmill-parser-wasm-yaml": "1.561.0",
152152
"windmill-sql-datatype-parser-wasm": "1.512.0",
153153
"windmill-utils-internal": "^1.3.1",

0 commit comments

Comments
 (0)