@design-edito/tools 0.3.8 → 0.3.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/agnostic/arrays/index.d.ts +2 -2
- package/agnostic/arrays/index.js +2 -2
- package/agnostic/arrays/is-array-of/index.d.ts +1 -1
- package/agnostic/arrays/is-array-of/index.js +2 -2
- package/agnostic/booleans/is-falsy/index.d.ts +1 -1
- package/agnostic/colors/channels/index.d.ts +1 -1
- package/agnostic/colors/contrast/index.d.ts +1 -1
- package/agnostic/colors/convert/index.d.ts +1 -1
- package/agnostic/colors/convert/index.js +14 -17
- package/agnostic/colors/cssColorsMap.d.ts +9 -0
- package/agnostic/colors/distance/index.d.ts +1 -1
- package/agnostic/colors/index.d.ts +5 -5
- package/agnostic/colors/index.js +5 -5
- package/agnostic/colors/invert/index.d.ts +1 -1
- package/agnostic/colors/luminance/index.d.ts +1 -1
- package/agnostic/colors/palette/index.js +2 -0
- package/agnostic/colors/tidy/index.js +2 -1
- package/agnostic/colors/typechecks/index.d.ts +1 -1
- package/agnostic/colors/typechecks/index.js +1 -3
- package/agnostic/colors/types.d.ts +0 -7
- package/agnostic/colors/types.js +0 -154
- package/agnostic/css/bem/index.d.ts +3 -3
- package/agnostic/css/bem/index.js +6 -5
- package/agnostic/css/clss/index.d.ts +2 -1
- package/agnostic/css/clss/index.js +2 -2
- package/agnostic/css/generate-nice-color/index.js +1 -0
- package/agnostic/css/index.d.ts +3 -3
- package/agnostic/css/index.js +3 -3
- package/agnostic/css/styles-set/index.d.ts +4 -4
- package/agnostic/css/styles-set/index.js +1 -1
- package/agnostic/errors/register/index.js +4 -2
- package/agnostic/html/get-node-ancestors/index.js +1 -1
- package/agnostic/html/get-position-inside-parent/index.js +1 -1
- package/agnostic/html/hyper-json/cast/index.d.ts +1 -1
- package/agnostic/html/hyper-json/method/index.d.ts +2 -2
- package/agnostic/html/hyper-json/serialize/index.d.ts +1 -1
- package/agnostic/html/hyper-json/serialize/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/and/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.js +5 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.js +5 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/hjparse/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/hjstringify/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +21 -21
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +21 -21
- package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/join/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/length/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/or/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/push/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +7 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +7 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.js +9 -9
- package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.js +0 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/any/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/array/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/get/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/global/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/null/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/record/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/text/index.js +3 -1
- package/agnostic/html/hyper-json/transformer/index.d.ts +2 -2
- package/agnostic/html/hyper-json/transformer/index.js +6 -9
- package/agnostic/html/hyper-json/tree/index.d.ts +1 -1
- package/agnostic/html/hyper-json/tree/index.js +14 -10
- package/agnostic/html/hyper-json/types/index.d.ts +9 -13
- package/agnostic/html/hyper-json/utils/index.d.ts +7 -7
- package/agnostic/html/hyper-json/utils/index.js +1 -1
- package/agnostic/html/index.d.ts +2 -2
- package/agnostic/html/index.js +2 -2
- package/agnostic/html/placeholders/index.d.ts +1 -1
- package/agnostic/html/selector-to-element/index.js +1 -1
- package/agnostic/index.d.ts +7 -7
- package/agnostic/index.js +7 -7
- package/agnostic/misc/assert/index.d.ts +2 -2
- package/agnostic/misc/assert/index.js +4 -4
- package/agnostic/misc/cast/index.d.ts +1 -1
- package/agnostic/misc/connection/index.js +0 -1
- package/agnostic/misc/crawler/index.d.ts +2 -2
- package/agnostic/misc/crossenv/detect-runtime/index.js +4 -4
- package/agnostic/misc/crossenv/window/index.d.ts +1 -1
- package/agnostic/misc/crossenv/window/index.js +2 -2
- package/agnostic/misc/data-size/index.js +2 -2
- package/agnostic/misc/index.d.ts +4 -4
- package/agnostic/misc/index.js +4 -4
- package/agnostic/misc/is-constructor-function/index.d.ts +1 -1
- package/agnostic/misc/logs/index.d.ts +1 -1
- package/agnostic/misc/logs/index.js +1 -1
- package/agnostic/misc/logs/logger/index.d.ts +3 -3
- package/agnostic/misc/outcome/index.d.ts +7 -7
- package/agnostic/numbers/approximate-rational/index.js +4 -2
- package/agnostic/numbers/index.d.ts +3 -3
- package/agnostic/numbers/index.js +3 -3
- package/agnostic/objects/deep-get-property/index.js +2 -2
- package/agnostic/objects/flatten-getters/index.js +2 -1
- package/agnostic/objects/index.d.ts +5 -4
- package/agnostic/objects/index.js +5 -4
- package/agnostic/objects/record-format/index.js +1 -0
- package/agnostic/objects/sort-keys/index.d.ts +11 -0
- package/agnostic/objects/sort-keys/index.js +12 -0
- package/agnostic/objects/sort-keys/index.test.d.ts +1 -0
- package/agnostic/optim/index.d.ts +1 -1
- package/agnostic/optim/index.js +1 -1
- package/agnostic/optim/memoize/index.js +1 -1
- package/agnostic/optim/throttle-debounce/index.d.ts +12 -10
- package/agnostic/optim/throttle-debounce/index.js +2 -2
- package/agnostic/optim/throttle-debounce/types.d.ts +1 -1
- package/agnostic/random/index.d.ts +2 -2
- package/agnostic/random/index.js +2 -2
- package/agnostic/random/random/index.js +1 -1
- package/agnostic/sanitization/html/index.js +7 -7
- package/agnostic/sanitization/index.d.ts +2 -2
- package/agnostic/sanitization/index.js +2 -2
- package/agnostic/sanitization/types.d.ts +2 -6
- package/agnostic/strings/char-codes/index.d.ts +5 -5
- package/agnostic/strings/char-codes/index.js +2 -2
- package/agnostic/strings/matches/index.d.ts +2 -2
- package/agnostic/time/dates/format-date/index.js +23 -9
- package/agnostic/time/duration/index.d.ts +23 -2
- package/agnostic/time/duration/index.js +36 -4
- package/agnostic/time/index.d.ts +2 -2
- package/agnostic/time/index.js +2 -2
- package/agnostic/time/timeout/index.js +2 -2
- package/agnostic/time/wait/index.d.ts +2 -2
- package/agnostic/time/wait/index.js +1 -1
- package/components/EventListener/index.d.ts +10 -0
- package/components/EventListener/index.js +47 -0
- package/components/EventListener/styles.module.css +0 -0
- package/components/Input/index.d.ts +7 -0
- package/components/Input/index.js +29 -0
- package/components/Input/styles.module.css +0 -0
- package/components/IntersectionObserver/index.d.ts +20 -0
- package/components/IntersectionObserver/index.js +79 -0
- package/components/IntersectionObserver/styles.module.css +0 -0
- package/components/index.d.ts +3 -1
- package/components/index.js +3 -1
- package/components/public-classnames.d.ts +3 -0
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/node/@aws-s3/storage/directory/copy-dir/index.d.ts +2 -2
- package/node/@aws-s3/storage/directory/copy-dir/index.js +3 -3
- package/node/@aws-s3/storage/directory/index.d.ts +1 -1
- package/node/@aws-s3/storage/directory/index.js +1 -1
- package/node/@aws-s3/storage/directory/list/index.d.ts +2 -2
- package/node/@aws-s3/storage/directory/list/index.js +1 -1
- package/node/@aws-s3/storage/directory/move-dir/index.d.ts +3 -3
- package/node/@aws-s3/storage/directory/move-dir/index.js +3 -3
- package/node/@aws-s3/storage/directory/remove-dir/index.d.ts +2 -2
- package/node/@aws-s3/storage/directory/remove-dir/index.js +4 -4
- package/node/@aws-s3/storage/file/copy/index.d.ts +1 -1
- package/node/@aws-s3/storage/file/download/index.d.ts +3 -3
- package/node/@aws-s3/storage/file/exists/index.d.ts +2 -2
- package/node/@aws-s3/storage/file/exists/index.js +1 -2
- package/node/@aws-s3/storage/file/index.d.ts +2 -2
- package/node/@aws-s3/storage/file/index.js +2 -2
- package/node/@aws-s3/storage/file/move/index.d.ts +2 -2
- package/node/@aws-s3/storage/file/remove/index.d.ts +1 -1
- package/node/@aws-s3/storage/file/stat/index.d.ts +1 -1
- package/node/@aws-s3/storage/file/upload/index.d.ts +2 -2
- package/node/@express/@multer/index.d.ts +1 -1
- package/node/@google-cloud/storage/bucket/get-metadata/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/copy-dir/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/index.js +1 -1
- package/node/@google-cloud/storage/directory/list/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/move-dir/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/remove-dir/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/copy/index.d.ts +2 -2
- package/node/@google-cloud/storage/file/download/index.d.ts +2 -2
- package/node/@google-cloud/storage/file/exists/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/generate-signed-url/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/get-metadata/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/get-permissions/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/index.d.ts +4 -4
- package/node/@google-cloud/storage/file/index.js +4 -4
- package/node/@google-cloud/storage/file/move/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/remove/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/revoke-signed-urls/index.d.ts +4 -4
- package/node/@google-cloud/storage/file/stat/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/stat/index.js +2 -2
- package/node/@google-cloud/storage/file/update-metadata/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/upload/index.d.ts +2 -2
- package/node/@google-cloud/storage/index.d.ts +1 -1
- package/node/@google-cloud/storage/index.js +1 -1
- package/node/cloud-storage/operations/copy-dir/index.d.ts +8 -8
- package/node/cloud-storage/operations/copy-dir/index.js +4 -4
- package/node/cloud-storage/operations/copy-file/index.d.ts +8 -8
- package/node/cloud-storage/operations/copy-file/index.js +4 -4
- package/node/cloud-storage/operations/download-file/index.d.ts +9 -9
- package/node/cloud-storage/operations/download-file/index.js +4 -4
- package/node/cloud-storage/operations/exists-file/index.d.ts +6 -6
- package/node/cloud-storage/operations/exists-file/index.js +4 -4
- package/node/cloud-storage/operations/index.d.ts +4 -4
- package/node/cloud-storage/operations/index.js +4 -4
- package/node/cloud-storage/operations/list-dir/index.d.ts +6 -6
- package/node/cloud-storage/operations/list-dir/index.js +4 -4
- package/node/cloud-storage/operations/move-dir/index.d.ts +8 -8
- package/node/cloud-storage/operations/move-dir/index.js +4 -4
- package/node/cloud-storage/operations/move-file/index.d.ts +8 -8
- package/node/cloud-storage/operations/move-file/index.js +4 -4
- package/node/cloud-storage/operations/remove-dir/index.d.ts +8 -8
- package/node/cloud-storage/operations/remove-dir/index.js +4 -4
- package/node/cloud-storage/operations/remove-file/index.d.ts +8 -8
- package/node/cloud-storage/operations/remove-file/index.js +4 -4
- package/node/cloud-storage/operations/stat-file/index.d.ts +8 -8
- package/node/cloud-storage/operations/stat-file/index.js +4 -4
- package/node/cloud-storage/operations/upload-file/index.d.ts +9 -9
- package/node/cloud-storage/operations/upload-file/index.js +4 -4
- package/node/files/read-write/index.js +1 -1
- package/node/files/subpaths/index.d.ts +3 -3
- package/node/files/subpaths/index.js +6 -6
- package/node/ftps/directory/copy-dir/index.d.ts +1 -1
- package/node/ftps/directory/copy-dir/index.js +1 -1
- package/node/ftps/directory/list/index.d.ts +1 -1
- package/node/ftps/directory/move-dir/index.d.ts +1 -1
- package/node/ftps/directory/move-dir/index.js +1 -3
- package/node/ftps/directory/remove-dir/index.d.ts +2 -2
- package/node/ftps/file/copy/index.d.ts +1 -1
- package/node/ftps/file/copy/index.js +1 -1
- package/node/ftps/file/download/index.d.ts +2 -2
- package/node/ftps/file/exists/index.d.ts +2 -2
- package/node/ftps/file/exists/index.js +1 -1
- package/node/ftps/file/index.d.ts +3 -3
- package/node/ftps/file/index.js +3 -3
- package/node/ftps/file/move/index.d.ts +3 -3
- package/node/ftps/file/move/index.js +1 -1
- package/node/ftps/file/remove/index.d.ts +1 -1
- package/node/ftps/file/stat/index.d.ts +1 -1
- package/node/ftps/file/stat/index.js +2 -2
- package/node/ftps/file/upload/index.d.ts +2 -2
- package/node/images/format/index.d.ts +1 -1
- package/node/images/format/index.js +9 -9
- package/node/images/index.d.ts +2 -2
- package/node/images/index.js +2 -2
- package/node/images/metadata/index.d.ts +1 -1
- package/node/images/metadata/index.js +1 -1
- package/node/images/transform/index.d.ts +2 -2
- package/node/images/transform/index.js +26 -21
- package/node/images/transform/operations/blur/index.d.ts +1 -1
- package/node/images/transform/operations/brighten/index.d.ts +1 -1
- package/node/images/transform/operations/extend/index.d.ts +1 -1
- package/node/images/transform/operations/extract/index.d.ts +1 -1
- package/node/images/transform/operations/flatten/index.d.ts +1 -1
- package/node/images/transform/operations/flatten/index.js +1 -1
- package/node/images/transform/operations/flip/index.d.ts +1 -1
- package/node/images/transform/operations/flop/index.d.ts +1 -1
- package/node/images/transform/operations/hue/index.d.ts +1 -1
- package/node/images/transform/operations/index.d.ts +5 -5
- package/node/images/transform/operations/index.js +5 -5
- package/node/images/transform/operations/level/index.d.ts +1 -1
- package/node/images/transform/operations/lighten/index.d.ts +1 -1
- package/node/images/transform/operations/normalize/index.d.ts +1 -1
- package/node/images/transform/operations/overlay/index.js +1 -1
- package/node/images/transform/operations/resize/index.d.ts +1 -1
- package/node/images/transform/operations/rotate/index.d.ts +1 -1
- package/node/images/transform/operations/saturate/index.d.ts +1 -1
- package/node/index.d.ts +5 -5
- package/node/index.js +5 -5
- package/node/process/prompt-continue/index.js +1 -1
- package/node/process/spawner/index.d.ts +1 -9
- package/node/process/spawner/index.js +10 -8
- package/node/sftp/directory/copy-dir/index.d.ts +2 -1
- package/node/sftp/directory/copy-dir/index.js +2 -2
- package/node/sftp/directory/list/index.d.ts +1 -1
- package/node/sftp/directory/move-dir/index.d.ts +1 -1
- package/node/sftp/directory/move-dir/index.js +2 -4
- package/node/sftp/directory/remove-dir/index.d.ts +2 -2
- package/node/sftp/file/copy/index.d.ts +2 -1
- package/node/sftp/file/copy/index.js +2 -2
- package/node/sftp/file/download/index.d.ts +3 -3
- package/node/sftp/file/exists/index.d.ts +1 -1
- package/node/sftp/file/index.d.ts +3 -3
- package/node/sftp/file/index.js +3 -3
- package/node/sftp/file/move/index.d.ts +3 -3
- package/node/sftp/file/move/index.js +3 -5
- package/node/sftp/file/remove/index.d.ts +1 -1
- package/node/sftp/file/remove/index.js +1 -1
- package/node/sftp/file/stat/index.d.ts +1 -1
- package/node/sftp/file/stat/index.js +1 -1
- package/node/sftp/file/upload/index.d.ts +3 -2
- package/node/sftp/file/upload/index.js +1 -1
- package/package.json +1260 -26
- package/components/Comp/index.d.ts +0 -1
- package/components/Comp/index.js +0 -8
|
@@ -19,21 +19,42 @@ export declare class Duration {
|
|
|
19
19
|
* @param type - The unit of the duration, either long or short form.
|
|
20
20
|
*/
|
|
21
21
|
constructor(value: number, type: DurationType | DurationTypeShort);
|
|
22
|
-
toMilliseconds
|
|
23
|
-
toMs()
|
|
22
|
+
toMilliseconds(): number;
|
|
23
|
+
toMs: () => number;
|
|
24
24
|
toSeconds(): number;
|
|
25
|
+
toS: () => number;
|
|
26
|
+
toSec: () => number;
|
|
25
27
|
toMinutes(): number;
|
|
28
|
+
toM: () => number;
|
|
29
|
+
toMin: () => number;
|
|
26
30
|
toHours(): number;
|
|
31
|
+
toH: () => number;
|
|
27
32
|
toDays(): number;
|
|
33
|
+
toD: () => number;
|
|
28
34
|
toWeeks(): number;
|
|
35
|
+
toW: () => number;
|
|
29
36
|
toMonths(): number;
|
|
37
|
+
toMth: () => number;
|
|
30
38
|
toYear(): number;
|
|
39
|
+
toY: () => number;
|
|
40
|
+
toYr: () => number;
|
|
31
41
|
}
|
|
32
42
|
export declare function milliseconds(value: number): Duration;
|
|
43
|
+
export declare const ms: typeof milliseconds;
|
|
33
44
|
export declare function seconds(value: number): Duration;
|
|
45
|
+
export declare const s: typeof seconds;
|
|
46
|
+
export declare const sec: typeof seconds;
|
|
34
47
|
export declare function minutes(value: number): Duration;
|
|
48
|
+
export declare const m: typeof minutes;
|
|
49
|
+
export declare const min: typeof minutes;
|
|
35
50
|
export declare function hours(value: number): Duration;
|
|
51
|
+
export declare const h: typeof hours;
|
|
36
52
|
export declare function days(value: number): Duration;
|
|
53
|
+
export declare const d: typeof days;
|
|
37
54
|
export declare function weeks(value: number): Duration;
|
|
55
|
+
export declare const w: typeof weeks;
|
|
38
56
|
export declare function months(value: number): Duration;
|
|
57
|
+
export declare const mth: typeof months;
|
|
39
58
|
export declare function years(value: number): Duration;
|
|
59
|
+
export declare const y: typeof years;
|
|
60
|
+
export declare const yr: typeof years;
|
|
@@ -10,7 +10,6 @@ var Duration = class {
|
|
|
10
10
|
*/
|
|
11
11
|
constructor(value, type) {
|
|
12
12
|
this.toMilliseconds = this.toMilliseconds.bind(this);
|
|
13
|
-
this.toMs = this.toMs.bind(this);
|
|
14
13
|
this.toSeconds = this.toSeconds.bind(this);
|
|
15
14
|
this.toMinutes = this.toMinutes.bind(this);
|
|
16
15
|
this.toHours = this.toHours.bind(this);
|
|
@@ -39,8 +38,8 @@ var Duration = class {
|
|
|
39
38
|
this.type = "milliseconds";
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
// [WIP] why only toMs and no other shorthands ?
|
|
42
|
+
toMilliseconds() {
|
|
44
43
|
if (this.type === "milliseconds") return this.value;
|
|
45
44
|
if (this.type === "seconds") return this.value * 1e3;
|
|
46
45
|
if (this.type === "minutes") return this.value * 1e3 * 60;
|
|
@@ -51,60 +50,93 @@ var Duration = class {
|
|
|
51
50
|
if (this.type === "years") return this.value * 1e3 * 60 * 60 * 24 * 365;
|
|
52
51
|
return this.value;
|
|
53
52
|
}
|
|
53
|
+
toMs = this.toMilliseconds.bind(this);
|
|
54
54
|
toSeconds() {
|
|
55
55
|
return this.toMs() / 1e3;
|
|
56
56
|
}
|
|
57
|
+
toS = this.toSeconds.bind(this);
|
|
58
|
+
toSec = this.toSeconds.bind(this);
|
|
57
59
|
toMinutes() {
|
|
58
60
|
return this.toMs() / (1e3 * 60);
|
|
59
61
|
}
|
|
62
|
+
toM = this.toMinutes.bind(this);
|
|
63
|
+
toMin = this.toMinutes.bind(this);
|
|
60
64
|
toHours() {
|
|
61
65
|
return this.toMs() / (1e3 * 60 * 60);
|
|
62
66
|
}
|
|
67
|
+
toH = this.toHours.bind(this);
|
|
63
68
|
toDays() {
|
|
64
69
|
return this.toMs() / (1e3 * 60 * 60 * 24);
|
|
65
70
|
}
|
|
71
|
+
toD = this.toDays.bind(this);
|
|
66
72
|
toWeeks() {
|
|
67
73
|
return this.toMs() / (1e3 * 60 * 60 * 24 * 7);
|
|
68
74
|
}
|
|
75
|
+
toW = this.toWeeks.bind(this);
|
|
69
76
|
toMonths() {
|
|
70
77
|
return this.toMs() / (1e3 * 60 * 60 * 24 * 30);
|
|
71
78
|
}
|
|
79
|
+
toMth = this.toMonths.bind(this);
|
|
72
80
|
toYear() {
|
|
73
81
|
return this.toMs() / (1e3 * 60 * 60 * 24 * 365);
|
|
74
82
|
}
|
|
83
|
+
toY = this.toYear.bind(this);
|
|
84
|
+
toYr = this.toYear.bind(this);
|
|
75
85
|
};
|
|
76
86
|
function milliseconds(value) {
|
|
77
87
|
return new Duration(value, "milliseconds");
|
|
78
88
|
}
|
|
89
|
+
var ms = milliseconds;
|
|
79
90
|
function seconds(value) {
|
|
80
91
|
return new Duration(value, "seconds");
|
|
81
92
|
}
|
|
93
|
+
var s = seconds;
|
|
94
|
+
var sec = seconds;
|
|
82
95
|
function minutes(value) {
|
|
83
96
|
return new Duration(value, "minutes");
|
|
84
97
|
}
|
|
98
|
+
var m = minutes;
|
|
99
|
+
var min = minutes;
|
|
85
100
|
function hours(value) {
|
|
86
101
|
return new Duration(value, "hours");
|
|
87
102
|
}
|
|
103
|
+
var h = hours;
|
|
88
104
|
function days(value) {
|
|
89
105
|
return new Duration(value, "days");
|
|
90
106
|
}
|
|
107
|
+
var d = days;
|
|
91
108
|
function weeks(value) {
|
|
92
109
|
return new Duration(value, "weeks");
|
|
93
110
|
}
|
|
111
|
+
var w = weeks;
|
|
94
112
|
function months(value) {
|
|
95
113
|
return new Duration(value, "months");
|
|
96
114
|
}
|
|
115
|
+
var mth = months;
|
|
97
116
|
function years(value) {
|
|
98
117
|
return new Duration(value, "years");
|
|
99
118
|
}
|
|
119
|
+
var y = years;
|
|
120
|
+
var yr = years;
|
|
100
121
|
export {
|
|
101
122
|
Duration,
|
|
123
|
+
d,
|
|
102
124
|
days,
|
|
125
|
+
h,
|
|
103
126
|
hours,
|
|
127
|
+
m,
|
|
104
128
|
milliseconds,
|
|
129
|
+
min,
|
|
105
130
|
minutes,
|
|
106
131
|
months,
|
|
132
|
+
ms,
|
|
133
|
+
mth,
|
|
134
|
+
s,
|
|
135
|
+
sec,
|
|
107
136
|
seconds,
|
|
137
|
+
w,
|
|
108
138
|
weeks,
|
|
109
|
-
|
|
139
|
+
y,
|
|
140
|
+
years,
|
|
141
|
+
yr
|
|
110
142
|
};
|
package/agnostic/time/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * as dates from './dates/index.js'
|
|
2
|
-
export * as duration from './duration/index.js'
|
|
3
2
|
export * as timeout from './timeout/index.js'
|
|
4
|
-
export * as
|
|
3
|
+
export * as duration from './duration/index.js'
|
|
5
4
|
export * as transitions from './transitions/index.js'
|
|
5
|
+
export * as wait from './wait/index.js'
|
package/agnostic/time/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * as dates from './dates/index.js'
|
|
2
|
-
export * as duration from './duration/index.js'
|
|
3
2
|
export * as timeout from './timeout/index.js'
|
|
4
|
-
export * as
|
|
3
|
+
export * as duration from './duration/index.js'
|
|
5
4
|
export * as transitions from './transitions/index.js'
|
|
5
|
+
export * as wait from './wait/index.js'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/agnostic/time/timeout/index.ts
|
|
2
|
-
function timeout(timeoutMs, callback) {
|
|
2
|
+
async function timeout(timeoutMs, callback) {
|
|
3
3
|
let hasRejected = false;
|
|
4
|
-
return new Promise(async (resolve, reject) => {
|
|
4
|
+
return await new Promise(async (resolve, reject) => {
|
|
5
5
|
const rejectTimeout = setTimeout(() => {
|
|
6
6
|
reject(false);
|
|
7
7
|
hasRejected = true;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Returns a promise that resolves after the specified duration in milliseconds.
|
|
3
3
|
*
|
|
4
4
|
* @param durationMs - Time to wait in milliseconds.
|
|
5
|
-
* @returns A promise that resolves to `
|
|
5
|
+
* @returns A promise that resolves to `void` after the delay.
|
|
6
6
|
*/
|
|
7
|
-
export declare function wait(durationMs: number): Promise<
|
|
7
|
+
export declare function wait(durationMs: number): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode, type JSX } from 'react';
|
|
2
|
+
export type Props = {
|
|
3
|
+
className?: string;
|
|
4
|
+
type?: string | string[];
|
|
5
|
+
targetSelector?: string;
|
|
6
|
+
onEvent?: (e: Event) => void;
|
|
7
|
+
content?: ReactNode;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare const EventListenerComponent: ({ className, type, targetSelector, onEvent, content, children }: Props) => JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// src/components/EventListener/index.tsx
|
|
2
|
+
import {
|
|
3
|
+
useRef,
|
|
4
|
+
useEffect
|
|
5
|
+
} from "react";
|
|
6
|
+
import { clss } from "../../agnostic/css/clss/index.js";
|
|
7
|
+
import { isNotFalsy } from "../../agnostic/booleans/is-falsy/index.js";
|
|
8
|
+
import { eventListener } from "../public-classnames.js";
|
|
9
|
+
import cssModule from "./styles.module.css";
|
|
10
|
+
import { jsxs } from "react/jsx-runtime";
|
|
11
|
+
var EventListenerComponent = ({
|
|
12
|
+
className,
|
|
13
|
+
type,
|
|
14
|
+
targetSelector,
|
|
15
|
+
onEvent,
|
|
16
|
+
content,
|
|
17
|
+
children
|
|
18
|
+
}) => {
|
|
19
|
+
const rootRef = useRef(null);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const root = rootRef.current;
|
|
22
|
+
if (onEvent === void 0 || type === void 0 || root === null) return;
|
|
23
|
+
const typeArr = Array.isArray(type) ? type : [type];
|
|
24
|
+
const elements = Array.from(targetSelector === void 0 ? [root] : root.querySelectorAll(targetSelector));
|
|
25
|
+
elements.forEach((elt) => {
|
|
26
|
+
typeArr.forEach((type2) => {
|
|
27
|
+
elt.addEventListener(type2, onEvent);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
return () => {
|
|
31
|
+
elements.forEach((elt) => {
|
|
32
|
+
typeArr.forEach((type2) => {
|
|
33
|
+
elt.removeEventListener(type2, onEvent);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
}, [targetSelector, type, onEvent]);
|
|
38
|
+
const c = clss(eventListener, { cssModule });
|
|
39
|
+
const wrapperClassName = [c(null), className].filter(isNotFalsy).join(" ");
|
|
40
|
+
return /* @__PURE__ */ jsxs("span", { className: wrapperClassName, ref: rootRef, children: [
|
|
41
|
+
children,
|
|
42
|
+
content
|
|
43
|
+
] });
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
EventListenerComponent
|
|
47
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/components/Input/index.tsx
|
|
2
|
+
import { clss } from "../../agnostic/css/clss/index.js";
|
|
3
|
+
import { randomHash } from "../../agnostic/random/uuid/index.js";
|
|
4
|
+
import * as classes from "../public-classnames.js";
|
|
5
|
+
import styles from "./styles.module.css";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
var Input = (props) => {
|
|
8
|
+
const { label, labelAfter } = props;
|
|
9
|
+
delete props.label;
|
|
10
|
+
delete props.labelAfter;
|
|
11
|
+
const c = clss([classes.input], { cssModule: styles });
|
|
12
|
+
const inputClassName = c(null, { alt: true });
|
|
13
|
+
const inputId = props.id ?? randomHash(8);
|
|
14
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15
|
+
label !== void 0 && labelAfter !== true && /* @__PURE__ */ jsx("label", { children: label }),
|
|
16
|
+
/* @__PURE__ */ jsx(
|
|
17
|
+
"input",
|
|
18
|
+
{
|
|
19
|
+
...props,
|
|
20
|
+
className: inputClassName,
|
|
21
|
+
id: inputId
|
|
22
|
+
}
|
|
23
|
+
),
|
|
24
|
+
label !== void 0 && labelAfter === true && /* @__PURE__ */ jsx("label", { children: label })
|
|
25
|
+
] });
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
Input
|
|
29
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode, type JSX } from 'react';
|
|
2
|
+
export type IO = IntersectionObserver;
|
|
3
|
+
export type IOE = IntersectionObserverEntry;
|
|
4
|
+
type ObserverOptions = {
|
|
5
|
+
root?: HTMLElement;
|
|
6
|
+
rootMargin?: string;
|
|
7
|
+
threshold?: number[] | number;
|
|
8
|
+
};
|
|
9
|
+
export type Props = {
|
|
10
|
+
className?: string;
|
|
11
|
+
render?: ReactNode;
|
|
12
|
+
onIntersection?: (details: {
|
|
13
|
+
ioEntry?: IOE | undefined;
|
|
14
|
+
observer: IO;
|
|
15
|
+
}) => void;
|
|
16
|
+
content?: ReactNode;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
} & ObserverOptions;
|
|
19
|
+
export declare const IntersectionObserverComponent: ({ className, render, content, onIntersection, root, rootMargin, threshold, children }: Props) => JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// src/components/IntersectionObserver/index.tsx
|
|
2
|
+
import {
|
|
3
|
+
useState,
|
|
4
|
+
useRef,
|
|
5
|
+
useEffect,
|
|
6
|
+
useCallback
|
|
7
|
+
} from "react";
|
|
8
|
+
import { clss } from "../../agnostic/css/clss/index.js";
|
|
9
|
+
import { isNotFalsy } from "../../agnostic/booleans/is-falsy/index.js";
|
|
10
|
+
import { intersectionObserver } from "../public-classnames.js";
|
|
11
|
+
import cssModule from "./styles.module.css";
|
|
12
|
+
import { jsxs } from "react/jsx-runtime";
|
|
13
|
+
var IntersectionObserverComponent = ({
|
|
14
|
+
className,
|
|
15
|
+
render,
|
|
16
|
+
content,
|
|
17
|
+
onIntersection,
|
|
18
|
+
root,
|
|
19
|
+
rootMargin,
|
|
20
|
+
threshold,
|
|
21
|
+
children
|
|
22
|
+
}) => {
|
|
23
|
+
const [ioEntry, setIoEntry] = useState(null);
|
|
24
|
+
const rootRef = useRef(null);
|
|
25
|
+
const observerRef = useRef(null);
|
|
26
|
+
const observation = useCallback((entries, observer) => {
|
|
27
|
+
const thisEntry = entries[0];
|
|
28
|
+
if (thisEntry === void 0) return setIoEntry(null);
|
|
29
|
+
if (onIntersection !== void 0) onIntersection({
|
|
30
|
+
ioEntry: thisEntry,
|
|
31
|
+
observer
|
|
32
|
+
});
|
|
33
|
+
setIoEntry(thisEntry);
|
|
34
|
+
}, [onIntersection]);
|
|
35
|
+
const forceObservation = useCallback(() => {
|
|
36
|
+
const rootEl = rootRef.current;
|
|
37
|
+
const observer = observerRef.current;
|
|
38
|
+
if (rootEl === null || observer === null) return;
|
|
39
|
+
observer.unobserve(rootEl);
|
|
40
|
+
observer.observe(rootEl);
|
|
41
|
+
}, []);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const rootEl = rootRef.current;
|
|
44
|
+
if (rootEl === null) return console.warn("rootRef.current should not be null");
|
|
45
|
+
const observer = new IntersectionObserver(observation, { root, rootMargin, threshold });
|
|
46
|
+
observerRef.current = observer;
|
|
47
|
+
observer.observe(rootEl);
|
|
48
|
+
return () => observer.disconnect();
|
|
49
|
+
}, [root, rootMargin, threshold, observation]);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const timeout1 = window.setTimeout(forceObservation, 100);
|
|
52
|
+
const timeout2 = window.setTimeout(forceObservation, 500);
|
|
53
|
+
return () => {
|
|
54
|
+
window.clearTimeout(timeout1);
|
|
55
|
+
window.clearTimeout(timeout2);
|
|
56
|
+
};
|
|
57
|
+
}, [forceObservation]);
|
|
58
|
+
const c = clss(intersectionObserver, { cssModule });
|
|
59
|
+
const isIntersecting = ioEntry?.isIntersecting ?? false;
|
|
60
|
+
const wrapperClassName = [
|
|
61
|
+
c(null, { "is-intersecting": isIntersecting }),
|
|
62
|
+
className
|
|
63
|
+
].filter(isNotFalsy).join(" ");
|
|
64
|
+
return /* @__PURE__ */ jsxs(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
ref: rootRef,
|
|
68
|
+
className: wrapperClassName,
|
|
69
|
+
children: [
|
|
70
|
+
render ?? null,
|
|
71
|
+
children,
|
|
72
|
+
content
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
export {
|
|
78
|
+
IntersectionObserverComponent
|
|
79
|
+
};
|
|
File without changes
|
package/components/index.d.ts
CHANGED
package/components/index.js
CHANGED
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S3Client, ListObjectsV2CommandInput, CopyObjectCommandInput } from '@aws-sdk/client-s3';
|
|
1
|
+
import { type S3Client, type ListObjectsV2CommandInput, type CopyObjectCommandInput } from '@aws-sdk/client-s3';
|
|
2
2
|
import * as Outcome from '../../../../../agnostic/misc/outcome/index.js';
|
|
3
3
|
export type CopyDirOptions = {
|
|
4
4
|
/** Extra parameters forwarded to each `ListObjectsV2Command`. `Bucket` and `Prefix` are supplied by this utility. */
|
|
@@ -10,7 +10,7 @@ export type CopyDirOptions = {
|
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Recursively copies every object under `sourceDir` to the same relative path
|
|
13
|
-
* beneath `targetDir` in a single S3 bucket (AWS
|
|
13
|
+
* beneath `targetDir` in a single S3 bucket (AWS SDK v3).
|
|
14
14
|
*
|
|
15
15
|
* @param {S3Client} client - The v3 S3 client instance.
|
|
16
16
|
* @param {string} bucketName - The name of the S3 bucket.
|
|
@@ -22,7 +22,7 @@ async function copyDir(client, bucketName, sourceDir, targetDir, options) {
|
|
|
22
22
|
})
|
|
23
23
|
);
|
|
24
24
|
for (const obj of listResp.Contents ?? []) {
|
|
25
|
-
if (
|
|
25
|
+
if (obj.Key === void 0) continue;
|
|
26
26
|
const rel = obj.Key.substring(from.length);
|
|
27
27
|
const dest = `${to}${rel}`;
|
|
28
28
|
if (!overwrite) {
|
|
@@ -45,8 +45,8 @@ async function copyDir(client, bucketName, sourceDir, targetDir, options) {
|
|
|
45
45
|
})
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
|
-
token = listResp.IsTruncated ? listResp.NextContinuationToken : void 0;
|
|
49
|
-
} while (token);
|
|
48
|
+
token = listResp.IsTruncated === true ? listResp.NextContinuationToken : void 0;
|
|
49
|
+
} while (token !== void 0);
|
|
50
50
|
return Outcome.makeSuccess(true);
|
|
51
51
|
} catch (err) {
|
|
52
52
|
return Outcome.makeFailure(unknownToString(err));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { S3Client, ListObjectsV2CommandInput } from '@aws-sdk/client-s3';
|
|
1
|
+
import { type S3Client, type ListObjectsV2CommandInput } from '@aws-sdk/client-s3';
|
|
2
2
|
import * as Outcome from '../../../../../agnostic/misc/outcome/index.js';
|
|
3
3
|
/** Extra parameters forwarded to each `ListObjectsV2Command`. */
|
|
4
4
|
export type ListOptions = Omit<ListObjectsV2CommandInput, 'Bucket' | 'Prefix' | 'Delimiter'>;
|
|
5
5
|
/**
|
|
6
6
|
* Lists all direct‑child object keys under a given directory prefix in an S3
|
|
7
|
-
* bucket (AWS
|
|
7
|
+
* bucket (AWS SDK v3). The listing is **non‑recursive**.
|
|
8
8
|
*
|
|
9
9
|
* @param {S3Client} client - The v3 S3 client used to list objects.
|
|
10
10
|
* @param {string} bucketName - The name of the S3 bucket.
|
|
@@ -15,7 +15,7 @@ async function list(client, bucketName, directoryPath, options) {
|
|
|
15
15
|
...options
|
|
16
16
|
})
|
|
17
17
|
);
|
|
18
|
-
const keys = (response.Contents ?? []).map((obj) => obj.Key).filter(
|
|
18
|
+
const keys = (response.Contents ?? []).map((obj) => obj.Key).filter((e) => e !== void 0);
|
|
19
19
|
return Outcome.makeSuccess(keys);
|
|
20
20
|
} catch (err) {
|
|
21
21
|
return Outcome.makeFailure(unknownToString(err));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S3Client, ListObjectsV2CommandInput, CopyObjectCommandInput, DeleteObjectCommandInput } from '@aws-sdk/client-s3';
|
|
1
|
+
import { type S3Client, type ListObjectsV2CommandInput, type CopyObjectCommandInput, type DeleteObjectCommandInput } from '@aws-sdk/client-s3';
|
|
2
2
|
import * as Outcome from '../../../../../agnostic/misc/outcome/index.js';
|
|
3
3
|
export type MoveDirOptions = {
|
|
4
4
|
/** Extra parameters forwarded to every `ListObjectsV2Command` call. */
|
|
@@ -16,9 +16,9 @@ export type MoveDirOptions = {
|
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Recursively moves every object under `sourceDir` to the corresponding path
|
|
19
|
-
* under `targetDir` within the same S3 bucket (AWS
|
|
19
|
+
* under `targetDir` within the same S3 bucket (AWS SDK v3).
|
|
20
20
|
*
|
|
21
|
-
* Behaviour when `overwrite`
|
|
21
|
+
* Behaviour when `overwrite` is **false** (default): abort if *any* destination
|
|
22
22
|
* key already exists.
|
|
23
23
|
*
|
|
24
24
|
* @param {S3Client} client - The v3 S3 client instance.
|
|
@@ -28,7 +28,7 @@ async function moveDir(client, bucketName, sourceDir, targetDir, options) {
|
|
|
28
28
|
})
|
|
29
29
|
);
|
|
30
30
|
for (const obj of listResp.Contents ?? []) {
|
|
31
|
-
if (
|
|
31
|
+
if (obj.Key === void 0) continue;
|
|
32
32
|
const rel = obj.Key.substring(from.length);
|
|
33
33
|
const dest = `${to}${rel}`;
|
|
34
34
|
if (!overwrite) {
|
|
@@ -58,8 +58,8 @@ async function moveDir(client, bucketName, sourceDir, targetDir, options) {
|
|
|
58
58
|
})
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
|
-
token = listResp.IsTruncated ? listResp.NextContinuationToken : void 0;
|
|
62
|
-
} while (token);
|
|
61
|
+
token = listResp.IsTruncated === true ? listResp.NextContinuationToken : void 0;
|
|
62
|
+
} while (token !== void 0);
|
|
63
63
|
return Outcome.makeSuccess(true);
|
|
64
64
|
} catch (err) {
|
|
65
65
|
return Outcome.makeFailure(unknownToString(err));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S3Client, ListObjectsV2CommandInput, DeleteObjectsCommandInput } from '@aws-sdk/client-s3';
|
|
1
|
+
import { type S3Client, type ListObjectsV2CommandInput, type DeleteObjectsCommandInput } from '@aws-sdk/client-s3';
|
|
2
2
|
import * as Outcome from '../../../../../agnostic/misc/outcome/index.js';
|
|
3
3
|
export type RemoveDirOptions = {
|
|
4
4
|
/** Extra parameters forwarded to each `ListObjectsV2Command` call. */
|
|
@@ -15,7 +15,7 @@ export type RemoveDirOptions = {
|
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* Recursively deletes all objects under a directory prefix in an S3 bucket
|
|
18
|
-
* using the AWS
|
|
18
|
+
* using the AWS SDK v3 client. Handles pagination and the 1 000‑key limit of
|
|
19
19
|
* `DeleteObjects`.
|
|
20
20
|
*
|
|
21
21
|
* @param {S3Client} client - The v3 S3 client instance.
|
|
@@ -24,8 +24,8 @@ async function removeDir(client, bucketName, directoryPath, options) {
|
|
|
24
24
|
...listObjectsOptions
|
|
25
25
|
})
|
|
26
26
|
);
|
|
27
|
-
const keys = (listResp.Contents ?? []).map((o) => o.Key).filter(
|
|
28
|
-
if (keys.length) {
|
|
27
|
+
const keys = (listResp.Contents ?? []).map((o) => o.Key).filter((e) => e !== void 0);
|
|
28
|
+
if (keys.length > 0) {
|
|
29
29
|
anyFound = true;
|
|
30
30
|
for (let i = 0; i < keys.length; i += 1e3) {
|
|
31
31
|
const chunk = keys.slice(i, i + 1e3);
|
|
@@ -38,8 +38,8 @@ async function removeDir(client, bucketName, directoryPath, options) {
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
continuationToken = listResp.IsTruncated ? listResp.NextContinuationToken : void 0;
|
|
42
|
-
} while (continuationToken);
|
|
41
|
+
continuationToken = listResp.IsTruncated === true ? listResp.NextContinuationToken : void 0;
|
|
42
|
+
} while (continuationToken !== void 0);
|
|
43
43
|
if (!anyFound && !ignoreMissing) {
|
|
44
44
|
return Outcome.makeFailure(`No objects found for prefix "${prefix}".`);
|
|
45
45
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Readable } from 'node:stream';
|
|
2
|
-
import { S3Client, GetObjectCommandInput } from '@aws-sdk/client-s3';
|
|
1
|
+
import { type Readable } from 'node:stream';
|
|
2
|
+
import { type S3Client, type GetObjectCommandInput } from '@aws-sdk/client-s3';
|
|
3
3
|
import * as Outcome from '../../../../../agnostic/misc/outcome/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Additional parameters forwarded to `GetObjectCommand`.
|
|
@@ -9,7 +9,7 @@ export type DownloadOptions = Omit<GetObjectCommandInput, 'Bucket' | 'Key'>;
|
|
|
9
9
|
/**
|
|
10
10
|
* Downloads a file from a specified Amazon S3 bucket.
|
|
11
11
|
*
|
|
12
|
-
* The function streams the object’s content back as a Node
|
|
12
|
+
* The function streams the object’s content back as a Node `Readable`.
|
|
13
13
|
*
|
|
14
14
|
* @param {S3Client} client - The v3 S3 client instance.
|
|
15
15
|
* @param {string} bucketName - The name of the S3 bucket.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S3Client, HeadObjectCommandInput } from '@aws-sdk/client-s3';
|
|
1
|
+
import { type S3Client, type HeadObjectCommandInput } from '@aws-sdk/client-s3';
|
|
2
2
|
import * as Outcome from '../../../../../agnostic/misc/outcome/index.js';
|
|
3
3
|
export type ExistsOptions = {
|
|
4
4
|
/**
|
|
@@ -8,7 +8,7 @@ export type ExistsOptions = {
|
|
|
8
8
|
headObjectOptions?: Omit<HeadObjectCommandInput, 'Bucket' | 'Key'>;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
* Checks whether an object exists in a specified S3 bucket (AWS
|
|
11
|
+
* Checks whether an object exists in a specified S3 bucket (AWS SDK v3).
|
|
12
12
|
*
|
|
13
13
|
* @param {S3Client} client - The v3 S3 client instance.
|
|
14
14
|
* @param {string} bucketName - The name of the S3 bucket.
|
|
@@ -16,8 +16,7 @@ async function exists(client, bucketName, sourcePath, options) {
|
|
|
16
16
|
);
|
|
17
17
|
return Outcome.makeSuccess(true);
|
|
18
18
|
} catch (err) {
|
|
19
|
-
const notFound = err.$metadata?.httpStatusCode === 404 || err.name === "NotFound" || err.Code === "NotFound" ||
|
|
20
|
-
err.Code === "NoSuchKey";
|
|
19
|
+
const notFound = err.$metadata?.httpStatusCode === 404 || err.name === "NotFound" || err.Code === "NotFound" || err.Code === "NoSuchKey";
|
|
21
20
|
if (notFound) {
|
|
22
21
|
return Outcome.makeSuccess(false);
|
|
23
22
|
}
|