decocms 2.181.2 → 2.181.3
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-Hpsw9_tf.js → AlertCircle-D2rRA9CS.js} +1 -1
- package/dist/client/assets/{ArrowLeft-U7OUoBhv.js → ArrowLeft-D4bkD9qi.js} +1 -1
- package/dist/client/assets/{ArrowUp-BrSLqvQo.js → ArrowUp-CpDF-NAu.js} +1 -1
- package/dist/client/assets/{Check-CVKUMJv3.js → Check-CecxQkQE.js} +1 -1
- package/dist/client/assets/{ChevronDown-Ds3IOx8p.js → ChevronDown-Cm9SuGtV.js} +1 -1
- package/dist/client/assets/{ChevronRight-CTHCKnjF.js → ChevronRight-2xVQHhsF.js} +1 -1
- package/dist/client/assets/{ChevronUp-DJbt-mXd.js → ChevronUp-B6bu9ZD3.js} +1 -1
- package/dist/client/assets/{Container-D4n2e11R.js → Container-sfWYtc36.js} +1 -1
- package/dist/client/assets/{Dataflow03-q5kzWw4s.js → Dataflow03-BcXlVxgR.js} +1 -1
- package/dist/client/assets/{Download01-BBRbjA11.js → Download01-DGSbxmSo.js} +1 -1
- package/dist/client/assets/{FolderClosed-CgbAGtho.js → FolderClosed-DlY-lqwP.js} +1 -1
- package/dist/client/assets/{Grid01-CbgVFQNg.js → Grid01-CLnEHof5.js} +1 -1
- package/dist/client/assets/{List-D35z7ORx.js → List-CnkQuVUq.js} +1 -1
- package/dist/client/assets/{Loading01-DDv5lfhX.js → Loading01-ZUH_hVSq.js} +1 -1
- package/dist/client/assets/{Play-Q9uDVIa5.js → Play-CCpyKlpN.js} +1 -1
- package/dist/client/assets/{Plus-DcUxQQXw.js → Plus-D9CNWrFQ.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-nS96T2bf.js → RefreshCcw01-Cu6svfY5.js} +1 -1
- package/dist/client/assets/{SearchMd-CTpXH6F3.js → SearchMd-BH_J7-7p.js} +1 -1
- package/dist/client/assets/{Settings01-BVY96Vsg.js → Settings01-DTaoTYj1.js} +1 -1
- package/dist/client/assets/{Trash01-CzfVJZjl.js → Trash01-Cv31wiMP.js} +1 -1
- package/dist/client/assets/{Type01-BwsSTKh1.js → Type01-BRLQyycA.js} +1 -1
- package/dist/client/assets/{Upload01-Bn_9d04P.js → Upload01-BY6Noksk.js} +1 -1
- package/dist/client/assets/{User01-Dl4j8Eui.js → User01-BloSEKZw.js} +1 -1
- package/dist/client/assets/{VideoRecorder-0-qQusnp.js → VideoRecorder-CqjZf9cg.js} +1 -1
- package/dist/client/assets/{X-DvXlEl9E.js → X-1dO_8PIJ.js} +1 -1
- package/dist/client/assets/{XCircle-DI9HiD4A.js → XCircle-BEC1SvTX.js} +1 -1
- package/dist/client/assets/{XClose-Bw5018RM.js → XClose-BzyTilGE.js} +1 -1
- package/dist/client/assets/{Zap-DGbTVlYq.js → Zap-D6SUOiFY.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-Cfflc0J5.js → agent-connections-preview-COmBlzCd.js} +1 -1
- package/dist/client/assets/{agent-detail-CehIC3W1.js → agent-detail-DAo3-7Gz.js} +1 -1
- package/dist/client/assets/{agents-DmtfY0M7.js → agents-Cy0iaygc.js} +1 -1
- package/dist/client/assets/{ai-providers-logos-BtOy-_hY.js → ai-providers-logos-Cr4iRu-0.js} +1 -1
- package/dist/client/assets/{alert-dialog-CIdU20ao.js → alert-dialog-DnwDlp7T.js} +1 -1
- package/dist/client/assets/{auth-catchall-DklKmwQO.js → auth-catchall-CJb2iecY.js} +1 -1
- package/dist/client/assets/{automation-detail-CIe1WG8E.js → automation-detail-DIl5XDBS.js} +1 -1
- package/dist/client/assets/{automations-KsqaYtsv.js → automations-4lM2x30V.js} +1 -1
- package/dist/client/assets/{avatar-Dz9Au16I.js → avatar-CahK8DWE.js} +1 -1
- package/dist/client/assets/{badge-BIY4HSu4.js → badge-a1yIqkX1.js} +1 -1
- package/dist/client/assets/{binder-DaeU7_Yt.js → binder-B_Xezby6.js} +1 -1
- package/dist/client/assets/{breadcrumb-DNInqlES.js → breadcrumb-DBLmG8ET.js} +1 -1
- package/dist/client/assets/{card-CoTaf7Bb.js → card-BkMKAjKJ.js} +1 -1
- package/dist/client/assets/{checkbox-UWf_Spym.js → checkbox-DFbWpPSa.js} +1 -1
- package/dist/client/assets/{collapsible-DGsDf05s.js → collapsible-CzCLTaIa.js} +1 -1
- package/dist/client/assets/{collection-detail-jT6_1Zus.js → collection-detail-CP2ikFfr.js} +1 -1
- package/dist/client/assets/{collection-display-button-CIwF6qiP.js → collection-display-button-BTy8OMGo.js} +1 -1
- package/dist/client/assets/{collection-search-DmeA1lkM.js → collection-search-BaA_5hnO.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DZ9kkHHz.js → collection-table-wrapper-CeDvXZ6e.js} +1 -1
- package/dist/client/assets/{collection-tabs-VEtVQj8e.js → collection-tabs-B_Ive8CL.js} +1 -1
- package/dist/client/assets/{command-DS9L8dE9.js → command-DeF62mUG.js} +1 -1
- package/dist/client/assets/{connection-card-DY8BmloD.js → connection-card-ClL9bm7k.js} +1 -1
- package/dist/client/assets/{connection-detail-D6zDmZps.js → connection-detail-D6Ad6Uup.js} +1 -1
- package/dist/client/assets/{connections-BvDULZyp.js → connections-Dkdo-MxF.js} +1 -1
- package/dist/client/assets/{constants-C5g6K3-0.js → constants-kAo23sAc.js} +1 -1
- package/dist/client/assets/{context-0-m5aPvK.js → context-C2WVT2wI.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-Bw7JkHCW.js → create-organization-dialog--yeW4Rp3.js} +1 -1
- package/dist/client/assets/{create-project-dialog-CofGaj8t.js → create-project-dialog-DX0tom06.js} +1 -1
- package/dist/client/assets/{danger-BxwsLFA0.js → danger-BEWSLgEr.js} +1 -1
- package/dist/client/assets/{danger-zone-DNgGGkaE.js → danger-zone-COttqiLk.js} +1 -1
- package/dist/client/assets/{dependencies-CscQrQx3.js → dependencies-DQpwdViP.js} +1 -1
- package/dist/client/assets/{dialog-Beaz2erB.js → dialog-B-I43lOk.js} +1 -1
- package/dist/client/assets/{drawer-DuM10S-O.js → drawer-Cc_fH-oc.js} +1 -1
- package/dist/client/assets/{dropdown-menu-IA1w2fjK.js → dropdown-menu-KiFp7XSX.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-CtDEEZnp.js → dynamic-plugin-layout-DqyTuAzp.js} +1 -1
- package/dist/client/assets/{editable-task-title-DuDIwQf_.js → editable-task-title-DABFKKXz.js} +1 -1
- package/dist/client/assets/{empty-state-DnJSxmJA.js → empty-state-BclY67WC.js} +1 -1
- package/dist/client/assets/{empty-state-hwIP0sm6.js → empty-state-UToLDOJO.js} +1 -1
- package/dist/client/assets/{env-vars-editor-Ceyzo9UT.js → env-vars-editor-D3JHoO0m.js} +1 -1
- package/dist/client/assets/{extract-connection-data-D13QyL30.js → extract-connection-data-GhIKo0Xr.js} +1 -1
- package/dist/client/assets/{file-browser-B-JXooL8.js → file-browser-CZHih4nP.js} +2 -2
- package/dist/client/assets/{form-CccEC3cm.js → form-edx7u0Be.js} +1 -1
- package/dist/client/assets/{general-axIGxWAv.js → general-rmW6kn_q.js} +1 -1
- package/dist/client/assets/{generate-id-0beDKMoR.js → generate-id-B0hqIne-.js} +1 -1
- package/dist/client/assets/{grid-view-VGzy6bo9.js → grid-view-SzsDCBqX.js} +1 -1
- package/dist/client/assets/{home-ED4EKgWV.js → home-BW8Jzf61.js} +1 -1
- package/dist/client/assets/{index-DxFKywdp.js → index--68a591R.js} +1 -1
- package/dist/client/assets/{index-Be3yjubl.js → index-B3DLUye8.js} +1 -1
- package/dist/client/assets/{index-CDessA1I.js → index-Bf3XZpZk.js} +1 -1
- package/dist/client/assets/{index-JasJqXzm.js → index-BsYB-j4p.js} +1 -1
- package/dist/client/assets/{index-VZp2CIbR.js → index-C45O1mgu.js} +1 -1
- package/dist/client/assets/{index-DQTOgFOw.js → index-CJ0BaJHY.js} +1 -1
- package/dist/client/assets/{index-BfJLXP0j.js → index-CNQ1T_R3.js} +1 -1
- package/dist/client/assets/{index-DqQdLYr7.js → index-Ca6dFB6s.js} +1 -1
- package/dist/client/assets/{index-C2aMuEoP.js → index-CyaqcTbn.js} +1 -1
- package/dist/client/assets/{index-BjxqoU_w.js → index-Di6oLb1g.js} +3 -3
- package/dist/client/assets/{index-DsV3YD3P.js → index-SfPPYQt8.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-C0OPB4rx.js → infiniteQueryObserver-Cg7Qn-Py.js} +1 -1
- package/dist/client/assets/{input-Be0bLLQW.js → input-DQ4QcwHR.js} +1 -1
- package/dist/client/assets/{integration-icon-C9ac9VOj.js → integration-icon-DlCg0T4C.js} +1 -1
- package/dist/client/assets/{label-C6smVCIk.js → label-BGeQL0ka.js} +1 -1
- package/dist/client/assets/{layout-D0N63fj1.js → layout-D6ZxqJKi.js} +1 -1
- package/dist/client/assets/{layout-CYi_63K3.js → layout-DtwUtGx0.js} +1 -1
- package/dist/client/assets/{login-B4SjGwXr.js → login-DlB4I5sp.js} +1 -1
- package/dist/client/assets/{logo-upload-DwLQLlu7.js → logo-upload-BtAPf8sp.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-BWF6RI84.js → mcp-app-renderer-Cg9Eew2n.js} +1 -1
- package/dist/client/assets/{mcp-server-card-ksfI1Eyh.js → mcp-server-card-4V1eOOTX.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-Cb-T_-Mb.js → mcp-server-detail-CX9gEsnH.js} +2 -2
- package/dist/client/assets/{members-DJ6DA7d5.js → members-D1cMWKgG.js} +1 -1
- package/dist/client/assets/{monaco-editor-D0GS_D3E.js → monaco-editor-DnqhgBvh.js} +1 -1
- package/dist/client/assets/{monitoring-osT0IqjS.js → monitoring-BQpDfDrf.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-edit-Bxyyp3mT.js → monitoring-dashboard-edit-Cbicjk63.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-view-D1jhpkzD.js → monitoring-dashboard-view-Ci-RFMRb.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BzJ0yham.js → monitoring-stats-row-vvMdV41p.js} +1 -1
- package/dist/client/assets/{oauth-callback-B9dLIXA2.js → oauth-callback-DIjSwsej.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-mFsE32vf.js → oauth-callback-ai-provider-Dh3KWtZ6.js} +1 -1
- package/dist/client/assets/{org-ai-providers-UG6FIdxB.js → org-ai-providers-DGjdQR3W.js} +1 -1
- package/dist/client/assets/{page-C4W1F739.js → page-DCh64rPG.js} +1 -1
- package/dist/client/assets/{page-Drtt1B9w.js → page-DqLtxYci.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-C-XfLac2.js → plugin-empty-state-DXF12w3Y.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-C7t75jMS.js → plugin-empty-state-KrWE8h_c.js} +1 -1
- package/dist/client/assets/{plugin-header-BJKUaApF.js → plugin-header-BRNld0B2.js} +1 -1
- package/dist/client/assets/{plugin-header-5ST0P5Q7.js → plugin-header-CxhFSwvz.js} +1 -1
- package/dist/client/assets/plugins-BVx4W74m.js +1 -0
- package/dist/client/assets/{popover-Dn0X9Fr1.js → popover-DnP50c_4.js} +1 -1
- package/dist/client/assets/{project-app-view-CcUsagsx.js → project-app-view-BjmqGgdc.js} +1 -1
- package/dist/client/assets/{project-layout-D9UABDEG.js → project-layout-B0N0-1u8.js} +1 -1
- package/dist/client/assets/{project-plugins-B2zBuBKC.js → project-plugins-W6YBdGTQ.js} +1 -1
- package/dist/client/assets/{projects-list-BWN1T4nW.js → projects-list-x0gTe3hu.js} +1 -1
- package/dist/client/assets/{registry-layout-tQMWJSmp.js → registry-layout-CCApya06.js} +1 -1
- package/dist/client/assets/{registry-utils-CVkiAvdy.js → registry-utils-B2MGgFdM.js} +1 -1
- package/dist/client/assets/{reset-password-DJ4VaB6B.js → reset-password-BGRs1AsG.js} +1 -1
- package/dist/client/assets/{resizable-BD6CMEjd.js → resizable-BUdS0TeH.js} +1 -1
- package/dist/client/assets/{save-actions-BFbH4lFH.js → save-actions-CZB_80fx.js} +1 -1
- package/dist/client/assets/{scroll-area-VqeDMOPN.js → scroll-area-BDvsWD3_.js} +1 -1
- package/dist/client/assets/{select-VEJvYQo7.js → select-DE6nOtq4.js} +1 -1
- package/dist/client/assets/{select-virtual-mcp-BVFbfMoH.js → select-virtual-mcp-BcDL714M.js} +1 -1
- package/dist/client/assets/{shell-layout-lPP98AcT.js → shell-layout-dlpBTl1V.js} +2 -2
- package/dist/client/assets/{sidebar-settings-Cvi9DQQC.js → sidebar-settings-DvmipHRI.js} +1 -1
- package/dist/client/assets/{skeleton-HKYMRn58.js → skeleton-jHSQmvNz.js} +1 -1
- package/dist/client/assets/{spinner-BFdTwge6.js → spinner-uIlWy8Tn.js} +1 -1
- package/dist/client/assets/{store-invite-BqHShMlA.js → store-invite-hyBdEV4m.js} +1 -1
- package/dist/client/assets/{switch-CG6Wlm7Y.js → switch-DqoVcDTw.js} +1 -1
- package/dist/client/assets/{table-C915-j5j.js → table-BtUXt-LB.js} +1 -1
- package/dist/client/assets/{tabs-EJf8mrdN.js → tabs-Co0v-Gtu.js} +1 -1
- package/dist/client/assets/{task-status-DwSGaLCq.js → task-status-mBvgK6CE.js} +5 -3
- package/dist/client/assets/tasks-D2ul5DI6.js +1 -0
- package/dist/client/assets/{tasks-panel-j-1pM09U.js → tasks-panel-CKxWhrpo.js} +1 -1
- package/dist/client/assets/{textarea-BpJcJgEu.js → textarea-DK_nHNH9.js} +1 -1
- package/dist/client/assets/{time-range-picker-CBrng89O.js → time-range-picker-Dq2GzTz_.js} +1 -1
- package/dist/client/assets/{toggle-group-D3jOZx6Z.js → toggle-group-C2i_WN24.js} +1 -1
- package/dist/client/assets/{tools-list-BJKvrBYn.js → tools-list-SO4mO2yz.js} +1 -1
- package/dist/client/assets/{tooltip-SqkLa6wk.js → tooltip-Bt2vWRpT.js} +1 -1
- package/dist/client/assets/{topbar-portal-Ul2d-lg1.js → topbar-portal-C9UZ6_6p.js} +1 -1
- package/dist/client/assets/{types-CdHbWvSx.js → types-C4sVrknd.js} +1 -1
- package/dist/client/assets/{use-automations-xjYa92g6.js → use-automations-DgVOPvmM.js} +1 -1
- package/dist/client/assets/{use-collections-Zp8eOwPm.js → use-collections-CojcRvND.js} +1 -1
- package/dist/client/assets/{use-connection-B-vgK3kN.js → use-connection-CJIltDo3.js} +1 -1
- package/dist/client/assets/{use-copy-Bor2cPit.js → use-copy-_cPtrtTH.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-DLLVUJBK.js → use-create-virtual-mcp-D7i1HcQg.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-QweqoXs4.js → use-infinite-scroll-xFnZb5m2.js} +1 -1
- package/dist/client/assets/{use-install-from-registry-BWF2XusE.js → use-install-from-registry-BUPQMjUV.js} +1 -1
- package/dist/client/assets/{use-list-state-BpX2jytt.js → use-list-state-Bp_aU4BI.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-qi4FHPHh.js → use-mcp-prompts-zeDoy0Xo.js} +1 -1
- package/dist/client/assets/{use-mcp-resources-B8ERGBbF.js → use-mcp-resources-BIFxFRhN.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DNLvgz5O.js → use-mcp-tools-BD0zsUGc.js} +1 -1
- package/dist/client/assets/{use-members-CcTYAvXH.js → use-members-CbUEMp3B.js} +1 -1
- package/dist/client/assets/{use-project-D_8V3WFM.js → use-project-BVkW8l1T.js} +1 -1
- package/dist/client/assets/{use-store-discovery-iIFblh2E.js → use-store-discovery-Dr1RNWE5.js} +1 -1
- package/dist/client/assets/{use-view-mode-BBlaOBUn.js → use-view-mode-DNywUlq7.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BnUWdVw5.js → use-virtual-mcp-BdGbK3Wg.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BKFOAK_4.js +1 -0
- package/dist/client/assets/{useMutation-oWI4nFQG.js → useMutation-BOcaN318.js} +1 -1
- package/dist/client/assets/useQuery-BrfnS-T_.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-XlSq2d-l.js +1 -0
- package/dist/client/assets/{user-BtGr8jKI.js → user-BdXDOTfV.js} +1 -1
- package/dist/client/assets/{workflow-CKtu7TZc.js → workflow-C2zJzxLb.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/node_modules/xtend/.jshintrc +30 -0
- package/dist/server/node_modules/{postgres-bytea/license → xtend/LICENSE} +1 -2
- package/dist/server/node_modules/xtend/README.md +32 -0
- package/dist/server/node_modules/xtend/immutable.js +19 -0
- package/dist/server/node_modules/xtend/mutable.js +17 -0
- package/dist/server/node_modules/xtend/package.json +55 -0
- package/dist/server/node_modules/xtend/test.js +103 -0
- package/package.json +1 -1
- package/dist/client/assets/plugins-EgDqBTdv.js +0 -1
- package/dist/client/assets/tasks-B-KbBDgd.js +0 -1
- package/dist/client/assets/useInfiniteQuery-KvMZbxSR.js +0 -1
- package/dist/client/assets/useQuery-CmP1G4DA.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-4eRk30PP.js +0 -1
- package/dist/server/node_modules/async-exit-hook/CHANGELOG.md +0 -62
- package/dist/server/node_modules/async-exit-hook/index.js +0 -171
- package/dist/server/node_modules/async-exit-hook/license +0 -21
- package/dist/server/node_modules/async-exit-hook/package.json +0 -66
- package/dist/server/node_modules/async-exit-hook/readme.md +0 -118
- package/dist/server/node_modules/pg-int8/LICENSE +0 -13
- package/dist/server/node_modules/pg-int8/README.md +0 -16
- package/dist/server/node_modules/pg-int8/index.js +0 -100
- package/dist/server/node_modules/pg-int8/package.json +0 -24
- package/dist/server/node_modules/postgres-bytea/index.js +0 -33
- package/dist/server/node_modules/postgres-bytea/package.json +0 -34
- package/dist/server/node_modules/postgres-bytea/readme.md +0 -34
- package/dist/server/node_modules/postgres-date/index.js +0 -116
- package/dist/server/node_modules/postgres-date/license +0 -21
- package/dist/server/node_modules/postgres-date/package.json +0 -33
- package/dist/server/node_modules/postgres-date/readme.md +0 -49
- package/dist/server/node_modules/postgres-interval/index.d.ts +0 -20
- package/dist/server/node_modules/postgres-interval/index.js +0 -125
- package/dist/server/node_modules/postgres-interval/license +0 -21
- package/dist/server/node_modules/postgres-interval/package.json +0 -36
- package/dist/server/node_modules/postgres-interval/readme.md +0 -48
- package/dist/server/node_modules/split2/LICENSE +0 -13
- package/dist/server/node_modules/split2/README.md +0 -85
- package/dist/server/node_modules/split2/bench.js +0 -27
- package/dist/server/node_modules/split2/index.js +0 -141
- package/dist/server/node_modules/split2/package.json +0 -39
- package/dist/server/node_modules/split2/test.js +0 -409
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
var DATE_TIME = /(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/
|
|
4
|
-
var DATE = /^(\d{1,})-(\d{2})-(\d{2})( BC)?$/
|
|
5
|
-
var TIME_ZONE = /([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/
|
|
6
|
-
var INFINITY = /^-?infinity$/
|
|
7
|
-
|
|
8
|
-
module.exports = function parseDate (isoDate) {
|
|
9
|
-
if (INFINITY.test(isoDate)) {
|
|
10
|
-
// Capitalize to Infinity before passing to Number
|
|
11
|
-
return Number(isoDate.replace('i', 'I'))
|
|
12
|
-
}
|
|
13
|
-
var matches = DATE_TIME.exec(isoDate)
|
|
14
|
-
|
|
15
|
-
if (!matches) {
|
|
16
|
-
// Force YYYY-MM-DD dates to be parsed as local time
|
|
17
|
-
return getDate(isoDate) || null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var isBC = !!matches[8]
|
|
21
|
-
var year = parseInt(matches[1], 10)
|
|
22
|
-
if (isBC) {
|
|
23
|
-
year = bcYearToNegativeYear(year)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
var month = parseInt(matches[2], 10) - 1
|
|
27
|
-
var day = matches[3]
|
|
28
|
-
var hour = parseInt(matches[4], 10)
|
|
29
|
-
var minute = parseInt(matches[5], 10)
|
|
30
|
-
var second = parseInt(matches[6], 10)
|
|
31
|
-
|
|
32
|
-
var ms = matches[7]
|
|
33
|
-
ms = ms ? 1000 * parseFloat(ms) : 0
|
|
34
|
-
|
|
35
|
-
var date
|
|
36
|
-
var offset = timeZoneOffset(isoDate)
|
|
37
|
-
if (offset != null) {
|
|
38
|
-
date = new Date(Date.UTC(year, month, day, hour, minute, second, ms))
|
|
39
|
-
|
|
40
|
-
// Account for years from 0 to 99 being interpreted as 1900-1999
|
|
41
|
-
// by Date.UTC / the multi-argument form of the Date constructor
|
|
42
|
-
if (is0To99(year)) {
|
|
43
|
-
date.setUTCFullYear(year)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (offset !== 0) {
|
|
47
|
-
date.setTime(date.getTime() - offset)
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
date = new Date(year, month, day, hour, minute, second, ms)
|
|
51
|
-
|
|
52
|
-
if (is0To99(year)) {
|
|
53
|
-
date.setFullYear(year)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return date
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function getDate (isoDate) {
|
|
61
|
-
var matches = DATE.exec(isoDate)
|
|
62
|
-
if (!matches) {
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
var year = parseInt(matches[1], 10)
|
|
67
|
-
var isBC = !!matches[4]
|
|
68
|
-
if (isBC) {
|
|
69
|
-
year = bcYearToNegativeYear(year)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
var month = parseInt(matches[2], 10) - 1
|
|
73
|
-
var day = matches[3]
|
|
74
|
-
// YYYY-MM-DD will be parsed as local time
|
|
75
|
-
var date = new Date(year, month, day)
|
|
76
|
-
|
|
77
|
-
if (is0To99(year)) {
|
|
78
|
-
date.setFullYear(year)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return date
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// match timezones:
|
|
85
|
-
// Z (UTC)
|
|
86
|
-
// -05
|
|
87
|
-
// +06:30
|
|
88
|
-
function timeZoneOffset (isoDate) {
|
|
89
|
-
if (isoDate.endsWith('+00')) {
|
|
90
|
-
return 0
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
var zone = TIME_ZONE.exec(isoDate.split(' ')[1])
|
|
94
|
-
if (!zone) return
|
|
95
|
-
var type = zone[1]
|
|
96
|
-
|
|
97
|
-
if (type === 'Z') {
|
|
98
|
-
return 0
|
|
99
|
-
}
|
|
100
|
-
var sign = type === '-' ? -1 : 1
|
|
101
|
-
var offset = parseInt(zone[2], 10) * 3600 +
|
|
102
|
-
parseInt(zone[3] || 0, 10) * 60 +
|
|
103
|
-
parseInt(zone[4] || 0, 10)
|
|
104
|
-
|
|
105
|
-
return offset * sign * 1000
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function bcYearToNegativeYear (year) {
|
|
109
|
-
// Account for numerical difference between representations of BC years
|
|
110
|
-
// See: https://github.com/bendrucker/postgres-date/issues/5
|
|
111
|
-
return -(year - 1)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function is0To99 (num) {
|
|
115
|
-
return num >= 0 && num < 100
|
|
116
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) Ben Drucker <bvdrucker@gmail.com> (bendrucker.me)
|
|
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
|
|
13
|
-
all 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
|
|
21
|
-
THE SOFTWARE.
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "postgres-date",
|
|
3
|
-
"main": "index.js",
|
|
4
|
-
"version": "1.0.7",
|
|
5
|
-
"description": "Postgres date column parser",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"repository": "bendrucker/postgres-date",
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "Ben Drucker",
|
|
10
|
-
"email": "bvdrucker@gmail.com",
|
|
11
|
-
"url": "bendrucker.me"
|
|
12
|
-
},
|
|
13
|
-
"engines": {
|
|
14
|
-
"node": ">=0.10.0"
|
|
15
|
-
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"test": "standard && tape test.js"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"postgres",
|
|
21
|
-
"date",
|
|
22
|
-
"parser"
|
|
23
|
-
],
|
|
24
|
-
"dependencies": {},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"standard": "^14.0.0",
|
|
27
|
-
"tape": "^5.0.0"
|
|
28
|
-
},
|
|
29
|
-
"files": [
|
|
30
|
-
"index.js",
|
|
31
|
-
"readme.md"
|
|
32
|
-
]
|
|
33
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# postgres-date [](https://travis-ci.org/bendrucker/postgres-date) [](https://greenkeeper.io/)
|
|
2
|
-
|
|
3
|
-
> Postgres date output parser
|
|
4
|
-
|
|
5
|
-
This package parses [date/time outputs](https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT) from Postgres into Javascript `Date` objects. Its goal is to match Postgres behavior and preserve data accuracy.
|
|
6
|
-
|
|
7
|
-
If you find a case where a valid Postgres output results in incorrect parsing (including loss of precision), please [create a pull request](https://github.com/bendrucker/postgres-date/compare) and provide a failing test.
|
|
8
|
-
|
|
9
|
-
**Supported Postgres Versions:** `>= 9.6`
|
|
10
|
-
|
|
11
|
-
All prior versions of Postgres are likely compatible but not officially supported.
|
|
12
|
-
|
|
13
|
-
## Install
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
$ npm install --save postgres-date
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## Usage
|
|
21
|
-
|
|
22
|
-
```js
|
|
23
|
-
var parse = require('postgres-date')
|
|
24
|
-
parse('2011-01-23 22:15:51Z')
|
|
25
|
-
// => 2011-01-23T22:15:51.000Z
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## API
|
|
29
|
-
|
|
30
|
-
#### `parse(isoDate)` -> `date`
|
|
31
|
-
|
|
32
|
-
##### isoDate
|
|
33
|
-
|
|
34
|
-
*Required*
|
|
35
|
-
Type: `string`
|
|
36
|
-
|
|
37
|
-
A date string from Postgres.
|
|
38
|
-
|
|
39
|
-
## Releases
|
|
40
|
-
|
|
41
|
-
The following semantic versioning increments will be used for changes:
|
|
42
|
-
|
|
43
|
-
* **Major**: Removal of support for Node.js versions or Postgres versions (not expected)
|
|
44
|
-
* **Minor**: Unused, since Postgres returns dates in standard ISO 8601 format
|
|
45
|
-
* **Patch**: Any fix for parsing behavior
|
|
46
|
-
|
|
47
|
-
## License
|
|
48
|
-
|
|
49
|
-
MIT © [Ben Drucker](http://bendrucker.me)
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
declare namespace PostgresInterval {
|
|
2
|
-
export interface IPostgresInterval {
|
|
3
|
-
years?: number;
|
|
4
|
-
months?: number;
|
|
5
|
-
days?: number;
|
|
6
|
-
hours?: number;
|
|
7
|
-
minutes?: number;
|
|
8
|
-
seconds?: number;
|
|
9
|
-
milliseconds?: number;
|
|
10
|
-
|
|
11
|
-
toPostgres(): string;
|
|
12
|
-
|
|
13
|
-
toISO(): string;
|
|
14
|
-
toISOString(): string;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
declare function PostgresInterval(raw: string): PostgresInterval.IPostgresInterval;
|
|
19
|
-
|
|
20
|
-
export = PostgresInterval;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
var extend = require('xtend/mutable')
|
|
4
|
-
|
|
5
|
-
module.exports = PostgresInterval
|
|
6
|
-
|
|
7
|
-
function PostgresInterval (raw) {
|
|
8
|
-
if (!(this instanceof PostgresInterval)) {
|
|
9
|
-
return new PostgresInterval(raw)
|
|
10
|
-
}
|
|
11
|
-
extend(this, parse(raw))
|
|
12
|
-
}
|
|
13
|
-
var properties = ['seconds', 'minutes', 'hours', 'days', 'months', 'years']
|
|
14
|
-
PostgresInterval.prototype.toPostgres = function () {
|
|
15
|
-
var filtered = properties.filter(this.hasOwnProperty, this)
|
|
16
|
-
|
|
17
|
-
// In addition to `properties`, we need to account for fractions of seconds.
|
|
18
|
-
if (this.milliseconds && filtered.indexOf('seconds') < 0) {
|
|
19
|
-
filtered.push('seconds')
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (filtered.length === 0) return '0'
|
|
23
|
-
return filtered
|
|
24
|
-
.map(function (property) {
|
|
25
|
-
var value = this[property] || 0
|
|
26
|
-
|
|
27
|
-
// Account for fractional part of seconds,
|
|
28
|
-
// remove trailing zeroes.
|
|
29
|
-
if (property === 'seconds' && this.milliseconds) {
|
|
30
|
-
value = (value + this.milliseconds / 1000).toFixed(6).replace(/\.?0+$/, '')
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return value + ' ' + property
|
|
34
|
-
}, this)
|
|
35
|
-
.join(' ')
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var propertiesISOEquivalent = {
|
|
39
|
-
years: 'Y',
|
|
40
|
-
months: 'M',
|
|
41
|
-
days: 'D',
|
|
42
|
-
hours: 'H',
|
|
43
|
-
minutes: 'M',
|
|
44
|
-
seconds: 'S'
|
|
45
|
-
}
|
|
46
|
-
var dateProperties = ['years', 'months', 'days']
|
|
47
|
-
var timeProperties = ['hours', 'minutes', 'seconds']
|
|
48
|
-
// according to ISO 8601
|
|
49
|
-
PostgresInterval.prototype.toISOString = PostgresInterval.prototype.toISO = function () {
|
|
50
|
-
var datePart = dateProperties
|
|
51
|
-
.map(buildProperty, this)
|
|
52
|
-
.join('')
|
|
53
|
-
|
|
54
|
-
var timePart = timeProperties
|
|
55
|
-
.map(buildProperty, this)
|
|
56
|
-
.join('')
|
|
57
|
-
|
|
58
|
-
return 'P' + datePart + 'T' + timePart
|
|
59
|
-
|
|
60
|
-
function buildProperty (property) {
|
|
61
|
-
var value = this[property] || 0
|
|
62
|
-
|
|
63
|
-
// Account for fractional part of seconds,
|
|
64
|
-
// remove trailing zeroes.
|
|
65
|
-
if (property === 'seconds' && this.milliseconds) {
|
|
66
|
-
value = (value + this.milliseconds / 1000).toFixed(6).replace(/0+$/, '')
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return value + propertiesISOEquivalent[property]
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
var NUMBER = '([+-]?\\d+)'
|
|
74
|
-
var YEAR = NUMBER + '\\s+years?'
|
|
75
|
-
var MONTH = NUMBER + '\\s+mons?'
|
|
76
|
-
var DAY = NUMBER + '\\s+days?'
|
|
77
|
-
var TIME = '([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?'
|
|
78
|
-
var INTERVAL = new RegExp([YEAR, MONTH, DAY, TIME].map(function (regexString) {
|
|
79
|
-
return '(' + regexString + ')?'
|
|
80
|
-
})
|
|
81
|
-
.join('\\s*'))
|
|
82
|
-
|
|
83
|
-
// Positions of values in regex match
|
|
84
|
-
var positions = {
|
|
85
|
-
years: 2,
|
|
86
|
-
months: 4,
|
|
87
|
-
days: 6,
|
|
88
|
-
hours: 9,
|
|
89
|
-
minutes: 10,
|
|
90
|
-
seconds: 11,
|
|
91
|
-
milliseconds: 12
|
|
92
|
-
}
|
|
93
|
-
// We can use negative time
|
|
94
|
-
var negatives = ['hours', 'minutes', 'seconds', 'milliseconds']
|
|
95
|
-
|
|
96
|
-
function parseMilliseconds (fraction) {
|
|
97
|
-
// add omitted zeroes
|
|
98
|
-
var microseconds = fraction + '000000'.slice(fraction.length)
|
|
99
|
-
return parseInt(microseconds, 10) / 1000
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function parse (interval) {
|
|
103
|
-
if (!interval) return {}
|
|
104
|
-
var matches = INTERVAL.exec(interval)
|
|
105
|
-
var isNegative = matches[8] === '-'
|
|
106
|
-
return Object.keys(positions)
|
|
107
|
-
.reduce(function (parsed, property) {
|
|
108
|
-
var position = positions[property]
|
|
109
|
-
var value = matches[position]
|
|
110
|
-
// no empty string
|
|
111
|
-
if (!value) return parsed
|
|
112
|
-
// milliseconds are actually microseconds (up to 6 digits)
|
|
113
|
-
// with omitted trailing zeroes.
|
|
114
|
-
value = property === 'milliseconds'
|
|
115
|
-
? parseMilliseconds(value)
|
|
116
|
-
: parseInt(value, 10)
|
|
117
|
-
// no zeros
|
|
118
|
-
if (!value) return parsed
|
|
119
|
-
if (isNegative && ~negatives.indexOf(property)) {
|
|
120
|
-
value *= -1
|
|
121
|
-
}
|
|
122
|
-
parsed[property] = value
|
|
123
|
-
return parsed
|
|
124
|
-
}, {})
|
|
125
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) Ben Drucker <bvdrucker@gmail.com> (bendrucker.me)
|
|
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
|
|
13
|
-
all 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
|
|
21
|
-
THE SOFTWARE.
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "postgres-interval",
|
|
3
|
-
"main": "index.js",
|
|
4
|
-
"version": "1.2.0",
|
|
5
|
-
"description": "Parse Postgres interval columns",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"repository": "bendrucker/postgres-interval",
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "Ben Drucker",
|
|
10
|
-
"email": "bvdrucker@gmail.com",
|
|
11
|
-
"url": "bendrucker.me"
|
|
12
|
-
},
|
|
13
|
-
"engines": {
|
|
14
|
-
"node": ">=0.10.0"
|
|
15
|
-
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"test": "standard && tape test.js"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"postgres",
|
|
21
|
-
"interval",
|
|
22
|
-
"parser"
|
|
23
|
-
],
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"xtend": "^4.0.0"
|
|
26
|
-
},
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"tape": "^4.0.0",
|
|
29
|
-
"standard": "^12.0.1"
|
|
30
|
-
},
|
|
31
|
-
"files": [
|
|
32
|
-
"index.js",
|
|
33
|
-
"index.d.ts",
|
|
34
|
-
"readme.md"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# postgres-interval [](https://travis-ci.org/bendrucker/postgres-interval) [](https://greenkeeper.io/)
|
|
2
|
-
|
|
3
|
-
> Parse Postgres interval columns
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## Install
|
|
7
|
-
|
|
8
|
-
```
|
|
9
|
-
$ npm install --save postgres-interval
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
var parse = require('postgres-interval')
|
|
17
|
-
var interval = parse('01:02:03')
|
|
18
|
-
//=> {hours: 1, minutes: 2, seconds: 3}
|
|
19
|
-
interval.toPostgres()
|
|
20
|
-
// 3 seconds 2 minutes 1 hours
|
|
21
|
-
interval.toISO()
|
|
22
|
-
// P0Y0M0DT1H2M3S
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## API
|
|
26
|
-
|
|
27
|
-
#### `parse(pgInterval)` -> `interval`
|
|
28
|
-
|
|
29
|
-
##### pgInterval
|
|
30
|
-
|
|
31
|
-
*Required*
|
|
32
|
-
Type: `string`
|
|
33
|
-
|
|
34
|
-
A Postgres interval string.
|
|
35
|
-
|
|
36
|
-
#### `interval.toPostgres()` -> `string`
|
|
37
|
-
|
|
38
|
-
Returns an interval string. This allows the interval object to be passed into prepared statements.
|
|
39
|
-
|
|
40
|
-
#### `interval.toISOString()` -> `string`
|
|
41
|
-
|
|
42
|
-
Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string.
|
|
43
|
-
|
|
44
|
-
Also available as `interval.toISO()` for backwards compatibility.
|
|
45
|
-
|
|
46
|
-
## License
|
|
47
|
-
|
|
48
|
-
MIT © [Ben Drucker](http://bendrucker.me)
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2014-2018, Matteo Collina <hello@matteocollina.com>
|
|
2
|
-
|
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
5
|
-
copyright notice and this permission notice appear in all copies.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
8
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
9
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
10
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
11
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
12
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
13
|
-
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# Split2(matcher, mapper, options)
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
Break up a stream and reassemble it so that each line is a chunk.
|
|
6
|
-
`split2` is inspired by [@dominictarr](https://github.com/dominictarr) [`split`](https://github.com/dominictarr/split) module,
|
|
7
|
-
and it is totally API compatible with it.
|
|
8
|
-
However, it is based on Node.js core [`Transform`](https://nodejs.org/api/stream.html#stream_new_stream_transform_options).
|
|
9
|
-
|
|
10
|
-
`matcher` may be a `String`, or a `RegExp`. Example, read every line in a file ...
|
|
11
|
-
|
|
12
|
-
``` js
|
|
13
|
-
fs.createReadStream(file)
|
|
14
|
-
.pipe(split2())
|
|
15
|
-
.on('data', function (line) {
|
|
16
|
-
//each chunk now is a separate line!
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
`split` takes the same arguments as `string.split` except it defaults to '/\r?\n/', and the optional `limit` paremeter is ignored.
|
|
22
|
-
[String#split](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split)
|
|
23
|
-
|
|
24
|
-
`split` takes an optional options object on it's third argument, which
|
|
25
|
-
is directly passed as a
|
|
26
|
-
[Transform](https://nodejs.org/api/stream.html#stream_new_stream_transform_options)
|
|
27
|
-
option.
|
|
28
|
-
|
|
29
|
-
Additionally, the `.maxLength` and `.skipOverflow` options are implemented, which set limits on the internal
|
|
30
|
-
buffer size and the stream's behavior when the limit is exceeded. There is no limit unless `maxLength` is set. When
|
|
31
|
-
the internal buffer size exceeds `maxLength`, the stream emits an error by default. You may also set `skipOverflow` to
|
|
32
|
-
true to suppress the error and instead skip past any lines that cause the internal buffer to exceed `maxLength`.
|
|
33
|
-
|
|
34
|
-
Calling `.destroy` will make the stream emit `close`. Use this to perform cleanup logic
|
|
35
|
-
|
|
36
|
-
``` js
|
|
37
|
-
var splitFile = function(filename) {
|
|
38
|
-
var file = fs.createReadStream(filename)
|
|
39
|
-
|
|
40
|
-
return file
|
|
41
|
-
.pipe(split2())
|
|
42
|
-
.on('close', function() {
|
|
43
|
-
// destroy the file stream in case the split stream was destroyed
|
|
44
|
-
file.destroy()
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
var stream = splitFile('my-file.txt')
|
|
49
|
-
|
|
50
|
-
stream.destroy() // will destroy the input file stream
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
# NDJ - Newline Delimited Json
|
|
54
|
-
|
|
55
|
-
`split2` accepts a function which transforms each line.
|
|
56
|
-
|
|
57
|
-
``` js
|
|
58
|
-
fs.createReadStream(file)
|
|
59
|
-
.pipe(split2(JSON.parse))
|
|
60
|
-
.on('data', function (obj) {
|
|
61
|
-
//each chunk now is a js object
|
|
62
|
-
})
|
|
63
|
-
.on("error", function(error) {
|
|
64
|
-
//handling parsing errors
|
|
65
|
-
})
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
However, in [@dominictarr](https://github.com/dominictarr) [`split`](https://github.com/dominictarr/split) the mapper
|
|
69
|
-
is wrapped in a try-catch, while here it is not: if your parsing logic can throw, wrap it yourself. Otherwise, you can also use the stream error handling when mapper function throw.
|
|
70
|
-
|
|
71
|
-
# License
|
|
72
|
-
|
|
73
|
-
Copyright (c) 2014-2021, Matteo Collina <hello@matteocollina.com>
|
|
74
|
-
|
|
75
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
76
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
77
|
-
copyright notice and this permission notice appear in all copies.
|
|
78
|
-
|
|
79
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
80
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
81
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
82
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
83
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
84
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
85
|
-
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const split = require('./')
|
|
4
|
-
const bench = require('fastbench')
|
|
5
|
-
const binarySplit = require('binary-split')
|
|
6
|
-
const fs = require('fs')
|
|
7
|
-
|
|
8
|
-
function benchSplit (cb) {
|
|
9
|
-
fs.createReadStream('package.json')
|
|
10
|
-
.pipe(split())
|
|
11
|
-
.on('end', cb)
|
|
12
|
-
.resume()
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function benchBinarySplit (cb) {
|
|
16
|
-
fs.createReadStream('package.json')
|
|
17
|
-
.pipe(binarySplit())
|
|
18
|
-
.on('end', cb)
|
|
19
|
-
.resume()
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const run = bench([
|
|
23
|
-
benchSplit,
|
|
24
|
-
benchBinarySplit
|
|
25
|
-
], 10000)
|
|
26
|
-
|
|
27
|
-
run(run)
|