@cloudant/couchbackup 2.9.10-SNAPSHOT.113 → 2.9.10
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/.scannerwork/report-task.txt +2 -2
- package/.scannerwork/scanner-report/analysis-warnings.pb +2 -2
- package/.scannerwork/scanner-report/analysis.log +1 -1
- package/.scannerwork/scanner-report/changesets-12.pb +1 -0
- package/.scannerwork/scanner-report/changesets-13.pb +1 -0
- package/.scannerwork/scanner-report/changesets-2.pb +1 -0
- package/.scannerwork/scanner-report/changesets-28.pb +1 -0
- package/.scannerwork/scanner-report/changesets-29.pb +1 -0
- package/.scannerwork/scanner-report/changesets-3.pb +1 -0
- package/.scannerwork/scanner-report/changesets-31.pb +1 -0
- package/.scannerwork/scanner-report/changesets-34.pb +1 -0
- package/.scannerwork/scanner-report/changesets-35.pb +1 -0
- package/.scannerwork/scanner-report/changesets-4.pb +1 -0
- package/.scannerwork/scanner-report/changesets-67.pb +1 -0
- package/.scannerwork/scanner-report/changesets-68.pb +1 -0
- package/.scannerwork/scanner-report/changesets-7.pb +1 -0
- package/.scannerwork/scanner-report/changesets-8.pb +1 -0
- package/.scannerwork/scanner-report/component-1.pb +2 -2
- package/.scannerwork/scanner-report/component-10.pb +1 -1
- package/.scannerwork/scanner-report/component-11.pb +1 -1
- package/.scannerwork/scanner-report/component-12.pb +1 -0
- package/.scannerwork/scanner-report/component-13.pb +1 -1
- package/.scannerwork/scanner-report/component-14.pb +1 -1
- package/.scannerwork/scanner-report/component-19.pb +1 -1
- package/.scannerwork/scanner-report/component-2.pb +1 -0
- package/.scannerwork/scanner-report/component-20.pb +1 -1
- package/.scannerwork/scanner-report/component-21.pb +1 -1
- package/.scannerwork/scanner-report/component-22.pb +1 -1
- package/.scannerwork/scanner-report/component-23.pb +1 -1
- package/.scannerwork/scanner-report/component-24.pb +1 -1
- package/.scannerwork/scanner-report/component-25.pb +1 -1
- package/.scannerwork/scanner-report/component-26.pb +1 -1
- package/.scannerwork/scanner-report/component-27.pb +1 -1
- package/.scannerwork/scanner-report/component-28.pb +1 -0
- package/.scannerwork/scanner-report/component-29.pb +1 -0
- package/.scannerwork/scanner-report/component-3.pb +1 -0
- package/.scannerwork/scanner-report/component-30.pb +1 -1
- package/.scannerwork/scanner-report/component-31.pb +1 -0
- package/.scannerwork/scanner-report/component-32.pb +1 -1
- package/.scannerwork/scanner-report/component-33.pb +1 -1
- package/.scannerwork/scanner-report/component-34.pb +1 -0
- package/.scannerwork/scanner-report/component-35.pb +1 -0
- package/.scannerwork/scanner-report/component-4.pb +1 -0
- package/.scannerwork/scanner-report/component-47.pb +1 -1
- package/.scannerwork/scanner-report/component-48.pb +1 -1
- package/.scannerwork/scanner-report/component-49.pb +1 -1
- package/.scannerwork/scanner-report/component-5.pb +1 -1
- package/.scannerwork/scanner-report/component-50.pb +1 -1
- package/.scannerwork/scanner-report/component-51.pb +1 -1
- package/.scannerwork/scanner-report/component-52.pb +1 -1
- package/.scannerwork/scanner-report/component-54.pb +1 -1
- package/.scannerwork/scanner-report/component-56.pb +1 -1
- package/.scannerwork/scanner-report/component-59.pb +1 -1
- package/.scannerwork/scanner-report/component-6.pb +1 -1
- package/.scannerwork/scanner-report/component-60.pb +1 -1
- package/.scannerwork/scanner-report/component-65.pb +1 -0
- package/.scannerwork/scanner-report/component-66.pb +1 -0
- package/.scannerwork/scanner-report/component-67.pb +1 -1
- package/.scannerwork/scanner-report/component-68.pb +1 -1
- package/.scannerwork/scanner-report/component-7.pb +1 -0
- package/.scannerwork/scanner-report/component-8.pb +1 -0
- package/.scannerwork/scanner-report/component-9.pb +1 -1
- package/.scannerwork/scanner-report/coverages-10.pb +0 -0
- package/.scannerwork/scanner-report/coverages-11.pb +0 -0
- package/.scannerwork/scanner-report/coverages-13.pb +0 -0
- package/.scannerwork/scanner-report/coverages-14.pb +0 -0
- package/.scannerwork/scanner-report/coverages-19.pb +0 -0
- package/.scannerwork/scanner-report/coverages-2.pb +0 -0
- package/.scannerwork/scanner-report/coverages-20.pb +0 -0
- package/.scannerwork/scanner-report/coverages-21.pb +0 -0
- package/.scannerwork/scanner-report/coverages-22.pb +0 -0
- package/.scannerwork/scanner-report/coverages-23.pb +0 -0
- package/.scannerwork/scanner-report/coverages-24.pb +0 -0
- package/.scannerwork/scanner-report/coverages-25.pb +0 -0
- package/.scannerwork/scanner-report/coverages-26.pb +0 -0
- package/.scannerwork/scanner-report/coverages-27.pb +0 -0
- package/.scannerwork/scanner-report/coverages-28.pb +0 -0
- package/.scannerwork/scanner-report/coverages-29.pb +0 -0
- package/.scannerwork/scanner-report/coverages-3.pb +0 -0
- package/.scannerwork/scanner-report/coverages-30.pb +0 -0
- package/.scannerwork/scanner-report/coverages-32.pb +0 -0
- package/.scannerwork/scanner-report/coverages-33.pb +0 -0
- package/.scannerwork/scanner-report/coverages-34.pb +0 -0
- package/.scannerwork/scanner-report/coverages-4.pb +0 -0
- package/.scannerwork/scanner-report/coverages-47.pb +0 -0
- package/.scannerwork/scanner-report/coverages-48.pb +0 -0
- package/.scannerwork/scanner-report/coverages-49.pb +0 -0
- package/.scannerwork/scanner-report/coverages-5.pb +0 -0
- package/.scannerwork/scanner-report/coverages-50.pb +0 -0
- package/.scannerwork/scanner-report/coverages-51.pb +0 -0
- package/.scannerwork/scanner-report/coverages-52.pb +0 -0
- package/.scannerwork/scanner-report/coverages-56.pb +0 -0
- package/.scannerwork/scanner-report/coverages-59.pb +0 -0
- package/.scannerwork/scanner-report/coverages-6.pb +0 -0
- package/.scannerwork/scanner-report/coverages-60.pb +0 -0
- package/.scannerwork/scanner-report/coverages-67.pb +0 -0
- package/.scannerwork/scanner-report/coverages-68.pb +0 -0
- package/.scannerwork/scanner-report/coverages-7.pb +0 -0
- package/.scannerwork/scanner-report/coverages-8.pb +0 -0
- package/.scannerwork/scanner-report/coverages-9.pb +0 -0
- package/.scannerwork/scanner-report/duplications-2.pb +2 -0
- package/.scannerwork/scanner-report/duplications-21.pb +3 -0
- package/.scannerwork/scanner-report/duplications-24.pb +0 -2
- package/.scannerwork/scanner-report/duplications-26.pb +0 -2
- package/.scannerwork/scanner-report/duplications-27.pb +2 -0
- package/.scannerwork/scanner-report/duplications-29.pb +2 -0
- package/.scannerwork/scanner-report/duplications-32.pb +3 -2
- package/.scannerwork/scanner-report/duplications-33.pb +0 -2
- package/.scannerwork/scanner-report/duplications-34.pb +2 -0
- package/.scannerwork/scanner-report/duplications-4.pb +2 -0
- package/.scannerwork/scanner-report/duplications-49.pb +0 -3
- package/.scannerwork/scanner-report/duplications-5.pb +0 -2
- package/.scannerwork/scanner-report/duplications-52.pb +3 -0
- package/.scannerwork/scanner-report/duplications-56.pb +0 -3
- package/.scannerwork/scanner-report/duplications-59.pb +2 -2
- package/.scannerwork/scanner-report/duplications-6.pb +0 -2
- package/.scannerwork/scanner-report/duplications-60.pb +2 -0
- package/.scannerwork/scanner-report/issues-21.pb +4 -0
- package/.scannerwork/scanner-report/issues-49.pb +5 -3
- package/.scannerwork/scanner-report/measures-10.pb +0 -0
- package/.scannerwork/scanner-report/measures-11.pb +0 -0
- package/.scannerwork/scanner-report/measures-13.pb +0 -0
- package/.scannerwork/scanner-report/measures-14.pb +0 -0
- package/.scannerwork/scanner-report/measures-19.pb +0 -0
- package/.scannerwork/scanner-report/measures-2.pb +0 -0
- package/.scannerwork/scanner-report/measures-20.pb +0 -0
- package/.scannerwork/scanner-report/measures-21.pb +0 -0
- package/.scannerwork/scanner-report/measures-22.pb +0 -0
- package/.scannerwork/scanner-report/measures-23.pb +0 -0
- package/.scannerwork/scanner-report/measures-24.pb +0 -0
- package/.scannerwork/scanner-report/measures-25.pb +0 -0
- package/.scannerwork/scanner-report/measures-26.pb +0 -0
- package/.scannerwork/scanner-report/measures-27.pb +0 -0
- package/.scannerwork/scanner-report/measures-28.pb +0 -0
- package/.scannerwork/scanner-report/measures-29.pb +15 -0
- package/.scannerwork/scanner-report/measures-3.pb +16 -0
- package/.scannerwork/scanner-report/measures-30.pb +0 -0
- package/.scannerwork/scanner-report/measures-32.pb +0 -0
- package/.scannerwork/scanner-report/measures-33.pb +0 -0
- package/.scannerwork/scanner-report/measures-34.pb +0 -0
- package/.scannerwork/scanner-report/measures-35.pb +0 -0
- package/.scannerwork/scanner-report/measures-4.pb +0 -0
- package/.scannerwork/scanner-report/measures-47.pb +0 -0
- package/.scannerwork/scanner-report/measures-48.pb +0 -0
- package/.scannerwork/scanner-report/measures-49.pb +0 -0
- package/.scannerwork/scanner-report/measures-5.pb +0 -0
- package/.scannerwork/scanner-report/measures-50.pb +0 -0
- package/.scannerwork/scanner-report/measures-51.pb +0 -0
- package/.scannerwork/scanner-report/measures-52.pb +0 -0
- package/.scannerwork/scanner-report/measures-54.pb +0 -0
- package/.scannerwork/scanner-report/measures-56.pb +0 -0
- package/.scannerwork/scanner-report/measures-59.pb +0 -0
- package/.scannerwork/scanner-report/measures-6.pb +0 -0
- package/.scannerwork/scanner-report/measures-60.pb +0 -0
- package/.scannerwork/scanner-report/measures-65.pb +0 -0
- package/.scannerwork/scanner-report/measures-66.pb +0 -0
- package/.scannerwork/scanner-report/measures-67.pb +0 -0
- package/.scannerwork/scanner-report/measures-68.pb +0 -0
- package/.scannerwork/scanner-report/measures-7.pb +0 -0
- package/.scannerwork/scanner-report/measures-8.pb +0 -0
- package/.scannerwork/scanner-report/measures-9.pb +0 -0
- package/.scannerwork/scanner-report/metadata.pb +0 -0
- package/.scannerwork/scanner-report/source-10.txt +257 -53
- package/.scannerwork/scanner-report/source-11.txt +100 -96
- package/.scannerwork/scanner-report/source-13.txt +129 -509
- package/.scannerwork/scanner-report/source-14.txt +83 -59
- package/.scannerwork/scanner-report/source-19.txt +88 -255
- package/.scannerwork/scanner-report/source-2.txt +75 -0
- package/.scannerwork/scanner-report/source-20.txt +20 -96
- package/.scannerwork/scanner-report/source-21.txt +228 -162
- package/.scannerwork/scanner-report/source-22.txt +22 -115
- package/.scannerwork/scanner-report/source-23.txt +584 -123
- package/.scannerwork/scanner-report/source-24.txt +18 -59
- package/.scannerwork/scanner-report/source-25.txt +142 -40
- package/.scannerwork/scanner-report/source-26.txt +132 -77
- package/.scannerwork/scanner-report/source-27.txt +124 -83
- package/.scannerwork/scanner-report/{source-62.txt → source-28.txt} +13 -6
- package/.scannerwork/scanner-report/source-29.txt +293 -0
- package/.scannerwork/scanner-report/source-3.txt +178 -0
- package/.scannerwork/scanner-report/source-30.txt +63 -389
- package/.scannerwork/scanner-report/source-32.txt +90 -252
- package/.scannerwork/scanner-report/source-33.txt +41 -118
- package/.scannerwork/scanner-report/source-34.txt +225 -0
- package/.scannerwork/scanner-report/source-35.txt +47 -0
- package/.scannerwork/scanner-report/source-4.txt +92 -0
- package/.scannerwork/scanner-report/source-47.txt +38 -11
- package/.scannerwork/scanner-report/source-48.txt +45 -133
- package/.scannerwork/scanner-report/source-49.txt +329 -207
- package/.scannerwork/scanner-report/source-5.txt +87 -166
- package/.scannerwork/scanner-report/source-50.txt +10 -347
- package/.scannerwork/scanner-report/source-51.txt +83 -19
- package/.scannerwork/scanner-report/source-52.txt +82 -31
- package/.scannerwork/scanner-report/source-54.txt +167 -47
- package/.scannerwork/scanner-report/source-56.txt +394 -95
- package/.scannerwork/scanner-report/source-59.txt +161 -196
- package/.scannerwork/scanner-report/source-6.txt +145 -156
- package/.scannerwork/scanner-report/source-60.txt +158 -18
- package/.scannerwork/scanner-report/source-65.txt +509 -0
- package/.scannerwork/scanner-report/source-66.txt +509 -0
- package/.scannerwork/scanner-report/source-67.txt +77 -509
- package/.scannerwork/scanner-report/source-68.txt +56 -167
- package/.scannerwork/scanner-report/source-7.txt +80 -0
- package/.scannerwork/scanner-report/source-8.txt +54 -0
- package/.scannerwork/scanner-report/source-9.txt +14 -39
- package/.scannerwork/scanner-report/symbols-10.pb +354 -30
- package/.scannerwork/scanner-report/symbols-11.pb +29 -27
- package/.scannerwork/scanner-report/symbols-13.pb +33 -0
- package/.scannerwork/scanner-report/symbols-14.pb +41 -45
- package/.scannerwork/scanner-report/symbols-19.pb +28 -354
- package/.scannerwork/scanner-report/symbols-2.pb +42 -0
- package/.scannerwork/scanner-report/symbols-20.pb +16 -58
- package/.scannerwork/scanner-report/symbols-21.pb +384 -134
- package/.scannerwork/scanner-report/symbols-22.pb +14 -33
- package/.scannerwork/scanner-report/symbols-23.pb +1241 -113
- package/.scannerwork/scanner-report/symbols-24.pb +9 -41
- package/.scannerwork/scanner-report/symbols-25.pb +111 -14
- package/.scannerwork/scanner-report/symbols-26.pb +84 -43
- package/.scannerwork/scanner-report/symbols-27.pb +102 -42
- package/.scannerwork/scanner-report/symbols-28.pb +11 -0
- package/.scannerwork/scanner-report/symbols-29.pb +486 -0
- package/.scannerwork/scanner-report/symbols-3.pb +144 -0
- package/.scannerwork/scanner-report/symbols-30.pb +60 -610
- package/.scannerwork/scanner-report/symbols-32.pb +97 -486
- package/.scannerwork/scanner-report/symbols-33.pb +36 -102
- package/.scannerwork/scanner-report/symbols-34.pb +418 -0
- package/.scannerwork/scanner-report/symbols-4.pb +44 -0
- package/.scannerwork/scanner-report/symbols-47.pb +43 -14
- package/.scannerwork/scanner-report/symbols-48.pb +44 -111
- package/.scannerwork/scanner-report/symbols-49.pb +455 -355
- package/.scannerwork/scanner-report/symbols-5.pb +59 -180
- package/.scannerwork/scanner-report/symbols-50.pb +9 -494
- package/.scannerwork/scanner-report/symbols-51.pb +69 -11
- package/.scannerwork/scanner-report/symbols-52.pb +74 -33
- package/.scannerwork/scanner-report/symbols-56.pb +610 -77
- package/.scannerwork/scanner-report/symbols-59.pb +178 -416
- package/.scannerwork/scanner-report/symbols-6.pb +120 -147
- package/.scannerwork/scanner-report/symbols-60.pb +152 -16
- package/.scannerwork/scanner-report/symbols-67.pb +30 -0
- package/.scannerwork/scanner-report/symbols-68.pb +19 -0
- package/.scannerwork/scanner-report/symbols-7.pb +46 -0
- package/.scannerwork/scanner-report/symbols-8.pb +15 -0
- package/.scannerwork/scanner-report/symbols-9.pb +13 -18
- package/.scannerwork/scanner-report/syntax-highlightings-10.pb +255 -73
- package/.scannerwork/scanner-report/syntax-highlightings-11.pb +79 -104
- package/.scannerwork/scanner-report/syntax-highlightings-13.pb +118 -3736
- package/.scannerwork/scanner-report/syntax-highlightings-14.pb +81 -60
- package/.scannerwork/scanner-report/syntax-highlightings-19.pb +103 -250
- package/.scannerwork/scanner-report/syntax-highlightings-2.pb +78 -0
- package/.scannerwork/scanner-report/syntax-highlightings-20.pb +29 -99
- package/.scannerwork/scanner-report/syntax-highlightings-21.pb +269 -183
- package/.scannerwork/scanner-report/syntax-highlightings-22.pb +22 -97
- package/.scannerwork/scanner-report/syntax-highlightings-23.pb +815 -141
- package/.scannerwork/scanner-report/syntax-highlightings-24.pb +17 -45
- package/.scannerwork/scanner-report/syntax-highlightings-25.pb +193 -24
- package/.scannerwork/scanner-report/syntax-highlightings-26.pb +157 -56
- package/.scannerwork/scanner-report/syntax-highlightings-27.pb +195 -84
- package/.scannerwork/scanner-report/syntax-highlightings-28.pb +59 -0
- package/.scannerwork/scanner-report/syntax-highlightings-29.pb +659 -0
- package/.scannerwork/scanner-report/syntax-highlightings-3.pb +243 -0
- package/.scannerwork/scanner-report/syntax-highlightings-30.pb +74 -612
- package/.scannerwork/scanner-report/syntax-highlightings-32.pb +147 -624
- package/.scannerwork/scanner-report/syntax-highlightings-33.pb +57 -189
- package/.scannerwork/scanner-report/syntax-highlightings-34.pb +331 -0
- package/.scannerwork/scanner-report/syntax-highlightings-35.pb +68 -0
- package/.scannerwork/scanner-report/syntax-highlightings-4.pb +90 -0
- package/.scannerwork/scanner-report/syntax-highlightings-47.pb +47 -19
- package/.scannerwork/scanner-report/syntax-highlightings-48.pb +63 -176
- package/.scannerwork/scanner-report/syntax-highlightings-49.pb +498 -197
- package/.scannerwork/scanner-report/syntax-highlightings-5.pb +100 -192
- package/.scannerwork/scanner-report/syntax-highlightings-50.pb +15 -597
- package/.scannerwork/scanner-report/syntax-highlightings-51.pb +71 -25
- package/.scannerwork/scanner-report/syntax-highlightings-52.pb +118 -55
- package/.scannerwork/scanner-report/syntax-highlightings-54.pb +938 -57
- package/.scannerwork/scanner-report/syntax-highlightings-56.pb +619 -129
- package/.scannerwork/scanner-report/syntax-highlightings-59.pb +170 -276
- package/.scannerwork/scanner-report/syntax-highlightings-6.pb +155 -156
- package/.scannerwork/scanner-report/syntax-highlightings-60.pb +185 -34
- package/.scannerwork/scanner-report/syntax-highlightings-65.pb +3748 -0
- package/.scannerwork/scanner-report/syntax-highlightings-66.pb +3747 -0
- package/.scannerwork/scanner-report/syntax-highlightings-67.pb +72 -3717
- package/.scannerwork/scanner-report/syntax-highlightings-68.pb +54 -921
- package/.scannerwork/scanner-report/syntax-highlightings-7.pb +95 -0
- package/.scannerwork/scanner-report/syntax-highlightings-8.pb +54 -0
- package/.scannerwork/scanner-report/syntax-highlightings-9.pb +33 -70
- package/CHANGES.md +6 -2
- package/package.json +1 -1
- package/test-16-results.xml +150 -150
- package/test-18-results.xml +149 -149
- package/test-iam-18-results.xml +50 -50
- package/.scannerwork/scanner-report/changesets-16.pb +0 -1
- package/.scannerwork/scanner-report/changesets-17.pb +0 -1
- package/.scannerwork/scanner-report/changesets-18.pb +0 -1
- package/.scannerwork/scanner-report/changesets-45.pb +0 -1
- package/.scannerwork/scanner-report/changesets-46.pb +0 -1
- package/.scannerwork/scanner-report/changesets-53.pb +0 -1
- package/.scannerwork/scanner-report/changesets-54.pb +0 -1
- package/.scannerwork/scanner-report/changesets-55.pb +0 -1
- package/.scannerwork/scanner-report/changesets-57.pb +0 -1
- package/.scannerwork/scanner-report/changesets-58.pb +0 -1
- package/.scannerwork/scanner-report/changesets-61.pb +0 -1
- package/.scannerwork/scanner-report/changesets-62.pb +0 -1
- package/.scannerwork/scanner-report/changesets-63.pb +0 -1
- package/.scannerwork/scanner-report/changesets-64.pb +0 -1
- package/.scannerwork/scanner-report/component-16.pb +0 -1
- package/.scannerwork/scanner-report/component-17.pb +0 -1
- package/.scannerwork/scanner-report/component-18.pb +0 -1
- package/.scannerwork/scanner-report/component-45.pb +0 -1
- package/.scannerwork/scanner-report/component-46.pb +0 -1
- package/.scannerwork/scanner-report/component-53.pb +0 -1
- package/.scannerwork/scanner-report/component-55.pb +0 -1
- package/.scannerwork/scanner-report/component-57.pb +0 -1
- package/.scannerwork/scanner-report/component-58.pb +0 -1
- package/.scannerwork/scanner-report/component-61.pb +0 -1
- package/.scannerwork/scanner-report/component-62.pb +0 -1
- package/.scannerwork/scanner-report/component-63.pb +0 -1
- package/.scannerwork/scanner-report/component-64.pb +0 -1
- package/.scannerwork/scanner-report/coverages-16.pb +0 -0
- package/.scannerwork/scanner-report/coverages-18.pb +0 -0
- package/.scannerwork/scanner-report/coverages-45.pb +0 -0
- package/.scannerwork/scanner-report/coverages-53.pb +0 -0
- package/.scannerwork/scanner-report/coverages-55.pb +0 -0
- package/.scannerwork/scanner-report/coverages-57.pb +0 -0
- package/.scannerwork/scanner-report/coverages-58.pb +0 -0
- package/.scannerwork/scanner-report/coverages-61.pb +0 -0
- package/.scannerwork/scanner-report/coverages-62.pb +0 -0
- package/.scannerwork/scanner-report/coverages-63.pb +0 -0
- package/.scannerwork/scanner-report/coverages-64.pb +0 -0
- package/.scannerwork/scanner-report/duplications-58.pb +0 -0
- package/.scannerwork/scanner-report/duplications-61.pb +0 -3
- package/.scannerwork/scanner-report/duplications-63.pb +0 -0
- package/.scannerwork/scanner-report/duplications-64.pb +0 -0
- package/.scannerwork/scanner-report/issues-50.pb +0 -6
- package/.scannerwork/scanner-report/measures-16.pb +0 -0
- package/.scannerwork/scanner-report/measures-18.pb +0 -0
- package/.scannerwork/scanner-report/measures-45.pb +0 -0
- package/.scannerwork/scanner-report/measures-53.pb +0 -0
- package/.scannerwork/scanner-report/measures-55.pb +0 -0
- package/.scannerwork/scanner-report/measures-57.pb +0 -0
- package/.scannerwork/scanner-report/measures-58.pb +0 -0
- package/.scannerwork/scanner-report/measures-61.pb +0 -0
- package/.scannerwork/scanner-report/measures-62.pb +0 -0
- package/.scannerwork/scanner-report/measures-63.pb +0 -0
- package/.scannerwork/scanner-report/measures-64.pb +0 -0
- package/.scannerwork/scanner-report/source-16.txt +0 -118
- package/.scannerwork/scanner-report/source-18.txt +0 -31
- package/.scannerwork/scanner-report/source-45.txt +0 -625
- package/.scannerwork/scanner-report/source-53.txt +0 -92
- package/.scannerwork/scanner-report/source-55.txt +0 -147
- package/.scannerwork/scanner-report/source-57.txt +0 -68
- package/.scannerwork/scanner-report/source-58.txt +0 -63
- package/.scannerwork/scanner-report/source-61.txt +0 -131
- package/.scannerwork/scanner-report/source-63.txt +0 -34
- package/.scannerwork/scanner-report/source-64.txt +0 -100
- package/.scannerwork/scanner-report/symbols-16.pb +0 -30
- package/.scannerwork/scanner-report/symbols-18.pb +0 -14
- package/.scannerwork/scanner-report/symbols-45.pb +0 -1254
- package/.scannerwork/scanner-report/symbols-53.pb +0 -60
- package/.scannerwork/scanner-report/symbols-55.pb +0 -85
- package/.scannerwork/scanner-report/symbols-57.pb +0 -45
- package/.scannerwork/scanner-report/symbols-58.pb +0 -43
- package/.scannerwork/scanner-report/symbols-61.pb +0 -97
- package/.scannerwork/scanner-report/symbols-62.pb +0 -9
- package/.scannerwork/scanner-report/symbols-63.pb +0 -10
- package/.scannerwork/scanner-report/symbols-64.pb +0 -69
- package/.scannerwork/scanner-report/syntax-highlightings-16.pb +0 -113
- package/.scannerwork/scanner-report/syntax-highlightings-18.pb +0 -45
- package/.scannerwork/scanner-report/syntax-highlightings-45.pb +0 -887
- package/.scannerwork/scanner-report/syntax-highlightings-53.pb +0 -110
- package/.scannerwork/scanner-report/syntax-highlightings-55.pb +0 -191
- package/.scannerwork/scanner-report/syntax-highlightings-57.pb +0 -110
- package/.scannerwork/scanner-report/syntax-highlightings-58.pb +0 -82
- package/.scannerwork/scanner-report/syntax-highlightings-61.pb +0 -182
- package/.scannerwork/scanner-report/syntax-highlightings-62.pb +0 -48
- package/.scannerwork/scanner-report/syntax-highlightings-63.pb +0 -50
- package/.scannerwork/scanner-report/syntax-highlightings-64.pb +0 -105
- /package/.scannerwork/scanner-report/{coverages-17.pb → coverages-12.pb} +0 -0
- /package/.scannerwork/scanner-report/{coverages-46.pb → coverages-31.pb} +0 -0
- /package/.scannerwork/scanner-report/{coverages-54.pb → coverages-35.pb} +0 -0
- /package/.scannerwork/scanner-report/{duplications-16.pb → duplications-12.pb} +0 -0
- /package/.scannerwork/scanner-report/{duplications-17.pb → duplications-13.pb} +0 -0
- /package/.scannerwork/scanner-report/{duplications-18.pb → duplications-28.pb} +0 -0
- /package/.scannerwork/scanner-report/{duplications-45.pb → duplications-3.pb} +0 -0
- /package/.scannerwork/scanner-report/{duplications-46.pb → duplications-31.pb} +0 -0
- /package/.scannerwork/scanner-report/{duplications-50.pb → duplications-35.pb} +0 -0
- /package/.scannerwork/scanner-report/{duplications-53.pb → duplications-67.pb} +0 -0
- /package/.scannerwork/scanner-report/{duplications-54.pb → duplications-68.pb} +0 -0
- /package/.scannerwork/scanner-report/{duplications-55.pb → duplications-7.pb} +0 -0
- /package/.scannerwork/scanner-report/{duplications-57.pb → duplications-8.pb} +0 -0
- /package/.scannerwork/scanner-report/{issues-46.pb → issues-31.pb} +0 -0
- /package/.scannerwork/scanner-report/{issues-54.pb → issues-35.pb} +0 -0
- /package/.scannerwork/scanner-report/{measures-17.pb → measures-12.pb} +0 -0
- /package/.scannerwork/scanner-report/{measures-46.pb → measures-31.pb} +0 -0
- /package/.scannerwork/scanner-report/{source-17.txt → source-12.txt} +0 -0
- /package/.scannerwork/scanner-report/{source-46.txt → source-31.txt} +0 -0
- /package/.scannerwork/scanner-report/{symbols-17.pb → symbols-12.pb} +0 -0
- /package/.scannerwork/scanner-report/{symbols-46.pb → symbols-31.pb} +0 -0
- /package/.scannerwork/scanner-report/{symbols-54.pb → symbols-35.pb} +0 -0
- /package/.scannerwork/scanner-report/{syntax-highlightings-17.pb → syntax-highlightings-12.pb} +0 -0
- /package/.scannerwork/scanner-report/{syntax-highlightings-46.pb → syntax-highlightings-31.pb} +0 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// Copyright © 2017, 2021 IBM Corp. All rights reserved.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
16
|
+
const pkg = require('../package.json');
|
|
17
|
+
const stream = require('stream');
|
|
18
|
+
const { CloudantV1, CouchdbSessionAuthenticator } = require('@ibm-cloud/cloudant');
|
|
19
|
+
const { IamAuthenticator, NoAuthAuthenticator } = require('ibm-cloud-sdk-core');
|
|
20
|
+
const retryPlugin = require('retry-axios');
|
|
21
|
+
|
|
22
|
+
const userAgent = 'couchbackup-cloudant/' + pkg.version + ' (Node.js ' +
|
|
23
|
+
process.version + ')';
|
|
24
|
+
|
|
25
|
+
// Class for streaming _changes error responses into
|
|
26
|
+
// In general the response is a small error/reason JSON object
|
|
27
|
+
// so it is OK to have this in memory.
|
|
28
|
+
class ResponseWriteable extends stream.Writable {
|
|
29
|
+
constructor(options) {
|
|
30
|
+
super(options);
|
|
31
|
+
this.data = [];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_write(chunk, encoding, callback) {
|
|
35
|
+
this.data.push(chunk);
|
|
36
|
+
callback();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
stringBody() {
|
|
40
|
+
return Buffer.concat(this.data).toString();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// An interceptor function to help augment error bodies with a little
|
|
45
|
+
// extra information so we can continue to use consistent messaging
|
|
46
|
+
// after the ugprade to @ibm-cloud/cloudant
|
|
47
|
+
const errorHelper = async function(err) {
|
|
48
|
+
let method;
|
|
49
|
+
let requestUrl;
|
|
50
|
+
if (err.response) {
|
|
51
|
+
if (err.response.config.url) {
|
|
52
|
+
requestUrl = err.response.config.url;
|
|
53
|
+
method = err.response.config.method;
|
|
54
|
+
}
|
|
55
|
+
// Override the status text with an improved message
|
|
56
|
+
let errorMsg = `${err.response.status} ${err.response.statusText || ''}: ` +
|
|
57
|
+
`${method} ${requestUrl}`;
|
|
58
|
+
if (err.response.data) {
|
|
59
|
+
// Check if we have a JSON response and try to get the error/reason
|
|
60
|
+
if (err.response.headers['content-type'] === 'application/json') {
|
|
61
|
+
if (!err.response.data.error && err.response.data.pipe) {
|
|
62
|
+
// If we didn't find a JSON object with `error` then we might have a stream response.
|
|
63
|
+
// Detect the stream by the presence of `pipe` and use it to get the body and parse
|
|
64
|
+
// the error information.
|
|
65
|
+
const p = new Promise((resolve, reject) => {
|
|
66
|
+
const errorBody = new ResponseWriteable();
|
|
67
|
+
err.response.data.pipe(errorBody)
|
|
68
|
+
.on('finish', () => { resolve(JSON.parse(errorBody.stringBody())); })
|
|
69
|
+
.on('error', () => { reject(err); });
|
|
70
|
+
});
|
|
71
|
+
// Replace the stream on the response with the parsed object
|
|
72
|
+
err.response.data = await p;
|
|
73
|
+
}
|
|
74
|
+
// Append the error/reason if available
|
|
75
|
+
if (err.response.data.error) {
|
|
76
|
+
// Override the status text with our more complete message
|
|
77
|
+
errorMsg += ` - Error: ${err.response.data.error}`;
|
|
78
|
+
if (err.response.data.reason) {
|
|
79
|
+
errorMsg += `, Reason: ${err.response.data.reason}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
errorMsg += err.response.data;
|
|
84
|
+
}
|
|
85
|
+
// Set a new message for use by the node-sdk-core
|
|
86
|
+
// We use the errors array because it gets processed
|
|
87
|
+
// ahead of all other service errors.
|
|
88
|
+
err.response.data.errors = [{ message: errorMsg }];
|
|
89
|
+
}
|
|
90
|
+
} else if (err.request) {
|
|
91
|
+
if (!err.message.includes(err.config.url)) {
|
|
92
|
+
// Augment the message with the URL and method
|
|
93
|
+
// but don't do it again if we already have the URL.
|
|
94
|
+
err.message = `${err.message}: ${err.config.method} ${err.config.url}`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return Promise.reject(err);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
module.exports = {
|
|
101
|
+
client: function(rawUrl, opts) {
|
|
102
|
+
const url = new URL(rawUrl);
|
|
103
|
+
// Split the URL to separate service from database
|
|
104
|
+
// Use origin as the "base" to remove auth elements
|
|
105
|
+
const actUrl = new URL(url.pathname.substring(0, url.pathname.lastIndexOf('/')), url.origin);
|
|
106
|
+
const dbName = url.pathname.substring(url.pathname.lastIndexOf('/') + 1);
|
|
107
|
+
let authenticator;
|
|
108
|
+
// Default to cookieauth unless an IAM key is provided
|
|
109
|
+
if (opts.iamApiKey) {
|
|
110
|
+
const iamAuthOpts = { apikey: opts.iamApiKey };
|
|
111
|
+
if (opts.iamTokenUrl) {
|
|
112
|
+
iamAuthOpts.url = opts.iamTokenUrl;
|
|
113
|
+
}
|
|
114
|
+
authenticator = new IamAuthenticator(iamAuthOpts);
|
|
115
|
+
} else if (url.username) {
|
|
116
|
+
authenticator = new CouchdbSessionAuthenticator({
|
|
117
|
+
username: decodeURIComponent(url.username),
|
|
118
|
+
password: decodeURIComponent(url.password)
|
|
119
|
+
});
|
|
120
|
+
} else {
|
|
121
|
+
authenticator = new NoAuthAuthenticator();
|
|
122
|
+
}
|
|
123
|
+
const serviceOpts = {
|
|
124
|
+
authenticator: authenticator,
|
|
125
|
+
timeout: opts.requestTimeout,
|
|
126
|
+
// Axios performance options
|
|
127
|
+
maxContentLength: -1
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const service = new CloudantV1(serviceOpts);
|
|
131
|
+
// Configure retries
|
|
132
|
+
const maxRetries = 2; // for 3 total attempts
|
|
133
|
+
service.getHttpClient().defaults.raxConfig = {
|
|
134
|
+
// retries for status codes
|
|
135
|
+
retry: maxRetries,
|
|
136
|
+
// retries for non-response e.g. ETIMEDOUT
|
|
137
|
+
noResponseRetries: maxRetries,
|
|
138
|
+
backoffType: 'exponential',
|
|
139
|
+
httpMethodsToRetry: ['GET', 'HEAD', 'POST'],
|
|
140
|
+
statusCodesToRetry: [
|
|
141
|
+
[429, 429],
|
|
142
|
+
[500, 599]
|
|
143
|
+
],
|
|
144
|
+
shouldRetry: err => {
|
|
145
|
+
const cfg = retryPlugin.getConfig(err);
|
|
146
|
+
// cap at max retries regardless of response/non-response type
|
|
147
|
+
if (cfg.currentRetryAttempt >= maxRetries) {
|
|
148
|
+
return false;
|
|
149
|
+
} else {
|
|
150
|
+
return retryPlugin.shouldRetryRequest(err);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
instance: service.getHttpClient()
|
|
154
|
+
};
|
|
155
|
+
retryPlugin.attach(service.getHttpClient());
|
|
156
|
+
|
|
157
|
+
service.setServiceUrl(actUrl.toString());
|
|
158
|
+
if (authenticator instanceof CouchdbSessionAuthenticator) {
|
|
159
|
+
// Awkward workaround for known Couch issue with compression on _session requests
|
|
160
|
+
// It is not feasible to disable compression on all requests with the amount of
|
|
161
|
+
// data this lib needs to move, so override the property in the tokenManager instance.
|
|
162
|
+
authenticator.tokenManager.requestWrapperInstance.compressRequestData = false;
|
|
163
|
+
}
|
|
164
|
+
if (authenticator.tokenManager && authenticator.tokenManager.requestWrapperInstance) {
|
|
165
|
+
authenticator.tokenManager.requestWrapperInstance.axiosInstance.interceptors.response.use(null, errorHelper);
|
|
166
|
+
}
|
|
167
|
+
// Add error interceptors to put URLs in error messages
|
|
168
|
+
service.getHttpClient().interceptors.response.use(null, errorHelper);
|
|
169
|
+
|
|
170
|
+
// Add request interceptor to add user-agent (adding it with custom request headers gets overwritten)
|
|
171
|
+
service.getHttpClient().interceptors.request.use(function(requestConfig) {
|
|
172
|
+
requestConfig.headers['User-Agent'] = userAgent;
|
|
173
|
+
return requestConfig;
|
|
174
|
+
}, null);
|
|
175
|
+
|
|
176
|
+
return { service: service, db: dbName, url: actUrl.toString() };
|
|
177
|
+
}
|
|
178
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright ©
|
|
1
|
+
// Copyright © 2018, 2021 IBM Corp. All rights reserved.
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -11,408 +11,82 @@
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
'use strict';
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* @module couchbackup
|
|
19
|
-
* @see module:couchbackup
|
|
20
|
-
*/
|
|
15
|
+
/* global describe it */
|
|
16
|
+
'use strict';
|
|
21
17
|
|
|
22
|
-
const backupFull = require('./includes/backup.js');
|
|
23
|
-
const defaults = require('./includes/config.js').apiDefaults;
|
|
24
|
-
const error = require('./includes/error.js');
|
|
25
|
-
const request = require('./includes/request.js');
|
|
26
|
-
const restoreInternal = require('./includes/restore.js');
|
|
27
|
-
const backupShallow = require('./includes/shallowbackup.js');
|
|
28
|
-
const debug = require('debug')('couchbackup:app');
|
|
29
|
-
const events = require('events');
|
|
30
18
|
const fs = require('fs');
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
x <= MAX_SAFE_INTEGER;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Validate arguments.
|
|
53
|
-
*
|
|
54
|
-
* @param {object} url - URL of database.
|
|
55
|
-
* @param {object} opts - Options.
|
|
56
|
-
* @param {function} cb - Callback to be called on error.
|
|
57
|
-
*/
|
|
58
|
-
function validateArgs(url, opts, cb) {
|
|
59
|
-
if (typeof url !== 'string') {
|
|
60
|
-
cb(new error.BackupError('InvalidOption', 'Invalid URL, must be type string'), null);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (opts && typeof opts.bufferSize !== 'undefined' && !isSafePositiveInteger(opts.bufferSize)) {
|
|
64
|
-
cb(new error.BackupError('InvalidOption', 'Invalid buffer size option, must be a positive integer in the range (0, MAX_SAFE_INTEGER]'), null);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (opts && typeof opts.iamApiKey !== 'undefined' && typeof opts.iamApiKey !== 'string') {
|
|
68
|
-
cb(new error.BackupError('InvalidOption', 'Invalid iamApiKey option, must be type string'), null);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (opts && typeof opts.log !== 'undefined' && typeof opts.log !== 'string') {
|
|
72
|
-
cb(new error.BackupError('InvalidOption', 'Invalid log option, must be type string'), null);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (opts && typeof opts.mode !== 'undefined' && ['full', 'shallow'].indexOf(opts.mode) === -1) {
|
|
76
|
-
cb(new error.BackupError('InvalidOption', 'Invalid mode option, must be either "full" or "shallow"'), null);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (opts && typeof opts.output !== 'undefined' && typeof opts.output !== 'string') {
|
|
80
|
-
cb(new error.BackupError('InvalidOption', 'Invalid output option, must be type string'), null);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (opts && typeof opts.parallelism !== 'undefined' && !isSafePositiveInteger(opts.parallelism)) {
|
|
84
|
-
cb(new error.BackupError('InvalidOption', 'Invalid parallelism option, must be a positive integer in the range (0, MAX_SAFE_INTEGER]'), null);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (opts && typeof opts.requestTimeout !== 'undefined' && !isSafePositiveInteger(opts.requestTimeout)) {
|
|
88
|
-
cb(new error.BackupError('InvalidOption', 'Invalid request timeout option, must be a positive integer in the range (0, MAX_SAFE_INTEGER]'), null);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (opts && typeof opts.resume !== 'undefined' && typeof opts.resume !== 'boolean') {
|
|
92
|
-
cb(new error.BackupError('InvalidOption', 'Invalid resume option, must be type boolean'), null);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Validate URL and ensure no auth if using key
|
|
97
|
-
try {
|
|
98
|
-
const urlObject = new URL(url);
|
|
99
|
-
// We require a protocol, host and path (for db), fail if any is missing.
|
|
100
|
-
if (urlObject.protocol !== 'https:' && urlObject.protocol !== 'http:') {
|
|
101
|
-
cb(new error.BackupError('InvalidOption', 'Invalid URL protocol.'));
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (!urlObject.host) {
|
|
105
|
-
cb(new error.BackupError('InvalidOption', 'Invalid URL host.'));
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (!urlObject.pathname || urlObject.pathname === '/') {
|
|
109
|
-
cb(new error.BackupError('InvalidOption', 'Invalid URL, missing path element (no database).'));
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
if (opts && opts.iamApiKey && (urlObject.username || urlObject.password)) {
|
|
113
|
-
cb(new error.BackupError('InvalidOption', 'URL user information must not be supplied when using IAM API key.'));
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
} catch (err) {
|
|
117
|
-
cb(err);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Perform validation of invalid options for shallow mode and WARN
|
|
122
|
-
// We don't error for backwards compatibility with scripts that may have been
|
|
123
|
-
// written passing complete sets of options through
|
|
124
|
-
if (opts && opts.mode === 'shallow') {
|
|
125
|
-
if (opts.log || opts.resume) {
|
|
126
|
-
console.warn('WARNING: the options "log" and "resume" are invalid when using shallow mode.');
|
|
127
|
-
}
|
|
128
|
-
if (opts.parallelism) {
|
|
129
|
-
console.warn('WARNING: the option "parallelism" has no effect when using shallow mode.');
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (opts && opts.resume) {
|
|
134
|
-
if (!opts.log) {
|
|
135
|
-
// This is the second place we check for the presence of the log option in conjunction with resume
|
|
136
|
-
// It has to be here for the API case
|
|
137
|
-
cb(new error.BackupError('NoLogFileName', 'To resume a backup, a log file must be specified'), null);
|
|
138
|
-
return;
|
|
139
|
-
} else if (!fs.existsSync(opts.log)) {
|
|
140
|
-
cb(new error.BackupError('LogDoesNotExist', 'To resume a backup, the log file must exist'), null);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function addEventListener(indicator, emitter, event, f) {
|
|
148
|
-
emitter.on(event, function(...args) {
|
|
149
|
-
if (!indicator.errored) {
|
|
150
|
-
if (event === 'error') indicator.errored = true;
|
|
151
|
-
f(...args);
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/*
|
|
157
|
-
Check the backup database exists and that the credentials used have
|
|
158
|
-
visibility. Callback with a fatal error if there is a problem with the DB.
|
|
159
|
-
@param {string} db - database object
|
|
160
|
-
@param {function(err)} callback - error is undefined if DB exists
|
|
161
|
-
*/
|
|
162
|
-
function proceedIfBackupDbValid(db, callback) {
|
|
163
|
-
db.service.headDatabase({ db: db.db }).then(() => callback()).catch(err => {
|
|
164
|
-
err = error.convertResponseError(err, err => parseIfDbValidResponseError(db, err));
|
|
165
|
-
callback(err);
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/*
|
|
170
|
-
Check that the restore database exists, is new and is empty. Also verify that the credentials used have
|
|
171
|
-
visibility. Callback with a fatal error if there is a problem with the DB.
|
|
172
|
-
@param {string} db - database object
|
|
173
|
-
@param {function(err)} callback - error is undefined if DB exists, new and empty
|
|
174
|
-
*/
|
|
175
|
-
function proceedIfRestoreDbValid(db, callback) {
|
|
176
|
-
db.service.getDatabaseInformation({ db: db.db }).then(response => {
|
|
177
|
-
const { doc_count: docCount, doc_del_count: deletedDocCount } = response.result;
|
|
178
|
-
// The system databases can have a validation ddoc(s) injected in them on creation.
|
|
179
|
-
// This sets the doc count off, so we just complitely exclude the system databases from this check.
|
|
180
|
-
// The assumption here is that users restoring system databases know what they are doing.
|
|
181
|
-
if (!db.db.startsWith('_') && (docCount !== 0 || deletedDocCount !== 0)) {
|
|
182
|
-
const notEmptyDBErr = new Error(`Target database ${db.url}${db.db} is not empty.`);
|
|
183
|
-
notEmptyDBErr.name = 'DatabaseNotEmpty';
|
|
184
|
-
callback(notEmptyDBErr);
|
|
185
|
-
} else {
|
|
186
|
-
callback();
|
|
187
|
-
}
|
|
188
|
-
}).catch(err => {
|
|
189
|
-
err = error.convertResponseError(err, err => parseIfDbValidResponseError(db, err));
|
|
190
|
-
callback(err);
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/*
|
|
195
|
-
Convert the database validation response error to a special DatabaseNotFound error
|
|
196
|
-
in case the database is missing. Otherwise delegate to the default error factory.
|
|
197
|
-
@param {object} db - database object
|
|
198
|
-
@param {object} err - HTTP response error
|
|
199
|
-
*/
|
|
200
|
-
function parseIfDbValidResponseError(db, err) {
|
|
201
|
-
if (err && err.status === 404) {
|
|
202
|
-
// Override the error type and message for the DB not found case
|
|
203
|
-
const msg = `Database ${db.url}` +
|
|
204
|
-
`${db.db} does not exist. ` +
|
|
205
|
-
'Check the URL and database name have been specified correctly.';
|
|
206
|
-
const noDBErr = new Error(msg);
|
|
207
|
-
noDBErr.name = 'DatabaseNotFound';
|
|
208
|
-
return noDBErr;
|
|
209
|
-
}
|
|
210
|
-
// Delegate to the default error factory if it wasn't a 404
|
|
211
|
-
return error.convertResponseError(err);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
module.exports = {
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Backup a Cloudant database to a stream.
|
|
218
|
-
*
|
|
219
|
-
* @param {string} srcUrl - URL of database to backup.
|
|
220
|
-
* @param {stream.Writable} targetStream - Stream to write content to.
|
|
221
|
-
* @param {object} opts - Backup options.
|
|
222
|
-
* @param {number} [opts.parallelism=5] - Number of parallel HTTP requests to use.
|
|
223
|
-
* @param {number} [opts.bufferSize=500] - Number of documents per batch request.
|
|
224
|
-
* @param {number} [opts.requestTimeout=120000] - Milliseconds to wait before retrying a HTTP request.
|
|
225
|
-
* @param {string} [opts.iamApiKey] - IAM API key to use to access Cloudant database.
|
|
226
|
-
* @param {string} [opts.log] - Log file name. Default uses a temporary file.
|
|
227
|
-
* @param {boolean} [opts.resume] - Whether to resume from existing log.
|
|
228
|
-
* @param {string} [opts.mode=full] - Use `full` or `shallow` mode.
|
|
229
|
-
* @param {backupRestoreCallback} callback - Called on completion.
|
|
230
|
-
*/
|
|
231
|
-
backup: function(srcUrl, targetStream, opts, callback) {
|
|
232
|
-
const listenerErrorIndicator = { errored: false };
|
|
233
|
-
if (typeof callback === 'undefined' && typeof opts === 'function') {
|
|
234
|
-
callback = opts;
|
|
235
|
-
opts = {};
|
|
236
|
-
}
|
|
237
|
-
if (!validateArgs(srcUrl, opts, callback)) {
|
|
238
|
-
// bad args, bail
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// if there is an error writing to the stream, call the completion
|
|
243
|
-
// callback with the error set
|
|
244
|
-
addEventListener(listenerErrorIndicator, targetStream, 'error', function(err) {
|
|
245
|
-
debug('Error ' + JSON.stringify(err));
|
|
246
|
-
if (callback) callback(err);
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
opts = Object.assign({}, defaults(), opts);
|
|
250
|
-
|
|
251
|
-
const ee = new events.EventEmitter();
|
|
252
|
-
|
|
253
|
-
// Set up the DB client
|
|
254
|
-
const backupDB = request.client(srcUrl, opts);
|
|
255
|
-
|
|
256
|
-
// Validate the DB exists, before proceeding to backup
|
|
257
|
-
proceedIfBackupDbValid(backupDB, function(err) {
|
|
258
|
-
if (err) {
|
|
259
|
-
if (err.name === 'DatabaseNotFound') {
|
|
260
|
-
err.message = `${err.message} Ensure the backup source database exists.`;
|
|
261
|
-
}
|
|
262
|
-
// Didn't exist, or another fatal error, exit
|
|
263
|
-
callback(err);
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
let backup = null;
|
|
267
|
-
if (opts.mode === 'shallow') {
|
|
268
|
-
backup = backupShallow;
|
|
269
|
-
} else { // full mode
|
|
270
|
-
backup = backupFull;
|
|
19
|
+
const readline = require('readline');
|
|
20
|
+
const u = require('./citestutils.js');
|
|
21
|
+
const uuid = require('uuid').v4;
|
|
22
|
+
|
|
23
|
+
const params = { useApi: true };
|
|
24
|
+
|
|
25
|
+
describe(u.scenario('Concurrent database backups', params), function() {
|
|
26
|
+
it('should run concurrent API database backups correctly #slower', function(done) {
|
|
27
|
+
// Allow up to 900 s to backup and compare (it should be much faster)!
|
|
28
|
+
u.setTimeout(this, 900);
|
|
29
|
+
|
|
30
|
+
let doneCount = 0;
|
|
31
|
+
let doneErr;
|
|
32
|
+
const finished = function(err) {
|
|
33
|
+
doneCount++;
|
|
34
|
+
if (doneCount === 2) {
|
|
35
|
+
done(doneErr || err);
|
|
271
36
|
}
|
|
37
|
+
doneErr = err;
|
|
38
|
+
};
|
|
272
39
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
// will cause an empty line that will be gracefully handled by the restore.
|
|
276
|
-
if (opts.resume) {
|
|
277
|
-
targetStream.write('\n');
|
|
278
|
-
}
|
|
40
|
+
const checkForEmptyBatches = function(fileName, cb) {
|
|
41
|
+
let foundEmptyBatch = false;
|
|
279
42
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
ee.emit('changes', batch);
|
|
43
|
+
const rd = readline.createInterface({
|
|
44
|
+
input: fs.createReadStream(fileName),
|
|
45
|
+
output: fs.createWriteStream('/dev/null'),
|
|
46
|
+
terminal: false
|
|
285
47
|
});
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
if (logCompletedBatch) {
|
|
293
|
-
logCompletedBatch(obj.batch);
|
|
294
|
-
}
|
|
295
|
-
debug(' backed up batch', obj.batch, ' docs: ', obj.total, 'Time', obj.time);
|
|
296
|
-
}
|
|
297
|
-
// Write the received content to the targetStream
|
|
298
|
-
const continueWriting = targetStream.write(JSON.stringify(obj.data) + '\n',
|
|
299
|
-
'utf8',
|
|
300
|
-
writeFlushed);
|
|
301
|
-
if (!continueWriting) {
|
|
302
|
-
// The buffer was full, pause the queue to stop the writes until we
|
|
303
|
-
// get a drain event
|
|
304
|
-
if (q && !q.paused) {
|
|
305
|
-
q.pause();
|
|
306
|
-
targetStream.once('drain', function() {
|
|
307
|
-
q.resume();
|
|
308
|
-
});
|
|
309
|
-
}
|
|
48
|
+
|
|
49
|
+
rd.on('line', function(line) {
|
|
50
|
+
if (JSON.parse(line).length === 0) {
|
|
51
|
+
// Note: Empty batch arrays indicate that the running backup is
|
|
52
|
+
// incorrectly sharing a log file with another ongoing backup job.
|
|
53
|
+
foundEmptyBatch = true;
|
|
310
54
|
}
|
|
311
55
|
});
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
function emitFinished() {
|
|
319
|
-
debug('Backup complete - written ' + JSON.stringify(obj));
|
|
320
|
-
const summary = { total: obj.total };
|
|
321
|
-
ee.emit('finished', summary);
|
|
322
|
-
if (callback) callback(null, summary);
|
|
56
|
+
|
|
57
|
+
rd.on('close', function() {
|
|
58
|
+
if (foundEmptyBatch) {
|
|
59
|
+
cb(new Error(`Log file '${fileName}' contains empty batches`));
|
|
60
|
+
} else {
|
|
61
|
+
cb();
|
|
323
62
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// [1] Run 'largedb2g' database backup
|
|
67
|
+
const actualBackup1 = `./${uuid()}`;
|
|
68
|
+
const output1 = fs.createWriteStream(actualBackup1);
|
|
69
|
+
output1.on('open', function() {
|
|
70
|
+
u.testBackup(params, 'largedb2g', output1, function(err) {
|
|
71
|
+
if (err) {
|
|
72
|
+
finished(err);
|
|
327
73
|
} else {
|
|
328
|
-
|
|
329
|
-
// emitFinished function for a callback when the file stream's finish
|
|
330
|
-
// event is emitted.
|
|
331
|
-
targetStream.end('', 'utf8', emitFinished);
|
|
74
|
+
checkForEmptyBatches(actualBackup1, finished);
|
|
332
75
|
}
|
|
333
76
|
});
|
|
334
77
|
});
|
|
335
|
-
return ee;
|
|
336
|
-
},
|
|
337
78
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
* @param {string} opts.iamApiKey - IAM API key to use to access Cloudant database.
|
|
348
|
-
* @param {backupRestoreCallback} callback - Called on completion.
|
|
349
|
-
*/
|
|
350
|
-
restore: function(srcStream, targetUrl, opts, callback) {
|
|
351
|
-
const listenerErrorIndicator = { errored: false };
|
|
352
|
-
if (typeof callback === 'undefined' && typeof opts === 'function') {
|
|
353
|
-
callback = opts;
|
|
354
|
-
opts = {};
|
|
355
|
-
}
|
|
356
|
-
validateArgs(targetUrl, opts, callback);
|
|
357
|
-
opts = Object.assign({}, defaults(), opts);
|
|
358
|
-
|
|
359
|
-
const ee = new events.EventEmitter();
|
|
360
|
-
|
|
361
|
-
// Set up the DB client
|
|
362
|
-
const restoreDB = request.client(targetUrl, opts);
|
|
363
|
-
|
|
364
|
-
// Validate the DB exists, before proceeding to restore
|
|
365
|
-
proceedIfRestoreDbValid(restoreDB, function(err) {
|
|
366
|
-
if (err) {
|
|
367
|
-
if (err.name === 'DatabaseNotFound') {
|
|
368
|
-
err.message = `${err.message} Create the target database before restoring.`;
|
|
369
|
-
} else if (err.name === 'DatabaseNotEmpty') {
|
|
370
|
-
err.message = `${err.message} A target database must be a new and empty database.`;
|
|
371
|
-
}
|
|
372
|
-
// Didn't exist, or another fatal error, exit
|
|
373
|
-
callback(err);
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
restoreInternal(
|
|
378
|
-
restoreDB,
|
|
379
|
-
opts,
|
|
380
|
-
srcStream,
|
|
381
|
-
ee,
|
|
382
|
-
function(err, writer) {
|
|
383
|
-
if (err) {
|
|
384
|
-
callback(err, null);
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
if (writer != null) {
|
|
388
|
-
addEventListener(listenerErrorIndicator, writer, 'restored', function(obj) {
|
|
389
|
-
debug(' restored ', obj.total);
|
|
390
|
-
ee.emit('restored', { documents: obj.documents, total: obj.total });
|
|
391
|
-
});
|
|
392
|
-
addEventListener(listenerErrorIndicator, writer, 'error', function(err) {
|
|
393
|
-
debug('Error ' + JSON.stringify(err));
|
|
394
|
-
// Only call destroy if it is available on the stream
|
|
395
|
-
if (srcStream.destroy && srcStream.destroy instanceof Function) {
|
|
396
|
-
srcStream.destroy();
|
|
397
|
-
}
|
|
398
|
-
callback(err);
|
|
399
|
-
});
|
|
400
|
-
addEventListener(listenerErrorIndicator, writer, 'finished', function(obj) {
|
|
401
|
-
debug('restore complete');
|
|
402
|
-
ee.emit('finished', { total: obj.total });
|
|
403
|
-
callback(null, obj);
|
|
404
|
-
});
|
|
405
|
-
}
|
|
79
|
+
// [2] Run 'largedb1g' database backup
|
|
80
|
+
const actualBackup2 = `./${uuid()}`;
|
|
81
|
+
const output2 = fs.createWriteStream(actualBackup2);
|
|
82
|
+
output2.on('open', function() {
|
|
83
|
+
u.testBackup(params, 'largedb1g', output2, function(err) {
|
|
84
|
+
if (err) {
|
|
85
|
+
finished(err);
|
|
86
|
+
} else {
|
|
87
|
+
checkForEmptyBatches(actualBackup2, finished);
|
|
406
88
|
}
|
|
407
|
-
);
|
|
89
|
+
});
|
|
408
90
|
});
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Backup/restore callback
|
|
415
|
-
* @callback backupRestoreCallback
|
|
416
|
-
* @param {Error} err - Error object if operation failed.
|
|
417
|
-
* @param {object} data - summary data for backup/restore
|
|
418
|
-
*/
|
|
91
|
+
});
|
|
92
|
+
});
|