decocms 2.180.0 → 2.180.1
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/dist/client/assets/{AlertCircle-B8eJ9Fod.js → AlertCircle-CbWLhYeZ.js} +1 -1
- package/dist/client/assets/{ArrowLeft-BsqjOo0a.js → ArrowLeft-B9NeadX7.js} +1 -1
- package/dist/client/assets/{ArrowUp-Cfk9ftkI.js → ArrowUp-DrfphUZ7.js} +1 -1
- package/dist/client/assets/{Check-LF3O8VSl.js → Check-DcjDmu9V.js} +1 -1
- package/dist/client/assets/{ChevronDown-CoxfMCD_.js → ChevronDown-DrbU8H5D.js} +1 -1
- package/dist/client/assets/{ChevronRight-CkZ762r8.js → ChevronRight-DDdv6Tbp.js} +1 -1
- package/dist/client/assets/{ChevronUp-CkQ5LXE4.js → ChevronUp-VuH0I39v.js} +1 -1
- package/dist/client/assets/{Container-C_jftBLa.js → Container-CGejuubt.js} +1 -1
- package/dist/client/assets/{Dataflow03-B_UyQRrQ.js → Dataflow03-pJrIM8ao.js} +1 -1
- package/dist/client/assets/{Download01-Dn7pc_mQ.js → Download01-CQYzJttq.js} +1 -1
- package/dist/client/assets/{FolderClosed-Csm3WP5B.js → FolderClosed-CVPLIN3O.js} +1 -1
- package/dist/client/assets/{Grid01-Bg8b-MfH.js → Grid01-B844I2C0.js} +1 -1
- package/dist/client/assets/{List-BpugyVN4.js → List-Tv7Uz5X9.js} +1 -1
- package/dist/client/assets/{Loading01-BkQZaZ86.js → Loading01-Bc-DhPB6.js} +1 -1
- package/dist/client/assets/{Play-Bpqump99.js → Play-DCXtg8WP.js} +1 -1
- package/dist/client/assets/{Plus-Dt2hP7ZJ.js → Plus-C4kspS_I.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-BEbjARvC.js → RefreshCcw01-WHy1Jkso.js} +1 -1
- package/dist/client/assets/{SearchMd-BFV4EEyM.js → SearchMd-BR3WTGyz.js} +1 -1
- package/dist/client/assets/{Settings01--CB8mKBF.js → Settings01-B10O7d_o.js} +1 -1
- package/dist/client/assets/{Trash01-QTnEOFQZ.js → Trash01-BuPEx0_k.js} +1 -1
- package/dist/client/assets/{Type01-_F3mzKx6.js → Type01-DOkYrJiE.js} +1 -1
- package/dist/client/assets/{Upload01-CGSlQvAp.js → Upload01-C0WOeUrY.js} +1 -1
- package/dist/client/assets/{User01-aj-zclnv.js → User01-BUPQq0ED.js} +1 -1
- package/dist/client/assets/{VideoRecorder-D9PsxJCT.js → VideoRecorder-BxZ6ULCH.js} +1 -1
- package/dist/client/assets/{X-CcYgD4OX.js → X-DCpTFZeq.js} +1 -1
- package/dist/client/assets/{XCircle-D3Nvo83i.js → XCircle-DYElgwI6.js} +1 -1
- package/dist/client/assets/{XClose-BbXP9DKi.js → XClose-D1beSwQV.js} +1 -1
- package/dist/client/assets/{Zap-CL-zS1_o.js → Zap-UiK1PUg9.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-yyYAc1Y_.js → agent-connections-preview-DgkBw1_l.js} +1 -1
- package/dist/client/assets/{agent-detail-CO6liKCV.js → agent-detail-Bd6DKOlD.js} +1 -1
- package/dist/client/assets/{agents-CnIjEcH1.js → agents-DWqpBnsH.js} +1 -1
- package/dist/client/assets/{ai-providers-logos-dK9NDdIF.js → ai-providers-logos-uG0Mew5d.js} +1 -1
- package/dist/client/assets/{alert-dialog-B7veNUkq.js → alert-dialog-CgAC3BOl.js} +1 -1
- package/dist/client/assets/{auth-catchall-BiyI3G0T.js → auth-catchall-CL8VE192.js} +1 -1
- package/dist/client/assets/{automation-detail-7rT6BloM.js → automation-detail-BhLrq0dM.js} +1 -1
- package/dist/client/assets/{automations-C4il4Gbe.js → automations-R_FawvUI.js} +1 -1
- package/dist/client/assets/{avatar-BM-8GWUG.js → avatar-DDDYpGJF.js} +1 -1
- package/dist/client/assets/{badge-Cumb6-S9.js → badge-Bjpq-dTo.js} +1 -1
- package/dist/client/assets/{binder-C7qDL2Qf.js → binder-NYNrYM3G.js} +1 -1
- package/dist/client/assets/{breadcrumb-7qt2G4oc.js → breadcrumb-CB7jsoFZ.js} +1 -1
- package/dist/client/assets/{card-MD3_cdl-.js → card-DpLO2iaY.js} +1 -1
- package/dist/client/assets/{checkbox-K8EP3pTL.js → checkbox-Cmst94pj.js} +1 -1
- package/dist/client/assets/{collapsible-xpsXy8wv.js → collapsible-CrFa4wr9.js} +1 -1
- package/dist/client/assets/{collection-detail-U2cng7ZV.js → collection-detail-DryS-0FT.js} +1 -1
- package/dist/client/assets/{collection-display-button-CneWEmV-.js → collection-display-button-D4lR44rH.js} +1 -1
- package/dist/client/assets/{collection-search-BjwxIPZo.js → collection-search-BWvT1mtI.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DIx3NJ4P.js → collection-table-wrapper-DtUdWdus.js} +1 -1
- package/dist/client/assets/{collection-tabs-Dh0Q01AZ.js → collection-tabs-KsFYJUlb.js} +1 -1
- package/dist/client/assets/{command-NoPVlaEu.js → command-D37huG2X.js} +1 -1
- package/dist/client/assets/{connection-card-yKH89qjd.js → connection-card-yQSrUKDB.js} +1 -1
- package/dist/client/assets/{connection-detail-AHaqgIR7.js → connection-detail-B53-efUG.js} +1 -1
- package/dist/client/assets/{connections-l_vSiTwM.js → connections-Bx9lPnWk.js} +1 -1
- package/dist/client/assets/{constants-CxMCfkTL.js → constants-zYgM_0a9.js} +1 -1
- package/dist/client/assets/{context-CSEQjmqr.js → context-ClaY50kW.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-DdxPGHeC.js → create-organization-dialog-Be59rwts.js} +1 -1
- package/dist/client/assets/{create-project-dialog-CcCDkiLS.js → create-project-dialog-BxooZZKw.js} +1 -1
- package/dist/client/assets/{danger-DDAzF_I4.js → danger-BqaBl_q3.js} +1 -1
- package/dist/client/assets/{danger-zone-BC1lNC6W.js → danger-zone-BfHnGFV8.js} +1 -1
- package/dist/client/assets/{dependencies-JXKC29RT.js → dependencies-c_Dnkt09.js} +1 -1
- package/dist/client/assets/{dialog-DrVTTNou.js → dialog-9dz0XD_x.js} +1 -1
- package/dist/client/assets/{drawer-D5CP8kBI.js → drawer-BUTpu_fr.js} +1 -1
- package/dist/client/assets/{dropdown-menu-C89gFzkt.js → dropdown-menu-Bu3FiY_L.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-BbaU9_8j.js → dynamic-plugin-layout-CmNTXSLI.js} +1 -1
- package/dist/client/assets/{editable-task-title-DsAH2SQ2.js → editable-task-title-o3X-MF0r.js} +1 -1
- package/dist/client/assets/{empty-state-DbZVzTBg.js → empty-state-BZHGNb7q.js} +1 -1
- package/dist/client/assets/{empty-state-BBvw3ZYd.js → empty-state-DZEt4GhJ.js} +1 -1
- package/dist/client/assets/{env-vars-editor-cvzwdQUu.js → env-vars-editor-B0qTLind.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BffW3qeV.js → extract-connection-data-etKnB491.js} +1 -1
- package/dist/client/assets/{file-browser-mmi6aXC9.js → file-browser-CgCeL4Le.js} +2 -2
- package/dist/client/assets/{form-CWBeLdT6.js → form-BqkPOMyB.js} +1 -1
- package/dist/client/assets/{general-CcztoxCU.js → general-CftlpT6m.js} +1 -1
- package/dist/client/assets/{generate-id-Dg3pJRJj.js → generate-id-DvtLadCy.js} +1 -1
- package/dist/client/assets/{grid-view-B7Dp989W.js → grid-view-DHsEK-PQ.js} +1 -1
- package/dist/client/assets/{home-VPKMEjYo.js → home-PSYpS_Lj.js} +1 -1
- package/dist/client/assets/{index-BtPRAwS7.js → index-BQdJvUAH.js} +1 -1
- package/dist/client/assets/{index-sDOHRFRE.js → index-BWrGddwd.js} +1 -1
- package/dist/client/assets/{index-8Rhr5q5h.js → index-BazPw9_O.js} +1 -1
- package/dist/client/assets/{index-B02T0zBo.js → index-Brr7A335.js} +3 -3
- package/dist/client/assets/{index-BLDRNzDY.js → index-C4N6EaVB.js} +1 -1
- package/dist/client/assets/{index-B3k9P-lf.js → index-COnRU3v7.js} +1 -1
- package/dist/client/assets/{index-BLdXKd8l.js → index-DYfGsM_t.js} +1 -1
- package/dist/client/assets/{index-C8GCLBuY.js → index-DZgMGqvO.js} +1 -1
- package/dist/client/assets/{index-DawpyEvM.js → index-Db4SWmqo.js} +1 -1
- package/dist/client/assets/{index-Digd80e7.js → index-JPBlKO3L.js} +1 -1
- package/dist/client/assets/{index-DhZa9JXj.js → index-PAn33g2N.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-CkKdAcwZ.js → infiniteQueryObserver-c6RXxZ0G.js} +1 -1
- package/dist/client/assets/{input-ForWep-5.js → input-BNjye-PL.js} +1 -1
- package/dist/client/assets/{integration-icon-BzBBJ1Fk.js → integration-icon-DNmpqadJ.js} +1 -1
- package/dist/client/assets/{label-W6RhX9gu.js → label-eGYyBJst.js} +1 -1
- package/dist/client/assets/{layout-C--X5eSs.js → layout-BlxQvRSL.js} +1 -1
- package/dist/client/assets/{layout-rVBMqKc2.js → layout-DekWEJhY.js} +1 -1
- package/dist/client/assets/{login-LyWPWfzK.js → login-DIFEZdtr.js} +1 -1
- package/dist/client/assets/{logo-upload-D9fV-5Wh.js → logo-upload-DiA99WAp.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-CEmMQe7U.js → mcp-app-renderer-CFNpTQ6E.js} +1 -1
- package/dist/client/assets/{mcp-server-card-BJN3Fvzu.js → mcp-server-card-CdsVz3jG.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-zBT-Z-Xy.js → mcp-server-detail-DJvBbAjW.js} +2 -2
- package/dist/client/assets/{members-BDM7TZxS.js → members-Dyh2zG1d.js} +1 -1
- package/dist/client/assets/{monaco-editor-kDZdmDDL.js → monaco-editor-Bo90MSIY.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-edit-BuUSd4S7.js → monitoring-dashboard-edit-xhJPKPVH.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-view-DxXnUjzJ.js → monitoring-dashboard-view-dy0Flwse.js} +1 -1
- package/dist/client/assets/{monitoring-6tVMGVPB.js → monitoring-gqmKl2bi.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BwublEtu.js → monitoring-stats-row-iYQx558q.js} +1 -1
- package/dist/client/assets/{oauth-callback-u8tTg7C5.js → oauth-callback-BqwcoIo6.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-CIS3s0nz.js → oauth-callback-ai-provider-Dgpw8lcY.js} +1 -1
- package/dist/client/assets/{org-ai-providers-B_fAMKG8.js → org-ai-providers-D56R_fMG.js} +1 -1
- package/dist/client/assets/{page-CAbxUZTp.js → page-0Lz9H1On.js} +1 -1
- package/dist/client/assets/{page-CKYYB5UO.js → page-DOK5Sw55.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-BJl5Ig-x.js → plugin-empty-state-CEDsozup.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-CwdpqFxA.js → plugin-empty-state-DWQhD8Mf.js} +1 -1
- package/dist/client/assets/{plugin-header-CecjK7-6.js → plugin-header-CLZrxRuX.js} +1 -1
- package/dist/client/assets/{plugin-header-9p_F2K9N.js → plugin-header-DzGPACOB.js} +1 -1
- package/dist/client/assets/plugins-BTfTKK1m.js +1 -0
- package/dist/client/assets/{popover-B4lCL3Ry.js → popover-Z3f6ZQm7.js} +1 -1
- package/dist/client/assets/{project-app-view-hEe0cnSR.js → project-app-view-V-uewlX6.js} +1 -1
- package/dist/client/assets/{project-layout-CZOciC9q.js → project-layout-BBK9e0vM.js} +1 -1
- package/dist/client/assets/{project-plugins-BYtvCgGC.js → project-plugins-Cwp30i4R.js} +1 -1
- package/dist/client/assets/{projects-list-DLy1jTdn.js → projects-list-B8C93dIo.js} +1 -1
- package/dist/client/assets/{registry-layout-9bTlGXFv.js → registry-layout-C4_a8IdE.js} +1 -1
- package/dist/client/assets/{registry-utils-Du5_ORZW.js → registry-utils-y_fNkZkQ.js} +1 -1
- package/dist/client/assets/{reset-password-VTtBosDY.js → reset-password-BERKFVJp.js} +1 -1
- package/dist/client/assets/{resizable-CmQhfOL7.js → resizable-VdsKauhj.js} +1 -1
- package/dist/client/assets/{save-actions-gCP1b0um.js → save-actions-CMjDy0Ce.js} +1 -1
- package/dist/client/assets/{scroll-area-XDfeLpGT.js → scroll-area-Dys6p7CY.js} +1 -1
- package/dist/client/assets/{select-DPY6FKWr.js → select-B4xbO58q.js} +1 -1
- package/dist/client/assets/{select-virtual-mcp-CIMYOASs.js → select-virtual-mcp-Dkfvl35G.js} +1 -1
- package/dist/client/assets/{shell-layout-Cvv7MmQe.js → shell-layout-CzWpNDNz.js} +2 -2
- package/dist/client/assets/{sidebar-settings-oum_h4r1.js → sidebar-settings-94-vpDCw.js} +1 -1
- package/dist/client/assets/{skeleton-D7_wHYzP.js → skeleton-BfSOCc9S.js} +1 -1
- package/dist/client/assets/{spinner-qAHxlGf5.js → spinner-DnOPQqyk.js} +1 -1
- package/dist/client/assets/{store-invite-CZfZboyf.js → store-invite-PCKKyOl8.js} +1 -1
- package/dist/client/assets/{switch-B_37GSuW.js → switch-Dn2VbcGQ.js} +1 -1
- package/dist/client/assets/{table-DirES7KL.js → table-BxPcvQ9o.js} +1 -1
- package/dist/client/assets/{tabs-CKfZGJCt.js → tabs-D70zg5lJ.js} +1 -1
- package/dist/client/assets/{task-status-DeYQ5Diz.js → task-status-DcA6CFUk.js} +1 -1
- package/dist/client/assets/tasks-DFBzNwFL.js +1 -0
- package/dist/client/assets/{tasks-panel-Bbz3xeDf.js → tasks-panel-B9bc_p-z.js} +1 -1
- package/dist/client/assets/{textarea-BKGwVT1m.js → textarea-Ct5_AtGA.js} +1 -1
- package/dist/client/assets/{time-range-picker-y1wEVr1m.js → time-range-picker-C3sQPl1b.js} +1 -1
- package/dist/client/assets/{toggle-group-C7uP4yM0.js → toggle-group-BTFft7Fn.js} +1 -1
- package/dist/client/assets/{tools-list-BrPZj3wN.js → tools-list-C87HbBZ8.js} +1 -1
- package/dist/client/assets/{tooltip-CFp3ORxD.js → tooltip-CkRG11nt.js} +1 -1
- package/dist/client/assets/{topbar-portal-DS87obgh.js → topbar-portal-DbW6t3qj.js} +1 -1
- package/dist/client/assets/{types-Cq5MfqXb.js → types-Dx34u3xT.js} +1 -1
- package/dist/client/assets/{use-automations-COEE-nvw.js → use-automations-CmTGPtG8.js} +1 -1
- package/dist/client/assets/{use-collections-Glkd82JS.js → use-collections-BuridTiI.js} +1 -1
- package/dist/client/assets/{use-connection-DEVOZTNJ.js → use-connection-WnniEfph.js} +1 -1
- package/dist/client/assets/{use-copy-C9sTW2YW.js → use-copy-BeVulQm3.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-Br5CSA0l.js → use-create-virtual-mcp-BbDtSF4k.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-Cxu6oap_.js → use-infinite-scroll-BitXf5wc.js} +1 -1
- package/dist/client/assets/{use-install-from-registry-B67DeFNR.js → use-install-from-registry-BbsHXAvF.js} +1 -1
- package/dist/client/assets/{use-list-state-9uBW39Lr.js → use-list-state-BS-4PDWE.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-DFUn-Vc8.js → use-mcp-prompts-C6hR9huh.js} +1 -1
- package/dist/client/assets/{use-mcp-resources-CkUyAyuG.js → use-mcp-resources-DhirVQgi.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CMxPCHjd.js → use-mcp-tools-BjoRAfDL.js} +1 -1
- package/dist/client/assets/{use-members-CXGpt7MK.js → use-members-BdRmI9FL.js} +1 -1
- package/dist/client/assets/{use-project-C-n-ZTz8.js → use-project-Dy3tSas3.js} +1 -1
- package/dist/client/assets/{use-store-discovery-CaaH9ZyH.js → use-store-discovery-DtyNi-FP.js} +1 -1
- package/dist/client/assets/{use-view-mode-CyRa2Tg7.js → use-view-mode-U7lICyoa.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-B29yPvq9.js → use-virtual-mcp-RrB-tK1z.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CsD7JLjH.js +1 -0
- package/dist/client/assets/{useMutation-r3KZb1HO.js → useMutation-BZjo1ZXS.js} +1 -1
- package/dist/client/assets/useQuery-Ck1ZbbFp.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-D1F_CbNV.js +1 -0
- package/dist/client/assets/{user-CSVNc19J.js → user-B-oJutpy.js} +1 -1
- package/dist/client/assets/{workflow-ZIi3x0hm.js → workflow-DxaY4-SA.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/migrate.js +1 -1
- package/dist/server/node_modules/pg/LICENSE +21 -0
- package/dist/server/node_modules/pg/README.md +95 -0
- package/dist/server/node_modules/pg/esm/index.mjs +20 -0
- package/dist/server/node_modules/pg/lib/client.js +743 -0
- package/dist/server/node_modules/pg/lib/connection-parameters.js +171 -0
- package/dist/server/node_modules/pg/lib/connection.js +221 -0
- package/dist/server/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
- package/dist/server/node_modules/pg/lib/crypto/sasl.js +212 -0
- package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +43 -0
- package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +89 -0
- package/dist/server/node_modules/pg/lib/crypto/utils.js +9 -0
- package/dist/server/node_modules/pg/lib/defaults.js +91 -0
- package/dist/server/node_modules/pg/lib/index.js +73 -0
- package/dist/server/node_modules/pg/lib/native/client.js +323 -0
- package/dist/server/node_modules/pg/lib/native/index.js +2 -0
- package/dist/server/node_modules/pg/lib/native/query.js +165 -0
- package/dist/server/node_modules/pg/lib/query.js +252 -0
- package/dist/server/node_modules/pg/lib/result.js +109 -0
- package/dist/server/node_modules/pg/lib/stream.js +83 -0
- package/dist/server/node_modules/pg/lib/type-overrides.js +35 -0
- package/dist/server/node_modules/pg/lib/utils.js +217 -0
- package/dist/server/node_modules/pg/package.json +76 -0
- package/dist/server/node_modules/pg-pool/LICENSE +21 -0
- package/dist/server/node_modules/pg-pool/README.md +357 -0
- package/dist/server/node_modules/pg-pool/esm/index.mjs +5 -0
- package/dist/server/node_modules/pg-pool/index.js +517 -0
- package/dist/server/node_modules/pg-pool/package.json +51 -0
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/plugins-FpJP518T.js +0 -1
- package/dist/client/assets/tasks-C-mIVJ1R.js +0 -1
- package/dist/client/assets/useInfiniteQuery-pONeFYZo.js +0 -1
- package/dist/client/assets/useQuery-D3gzovXd.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-ButnbJ6Q.js +0 -1
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
const EventEmitter = require('events').EventEmitter
|
|
3
|
+
|
|
4
|
+
const NOOP = function () {}
|
|
5
|
+
|
|
6
|
+
const removeWhere = (list, predicate) => {
|
|
7
|
+
const i = list.findIndex(predicate)
|
|
8
|
+
|
|
9
|
+
return i === -1 ? undefined : list.splice(i, 1)[0]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
class IdleItem {
|
|
13
|
+
constructor(client, idleListener, timeoutId) {
|
|
14
|
+
this.client = client
|
|
15
|
+
this.idleListener = idleListener
|
|
16
|
+
this.timeoutId = timeoutId
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
class PendingItem {
|
|
21
|
+
constructor(callback) {
|
|
22
|
+
this.callback = callback
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function throwOnDoubleRelease() {
|
|
27
|
+
throw new Error('Release called on client which has already been released to the pool.')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function promisify(Promise, callback) {
|
|
31
|
+
if (callback) {
|
|
32
|
+
return { callback: callback, result: undefined }
|
|
33
|
+
}
|
|
34
|
+
let rej
|
|
35
|
+
let res
|
|
36
|
+
const cb = function (err, client) {
|
|
37
|
+
err ? rej(err) : res(client)
|
|
38
|
+
}
|
|
39
|
+
const result = new Promise(function (resolve, reject) {
|
|
40
|
+
res = resolve
|
|
41
|
+
rej = reject
|
|
42
|
+
}).catch((err) => {
|
|
43
|
+
// replace the stack trace that leads to `TCP.onStreamRead` with one that leads back to the
|
|
44
|
+
// application that created the query
|
|
45
|
+
Error.captureStackTrace(err)
|
|
46
|
+
throw err
|
|
47
|
+
})
|
|
48
|
+
return { callback: cb, result: result }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function makeIdleListener(pool, client) {
|
|
52
|
+
return function idleListener(err) {
|
|
53
|
+
err.client = client
|
|
54
|
+
|
|
55
|
+
client.removeListener('error', idleListener)
|
|
56
|
+
client.on('error', () => {
|
|
57
|
+
pool.log('additional client error after disconnection due to error', err)
|
|
58
|
+
})
|
|
59
|
+
pool._remove(client)
|
|
60
|
+
// TODO - document that once the pool emits an error
|
|
61
|
+
// the client has already been closed & purged and is unusable
|
|
62
|
+
pool.emit('error', err, client)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
class Pool extends EventEmitter {
|
|
67
|
+
constructor(options, Client) {
|
|
68
|
+
super()
|
|
69
|
+
this.options = Object.assign({}, options)
|
|
70
|
+
|
|
71
|
+
if (options != null && 'password' in options) {
|
|
72
|
+
// "hiding" the password so it doesn't show up in stack traces
|
|
73
|
+
// or if the client is console.logged
|
|
74
|
+
Object.defineProperty(this.options, 'password', {
|
|
75
|
+
configurable: true,
|
|
76
|
+
enumerable: false,
|
|
77
|
+
writable: true,
|
|
78
|
+
value: options.password,
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
if (options != null && options.ssl && options.ssl.key) {
|
|
82
|
+
// "hiding" the ssl->key so it doesn't show up in stack traces
|
|
83
|
+
// or if the client is console.logged
|
|
84
|
+
Object.defineProperty(this.options.ssl, 'key', {
|
|
85
|
+
enumerable: false,
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
this.options.max = this.options.max || this.options.poolSize || 10
|
|
90
|
+
this.options.min = this.options.min || 0
|
|
91
|
+
this.options.maxUses = this.options.maxUses || Infinity
|
|
92
|
+
this.options.allowExitOnIdle = this.options.allowExitOnIdle || false
|
|
93
|
+
this.options.maxLifetimeSeconds = this.options.maxLifetimeSeconds || 0
|
|
94
|
+
this.log = this.options.log || function () {}
|
|
95
|
+
this.Client = this.options.Client || Client || require('pg').Client
|
|
96
|
+
this.Promise = this.options.Promise || global.Promise
|
|
97
|
+
|
|
98
|
+
if (typeof this.options.idleTimeoutMillis === 'undefined') {
|
|
99
|
+
this.options.idleTimeoutMillis = 10000
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
this._clients = []
|
|
103
|
+
this._idle = []
|
|
104
|
+
this._expired = new WeakSet()
|
|
105
|
+
this._pendingQueue = []
|
|
106
|
+
this._endCallback = undefined
|
|
107
|
+
this.ending = false
|
|
108
|
+
this.ended = false
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
_promiseTry(f) {
|
|
112
|
+
const Promise = this.Promise
|
|
113
|
+
if (typeof Promise.try === 'function') {
|
|
114
|
+
return Promise.try(f)
|
|
115
|
+
}
|
|
116
|
+
return new Promise((resolve) => resolve(f()))
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
_isFull() {
|
|
120
|
+
return this._clients.length >= this.options.max
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
_isAboveMin() {
|
|
124
|
+
return this._clients.length > this.options.min
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
_pulseQueue() {
|
|
128
|
+
this.log('pulse queue')
|
|
129
|
+
if (this.ended) {
|
|
130
|
+
this.log('pulse queue ended')
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
if (this.ending) {
|
|
134
|
+
this.log('pulse queue on ending')
|
|
135
|
+
if (this._idle.length) {
|
|
136
|
+
this._idle.slice().map((item) => {
|
|
137
|
+
this._remove(item.client)
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
if (!this._clients.length) {
|
|
141
|
+
this.ended = true
|
|
142
|
+
this._endCallback()
|
|
143
|
+
}
|
|
144
|
+
return
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// if we don't have any waiting, do nothing
|
|
148
|
+
if (!this._pendingQueue.length) {
|
|
149
|
+
this.log('no queued requests')
|
|
150
|
+
return
|
|
151
|
+
}
|
|
152
|
+
// if we don't have any idle clients and we have no more room do nothing
|
|
153
|
+
if (!this._idle.length && this._isFull()) {
|
|
154
|
+
return
|
|
155
|
+
}
|
|
156
|
+
const pendingItem = this._pendingQueue.shift()
|
|
157
|
+
if (this._idle.length) {
|
|
158
|
+
const idleItem = this._idle.pop()
|
|
159
|
+
clearTimeout(idleItem.timeoutId)
|
|
160
|
+
const client = idleItem.client
|
|
161
|
+
client.ref && client.ref()
|
|
162
|
+
const idleListener = idleItem.idleListener
|
|
163
|
+
|
|
164
|
+
return this._acquireClient(client, pendingItem, idleListener, false)
|
|
165
|
+
}
|
|
166
|
+
if (!this._isFull()) {
|
|
167
|
+
return this.newClient(pendingItem)
|
|
168
|
+
}
|
|
169
|
+
throw new Error('unexpected condition')
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
_remove(client, callback) {
|
|
173
|
+
const removed = removeWhere(this._idle, (item) => item.client === client)
|
|
174
|
+
|
|
175
|
+
if (removed !== undefined) {
|
|
176
|
+
clearTimeout(removed.timeoutId)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
this._clients = this._clients.filter((c) => c !== client)
|
|
180
|
+
const context = this
|
|
181
|
+
client.end(() => {
|
|
182
|
+
context.emit('remove', client)
|
|
183
|
+
|
|
184
|
+
if (typeof callback === 'function') {
|
|
185
|
+
callback()
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
connect(cb) {
|
|
191
|
+
if (this.ending) {
|
|
192
|
+
const err = new Error('Cannot use a pool after calling end on the pool')
|
|
193
|
+
return cb ? cb(err) : this.Promise.reject(err)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const response = promisify(this.Promise, cb)
|
|
197
|
+
const result = response.result
|
|
198
|
+
|
|
199
|
+
// if we don't have to connect a new client, don't do so
|
|
200
|
+
if (this._isFull() || this._idle.length) {
|
|
201
|
+
// if we have idle clients schedule a pulse immediately
|
|
202
|
+
if (this._idle.length) {
|
|
203
|
+
process.nextTick(() => this._pulseQueue())
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (!this.options.connectionTimeoutMillis) {
|
|
207
|
+
this._pendingQueue.push(new PendingItem(response.callback))
|
|
208
|
+
return result
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const queueCallback = (err, res, done) => {
|
|
212
|
+
clearTimeout(tid)
|
|
213
|
+
response.callback(err, res, done)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const pendingItem = new PendingItem(queueCallback)
|
|
217
|
+
|
|
218
|
+
// set connection timeout on checking out an existing client
|
|
219
|
+
const tid = setTimeout(() => {
|
|
220
|
+
// remove the callback from pending waiters because
|
|
221
|
+
// we're going to call it with a timeout error
|
|
222
|
+
removeWhere(this._pendingQueue, (i) => i.callback === queueCallback)
|
|
223
|
+
pendingItem.timedOut = true
|
|
224
|
+
response.callback(new Error('timeout exceeded when trying to connect'))
|
|
225
|
+
}, this.options.connectionTimeoutMillis)
|
|
226
|
+
|
|
227
|
+
if (tid.unref) {
|
|
228
|
+
tid.unref()
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
this._pendingQueue.push(pendingItem)
|
|
232
|
+
return result
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
this.newClient(new PendingItem(response.callback))
|
|
236
|
+
|
|
237
|
+
return result
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
newClient(pendingItem) {
|
|
241
|
+
const client = new this.Client(this.options)
|
|
242
|
+
this._clients.push(client)
|
|
243
|
+
const idleListener = makeIdleListener(this, client)
|
|
244
|
+
|
|
245
|
+
this.log('checking client timeout')
|
|
246
|
+
|
|
247
|
+
// connection timeout logic
|
|
248
|
+
let tid
|
|
249
|
+
let timeoutHit = false
|
|
250
|
+
if (this.options.connectionTimeoutMillis) {
|
|
251
|
+
tid = setTimeout(() => {
|
|
252
|
+
if (client.connection) {
|
|
253
|
+
this.log('ending client due to timeout')
|
|
254
|
+
timeoutHit = true
|
|
255
|
+
client.connection.stream.destroy()
|
|
256
|
+
} else if (!client.isConnected()) {
|
|
257
|
+
this.log('ending client due to timeout')
|
|
258
|
+
timeoutHit = true
|
|
259
|
+
// force kill the node driver, and let libpq do its teardown
|
|
260
|
+
client.end()
|
|
261
|
+
}
|
|
262
|
+
}, this.options.connectionTimeoutMillis)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
this.log('connecting new client')
|
|
266
|
+
client.connect((err) => {
|
|
267
|
+
if (tid) {
|
|
268
|
+
clearTimeout(tid)
|
|
269
|
+
}
|
|
270
|
+
client.on('error', idleListener)
|
|
271
|
+
if (err) {
|
|
272
|
+
this.log('client failed to connect', err)
|
|
273
|
+
// remove the dead client from our list of clients
|
|
274
|
+
this._clients = this._clients.filter((c) => c !== client)
|
|
275
|
+
if (timeoutHit) {
|
|
276
|
+
err = new Error('Connection terminated due to connection timeout', { cause: err })
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// this client won’t be released, so move on immediately
|
|
280
|
+
this._pulseQueue()
|
|
281
|
+
|
|
282
|
+
if (!pendingItem.timedOut) {
|
|
283
|
+
pendingItem.callback(err, undefined, NOOP)
|
|
284
|
+
}
|
|
285
|
+
} else {
|
|
286
|
+
this.log('new client connected')
|
|
287
|
+
|
|
288
|
+
if (this.options.onConnect) {
|
|
289
|
+
this._promiseTry(() => this.options.onConnect(client)).then(
|
|
290
|
+
() => {
|
|
291
|
+
this._afterConnect(client, pendingItem, idleListener)
|
|
292
|
+
},
|
|
293
|
+
(hookErr) => {
|
|
294
|
+
this._clients = this._clients.filter((c) => c !== client)
|
|
295
|
+
client.end(() => {
|
|
296
|
+
this._pulseQueue()
|
|
297
|
+
if (!pendingItem.timedOut) {
|
|
298
|
+
pendingItem.callback(hookErr, undefined, NOOP)
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
}
|
|
302
|
+
)
|
|
303
|
+
return
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return this._afterConnect(client, pendingItem, idleListener)
|
|
307
|
+
}
|
|
308
|
+
})
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
_afterConnect(client, pendingItem, idleListener) {
|
|
312
|
+
if (this.options.maxLifetimeSeconds !== 0) {
|
|
313
|
+
const maxLifetimeTimeout = setTimeout(() => {
|
|
314
|
+
this.log('ending client due to expired lifetime')
|
|
315
|
+
this._expired.add(client)
|
|
316
|
+
const idleIndex = this._idle.findIndex((idleItem) => idleItem.client === client)
|
|
317
|
+
if (idleIndex !== -1) {
|
|
318
|
+
this._acquireClient(
|
|
319
|
+
client,
|
|
320
|
+
new PendingItem((err, client, clientRelease) => clientRelease()),
|
|
321
|
+
idleListener,
|
|
322
|
+
false
|
|
323
|
+
)
|
|
324
|
+
}
|
|
325
|
+
}, this.options.maxLifetimeSeconds * 1000)
|
|
326
|
+
|
|
327
|
+
maxLifetimeTimeout.unref()
|
|
328
|
+
client.once('end', () => clearTimeout(maxLifetimeTimeout))
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return this._acquireClient(client, pendingItem, idleListener, true)
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// acquire a client for a pending work item
|
|
335
|
+
_acquireClient(client, pendingItem, idleListener, isNew) {
|
|
336
|
+
if (isNew) {
|
|
337
|
+
this.emit('connect', client)
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
this.emit('acquire', client)
|
|
341
|
+
|
|
342
|
+
client.release = this._releaseOnce(client, idleListener)
|
|
343
|
+
|
|
344
|
+
client.removeListener('error', idleListener)
|
|
345
|
+
|
|
346
|
+
if (!pendingItem.timedOut) {
|
|
347
|
+
if (isNew && this.options.verify) {
|
|
348
|
+
this.options.verify(client, (err) => {
|
|
349
|
+
if (err) {
|
|
350
|
+
client.release(err)
|
|
351
|
+
return pendingItem.callback(err, undefined, NOOP)
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
pendingItem.callback(undefined, client, client.release)
|
|
355
|
+
})
|
|
356
|
+
} else {
|
|
357
|
+
pendingItem.callback(undefined, client, client.release)
|
|
358
|
+
}
|
|
359
|
+
} else {
|
|
360
|
+
if (isNew && this.options.verify) {
|
|
361
|
+
this.options.verify(client, client.release)
|
|
362
|
+
} else {
|
|
363
|
+
client.release()
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// returns a function that wraps _release and throws if called more than once
|
|
369
|
+
_releaseOnce(client, idleListener) {
|
|
370
|
+
let released = false
|
|
371
|
+
|
|
372
|
+
return (err) => {
|
|
373
|
+
if (released) {
|
|
374
|
+
throwOnDoubleRelease()
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
released = true
|
|
378
|
+
this._release(client, idleListener, err)
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// release a client back to the poll, include an error
|
|
383
|
+
// to remove it from the pool
|
|
384
|
+
_release(client, idleListener, err) {
|
|
385
|
+
client.on('error', idleListener)
|
|
386
|
+
|
|
387
|
+
client._poolUseCount = (client._poolUseCount || 0) + 1
|
|
388
|
+
|
|
389
|
+
this.emit('release', err, client)
|
|
390
|
+
|
|
391
|
+
// TODO(bmc): expose a proper, public interface _queryable and _ending
|
|
392
|
+
if (err || this.ending || !client._queryable || client._ending || client._poolUseCount >= this.options.maxUses) {
|
|
393
|
+
if (client._poolUseCount >= this.options.maxUses) {
|
|
394
|
+
this.log('remove expended client')
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
return this._remove(client, this._pulseQueue.bind(this))
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
const isExpired = this._expired.has(client)
|
|
401
|
+
if (isExpired) {
|
|
402
|
+
this.log('remove expired client')
|
|
403
|
+
this._expired.delete(client)
|
|
404
|
+
return this._remove(client, this._pulseQueue.bind(this))
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// idle timeout
|
|
408
|
+
let tid
|
|
409
|
+
if (this.options.idleTimeoutMillis && this._isAboveMin()) {
|
|
410
|
+
tid = setTimeout(() => {
|
|
411
|
+
if (this._isAboveMin()) {
|
|
412
|
+
this.log('remove idle client')
|
|
413
|
+
this._remove(client, this._pulseQueue.bind(this))
|
|
414
|
+
}
|
|
415
|
+
}, this.options.idleTimeoutMillis)
|
|
416
|
+
|
|
417
|
+
if (this.options.allowExitOnIdle) {
|
|
418
|
+
// allow Node to exit if this is all that's left
|
|
419
|
+
tid.unref()
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (this.options.allowExitOnIdle) {
|
|
424
|
+
client.unref()
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
this._idle.push(new IdleItem(client, idleListener, tid))
|
|
428
|
+
this._pulseQueue()
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
query(text, values, cb) {
|
|
432
|
+
// guard clause against passing a function as the first parameter
|
|
433
|
+
if (typeof text === 'function') {
|
|
434
|
+
const response = promisify(this.Promise, text)
|
|
435
|
+
setImmediate(function () {
|
|
436
|
+
return response.callback(new Error('Passing a function as the first parameter to pool.query is not supported'))
|
|
437
|
+
})
|
|
438
|
+
return response.result
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// allow plain text query without values
|
|
442
|
+
if (typeof values === 'function') {
|
|
443
|
+
cb = values
|
|
444
|
+
values = undefined
|
|
445
|
+
}
|
|
446
|
+
const response = promisify(this.Promise, cb)
|
|
447
|
+
cb = response.callback
|
|
448
|
+
|
|
449
|
+
this.connect((err, client) => {
|
|
450
|
+
if (err) {
|
|
451
|
+
return cb(err)
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
let clientReleased = false
|
|
455
|
+
const onError = (err) => {
|
|
456
|
+
if (clientReleased) {
|
|
457
|
+
return
|
|
458
|
+
}
|
|
459
|
+
clientReleased = true
|
|
460
|
+
client.release(err)
|
|
461
|
+
cb(err)
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
client.once('error', onError)
|
|
465
|
+
this.log('dispatching query')
|
|
466
|
+
try {
|
|
467
|
+
client.query(text, values, (err, res) => {
|
|
468
|
+
this.log('query dispatched')
|
|
469
|
+
client.removeListener('error', onError)
|
|
470
|
+
if (clientReleased) {
|
|
471
|
+
return
|
|
472
|
+
}
|
|
473
|
+
clientReleased = true
|
|
474
|
+
client.release(err)
|
|
475
|
+
if (err) {
|
|
476
|
+
return cb(err)
|
|
477
|
+
}
|
|
478
|
+
return cb(undefined, res)
|
|
479
|
+
})
|
|
480
|
+
} catch (err) {
|
|
481
|
+
client.release(err)
|
|
482
|
+
return cb(err)
|
|
483
|
+
}
|
|
484
|
+
})
|
|
485
|
+
return response.result
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
end(cb) {
|
|
489
|
+
this.log('ending')
|
|
490
|
+
if (this.ending) {
|
|
491
|
+
const err = new Error('Called end on pool more than once')
|
|
492
|
+
return cb ? cb(err) : this.Promise.reject(err)
|
|
493
|
+
}
|
|
494
|
+
this.ending = true
|
|
495
|
+
const promised = promisify(this.Promise, cb)
|
|
496
|
+
this._endCallback = promised.callback
|
|
497
|
+
this._pulseQueue()
|
|
498
|
+
return promised.result
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
get waitingCount() {
|
|
502
|
+
return this._pendingQueue.length
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
get idleCount() {
|
|
506
|
+
return this._idle.length
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
get expiredCount() {
|
|
510
|
+
return this._clients.reduce((acc, client) => acc + (this._expired.has(client) ? 1 : 0), 0)
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
get totalCount() {
|
|
514
|
+
return this._clients.length
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
module.exports = Pool
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pg-pool",
|
|
3
|
+
"version": "3.13.0",
|
|
4
|
+
"description": "Connection pool for node-postgres",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./esm/index.mjs",
|
|
9
|
+
"require": "./index.js",
|
|
10
|
+
"default": "./index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"directories": {
|
|
14
|
+
"test": "test"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": " node_modules/.bin/mocha"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git://github.com/brianc/node-postgres.git",
|
|
22
|
+
"directory": "packages/pg-pool"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"pg",
|
|
26
|
+
"postgres",
|
|
27
|
+
"pool",
|
|
28
|
+
"database"
|
|
29
|
+
],
|
|
30
|
+
"author": "Brian M. Carlson",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/brianc/node-postgres/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/brianc/node-postgres/tree/master/packages/pg-pool#readme",
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"bluebird": "3.7.2",
|
|
38
|
+
"co": "4.6.0",
|
|
39
|
+
"expect.js": "0.3.1",
|
|
40
|
+
"lodash": "^4.17.11",
|
|
41
|
+
"mocha": "^11.7.5"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"pg": ">=8.0"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"index.js",
|
|
48
|
+
"esm"
|
|
49
|
+
],
|
|
50
|
+
"gitHead": "c9070cc8d526fca65780cedc25c1966b57cf7532"
|
|
51
|
+
}
|