@hasna/connectors 1.3.33 → 1.3.35
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/bin/index.js +1119 -268
- package/bin/mcp.js +378 -201
- package/bin/serve.js +452 -275
- package/dashboard/dist/assets/index-DJjxFlTl.css +1 -0
- package/dashboard/dist/assets/index-DNPZ58_i.js +284 -0
- package/dashboard/dist/index.html +2 -2
- package/dist/cli/components/App.d.ts +2 -1
- package/dist/cli/components/CategorySelect.d.ts +2 -1
- package/dist/cli/components/ConnectorSelect.d.ts +2 -1
- package/dist/cli/components/Header.d.ts +2 -1
- package/dist/cli/components/InstallProgress.d.ts +2 -1
- package/dist/cli/components/SearchView.d.ts +2 -1
- package/dist/index.js +109 -110
- package/package.json +3 -2
- package/connectors/connect-github/bin/index.js +0 -3518
- package/connectors/connect-github/dist/index.js +0 -520
- package/connectors/connect-yousign/bun.lock +0 -32
- package/connectors/connect-yousign/node_modules/@types/bun/LICENSE +0 -21
- package/connectors/connect-yousign/node_modules/@types/bun/README.md +0 -20
- package/connectors/connect-yousign/node_modules/@types/bun/index.d.ts +0 -1
- package/connectors/connect-yousign/node_modules/@types/bun/package.json +0 -53
- package/connectors/connect-yousign/node_modules/@types/node/LICENSE +0 -21
- package/connectors/connect-yousign/node_modules/@types/node/README.md +0 -15
- package/connectors/connect-yousign/node_modules/@types/node/assert/strict.d.ts +0 -105
- package/connectors/connect-yousign/node_modules/@types/node/assert.d.ts +0 -955
- package/connectors/connect-yousign/node_modules/@types/node/async_hooks.d.ts +0 -623
- package/connectors/connect-yousign/node_modules/@types/node/buffer.buffer.d.ts +0 -466
- package/connectors/connect-yousign/node_modules/@types/node/buffer.d.ts +0 -1810
- package/connectors/connect-yousign/node_modules/@types/node/child_process.d.ts +0 -1433
- package/connectors/connect-yousign/node_modules/@types/node/cluster.d.ts +0 -486
- package/connectors/connect-yousign/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
- package/connectors/connect-yousign/node_modules/@types/node/console.d.ts +0 -151
- package/connectors/connect-yousign/node_modules/@types/node/constants.d.ts +0 -20
- package/connectors/connect-yousign/node_modules/@types/node/crypto.d.ts +0 -4065
- package/connectors/connect-yousign/node_modules/@types/node/dgram.d.ts +0 -564
- package/connectors/connect-yousign/node_modules/@types/node/diagnostics_channel.d.ts +0 -576
- package/connectors/connect-yousign/node_modules/@types/node/dns/promises.d.ts +0 -503
- package/connectors/connect-yousign/node_modules/@types/node/dns.d.ts +0 -922
- package/connectors/connect-yousign/node_modules/@types/node/domain.d.ts +0 -166
- package/connectors/connect-yousign/node_modules/@types/node/events.d.ts +0 -1047
- package/connectors/connect-yousign/node_modules/@types/node/fs/promises.d.ts +0 -1329
- package/connectors/connect-yousign/node_modules/@types/node/fs.d.ts +0 -4678
- package/connectors/connect-yousign/node_modules/@types/node/globals.d.ts +0 -150
- package/connectors/connect-yousign/node_modules/@types/node/globals.typedarray.d.ts +0 -101
- package/connectors/connect-yousign/node_modules/@types/node/http.d.ts +0 -2188
- package/connectors/connect-yousign/node_modules/@types/node/http2.d.ts +0 -2480
- package/connectors/connect-yousign/node_modules/@types/node/https.d.ts +0 -405
- package/connectors/connect-yousign/node_modules/@types/node/index.d.ts +0 -115
- package/connectors/connect-yousign/node_modules/@types/node/inspector/promises.d.ts +0 -41
- package/connectors/connect-yousign/node_modules/@types/node/inspector.d.ts +0 -269
- package/connectors/connect-yousign/node_modules/@types/node/inspector.generated.d.ts +0 -4401
- package/connectors/connect-yousign/node_modules/@types/node/module.d.ts +0 -757
- package/connectors/connect-yousign/node_modules/@types/node/net.d.ts +0 -933
- package/connectors/connect-yousign/node_modules/@types/node/os.d.ts +0 -507
- package/connectors/connect-yousign/node_modules/@types/node/package.json +0 -155
- package/connectors/connect-yousign/node_modules/@types/node/path/posix.d.ts +0 -8
- package/connectors/connect-yousign/node_modules/@types/node/path/win32.d.ts +0 -8
- package/connectors/connect-yousign/node_modules/@types/node/path.d.ts +0 -187
- package/connectors/connect-yousign/node_modules/@types/node/perf_hooks.d.ts +0 -643
- package/connectors/connect-yousign/node_modules/@types/node/process.d.ts +0 -2175
- package/connectors/connect-yousign/node_modules/@types/node/punycode.d.ts +0 -117
- package/connectors/connect-yousign/node_modules/@types/node/querystring.d.ts +0 -152
- package/connectors/connect-yousign/node_modules/@types/node/quic.d.ts +0 -910
- package/connectors/connect-yousign/node_modules/@types/node/readline/promises.d.ts +0 -161
- package/connectors/connect-yousign/node_modules/@types/node/readline.d.ts +0 -542
- package/connectors/connect-yousign/node_modules/@types/node/repl.d.ts +0 -415
- package/connectors/connect-yousign/node_modules/@types/node/sea.d.ts +0 -162
- package/connectors/connect-yousign/node_modules/@types/node/sqlite.d.ts +0 -1065
- package/connectors/connect-yousign/node_modules/@types/node/stream/consumers.d.ts +0 -38
- package/connectors/connect-yousign/node_modules/@types/node/stream/promises.d.ts +0 -211
- package/connectors/connect-yousign/node_modules/@types/node/stream/web.d.ts +0 -296
- package/connectors/connect-yousign/node_modules/@types/node/stream.d.ts +0 -1770
- package/connectors/connect-yousign/node_modules/@types/node/string_decoder.d.ts +0 -67
- package/connectors/connect-yousign/node_modules/@types/node/test/reporters.d.ts +0 -96
- package/connectors/connect-yousign/node_modules/@types/node/test.d.ts +0 -2275
- package/connectors/connect-yousign/node_modules/@types/node/timers/promises.d.ts +0 -108
- package/connectors/connect-yousign/node_modules/@types/node/timers.d.ts +0 -159
- package/connectors/connect-yousign/node_modules/@types/node/tls.d.ts +0 -1203
- package/connectors/connect-yousign/node_modules/@types/node/trace_events.d.ts +0 -197
- package/connectors/connect-yousign/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -462
- package/connectors/connect-yousign/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
- package/connectors/connect-yousign/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -36
- package/connectors/connect-yousign/node_modules/@types/node/ts5.6/index.d.ts +0 -117
- package/connectors/connect-yousign/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
- package/connectors/connect-yousign/node_modules/@types/node/ts5.7/index.d.ts +0 -117
- package/connectors/connect-yousign/node_modules/@types/node/tty.d.ts +0 -250
- package/connectors/connect-yousign/node_modules/@types/node/url.d.ts +0 -541
- package/connectors/connect-yousign/node_modules/@types/node/util/types.d.ts +0 -558
- package/connectors/connect-yousign/node_modules/@types/node/util.d.ts +0 -1687
- package/connectors/connect-yousign/node_modules/@types/node/v8.d.ts +0 -988
- package/connectors/connect-yousign/node_modules/@types/node/vm.d.ts +0 -1208
- package/connectors/connect-yousign/node_modules/@types/node/wasi.d.ts +0 -202
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -59
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/blob.d.ts +0 -23
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/console.d.ts +0 -9
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/domexception.d.ts +0 -68
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/events.d.ts +0 -106
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/fetch.d.ts +0 -69
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/navigator.d.ts +0 -25
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/performance.d.ts +0 -45
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/storage.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/streams.d.ts +0 -115
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/timers.d.ts +0 -44
- package/connectors/connect-yousign/node_modules/@types/node/web-globals/url.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/@types/node/worker_threads.d.ts +0 -717
- package/connectors/connect-yousign/node_modules/@types/node/zlib.d.ts +0 -682
- package/connectors/connect-yousign/node_modules/bun-types/CLAUDE.md +0 -105
- package/connectors/connect-yousign/node_modules/bun-types/README.md +0 -33
- package/connectors/connect-yousign/node_modules/bun-types/bun.d.ts +0 -8481
- package/connectors/connect-yousign/node_modules/bun-types/bun.ns.d.ts +0 -5
- package/connectors/connect-yousign/node_modules/bun-types/bundle.d.ts +0 -74
- package/connectors/connect-yousign/node_modules/bun-types/deprecated.d.ts +0 -184
- package/connectors/connect-yousign/node_modules/bun-types/devserver.d.ts +0 -187
- package/connectors/connect-yousign/node_modules/bun-types/docs/README.md +0 -28
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/bytecode.mdx +0 -447
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/css.mdx +0 -1024
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/esbuild.mdx +0 -304
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/executables.mdx +0 -1318
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/fullstack.mdx +0 -1086
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/hot-reloading.mdx +0 -229
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/html-static.mdx +0 -498
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/index.mdx +0 -1840
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/loaders.mdx +0 -451
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/macros.mdx +0 -328
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/minifier.mdx +0 -1286
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/plugins.mdx +0 -477
- package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/standalone-html.mdx +0 -314
- package/connectors/connect-yousign/node_modules/bun-types/docs/feedback.mdx +0 -75
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/arraybuffer-to-array.mdx +0 -29
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/arraybuffer-to-blob.mdx +0 -26
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/arraybuffer-to-buffer.mdx +0 -27
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/arraybuffer-to-string.mdx +0 -17
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/arraybuffer-to-typedarray.mdx +0 -41
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/blob-to-arraybuffer.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/blob-to-dataview.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/blob-to-stream.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/blob-to-string.mdx +0 -17
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/blob-to-typedarray.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/buffer-to-arraybuffer.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/buffer-to-blob.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/buffer-to-readablestream.mdx +0 -43
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/buffer-to-string.mdx +0 -27
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/buffer-to-typedarray.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/dataview-to-string.mdx +0 -17
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/typedarray-to-arraybuffer.mdx +0 -27
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/typedarray-to-blob.mdx +0 -18
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/typedarray-to-buffer.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/typedarray-to-dataview.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/typedarray-to-readablestream.mdx +0 -43
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/typedarray-to-string.mdx +0 -18
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/deployment/aws-lambda.mdx +0 -204
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/deployment/digital-ocean.mdx +0 -161
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/deployment/google-cloud-run.mdx +0 -194
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/deployment/railway.mdx +0 -145
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/deployment/render.mdx +0 -82
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/deployment/vercel.mdx +0 -97
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/astro.mdx +0 -82
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/discordjs.mdx +0 -80
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/docker.mdx +0 -151
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/drizzle.mdx +0 -195
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/elysia.mdx +0 -31
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/express.mdx +0 -43
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/gel.mdx +0 -261
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/hono.mdx +0 -47
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/mongoose.mdx +0 -92
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/neon-drizzle.mdx +0 -234
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/neon-serverless-postgres.mdx +0 -60
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/nextjs.mdx +0 -103
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/nuxt.mdx +0 -96
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/pm2.mdx +0 -55
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/prisma-postgres.mdx +0 -169
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/prisma.mdx +0 -164
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/qwik.mdx +0 -114
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/react.mdx +0 -52
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/remix.mdx +0 -97
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/sentry.mdx +0 -54
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/solidstart.mdx +0 -62
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/ssr-react.mdx +0 -49
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/stric.mdx +0 -54
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/sveltekit.mdx +0 -138
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/systemd.mdx +0 -114
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/tanstack-start.mdx +0 -791
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/upstash.mdx +0 -87
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/vite.mdx +0 -77
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/html-rewriter/extract-links.mdx +0 -71
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/html-rewriter/extract-social-meta.mdx +0 -97
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/cluster.mdx +0 -69
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/fetch-unix.mdx +0 -35
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/fetch.mdx +0 -26
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/file-uploads.mdx +0 -97
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/hot.mdx +0 -28
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/proxy.mdx +0 -50
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/server.mdx +0 -48
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/simple.mdx +0 -20
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/stream-file.mdx +0 -50
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/stream-iterator.mdx +0 -49
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/stream-node-streams-in-bun.mdx +0 -22
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/tls.mdx +0 -32
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/index.mdx +0 -10
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/add-dev.mdx +0 -28
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/add-git.mdx +0 -40
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/add-optional.mdx +0 -27
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/add-peer.mdx +0 -45
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/add-tarball.mdx +0 -35
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/add.mdx +0 -44
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/azure-artifacts.mdx +0 -76
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/cicd.mdx +0 -43
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/custom-registry.mdx +0 -32
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/from-npm-install-to-bun-install.mdx +0 -230
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/git-diff-bun-lockfile.mdx +0 -48
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/jfrog-artifactory.mdx +0 -28
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/npm-alias.mdx +0 -25
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/registry-scope.mdx +0 -40
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/trusted.mdx +0 -52
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/workspaces.mdx +0 -70
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/yarnlock.mdx +0 -51
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/argv.mdx +0 -66
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/ctrl-c.mdx +0 -18
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/ipc.mdx +0 -69
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/nanoseconds.mdx +0 -15
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/os-signals.mdx +0 -31
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/spawn-stderr.mdx +0 -34
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/spawn-stdout.mdx +0 -28
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/spawn.mdx +0 -43
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/stdin.mdx +0 -62
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/arraybuffer.mdx +0 -30
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/buffer.mdx +0 -21
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/exists.mdx +0 -18
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/json.mdx +0 -19
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/mime.mdx +0 -22
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/stream.mdx +0 -28
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/string.mdx +0 -24
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/uint8array.mdx +0 -23
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/watch.mdx +0 -66
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/build-time-constants.mdx +0 -295
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/cicd.mdx +0 -45
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/codesign-macos-executable.mdx +0 -61
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/define-constant.mdx +0 -149
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/delete-directory.mdx +0 -39
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/delete-file.mdx +0 -21
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/heap-snapshot.mdx +0 -28
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/import-html.mdx +0 -15
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/import-json.mdx +0 -46
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/import-json5.mdx +0 -74
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/import-toml.mdx +0 -32
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/import-yaml.mdx +0 -104
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/read-env.mdx +0 -37
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/set-env.mdx +0 -51
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/shell.mdx +0 -42
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/timezone.mdx +0 -38
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/tsconfig-paths.mdx +0 -31
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/typescript.mdx +0 -51
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/vscode-debugger.mdx +0 -47
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/web-debugger.mdx +0 -103
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/node-readable-to-arraybuffer.mdx +0 -13
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/node-readable-to-blob.mdx +0 -13
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/node-readable-to-json.mdx +0 -14
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/node-readable-to-string.mdx +0 -14
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/node-readable-to-uint8array.mdx +0 -13
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-array.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-arraybuffer.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-blob.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-buffer.mdx +0 -17
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-json.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-string.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-typedarray.mdx +0 -24
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/bail.mdx +0 -24
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/concurrent-test-glob.mdx +0 -146
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/coverage-threshold.mdx +0 -67
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/coverage.mdx +0 -49
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/happy-dom.mdx +0 -73
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/migrate-from-jest.mdx +0 -125
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/mock-clock.mdx +0 -50
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/mock-functions.mdx +0 -70
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/rerun-each.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/run-tests.mdx +0 -116
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/skip-tests.mdx +0 -43
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/snapshot.mdx +0 -102
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/spy-on.mdx +0 -49
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/svelte-test.mdx +0 -113
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/testing-library.mdx +0 -93
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/timeout.mdx +0 -17
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/todo-tests.mdx +0 -74
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/update-snapshots.mdx +0 -49
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/watch-mode.mdx +0 -24
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/base64.mdx +0 -17
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/deep-equals.mdx +0 -41
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/deflate.mdx +0 -20
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/detect-bun.mdx +0 -28
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/entrypoint.mdx +0 -19
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/escape-html.mdx +0 -24
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/file-url-to-path.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/gzip.mdx +0 -20
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/hash-a-password.mdx +0 -56
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/import-meta-dir.mdx +0 -15
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/import-meta-file.mdx +0 -15
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/import-meta-path.mdx +0 -15
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/javascript-uuid.mdx +0 -25
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/main.mdx +0 -43
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/path-to-file-url.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/sleep.mdx +0 -24
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/upgrade.mdx +0 -93
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/version.mdx +0 -23
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/which-path-to-executable-bin.mdx +0 -17
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/websocket/compression.mdx +0 -33
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/websocket/context.mdx +0 -79
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/websocket/pubsub.mdx +0 -43
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/websocket/simple.mdx +0 -38
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/append.mdx +0 -54
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/basic.mdx +0 -46
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/blob.mdx +0 -30
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/cat.mdx +0 -19
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/file-cp.mdx +0 -18
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/filesink.mdx +0 -54
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/response.mdx +0 -19
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/stdout.mdx +0 -23
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/stream.mdx +0 -19
- package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/unlink.mdx +0 -18
- package/connectors/connect-yousign/node_modules/bun-types/docs/index.mdx +0 -133
- package/connectors/connect-yousign/node_modules/bun-types/docs/installation.mdx +0 -372
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/bunx.mdx +0 -91
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/catalogs.mdx +0 -292
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/add.mdx +0 -179
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/audit.mdx +0 -60
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/info.mdx +0 -70
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/install.mdx +0 -591
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/link.mdx +0 -61
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/outdated.mdx +0 -197
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/patch.mdx +0 -69
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/pm.mdx +0 -323
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/publish.mdx +0 -131
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/remove.mdx +0 -16
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/update.mdx +0 -140
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/why.mdx +0 -84
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/filter.mdx +0 -127
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/global-cache.mdx +0 -72
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/isolated-installs.mdx +0 -220
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/lifecycle.mdx +0 -64
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/lockfile.mdx +0 -64
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/npmrc.mdx +0 -245
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/overrides.mdx +0 -83
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/scopes-registries.mdx +0 -35
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/security-scanner-api.mdx +0 -95
- package/connectors/connect-yousign/node_modules/bun-types/docs/pm/workspaces.mdx +0 -115
- package/connectors/connect-yousign/node_modules/bun-types/docs/project/benchmarking.mdx +0 -296
- package/connectors/connect-yousign/node_modules/bun-types/docs/project/bindgen.mdx +0 -223
- package/connectors/connect-yousign/node_modules/bun-types/docs/project/building-windows.mdx +0 -143
- package/connectors/connect-yousign/node_modules/bun-types/docs/project/contributing.mdx +0 -366
- package/connectors/connect-yousign/node_modules/bun-types/docs/project/feedback.mdx +0 -20
- package/connectors/connect-yousign/node_modules/bun-types/docs/project/license.mdx +0 -78
- package/connectors/connect-yousign/node_modules/bun-types/docs/project/roadmap.mdx +0 -8
- package/connectors/connect-yousign/node_modules/bun-types/docs/quickstart.mdx +0 -251
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/archive.mdx +0 -452
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/auto-install.mdx +0 -97
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/binary-data.mdx +0 -846
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/bun-apis.mdx +0 -59
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/bunfig.mdx +0 -754
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/c-compiler.mdx +0 -204
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/child-process.mdx +0 -659
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/color.mdx +0 -267
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/console.mdx +0 -67
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/cookies.mdx +0 -454
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/debugger.mdx +0 -335
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/environment-variables.mdx +0 -231
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/ffi.mdx +0 -567
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/file-io.mdx +0 -306
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/file-system-router.mdx +0 -118
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/file-types.mdx +0 -482
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/glob.mdx +0 -181
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/globals.mdx +0 -72
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/hashing.mdx +0 -315
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/html-rewriter.mdx +0 -333
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/cookies.mdx +0 -79
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/error-handling.mdx +0 -40
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/metrics.mdx +0 -36
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/routing.mdx +0 -289
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/server.mdx +0 -645
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/tls.mdx +0 -101
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/websockets.mdx +0 -414
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/index.mdx +0 -223
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/json5.mdx +0 -271
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/jsonl.mdx +0 -188
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/jsx.mdx +0 -115
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/markdown.mdx +0 -344
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/module-resolution.mdx +0 -374
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/networking/dns.mdx +0 -111
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/networking/fetch.mdx +0 -484
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/networking/tcp.mdx +0 -239
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/networking/udp.mdx +0 -180
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/node-api.mdx +0 -19
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/nodejs-compat.mdx +0 -468
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/plugins.mdx +0 -419
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/redis.mdx +0 -583
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/repl.mdx +0 -176
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/s3.mdx +0 -881
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/secrets.mdx +0 -340
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/semver.mdx +0 -57
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/shell.mdx +0 -637
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/sql.mdx +0 -1404
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/sqlite.mdx +0 -721
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/streams.mdx +0 -232
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/templating/create.mdx +0 -269
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/templating/init.mdx +0 -58
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/transpiler.mdx +0 -288
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/typescript.mdx +0 -58
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/utils.mdx +0 -1010
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/watch-mode.mdx +0 -161
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/web-apis.mdx +0 -29
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/workers.mdx +0 -314
- package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/yaml.mdx +0 -469
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/add.mdx +0 -166
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/build.mdx +0 -197
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/bunx.mdx +0 -49
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/feedback.mdx +0 -17
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/init.mdx +0 -84
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/install.mdx +0 -173
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/link.mdx +0 -163
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/outdated.mdx +0 -140
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/patch.mdx +0 -171
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/publish.mdx +0 -198
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/remove.mdx +0 -146
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/run.mdx +0 -305
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/test.mdx +0 -105
- package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/update.mdx +0 -144
- package/connectors/connect-yousign/node_modules/bun-types/docs/test/code-coverage.mdx +0 -409
- package/connectors/connect-yousign/node_modules/bun-types/docs/test/configuration.mdx +0 -520
- package/connectors/connect-yousign/node_modules/bun-types/docs/test/dates-times.mdx +0 -129
- package/connectors/connect-yousign/node_modules/bun-types/docs/test/discovery.mdx +0 -90
- package/connectors/connect-yousign/node_modules/bun-types/docs/test/dom.mdx +0 -226
- package/connectors/connect-yousign/node_modules/bun-types/docs/test/index.mdx +0 -409
- package/connectors/connect-yousign/node_modules/bun-types/docs/test/lifecycle.mdx +0 -366
- package/connectors/connect-yousign/node_modules/bun-types/docs/test/mocks.mdx +0 -637
- package/connectors/connect-yousign/node_modules/bun-types/docs/test/reporters.mdx +0 -126
- package/connectors/connect-yousign/node_modules/bun-types/docs/test/runtime-behavior.mdx +0 -342
- package/connectors/connect-yousign/node_modules/bun-types/docs/test/snapshots.mdx +0 -434
- package/connectors/connect-yousign/node_modules/bun-types/docs/test/writing-tests.mdx +0 -672
- package/connectors/connect-yousign/node_modules/bun-types/docs/typescript.mdx +0 -54
- package/connectors/connect-yousign/node_modules/bun-types/extensions.d.ts +0 -40
- package/connectors/connect-yousign/node_modules/bun-types/fetch.d.ts +0 -79
- package/connectors/connect-yousign/node_modules/bun-types/ffi.d.ts +0 -1154
- package/connectors/connect-yousign/node_modules/bun-types/globals.d.ts +0 -2067
- package/connectors/connect-yousign/node_modules/bun-types/html-rewriter.d.ts +0 -186
- package/connectors/connect-yousign/node_modules/bun-types/index.d.ts +0 -32
- package/connectors/connect-yousign/node_modules/bun-types/jsc.d.ts +0 -233
- package/connectors/connect-yousign/node_modules/bun-types/jsx.d.ts +0 -11
- package/connectors/connect-yousign/node_modules/bun-types/overrides.d.ts +0 -376
- package/connectors/connect-yousign/node_modules/bun-types/package.json +0 -37
- package/connectors/connect-yousign/node_modules/bun-types/redis.d.ts +0 -3352
- package/connectors/connect-yousign/node_modules/bun-types/s3.d.ts +0 -1335
- package/connectors/connect-yousign/node_modules/bun-types/security.d.ts +0 -101
- package/connectors/connect-yousign/node_modules/bun-types/serve.d.ts +0 -1296
- package/connectors/connect-yousign/node_modules/bun-types/shell.d.ts +0 -380
- package/connectors/connect-yousign/node_modules/bun-types/sql.d.ts +0 -887
- package/connectors/connect-yousign/node_modules/bun-types/sqlite.d.ts +0 -1322
- package/connectors/connect-yousign/node_modules/bun-types/test-globals.d.ts +0 -22
- package/connectors/connect-yousign/node_modules/bun-types/test.d.ts +0 -2392
- package/connectors/connect-yousign/node_modules/bun-types/vendor/expect-type/branding.d.ts +0 -283
- package/connectors/connect-yousign/node_modules/bun-types/vendor/expect-type/index.d.ts +0 -1207
- package/connectors/connect-yousign/node_modules/bun-types/vendor/expect-type/messages.d.ts +0 -395
- package/connectors/connect-yousign/node_modules/bun-types/vendor/expect-type/overloads.d.ts +0 -669
- package/connectors/connect-yousign/node_modules/bun-types/vendor/expect-type/utils.d.ts +0 -431
- package/connectors/connect-yousign/node_modules/bun-types/wasm.d.ts +0 -193
- package/connectors/connect-yousign/node_modules/chalk/license +0 -9
- package/connectors/connect-yousign/node_modules/chalk/package.json +0 -83
- package/connectors/connect-yousign/node_modules/chalk/readme.md +0 -297
- package/connectors/connect-yousign/node_modules/chalk/source/index.d.ts +0 -325
- package/connectors/connect-yousign/node_modules/chalk/source/index.js +0 -225
- package/connectors/connect-yousign/node_modules/chalk/source/utilities.js +0 -33
- package/connectors/connect-yousign/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +0 -236
- package/connectors/connect-yousign/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -223
- package/connectors/connect-yousign/node_modules/chalk/source/vendor/supports-color/browser.d.ts +0 -1
- package/connectors/connect-yousign/node_modules/chalk/source/vendor/supports-color/browser.js +0 -34
- package/connectors/connect-yousign/node_modules/chalk/source/vendor/supports-color/index.d.ts +0 -55
- package/connectors/connect-yousign/node_modules/chalk/source/vendor/supports-color/index.js +0 -190
- package/connectors/connect-yousign/node_modules/commander/LICENSE +0 -22
- package/connectors/connect-yousign/node_modules/commander/Readme.md +0 -1157
- package/connectors/connect-yousign/node_modules/commander/esm.mjs +0 -16
- package/connectors/connect-yousign/node_modules/commander/index.js +0 -24
- package/connectors/connect-yousign/node_modules/commander/lib/argument.js +0 -149
- package/connectors/connect-yousign/node_modules/commander/lib/command.js +0 -2509
- package/connectors/connect-yousign/node_modules/commander/lib/error.js +0 -39
- package/connectors/connect-yousign/node_modules/commander/lib/help.js +0 -520
- package/connectors/connect-yousign/node_modules/commander/lib/option.js +0 -330
- package/connectors/connect-yousign/node_modules/commander/lib/suggestSimilar.js +0 -101
- package/connectors/connect-yousign/node_modules/commander/package-support.json +0 -16
- package/connectors/connect-yousign/node_modules/commander/package.json +0 -84
- package/connectors/connect-yousign/node_modules/commander/typings/esm.d.mts +0 -3
- package/connectors/connect-yousign/node_modules/commander/typings/index.d.ts +0 -969
- package/connectors/connect-yousign/node_modules/typescript/LICENSE.txt +0 -55
- package/connectors/connect-yousign/node_modules/typescript/README.md +0 -50
- package/connectors/connect-yousign/node_modules/typescript/SECURITY.md +0 -41
- package/connectors/connect-yousign/node_modules/typescript/ThirdPartyNoticeText.txt +0 -193
- package/connectors/connect-yousign/node_modules/typescript/bin/tsc +0 -2
- package/connectors/connect-yousign/node_modules/typescript/bin/tsserver +0 -2
- package/connectors/connect-yousign/node_modules/typescript/lib/_tsc.js +0 -133818
- package/connectors/connect-yousign/node_modules/typescript/lib/_tsserver.js +0 -659
- package/connectors/connect-yousign/node_modules/typescript/lib/_typingsInstaller.js +0 -222
- package/connectors/connect-yousign/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/lib/de/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/lib/es/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/lib/it/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.d.ts +0 -22
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.decorators.d.ts +0 -384
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.decorators.legacy.d.ts +0 -22
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +0 -41
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.dom.d.ts +0 -39429
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.dom.iterable.d.ts +0 -571
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.collection.d.ts +0 -147
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.core.d.ts +0 -597
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.d.ts +0 -28
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.generator.d.ts +0 -77
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.iterable.d.ts +0 -605
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.promise.d.ts +0 -81
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.proxy.d.ts +0 -128
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.reflect.d.ts +0 -144
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.symbol.d.ts +0 -46
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +0 -326
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2016.array.include.d.ts +0 -116
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2016.d.ts +0 -21
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2016.full.d.ts +0 -23
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2016.intl.d.ts +0 -31
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +0 -21
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.d.ts +0 -26
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.date.d.ts +0 -31
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.full.d.ts +0 -23
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.intl.d.ts +0 -44
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.object.d.ts +0 -49
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +0 -135
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.string.d.ts +0 -45
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +0 -53
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +0 -77
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +0 -53
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.full.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.intl.d.ts +0 -83
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.promise.d.ts +0 -30
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.regexp.d.ts +0 -37
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.array.d.ts +0 -79
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.full.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.intl.d.ts +0 -23
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.object.d.ts +0 -33
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.string.d.ts +0 -37
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.symbol.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.bigint.d.ts +0 -765
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.d.ts +0 -27
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.date.d.ts +0 -42
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.full.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.intl.d.ts +0 -474
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.number.d.ts +0 -28
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.promise.d.ts +0 -47
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +0 -99
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.string.d.ts +0 -44
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +0 -41
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2021.d.ts +0 -23
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2021.full.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2021.intl.d.ts +0 -166
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2021.promise.d.ts +0 -48
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2021.string.d.ts +0 -33
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2021.weakref.d.ts +0 -78
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.array.d.ts +0 -121
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.d.ts +0 -25
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.error.d.ts +0 -75
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.full.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.intl.d.ts +0 -145
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.object.d.ts +0 -26
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.regexp.d.ts +0 -39
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.string.d.ts +0 -25
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2023.array.d.ts +0 -924
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2023.collection.d.ts +0 -21
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2023.d.ts +0 -22
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2023.full.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2023.intl.d.ts +0 -56
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +0 -65
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.collection.d.ts +0 -29
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.d.ts +0 -26
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.full.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.object.d.ts +0 -29
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.promise.d.ts +0 -35
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.regexp.d.ts +0 -25
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +0 -68
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.string.d.ts +0 -29
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es5.d.ts +0 -4601
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.es6.d.ts +0 -23
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.array.d.ts +0 -35
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.collection.d.ts +0 -96
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.d.ts +0 -29
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.decorators.d.ts +0 -28
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.disposable.d.ts +0 -193
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.error.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.float16.d.ts +0 -445
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.full.d.ts +0 -24
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.intl.d.ts +0 -21
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.iterator.d.ts +0 -148
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.promise.d.ts +0 -34
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +0 -25
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.scripthost.d.ts +0 -322
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +0 -41
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.webworker.d.ts +0 -13150
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +0 -23
- package/connectors/connect-yousign/node_modules/typescript/lib/lib.webworker.iterable.d.ts +0 -340
- package/connectors/connect-yousign/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/lib/tsc.js +0 -8
- package/connectors/connect-yousign/node_modules/typescript/lib/tsserver.js +0 -8
- package/connectors/connect-yousign/node_modules/typescript/lib/tsserverlibrary.d.ts +0 -17
- package/connectors/connect-yousign/node_modules/typescript/lib/tsserverlibrary.js +0 -21
- package/connectors/connect-yousign/node_modules/typescript/lib/typesMap.json +0 -497
- package/connectors/connect-yousign/node_modules/typescript/lib/typescript.d.ts +0 -11437
- package/connectors/connect-yousign/node_modules/typescript/lib/typescript.js +0 -200276
- package/connectors/connect-yousign/node_modules/typescript/lib/typingsInstaller.js +0 -8
- package/connectors/connect-yousign/node_modules/typescript/lib/watchGuard.js +0 -53
- package/connectors/connect-yousign/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +0 -2122
- package/connectors/connect-yousign/node_modules/typescript/package.json +0 -120
- package/connectors/connect-yousign/node_modules/undici-types/LICENSE +0 -21
- package/connectors/connect-yousign/node_modules/undici-types/README.md +0 -6
- package/connectors/connect-yousign/node_modules/undici-types/agent.d.ts +0 -32
- package/connectors/connect-yousign/node_modules/undici-types/api.d.ts +0 -43
- package/connectors/connect-yousign/node_modules/undici-types/balanced-pool.d.ts +0 -30
- package/connectors/connect-yousign/node_modules/undici-types/cache-interceptor.d.ts +0 -173
- package/connectors/connect-yousign/node_modules/undici-types/cache.d.ts +0 -36
- package/connectors/connect-yousign/node_modules/undici-types/client-stats.d.ts +0 -15
- package/connectors/connect-yousign/node_modules/undici-types/client.d.ts +0 -108
- package/connectors/connect-yousign/node_modules/undici-types/connector.d.ts +0 -34
- package/connectors/connect-yousign/node_modules/undici-types/content-type.d.ts +0 -21
- package/connectors/connect-yousign/node_modules/undici-types/cookies.d.ts +0 -30
- package/connectors/connect-yousign/node_modules/undici-types/diagnostics-channel.d.ts +0 -74
- package/connectors/connect-yousign/node_modules/undici-types/dispatcher.d.ts +0 -276
- package/connectors/connect-yousign/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -22
- package/connectors/connect-yousign/node_modules/undici-types/errors.d.ts +0 -161
- package/connectors/connect-yousign/node_modules/undici-types/eventsource.d.ts +0 -66
- package/connectors/connect-yousign/node_modules/undici-types/fetch.d.ts +0 -211
- package/connectors/connect-yousign/node_modules/undici-types/formdata.d.ts +0 -108
- package/connectors/connect-yousign/node_modules/undici-types/global-dispatcher.d.ts +0 -9
- package/connectors/connect-yousign/node_modules/undici-types/global-origin.d.ts +0 -7
- package/connectors/connect-yousign/node_modules/undici-types/h2c-client.d.ts +0 -73
- package/connectors/connect-yousign/node_modules/undici-types/handlers.d.ts +0 -15
- package/connectors/connect-yousign/node_modules/undici-types/header.d.ts +0 -160
- package/connectors/connect-yousign/node_modules/undici-types/index.d.ts +0 -88
- package/connectors/connect-yousign/node_modules/undici-types/interceptors.d.ts +0 -73
- package/connectors/connect-yousign/node_modules/undici-types/mock-agent.d.ts +0 -68
- package/connectors/connect-yousign/node_modules/undici-types/mock-call-history.d.ts +0 -111
- package/connectors/connect-yousign/node_modules/undici-types/mock-client.d.ts +0 -27
- package/connectors/connect-yousign/node_modules/undici-types/mock-errors.d.ts +0 -12
- package/connectors/connect-yousign/node_modules/undici-types/mock-interceptor.d.ts +0 -94
- package/connectors/connect-yousign/node_modules/undici-types/mock-pool.d.ts +0 -27
- package/connectors/connect-yousign/node_modules/undici-types/package.json +0 -55
- package/connectors/connect-yousign/node_modules/undici-types/patch.d.ts +0 -29
- package/connectors/connect-yousign/node_modules/undici-types/pool-stats.d.ts +0 -19
- package/connectors/connect-yousign/node_modules/undici-types/pool.d.ts +0 -41
- package/connectors/connect-yousign/node_modules/undici-types/proxy-agent.d.ts +0 -29
- package/connectors/connect-yousign/node_modules/undici-types/readable.d.ts +0 -68
- package/connectors/connect-yousign/node_modules/undici-types/retry-agent.d.ts +0 -8
- package/connectors/connect-yousign/node_modules/undici-types/retry-handler.d.ts +0 -125
- package/connectors/connect-yousign/node_modules/undici-types/round-robin-pool.d.ts +0 -41
- package/connectors/connect-yousign/node_modules/undici-types/snapshot-agent.d.ts +0 -109
- package/connectors/connect-yousign/node_modules/undici-types/util.d.ts +0 -18
- package/connectors/connect-yousign/node_modules/undici-types/utility.d.ts +0 -7
- package/connectors/connect-yousign/node_modules/undici-types/webidl.d.ts +0 -341
- package/connectors/connect-yousign/node_modules/undici-types/websocket.d.ts +0 -186
- package/dashboard/dist/assets/index-CSlS3oNV.css +0 -1
- package/dashboard/dist/assets/index-NCasN7x4.js +0 -284
- package/dist/server/server.test.d.ts +0 -1
package/bin/index.js
CHANGED
|
@@ -879,7 +879,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
879
879
|
this._exitCallback = (err) => {
|
|
880
880
|
if (err.code !== "commander.executeSubCommandAsync") {
|
|
881
881
|
throw err;
|
|
882
|
-
}
|
|
882
|
+
}
|
|
883
883
|
};
|
|
884
884
|
}
|
|
885
885
|
return this;
|
|
@@ -1909,7 +1909,7 @@ var package_default;
|
|
|
1909
1909
|
var init_package = __esm(() => {
|
|
1910
1910
|
package_default = {
|
|
1911
1911
|
name: "@hasna/connectors",
|
|
1912
|
-
version: "1.3.
|
|
1912
|
+
version: "1.3.35",
|
|
1913
1913
|
description: "Open source connector library - Install API connectors with a single command",
|
|
1914
1914
|
type: "module",
|
|
1915
1915
|
bin: {
|
|
@@ -1964,7 +1964,8 @@ var init_package = __esm(() => {
|
|
|
1964
1964
|
typescript: "^5"
|
|
1965
1965
|
},
|
|
1966
1966
|
dependencies: {
|
|
1967
|
-
"@hasna/cloud": "
|
|
1967
|
+
"@hasna/cloud": "0.1.24",
|
|
1968
|
+
"@hasna/events": "^0.1.3",
|
|
1968
1969
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
1969
1970
|
chalk: "^5.3.0",
|
|
1970
1971
|
commander: "^12.1.0",
|
|
@@ -6085,28 +6086,28 @@ var init_zod = __esm(() => {
|
|
|
6085
6086
|
|
|
6086
6087
|
// src/core/connectors/github.ts
|
|
6087
6088
|
import { Buffer as Buffer2 } from "buffer";
|
|
6088
|
-
import { existsSync } from "fs";
|
|
6089
|
-
import { dirname, join } from "path";
|
|
6089
|
+
import { existsSync as existsSync2 } from "fs";
|
|
6090
|
+
import { dirname, join as join2 } from "path";
|
|
6090
6091
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
6091
6092
|
function resolveGithubConnectorDir() {
|
|
6092
6093
|
const candidates = [
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6094
|
+
join2(__dirname2, "..", "..", "..", "connectors", "github"),
|
|
6095
|
+
join2(__dirname2, "..", "..", "connectors", "github"),
|
|
6096
|
+
join2(__dirname2, "..", "connectors", "github"),
|
|
6097
|
+
join2(process.cwd(), "connectors", "github")
|
|
6097
6098
|
];
|
|
6098
6099
|
for (const candidate of candidates) {
|
|
6099
|
-
if (
|
|
6100
|
+
if (existsSync2(candidate)) {
|
|
6100
6101
|
return candidate;
|
|
6101
6102
|
}
|
|
6102
6103
|
}
|
|
6103
6104
|
return candidates[0];
|
|
6104
6105
|
}
|
|
6105
6106
|
async function loadGitHubApiModule() {
|
|
6106
|
-
return await import(pathToFileURL(
|
|
6107
|
+
return await import(pathToFileURL(join2(CONNECTOR_DIR, "src", "api", "index.ts")).href);
|
|
6107
6108
|
}
|
|
6108
6109
|
async function loadGitHubConfigModule() {
|
|
6109
|
-
return await import(pathToFileURL(
|
|
6110
|
+
return await import(pathToFileURL(join2(CONNECTOR_DIR, "src", "utils", "config.ts")).href);
|
|
6110
6111
|
}
|
|
6111
6112
|
function extractGlobalArgs(args) {
|
|
6112
6113
|
const remaining = [];
|
|
@@ -6950,9 +6951,9 @@ Commands:
|
|
|
6950
6951
|
});
|
|
6951
6952
|
|
|
6952
6953
|
// src/core/connectors/gmail.ts
|
|
6953
|
-
import { existsSync as
|
|
6954
|
-
import { homedir } from "os";
|
|
6955
|
-
import { basename, join as
|
|
6954
|
+
import { existsSync as existsSync3, mkdirSync, readFileSync, readdirSync, writeFileSync } from "fs";
|
|
6955
|
+
import { homedir as homedir2 } from "os";
|
|
6956
|
+
import { basename, join as join3 } from "path";
|
|
6956
6957
|
async function modifyMessage(profile, messageId, addLabelIds, removeLabelIds) {
|
|
6957
6958
|
return requestJson(profile, `/users/me/messages/${encodeURIComponent(messageId)}/modify`, {}, {
|
|
6958
6959
|
method: "POST",
|
|
@@ -6989,7 +6990,7 @@ async function replyToMessage(profile, messageId, input) {
|
|
|
6989
6990
|
}
|
|
6990
6991
|
async function downloadAttachments(profile, input) {
|
|
6991
6992
|
const messageId = getMessageId(input);
|
|
6992
|
-
const outputDir = input.dir ?? input.outputDir ??
|
|
6993
|
+
const outputDir = input.dir ?? input.outputDir ?? join3(configDirs()[0], "attachments", messageId);
|
|
6993
6994
|
mkdirSync(outputDir, { recursive: true });
|
|
6994
6995
|
const attachments = input.attachmentId && input.filename ? [{
|
|
6995
6996
|
attachmentId: input.attachmentId,
|
|
@@ -7001,7 +7002,7 @@ async function downloadAttachments(profile, input) {
|
|
|
7001
7002
|
for (const attachment of attachments) {
|
|
7002
7003
|
const data = await requestJson(profile, `/users/me/messages/${encodeURIComponent(messageId)}/attachments/${encodeURIComponent(attachment.attachmentId)}`, {});
|
|
7003
7004
|
const filename = safeFilename(attachment.filename);
|
|
7004
|
-
const path =
|
|
7005
|
+
const path = join3(outputDir, filename);
|
|
7005
7006
|
const buffer = Buffer.from(data.data, "base64url");
|
|
7006
7007
|
writeFileSync(path, buffer);
|
|
7007
7008
|
downloaded.push({
|
|
@@ -7118,8 +7119,8 @@ async function refreshAccessToken(profile, currentTokens) {
|
|
|
7118
7119
|
function listProfiles() {
|
|
7119
7120
|
const profiles = new Set;
|
|
7120
7121
|
for (const baseDir of configDirs()) {
|
|
7121
|
-
const profilesDir =
|
|
7122
|
-
if (!
|
|
7122
|
+
const profilesDir = join3(baseDir, "profiles");
|
|
7123
|
+
if (!existsSync3(profilesDir))
|
|
7123
7124
|
continue;
|
|
7124
7125
|
for (const entry of readdirSync(profilesDir, { withFileTypes: true })) {
|
|
7125
7126
|
if (entry.isDirectory())
|
|
@@ -7137,8 +7138,8 @@ function loadCredentials(profile) {
|
|
|
7137
7138
|
return { clientId: envClientId, clientSecret: envClientSecret };
|
|
7138
7139
|
for (const baseDir of configDirs()) {
|
|
7139
7140
|
const credentials = {
|
|
7140
|
-
...readJson(
|
|
7141
|
-
...readJson(
|
|
7141
|
+
...readJson(join3(baseDir, "credentials.json")),
|
|
7142
|
+
...readJson(join3(baseDir, "profiles", profile, "config.json"))
|
|
7142
7143
|
};
|
|
7143
7144
|
if (credentials.clientId || credentials.clientSecret)
|
|
7144
7145
|
return credentials;
|
|
@@ -7147,30 +7148,30 @@ function loadCredentials(profile) {
|
|
|
7147
7148
|
}
|
|
7148
7149
|
function loadTokens(profile) {
|
|
7149
7150
|
for (const baseDir of configDirs()) {
|
|
7150
|
-
const fromProfile = readJson(
|
|
7151
|
+
const fromProfile = readJson(join3(baseDir, "profiles", profile, "tokens.json"));
|
|
7151
7152
|
if (fromProfile)
|
|
7152
7153
|
return fromProfile;
|
|
7153
|
-
const flat = readJson(
|
|
7154
|
+
const flat = readJson(join3(baseDir, "profiles", `${profile}.json`));
|
|
7154
7155
|
if (flat)
|
|
7155
7156
|
return flat.tokens ?? (flat.accessToken || flat.refreshToken ? flat : null);
|
|
7156
7157
|
}
|
|
7157
7158
|
return null;
|
|
7158
7159
|
}
|
|
7159
7160
|
function saveTokens(profile, tokens) {
|
|
7160
|
-
const baseDir = configDirs().find((dir) =>
|
|
7161
|
-
const profileDir =
|
|
7161
|
+
const baseDir = configDirs().find((dir) => existsSync3(dir)) ?? configDirs()[0];
|
|
7162
|
+
const profileDir = join3(baseDir, "profiles", profile);
|
|
7162
7163
|
mkdirSync(profileDir, { recursive: true });
|
|
7163
|
-
writeFileSync(
|
|
7164
|
+
writeFileSync(join3(profileDir, "tokens.json"), JSON.stringify(tokens, null, 2), { mode: 384 });
|
|
7164
7165
|
}
|
|
7165
7166
|
function configDirs() {
|
|
7166
7167
|
const explicit = process.env.HASNA_GMAIL_CONNECTOR_DIR ?? process.env.GMAIL_CONNECTOR_DIR;
|
|
7167
7168
|
if (explicit)
|
|
7168
7169
|
return [explicit];
|
|
7169
|
-
const baseDir = process.env.HASNA_CONNECTORS_DIR ??
|
|
7170
|
-
return [
|
|
7170
|
+
const baseDir = process.env.HASNA_CONNECTORS_DIR ?? join3(homedir2(), ".hasna", "connectors");
|
|
7171
|
+
return [join3(baseDir, "gmail"), join3(baseDir, "connect-gmail")];
|
|
7171
7172
|
}
|
|
7172
7173
|
function readJson(path) {
|
|
7173
|
-
if (!
|
|
7174
|
+
if (!existsSync3(path))
|
|
7174
7175
|
return null;
|
|
7175
7176
|
try {
|
|
7176
7177
|
return JSON.parse(readFileSync(path, "utf8"));
|
|
@@ -7420,9 +7421,9 @@ var init_gmail = __esm(() => {
|
|
|
7420
7421
|
});
|
|
7421
7422
|
|
|
7422
7423
|
// src/core/connectors/googledrive.ts
|
|
7423
|
-
import { existsSync as
|
|
7424
|
-
import { homedir as
|
|
7425
|
-
import { basename as basename2, join as
|
|
7424
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync2, readdirSync as readdirSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
7425
|
+
import { homedir as homedir3 } from "os";
|
|
7426
|
+
import { basename as basename2, join as join4 } from "path";
|
|
7426
7427
|
async function requestJson2(profile, path, params) {
|
|
7427
7428
|
const response = await request(profile, path, params);
|
|
7428
7429
|
const text = await response.text();
|
|
@@ -7490,8 +7491,8 @@ async function refreshAccessToken2(profile, currentTokens) {
|
|
|
7490
7491
|
function listProfiles2() {
|
|
7491
7492
|
const profiles = new Set;
|
|
7492
7493
|
for (const baseDir of configDirs2()) {
|
|
7493
|
-
const profilesDir =
|
|
7494
|
-
if (!
|
|
7494
|
+
const profilesDir = join4(baseDir, "profiles");
|
|
7495
|
+
if (!existsSync4(profilesDir))
|
|
7495
7496
|
continue;
|
|
7496
7497
|
for (const entry of readdirSync2(profilesDir, { withFileTypes: true })) {
|
|
7497
7498
|
if (entry.isDirectory())
|
|
@@ -7505,7 +7506,7 @@ function listProfiles2() {
|
|
|
7505
7506
|
function listProfileStatuses(profile) {
|
|
7506
7507
|
const profiles = profile ? [profile] : listProfiles2();
|
|
7507
7508
|
const uniqueProfiles = profiles.length ? profiles : ["default"];
|
|
7508
|
-
const
|
|
7509
|
+
const now2 = Date.now();
|
|
7509
7510
|
return uniqueProfiles.map((name) => {
|
|
7510
7511
|
const tokens = loadTokens2(name);
|
|
7511
7512
|
const credentials = loadCredentials2(name);
|
|
@@ -7513,7 +7514,7 @@ function listProfileStatuses(profile) {
|
|
|
7513
7514
|
const hasRefreshToken = Boolean(tokens?.refreshToken);
|
|
7514
7515
|
const hasOAuthCredentials = Boolean(credentials.clientId && credentials.clientSecret);
|
|
7515
7516
|
const expiresAt = tokens?.expiresAt ?? null;
|
|
7516
|
-
const expired = Boolean(expiresAt &&
|
|
7517
|
+
const expired = Boolean(expiresAt && now2 >= expiresAt - REFRESH_BUFFER_MS2);
|
|
7517
7518
|
const authenticated = Boolean(process.env.GOOGLE_ACCESS_TOKEN || hasRefreshToken || hasAccessToken && !expired);
|
|
7518
7519
|
const configured = authenticated || hasOAuthCredentials;
|
|
7519
7520
|
const authRequired = !authenticated || expired && !hasRefreshToken;
|
|
@@ -7538,8 +7539,8 @@ function loadCredentials2(profile) {
|
|
|
7538
7539
|
return { clientId: envClientId, clientSecret: envClientSecret };
|
|
7539
7540
|
for (const baseDir of configDirs2()) {
|
|
7540
7541
|
const credentials = {
|
|
7541
|
-
...readJson2(
|
|
7542
|
-
...readJson2(
|
|
7542
|
+
...readJson2(join4(baseDir, "credentials.json")),
|
|
7543
|
+
...readJson2(join4(baseDir, "profiles", profile, "config.json"))
|
|
7543
7544
|
};
|
|
7544
7545
|
if (credentials.clientId || credentials.clientSecret)
|
|
7545
7546
|
return credentials;
|
|
@@ -7548,30 +7549,30 @@ function loadCredentials2(profile) {
|
|
|
7548
7549
|
}
|
|
7549
7550
|
function loadTokens2(profile) {
|
|
7550
7551
|
for (const baseDir of configDirs2()) {
|
|
7551
|
-
const fromProfile = readJson2(
|
|
7552
|
+
const fromProfile = readJson2(join4(baseDir, "profiles", profile, "tokens.json"));
|
|
7552
7553
|
if (fromProfile)
|
|
7553
7554
|
return fromProfile;
|
|
7554
|
-
const flat = readJson2(
|
|
7555
|
+
const flat = readJson2(join4(baseDir, "profiles", `${profile}.json`));
|
|
7555
7556
|
if (flat)
|
|
7556
7557
|
return flat.tokens ?? (flat.accessToken || flat.refreshToken ? flat : null);
|
|
7557
7558
|
}
|
|
7558
7559
|
return null;
|
|
7559
7560
|
}
|
|
7560
7561
|
function saveTokens2(profile, tokens) {
|
|
7561
|
-
const baseDir = configDirs2().find((dir) =>
|
|
7562
|
-
const profileDir =
|
|
7562
|
+
const baseDir = configDirs2().find((dir) => existsSync4(dir)) ?? configDirs2()[0];
|
|
7563
|
+
const profileDir = join4(baseDir, "profiles", profile);
|
|
7563
7564
|
mkdirSync2(profileDir, { recursive: true });
|
|
7564
|
-
writeFileSync2(
|
|
7565
|
+
writeFileSync2(join4(profileDir, "tokens.json"), JSON.stringify(tokens, null, 2), { mode: 384 });
|
|
7565
7566
|
}
|
|
7566
7567
|
function configDirs2() {
|
|
7567
7568
|
const explicit = process.env.HASNA_GOOGLE_DRIVE_CONNECTOR_DIR ?? process.env.GOOGLE_DRIVE_CONNECTOR_DIR;
|
|
7568
7569
|
if (explicit)
|
|
7569
7570
|
return [explicit];
|
|
7570
|
-
const baseDir = process.env.HASNA_CONNECTORS_DIR ??
|
|
7571
|
-
return [
|
|
7571
|
+
const baseDir = process.env.HASNA_CONNECTORS_DIR ?? join4(homedir3(), ".hasna", "connectors");
|
|
7572
|
+
return [join4(baseDir, "googledrive"), join4(baseDir, "connect-googledrive")];
|
|
7572
7573
|
}
|
|
7573
7574
|
function readJson2(path) {
|
|
7574
|
-
if (!
|
|
7575
|
+
if (!existsSync4(path))
|
|
7575
7576
|
return null;
|
|
7576
7577
|
try {
|
|
7577
7578
|
return JSON.parse(readFileSync2(path, "utf8"));
|
|
@@ -7805,8 +7806,8 @@ __export(exports_dist, {
|
|
|
7805
7806
|
ensureConflictsTable: () => ensureConflictsTable,
|
|
7806
7807
|
ensureAllPgDatabases: () => ensureAllPgDatabases,
|
|
7807
7808
|
enableAutoSync: () => enableAutoSync,
|
|
7808
|
-
discoverSyncableServicesV2: () =>
|
|
7809
|
-
discoverSyncableServices: () =>
|
|
7809
|
+
discoverSyncableServicesV2: () => discoverSyncableServices2,
|
|
7810
|
+
discoverSyncableServices: () => discoverSyncableServices,
|
|
7810
7811
|
discoverServices: () => discoverServices,
|
|
7811
7812
|
detectConflicts: () => detectConflicts,
|
|
7812
7813
|
createDatabase: () => createDatabase,
|
|
@@ -7822,28 +7823,28 @@ __export(exports_dist, {
|
|
|
7822
7823
|
import { createRequire } from "module";
|
|
7823
7824
|
import { Database } from "bun:sqlite";
|
|
7824
7825
|
import {
|
|
7825
|
-
existsSync as
|
|
7826
|
+
existsSync as existsSync5,
|
|
7826
7827
|
mkdirSync as mkdirSync3,
|
|
7827
7828
|
readdirSync as readdirSync3,
|
|
7828
7829
|
copyFileSync
|
|
7829
7830
|
} from "fs";
|
|
7830
|
-
import { homedir as
|
|
7831
|
-
import { join as
|
|
7831
|
+
import { homedir as homedir4 } from "os";
|
|
7832
|
+
import { join as join5, relative } from "path";
|
|
7832
7833
|
import { existsSync as existsSync22, mkdirSync as mkdirSync22, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
7833
7834
|
import { homedir as homedir22 } from "os";
|
|
7834
7835
|
import { join as join22 } from "path";
|
|
7835
|
-
import { readdirSync as
|
|
7836
|
-
import { join as
|
|
7837
|
-
import { homedir as
|
|
7836
|
+
import { readdirSync as readdirSync32, existsSync as existsSync6 } from "fs";
|
|
7837
|
+
import { join as join6 } from "path";
|
|
7838
|
+
import { homedir as homedir5 } from "os";
|
|
7838
7839
|
import { hostname } from "os";
|
|
7839
|
-
import { existsSync as
|
|
7840
|
-
import { homedir as
|
|
7840
|
+
import { existsSync as existsSync32, readFileSync as readFileSync22 } from "fs";
|
|
7841
|
+
import { homedir as homedir32 } from "os";
|
|
7842
|
+
import { join as join32 } from "path";
|
|
7843
|
+
import { existsSync as existsSync42, readdirSync as readdirSync22 } from "fs";
|
|
7841
7844
|
import { join as join42 } from "path";
|
|
7842
|
-
import {
|
|
7843
|
-
import {
|
|
7844
|
-
import {
|
|
7845
|
-
import { existsSync as existsSync6, writeFileSync as writeFileSync22, unlinkSync, mkdirSync as mkdirSync32 } from "fs";
|
|
7846
|
-
import { homedir as homedir5, platform } from "os";
|
|
7845
|
+
import { join as join52, dirname as dirname2 } from "path";
|
|
7846
|
+
import { existsSync as existsSync52, writeFileSync as writeFileSync22, unlinkSync, mkdirSync as mkdirSync32 } from "fs";
|
|
7847
|
+
import { homedir as homedir42, platform } from "os";
|
|
7847
7848
|
function __accessProp2(key) {
|
|
7848
7849
|
return this[key];
|
|
7849
7850
|
}
|
|
@@ -8725,20 +8726,20 @@ function custom2(check, _params = {}, fatal) {
|
|
|
8725
8726
|
return ZodAny2.create();
|
|
8726
8727
|
}
|
|
8727
8728
|
function getDataDir(serviceName) {
|
|
8728
|
-
const dir =
|
|
8729
|
+
const dir = join5(HASNA_DIR, serviceName);
|
|
8729
8730
|
mkdirSync3(dir, { recursive: true });
|
|
8730
8731
|
return dir;
|
|
8731
8732
|
}
|
|
8732
8733
|
function getDbPath(serviceName) {
|
|
8733
8734
|
const dir = getDataDir(serviceName);
|
|
8734
|
-
return
|
|
8735
|
+
return join5(dir, `${serviceName}.db`);
|
|
8735
8736
|
}
|
|
8736
8737
|
function migrateDotfile(serviceName) {
|
|
8737
|
-
const legacyDir =
|
|
8738
|
-
const newDir =
|
|
8739
|
-
if (!
|
|
8738
|
+
const legacyDir = join5(homedir4(), `.${serviceName}`);
|
|
8739
|
+
const newDir = join5(HASNA_DIR, serviceName);
|
|
8740
|
+
if (!existsSync5(legacyDir))
|
|
8740
8741
|
return [];
|
|
8741
|
-
if (
|
|
8742
|
+
if (existsSync5(newDir))
|
|
8742
8743
|
return [];
|
|
8743
8744
|
mkdirSync3(newDir, { recursive: true });
|
|
8744
8745
|
const migrated = [];
|
|
@@ -8748,8 +8749,8 @@ function migrateDotfile(serviceName) {
|
|
|
8748
8749
|
function copyDirRecursive(src, dest, root, migrated) {
|
|
8749
8750
|
const entries = readdirSync3(src, { withFileTypes: true });
|
|
8750
8751
|
for (const entry of entries) {
|
|
8751
|
-
const srcPath =
|
|
8752
|
-
const destPath =
|
|
8752
|
+
const srcPath = join5(src, entry.name);
|
|
8753
|
+
const destPath = join5(dest, entry.name);
|
|
8753
8754
|
if (entry.isDirectory()) {
|
|
8754
8755
|
mkdirSync3(destPath, { recursive: true });
|
|
8755
8756
|
copyDirRecursive(srcPath, destPath, root, migrated);
|
|
@@ -8760,7 +8761,7 @@ function copyDirRecursive(src, dest, root, migrated) {
|
|
|
8760
8761
|
}
|
|
8761
8762
|
}
|
|
8762
8763
|
function hasLegacyDotfile(serviceName) {
|
|
8763
|
-
return
|
|
8764
|
+
return existsSync5(join5(homedir4(), `.${serviceName}`));
|
|
8764
8765
|
}
|
|
8765
8766
|
function getHasnaDir() {
|
|
8766
8767
|
mkdirSync3(HASNA_DIR, { recursive: true });
|
|
@@ -8815,11 +8816,11 @@ function isSyncExcludedTable(table) {
|
|
|
8815
8816
|
return SYNC_EXCLUDED_TABLE_PATTERNS.some((p) => p.test(table));
|
|
8816
8817
|
}
|
|
8817
8818
|
function discoverServices() {
|
|
8818
|
-
const dataDir =
|
|
8819
|
-
if (!
|
|
8819
|
+
const dataDir = join6(homedir5(), ".hasna");
|
|
8820
|
+
if (!existsSync6(dataDir))
|
|
8820
8821
|
return [];
|
|
8821
8822
|
try {
|
|
8822
|
-
const entries =
|
|
8823
|
+
const entries = readdirSync32(dataDir, { withFileTypes: true });
|
|
8823
8824
|
return entries.filter((e) => {
|
|
8824
8825
|
if (!e.isDirectory())
|
|
8825
8826
|
return false;
|
|
@@ -8831,30 +8832,30 @@ function discoverServices() {
|
|
|
8831
8832
|
return [];
|
|
8832
8833
|
}
|
|
8833
8834
|
}
|
|
8834
|
-
function
|
|
8835
|
+
function discoverSyncableServices2() {
|
|
8835
8836
|
const local = discoverServices();
|
|
8836
8837
|
const pgSet = new Set(KNOWN_PG_SERVICES);
|
|
8837
8838
|
return local.filter((s) => pgSet.has(s));
|
|
8838
8839
|
}
|
|
8839
8840
|
function getServiceDbPath(service) {
|
|
8840
|
-
const dataDir =
|
|
8841
|
-
if (!
|
|
8841
|
+
const dataDir = join6(homedir5(), ".hasna", service);
|
|
8842
|
+
if (!existsSync6(dataDir))
|
|
8842
8843
|
return null;
|
|
8843
8844
|
const candidates = [
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8845
|
+
join6(dataDir, `${service}.db`),
|
|
8846
|
+
join6(dataDir, "data.db"),
|
|
8847
|
+
join6(dataDir, "database.db")
|
|
8847
8848
|
];
|
|
8848
8849
|
try {
|
|
8849
|
-
const files =
|
|
8850
|
+
const files = readdirSync32(dataDir);
|
|
8850
8851
|
for (const f of files) {
|
|
8851
8852
|
if (f.endsWith(".db") && !f.endsWith("-wal") && !f.endsWith("-shm")) {
|
|
8852
|
-
candidates.push(
|
|
8853
|
+
candidates.push(join6(dataDir, f));
|
|
8853
8854
|
}
|
|
8854
8855
|
}
|
|
8855
8856
|
} catch {}
|
|
8856
8857
|
for (const p of candidates) {
|
|
8857
|
-
if (
|
|
8858
|
+
if (existsSync6(p))
|
|
8858
8859
|
return p;
|
|
8859
8860
|
}
|
|
8860
8861
|
return null;
|
|
@@ -9161,9 +9162,9 @@ async function syncTransfer(source, target, options, _direction) {
|
|
|
9161
9162
|
const batch = rows.slice(offset, offset + batchSize);
|
|
9162
9163
|
try {
|
|
9163
9164
|
if (isAsyncAdapter(target)) {
|
|
9164
|
-
await batchUpsertPg(target, table, columns, updateCols, pkColumns, batch
|
|
9165
|
+
await batchUpsertPg(target, table, columns, updateCols, pkColumns, batch);
|
|
9165
9166
|
} else {
|
|
9166
|
-
batchUpsertSqlite(target, table, columns, updateCols, pkColumns, batch
|
|
9167
|
+
batchUpsertSqlite(target, table, columns, updateCols, pkColumns, batch);
|
|
9167
9168
|
}
|
|
9168
9169
|
result.rowsWritten += batch.length;
|
|
9169
9170
|
} catch (err) {
|
|
@@ -9210,7 +9211,7 @@ async function syncTransfer(source, target, options, _direction) {
|
|
|
9210
9211
|
}
|
|
9211
9212
|
return results;
|
|
9212
9213
|
}
|
|
9213
|
-
async function batchUpsertPg(target, table, columns, updateCols, primaryKeys, batch
|
|
9214
|
+
async function batchUpsertPg(target, table, columns, updateCols, primaryKeys, batch) {
|
|
9214
9215
|
if (batch.length === 0)
|
|
9215
9216
|
return;
|
|
9216
9217
|
const colList = columns.map((c) => `"${c}"`).join(", ");
|
|
@@ -9220,22 +9221,20 @@ async function batchUpsertPg(target, table, columns, updateCols, primaryKeys, ba
|
|
|
9220
9221
|
}).join(", ");
|
|
9221
9222
|
const pkList = primaryKeys.map((c) => `"${c}"`).join(", ");
|
|
9222
9223
|
const setClause = updateCols.length > 0 ? updateCols.map((c) => `"${c}" = EXCLUDED."${c}"`).join(", ") : `"${primaryKeys[0]}" = EXCLUDED."${primaryKeys[0]}"`;
|
|
9223
|
-
const whereClause = conflictColumn && updateCols.includes(conflictColumn) ? ` WHERE "${table}"."${conflictColumn}" IS NULL OR EXCLUDED."${conflictColumn}" >= "${table}"."${conflictColumn}"` : "";
|
|
9224
9224
|
const sql = `INSERT INTO "${table}" (${colList}) VALUES ${valuePlaceholders}
|
|
9225
|
-
ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}
|
|
9225
|
+
ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}`;
|
|
9226
9226
|
const params = batch.flatMap((row) => columns.map((c) => row[c] ?? null));
|
|
9227
9227
|
await target.run(sql, ...params);
|
|
9228
9228
|
}
|
|
9229
|
-
function batchUpsertSqlite(target, table, columns, updateCols, primaryKeys, batch
|
|
9229
|
+
function batchUpsertSqlite(target, table, columns, updateCols, primaryKeys, batch) {
|
|
9230
9230
|
if (batch.length === 0)
|
|
9231
9231
|
return;
|
|
9232
9232
|
const colList = columns.map((c) => `"${c}"`).join(", ");
|
|
9233
9233
|
const valuePlaceholders = batch.map(() => `(${columns.map(() => "?").join(", ")})`).join(", ");
|
|
9234
9234
|
const pkList = primaryKeys.map((c) => `"${c}"`).join(", ");
|
|
9235
9235
|
const setClause = updateCols.length > 0 ? updateCols.map((c) => `"${c}" = EXCLUDED."${c}"`).join(", ") : `"${primaryKeys[0]}" = EXCLUDED."${primaryKeys[0]}"`;
|
|
9236
|
-
const whereClause = conflictColumn && updateCols.includes(conflictColumn) ? ` WHERE "${table}"."${conflictColumn}" IS NULL OR EXCLUDED."${conflictColumn}" >= "${table}"."${conflictColumn}"` : "";
|
|
9237
9236
|
const sql = `INSERT INTO "${table}" (${colList}) VALUES ${valuePlaceholders}
|
|
9238
|
-
ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}
|
|
9237
|
+
ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}`;
|
|
9239
9238
|
const params = batch.flatMap((row) => columns.map((c) => coerceForSqlite(row[c])));
|
|
9240
9239
|
target.run(sql, ...params);
|
|
9241
9240
|
}
|
|
@@ -9294,17 +9293,17 @@ function ensureFeedbackTable(db) {
|
|
|
9294
9293
|
function saveFeedback(db, feedback) {
|
|
9295
9294
|
ensureFeedbackTable(db);
|
|
9296
9295
|
const id = feedback.id ?? Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
9297
|
-
const
|
|
9296
|
+
const now2 = new Date().toISOString();
|
|
9298
9297
|
const machineId = feedback.machine_id ?? hostname();
|
|
9299
9298
|
db.run(`INSERT INTO feedback (id, service, version, message, email, machine_id, created_at)
|
|
9300
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)`, id, feedback.service, feedback.version ?? "", feedback.message, feedback.email ?? "", machineId, feedback.created_at ??
|
|
9299
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)`, id, feedback.service, feedback.version ?? "", feedback.message, feedback.email ?? "", machineId, feedback.created_at ?? now2);
|
|
9301
9300
|
return id;
|
|
9302
9301
|
}
|
|
9303
9302
|
async function sendFeedback(feedback, db) {
|
|
9304
9303
|
const config = getCloudConfig();
|
|
9305
9304
|
const id = feedback.id ?? Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
9306
9305
|
const machineId = feedback.machine_id ?? hostname();
|
|
9307
|
-
const
|
|
9306
|
+
const now2 = new Date().toISOString();
|
|
9308
9307
|
const payload = {
|
|
9309
9308
|
id,
|
|
9310
9309
|
service: feedback.service,
|
|
@@ -9312,7 +9311,7 @@ async function sendFeedback(feedback, db) {
|
|
|
9312
9311
|
message: feedback.message,
|
|
9313
9312
|
email: feedback.email ?? "",
|
|
9314
9313
|
machine_id: machineId,
|
|
9315
|
-
created_at: feedback.created_at ??
|
|
9314
|
+
created_at: feedback.created_at ?? now2
|
|
9316
9315
|
};
|
|
9317
9316
|
try {
|
|
9318
9317
|
const res = await fetch(config.feedback_endpoint, {
|
|
@@ -9368,8 +9367,8 @@ class SyncProgressTracker {
|
|
|
9368
9367
|
}
|
|
9369
9368
|
start(table, total, direction) {
|
|
9370
9369
|
const resumed = this.canResume(table);
|
|
9371
|
-
const
|
|
9372
|
-
this.startTimes.set(table,
|
|
9370
|
+
const now2 = Date.now();
|
|
9371
|
+
this.startTimes.set(table, now2);
|
|
9373
9372
|
const status = resumed ? "resumed" : "in_progress";
|
|
9374
9373
|
const info = {
|
|
9375
9374
|
table,
|
|
@@ -9691,10 +9690,10 @@ function incrementalSyncPush(local, remote, tables, options = {}) {
|
|
|
9691
9690
|
if (rows.length === 0) {
|
|
9692
9691
|
stat.skipped_rows = stat.total_rows;
|
|
9693
9692
|
}
|
|
9694
|
-
const
|
|
9693
|
+
const now2 = new Date().toISOString();
|
|
9695
9694
|
upsertSyncMeta(local, {
|
|
9696
9695
|
table_name: table,
|
|
9697
|
-
last_synced_at:
|
|
9696
|
+
last_synced_at: now2,
|
|
9698
9697
|
last_synced_row_count: stat.synced_rows,
|
|
9699
9698
|
direction: "push"
|
|
9700
9699
|
});
|
|
@@ -9744,10 +9743,10 @@ function incrementalSyncPull(remote, local, tables, options = {}) {
|
|
|
9744
9743
|
if (rows.length === 0) {
|
|
9745
9744
|
stat.skipped_rows = stat.total_rows;
|
|
9746
9745
|
}
|
|
9747
|
-
const
|
|
9746
|
+
const now2 = new Date().toISOString();
|
|
9748
9747
|
upsertSyncMeta(local, {
|
|
9749
9748
|
table_name: table,
|
|
9750
|
-
last_synced_at:
|
|
9749
|
+
last_synced_at: now2,
|
|
9751
9750
|
last_synced_row_count: stat.synced_rows,
|
|
9752
9751
|
direction: "pull"
|
|
9753
9752
|
});
|
|
@@ -9775,7 +9774,7 @@ function resetAllSyncMeta(db) {
|
|
|
9775
9774
|
}
|
|
9776
9775
|
function getAutoSyncConfig() {
|
|
9777
9776
|
try {
|
|
9778
|
-
if (!
|
|
9777
|
+
if (!existsSync32(AUTO_SYNC_CONFIG_PATH)) {
|
|
9779
9778
|
return { ...DEFAULT_AUTO_SYNC_CONFIG };
|
|
9780
9779
|
}
|
|
9781
9780
|
const raw = JSON.parse(readFileSync22(AUTO_SYNC_CONFIG_PATH, "utf-8"));
|
|
@@ -9787,7 +9786,7 @@ function getAutoSyncConfig() {
|
|
|
9787
9786
|
return { ...DEFAULT_AUTO_SYNC_CONFIG };
|
|
9788
9787
|
}
|
|
9789
9788
|
}
|
|
9790
|
-
|
|
9789
|
+
function executeAutoSync(event, local, remote, tables) {
|
|
9791
9790
|
const direction = event === "start" ? "pull" : "push";
|
|
9792
9791
|
const result = {
|
|
9793
9792
|
event,
|
|
@@ -9797,31 +9796,18 @@ async function executeAutoSync(event, serviceName, local, tables) {
|
|
|
9797
9796
|
total_rows_synced: 0,
|
|
9798
9797
|
errors: []
|
|
9799
9798
|
};
|
|
9800
|
-
let remote = null;
|
|
9801
9799
|
try {
|
|
9802
|
-
const
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
if (syncTables.length === 0) {
|
|
9806
|
-
result.success = true;
|
|
9807
|
-
return result;
|
|
9808
|
-
}
|
|
9809
|
-
const results = direction === "pull" ? await syncPull(remote, local, { tables: syncTables }) : await syncPush(local, remote, { tables: syncTables });
|
|
9810
|
-
for (const r of results) {
|
|
9811
|
-
if (r.errors.length === 0)
|
|
9800
|
+
const stats = direction === "pull" ? incrementalSyncPull(remote, local, tables) : incrementalSyncPush(local, remote, tables);
|
|
9801
|
+
for (const s of stats) {
|
|
9802
|
+
if (s.errors.length === 0) {
|
|
9812
9803
|
result.tables_synced++;
|
|
9813
|
-
|
|
9814
|
-
result.
|
|
9804
|
+
}
|
|
9805
|
+
result.total_rows_synced += s.synced_rows;
|
|
9806
|
+
result.errors.push(...s.errors);
|
|
9815
9807
|
}
|
|
9816
9808
|
result.success = result.errors.length === 0;
|
|
9817
9809
|
} catch (err) {
|
|
9818
9810
|
result.errors.push(err?.message ?? String(err));
|
|
9819
|
-
} finally {
|
|
9820
|
-
if (remote) {
|
|
9821
|
-
try {
|
|
9822
|
-
await remote.close();
|
|
9823
|
-
} catch {}
|
|
9824
|
-
}
|
|
9825
9811
|
}
|
|
9826
9812
|
return result;
|
|
9827
9813
|
}
|
|
@@ -9829,76 +9815,80 @@ function installSignalHandlers() {
|
|
|
9829
9815
|
if (signalHandlersInstalled)
|
|
9830
9816
|
return;
|
|
9831
9817
|
signalHandlersInstalled = true;
|
|
9832
|
-
const handleExit =
|
|
9818
|
+
const handleExit = () => {
|
|
9833
9819
|
for (const fn of cleanupHandlers) {
|
|
9834
9820
|
try {
|
|
9835
|
-
|
|
9821
|
+
fn();
|
|
9836
9822
|
} catch {}
|
|
9837
9823
|
}
|
|
9838
9824
|
};
|
|
9839
|
-
process.on("SIGTERM",
|
|
9840
|
-
|
|
9825
|
+
process.on("SIGTERM", () => {
|
|
9826
|
+
handleExit();
|
|
9841
9827
|
process.exit(0);
|
|
9842
9828
|
});
|
|
9843
|
-
process.on("SIGINT",
|
|
9844
|
-
|
|
9829
|
+
process.on("SIGINT", () => {
|
|
9830
|
+
handleExit();
|
|
9845
9831
|
process.exit(0);
|
|
9846
9832
|
});
|
|
9847
|
-
process.on("beforeExit",
|
|
9848
|
-
|
|
9833
|
+
process.on("beforeExit", () => {
|
|
9834
|
+
handleExit();
|
|
9849
9835
|
});
|
|
9850
9836
|
}
|
|
9851
9837
|
function setupAutoSync(serviceName, server, local, remote, tables) {
|
|
9852
9838
|
const config = getAutoSyncConfig();
|
|
9853
9839
|
const cloudConfig = getCloudConfig();
|
|
9854
9840
|
const isSyncEnabled = cloudConfig.mode === "hybrid" || cloudConfig.mode === "cloud";
|
|
9855
|
-
const syncOnStart =
|
|
9841
|
+
const syncOnStart = () => {
|
|
9856
9842
|
if (!config.auto_sync_on_start || !isSyncEnabled)
|
|
9857
9843
|
return null;
|
|
9858
|
-
return executeAutoSync("start",
|
|
9844
|
+
return executeAutoSync("start", local, remote, tables);
|
|
9859
9845
|
};
|
|
9860
|
-
const syncOnStop =
|
|
9846
|
+
const syncOnStop = () => {
|
|
9861
9847
|
if (!config.auto_sync_on_stop || !isSyncEnabled)
|
|
9862
9848
|
return null;
|
|
9863
|
-
return executeAutoSync("stop",
|
|
9849
|
+
return executeAutoSync("stop", local, remote, tables);
|
|
9864
9850
|
};
|
|
9865
9851
|
if (server && typeof server.onconnect === "function") {
|
|
9866
9852
|
const origOnConnect = server.onconnect;
|
|
9867
|
-
server.onconnect =
|
|
9868
|
-
|
|
9853
|
+
server.onconnect = (...args) => {
|
|
9854
|
+
syncOnStart();
|
|
9869
9855
|
return origOnConnect.apply(server, args);
|
|
9870
9856
|
};
|
|
9871
9857
|
} else if (server && typeof server.on === "function") {
|
|
9872
|
-
server.on("connect", () =>
|
|
9858
|
+
server.on("connect", () => {
|
|
9859
|
+
syncOnStart();
|
|
9860
|
+
});
|
|
9873
9861
|
}
|
|
9874
9862
|
if (server && typeof server.ondisconnect === "function") {
|
|
9875
9863
|
const origOnDisconnect = server.ondisconnect;
|
|
9876
|
-
server.ondisconnect =
|
|
9877
|
-
|
|
9864
|
+
server.ondisconnect = (...args) => {
|
|
9865
|
+
syncOnStop();
|
|
9878
9866
|
return origOnDisconnect.apply(server, args);
|
|
9879
9867
|
};
|
|
9880
9868
|
} else if (server && typeof server.on === "function") {
|
|
9881
|
-
server.on("disconnect", () =>
|
|
9869
|
+
server.on("disconnect", () => {
|
|
9870
|
+
syncOnStop();
|
|
9871
|
+
});
|
|
9882
9872
|
}
|
|
9883
9873
|
installSignalHandlers();
|
|
9884
|
-
cleanupHandlers.push(
|
|
9885
|
-
|
|
9874
|
+
cleanupHandlers.push(() => {
|
|
9875
|
+
syncOnStop();
|
|
9886
9876
|
});
|
|
9887
9877
|
return { syncOnStart, syncOnStop, config };
|
|
9888
9878
|
}
|
|
9889
9879
|
function enableAutoSync(serviceName, mcpServer, local, remote, tables) {
|
|
9890
9880
|
setupAutoSync(serviceName, mcpServer, local, remote, tables);
|
|
9891
9881
|
}
|
|
9892
|
-
function
|
|
9882
|
+
function discoverSyncableServices() {
|
|
9893
9883
|
const hasnaDir = getHasnaDir();
|
|
9894
9884
|
const services = [];
|
|
9895
9885
|
try {
|
|
9896
|
-
const entries =
|
|
9886
|
+
const entries = readdirSync22(hasnaDir, { withFileTypes: true });
|
|
9897
9887
|
for (const entry of entries) {
|
|
9898
9888
|
if (!entry.isDirectory())
|
|
9899
9889
|
continue;
|
|
9900
|
-
const dbPath =
|
|
9901
|
-
if (
|
|
9890
|
+
const dbPath = join42(hasnaDir, entry.name, `${entry.name}.db`);
|
|
9891
|
+
if (existsSync42(dbPath)) {
|
|
9902
9892
|
services.push(entry.name);
|
|
9903
9893
|
}
|
|
9904
9894
|
}
|
|
@@ -9909,7 +9899,7 @@ async function runScheduledSync() {
|
|
|
9909
9899
|
const config = getCloudConfig();
|
|
9910
9900
|
if (config.mode === "local")
|
|
9911
9901
|
return [];
|
|
9912
|
-
const services =
|
|
9902
|
+
const services = discoverSyncableServices();
|
|
9913
9903
|
const results = [];
|
|
9914
9904
|
let remote = null;
|
|
9915
9905
|
for (const service of services) {
|
|
@@ -9920,8 +9910,8 @@ async function runScheduledSync() {
|
|
|
9920
9910
|
errors: []
|
|
9921
9911
|
};
|
|
9922
9912
|
try {
|
|
9923
|
-
const dbPath =
|
|
9924
|
-
if (!
|
|
9913
|
+
const dbPath = join42(getDataDir(service), `${service}.db`);
|
|
9914
|
+
if (!existsSync42(dbPath)) {
|
|
9925
9915
|
continue;
|
|
9926
9916
|
}
|
|
9927
9917
|
const local = new SqliteAdapter(dbPath);
|
|
@@ -10002,34 +9992,34 @@ function minutesToCron(minutes) {
|
|
|
10002
9992
|
}
|
|
10003
9993
|
function getWorkerPath() {
|
|
10004
9994
|
const dir = typeof import.meta.dir === "string" ? import.meta.dir : dirname2(import.meta.url.replace("file://", ""));
|
|
10005
|
-
const tsPath =
|
|
10006
|
-
const jsPath =
|
|
9995
|
+
const tsPath = join52(dir, "scheduled-sync.ts");
|
|
9996
|
+
const jsPath = join52(dir, "scheduled-sync.js");
|
|
10007
9997
|
try {
|
|
10008
|
-
if (
|
|
9998
|
+
if (existsSync52(tsPath))
|
|
10009
9999
|
return tsPath;
|
|
10010
10000
|
} catch {}
|
|
10011
10001
|
return jsPath;
|
|
10012
10002
|
}
|
|
10013
10003
|
function getBunPath() {
|
|
10014
10004
|
const candidates = [
|
|
10015
|
-
|
|
10005
|
+
join52(homedir42(), ".bun", "bin", "bun"),
|
|
10016
10006
|
"/usr/local/bin/bun",
|
|
10017
10007
|
"/usr/bin/bun"
|
|
10018
10008
|
];
|
|
10019
10009
|
for (const p of candidates) {
|
|
10020
|
-
if (
|
|
10010
|
+
if (existsSync52(p))
|
|
10021
10011
|
return p;
|
|
10022
10012
|
}
|
|
10023
10013
|
return "bun";
|
|
10024
10014
|
}
|
|
10025
10015
|
function getLaunchdPlistPath() {
|
|
10026
|
-
return
|
|
10016
|
+
return join52(homedir42(), "Library", "LaunchAgents", `com.hasna.cloud-sync.plist`);
|
|
10027
10017
|
}
|
|
10028
10018
|
function createLaunchdPlist(intervalMinutes) {
|
|
10029
10019
|
const workerPath = getWorkerPath();
|
|
10030
10020
|
const bunPath = getBunPath();
|
|
10031
|
-
const logPath =
|
|
10032
|
-
const errorLogPath =
|
|
10021
|
+
const logPath = join52(CONFIG_DIR2, "sync.log");
|
|
10022
|
+
const errorLogPath = join52(CONFIG_DIR2, "sync-error.log");
|
|
10033
10023
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
10034
10024
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
10035
10025
|
<plist version="1.0">
|
|
@@ -10055,7 +10045,7 @@ function createLaunchdPlist(intervalMinutes) {
|
|
|
10055
10045
|
<key>PATH</key>
|
|
10056
10046
|
<string>${process.env.PATH || "/usr/local/bin:/usr/bin:/bin"}</string>
|
|
10057
10047
|
<key>HOME</key>
|
|
10058
|
-
<string>${
|
|
10048
|
+
<string>${homedir42()}</string>
|
|
10059
10049
|
</dict>
|
|
10060
10050
|
</dict>
|
|
10061
10051
|
</plist>`;
|
|
@@ -10080,7 +10070,7 @@ async function removeLaunchd() {
|
|
|
10080
10070
|
} catch {}
|
|
10081
10071
|
}
|
|
10082
10072
|
function getSystemdDir() {
|
|
10083
|
-
return
|
|
10073
|
+
return join52(homedir42(), ".config", "systemd", "user");
|
|
10084
10074
|
}
|
|
10085
10075
|
function createSystemdService() {
|
|
10086
10076
|
const workerPath = getWorkerPath();
|
|
@@ -10092,7 +10082,7 @@ After=network.target
|
|
|
10092
10082
|
[Service]
|
|
10093
10083
|
Type=oneshot
|
|
10094
10084
|
ExecStart=${bunPath} run ${workerPath}
|
|
10095
|
-
Environment=HOME=${
|
|
10085
|
+
Environment=HOME=${homedir42()}
|
|
10096
10086
|
Environment=PATH=${process.env.PATH || "/usr/local/bin:/usr/bin:/bin"}
|
|
10097
10087
|
|
|
10098
10088
|
[Install]
|
|
@@ -10115,8 +10105,8 @@ WantedBy=timers.target
|
|
|
10115
10105
|
async function registerSystemd(intervalMinutes) {
|
|
10116
10106
|
const dir = getSystemdDir();
|
|
10117
10107
|
mkdirSync32(dir, { recursive: true });
|
|
10118
|
-
writeFileSync22(
|
|
10119
|
-
writeFileSync22(
|
|
10108
|
+
writeFileSync22(join52(dir, `${SERVICE_NAME}.service`), createSystemdService());
|
|
10109
|
+
writeFileSync22(join52(dir, `${SERVICE_NAME}.timer`), createSystemdTimer(intervalMinutes));
|
|
10120
10110
|
await Bun.spawn(["systemctl", "--user", "daemon-reload"]).exited;
|
|
10121
10111
|
await Bun.spawn(["systemctl", "--user", "enable", "--now", `${SERVICE_NAME}.timer`]).exited;
|
|
10122
10112
|
}
|
|
@@ -10126,10 +10116,10 @@ async function removeSystemd() {
|
|
|
10126
10116
|
} catch {}
|
|
10127
10117
|
const dir = getSystemdDir();
|
|
10128
10118
|
try {
|
|
10129
|
-
unlinkSync(
|
|
10119
|
+
unlinkSync(join52(dir, `${SERVICE_NAME}.service`));
|
|
10130
10120
|
} catch {}
|
|
10131
10121
|
try {
|
|
10132
|
-
unlinkSync(
|
|
10122
|
+
unlinkSync(join52(dir, `${SERVICE_NAME}.timer`));
|
|
10133
10123
|
} catch {}
|
|
10134
10124
|
try {
|
|
10135
10125
|
await Bun.spawn(["systemctl", "--user", "daemon-reload"]).exited;
|
|
@@ -10166,9 +10156,9 @@ function getSyncScheduleStatus() {
|
|
|
10166
10156
|
let mechanism = "none";
|
|
10167
10157
|
if (registered) {
|
|
10168
10158
|
if (platform() === "darwin") {
|
|
10169
|
-
mechanism =
|
|
10159
|
+
mechanism = existsSync52(getLaunchdPlistPath()) ? "launchd" : "none";
|
|
10170
10160
|
} else {
|
|
10171
|
-
mechanism =
|
|
10161
|
+
mechanism = existsSync52(join52(getSystemdDir(), `${SERVICE_NAME}.timer`)) ? "systemd" : "none";
|
|
10172
10162
|
}
|
|
10173
10163
|
}
|
|
10174
10164
|
return {
|
|
@@ -10305,7 +10295,7 @@ async function ensureAllPgDatabases() {
|
|
|
10305
10295
|
}
|
|
10306
10296
|
return results;
|
|
10307
10297
|
}
|
|
10308
|
-
function registerCloudTools(server, serviceName
|
|
10298
|
+
function registerCloudTools(server, serviceName) {
|
|
10309
10299
|
server.tool(`${serviceName}_cloud_status`, "Show cloud configuration and connection health", {}, async () => {
|
|
10310
10300
|
const config = getCloudConfig();
|
|
10311
10301
|
const lines = [
|
|
@@ -10338,13 +10328,8 @@ function registerCloudTools(server, serviceName, opts = {}) {
|
|
|
10338
10328
|
isError: true
|
|
10339
10329
|
};
|
|
10340
10330
|
}
|
|
10341
|
-
const local = new SqliteAdapter(
|
|
10331
|
+
const local = new SqliteAdapter(getDbPath(serviceName));
|
|
10342
10332
|
const cloud = new PgAdapterAsync(getConnectionString(serviceName));
|
|
10343
|
-
if (opts.migrations?.length) {
|
|
10344
|
-
for (const sql of opts.migrations) {
|
|
10345
|
-
await cloud.run(sql);
|
|
10346
|
-
}
|
|
10347
|
-
}
|
|
10348
10333
|
const tableList = tablesStr ? tablesStr.split(",").map((t) => t.trim()) : listSqliteTables(local);
|
|
10349
10334
|
const results = await syncPush(local, cloud, { tables: tableList });
|
|
10350
10335
|
local.close();
|
|
@@ -10366,7 +10351,7 @@ function registerCloudTools(server, serviceName, opts = {}) {
|
|
|
10366
10351
|
isError: true
|
|
10367
10352
|
};
|
|
10368
10353
|
}
|
|
10369
|
-
const local = new SqliteAdapter(
|
|
10354
|
+
const local = new SqliteAdapter(getDbPath(serviceName));
|
|
10370
10355
|
const cloud = new PgAdapterAsync(getConnectionString(serviceName));
|
|
10371
10356
|
let tableList;
|
|
10372
10357
|
if (tablesStr) {
|
|
@@ -18718,7 +18703,7 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
|
|
|
18718
18703
|
init_external2();
|
|
18719
18704
|
});
|
|
18720
18705
|
init_dotfile = __esm2(() => {
|
|
18721
|
-
HASNA_DIR =
|
|
18706
|
+
HASNA_DIR = join5(homedir4(), ".hasna");
|
|
18722
18707
|
});
|
|
18723
18708
|
exports_config = {};
|
|
18724
18709
|
__export2(exports_config, {
|
|
@@ -18756,7 +18741,7 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
|
|
|
18756
18741
|
__export2(exports_discover, {
|
|
18757
18742
|
isSyncExcludedTable: () => isSyncExcludedTable,
|
|
18758
18743
|
getServiceDbPath: () => getServiceDbPath,
|
|
18759
|
-
discoverSyncableServices: () =>
|
|
18744
|
+
discoverSyncableServices: () => discoverSyncableServices2,
|
|
18760
18745
|
discoverServices: () => discoverServices,
|
|
18761
18746
|
SYNC_EXCLUDED_TABLE_PATTERNS: () => SYNC_EXCLUDED_TABLE_PATTERNS,
|
|
18762
18747
|
KNOWN_PG_SERVICES: () => KNOWN_PG_SERVICES
|
|
@@ -18811,10 +18796,8 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
|
|
|
18811
18796
|
init_config();
|
|
18812
18797
|
init_config();
|
|
18813
18798
|
init_dotfile();
|
|
18814
|
-
init_adapter();
|
|
18815
18799
|
init_config();
|
|
18816
|
-
|
|
18817
|
-
AUTO_SYNC_CONFIG_PATH = join42(homedir4(), ".hasna", "cloud", "config.json");
|
|
18800
|
+
AUTO_SYNC_CONFIG_PATH = join32(homedir32(), ".hasna", "cloud", "config.json");
|
|
18818
18801
|
DEFAULT_AUTO_SYNC_CONFIG = {
|
|
18819
18802
|
auto_sync_on_start: true,
|
|
18820
18803
|
auto_sync_on_stop: true
|
|
@@ -18824,7 +18807,7 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
|
|
|
18824
18807
|
init_adapter();
|
|
18825
18808
|
init_dotfile();
|
|
18826
18809
|
init_config();
|
|
18827
|
-
CONFIG_DIR2 =
|
|
18810
|
+
CONFIG_DIR2 = join52(homedir42(), ".hasna", "cloud");
|
|
18828
18811
|
init_adapter();
|
|
18829
18812
|
init_config();
|
|
18830
18813
|
init_discover();
|
|
@@ -18841,7 +18824,7 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
|
|
|
18841
18824
|
var exports_database = {};
|
|
18842
18825
|
__export(exports_database, {
|
|
18843
18826
|
shortUuid: () => shortUuid,
|
|
18844
|
-
now: () =>
|
|
18827
|
+
now: () => now2,
|
|
18845
18828
|
getDatabase: () => getDatabase,
|
|
18846
18829
|
getConnectorsHome: () => getConnectorsHome,
|
|
18847
18830
|
closeDatabase: () => closeDatabase
|
|
@@ -18904,7 +18887,7 @@ function closeDatabase() {
|
|
|
18904
18887
|
_db = null;
|
|
18905
18888
|
_dbPath = null;
|
|
18906
18889
|
}
|
|
18907
|
-
function
|
|
18890
|
+
function now2() {
|
|
18908
18891
|
return new Date().toISOString();
|
|
18909
18892
|
}
|
|
18910
18893
|
function shortUuid() {
|
|
@@ -29883,7 +29866,7 @@ __export(exports_promotions, {
|
|
|
29883
29866
|
});
|
|
29884
29867
|
function promoteConnector(name, db) {
|
|
29885
29868
|
const d = db ?? getDatabase();
|
|
29886
|
-
d.run("INSERT OR REPLACE INTO connector_promotions (connector, promoted_at) VALUES (?, ?)", [name,
|
|
29869
|
+
d.run("INSERT OR REPLACE INTO connector_promotions (connector, promoted_at) VALUES (?, ?)", [name, now2()]);
|
|
29887
29870
|
}
|
|
29888
29871
|
function demoteConnector(name, db) {
|
|
29889
29872
|
const d = db ?? getDatabase();
|
|
@@ -29913,7 +29896,7 @@ __export(exports_usage, {
|
|
|
29913
29896
|
});
|
|
29914
29897
|
function logUsage(connector, action, agentId, db) {
|
|
29915
29898
|
const d = db ?? getDatabase();
|
|
29916
|
-
d.run("INSERT INTO connector_usage (id, connector, action, agent_id, timestamp) VALUES (?, ?, ?, ?, ?)", [shortUuid(), connector, action, agentId ?? null,
|
|
29899
|
+
d.run("INSERT INTO connector_usage (id, connector, action, agent_id, timestamp) VALUES (?, ?, ?, ?, ?)", [shortUuid(), connector, action, agentId ?? null, now2()]);
|
|
29917
29900
|
}
|
|
29918
29901
|
function getUsageStats(connector, db) {
|
|
29919
29902
|
const d = db ?? getDatabase();
|
|
@@ -29971,7 +29954,7 @@ function registerAgent(input, db) {
|
|
|
29971
29954
|
};
|
|
29972
29955
|
}
|
|
29973
29956
|
const updates = ["last_seen_at = ?"];
|
|
29974
|
-
const params = [
|
|
29957
|
+
const params = [now2()];
|
|
29975
29958
|
if (input.session_id && !sameSession) {
|
|
29976
29959
|
updates.push("session_id = ?");
|
|
29977
29960
|
params.push(input.session_id);
|
|
@@ -29981,7 +29964,7 @@ function registerAgent(input, db) {
|
|
|
29981
29964
|
return getAgent(existing.id, d);
|
|
29982
29965
|
}
|
|
29983
29966
|
const id = shortUuid2();
|
|
29984
|
-
const ts =
|
|
29967
|
+
const ts = now2();
|
|
29985
29968
|
d.run(`INSERT INTO agents (id, name, session_id, role, last_seen_at, created_at)
|
|
29986
29969
|
VALUES (?, ?, ?, ?, ?, ?)`, [id, normalizedName, input.session_id ?? null, input.role ?? "agent", ts, ts]);
|
|
29987
29970
|
return getAgent(id, d);
|
|
@@ -30000,12 +29983,12 @@ function listAgents(db) {
|
|
|
30000
29983
|
}
|
|
30001
29984
|
function heartbeat(id, db) {
|
|
30002
29985
|
const d = db ?? getDatabase();
|
|
30003
|
-
d.run("UPDATE agents SET last_seen_at = ? WHERE id = ?", [
|
|
29986
|
+
d.run("UPDATE agents SET last_seen_at = ? WHERE id = ?", [now2(), id]);
|
|
30004
29987
|
return getAgent(id, d);
|
|
30005
29988
|
}
|
|
30006
29989
|
function setFocus(id, projectId, db) {
|
|
30007
29990
|
const d = db ?? getDatabase();
|
|
30008
|
-
d.run("UPDATE agents SET project_id = ?, last_seen_at = ? WHERE id = ?", [projectId,
|
|
29991
|
+
d.run("UPDATE agents SET project_id = ?, last_seen_at = ? WHERE id = ?", [projectId, now2(), id]);
|
|
30009
29992
|
return getAgent(id, d);
|
|
30010
29993
|
}
|
|
30011
29994
|
function deleteAgent(id, db) {
|
|
@@ -30037,9 +30020,9 @@ function countActiveAgents(db) {
|
|
|
30037
30020
|
return Math.max(1, row?.count ?? 1);
|
|
30038
30021
|
}
|
|
30039
30022
|
function currentWindowStart() {
|
|
30040
|
-
const
|
|
30023
|
+
const now4 = Date.now();
|
|
30041
30024
|
const windowMs = WINDOW_SECONDS * 1000;
|
|
30042
|
-
return new Date(Math.floor(
|
|
30025
|
+
return new Date(Math.floor(now4 / windowMs) * windowMs).toISOString();
|
|
30043
30026
|
}
|
|
30044
30027
|
function checkRateBudget(agentId, connector, connectorLimit, consume = true, db) {
|
|
30045
30028
|
const d = db ?? getDatabase();
|
|
@@ -30269,7 +30252,7 @@ function rowToJob(row) {
|
|
|
30269
30252
|
function createJob(input, db) {
|
|
30270
30253
|
const d = db ?? getDatabase();
|
|
30271
30254
|
const id = shortUuid();
|
|
30272
|
-
const ts =
|
|
30255
|
+
const ts = now2();
|
|
30273
30256
|
d.run("INSERT INTO connector_jobs (id, name, connector, command, args, cron, enabled, strip, created_at) VALUES (?, ?, ?, ?, ?, ?, 1, ?, ?)", [id, input.name, input.connector, input.command, JSON.stringify(input.args ?? []), input.cron, input.strip ? 1 : 0, ts]);
|
|
30274
30257
|
return getJob(id, d);
|
|
30275
30258
|
}
|
|
@@ -30335,18 +30318,18 @@ function deleteJob(id, db) {
|
|
|
30335
30318
|
}
|
|
30336
30319
|
function touchJobLastRun(id, db) {
|
|
30337
30320
|
const d = db ?? getDatabase();
|
|
30338
|
-
d.run("UPDATE connector_jobs SET last_run_at = ? WHERE id = ?", [
|
|
30321
|
+
d.run("UPDATE connector_jobs SET last_run_at = ? WHERE id = ?", [now2(), id]);
|
|
30339
30322
|
}
|
|
30340
30323
|
function createJobRun(jobId, db) {
|
|
30341
30324
|
const d = db ?? getDatabase();
|
|
30342
30325
|
const id = shortUuid();
|
|
30343
|
-
const ts =
|
|
30326
|
+
const ts = now2();
|
|
30344
30327
|
d.run("INSERT INTO connector_job_runs (id, job_id, started_at) VALUES (?, ?, ?)", [id, jobId, ts]);
|
|
30345
30328
|
return { id, job_id: jobId, started_at: ts, finished_at: null, exit_code: null, raw_output: null, stripped_output: null };
|
|
30346
30329
|
}
|
|
30347
30330
|
function finishJobRun(id, result, db) {
|
|
30348
30331
|
const d = db ?? getDatabase();
|
|
30349
|
-
d.run("UPDATE connector_job_runs SET finished_at = ?, exit_code = ?, raw_output = ?, stripped_output = ? WHERE id = ?", [
|
|
30332
|
+
d.run("UPDATE connector_job_runs SET finished_at = ?, exit_code = ?, raw_output = ?, stripped_output = ? WHERE id = ?", [now2(), result.exit_code, result.raw_output, result.stripped_output ?? null, id]);
|
|
30350
30333
|
}
|
|
30351
30334
|
function getLatestRun(jobId, db) {
|
|
30352
30335
|
const d = db ?? getDatabase();
|
|
@@ -30371,7 +30354,7 @@ function rowToWorkflow(row) {
|
|
|
30371
30354
|
function createWorkflow(input, db) {
|
|
30372
30355
|
const d = db ?? getDatabase();
|
|
30373
30356
|
const id = shortUuid();
|
|
30374
|
-
d.run("INSERT INTO connector_workflows (id, name, steps, enabled, created_at) VALUES (?, ?, ?, 1, ?)", [id, input.name, JSON.stringify(input.steps),
|
|
30357
|
+
d.run("INSERT INTO connector_workflows (id, name, steps, enabled, created_at) VALUES (?, ?, ?, 1, ?)", [id, input.name, JSON.stringify(input.steps), now2()]);
|
|
30375
30358
|
return getWorkflow(id, d);
|
|
30376
30359
|
}
|
|
30377
30360
|
function getWorkflow(id, db) {
|
|
@@ -30404,7 +30387,7 @@ __export(exports_scheduler, {
|
|
|
30404
30387
|
startScheduler: () => startScheduler,
|
|
30405
30388
|
cronMatches: () => cronMatches
|
|
30406
30389
|
});
|
|
30407
|
-
import { spawn } from "child_process";
|
|
30390
|
+
import { spawn as spawn2 } from "child_process";
|
|
30408
30391
|
function cronMatches(cron, d) {
|
|
30409
30392
|
const parts = cron.trim().split(/\s+/);
|
|
30410
30393
|
if (parts.length !== 5)
|
|
@@ -30431,7 +30414,7 @@ function cronMatches(cron, d) {
|
|
|
30431
30414
|
async function runConnectorCommand(connector, command, args) {
|
|
30432
30415
|
return new Promise((resolve) => {
|
|
30433
30416
|
const cmdArgs = [connector, command, ...args, "--format", "json"];
|
|
30434
|
-
const proc =
|
|
30417
|
+
const proc = spawn2("connectors", ["run", ...cmdArgs], { shell: false });
|
|
30435
30418
|
let output = "";
|
|
30436
30419
|
proc.stdout.on("data", (d) => {
|
|
30437
30420
|
output += d.toString();
|
|
@@ -30468,14 +30451,14 @@ function startScheduler(db) {
|
|
|
30468
30451
|
_interval = setInterval(() => {
|
|
30469
30452
|
(async () => {
|
|
30470
30453
|
try {
|
|
30471
|
-
const
|
|
30472
|
-
const currentMinute =
|
|
30454
|
+
const now4 = new Date;
|
|
30455
|
+
const currentMinute = now4.getMinutes() + now4.getHours() * 60;
|
|
30473
30456
|
if (currentMinute === _lastCheckedMinute)
|
|
30474
30457
|
return;
|
|
30475
30458
|
_lastCheckedMinute = currentMinute;
|
|
30476
30459
|
const jobs = listEnabledJobs(db);
|
|
30477
30460
|
for (const job of jobs) {
|
|
30478
|
-
if (cronMatches(job.cron,
|
|
30461
|
+
if (cronMatches(job.cron, now4)) {
|
|
30479
30462
|
executeJob(job, db).catch(() => {});
|
|
30480
30463
|
}
|
|
30481
30464
|
}
|
|
@@ -30580,7 +30563,7 @@ __export(exports_runner, {
|
|
|
30580
30563
|
import { existsSync as existsSync17, readdirSync as readdirSync10 } from "fs";
|
|
30581
30564
|
import { join as join17, dirname as dirname7 } from "path";
|
|
30582
30565
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
30583
|
-
import { spawn as
|
|
30566
|
+
import { spawn as spawn3 } from "child_process";
|
|
30584
30567
|
function resolveConnectorsDir2() {
|
|
30585
30568
|
const fromBin = join17(__dirname5, "..", "connectors");
|
|
30586
30569
|
if (existsSync17(fromBin))
|
|
@@ -30850,7 +30833,7 @@ function runLegacyConnectorCommand(name, args, timeoutMs = 30000) {
|
|
|
30850
30833
|
});
|
|
30851
30834
|
}
|
|
30852
30835
|
return new Promise((resolve) => {
|
|
30853
|
-
const proc =
|
|
30836
|
+
const proc = spawn3("bun", ["run", cliPath, ...args], {
|
|
30854
30837
|
timeout: timeoutMs,
|
|
30855
30838
|
env: buildEnvWithCredentials(connectorName, process.env),
|
|
30856
30839
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -34413,7 +34396,7 @@ class JSONSchemaGenerator {
|
|
|
34413
34396
|
if (val === undefined) {
|
|
34414
34397
|
if (this.unrepresentable === "throw") {
|
|
34415
34398
|
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
34416
|
-
}
|
|
34399
|
+
}
|
|
34417
34400
|
} else if (typeof val === "bigint") {
|
|
34418
34401
|
if (this.unrepresentable === "throw") {
|
|
34419
34402
|
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
@@ -35645,7 +35628,7 @@ var init_types3 = __esm(() => {
|
|
|
35645
35628
|
ProgressTokenSchema = union([string2(), number2().int()]);
|
|
35646
35629
|
CursorSchema = string2();
|
|
35647
35630
|
TaskCreationParamsSchema = looseObject({
|
|
35648
|
-
ttl:
|
|
35631
|
+
ttl: number2().optional(),
|
|
35649
35632
|
pollInterval: number2().optional()
|
|
35650
35633
|
});
|
|
35651
35634
|
TaskMetadataSchema = object({
|
|
@@ -35793,7 +35776,8 @@ var init_types3 = __esm(() => {
|
|
|
35793
35776
|
roots: object({
|
|
35794
35777
|
listChanged: boolean2().optional()
|
|
35795
35778
|
}).optional(),
|
|
35796
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
35779
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
35780
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
35797
35781
|
});
|
|
35798
35782
|
InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
35799
35783
|
protocolVersion: string2(),
|
|
@@ -35818,7 +35802,8 @@ var init_types3 = __esm(() => {
|
|
|
35818
35802
|
tools: object({
|
|
35819
35803
|
listChanged: boolean2().optional()
|
|
35820
35804
|
}).optional(),
|
|
35821
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
35805
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
35806
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
35822
35807
|
});
|
|
35823
35808
|
InitializeResultSchema = ResultSchema.extend({
|
|
35824
35809
|
protocolVersion: string2(),
|
|
@@ -35933,6 +35918,7 @@ var init_types3 = __esm(() => {
|
|
|
35933
35918
|
uri: string2(),
|
|
35934
35919
|
description: optional(string2()),
|
|
35935
35920
|
mimeType: optional(string2()),
|
|
35921
|
+
size: optional(number2()),
|
|
35936
35922
|
annotations: AnnotationsSchema.optional(),
|
|
35937
35923
|
_meta: optional(looseObject({}))
|
|
35938
35924
|
});
|
|
@@ -36571,6 +36557,7 @@ data:
|
|
|
36571
36557
|
async handleGetRequest(req) {
|
|
36572
36558
|
const acceptHeader = req.headers.get("accept");
|
|
36573
36559
|
if (!acceptHeader?.includes("text/event-stream")) {
|
|
36560
|
+
this.onerror?.(new Error("Not Acceptable: Client must accept text/event-stream"));
|
|
36574
36561
|
return this.createJsonErrorResponse(406, -32000, "Not Acceptable: Client must accept text/event-stream");
|
|
36575
36562
|
}
|
|
36576
36563
|
const sessionError = this.validateSession(req);
|
|
@@ -36588,6 +36575,7 @@ data:
|
|
|
36588
36575
|
}
|
|
36589
36576
|
}
|
|
36590
36577
|
if (this._streamMapping.get(this._standaloneSseStreamId) !== undefined) {
|
|
36578
|
+
this.onerror?.(new Error("Conflict: Only one SSE stream is allowed per session"));
|
|
36591
36579
|
return this.createJsonErrorResponse(409, -32000, "Conflict: Only one SSE stream is allowed per session");
|
|
36592
36580
|
}
|
|
36593
36581
|
const encoder = new TextEncoder;
|
|
@@ -36622,6 +36610,7 @@ data:
|
|
|
36622
36610
|
}
|
|
36623
36611
|
async replayEvents(lastEventId) {
|
|
36624
36612
|
if (!this._eventStore) {
|
|
36613
|
+
this.onerror?.(new Error("Event store not configured"));
|
|
36625
36614
|
return this.createJsonErrorResponse(400, -32000, "Event store not configured");
|
|
36626
36615
|
}
|
|
36627
36616
|
try {
|
|
@@ -36629,9 +36618,11 @@ data:
|
|
|
36629
36618
|
if (this._eventStore.getStreamIdForEventId) {
|
|
36630
36619
|
streamId = await this._eventStore.getStreamIdForEventId(lastEventId);
|
|
36631
36620
|
if (!streamId) {
|
|
36621
|
+
this.onerror?.(new Error("Invalid event ID format"));
|
|
36632
36622
|
return this.createJsonErrorResponse(400, -32000, "Invalid event ID format");
|
|
36633
36623
|
}
|
|
36634
36624
|
if (this._streamMapping.get(streamId) !== undefined) {
|
|
36625
|
+
this.onerror?.(new Error("Conflict: Stream already has an active connection"));
|
|
36635
36626
|
return this.createJsonErrorResponse(409, -32000, "Conflict: Stream already has an active connection");
|
|
36636
36627
|
}
|
|
36637
36628
|
}
|
|
@@ -36691,11 +36682,13 @@ data:
|
|
|
36691
36682
|
`;
|
|
36692
36683
|
controller.enqueue(encoder.encode(eventData));
|
|
36693
36684
|
return true;
|
|
36694
|
-
} catch {
|
|
36685
|
+
} catch (error2) {
|
|
36686
|
+
this.onerror?.(error2);
|
|
36695
36687
|
return false;
|
|
36696
36688
|
}
|
|
36697
36689
|
}
|
|
36698
36690
|
handleUnsupportedRequest() {
|
|
36691
|
+
this.onerror?.(new Error("Method not allowed."));
|
|
36699
36692
|
return new Response(JSON.stringify({
|
|
36700
36693
|
jsonrpc: "2.0",
|
|
36701
36694
|
error: {
|
|
@@ -36715,14 +36708,17 @@ data:
|
|
|
36715
36708
|
try {
|
|
36716
36709
|
const acceptHeader = req.headers.get("accept");
|
|
36717
36710
|
if (!acceptHeader?.includes("application/json") || !acceptHeader.includes("text/event-stream")) {
|
|
36711
|
+
this.onerror?.(new Error("Not Acceptable: Client must accept both application/json and text/event-stream"));
|
|
36718
36712
|
return this.createJsonErrorResponse(406, -32000, "Not Acceptable: Client must accept both application/json and text/event-stream");
|
|
36719
36713
|
}
|
|
36720
36714
|
const ct = req.headers.get("content-type");
|
|
36721
36715
|
if (!ct || !ct.includes("application/json")) {
|
|
36716
|
+
this.onerror?.(new Error("Unsupported Media Type: Content-Type must be application/json"));
|
|
36722
36717
|
return this.createJsonErrorResponse(415, -32000, "Unsupported Media Type: Content-Type must be application/json");
|
|
36723
36718
|
}
|
|
36724
36719
|
const requestInfo = {
|
|
36725
|
-
headers: Object.fromEntries(req.headers.entries())
|
|
36720
|
+
headers: Object.fromEntries(req.headers.entries()),
|
|
36721
|
+
url: new URL(req.url)
|
|
36726
36722
|
};
|
|
36727
36723
|
let rawMessage;
|
|
36728
36724
|
if (options?.parsedBody !== undefined) {
|
|
@@ -36731,6 +36727,7 @@ data:
|
|
|
36731
36727
|
try {
|
|
36732
36728
|
rawMessage = await req.json();
|
|
36733
36729
|
} catch {
|
|
36730
|
+
this.onerror?.(new Error("Parse error: Invalid JSON"));
|
|
36734
36731
|
return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON");
|
|
36735
36732
|
}
|
|
36736
36733
|
}
|
|
@@ -36742,14 +36739,17 @@ data:
|
|
|
36742
36739
|
messages = [JSONRPCMessageSchema.parse(rawMessage)];
|
|
36743
36740
|
}
|
|
36744
36741
|
} catch {
|
|
36742
|
+
this.onerror?.(new Error("Parse error: Invalid JSON-RPC message"));
|
|
36745
36743
|
return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON-RPC message");
|
|
36746
36744
|
}
|
|
36747
36745
|
const isInitializationRequest = messages.some(isInitializeRequest);
|
|
36748
36746
|
if (isInitializationRequest) {
|
|
36749
36747
|
if (this._initialized && this.sessionId !== undefined) {
|
|
36748
|
+
this.onerror?.(new Error("Invalid Request: Server already initialized"));
|
|
36750
36749
|
return this.createJsonErrorResponse(400, -32600, "Invalid Request: Server already initialized");
|
|
36751
36750
|
}
|
|
36752
36751
|
if (messages.length > 1) {
|
|
36752
|
+
this.onerror?.(new Error("Invalid Request: Only one initialization request is allowed"));
|
|
36753
36753
|
return this.createJsonErrorResponse(400, -32600, "Invalid Request: Only one initialization request is allowed");
|
|
36754
36754
|
}
|
|
36755
36755
|
this.sessionId = this.sessionIdGenerator?.();
|
|
@@ -36867,13 +36867,16 @@ data:
|
|
|
36867
36867
|
return;
|
|
36868
36868
|
}
|
|
36869
36869
|
if (!this._initialized) {
|
|
36870
|
+
this.onerror?.(new Error("Bad Request: Server not initialized"));
|
|
36870
36871
|
return this.createJsonErrorResponse(400, -32000, "Bad Request: Server not initialized");
|
|
36871
36872
|
}
|
|
36872
36873
|
const sessionId = req.headers.get("mcp-session-id");
|
|
36873
36874
|
if (!sessionId) {
|
|
36875
|
+
this.onerror?.(new Error("Bad Request: Mcp-Session-Id header is required"));
|
|
36874
36876
|
return this.createJsonErrorResponse(400, -32000, "Bad Request: Mcp-Session-Id header is required");
|
|
36875
36877
|
}
|
|
36876
36878
|
if (sessionId !== this.sessionId) {
|
|
36879
|
+
this.onerror?.(new Error("Session not found"));
|
|
36877
36880
|
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
36878
36881
|
}
|
|
36879
36882
|
return;
|
|
@@ -36881,6 +36884,7 @@ data:
|
|
|
36881
36884
|
validateProtocolVersion(req) {
|
|
36882
36885
|
const protocolVersion = req.headers.get("mcp-protocol-version");
|
|
36883
36886
|
if (protocolVersion !== null && !SUPPORTED_PROTOCOL_VERSIONS.includes(protocolVersion)) {
|
|
36887
|
+
this.onerror?.(new Error(`Bad Request: Unsupported protocol version: ${protocolVersion}` + ` (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(", ")})`));
|
|
36884
36888
|
return this.createJsonErrorResponse(400, -32000, `Bad Request: Unsupported protocol version: ${protocolVersion} (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(", ")})`);
|
|
36885
36889
|
}
|
|
36886
36890
|
return;
|
|
@@ -38869,6 +38873,10 @@ class Protocol {
|
|
|
38869
38873
|
this._progressHandlers.clear();
|
|
38870
38874
|
this._taskProgressTokens.clear();
|
|
38871
38875
|
this._pendingDebouncedNotifications.clear();
|
|
38876
|
+
for (const info of this._timeoutInfo.values()) {
|
|
38877
|
+
clearTimeout(info.timeoutId);
|
|
38878
|
+
}
|
|
38879
|
+
this._timeoutInfo.clear();
|
|
38872
38880
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
38873
38881
|
controller.abort();
|
|
38874
38882
|
}
|
|
@@ -38999,7 +39007,9 @@ class Protocol {
|
|
|
38999
39007
|
await capturedTransport?.send(errorResponse);
|
|
39000
39008
|
}
|
|
39001
39009
|
}).catch((error2) => this._onerror(new Error(`Failed to send response: ${error2}`))).finally(() => {
|
|
39002
|
-
this._requestHandlerAbortControllers.
|
|
39010
|
+
if (this._requestHandlerAbortControllers.get(request2.id) === abortController) {
|
|
39011
|
+
this._requestHandlerAbortControllers.delete(request2.id);
|
|
39012
|
+
}
|
|
39003
39013
|
});
|
|
39004
39014
|
}
|
|
39005
39015
|
_onprogress(notification) {
|
|
@@ -42512,6 +42522,9 @@ var require_data = __commonJS((exports, module) => {
|
|
|
42512
42522
|
var require_utils3 = __commonJS((exports, module) => {
|
|
42513
42523
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
42514
42524
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
42525
|
+
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
42526
|
+
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
42527
|
+
var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
|
|
42515
42528
|
function stringArrayToHexStripped(input) {
|
|
42516
42529
|
let acc = "";
|
|
42517
42530
|
let code = 0;
|
|
@@ -42705,27 +42718,77 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
42705
42718
|
}
|
|
42706
42719
|
return output.join("");
|
|
42707
42720
|
}
|
|
42708
|
-
|
|
42709
|
-
|
|
42710
|
-
|
|
42711
|
-
|
|
42712
|
-
|
|
42713
|
-
|
|
42714
|
-
|
|
42715
|
-
|
|
42716
|
-
|
|
42717
|
-
|
|
42721
|
+
var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
|
|
42722
|
+
var HOST_DELIM_RE = /[@/?#:]/g;
|
|
42723
|
+
var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
|
|
42724
|
+
function reescapeHostDelimiters(host, isIP) {
|
|
42725
|
+
const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
|
|
42726
|
+
re.lastIndex = 0;
|
|
42727
|
+
return host.replace(re, (ch) => HOST_DELIMS[ch]);
|
|
42728
|
+
}
|
|
42729
|
+
function normalizePercentEncoding(input, decodeUnreserved = false) {
|
|
42730
|
+
if (input.indexOf("%") === -1) {
|
|
42731
|
+
return input;
|
|
42718
42732
|
}
|
|
42719
|
-
|
|
42720
|
-
|
|
42733
|
+
let output = "";
|
|
42734
|
+
for (let i = 0;i < input.length; i++) {
|
|
42735
|
+
if (input[i] === "%" && i + 2 < input.length) {
|
|
42736
|
+
const hex = input.slice(i + 1, i + 3);
|
|
42737
|
+
if (isHexPair(hex)) {
|
|
42738
|
+
const normalizedHex = hex.toUpperCase();
|
|
42739
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
42740
|
+
if (decodeUnreserved && isUnreserved(decoded)) {
|
|
42741
|
+
output += decoded;
|
|
42742
|
+
} else {
|
|
42743
|
+
output += "%" + normalizedHex;
|
|
42744
|
+
}
|
|
42745
|
+
i += 2;
|
|
42746
|
+
continue;
|
|
42747
|
+
}
|
|
42748
|
+
}
|
|
42749
|
+
output += input[i];
|
|
42721
42750
|
}
|
|
42722
|
-
|
|
42723
|
-
|
|
42751
|
+
return output;
|
|
42752
|
+
}
|
|
42753
|
+
function normalizePathEncoding(input) {
|
|
42754
|
+
let output = "";
|
|
42755
|
+
for (let i = 0;i < input.length; i++) {
|
|
42756
|
+
if (input[i] === "%" && i + 2 < input.length) {
|
|
42757
|
+
const hex = input.slice(i + 1, i + 3);
|
|
42758
|
+
if (isHexPair(hex)) {
|
|
42759
|
+
const normalizedHex = hex.toUpperCase();
|
|
42760
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
42761
|
+
if (decoded !== "." && isUnreserved(decoded)) {
|
|
42762
|
+
output += decoded;
|
|
42763
|
+
} else {
|
|
42764
|
+
output += "%" + normalizedHex;
|
|
42765
|
+
}
|
|
42766
|
+
i += 2;
|
|
42767
|
+
continue;
|
|
42768
|
+
}
|
|
42769
|
+
}
|
|
42770
|
+
if (isPathCharacter(input[i])) {
|
|
42771
|
+
output += input[i];
|
|
42772
|
+
} else {
|
|
42773
|
+
output += escape(input[i]);
|
|
42774
|
+
}
|
|
42724
42775
|
}
|
|
42725
|
-
|
|
42726
|
-
|
|
42776
|
+
return output;
|
|
42777
|
+
}
|
|
42778
|
+
function escapePreservingEscapes(input) {
|
|
42779
|
+
let output = "";
|
|
42780
|
+
for (let i = 0;i < input.length; i++) {
|
|
42781
|
+
if (input[i] === "%" && i + 2 < input.length) {
|
|
42782
|
+
const hex = input.slice(i + 1, i + 3);
|
|
42783
|
+
if (isHexPair(hex)) {
|
|
42784
|
+
output += "%" + hex.toUpperCase();
|
|
42785
|
+
i += 2;
|
|
42786
|
+
continue;
|
|
42787
|
+
}
|
|
42788
|
+
}
|
|
42789
|
+
output += escape(input[i]);
|
|
42727
42790
|
}
|
|
42728
|
-
return
|
|
42791
|
+
return output;
|
|
42729
42792
|
}
|
|
42730
42793
|
function recomposeAuthority(component) {
|
|
42731
42794
|
const uriTokens = [];
|
|
@@ -42740,7 +42803,7 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
42740
42803
|
if (ipV6res.isIPV6 === true) {
|
|
42741
42804
|
host = `[${ipV6res.escapedHost}]`;
|
|
42742
42805
|
} else {
|
|
42743
|
-
host =
|
|
42806
|
+
host = reescapeHostDelimiters(host, false);
|
|
42744
42807
|
}
|
|
42745
42808
|
}
|
|
42746
42809
|
uriTokens.push(host);
|
|
@@ -42754,7 +42817,10 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
42754
42817
|
module.exports = {
|
|
42755
42818
|
nonSimpleDomain,
|
|
42756
42819
|
recomposeAuthority,
|
|
42757
|
-
|
|
42820
|
+
reescapeHostDelimiters,
|
|
42821
|
+
normalizePercentEncoding,
|
|
42822
|
+
normalizePathEncoding,
|
|
42823
|
+
escapePreservingEscapes,
|
|
42758
42824
|
removeDotSegments,
|
|
42759
42825
|
isIPv4,
|
|
42760
42826
|
isUUID,
|
|
@@ -42939,11 +43005,11 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
42939
43005
|
|
|
42940
43006
|
// node_modules/fast-uri/index.js
|
|
42941
43007
|
var require_fast_uri = __commonJS((exports, module) => {
|
|
42942
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority,
|
|
43008
|
+
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils3();
|
|
42943
43009
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
42944
43010
|
function normalize(uri, options) {
|
|
42945
43011
|
if (typeof uri === "string") {
|
|
42946
|
-
uri =
|
|
43012
|
+
uri = normalizeString(uri, options);
|
|
42947
43013
|
} else if (typeof uri === "object") {
|
|
42948
43014
|
uri = parse6(serialize(uri, options), options);
|
|
42949
43015
|
}
|
|
@@ -43009,19 +43075,9 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43009
43075
|
return target;
|
|
43010
43076
|
}
|
|
43011
43077
|
function equal(uriA, uriB, options) {
|
|
43012
|
-
|
|
43013
|
-
|
|
43014
|
-
|
|
43015
|
-
} else if (typeof uriA === "object") {
|
|
43016
|
-
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
43017
|
-
}
|
|
43018
|
-
if (typeof uriB === "string") {
|
|
43019
|
-
uriB = unescape(uriB);
|
|
43020
|
-
uriB = serialize(normalizeComponentEncoding(parse6(uriB, options), true), { ...options, skipEscape: true });
|
|
43021
|
-
} else if (typeof uriB === "object") {
|
|
43022
|
-
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
43023
|
-
}
|
|
43024
|
-
return uriA.toLowerCase() === uriB.toLowerCase();
|
|
43078
|
+
const normalizedA = normalizeComparableURI(uriA, options);
|
|
43079
|
+
const normalizedB = normalizeComparableURI(uriB, options);
|
|
43080
|
+
return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase();
|
|
43025
43081
|
}
|
|
43026
43082
|
function serialize(cmpts, opts) {
|
|
43027
43083
|
const component = {
|
|
@@ -43047,12 +43103,12 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43047
43103
|
schemeHandler.serialize(component, options);
|
|
43048
43104
|
if (component.path !== undefined) {
|
|
43049
43105
|
if (!options.skipEscape) {
|
|
43050
|
-
component.path =
|
|
43106
|
+
component.path = escapePreservingEscapes(component.path);
|
|
43051
43107
|
if (component.scheme !== undefined) {
|
|
43052
43108
|
component.path = component.path.split("%3A").join(":");
|
|
43053
43109
|
}
|
|
43054
43110
|
} else {
|
|
43055
|
-
component.path =
|
|
43111
|
+
component.path = normalizePercentEncoding(component.path);
|
|
43056
43112
|
}
|
|
43057
43113
|
}
|
|
43058
43114
|
if (options.reference !== "suffix" && component.scheme) {
|
|
@@ -43087,7 +43143,16 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43087
43143
|
return uriTokens.join("");
|
|
43088
43144
|
}
|
|
43089
43145
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
43090
|
-
function
|
|
43146
|
+
function getParseError(parsed, matches) {
|
|
43147
|
+
if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
|
|
43148
|
+
return 'URI path must start with "/" when authority is present.';
|
|
43149
|
+
}
|
|
43150
|
+
if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
|
|
43151
|
+
return "URI port is malformed.";
|
|
43152
|
+
}
|
|
43153
|
+
return;
|
|
43154
|
+
}
|
|
43155
|
+
function parseWithStatus(uri, opts) {
|
|
43091
43156
|
const options = Object.assign({}, opts);
|
|
43092
43157
|
const parsed = {
|
|
43093
43158
|
scheme: undefined,
|
|
@@ -43098,6 +43163,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43098
43163
|
query: undefined,
|
|
43099
43164
|
fragment: undefined
|
|
43100
43165
|
};
|
|
43166
|
+
let malformedAuthorityOrPort = false;
|
|
43101
43167
|
let isIP = false;
|
|
43102
43168
|
if (options.reference === "suffix") {
|
|
43103
43169
|
if (options.scheme) {
|
|
@@ -43118,6 +43184,11 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43118
43184
|
if (isNaN(parsed.port)) {
|
|
43119
43185
|
parsed.port = matches[5];
|
|
43120
43186
|
}
|
|
43187
|
+
const parseError = getParseError(parsed, matches);
|
|
43188
|
+
if (parseError !== undefined) {
|
|
43189
|
+
parsed.error = parsed.error || parseError;
|
|
43190
|
+
malformedAuthorityOrPort = true;
|
|
43191
|
+
}
|
|
43121
43192
|
if (parsed.host) {
|
|
43122
43193
|
const ipv4result = isIPv4(parsed.host);
|
|
43123
43194
|
if (ipv4result === false) {
|
|
@@ -43156,14 +43227,18 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43156
43227
|
parsed.scheme = unescape(parsed.scheme);
|
|
43157
43228
|
}
|
|
43158
43229
|
if (parsed.host !== undefined) {
|
|
43159
|
-
parsed.host = unescape(parsed.host);
|
|
43230
|
+
parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
|
|
43160
43231
|
}
|
|
43161
43232
|
}
|
|
43162
43233
|
if (parsed.path) {
|
|
43163
|
-
parsed.path =
|
|
43234
|
+
parsed.path = normalizePathEncoding(parsed.path);
|
|
43164
43235
|
}
|
|
43165
43236
|
if (parsed.fragment) {
|
|
43166
|
-
|
|
43237
|
+
try {
|
|
43238
|
+
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
|
|
43239
|
+
} catch {
|
|
43240
|
+
parsed.error = parsed.error || "URI malformed";
|
|
43241
|
+
}
|
|
43167
43242
|
}
|
|
43168
43243
|
}
|
|
43169
43244
|
if (schemeHandler && schemeHandler.parse) {
|
|
@@ -43172,7 +43247,29 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43172
43247
|
} else {
|
|
43173
43248
|
parsed.error = parsed.error || "URI can not be parsed.";
|
|
43174
43249
|
}
|
|
43175
|
-
return parsed;
|
|
43250
|
+
return { parsed, malformedAuthorityOrPort };
|
|
43251
|
+
}
|
|
43252
|
+
function parse6(uri, opts) {
|
|
43253
|
+
return parseWithStatus(uri, opts).parsed;
|
|
43254
|
+
}
|
|
43255
|
+
function normalizeString(uri, opts) {
|
|
43256
|
+
return normalizeStringWithStatus(uri, opts).normalized;
|
|
43257
|
+
}
|
|
43258
|
+
function normalizeStringWithStatus(uri, opts) {
|
|
43259
|
+
const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
43260
|
+
return {
|
|
43261
|
+
normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
|
|
43262
|
+
malformedAuthorityOrPort
|
|
43263
|
+
};
|
|
43264
|
+
}
|
|
43265
|
+
function normalizeComparableURI(uri, opts) {
|
|
43266
|
+
if (typeof uri === "string") {
|
|
43267
|
+
const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
|
|
43268
|
+
return malformedAuthorityOrPort ? undefined : normalized;
|
|
43269
|
+
}
|
|
43270
|
+
if (typeof uri === "object") {
|
|
43271
|
+
return serialize(uri, opts);
|
|
43272
|
+
}
|
|
43176
43273
|
}
|
|
43177
43274
|
var fastUri = {
|
|
43178
43275
|
SCHEMES,
|
|
@@ -43307,7 +43404,7 @@ var require_core = __commonJS((exports) => {
|
|
|
43307
43404
|
constructor(opts = {}) {
|
|
43308
43405
|
this.schemas = {};
|
|
43309
43406
|
this.refs = {};
|
|
43310
|
-
this.formats =
|
|
43407
|
+
this.formats = Object.create(null);
|
|
43311
43408
|
this._compilations = new Set;
|
|
43312
43409
|
this._loading = {};
|
|
43313
43410
|
this._cache = new Map;
|
|
@@ -44048,6 +44145,7 @@ var require_limitLength = __commonJS((exports) => {
|
|
|
44048
44145
|
var require_pattern = __commonJS((exports) => {
|
|
44049
44146
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44050
44147
|
var code_1 = require_code2();
|
|
44148
|
+
var util_1 = require_util();
|
|
44051
44149
|
var codegen_1 = require_codegen();
|
|
44052
44150
|
var error2 = {
|
|
44053
44151
|
message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
|
|
@@ -44060,10 +44158,18 @@ var require_pattern = __commonJS((exports) => {
|
|
|
44060
44158
|
$data: true,
|
|
44061
44159
|
error: error2,
|
|
44062
44160
|
code(cxt) {
|
|
44063
|
-
const { data, $data, schema, schemaCode, it } = cxt;
|
|
44161
|
+
const { gen, data, $data, schema, schemaCode, it } = cxt;
|
|
44064
44162
|
const u = it.opts.unicodeRegExp ? "u" : "";
|
|
44065
|
-
|
|
44066
|
-
|
|
44163
|
+
if ($data) {
|
|
44164
|
+
const { regExp } = it.opts.code;
|
|
44165
|
+
const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
|
|
44166
|
+
const valid = gen.let("valid");
|
|
44167
|
+
gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
|
|
44168
|
+
cxt.fail$data((0, codegen_1._)`!${valid}`);
|
|
44169
|
+
} else {
|
|
44170
|
+
const regExp = (0, code_1.usePattern)(cxt, schema);
|
|
44171
|
+
cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
|
|
44172
|
+
}
|
|
44067
44173
|
}
|
|
44068
44174
|
};
|
|
44069
44175
|
exports.default = def;
|
|
@@ -46020,6 +46126,62 @@ class ExperimentalServerTasks {
|
|
|
46020
46126
|
requestStream(request2, resultSchema, options) {
|
|
46021
46127
|
return this._server.requestStream(request2, resultSchema, options);
|
|
46022
46128
|
}
|
|
46129
|
+
createMessageStream(params, options) {
|
|
46130
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
46131
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
46132
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
46133
|
+
}
|
|
46134
|
+
if (params.messages.length > 0) {
|
|
46135
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
46136
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
46137
|
+
const hasToolResults = lastContent.some((c) => c.type === "tool_result");
|
|
46138
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
|
|
46139
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
46140
|
+
const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
|
|
46141
|
+
if (hasToolResults) {
|
|
46142
|
+
if (lastContent.some((c) => c.type !== "tool_result")) {
|
|
46143
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
46144
|
+
}
|
|
46145
|
+
if (!hasPreviousToolUse) {
|
|
46146
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
46147
|
+
}
|
|
46148
|
+
}
|
|
46149
|
+
if (hasPreviousToolUse) {
|
|
46150
|
+
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
46151
|
+
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
46152
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
46153
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
46154
|
+
}
|
|
46155
|
+
}
|
|
46156
|
+
}
|
|
46157
|
+
return this.requestStream({
|
|
46158
|
+
method: "sampling/createMessage",
|
|
46159
|
+
params
|
|
46160
|
+
}, CreateMessageResultSchema, options);
|
|
46161
|
+
}
|
|
46162
|
+
elicitInputStream(params, options) {
|
|
46163
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
46164
|
+
const mode = params.mode ?? "form";
|
|
46165
|
+
switch (mode) {
|
|
46166
|
+
case "url": {
|
|
46167
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
46168
|
+
throw new Error("Client does not support url elicitation.");
|
|
46169
|
+
}
|
|
46170
|
+
break;
|
|
46171
|
+
}
|
|
46172
|
+
case "form": {
|
|
46173
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
46174
|
+
throw new Error("Client does not support form elicitation.");
|
|
46175
|
+
}
|
|
46176
|
+
break;
|
|
46177
|
+
}
|
|
46178
|
+
}
|
|
46179
|
+
const normalizedParams = mode === "form" && params.mode === undefined ? { ...params, mode: "form" } : params;
|
|
46180
|
+
return this.requestStream({
|
|
46181
|
+
method: "elicitation/create",
|
|
46182
|
+
params: normalizedParams
|
|
46183
|
+
}, ElicitResultSchema, options);
|
|
46184
|
+
}
|
|
46023
46185
|
async getTask(taskId, options) {
|
|
46024
46186
|
return this._server.getTask({ taskId }, options);
|
|
46025
46187
|
}
|
|
@@ -46033,6 +46195,9 @@ class ExperimentalServerTasks {
|
|
|
46033
46195
|
return this._server.cancelTask({ taskId }, options);
|
|
46034
46196
|
}
|
|
46035
46197
|
}
|
|
46198
|
+
var init_server = __esm(() => {
|
|
46199
|
+
init_types3();
|
|
46200
|
+
});
|
|
46036
46201
|
|
|
46037
46202
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
46038
46203
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
@@ -46071,11 +46236,12 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
46071
46236
|
|
|
46072
46237
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
46073
46238
|
var Server;
|
|
46074
|
-
var
|
|
46239
|
+
var init_server2 = __esm(() => {
|
|
46075
46240
|
init_protocol();
|
|
46076
46241
|
init_types3();
|
|
46077
46242
|
init_ajv_provider();
|
|
46078
46243
|
init_zod_compat();
|
|
46244
|
+
init_server();
|
|
46079
46245
|
Server = class Server extends Protocol {
|
|
46080
46246
|
constructor(_serverInfo, options) {
|
|
46081
46247
|
super(options);
|
|
@@ -47084,6 +47250,9 @@ class McpServer {
|
|
|
47084
47250
|
annotations = rest.shift();
|
|
47085
47251
|
}
|
|
47086
47252
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
47253
|
+
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
|
|
47254
|
+
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
47255
|
+
}
|
|
47087
47256
|
annotations = rest.shift();
|
|
47088
47257
|
}
|
|
47089
47258
|
}
|
|
@@ -47172,6 +47341,9 @@ function getZodSchemaObject(schema) {
|
|
|
47172
47341
|
if (isZodRawShapeCompat(schema)) {
|
|
47173
47342
|
return objectFromShape(schema);
|
|
47174
47343
|
}
|
|
47344
|
+
if (!isZodSchemaInstance(schema)) {
|
|
47345
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
47346
|
+
}
|
|
47175
47347
|
return schema;
|
|
47176
47348
|
}
|
|
47177
47349
|
function promptArgumentsFromSchema(schema) {
|
|
@@ -47211,7 +47383,7 @@ function createCompletionResult(suggestions) {
|
|
|
47211
47383
|
}
|
|
47212
47384
|
var EMPTY_OBJECT_JSON_SCHEMA, EMPTY_COMPLETION_RESULT;
|
|
47213
47385
|
var init_mcp = __esm(() => {
|
|
47214
|
-
|
|
47386
|
+
init_server2();
|
|
47215
47387
|
init_zod_compat();
|
|
47216
47388
|
init_zod_json_schema_compat();
|
|
47217
47389
|
init_types3();
|
|
@@ -47517,7 +47689,7 @@ var init_management = __esm(() => {
|
|
|
47517
47689
|
// src/mcp/tools/auth.ts
|
|
47518
47690
|
import { existsSync as existsSync18, readFileSync as readFileSync9 } from "fs";
|
|
47519
47691
|
import { join as join18 } from "path";
|
|
47520
|
-
import { spawn as
|
|
47692
|
+
import { spawn as spawn4 } from "child_process";
|
|
47521
47693
|
function registerAuthTools(server, stripped) {
|
|
47522
47694
|
server.registerTool("connector_auth_status", {
|
|
47523
47695
|
title: "Connector Auth Status",
|
|
@@ -47660,7 +47832,7 @@ function registerAuthTools(server, stripped) {
|
|
|
47660
47832
|
} catch {}
|
|
47661
47833
|
if (!serverRunning) {
|
|
47662
47834
|
const scriptPath = process.argv[1];
|
|
47663
|
-
const serverProc =
|
|
47835
|
+
const serverProc = spawn4("node", [scriptPath, "serve", "--port", String(serverPort)], {
|
|
47664
47836
|
detached: true,
|
|
47665
47837
|
stdio: "ignore"
|
|
47666
47838
|
});
|
|
@@ -48228,7 +48400,7 @@ function buildServer() {
|
|
|
48228
48400
|
registerCloudTools(server, "connectors");
|
|
48229
48401
|
return server;
|
|
48230
48402
|
}
|
|
48231
|
-
var
|
|
48403
|
+
var init_server3 = __esm(() => {
|
|
48232
48404
|
init_mcp();
|
|
48233
48405
|
init_strip();
|
|
48234
48406
|
init_dist();
|
|
@@ -48262,7 +48434,7 @@ async function handleMcpHttpRequest(req) {
|
|
|
48262
48434
|
var MCP_NAME = "connectors";
|
|
48263
48435
|
var init_http = __esm(() => {
|
|
48264
48436
|
init_webStandardStreamableHttp();
|
|
48265
|
-
|
|
48437
|
+
init_server3();
|
|
48266
48438
|
});
|
|
48267
48439
|
|
|
48268
48440
|
// src/server/serve.ts
|
|
@@ -49113,6 +49285,684 @@ var {
|
|
|
49113
49285
|
Help
|
|
49114
49286
|
} = import__.default;
|
|
49115
49287
|
|
|
49288
|
+
// node_modules/@hasna/events/dist/commander.js
|
|
49289
|
+
import { chmod, mkdir, readFile, rename, writeFile } from "fs/promises";
|
|
49290
|
+
import { existsSync } from "fs";
|
|
49291
|
+
import { homedir } from "os";
|
|
49292
|
+
import { join } from "path";
|
|
49293
|
+
import { createHmac, timingSafeEqual } from "crypto";
|
|
49294
|
+
import { randomUUID } from "crypto";
|
|
49295
|
+
import { spawn } from "child_process";
|
|
49296
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
49297
|
+
function getPathValue(input, path) {
|
|
49298
|
+
return path.split(".").reduce((value, part) => {
|
|
49299
|
+
if (value && typeof value === "object" && part in value) {
|
|
49300
|
+
return value[part];
|
|
49301
|
+
}
|
|
49302
|
+
return;
|
|
49303
|
+
}, input);
|
|
49304
|
+
}
|
|
49305
|
+
function wildcardToRegExp(pattern) {
|
|
49306
|
+
const escaped = pattern.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*");
|
|
49307
|
+
return new RegExp(`^${escaped}$`);
|
|
49308
|
+
}
|
|
49309
|
+
function matchString(value, matcher) {
|
|
49310
|
+
if (matcher === undefined)
|
|
49311
|
+
return true;
|
|
49312
|
+
if (value === undefined)
|
|
49313
|
+
return false;
|
|
49314
|
+
const matchers = Array.isArray(matcher) ? matcher : [matcher];
|
|
49315
|
+
return matchers.some((item) => wildcardToRegExp(item).test(value));
|
|
49316
|
+
}
|
|
49317
|
+
function matchRecord(input, matcher) {
|
|
49318
|
+
if (!matcher)
|
|
49319
|
+
return true;
|
|
49320
|
+
return Object.entries(matcher).every(([path, expected]) => {
|
|
49321
|
+
const actual = getPathValue(input, path);
|
|
49322
|
+
if (typeof expected === "string" || Array.isArray(expected)) {
|
|
49323
|
+
return matchString(actual === undefined ? undefined : String(actual), expected);
|
|
49324
|
+
}
|
|
49325
|
+
return actual === expected;
|
|
49326
|
+
});
|
|
49327
|
+
}
|
|
49328
|
+
function eventMatchesFilter(event, filter) {
|
|
49329
|
+
return matchString(event.source, filter.source) && matchString(event.type, filter.type) && matchString(event.subject, filter.subject) && matchString(event.severity, filter.severity) && matchRecord(event.data, filter.data) && matchRecord(event.metadata, filter.metadata);
|
|
49330
|
+
}
|
|
49331
|
+
function channelMatchesEvent(channel, event) {
|
|
49332
|
+
if (!channel.enabled)
|
|
49333
|
+
return false;
|
|
49334
|
+
if (!channel.filters || channel.filters.length === 0)
|
|
49335
|
+
return true;
|
|
49336
|
+
return channel.filters.some((filter) => eventMatchesFilter(event, filter));
|
|
49337
|
+
}
|
|
49338
|
+
var HASNA_EVENTS_DIR_ENV = "HASNA_EVENTS_DIR";
|
|
49339
|
+
var HASNA_EVENTS_HOME_ENV = "HASNA_EVENTS_HOME";
|
|
49340
|
+
function getEventsDataDir(override) {
|
|
49341
|
+
return override || process.env[HASNA_EVENTS_DIR_ENV] || process.env[HASNA_EVENTS_HOME_ENV] || join(homedir(), ".hasna", "events");
|
|
49342
|
+
}
|
|
49343
|
+
|
|
49344
|
+
class JsonEventsStore {
|
|
49345
|
+
dataDir;
|
|
49346
|
+
channelsPath;
|
|
49347
|
+
eventsPath;
|
|
49348
|
+
deliveriesPath;
|
|
49349
|
+
constructor(dataDir = getEventsDataDir()) {
|
|
49350
|
+
this.dataDir = dataDir;
|
|
49351
|
+
this.channelsPath = join(dataDir, "channels.json");
|
|
49352
|
+
this.eventsPath = join(dataDir, "events.json");
|
|
49353
|
+
this.deliveriesPath = join(dataDir, "deliveries.json");
|
|
49354
|
+
}
|
|
49355
|
+
async init() {
|
|
49356
|
+
await mkdir(this.dataDir, { recursive: true, mode: 448 });
|
|
49357
|
+
await chmod(this.dataDir, 448).catch(() => {
|
|
49358
|
+
return;
|
|
49359
|
+
});
|
|
49360
|
+
await this.ensureArrayFile(this.channelsPath);
|
|
49361
|
+
await this.ensureArrayFile(this.eventsPath);
|
|
49362
|
+
await this.ensureArrayFile(this.deliveriesPath);
|
|
49363
|
+
}
|
|
49364
|
+
async addChannel(channel) {
|
|
49365
|
+
await this.init();
|
|
49366
|
+
const channels = await this.readJson(this.channelsPath, []);
|
|
49367
|
+
const index = channels.findIndex((item) => item.id === channel.id);
|
|
49368
|
+
if (index >= 0) {
|
|
49369
|
+
channels[index] = { ...channel, createdAt: channels[index].createdAt, updatedAt: new Date().toISOString() };
|
|
49370
|
+
} else {
|
|
49371
|
+
channels.push(channel);
|
|
49372
|
+
}
|
|
49373
|
+
await this.writeJson(this.channelsPath, channels);
|
|
49374
|
+
return index >= 0 ? channels[index] : channel;
|
|
49375
|
+
}
|
|
49376
|
+
async listChannels() {
|
|
49377
|
+
await this.init();
|
|
49378
|
+
return this.readJson(this.channelsPath, []);
|
|
49379
|
+
}
|
|
49380
|
+
async getChannel(id) {
|
|
49381
|
+
const channels = await this.listChannels();
|
|
49382
|
+
return channels.find((channel) => channel.id === id);
|
|
49383
|
+
}
|
|
49384
|
+
async removeChannel(id) {
|
|
49385
|
+
await this.init();
|
|
49386
|
+
const channels = await this.readJson(this.channelsPath, []);
|
|
49387
|
+
const next = channels.filter((channel) => channel.id !== id);
|
|
49388
|
+
await this.writeJson(this.channelsPath, next);
|
|
49389
|
+
return next.length !== channels.length;
|
|
49390
|
+
}
|
|
49391
|
+
async appendEvent(event) {
|
|
49392
|
+
await this.init();
|
|
49393
|
+
const events = await this.readJson(this.eventsPath, []);
|
|
49394
|
+
events.push(event);
|
|
49395
|
+
await this.writeJson(this.eventsPath, events);
|
|
49396
|
+
return event;
|
|
49397
|
+
}
|
|
49398
|
+
async listEvents() {
|
|
49399
|
+
await this.init();
|
|
49400
|
+
return this.readJson(this.eventsPath, []);
|
|
49401
|
+
}
|
|
49402
|
+
async findEventByIdentity(identity) {
|
|
49403
|
+
const events = await this.listEvents();
|
|
49404
|
+
return events.find((event) => identity.id !== undefined && event.id === identity.id || identity.dedupeKey !== undefined && event.dedupeKey === identity.dedupeKey);
|
|
49405
|
+
}
|
|
49406
|
+
async appendDelivery(result) {
|
|
49407
|
+
await this.init();
|
|
49408
|
+
const deliveries = await this.readJson(this.deliveriesPath, []);
|
|
49409
|
+
deliveries.push(result);
|
|
49410
|
+
await this.writeJson(this.deliveriesPath, deliveries);
|
|
49411
|
+
return result;
|
|
49412
|
+
}
|
|
49413
|
+
async listDeliveries() {
|
|
49414
|
+
await this.init();
|
|
49415
|
+
return this.readJson(this.deliveriesPath, []);
|
|
49416
|
+
}
|
|
49417
|
+
async exportData() {
|
|
49418
|
+
return {
|
|
49419
|
+
channels: await this.listChannels(),
|
|
49420
|
+
events: await this.listEvents(),
|
|
49421
|
+
deliveries: await this.listDeliveries()
|
|
49422
|
+
};
|
|
49423
|
+
}
|
|
49424
|
+
async ensureArrayFile(path) {
|
|
49425
|
+
if (!existsSync(path)) {
|
|
49426
|
+
await writeFile(path, `[]
|
|
49427
|
+
`, { encoding: "utf-8", mode: 384 });
|
|
49428
|
+
}
|
|
49429
|
+
await chmod(path, 384).catch(() => {
|
|
49430
|
+
return;
|
|
49431
|
+
});
|
|
49432
|
+
}
|
|
49433
|
+
async readJson(path, fallback) {
|
|
49434
|
+
try {
|
|
49435
|
+
const raw = await readFile(path, "utf-8");
|
|
49436
|
+
if (!raw.trim())
|
|
49437
|
+
return fallback;
|
|
49438
|
+
return JSON.parse(raw);
|
|
49439
|
+
} catch (error) {
|
|
49440
|
+
if (error.code === "ENOENT")
|
|
49441
|
+
return fallback;
|
|
49442
|
+
throw error;
|
|
49443
|
+
}
|
|
49444
|
+
}
|
|
49445
|
+
async writeJson(path, value) {
|
|
49446
|
+
const tempPath = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
49447
|
+
await writeFile(tempPath, `${JSON.stringify(value, null, 2)}
|
|
49448
|
+
`, { encoding: "utf-8", mode: 384 });
|
|
49449
|
+
await rename(tempPath, path);
|
|
49450
|
+
await chmod(path, 384).catch(() => {
|
|
49451
|
+
return;
|
|
49452
|
+
});
|
|
49453
|
+
}
|
|
49454
|
+
}
|
|
49455
|
+
var DEFAULT_SIGNATURE_TOLERANCE_MS = 5 * 60 * 1000;
|
|
49456
|
+
function buildSignatureBase(timestamp, body) {
|
|
49457
|
+
return `${timestamp}.${body}`;
|
|
49458
|
+
}
|
|
49459
|
+
function signPayload(secret, timestamp, body) {
|
|
49460
|
+
const digest = createHmac("sha256", secret).update(buildSignatureBase(timestamp, body)).digest("hex");
|
|
49461
|
+
return `sha256=${digest}`;
|
|
49462
|
+
}
|
|
49463
|
+
function now() {
|
|
49464
|
+
return new Date().toISOString();
|
|
49465
|
+
}
|
|
49466
|
+
function truncate(value, max = 4096) {
|
|
49467
|
+
return value.length > max ? `${value.slice(0, max)}...` : value;
|
|
49468
|
+
}
|
|
49469
|
+
function buildWebhookRequest(event, channel) {
|
|
49470
|
+
if (!channel.webhook)
|
|
49471
|
+
throw new Error(`Channel ${channel.id} has no webhook config`);
|
|
49472
|
+
const body = JSON.stringify(event);
|
|
49473
|
+
const timestamp = event.time;
|
|
49474
|
+
const headers = {
|
|
49475
|
+
"Content-Type": "application/json",
|
|
49476
|
+
"User-Agent": "@hasna/events",
|
|
49477
|
+
"X-Hasna-Event-Id": event.id,
|
|
49478
|
+
"X-Hasna-Event-Type": event.type,
|
|
49479
|
+
"X-Hasna-Timestamp": timestamp,
|
|
49480
|
+
...channel.webhook.headers
|
|
49481
|
+
};
|
|
49482
|
+
if (channel.webhook.secret) {
|
|
49483
|
+
headers["X-Hasna-Signature"] = signPayload(channel.webhook.secret, timestamp, body);
|
|
49484
|
+
}
|
|
49485
|
+
return { body, headers };
|
|
49486
|
+
}
|
|
49487
|
+
async function dispatchWebhook(event, channel, options = {}) {
|
|
49488
|
+
if (!channel.webhook)
|
|
49489
|
+
throw new Error(`Channel ${channel.id} has no webhook config`);
|
|
49490
|
+
const startedAt = now();
|
|
49491
|
+
const { body, headers } = buildWebhookRequest(event, channel);
|
|
49492
|
+
const controller = new AbortController;
|
|
49493
|
+
const timeout = setTimeout(() => controller.abort(), channel.webhook.timeoutMs ?? 15000);
|
|
49494
|
+
try {
|
|
49495
|
+
const response = await (options.fetchImpl ?? fetch)(channel.webhook.url, {
|
|
49496
|
+
method: "POST",
|
|
49497
|
+
headers,
|
|
49498
|
+
body,
|
|
49499
|
+
signal: controller.signal
|
|
49500
|
+
});
|
|
49501
|
+
const responseBody = truncate(await response.text());
|
|
49502
|
+
return {
|
|
49503
|
+
attempt: 1,
|
|
49504
|
+
status: response.ok ? "success" : "failed",
|
|
49505
|
+
startedAt,
|
|
49506
|
+
completedAt: now(),
|
|
49507
|
+
responseStatus: response.status,
|
|
49508
|
+
responseBody,
|
|
49509
|
+
error: response.ok ? undefined : `Webhook returned HTTP ${response.status}`
|
|
49510
|
+
};
|
|
49511
|
+
} catch (error) {
|
|
49512
|
+
return {
|
|
49513
|
+
attempt: 1,
|
|
49514
|
+
status: "failed",
|
|
49515
|
+
startedAt,
|
|
49516
|
+
completedAt: now(),
|
|
49517
|
+
error: error instanceof Error ? error.message : String(error)
|
|
49518
|
+
};
|
|
49519
|
+
} finally {
|
|
49520
|
+
clearTimeout(timeout);
|
|
49521
|
+
}
|
|
49522
|
+
}
|
|
49523
|
+
async function dispatchCommand(event, channel) {
|
|
49524
|
+
if (!channel.command)
|
|
49525
|
+
throw new Error(`Channel ${channel.id} has no command config`);
|
|
49526
|
+
const startedAt = now();
|
|
49527
|
+
const eventJson = JSON.stringify(event);
|
|
49528
|
+
const env = {
|
|
49529
|
+
...process.env,
|
|
49530
|
+
...channel.command.env,
|
|
49531
|
+
HASNA_CHANNEL_ID: channel.id,
|
|
49532
|
+
HASNA_EVENT_ID: event.id,
|
|
49533
|
+
HASNA_EVENT_TYPE: event.type,
|
|
49534
|
+
HASNA_EVENT_SOURCE: event.source,
|
|
49535
|
+
HASNA_EVENT_SUBJECT: event.subject ?? "",
|
|
49536
|
+
HASNA_EVENT_SEVERITY: event.severity,
|
|
49537
|
+
HASNA_EVENT_TIME: event.time,
|
|
49538
|
+
HASNA_EVENT_DEDUPE_KEY: event.dedupeKey ?? "",
|
|
49539
|
+
HASNA_EVENT_SCHEMA_VERSION: event.schemaVersion,
|
|
49540
|
+
HASNA_EVENT_JSON: eventJson
|
|
49541
|
+
};
|
|
49542
|
+
return new Promise((resolve) => {
|
|
49543
|
+
const child = spawn(channel.command.command, channel.command.args ?? [], {
|
|
49544
|
+
cwd: channel.command.cwd,
|
|
49545
|
+
env,
|
|
49546
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
49547
|
+
});
|
|
49548
|
+
let stdout = "";
|
|
49549
|
+
let stderr = "";
|
|
49550
|
+
const timeout = setTimeout(() => child.kill("SIGTERM"), channel.command.timeoutMs ?? 15000);
|
|
49551
|
+
child.stdin.end(eventJson);
|
|
49552
|
+
child.stdout.on("data", (chunk) => {
|
|
49553
|
+
stdout += chunk.toString();
|
|
49554
|
+
});
|
|
49555
|
+
child.stderr.on("data", (chunk) => {
|
|
49556
|
+
stderr += chunk.toString();
|
|
49557
|
+
});
|
|
49558
|
+
child.on("error", (error) => {
|
|
49559
|
+
clearTimeout(timeout);
|
|
49560
|
+
resolve({
|
|
49561
|
+
attempt: 1,
|
|
49562
|
+
status: "failed",
|
|
49563
|
+
startedAt,
|
|
49564
|
+
completedAt: now(),
|
|
49565
|
+
stdout: truncate(stdout),
|
|
49566
|
+
stderr: truncate(stderr),
|
|
49567
|
+
error: error.message
|
|
49568
|
+
});
|
|
49569
|
+
});
|
|
49570
|
+
child.on("close", (code, signal) => {
|
|
49571
|
+
clearTimeout(timeout);
|
|
49572
|
+
const success = code === 0;
|
|
49573
|
+
resolve({
|
|
49574
|
+
attempt: 1,
|
|
49575
|
+
status: success ? "success" : "failed",
|
|
49576
|
+
startedAt,
|
|
49577
|
+
completedAt: now(),
|
|
49578
|
+
stdout: truncate(stdout),
|
|
49579
|
+
stderr: truncate(stderr),
|
|
49580
|
+
error: success ? undefined : `Command exited with ${signal ? `signal ${signal}` : `code ${code}`}`
|
|
49581
|
+
});
|
|
49582
|
+
});
|
|
49583
|
+
});
|
|
49584
|
+
}
|
|
49585
|
+
async function dispatchChannel(event, channel, options = {}) {
|
|
49586
|
+
if (channel.transport === "webhook")
|
|
49587
|
+
return dispatchWebhook(event, channel, options);
|
|
49588
|
+
if (channel.transport === "command")
|
|
49589
|
+
return dispatchCommand(event, channel);
|
|
49590
|
+
return {
|
|
49591
|
+
attempt: 1,
|
|
49592
|
+
status: "skipped",
|
|
49593
|
+
startedAt: now(),
|
|
49594
|
+
completedAt: now(),
|
|
49595
|
+
error: `Unsupported transport: ${channel.transport}`
|
|
49596
|
+
};
|
|
49597
|
+
}
|
|
49598
|
+
function createDeliveryResult(event, channel, attempts) {
|
|
49599
|
+
const status = attempts.some((attempt) => attempt.status === "success") ? "success" : attempts.every((attempt) => attempt.status === "skipped") ? "skipped" : "failed";
|
|
49600
|
+
return {
|
|
49601
|
+
id: randomUUID(),
|
|
49602
|
+
eventId: event.id,
|
|
49603
|
+
channelId: channel.id,
|
|
49604
|
+
transport: channel.transport,
|
|
49605
|
+
status,
|
|
49606
|
+
attempts,
|
|
49607
|
+
createdAt: attempts[0]?.startedAt ?? now(),
|
|
49608
|
+
completedAt: attempts.at(-1)?.completedAt ?? now()
|
|
49609
|
+
};
|
|
49610
|
+
}
|
|
49611
|
+
function createEvent(input) {
|
|
49612
|
+
return {
|
|
49613
|
+
id: input.id ?? randomUUID2(),
|
|
49614
|
+
source: input.source,
|
|
49615
|
+
type: input.type,
|
|
49616
|
+
time: normalizeTime(input.time),
|
|
49617
|
+
subject: input.subject,
|
|
49618
|
+
severity: input.severity ?? "info",
|
|
49619
|
+
data: input.data ?? {},
|
|
49620
|
+
message: input.message,
|
|
49621
|
+
dedupeKey: input.dedupeKey,
|
|
49622
|
+
schemaVersion: input.schemaVersion ?? "1.0",
|
|
49623
|
+
metadata: input.metadata ?? {}
|
|
49624
|
+
};
|
|
49625
|
+
}
|
|
49626
|
+
|
|
49627
|
+
class EventsClient {
|
|
49628
|
+
store;
|
|
49629
|
+
redactors;
|
|
49630
|
+
transportOptions;
|
|
49631
|
+
constructor(options = {}) {
|
|
49632
|
+
this.store = options.store ?? new JsonEventsStore(options.dataDir);
|
|
49633
|
+
this.redactors = options.redactors ?? [];
|
|
49634
|
+
this.transportOptions = { fetchImpl: options.fetchImpl };
|
|
49635
|
+
}
|
|
49636
|
+
async addChannel(input) {
|
|
49637
|
+
const timestamp = new Date().toISOString();
|
|
49638
|
+
return this.store.addChannel({
|
|
49639
|
+
...input,
|
|
49640
|
+
createdAt: input.createdAt ?? timestamp,
|
|
49641
|
+
updatedAt: input.updatedAt ?? timestamp
|
|
49642
|
+
});
|
|
49643
|
+
}
|
|
49644
|
+
async listChannels() {
|
|
49645
|
+
return this.store.listChannels();
|
|
49646
|
+
}
|
|
49647
|
+
async removeChannel(id) {
|
|
49648
|
+
return this.store.removeChannel(id);
|
|
49649
|
+
}
|
|
49650
|
+
async emit(input, options = {}) {
|
|
49651
|
+
const event = options.redactSensitiveData === false ? createEvent(input) : redactSensitiveKeys(createEvent(input));
|
|
49652
|
+
if (options.dedupe !== false) {
|
|
49653
|
+
const existing = await this.store.findEventByIdentity({ id: input.id, dedupeKey: event.dedupeKey });
|
|
49654
|
+
if (existing) {
|
|
49655
|
+
return { event: existing, deliveries: [], deduped: true };
|
|
49656
|
+
}
|
|
49657
|
+
}
|
|
49658
|
+
await this.store.appendEvent(event);
|
|
49659
|
+
const deliveries = options.deliver === false ? [] : await this.deliver(event);
|
|
49660
|
+
return { event, deliveries, deduped: false };
|
|
49661
|
+
}
|
|
49662
|
+
async listEvents() {
|
|
49663
|
+
return this.store.listEvents();
|
|
49664
|
+
}
|
|
49665
|
+
async listDeliveries() {
|
|
49666
|
+
return this.store.listDeliveries();
|
|
49667
|
+
}
|
|
49668
|
+
async deliver(event) {
|
|
49669
|
+
const channels = await this.store.listChannels();
|
|
49670
|
+
const selected = channels.filter((channel) => channelMatchesEvent(channel, event));
|
|
49671
|
+
const deliveries = [];
|
|
49672
|
+
for (const channel of selected) {
|
|
49673
|
+
const eventForChannel = await this.applyRedaction(event, channel);
|
|
49674
|
+
const result = await this.deliverWithRetry(eventForChannel, channel);
|
|
49675
|
+
await this.store.appendDelivery(result);
|
|
49676
|
+
deliveries.push(result);
|
|
49677
|
+
}
|
|
49678
|
+
return deliveries;
|
|
49679
|
+
}
|
|
49680
|
+
async testChannel(id, input = {}) {
|
|
49681
|
+
const channel = await this.store.getChannel(id);
|
|
49682
|
+
if (!channel)
|
|
49683
|
+
throw new Error(`Channel not found: ${id}`);
|
|
49684
|
+
const event = createEvent({
|
|
49685
|
+
source: input.source ?? "hasna.events",
|
|
49686
|
+
type: input.type ?? "events.test",
|
|
49687
|
+
subject: input.subject ?? id,
|
|
49688
|
+
severity: input.severity ?? "info",
|
|
49689
|
+
data: input.data ?? { test: true },
|
|
49690
|
+
message: input.message ?? "Hasna events test delivery",
|
|
49691
|
+
dedupeKey: input.dedupeKey,
|
|
49692
|
+
schemaVersion: input.schemaVersion,
|
|
49693
|
+
metadata: input.metadata,
|
|
49694
|
+
time: input.time,
|
|
49695
|
+
id: input.id
|
|
49696
|
+
});
|
|
49697
|
+
const eventForChannel = await this.applyRedaction(event, channel);
|
|
49698
|
+
const result = await this.deliverWithRetry(eventForChannel, channel);
|
|
49699
|
+
await this.store.appendDelivery(result);
|
|
49700
|
+
return result;
|
|
49701
|
+
}
|
|
49702
|
+
async replay(options = {}) {
|
|
49703
|
+
const events = (await this.store.listEvents()).filter((event) => {
|
|
49704
|
+
if (options.eventId && event.id !== options.eventId)
|
|
49705
|
+
return false;
|
|
49706
|
+
if (options.source && event.source !== options.source)
|
|
49707
|
+
return false;
|
|
49708
|
+
if (options.type && event.type !== options.type)
|
|
49709
|
+
return false;
|
|
49710
|
+
return true;
|
|
49711
|
+
});
|
|
49712
|
+
if (options.dryRun)
|
|
49713
|
+
return { events, deliveries: [] };
|
|
49714
|
+
const deliveries = [];
|
|
49715
|
+
for (const event of events) {
|
|
49716
|
+
deliveries.push(...await this.deliver(event));
|
|
49717
|
+
}
|
|
49718
|
+
return { events, deliveries };
|
|
49719
|
+
}
|
|
49720
|
+
async applyRedaction(event, channel) {
|
|
49721
|
+
let next = redactPaths(event, channel.redact?.paths ?? [], channel.redact?.replacement ?? "[REDACTED]");
|
|
49722
|
+
for (const redactor of this.redactors) {
|
|
49723
|
+
next = await redactor(next, channel);
|
|
49724
|
+
}
|
|
49725
|
+
return next;
|
|
49726
|
+
}
|
|
49727
|
+
async deliverWithRetry(event, channel) {
|
|
49728
|
+
const policy = normalizeRetryPolicy(channel.retry);
|
|
49729
|
+
const attempts = [];
|
|
49730
|
+
for (let index = 0;index < policy.maxAttempts; index += 1) {
|
|
49731
|
+
const attempt = await dispatchChannel(event, channel, this.transportOptions);
|
|
49732
|
+
attempt.attempt = index + 1;
|
|
49733
|
+
if (attempt.status === "failed" && index + 1 < policy.maxAttempts) {
|
|
49734
|
+
attempt.nextBackoffMs = Math.round(policy.backoffMs * policy.multiplier ** index);
|
|
49735
|
+
}
|
|
49736
|
+
attempts.push(attempt);
|
|
49737
|
+
if (attempt.status !== "failed")
|
|
49738
|
+
break;
|
|
49739
|
+
if (attempt.nextBackoffMs)
|
|
49740
|
+
await Bun.sleep(attempt.nextBackoffMs);
|
|
49741
|
+
}
|
|
49742
|
+
return createDeliveryResult(event, channel, attempts);
|
|
49743
|
+
}
|
|
49744
|
+
}
|
|
49745
|
+
function redactPaths(event, paths, replacement = "[REDACTED]") {
|
|
49746
|
+
if (paths.length === 0)
|
|
49747
|
+
return event;
|
|
49748
|
+
const copy = structuredClone(event);
|
|
49749
|
+
for (const path of paths) {
|
|
49750
|
+
setPath(copy, path, replacement);
|
|
49751
|
+
}
|
|
49752
|
+
return copy;
|
|
49753
|
+
}
|
|
49754
|
+
function sanitizeChannelForOutput(channel) {
|
|
49755
|
+
const copy = structuredClone(channel);
|
|
49756
|
+
if (copy.webhook?.secret)
|
|
49757
|
+
copy.webhook.secret = "[REDACTED]";
|
|
49758
|
+
if (copy.command?.env) {
|
|
49759
|
+
copy.command.env = Object.fromEntries(Object.entries(copy.command.env).map(([key, value]) => [key, shouldRedactKey(key) ? "[REDACTED]" : value]));
|
|
49760
|
+
}
|
|
49761
|
+
return copy;
|
|
49762
|
+
}
|
|
49763
|
+
function sanitizeChannelsForOutput(channels) {
|
|
49764
|
+
return channels.map(sanitizeChannelForOutput);
|
|
49765
|
+
}
|
|
49766
|
+
function redactSensitiveKeys(event, replacement = "[REDACTED]") {
|
|
49767
|
+
return redactValue(event, replacement);
|
|
49768
|
+
}
|
|
49769
|
+
function shouldRedactKey(key) {
|
|
49770
|
+
return /secret|token|password|api[_-]?key|authorization/i.test(key);
|
|
49771
|
+
}
|
|
49772
|
+
function redactValue(value, replacement) {
|
|
49773
|
+
if (Array.isArray(value))
|
|
49774
|
+
return value.map((item) => redactValue(item, replacement));
|
|
49775
|
+
if (!value || typeof value !== "object")
|
|
49776
|
+
return value;
|
|
49777
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
49778
|
+
key,
|
|
49779
|
+
shouldRedactKey(key) ? replacement : redactValue(item, replacement)
|
|
49780
|
+
]));
|
|
49781
|
+
}
|
|
49782
|
+
function setPath(input, path, replacement) {
|
|
49783
|
+
const parts = path.split(".");
|
|
49784
|
+
let cursor = input;
|
|
49785
|
+
for (const part of parts.slice(0, -1)) {
|
|
49786
|
+
const next = cursor[part];
|
|
49787
|
+
if (!next || typeof next !== "object")
|
|
49788
|
+
return;
|
|
49789
|
+
cursor = next;
|
|
49790
|
+
}
|
|
49791
|
+
const last = parts.at(-1);
|
|
49792
|
+
if (last && last in cursor)
|
|
49793
|
+
cursor[last] = replacement;
|
|
49794
|
+
}
|
|
49795
|
+
function normalizeTime(value) {
|
|
49796
|
+
if (!value)
|
|
49797
|
+
return new Date().toISOString();
|
|
49798
|
+
return value instanceof Date ? value.toISOString() : value;
|
|
49799
|
+
}
|
|
49800
|
+
function normalizeRetryPolicy(policy) {
|
|
49801
|
+
return {
|
|
49802
|
+
maxAttempts: Math.max(1, policy?.maxAttempts ?? 1),
|
|
49803
|
+
backoffMs: Math.max(0, policy?.backoffMs ?? 250),
|
|
49804
|
+
multiplier: Math.max(1, policy?.multiplier ?? 2)
|
|
49805
|
+
};
|
|
49806
|
+
}
|
|
49807
|
+
function parseJsonObject(value, fallback) {
|
|
49808
|
+
if (!value)
|
|
49809
|
+
return fallback;
|
|
49810
|
+
const parsed = JSON.parse(value);
|
|
49811
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
49812
|
+
throw new Error("Expected a JSON object");
|
|
49813
|
+
}
|
|
49814
|
+
return parsed;
|
|
49815
|
+
}
|
|
49816
|
+
function parseHeaders(values) {
|
|
49817
|
+
if (!values?.length)
|
|
49818
|
+
return;
|
|
49819
|
+
const headers = {};
|
|
49820
|
+
for (const value of values) {
|
|
49821
|
+
const separator = value.indexOf("=");
|
|
49822
|
+
if (separator === -1)
|
|
49823
|
+
throw new Error(`Invalid header, expected name=value: ${value}`);
|
|
49824
|
+
headers[value.slice(0, separator)] = value.slice(separator + 1);
|
|
49825
|
+
}
|
|
49826
|
+
return headers;
|
|
49827
|
+
}
|
|
49828
|
+
function parseFilter(options) {
|
|
49829
|
+
const filter2 = {};
|
|
49830
|
+
if (options.source)
|
|
49831
|
+
filter2.source = options.source;
|
|
49832
|
+
if (options.type)
|
|
49833
|
+
filter2.type = options.type;
|
|
49834
|
+
if (options.subject)
|
|
49835
|
+
filter2.subject = options.subject;
|
|
49836
|
+
if (options.severity)
|
|
49837
|
+
filter2.severity = options.severity;
|
|
49838
|
+
return Object.keys(filter2).length > 0 ? [filter2] : undefined;
|
|
49839
|
+
}
|
|
49840
|
+
function createClient(options) {
|
|
49841
|
+
if (options.createClient)
|
|
49842
|
+
return options.createClient();
|
|
49843
|
+
return new EventsClient({ store: new JsonEventsStore(options.dataDir) });
|
|
49844
|
+
}
|
|
49845
|
+
function print(value, json, text) {
|
|
49846
|
+
if (json)
|
|
49847
|
+
console.log(JSON.stringify(value, null, 2));
|
|
49848
|
+
else
|
|
49849
|
+
console.log(text);
|
|
49850
|
+
}
|
|
49851
|
+
function registerWebhookCommands(program2, options) {
|
|
49852
|
+
const webhooks = program2.command(options.webhooksCommandName ?? "webhooks").description("Manage Hasna event webhook subscriptions");
|
|
49853
|
+
webhooks.command("add").description("Add or replace a webhook or command subscription").argument("<target>", "Webhook URL or command binary").requiredOption("--id <id>", "Subscription/channel identifier").option("--transport <kind>", "Transport kind: webhook or command", "webhook").option("--name <name>", "Display name").option("--type <pattern>", "Event type filter, e.g. todos.task.*").option("--source <pattern>", "Event source filter").option("--subject <pattern>", "Event subject filter").option("--severity <pattern>", "Event severity filter").option("--secret <secret>", "Webhook HMAC secret").option("--header <name=value...>", "Webhook header", collectValues, []).option("--arg <arg...>", "Command argument", collectValues, []).option("--timeout-ms <ms>", "Transport timeout in milliseconds", parseNumber).option("--retry-attempts <n>", "Maximum delivery attempts", parseNumber).option("--retry-backoff-ms <ms>", "Initial retry backoff in milliseconds", parseNumber).option("--redact <path...>", "Event field path to redact before delivery", collectValues, []).option("--disabled", "Create channel disabled", false).option("-j, --json", "Print JSON output", false).action(async (target, actionOptions) => {
|
|
49854
|
+
const timestamp = new Date().toISOString();
|
|
49855
|
+
const channel = {
|
|
49856
|
+
id: actionOptions.id,
|
|
49857
|
+
name: actionOptions.name,
|
|
49858
|
+
enabled: !actionOptions.disabled,
|
|
49859
|
+
transport: actionOptions.transport,
|
|
49860
|
+
filters: parseFilter(actionOptions),
|
|
49861
|
+
retry: actionOptions.retryAttempts || actionOptions.retryBackoffMs ? { maxAttempts: actionOptions.retryAttempts, backoffMs: actionOptions.retryBackoffMs } : undefined,
|
|
49862
|
+
redact: actionOptions.redact?.length ? { paths: actionOptions.redact } : undefined,
|
|
49863
|
+
createdAt: timestamp,
|
|
49864
|
+
updatedAt: timestamp
|
|
49865
|
+
};
|
|
49866
|
+
if (actionOptions.transport === "webhook") {
|
|
49867
|
+
channel.webhook = { url: target, secret: actionOptions.secret, headers: parseHeaders(actionOptions.header), timeoutMs: actionOptions.timeoutMs };
|
|
49868
|
+
} else if (actionOptions.transport === "command") {
|
|
49869
|
+
channel.command = { command: target, args: actionOptions.arg ?? [], timeoutMs: actionOptions.timeoutMs };
|
|
49870
|
+
} else {
|
|
49871
|
+
throw new Error(`Transport ${actionOptions.transport} is reserved for future use and cannot be added yet`);
|
|
49872
|
+
}
|
|
49873
|
+
const saved = await createClient(options).addChannel(channel);
|
|
49874
|
+
print(sanitizeChannelForOutput(saved), Boolean(actionOptions.json), `Added ${saved.transport} channel ${saved.id}`);
|
|
49875
|
+
});
|
|
49876
|
+
webhooks.command("list").description("List configured subscriptions").option("-j, --json", "Print JSON output", false).action(async (actionOptions) => {
|
|
49877
|
+
const channels = await createClient(options).listChannels();
|
|
49878
|
+
if (actionOptions.json) {
|
|
49879
|
+
console.log(JSON.stringify(sanitizeChannelsForOutput(channels), null, 2));
|
|
49880
|
+
return;
|
|
49881
|
+
}
|
|
49882
|
+
if (!channels.length) {
|
|
49883
|
+
console.log("No channels configured.");
|
|
49884
|
+
return;
|
|
49885
|
+
}
|
|
49886
|
+
for (const channel of channels) {
|
|
49887
|
+
console.log(`${channel.id} ${channel.enabled ? "enabled" : "disabled"} ${channel.transport} ${channel.webhook?.url ?? channel.command?.command ?? channel.transport}`);
|
|
49888
|
+
}
|
|
49889
|
+
});
|
|
49890
|
+
webhooks.command("remove").description("Remove a subscription").argument("<id>", "Subscription/channel identifier").option("-j, --json", "Print JSON output", false).action(async (id, actionOptions) => {
|
|
49891
|
+
const removed = await createClient(options).removeChannel(id);
|
|
49892
|
+
print({ removed }, Boolean(actionOptions.json), removed ? `Removed ${id}` : `Channel not found: ${id}`);
|
|
49893
|
+
});
|
|
49894
|
+
webhooks.command("test").description("Send a test event to one subscription").argument("<id>", "Subscription/channel identifier").option("--type <type>", "Event type", "events.test").option("--subject <subject>", "Event subject").option("--message <message>", "Event message", "Hasna events test delivery").option("--data <json>", "Event data JSON object").option("-j, --json", "Print JSON output", false).action(async (id, actionOptions) => {
|
|
49895
|
+
const result = await createClient(options).testChannel(id, {
|
|
49896
|
+
source: options.source,
|
|
49897
|
+
type: actionOptions.type,
|
|
49898
|
+
subject: actionOptions.subject ?? id,
|
|
49899
|
+
message: actionOptions.message,
|
|
49900
|
+
data: parseJsonObject(actionOptions.data, { test: true })
|
|
49901
|
+
});
|
|
49902
|
+
print(result, Boolean(actionOptions.json), `${result.status}: ${result.channelId}`);
|
|
49903
|
+
});
|
|
49904
|
+
return webhooks;
|
|
49905
|
+
}
|
|
49906
|
+
function registerEventCommands(program2, options) {
|
|
49907
|
+
const events = program2.command(options.eventsCommandName ?? "events").description("Emit, list, and replay Hasna events");
|
|
49908
|
+
events.command("emit").description("Emit an event from this app").argument("<type>", "Event type").option("--source <source>", "Event source override").option("--subject <subject>", "Event subject").option("--severity <severity>", "Event severity", "info").option("--message <message>", "Event message").option("--dedupe-key <key>", "Dedupe key").option("--data <json>", "Event data JSON object").option("--metadata <json>", "Event metadata JSON object").option("--no-deliver", "Record without delivering").option("--no-dedupe", "Allow duplicate id/dedupeKey events").option("-j, --json", "Print JSON output", false).action(async (type, actionOptions) => {
|
|
49909
|
+
const result = await createClient(options).emit({
|
|
49910
|
+
source: actionOptions.source ?? options.source,
|
|
49911
|
+
type,
|
|
49912
|
+
subject: actionOptions.subject,
|
|
49913
|
+
severity: actionOptions.severity,
|
|
49914
|
+
message: actionOptions.message,
|
|
49915
|
+
dedupeKey: actionOptions.dedupeKey,
|
|
49916
|
+
data: parseJsonObject(actionOptions.data, {}),
|
|
49917
|
+
metadata: parseJsonObject(actionOptions.metadata, {})
|
|
49918
|
+
}, { deliver: actionOptions.deliver, dedupe: actionOptions.dedupe });
|
|
49919
|
+
print(result, Boolean(actionOptions.json), `${result.deduped ? "Deduped" : "Emitted"} ${result.event.id} to ${result.deliveries.length} channel(s)`);
|
|
49920
|
+
});
|
|
49921
|
+
events.command("list").description("List recorded events").option("--source <source>", "Filter by source").option("--type <type>", "Filter by type").option("--limit <n>", "Limit results", parseNumber).option("-j, --json", "Print JSON output", false).action(async (actionOptions) => {
|
|
49922
|
+
let rows = await createClient(options).listEvents();
|
|
49923
|
+
if (actionOptions.source)
|
|
49924
|
+
rows = rows.filter((event) => event.source === actionOptions.source);
|
|
49925
|
+
if (actionOptions.type)
|
|
49926
|
+
rows = rows.filter((event) => event.type === actionOptions.type);
|
|
49927
|
+
if (actionOptions.limit)
|
|
49928
|
+
rows = rows.slice(-actionOptions.limit);
|
|
49929
|
+
if (actionOptions.json) {
|
|
49930
|
+
console.log(JSON.stringify(rows, null, 2));
|
|
49931
|
+
return;
|
|
49932
|
+
}
|
|
49933
|
+
if (!rows.length) {
|
|
49934
|
+
console.log("No events recorded.");
|
|
49935
|
+
return;
|
|
49936
|
+
}
|
|
49937
|
+
for (const event of rows)
|
|
49938
|
+
console.log(`${event.time} ${event.id} ${event.source} ${event.type} ${event.severity}`);
|
|
49939
|
+
});
|
|
49940
|
+
events.command("replay").description("Replay recorded events").option("--id <id>", "Replay one event id").option("--source <source>", "Filter by source").option("--type <type>", "Filter by type").option("--dry-run", "Preview without delivery", false).option("-j, --json", "Print JSON output", false).action(async (actionOptions) => {
|
|
49941
|
+
const result = await createClient(options).replay({
|
|
49942
|
+
eventId: actionOptions.id,
|
|
49943
|
+
source: actionOptions.source,
|
|
49944
|
+
type: actionOptions.type,
|
|
49945
|
+
dryRun: actionOptions.dryRun
|
|
49946
|
+
});
|
|
49947
|
+
print(result, Boolean(actionOptions.json), `Replayed ${result.events.length} event(s), ${result.deliveries.length} delivery result(s)`);
|
|
49948
|
+
});
|
|
49949
|
+
return events;
|
|
49950
|
+
}
|
|
49951
|
+
function registerEventsCommands(program2, options) {
|
|
49952
|
+
registerWebhookCommands(program2, options);
|
|
49953
|
+
registerEventCommands(program2, options);
|
|
49954
|
+
}
|
|
49955
|
+
function parseNumber(value) {
|
|
49956
|
+
const parsed = Number(value);
|
|
49957
|
+
if (!Number.isFinite(parsed))
|
|
49958
|
+
throw new Error(`Expected a number, got ${value}`);
|
|
49959
|
+
return parsed;
|
|
49960
|
+
}
|
|
49961
|
+
function collectValues(value, previous) {
|
|
49962
|
+
previous.push(value);
|
|
49963
|
+
return previous;
|
|
49964
|
+
}
|
|
49965
|
+
|
|
49116
49966
|
// src/cli/index.tsx
|
|
49117
49967
|
init_package();
|
|
49118
49968
|
init_registry2();
|
|
@@ -51570,7 +52420,7 @@ var SENSITIVE_FIELDS = new Set([
|
|
|
51570
52420
|
"private_key",
|
|
51571
52421
|
"privatekey"
|
|
51572
52422
|
]);
|
|
51573
|
-
function
|
|
52423
|
+
function redactValue2(value) {
|
|
51574
52424
|
if (value.length <= 8)
|
|
51575
52425
|
return "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
51576
52426
|
return value.slice(0, 4) + "\u2022\u2022\u2022\u2022" + value.slice(-4);
|
|
@@ -51586,7 +52436,7 @@ function redactSecrets(obj) {
|
|
|
51586
52436
|
const result = {};
|
|
51587
52437
|
for (const [key, value] of Object.entries(obj)) {
|
|
51588
52438
|
if (SENSITIVE_FIELDS.has(key.toLowerCase()) && typeof value === "string") {
|
|
51589
|
-
result[key] =
|
|
52439
|
+
result[key] = redactValue2(value);
|
|
51590
52440
|
} else if (typeof value === "object" && value !== null) {
|
|
51591
52441
|
result[key] = redactSecrets(value);
|
|
51592
52442
|
} else {
|
|
@@ -51605,10 +52455,10 @@ function getOAuthTokenState(name) {
|
|
|
51605
52455
|
if (!tokens.expiresAt) {
|
|
51606
52456
|
return { hasTokens: true, expired: false };
|
|
51607
52457
|
}
|
|
51608
|
-
const
|
|
51609
|
-
const isExpired =
|
|
52458
|
+
const now4 = Date.now();
|
|
52459
|
+
const isExpired = now4 >= tokens.expiresAt - 60000;
|
|
51610
52460
|
const expiresIn = isExpired ? undefined : (() => {
|
|
51611
|
-
const ms = tokens.expiresAt -
|
|
52461
|
+
const ms = tokens.expiresAt - now4;
|
|
51612
52462
|
const mins = Math.floor(ms / 60000);
|
|
51613
52463
|
if (mins < 1)
|
|
51614
52464
|
return "less than a minute";
|
|
@@ -51762,9 +52612,9 @@ ${meta.displayName} \u2014 Auth Configuration
|
|
|
51762
52612
|
try {
|
|
51763
52613
|
if (!options.browser) {
|
|
51764
52614
|
console.log(chalk5.dim(`Starting OAuth server on port ${port}...`));
|
|
51765
|
-
const { spawn:
|
|
52615
|
+
const { spawn: spawn5 } = await import("child_process");
|
|
51766
52616
|
const scriptPath = process.argv[1];
|
|
51767
|
-
const serverProc =
|
|
52617
|
+
const serverProc = spawn5(process.execPath, [scriptPath, "serve", "--port", String(port)], {
|
|
51768
52618
|
detached: true,
|
|
51769
52619
|
stdio: "ignore"
|
|
51770
52620
|
});
|
|
@@ -53106,10 +53956,10 @@ Setting up ${meta.displayName}...
|
|
|
53106
53956
|
${chalk7.bold("Open this URL to authenticate:")}`);
|
|
53107
53957
|
console.log(` ${chalk7.cyan(oauthUrl)}
|
|
53108
53958
|
`);
|
|
53109
|
-
const { spawn:
|
|
53959
|
+
const { spawn: spawn5 } = await import("child_process");
|
|
53110
53960
|
const { getConnectorsHome: getConnectorsHome2 } = await Promise.resolve().then(() => (init_database(), exports_database));
|
|
53111
53961
|
const scriptPath = process.argv[1];
|
|
53112
|
-
const serverProc =
|
|
53962
|
+
const serverProc = spawn5(process.execPath, [scriptPath, "serve", "--port", String(port)], {
|
|
53113
53963
|
detached: true,
|
|
53114
53964
|
stdio: "ignore"
|
|
53115
53965
|
});
|
|
@@ -53651,4 +54501,5 @@ registerCommands5(program2);
|
|
|
53651
54501
|
registerCommands6(program2);
|
|
53652
54502
|
registerCommands7(program2);
|
|
53653
54503
|
registerCommands8(program2);
|
|
54504
|
+
registerEventsCommands(program2, { source: "connectors" });
|
|
53654
54505
|
program2.parse();
|