void 0.1.6 → 0.7.0
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/AGENT_PROMPT.md +15 -0
- package/README.md +62 -123
- package/dist/auth-BdsJ0Aff.d.mts +43 -0
- package/dist/auth-cmd-Dx8oPKZC.mjs +43 -0
- package/dist/auth-migrations-BAtAck2g.mjs +117 -0
- package/dist/better-auth-shared-C9_GHSkR.d.mts +71 -0
- package/dist/better-auth-shared-CdYmQGry.mjs +163 -0
- package/dist/cache-W82I8ihI.mjs +47 -0
- package/dist/cancel-deploy-BOBTqqh0.mjs +59 -0
- package/dist/cf-access-Dee5cXxL.mjs +22 -0
- package/dist/chunk-DJd-R1mw.mjs +34 -0
- package/dist/cli/cli.d.mts +1 -0
- package/dist/cli/cli.mjs +1807 -0
- package/dist/client-snXOjrp1.mjs +565 -0
- package/dist/collect-CjeZgz5D.mjs +55 -0
- package/dist/config-BIa9HwVX.mjs +573 -0
- package/dist/config-BzM9Dy7T.mjs +37 -0
- package/dist/config-CvHtTM0q.mjs +30 -0
- package/dist/create-project-BIA15W7z.mjs +90 -0
- package/dist/db-DsRoMcfN.mjs +895 -0
- package/dist/defer-DcxEsVH1.mjs +49 -0
- package/dist/delete-DAP6yDc7.mjs +64 -0
- package/dist/deploy-BPKblFx6.mjs +2424 -0
- package/dist/discover-B7FkXBLB.mjs +40 -0
- package/dist/dist-DUyXJLkq.mjs +2667 -0
- package/dist/dist-Dayj3gCK.mjs +1287 -0
- package/dist/domain-BGofcQ6I.mjs +79 -0
- package/dist/dotenv-DwO4ti0Z.mjs +173 -0
- package/dist/drizzle-NnudE_UN.mjs +232 -0
- package/dist/env-CyG3tvU0.mjs +301 -0
- package/dist/env-helpers-Dr9Y7RnE.d.mts +52 -0
- package/dist/env-raw-BDL4TvdN.mjs +32 -0
- package/dist/env-types-DknSA4SO.mjs +64 -0
- package/dist/env-validation-DJKjR_8q.mjs +163 -0
- package/dist/fetch-error-BQ8sZ5Nd.mjs +266 -0
- package/dist/fetch-error-CVZ5CGA-.d.mts +20 -0
- package/dist/gen-U0Ktr4Zd.mjs +761 -0
- package/dist/handler-B0ds0OHJ.d.mts +269 -0
- package/dist/head-P-egrtFE.d.mts +45 -0
- package/dist/headers-DCXc7mDs.mjs +279 -0
- package/dist/index.d.mts +32 -0
- package/dist/index.mjs +4695 -0
- package/dist/init-C7wS5iGP.mjs +2625 -0
- package/dist/link-p2R6NbgN.mjs +49 -0
- package/dist/list-Bfel-QLc.mjs +113 -0
- package/dist/log-DXdqnmhF.mjs +26 -0
- package/dist/login-CkcXUiIu.mjs +72 -0
- package/dist/logs-DmkrRvx6.mjs +98 -0
- package/dist/magic-string.es-D6g9UnIy.mjs +1011 -0
- package/dist/mcp-CaQzfeUi.mjs +373 -0
- package/dist/node-DDfXj10V.mjs +54 -0
- package/dist/output-BwlcIYSR.mjs +139 -0
- package/dist/pages/client.d.mts +198 -0
- package/dist/pages/client.mjs +980 -0
- package/dist/pages/head-client.d.mts +15 -0
- package/dist/pages/head-client.mjs +90 -0
- package/dist/pages/head.d.mts +2 -0
- package/dist/pages/head.mjs +112 -0
- package/dist/pages/index.d.mts +38 -0
- package/dist/pages/index.mjs +76 -0
- package/dist/pages/islands-plugin.d.mts +50 -0
- package/dist/pages/islands-plugin.mjs +195 -0
- package/dist/pages/prefetch.d.mts +31 -0
- package/dist/pages/prefetch.mjs +90 -0
- package/dist/pages/protocol.d.mts +3 -0
- package/dist/pages/protocol.mjs +193 -0
- package/dist/pages/serialize.d.mts +10 -0
- package/dist/pages/serialize.mjs +14 -0
- package/dist/pathe.M-eThtNZ-D-kmWkCS.mjs +150 -0
- package/dist/plugin-inference-oZ6Ybu2_.mjs +2447 -0
- package/dist/prepare-BAtWufvm.mjs +99 -0
- package/dist/preset-D4I73kT4.mjs +221 -0
- package/dist/project-TqORyHn8.mjs +72 -0
- package/dist/project-cmd-B7lQp3F3.mjs +67 -0
- package/dist/project-slug-CKam8lF9.mjs +11 -0
- package/dist/project-tsconfig-DfkESbDL.mjs +63 -0
- package/dist/protocol-BWzXs2A2.d.mts +34 -0
- package/dist/providers-B3aMxWzP.mjs +67 -0
- package/dist/resolve-project-Br5BR03U.mjs +29 -0
- package/dist/rollback-gyC59l7U.mjs +92 -0
- package/dist/route-types-DReF1gUY.mjs +255 -0
- package/dist/routes-stub.d.mts +55 -0
- package/dist/routes-stub.mjs +1 -0
- package/dist/runner-6Ep3fNQu.mjs +123 -0
- package/dist/runner-pg-D0wWHYnr.mjs +57 -0
- package/dist/runtime/ai.d.mts +127 -0
- package/dist/runtime/ai.mjs +348 -0
- package/dist/runtime/auth-client-react.d.mts +8 -0
- package/dist/runtime/auth-client-react.mjs +6 -0
- package/dist/runtime/auth-client-solid.d.mts +8 -0
- package/dist/runtime/auth-client-solid.mjs +6 -0
- package/dist/runtime/auth-client-svelte.d.mts +8 -0
- package/dist/runtime/auth-client-svelte.mjs +6 -0
- package/dist/runtime/auth-client-vue.d.mts +8 -0
- package/dist/runtime/auth-client-vue.mjs +6 -0
- package/dist/runtime/auth-client.d.mts +8 -0
- package/dist/runtime/auth-client.mjs +6 -0
- package/dist/runtime/auth.d.mts +2 -0
- package/dist/runtime/auth.mjs +22 -0
- package/dist/runtime/better-auth-pg.d.mts +11 -0
- package/dist/runtime/better-auth-pg.mjs +51 -0
- package/dist/runtime/better-auth.d.mts +11 -0
- package/dist/runtime/better-auth.mjs +33 -0
- package/dist/runtime/client.d.mts +6 -0
- package/dist/runtime/client.mjs +5 -0
- package/dist/runtime/db-pg.d.mts +2 -0
- package/dist/runtime/db-pg.mjs +1 -0
- package/dist/runtime/db.d.mts +17 -0
- package/dist/runtime/db.mjs +30 -0
- package/dist/runtime/drizzle-arktype.d.mts +1 -0
- package/dist/runtime/drizzle-arktype.mjs +2 -0
- package/dist/runtime/drizzle-valibot.d.mts +1 -0
- package/dist/runtime/drizzle-valibot.mjs +2 -0
- package/dist/runtime/drizzle-zod.d.mts +1 -0
- package/dist/runtime/drizzle-zod.mjs +2 -0
- package/dist/runtime/env-helpers.d.mts +2 -0
- package/dist/runtime/env-helpers.mjs +173 -0
- package/dist/runtime/env-public-client.d.mts +22 -0
- package/dist/runtime/env-public-client.mjs +54 -0
- package/dist/runtime/env-public.d.mts +143 -0
- package/dist/runtime/env-public.mjs +366 -0
- package/dist/runtime/env.d.mts +13 -0
- package/dist/runtime/env.mjs +51 -0
- package/dist/runtime/fetch-stream.d.mts +51 -0
- package/dist/runtime/fetch-stream.mjs +81 -0
- package/dist/runtime/fetch.d.mts +59 -0
- package/dist/runtime/fetch.mjs +18 -0
- package/dist/runtime/handler.d.mts +3 -0
- package/dist/runtime/handler.mjs +85 -0
- package/dist/runtime/isr.d.mts +26 -0
- package/dist/runtime/isr.mjs +43 -0
- package/dist/runtime/kv.d.mts +48 -0
- package/dist/runtime/kv.mjs +106 -0
- package/dist/runtime/log.d.mts +24 -0
- package/dist/runtime/log.mjs +31 -0
- package/dist/runtime/migration-handler-pg.d.mts +6 -0
- package/dist/runtime/migration-handler-pg.mjs +85 -0
- package/dist/runtime/migration-handler.d.mts +19 -0
- package/dist/runtime/migration-handler.mjs +92 -0
- package/dist/runtime/queues.d.mts +7 -0
- package/dist/runtime/queues.mjs +8 -0
- package/dist/runtime/remote/binding-handler.d.mts +15 -0
- package/dist/runtime/remote/binding-handler.mjs +208 -0
- package/dist/runtime/remote/index.d.mts +8 -0
- package/dist/runtime/remote/index.mjs +461 -0
- package/dist/runtime/response.d.mts +14 -0
- package/dist/runtime/response.mjs +30 -0
- package/dist/runtime/sandbox.d.mts +17 -0
- package/dist/runtime/sandbox.mjs +19 -0
- package/dist/runtime/schema-d1.d.mts +1 -0
- package/dist/runtime/schema-d1.mjs +2 -0
- package/dist/runtime/schema-pg.d.mts +1 -0
- package/dist/runtime/schema-pg.mjs +2 -0
- package/dist/runtime/seed.d.mts +30 -0
- package/dist/runtime/seed.mjs +6 -0
- package/dist/runtime/storage.d.mts +7 -0
- package/dist/runtime/storage.mjs +14 -0
- package/dist/runtime/validator.d.mts +2 -0
- package/dist/runtime/validator.mjs +72 -0
- package/dist/runtime/ws-server.d.mts +26 -0
- package/dist/runtime/ws-server.mjs +296 -0
- package/dist/runtime/ws.d.mts +123 -0
- package/dist/runtime/ws.mjs +103 -0
- package/dist/scan-Ba4hFwlH.mjs +324 -0
- package/dist/scan-C6HMEIdW.mjs +318 -0
- package/dist/secret-CeRSukgM.mjs +109 -0
- package/dist/skills-ipldjlKE.mjs +62 -0
- package/dist/standard-schema-9CRjx-uR.d.mts +42 -0
- package/dist/subcommand-prompt-BKjuNAPb.mjs +349 -0
- package/dist/sveltekit.d.mts +20 -0
- package/dist/sveltekit.mjs +61 -0
- package/dist/types-mHOEwpW4.d.mts +57 -0
- package/dist/validate-CaMavMxu.mjs +146 -0
- package/dist/yarn-pnp-BFqMV_bl.mjs +196 -0
- package/getting-started-prompt.txt +26 -0
- package/package.json +322 -30
- package/schema.json +364 -0
- package/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
- package/skills/void/SKILL.md +75 -0
- package/skills/void/command/void.md +7 -0
- package/skills/void/docs/guide/ai.md +235 -0
- package/skills/void/docs/guide/app-types.md +103 -0
- package/skills/void/docs/guide/auth.md +257 -0
- package/skills/void/docs/guide/database/d1.md +106 -0
- package/skills/void/docs/guide/database/postgresql.md +106 -0
- package/skills/void/docs/guide/database.md +418 -0
- package/skills/void/docs/guide/deployment.md +98 -0
- package/skills/void/docs/guide/edge/headers.md +79 -0
- package/skills/void/docs/guide/edge/prerendering.md +83 -0
- package/skills/void/docs/guide/edge/redirects.md +116 -0
- package/skills/void/docs/guide/edge/revalidation.md +131 -0
- package/skills/void/docs/guide/edge/rewrites.md +354 -0
- package/skills/void/docs/guide/edge/static-assets.md +72 -0
- package/skills/void/docs/guide/env-vars.md +298 -0
- package/skills/void/docs/guide/index.md +80 -0
- package/skills/void/docs/guide/jobs.md +91 -0
- package/skills/void/docs/guide/kv.md +107 -0
- package/skills/void/docs/guide/pages-routing/actions-and-forms.md +419 -0
- package/skills/void/docs/guide/pages-routing/head.md +130 -0
- package/skills/void/docs/guide/pages-routing/islands.md +405 -0
- package/skills/void/docs/guide/pages-routing/layouts.md +362 -0
- package/skills/void/docs/guide/pages-routing/loaders.md +267 -0
- package/skills/void/docs/guide/pages-routing/markdown.md +625 -0
- package/skills/void/docs/guide/pages-routing/overview.md +236 -0
- package/skills/void/docs/guide/pages-routing/view-transitions.md +140 -0
- package/skills/void/docs/guide/queues.md +140 -0
- package/skills/void/docs/guide/quickstart.md +233 -0
- package/skills/void/docs/guide/remote-dev.md +67 -0
- package/skills/void/docs/guide/sandboxes.md +82 -0
- package/skills/void/docs/guide/server-routing.md +246 -0
- package/skills/void/docs/guide/ssg.md +74 -0
- package/skills/void/docs/guide/ssr.md +105 -0
- package/skills/void/docs/guide/storage.md +67 -0
- package/skills/void/docs/guide/type-safety.md +179 -0
- package/skills/void/docs/guide/typed-fetch.md +113 -0
- package/skills/void/docs/guide/websockets.md +190 -0
- package/skills/void/docs/index.md +48 -0
- package/skills/void/docs/integrations/agents.md +84 -0
- package/skills/void/docs/integrations/cloudflare.md +284 -0
- package/skills/void/docs/integrations/frameworks/analog.md +182 -0
- package/skills/void/docs/integrations/frameworks/astro.md +197 -0
- package/skills/void/docs/integrations/frameworks/nuxt.md +164 -0
- package/skills/void/docs/integrations/frameworks/overview.md +136 -0
- package/skills/void/docs/integrations/frameworks/react-router.md +137 -0
- package/skills/void/docs/integrations/frameworks/sveltekit.md +191 -0
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +140 -0
- package/skills/void/docs/integrations/hono.md +97 -0
- package/skills/void/docs/integrations/nodejs-bun-deno.md +210 -0
- package/skills/void/docs/node_modules/@iconify/vue/README.md +408 -0
- package/skills/void/docs/node_modules/@iconify/vue/offline/readme.md +5 -0
- package/skills/void/docs/node_modules/@voidzero-dev/vitepress-theme/README.md +103 -0
- package/skills/void/docs/node_modules/oxc-minify/README.md +78 -0
- package/skills/void/docs/node_modules/reka-ui/README.md +80 -0
- package/skills/void/docs/node_modules/vitepress/README.md +28 -0
- package/skills/void/docs/node_modules/vitepress/template/api-examples.md +49 -0
- package/skills/void/docs/node_modules/vitepress/template/index.md +28 -0
- package/skills/void/docs/node_modules/vitepress/template/markdown-examples.md +85 -0
- package/skills/void/docs/node_modules/vitepress-plugin-group-icons/README.md +101 -0
- package/skills/void/docs/node_modules/void/AGENTS.md +204 -0
- package/skills/void/docs/node_modules/void/AGENT_PROMPT.md +15 -0
- package/skills/void/docs/node_modules/void/README.md +89 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +591 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +375 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +174 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/vite-plugin/README.md +37 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/workers-types/README.md +135 -0
- package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +189 -0
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/CHANGELOG.md +143 -0
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/README.md +1272 -0
- package/skills/void/docs/node_modules/void/node_modules/@napi-rs/keyring/README.md +19 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/better-sqlite3/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/pg/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/README.md +22 -0
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/vendor/vscode-jsonrpc/README.md +69 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/README.md +152 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/engine-javascript/README.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/transformers/README.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/CHANGELOG.md +24 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/README.md +565 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +124 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-anchor/README.md +600 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-attrs/README.md +386 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-container/README.md +95 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-emoji/README.md +101 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/pathe/README.md +73 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/shiki/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +25 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tsdown/README.md +55 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/LICENSE.md +2230 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/README.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vue/README.md +58 -0
- package/skills/void/docs/node_modules/void/node_modules/arktype/README.md +165 -0
- package/skills/void/docs/node_modules/void/node_modules/better-auth/LICENSE.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/better-auth/README.md +32 -0
- package/skills/void/docs/node_modules/void/node_modules/better-sqlite3/README.md +99 -0
- package/skills/void/docs/node_modules/void/node_modules/blake3-jit/README.md +108 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-arktype/README.md +51 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-kit/README.md +79 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-orm/README.md +44 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-valibot/README.md +51 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-zod/README.md +65 -0
- package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +390 -0
- package/skills/void/docs/node_modules/void/node_modules/estree-walker/README.md +48 -0
- package/skills/void/docs/node_modules/void/node_modules/hono/README.md +85 -0
- package/skills/void/docs/node_modules/void/node_modules/ignore/README.md +452 -0
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/CHANGELOG.md +76 -0
- package/{LICENSE → skills/void/docs/node_modules/void/node_modules/jsonc-parser/LICENSE.md} +21 -21
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/README.md +364 -0
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/SECURITY.md +41 -0
- package/skills/void/docs/node_modules/void/node_modules/magic-string/README.md +325 -0
- package/skills/void/docs/node_modules/void/node_modules/ofetch/README.md +398 -0
- package/skills/void/docs/node_modules/void/node_modules/pathe/README.md +73 -0
- package/skills/void/docs/node_modules/void/node_modules/pg/README.md +95 -0
- package/skills/void/docs/node_modules/void/node_modules/pglite-server/LICENSE.md +21 -0
- package/skills/void/docs/node_modules/void/node_modules/pglite-server/README.md +135 -0
- package/skills/void/docs/node_modules/void/node_modules/picocolors/README.md +21 -0
- package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +25 -0
- package/skills/void/docs/node_modules/void/node_modules/tsdown/README.md +55 -0
- package/skills/void/docs/node_modules/void/node_modules/valibot/LICENSE.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/valibot/README.md +94 -0
- package/skills/void/docs/node_modules/void/node_modules/vite/LICENSE.md +2230 -0
- package/skills/void/docs/node_modules/void/node_modules/vite/README.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/wrangler/README.md +63 -0
- package/skills/void/docs/node_modules/void/node_modules/zod/README.md +191 -0
- package/skills/void/docs/node_modules/void/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
- package/skills/void/docs/node_modules/void/skills/void/SKILL.md +75 -0
- package/skills/void/docs/node_modules/void/skills/void/command/void.md +7 -0
- package/skills/void/docs/reference/api.md +917 -0
- package/skills/void/docs/reference/cli.md +561 -0
- package/skills/void/docs/reference/config.md +408 -0
- package/skills/void/docs/reference/resource-inference.md +149 -0
- package/skills/void/docs/reference/structure.md +176 -0
- package/.npmignore +0 -29
- package/.travis.yml +0 -9
- package/favicon.ico +0 -0
- package/index.js +0 -14
- package/lib/Job.js +0 -150
- package/lib/Void.js +0 -99
- package/lib/scan.js +0 -19
- package/test/credentials.js +0 -20
- package/test/job.js +0 -64
- package/test/static/dir1/test6.html +0 -0
- package/test/static/dir2/test7.html +0 -0
- package/test/static/dir2/test8.html +0 -0
- package/test/static/dir2/test9.html +0 -0
- package/test/static/test1.html +0 -0
- package/test/static/test2.html +0 -0
- package/test/static/test3.html +0 -0
- package/test/void.js +0 -31
- /package/{test/static/dir1/test4.html → skills/void/docs/integrations/auth-providers.md} +0 -0
- /package/{test/static/dir1/test5.html → skills/void/docs/integrations/payment-processors.md} +0 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
# ofetch
|
|
2
|
+
|
|
3
|
+
<!-- automd:badges -->
|
|
4
|
+
|
|
5
|
+
[](https://npmjs.com/package/ofetch)
|
|
6
|
+
[](https://npm.chart.dev/ofetch)
|
|
7
|
+
|
|
8
|
+
<!-- /automd -->
|
|
9
|
+
|
|
10
|
+
A better fetch API. Works on node, browser, and workers.
|
|
11
|
+
|
|
12
|
+
> [!IMPORTANT]
|
|
13
|
+
> You are on v2 (alpha) development branch. See [v1](https://github.com/unjs/ofetch/tree/v1) for v1 docs.
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary>Spoiler</summary>
|
|
17
|
+
<img src="https://media.giphy.com/media/Dn1QRA9hqMcoMz9zVZ/giphy.gif">
|
|
18
|
+
</details>
|
|
19
|
+
|
|
20
|
+
## 🚀 Quick Start
|
|
21
|
+
|
|
22
|
+
Install:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx nypm i ofetch
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Import:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import { ofetch } from "ofetch";
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## ✔️ Parsing Response
|
|
35
|
+
|
|
36
|
+
`ofetch` smartly parse JSON responses.
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const { users } = await ofetch("/api/users");
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For binary content types, `ofetch` will instead return a `Blob` object.
|
|
43
|
+
|
|
44
|
+
You can optionally provide a different parser than `JSON.parse`, or specify `blob`, `arrayBuffer`, `text` or `stream` to force parsing the body with the respective `FetchResponse` method.
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
// Return text as is
|
|
48
|
+
await ofetch("/movie?lang=en", { parseResponse: (txt) => txt });
|
|
49
|
+
|
|
50
|
+
// Get the blob version of the response
|
|
51
|
+
await ofetch("/api/generate-image", { responseType: "blob" });
|
|
52
|
+
|
|
53
|
+
// Get the stream version of the response
|
|
54
|
+
await ofetch("/api/generate-image", { responseType: "stream" });
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## ✔️ JSON Body
|
|
58
|
+
|
|
59
|
+
If an object or a class with a `.toJSON()` method is passed to the `body` option, `ofetch` automatically stringifies it.
|
|
60
|
+
|
|
61
|
+
`ofetch` utilizes `JSON.stringify()` to convert the passed object. Classes without a `.toJSON()` method have to be converted into a string value in advance before being passed to the `body` option.
|
|
62
|
+
|
|
63
|
+
For `PUT`, `PATCH`, and `POST` request methods, when a string or object body is set, `ofetch` adds the default `"content-type": "application/json"` and `accept: "application/json"` headers (which you can always override).
|
|
64
|
+
|
|
65
|
+
Additionally, `ofetch` supports binary responses with `Buffer`, `ReadableStream`, `Stream`, and [compatible body types](https://developer.mozilla.org/en-US/docs/Web/API/fetch#body). `ofetch` will automatically set the `duplex: "half"` option for streaming support!
|
|
66
|
+
|
|
67
|
+
**Example:**
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
const { users } = await ofetch("/api/users", {
|
|
71
|
+
method: "POST",
|
|
72
|
+
body: { some: "json" },
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## ✔️ Handling Errors
|
|
77
|
+
|
|
78
|
+
`ofetch` Automatically throws errors when `response.ok` is `false` with a friendly error message and compact stack (hiding internals).
|
|
79
|
+
|
|
80
|
+
A parsed error body is available with `error.data`. You may also use `FetchError` type.
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
await ofetch("https://google.com/404");
|
|
84
|
+
// FetchError: [GET] "https://google/404": 404 Not Found
|
|
85
|
+
// at async main (/project/playground.ts:4:3)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
To catch error response:
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
await ofetch("/url").catch((error) => error.data);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
To bypass status error catching you can set `ignoreResponseError` option:
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
await ofetch("/url", { ignoreResponseError: true });
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## ✔️ Auto Retry
|
|
101
|
+
|
|
102
|
+
`ofetch` Automatically retries the request if an error happens and if the response status code is included in `retryStatusCodes` list:
|
|
103
|
+
|
|
104
|
+
**Retry status codes:**
|
|
105
|
+
|
|
106
|
+
- `408` - Request Timeout
|
|
107
|
+
- `409` - Conflict
|
|
108
|
+
- `425` - Too Early ([Experimental](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Early-Data))
|
|
109
|
+
- `429` - Too Many Requests
|
|
110
|
+
- `500` - Internal Server Error
|
|
111
|
+
- `502` - Bad Gateway
|
|
112
|
+
- `503` - Service Unavailable
|
|
113
|
+
- `504` - Gateway Timeout
|
|
114
|
+
|
|
115
|
+
You can specify the amount of retry and delay between them using `retry` and `retryDelay` options and also pass a custom array of codes using `retryStatusCodes` option.
|
|
116
|
+
|
|
117
|
+
The default for `retry` is `1` retry, except for `POST`, `PUT`, `PATCH`, and `DELETE` methods where `ofetch` does not retry by default to avoid introducing side effects. If you set a custom value for `retry` it will **always retry** for all requests.
|
|
118
|
+
|
|
119
|
+
The default for `retryDelay` is `0` ms.
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
await ofetch("http://google.com/404", {
|
|
123
|
+
retry: 3,
|
|
124
|
+
retryDelay: 500, // ms
|
|
125
|
+
retryStatusCodes: [404, 500], // response status codes to retry
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## ✔️ Timeout
|
|
130
|
+
|
|
131
|
+
You can specify `timeout` in milliseconds to automatically abort a request after a timeout (default is disabled).
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
await ofetch("http://google.com/404", {
|
|
135
|
+
timeout: 3000, // Timeout after 3 seconds
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## ✔️ Type Friendly
|
|
140
|
+
|
|
141
|
+
The response can be type assisted:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
const article = await ofetch<Article>(`/api/article/${id}`);
|
|
145
|
+
// Auto complete working with article.id
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## ✔️ Adding `baseURL`
|
|
149
|
+
|
|
150
|
+
By using `baseURL` option, `ofetch` prepends it for trailing/leading slashes and query search params for baseURL using [ufo](https://github.com/unjs/ufo):
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
await ofetch("/config", { baseURL });
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## ✔️ Adding Query Search Params
|
|
157
|
+
|
|
158
|
+
By using `query` option (or `params` as alias), `ofetch` adds query search params to the URL by preserving the query in the request itself using [ufo](https://github.com/unjs/ufo):
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
await ofetch("/movie?lang=en", { query: { id: 123 } });
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## ✔️ Interceptors
|
|
165
|
+
|
|
166
|
+
Providing async interceptors to hook into lifecycle events of `ofetch` call is possible.
|
|
167
|
+
|
|
168
|
+
You might want to use `ofetch.create` to set shared interceptors.
|
|
169
|
+
|
|
170
|
+
### `onRequest({ request, options })`
|
|
171
|
+
|
|
172
|
+
`onRequest` is called as soon as `ofetch` is called, allowing you to modify options or do simple logging.
|
|
173
|
+
|
|
174
|
+
```js
|
|
175
|
+
await ofetch("/api", {
|
|
176
|
+
async onRequest({ request, options }) {
|
|
177
|
+
// Log request
|
|
178
|
+
console.log("[fetch request]", request, options);
|
|
179
|
+
|
|
180
|
+
// Add `?t=1640125211170` to query search params
|
|
181
|
+
options.query = options.query || {};
|
|
182
|
+
options.query.t = new Date();
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### `onRequestError({ request, options, error })`
|
|
188
|
+
|
|
189
|
+
`onRequestError` will be called when the fetch request fails.
|
|
190
|
+
|
|
191
|
+
```js
|
|
192
|
+
await ofetch("/api", {
|
|
193
|
+
async onRequestError({ request, options, error }) {
|
|
194
|
+
// Log error
|
|
195
|
+
console.log("[fetch request error]", request, error);
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### `onResponse({ request, options, response })`
|
|
201
|
+
|
|
202
|
+
`onResponse` will be called after `fetch` call and parsing body.
|
|
203
|
+
|
|
204
|
+
```js
|
|
205
|
+
await ofetch("/api", {
|
|
206
|
+
async onResponse({ request, response, options }) {
|
|
207
|
+
// Log response
|
|
208
|
+
console.log("[fetch response]", request, response.status, response.body);
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### `onResponseError({ request, options, response })`
|
|
214
|
+
|
|
215
|
+
`onResponseError` is the same as `onResponse` but will be called when fetch happens but `response.ok` is not `true`.
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
await ofetch("/api", {
|
|
219
|
+
async onResponseError({ request, response, options }) {
|
|
220
|
+
// Log error
|
|
221
|
+
console.log(
|
|
222
|
+
"[fetch response error]",
|
|
223
|
+
request,
|
|
224
|
+
response.status,
|
|
225
|
+
response.body
|
|
226
|
+
);
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Passing array of interceptors
|
|
232
|
+
|
|
233
|
+
If necessary, it's also possible to pass an array of function that will be called sequentially.
|
|
234
|
+
|
|
235
|
+
```js
|
|
236
|
+
await ofetch("/api", {
|
|
237
|
+
onRequest: [
|
|
238
|
+
() => {
|
|
239
|
+
/* Do something */
|
|
240
|
+
},
|
|
241
|
+
() => {
|
|
242
|
+
/* Do something else */
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## ✔️ Create fetch with default options
|
|
249
|
+
|
|
250
|
+
This utility is useful if you need to use common options across several fetch calls.
|
|
251
|
+
|
|
252
|
+
**Note:** Defaults will be cloned at one level and inherited. Be careful about nested options like `headers`.
|
|
253
|
+
|
|
254
|
+
```js
|
|
255
|
+
const apiFetch = ofetch.create({ baseURL: "/api" });
|
|
256
|
+
|
|
257
|
+
apiFetch("/test"); // Same as ofetch('/test', { baseURL: '/api' })
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## 💡 Adding headers
|
|
261
|
+
|
|
262
|
+
By using `headers` option, `ofetch` adds extra headers in addition to the request default headers:
|
|
263
|
+
|
|
264
|
+
```js
|
|
265
|
+
await ofetch("/movies", {
|
|
266
|
+
headers: {
|
|
267
|
+
Accept: "application/json",
|
|
268
|
+
"Cache-Control": "no-cache",
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## 🍣 Access to Raw Response
|
|
274
|
+
|
|
275
|
+
If you need to access raw response (for headers, etc), you can use `ofetch.raw`:
|
|
276
|
+
|
|
277
|
+
```js
|
|
278
|
+
const response = await ofetch.raw("/sushi");
|
|
279
|
+
|
|
280
|
+
// response._data
|
|
281
|
+
// response.headers
|
|
282
|
+
// ...
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## 🌿 Using Native Fetch
|
|
286
|
+
|
|
287
|
+
As a shortcut, you can use `ofetch.native` that provides native `fetch` API
|
|
288
|
+
|
|
289
|
+
```js
|
|
290
|
+
const json = await ofetch.native("/sushi").then((r) => r.json());
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## 📡 SSE
|
|
294
|
+
|
|
295
|
+
**Example:** Handle SSE response:
|
|
296
|
+
|
|
297
|
+
```js
|
|
298
|
+
const stream = await ofetch("/sse");
|
|
299
|
+
const reader = stream.getReader();
|
|
300
|
+
const decoder = new TextDecoder();
|
|
301
|
+
while (true) {
|
|
302
|
+
const { done, value } = await reader.read();
|
|
303
|
+
if (done) break;
|
|
304
|
+
// Here is the chunked text of the SSE response.
|
|
305
|
+
const text = decoder.decode(value);
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## 🕵️ Adding HTTP(S) Agent
|
|
310
|
+
|
|
311
|
+
In Node.js (>= 18) environments, you can provide a custom dispatcher to intercept requests and support features such as Proxy and self-signed certificates. This feature is enabled by [undici](https://undici.nodejs.org/) built-in Node.js. [read more](https://undici.nodejs.org/#/docs/api/Dispatcher) about the Dispatcher API.
|
|
312
|
+
|
|
313
|
+
Some available agents:
|
|
314
|
+
|
|
315
|
+
- `ProxyAgent`: A Proxy Agent class that implements the Agent API. It allows the connection through a proxy in a simple way. ([docs](https://undici.nodejs.org/#/docs/api/ProxyAgent))
|
|
316
|
+
- `MockAgent`: A mocked Agent class that implements the Agent API. It allows one to intercept HTTP requests made through undici and return mocked responses instead. ([docs](https://undici.nodejs.org/#/docs/api/MockAgent))
|
|
317
|
+
- `Agent`: Agent allows dispatching requests against multiple different origins. ([docs](https://undici.nodejs.org/#/docs/api/Agent))
|
|
318
|
+
|
|
319
|
+
**Example:** Set a proxy agent for one request:
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
import { ProxyAgent } from "undici";
|
|
323
|
+
import { ofetch } from "ofetch";
|
|
324
|
+
|
|
325
|
+
const proxyAgent = new ProxyAgent("http://localhost:3128");
|
|
326
|
+
const data = await ofetch("https://icanhazip.com", { dispatcher: proxyAgent });
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
**Example:** Create a custom fetch instance that has proxy enabled:
|
|
330
|
+
|
|
331
|
+
```ts
|
|
332
|
+
import { ProxyAgent, setGlobalDispatcher } from "undici";
|
|
333
|
+
import { ofetch } from "ofetch";
|
|
334
|
+
|
|
335
|
+
const proxyAgent = new ProxyAgent("http://localhost:3128");
|
|
336
|
+
const fetchWithProxy = ofetch.create({ dispatcher: proxyAgent });
|
|
337
|
+
|
|
338
|
+
const data = await fetchWithProxy("https://icanhazip.com");
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Example:** Set a proxy agent for all requests:
|
|
342
|
+
|
|
343
|
+
```ts
|
|
344
|
+
import { ProxyAgent, setGlobalDispatcher } from "undici";
|
|
345
|
+
import { ofetch } from "ofetch";
|
|
346
|
+
|
|
347
|
+
const proxyAgent = new ProxyAgent("http://localhost:3128");
|
|
348
|
+
setGlobalDispatcher(proxyAgent);
|
|
349
|
+
|
|
350
|
+
const data = await ofetch("https://icanhazip.com");
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**Example:** Allow self-signed certificates (USE AT YOUR OWN RISK!)
|
|
354
|
+
|
|
355
|
+
```ts
|
|
356
|
+
import { Agent } from "undici";
|
|
357
|
+
import { ofetch } from "ofetch";
|
|
358
|
+
|
|
359
|
+
// Note: This makes fetch unsecure against MITM attacks. USE AT YOUR OWN RISK!
|
|
360
|
+
const unsecureAgent = new Agent({ connect: { rejectUnauthorized: false } });
|
|
361
|
+
const unsecureFetch = ofetch.create({ dispatcher: unsecureAgent });
|
|
362
|
+
|
|
363
|
+
const data = await unsecureFetch("https://www.squid-cache.org/");
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### 💪 Augment `FetchOptions` interface
|
|
367
|
+
|
|
368
|
+
You can augment the `FetchOptions` interface to add custom properties.
|
|
369
|
+
|
|
370
|
+
```ts
|
|
371
|
+
// Place this in any `.ts` or `.d.ts` file.
|
|
372
|
+
// Ensure it's included in the project's tsconfig.json "files".
|
|
373
|
+
declare module "ofetch" {
|
|
374
|
+
interface FetchOptions {
|
|
375
|
+
// Custom properties
|
|
376
|
+
requiresAuth?: boolean;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export {};
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
This lets you pass and use those properties with full type safety throughout `ofetch` calls.
|
|
384
|
+
|
|
385
|
+
```ts
|
|
386
|
+
const myFetch = ofetch.create({
|
|
387
|
+
onRequest(context) {
|
|
388
|
+
// ^? { ..., options: {..., requiresAuth?: boolean }}
|
|
389
|
+
console.log(context.options.requiresAuth);
|
|
390
|
+
},
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
myFetch("/foo", { requiresAuth: true });
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## License
|
|
397
|
+
|
|
398
|
+
💛 Published under the [MIT](https://github.com/h3js/rou3/blob/main/LICENSE) license.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# 🛣️ pathe
|
|
2
|
+
|
|
3
|
+
> Universal filesystem path utils
|
|
4
|
+
|
|
5
|
+
[![version][npm-v-src]][npm-v-href]
|
|
6
|
+
[![downloads][npm-d-src]][npm-d-href]
|
|
7
|
+
[![size][size-src]][size-href]
|
|
8
|
+
|
|
9
|
+
## ❓ Why
|
|
10
|
+
|
|
11
|
+
For [historical reasons](https://docs.microsoft.com/en-us/archive/blogs/larryosterman/why-is-the-dos-path-character), windows followed MS-DOS and used backslash for separating paths rather than slash used for macOS, Linux, and other Posix operating systems. Nowadays, [Windows](https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN) supports both Slash and Backslash for paths. [Node.js's built-in `path` module](https://nodejs.org/api/path.html) in the default operation of the path module varies based on the operating system on which a Node.js application is running. Specifically, when running on a Windows operating system, the path module will assume that Windows-style paths are being used. **This makes inconsistent code behavior between Windows and POSIX.**
|
|
12
|
+
|
|
13
|
+
Compared to popular [upath](https://github.com/anodynos/upath), pathe provides **identical exports** of Node.js with normalization on **all operations** and is written in modern **ESM/TypeScript** and has **no dependency on Node.js**!
|
|
14
|
+
|
|
15
|
+
This package is a drop-in replacement of the Node.js's [path module](https://nodejs.org/api/path.html) module and ensures paths are normalized with slash `/` and work in environments including Node.js.
|
|
16
|
+
|
|
17
|
+
## 💿 Usage
|
|
18
|
+
|
|
19
|
+
Install using npm or yarn:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# npm
|
|
23
|
+
npm i pathe
|
|
24
|
+
|
|
25
|
+
# yarn
|
|
26
|
+
yarn add pathe
|
|
27
|
+
|
|
28
|
+
# pnpm
|
|
29
|
+
pnpm i pathe
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Import:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
// ESM / Typescript
|
|
36
|
+
import { resolve, matchesGlob } from "pathe";
|
|
37
|
+
|
|
38
|
+
// CommonJS
|
|
39
|
+
const { resolve, matchesGlob } = require("pathe");
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Read more about path utils from [Node.js documentation](https://nodejs.org/api/path.html) and rest assured behavior is consistently like POSIX regardless of your input paths format and running platform (the only exception is `delimiter` constant export, it will be set to `;` on windows platform).
|
|
43
|
+
|
|
44
|
+
### Extra utilities
|
|
45
|
+
|
|
46
|
+
Pathe exports some extra utilities that do not exist in standard Node.js [path module](https://nodejs.org/api/path.html).
|
|
47
|
+
In order to use them, you can import from `pathe/utils` subpath:
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
import {
|
|
51
|
+
filename,
|
|
52
|
+
normalizeAliases,
|
|
53
|
+
resolveAlias,
|
|
54
|
+
reverseResolveAlias,
|
|
55
|
+
} from "pathe/utils";
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
Made with 💛 Published under the [MIT](./LICENSE) license.
|
|
61
|
+
|
|
62
|
+
Some code was used from the Node.js project. Glob supported is powered by [zeptomatch](https://github.com/fabiospampinato/zeptomatch).
|
|
63
|
+
|
|
64
|
+
<!-- Refs -->
|
|
65
|
+
|
|
66
|
+
[npm-v-src]: https://img.shields.io/npm/v/pathe?style=flat-square
|
|
67
|
+
[npm-v-href]: https://npmjs.com/package/pathe
|
|
68
|
+
[npm-d-src]: https://img.shields.io/npm/dm/pathe?style=flat-square
|
|
69
|
+
[npm-d-href]: https://npmjs.com/package/pathe
|
|
70
|
+
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/pathe/ci/main?style=flat-square
|
|
71
|
+
[github-actions-href]: https://github.com/unjs/pathe/actions?query=workflow%3Aci
|
|
72
|
+
[size-src]: https://packagephobia.now.sh/badge?p=pathe
|
|
73
|
+
[size-href]: https://packagephobia.now.sh/result?p=pathe
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# node-postgres
|
|
2
|
+
|
|
3
|
+
[](http://travis-ci.org/brianc/node-postgres)
|
|
4
|
+
<span class="badge-npmversion"><a href="https://npmjs.org/package/pg" title="View this project on NPM"><img src="https://img.shields.io/npm/v/pg.svg" alt="NPM version" /></a></span>
|
|
5
|
+
<span class="badge-npmdownloads"><a href="https://npmjs.org/package/pg" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/pg.svg" alt="NPM downloads" /></a></span>
|
|
6
|
+
|
|
7
|
+
Non-blocking PostgreSQL client for Node.js. Pure JavaScript and optional native libpq bindings.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
$ npm install pg
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## :star: [Documentation](https://node-postgres.com) :star:
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
- Pure JavaScript client and native libpq bindings share _the same API_
|
|
22
|
+
- Connection pooling
|
|
23
|
+
- Extensible JS ↔ PostgreSQL data-type coercion
|
|
24
|
+
- Supported PostgreSQL features
|
|
25
|
+
- Parameterized queries
|
|
26
|
+
- Named statements with query plan caching
|
|
27
|
+
- Async notifications with `LISTEN/NOTIFY`
|
|
28
|
+
- Bulk import & export with `COPY TO/COPY FROM`
|
|
29
|
+
|
|
30
|
+
### Extras
|
|
31
|
+
|
|
32
|
+
node-postgres is by design pretty light on abstractions. These are some handy modules we've been using over the years to complete the picture.
|
|
33
|
+
The entire list can be found on our [wiki](https://github.com/brianc/node-postgres/wiki/Extras).
|
|
34
|
+
|
|
35
|
+
## Support
|
|
36
|
+
|
|
37
|
+
node-postgres is free software. If you encounter a bug with the library please open an issue on the [GitHub repo](https://github.com/brianc/node-postgres). If you have questions unanswered by the documentation please open an issue pointing out how the documentation was unclear & I will do my best to make it better!
|
|
38
|
+
|
|
39
|
+
When you open an issue please provide:
|
|
40
|
+
|
|
41
|
+
- version of Node
|
|
42
|
+
- version of Postgres
|
|
43
|
+
- smallest possible snippet of code to reproduce the problem
|
|
44
|
+
|
|
45
|
+
You can also follow me [@briancarlson](https://twitter.com/briancarlson) if that's your thing. I try to always announce noteworthy changes & developments with node-postgres on Twitter.
|
|
46
|
+
|
|
47
|
+
## Sponsorship :two_hearts:
|
|
48
|
+
|
|
49
|
+
node-postgres's continued development has been made possible in part by generous financial support from [the community](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md).
|
|
50
|
+
|
|
51
|
+
If you or your company are benefiting from node-postgres and would like to help keep the project financially sustainable [please consider supporting](https://github.com/sponsors/brianc) its development.
|
|
52
|
+
|
|
53
|
+
### Featured sponsor
|
|
54
|
+
|
|
55
|
+
Special thanks to [medplum](https://medplum.com) for their generous and thoughtful support of node-postgres!
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
## Contributing
|
|
60
|
+
|
|
61
|
+
**:heart: contributions!**
|
|
62
|
+
|
|
63
|
+
I will **happily** accept your pull request if it:
|
|
64
|
+
|
|
65
|
+
- **has tests**
|
|
66
|
+
- looks reasonable
|
|
67
|
+
- does not break backwards compatibility
|
|
68
|
+
|
|
69
|
+
If your change involves breaking backwards compatibility please please point that out in the pull request & we can discuss & plan when and how to release it and what type of documentation or communicate it will require.
|
|
70
|
+
|
|
71
|
+
## Troubleshooting and FAQ
|
|
72
|
+
|
|
73
|
+
The causes and solutions to common errors can be found among the [Frequently Asked Questions (FAQ)](https://github.com/brianc/node-postgres/wiki/FAQ)
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
Copyright (c) 2010-2020 Brian Carlson (brian.m.carlson@gmail.com)
|
|
78
|
+
|
|
79
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
80
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
81
|
+
in the Software without restriction, including without limitation the rights
|
|
82
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
83
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
84
|
+
furnished to do so, subject to the following conditions:
|
|
85
|
+
|
|
86
|
+
The above copyright notice and this permission notice shall be included in
|
|
87
|
+
all copies or substantial portions of the Software.
|
|
88
|
+
|
|
89
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
90
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
91
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
92
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
93
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
94
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
95
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Kamil Ogórek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|