Skip to content

Commit 09a950c

Browse files
author
flowcore-platform
committed
fix(package): ✨ Update dependencies and add bunfig.toml configuration
1 parent 76d7867 commit 09a950c

File tree

5 files changed

+100
-32
lines changed

5 files changed

+100
-32
lines changed

bun.lock

Lines changed: 73 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"devDependencies": {
2222
"@biomejs/biome": "^1.9.4",
2323
"@types/bun": "latest",
24+
"rimraf": "^6.0.1",
2425
"typescript": "^5",
2526
},
2627
"peerDependencies": {
@@ -107,7 +108,7 @@
107108

108109
"aggregate-error": ["[email protected]", "", { "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" } }, ""],
109110

110-
"ansi-regex": ["ansi-regex@5.0.1", "", {}, ""],
111+
"ansi-regex": ["ansi-regex@6.1.0", "", {}, ""],
111112

112113
"ansi-styles": ["[email protected]", "", {}, ""],
113114

@@ -129,7 +130,7 @@
129130

130131
"body-parser": ["[email protected]", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^1.0.5", "debug": "^4.4.0", "http-errors": "^2.0.0", "iconv-lite": "^0.5.2", "on-finished": "^2.4.1", "qs": "^6.14.0", "raw-body": "^3.0.0", "type-is": "^2.0.0" } }, ""],
131132

132-
"brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, ""],
133+
"brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, ""],
133134

134135
"buffer": ["[email protected]", "", { "dependencies": { "base64-js": "^1.0.2", "ieee754": "^1.1.4", "isarray": "^1.0.0" } }, ""],
135136

@@ -199,7 +200,7 @@
199200

200201
"ee-first": ["[email protected]", "", {}, ""],
201202

202-
"emoji-regex": ["emoji-regex@8.0.0", "", {}, ""],
203+
"emoji-regex": ["emoji-regex@9.2.2", "", {}, ""],
203204

204205
"encodeurl": ["[email protected]", "", {}, ""],
205206

@@ -255,7 +256,7 @@
255256

256257
"get-proto": ["[email protected]", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, ""],
257258

258-
"glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, ""],
259+
"glob": ["glob@11.0.1", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^4.0.1", "minimatch": "^10.0.0", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^2.0.0" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-zrQDm8XPnYEKawJScsnM0QzobJxlT/kHOOlRTio8IH/GrmxRE5fjllkzdaHclIuNjUQTJYH2xHNIGfdpJkDJUw=="],
259260

260261
"gopd": ["[email protected]", "", {}, ""],
261262

@@ -321,7 +322,7 @@
321322

322323
"isexe": ["[email protected]", "", {}, ""],
323324

324-
"jackspeak": ["jackspeak@3.4.3", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, ""],
325+
"jackspeak": ["jackspeak@4.1.0", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" } }, "sha512-9DDdhb5j6cpeitCbvLO7n7J4IxnbM6hoF6O1g4HQ5TfhvvKN8ywDM7668ZhMHRqVmxqhps/F6syWK2KcPxYlkw=="],
325326

326327
"jmespath": ["[email protected]", "", {}, ""],
327328

@@ -335,7 +336,7 @@
335336

336337
"long": ["[email protected]", "", {}, ""],
337338

338-
"lru-cache": ["lru-cache@7.18.3", "", {}, ""],
339+
"lru-cache": ["lru-cache@11.1.0", "", {}, "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A=="],
339340

340341
"make-fetch-happen": ["[email protected]", "", { "dependencies": { "agentkeepalive": "^4.2.1", "cacache": "^16.1.0", "http-cache-semantics": "^4.1.0", "http-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.0", "is-lambda": "^1.0.1", "lru-cache": "^7.7.1", "minipass": "^3.1.6", "minipass-collect": "^1.0.2", "minipass-fetch": "^2.0.3", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^0.6.3", "promise-retry": "^2.0.1", "socks-proxy-agent": "^7.0.0", "ssri": "^9.0.0" } }, ""],
341342

@@ -351,7 +352,7 @@
351352

352353
"mime-types": ["[email protected]", "", { "dependencies": { "mime-db": "^1.53.0" } }, ""],
353354

354-
"minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, ""],
355+
"minimatch": ["minimatch@10.0.1", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ=="],
355356

356357
"minipass": ["[email protected]", "", {}, ""],
357358

@@ -411,7 +412,7 @@
411412

412413
"path-key": ["[email protected]", "", {}, ""],
413414

414-
"path-scurry": ["path-scurry@1.11.1", "", { "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, ""],
415+
"path-scurry": ["path-scurry@2.0.0", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg=="],
415416

416417
"path-to-regexp": ["[email protected]", "", {}, ""],
417418

@@ -443,7 +444,7 @@
443444

444445
"retry": ["[email protected]", "", {}, ""],
445446

446-
"rimraf": ["rimraf@3.0.2", "", { "dependencies": { "glob": "^7.1.3" }, "bin": "bin.js" }, ""],
447+
"rimraf": ["rimraf@6.0.1", "", { "dependencies": { "glob": "^11.0.0", "package-json-from-dist": "^1.0.0" }, "bin": { "rimraf": "dist/esm/bin.mjs" } }, "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A=="],
447448

448449
"router": ["[email protected]", "", { "dependencies": { "is-promise": "^4.0.0", "parseurl": "^1.3.3", "path-to-regexp": "^8.0.0" } }, ""],
449450

@@ -481,7 +482,7 @@
481482

482483
"side-channel-weakmap": ["[email protected]", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3", "side-channel-map": "^1.0.1" } }, ""],
483484

484-
"signal-exit": ["signal-exit@3.0.7", "", {}, ""],
485+
"signal-exit": ["signal-exit@4.1.0", "", {}, ""],
485486

486487
"smart-buffer": ["[email protected]", "", {}, ""],
487488

@@ -497,13 +498,13 @@
497498

498499
"strict-event-emitter": ["[email protected]", "", {}, ""],
499500

500-
"string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, ""],
501+
"string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, ""],
501502

502503
"string-width-cjs": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, ""],
503504

504505
"string_decoder": ["[email protected]", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, ""],
505506

506-
"strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, ""],
507+
"strip-ansi": ["strip-ansi@7.1.0", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, ""],
507508

508509
"strip-ansi-cjs": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, ""],
509510

@@ -575,12 +576,10 @@
575576

576577
"zod-to-json-schema": ["[email protected]", "", { "peerDependencies": { "zod": "^3.24.1" } }, ""],
577578

578-
"@isaacs/cliui/string-width": ["[email protected]", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, ""],
579-
580-
"@isaacs/cliui/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, ""],
581-
582579
"@npmcli/move-file/mkdirp": ["[email protected]", "", { "bin": "bin/cmd.js" }, ""],
583580

581+
"@npmcli/move-file/rimraf": ["[email protected]", "", { "dependencies": { "glob": "^7.1.3" }, "bin": "bin.js" }, ""],
582+
584583
"body-parser/debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, ""],
585584

586585
"body-parser/iconv-lite": ["[email protected]", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3" } }, ""],
@@ -591,20 +590,28 @@
591590

592591
"cacache/glob": ["[email protected]", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", "once": "^1.3.0" } }, ""],
593592

593+
"cacache/lru-cache": ["[email protected]", "", {}, ""],
594+
594595
"cacache/minipass": ["[email protected]", "", { "dependencies": { "yallist": "^4.0.0" } }, ""],
595596

596597
"cacache/mkdirp": ["[email protected]", "", { "bin": "bin/cmd.js" }, ""],
597598

599+
"cacache/rimraf": ["[email protected]", "", { "dependencies": { "glob": "^7.1.3" }, "bin": "bin.js" }, ""],
600+
598601
"cacache/tar": ["[email protected]", "", { "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" } }, ""],
599602

600603
"cross-spawn/which": ["[email protected]", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "bin/node-which" } }, ""],
601604

602605
"finalhandler/debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, ""],
603606

604-
"foreground-child/signal-exit": ["[email protected]", "", {}, ""],
605-
606607
"fs-minipass/minipass": ["[email protected]", "", { "dependencies": { "yallist": "^4.0.0" } }, ""],
607608

609+
"gauge/signal-exit": ["[email protected]", "", {}, ""],
610+
611+
"gauge/string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, ""],
612+
613+
"gauge/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, ""],
614+
608615
"http-proxy-agent/agent-base": ["[email protected]", "", { "dependencies": { "debug": "4" } }, ""],
609616

610617
"http-proxy-agent/debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, ""],
@@ -615,6 +622,8 @@
615622

616623
"make-fetch-happen/https-proxy-agent": ["[email protected]", "", { "dependencies": { "agent-base": "6", "debug": "4" } }, ""],
617624

625+
"make-fetch-happen/lru-cache": ["[email protected]", "", {}, ""],
626+
618627
"make-fetch-happen/minipass": ["[email protected]", "", { "dependencies": { "yallist": "^4.0.0" } }, ""],
619628

620629
"make-fetch-happen/negotiator": ["[email protected]", "", {}, ""],
@@ -633,14 +642,16 @@
633642

634643
"minizlib/rimraf": ["[email protected]", "", { "dependencies": { "glob": "^10.3.7" }, "bin": "dist/esm/bin.mjs" }, ""],
635644

645+
"node-gyp/glob": ["[email protected]", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, ""],
646+
636647
"node-gyp/nopt": ["[email protected]", "", { "dependencies": { "abbrev": "^1.0.0" }, "bin": "bin/nopt.js" }, ""],
637648

649+
"node-gyp/rimraf": ["[email protected]", "", { "dependencies": { "glob": "^7.1.3" }, "bin": "bin.js" }, ""],
650+
638651
"node-gyp/tar": ["[email protected]", "", { "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" } }, ""],
639652

640653
"node-gyp/which": ["[email protected]", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "bin/node-which" } }, ""],
641654

642-
"path-scurry/lru-cache": ["[email protected]", "", {}, ""],
643-
644655
"send/fresh": ["[email protected]", "", {}, ""],
645656

646657
"send/mime-types": ["[email protected]", "", { "dependencies": { "mime-db": "1.52.0" } }, ""],
@@ -653,22 +664,30 @@
653664

654665
"ssri/minipass": ["[email protected]", "", { "dependencies": { "yallist": "^4.0.0" } }, ""],
655666

656-
"wrap-ansi/string-width": ["[email protected]", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, ""],
667+
"string-width-cjs/emoji-regex": ["[email protected]", "", {}, ""],
668+
669+
"string-width-cjs/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, ""],
670+
671+
"strip-ansi-cjs/ansi-regex": ["[email protected]", "", {}, ""],
657672

658-
"wrap-ansi/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, ""],
673+
"wide-align/string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, ""],
659674

660675
"wrap-ansi-cjs/ansi-styles": ["[email protected]", "", { "dependencies": { "color-convert": "^2.0.1" } }, ""],
661676

662-
"@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, ""],
677+
"wrap-ansi-cjs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, ""],
663678

664-
"@isaacs/cliui/strip-ansi/ansi-regex": ["[email protected]", "", {}, ""],
679+
"wrap-ansi-cjs/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, ""],
680+
681+
"@npmcli/move-file/rimraf/glob": ["[email protected]", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, ""],
665682

666683
"body-parser/debug/ms": ["[email protected]", "", {}, ""],
667684

668685
"cacache/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, ""],
669686

670687
"cacache/minipass/yallist": ["[email protected]", "", {}, ""],
671688

689+
"cacache/rimraf/glob": ["[email protected]", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, ""],
690+
672691
"cacache/tar/minipass": ["[email protected]", "", {}, ""],
673692

674693
"cacache/tar/minizlib": ["[email protected]", "", { "dependencies": { "minipass": "^3.0.0", "yallist": "^4.0.0" } }, ""],
@@ -681,6 +700,10 @@
681700

682701
"fs-minipass/minipass/yallist": ["[email protected]", "", {}, ""],
683702

703+
"gauge/string-width/emoji-regex": ["[email protected]", "", {}, ""],
704+
705+
"gauge/strip-ansi/ansi-regex": ["[email protected]", "", {}, ""],
706+
684707
"http-proxy-agent/debug/ms": ["[email protected]", "", {}, ""],
685708

686709
"https-proxy-agent/debug/ms": ["[email protected]", "", {}, ""],
@@ -705,6 +728,8 @@
705728

706729
"minizlib/rimraf/glob": ["[email protected]", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": "dist/esm/bin.mjs" }, ""],
707730

731+
"node-gyp/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, ""],
732+
708733
"node-gyp/nopt/abbrev": ["[email protected]", "", {}, ""],
709734

710735
"node-gyp/tar/chownr": ["[email protected]", "", {}, ""],
@@ -725,20 +750,40 @@
725750

726751
"ssri/minipass/yallist": ["[email protected]", "", {}, ""],
727752

728-
"wrap-ansi/string-width/emoji-regex": ["[email protected]", "", {}, ""],
753+
"string-width-cjs/strip-ansi/ansi-regex": ["[email protected]", "", {}, ""],
754+
755+
"wide-align/string-width/emoji-regex": ["[email protected]", "", {}, ""],
756+
757+
"wide-align/string-width/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, ""],
758+
759+
"wrap-ansi-cjs/string-width/emoji-regex": ["[email protected]", "", {}, ""],
729760

730-
"wrap-ansi/strip-ansi/ansi-regex": ["ansi-regex@6.1.0", "", {}, ""],
761+
"wrap-ansi-cjs/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, ""],
731762

732-
"cacache/glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, ""],
763+
"@npmcli/move-file/rimraf/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, ""],
764+
765+
"cacache/rimraf/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, ""],
733766

734767
"cacache/tar/minizlib/minipass": ["[email protected]", "", { "dependencies": { "yallist": "^4.0.0" } }, ""],
735768

736769
"make-fetch-happen/https-proxy-agent/debug/ms": ["[email protected]", "", {}, ""],
737770

771+
"minizlib/rimraf/glob/jackspeak": ["[email protected]", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, ""],
772+
738773
"minizlib/rimraf/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, ""],
739774

775+
"minizlib/rimraf/glob/path-scurry": ["[email protected]", "", { "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, ""],
776+
777+
"node-gyp/glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, ""],
778+
740779
"node-gyp/tar/minizlib/minipass": ["[email protected]", "", { "dependencies": { "yallist": "^4.0.0" } }, ""],
741780

742-
"minizlib/rimraf/glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, ""],
781+
"wide-align/string-width/strip-ansi/ansi-regex": ["[email protected]", "", {}, ""],
782+
783+
"@npmcli/move-file/rimraf/glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, ""],
784+
785+
"cacache/rimraf/glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, ""],
786+
787+
"minizlib/rimraf/glob/path-scurry/lru-cache": ["[email protected]", "", {}, ""],
743788
}
744789
}

bunfig.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[install]
2+
production = false
3+
4+
[install.native]
5+
duckdb = true

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"README.md"
2424
],
2525
"scripts": {
26-
"build": "bun build ./src/index.ts --outdir ./dist --target node && bun run copy-files && bun run add-shebang",
26+
"build": "rimraf dist && bun run copy-files && bun build ./src/index.ts --outdir ./dist --target node && bun run add-shebang",
2727
"copy-files": "bun run scripts/copy-files.ts",
2828
"add-shebang": "bun run scripts/add-shebang.ts",
2929
"prepublishOnly": "bun run build",
@@ -34,6 +34,7 @@
3434
"devDependencies": {
3535
"@biomejs/biome": "^1.9.4",
3636
"@types/bun": "latest",
37+
"rimraf": "^6.0.1",
3738
"typescript": "^5"
3839
},
3940
"peerDependencies": {

src/duckdb/projector.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import { insertRecordIntoTable } from "./index"
44
// Store projector functions by name
55
const projectors: Record<string, ProjectorInfo> = {}
66

7+
type ProjectionResult = Record<string, unknown> | (Record<string, unknown>)[]
8+
79
// Type definition for a projection function
8-
export type ProjectionFunction = (event: FlowcoreEvent) => Record<string, unknown>
10+
export type ProjectionFunction = (event: FlowcoreEvent) => ProjectionResult | Promise<ProjectionResult>
911

1012
// Type definition for any function that could work as a projector
11-
export type GenericProjectionFunction = (event: Record<string, unknown>) => Record<string, unknown>
13+
export type GenericProjectionFunction = (event: Record<string, unknown>) => ProjectionResult | Promise<ProjectionResult>
1214

1315
// Type to store projector information
1416
interface ProjectorInfo {
@@ -95,10 +97,22 @@ export async function projectEvent(event: FlowcoreEvent, targetTable?: string, p
9597

9698
try {
9799
// Transform the event to a database record
98-
const record = projector.function(event)
100+
const record = await projector.function(event)
99101

100102
// Only insert if a target table is provided
101103
if (targetTable) {
104+
if (Array.isArray(record)) {
105+
// Insert each record into the database
106+
const results = await Promise.all(record.map(r => insertRecordIntoTable(targetTable, r)))
107+
return {
108+
success: results.every(r => r.success),
109+
message: results.map(r => r.message).join("\n"),
110+
projectorName: projector.name,
111+
targetTable,
112+
records: record,
113+
}
114+
}
115+
102116
// Insert the record into the database
103117
const result = await insertRecordIntoTable(targetTable, record)
104118

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ server.tool(
147147
- Return null for unmappable fields rather than throwing errors
148148
149149
4. Example Function Structure:
150+
151+
The function must return a single object or an array of objects, it can also return a promise that resolves to a single object or an array of objects.
152+
150153
<example js code>
151154
function projectEvent(event) {
152155
return {

0 commit comments

Comments
 (0)