Compare commits

...

63 Commits

Author SHA1 Message Date
948fba3a2c Allow disabling response decoding
All checks were successful
Build / Build NPM Project (push) Successful in 49s
Build / Tag Version (push) Successful in 8s
2024-08-13 14:48:48 -04:00
a168b03caf Renamed entry point to index
All checks were successful
Build / Build NPM Project (push) Successful in 47s
Build / Tag Version (push) Successful in 7s
2024-08-09 12:27:44 -04:00
75160b7dbc Fixed upload headers
All checks were successful
Build / Build NPM Project (push) Successful in 22s
Build / Tag Version (push) Successful in 4s
2024-07-19 10:16:31 -04:00
af887a0bfb Fixed http body
All checks were successful
Build / Build NPM Project (push) Successful in 22s
Build / Tag Version (push) Successful in 4s
2024-07-19 10:05:47 -04:00
7626c20f08 Improved http
All checks were successful
Build / Build NPM Project (push) Successful in 22s
Build / Tag Version (push) Successful in 5s
2024-07-19 09:24:53 -04:00
6998616445 Fixed import
All checks were successful
Build / Build NPM Project (push) Successful in 22s
Build / Tag Version (push) Successful in 4s
2024-07-19 09:02:42 -04:00
627757ff6d Added generics to upload function
All checks were successful
Build / Build NPM Project (push) Successful in 22s
Build / Tag Version (push) Successful in 4s
2024-07-19 08:59:15 -04:00
0a775f919b Added filebrowser & Merged a bunch of functions into file utilities
All checks were successful
Build / Build NPM Project (push) Successful in 23s
Build / Tag Version (push) Successful in 4s
2024-07-19 08:45:33 -04:00
7063b80bdd Added download blob function
All checks were successful
Build / Build NPM Project (push) Successful in 22s
Build / Tag Version (push) Successful in 5s
2024-07-19 08:33:26 -04:00
f3049160b6 Fixed imports
All checks were successful
Build / Build NPM Project (push) Successful in 21s
Build / Tag Version (push) Successful in 4s
2024-07-19 00:26:30 -04:00
e21273ddb2 Fixed exports
All checks were successful
Build / Build NPM Project (push) Successful in 21s
Build / Tag Version (push) Successful in 4s
2024-07-19 00:22:00 -04:00
8d3b427c1b Fix build?
All checks were successful
Build / Build NPM Project (push) Successful in 24s
Build / Tag Version (push) Successful in 4s
2024-07-19 00:09:40 -04:00
87857a01c5 Fix build?
Some checks failed
Build / Build NPM Project (push) Failing after 8s
Build / Tag Version (push) Has been skipped
2024-07-19 00:08:39 -04:00
535e579b43 Fix build?
Some checks failed
Build / Build NPM Project (push) Failing after 7s
Build / Tag Version (push) Has been skipped
2024-07-19 00:06:17 -04:00
2934f86530 Fix build?
Some checks failed
Build / Build NPM Project (push) Failing after 8s
Build / Tag Version (push) Has been skipped
2024-07-19 00:04:16 -04:00
0693397164 Added upload function with PromiseProgress support
Some checks failed
Build / Build NPM Project (push) Failing after 29s
Build / Tag Version (push) Has been skipped
2024-07-18 23:59:54 -04:00
2a878b7962 Updated XHR to HTTP with PromiseProgress support 2024-07-18 23:59:12 -04:00
7b2d4ba119 updated xhr error handling
All checks were successful
Build / Build NPM Project (push) Successful in 42s
Build / Tag Version (push) Successful in 4s
2024-06-25 09:58:02 -04:00
1a4e732fd5 deepMerge fix
All checks were successful
Build / Build NPM Project (push) Successful in 22s
Build / Tag Version (push) Successful in 5s
2024-06-18 21:08:18 -04:00
3a039c935f export deepMerge
All checks were successful
Build / Build NPM Project (push) Successful in 22s
Build / Tag Version (push) Successful in 4s
2024-06-18 20:19:10 -04:00
ac5b0b8b41 Added merge object
All checks were successful
Build / Build NPM Project (push) Successful in 21s
Build / Tag Version (push) Successful in 5s
2024-06-18 19:31:08 -04:00
3f85c9cf7d Updated package.json to include types file
All checks were successful
Build / Build NPM Project (push) Successful in 41s
Build / Tag Version (push) Successful in 5s
2024-06-17 10:23:48 -04:00
1eff60e7dd Fixed build
All checks were successful
Build / Build NPM Project (push) Successful in 22s
Build / Tag Version (push) Successful in 5s
2024-06-16 08:36:45 -04:00
1d9ad2ef63 Fixed module exports?
All checks were successful
Build / Build NPM Project (push) Successful in 38s
Build / Tag Version (push) Successful in 5s
Build / Publish (push) Successful in 7s
2024-06-16 08:29:49 -04:00
973a884b3e Added query & fragment to xhr
All checks were successful
Build / Build NPM Project (push) Successful in 38s
Build / Tag Version (push) Successful in 5s
Build / Publish (push) Successful in 7s
2024-06-15 22:29:37 -04:00
6f60f8bd94 Changed XHR error handling
All checks were successful
Build / Build NPM Project (push) Successful in 1m13s
Build / Tag Version (push) Successful in 16s
Build / Publish (push) Successful in 22s
2024-05-31 13:42:28 -04:00
07606cd996 Removed custom errors from xhr helper
All checks were successful
Build / Build NPM Project (push) Successful in 1m14s
Build / Tag Version (push) Successful in 16s
Build / Publish (push) Successful in 23s
2024-05-31 12:37:01 -04:00
3ca956e531 Fixed fetch errors
All checks were successful
Build / Build NPM Project (push) Successful in 1m27s
Build / Tag Version (push) Successful in 18s
Build / Publish (push) Successful in 26s
2024-05-31 10:04:51 -04:00
9350c837e5 Added math functions
All checks were successful
Build / Build NPM Project (push) Successful in 1m29s
Build / Tag Version (push) Successful in 19s
Build / Publish (push) Successful in 26s
2024-05-27 13:51:41 -04:00
86196c3feb Added promise progress
All checks were successful
Build / Build NPM Project (push) Successful in 17s
Build / Tag Version (push) Successful in 4s
Build / Publish (push) Successful in 7s
2024-04-27 23:09:12 -04:00
0985ff145e Fixed file upload types
All checks were successful
Build / Build NPM Project (push) Successful in 16s
Build / Tag Version (push) Successful in 4s
Build / Publish (push) Successful in 7s
2024-04-24 07:06:17 -04:00
7cd717fc7d Fixed upload export
All checks were successful
Build / Build NPM Project (push) Successful in 15s
Build / Tag Version (push) Successful in 5s
Build / Publish (push) Successful in 7s
2024-04-24 07:01:36 -04:00
2fe8cdb96a Added upload function which tracks progress
All checks were successful
Build / Build NPM Project (push) Successful in 16s
Build / Tag Version (push) Successful in 4s
Build / Publish (push) Successful in 7s
2024-04-24 06:57:15 -04:00
34c2df7a1a Fixed import
All checks were successful
Build / Build NPM Project (push) Successful in 16s
Build / Tag Version (push) Successful in 4s
Build / Publish (push) Successful in 7s
2024-04-23 09:09:07 -04:00
1d5509a078 Fixed export
All checks were successful
Build / Build NPM Project (push) Successful in 16s
Build / Tag Version (push) Successful in 4s
Build / Publish (push) Successful in 7s
2024-04-23 09:03:51 -04:00
9f57b93a9f Download stream
All checks were successful
Build / Build NPM Project (push) Successful in 17s
Build / Tag Version (push) Successful in 4s
Build / Publish (push) Successful in 10s
2024-04-23 09:02:10 -04:00
d0e9cbcaa6 Added download utilities
All checks were successful
Build / Build NPM Project (push) Successful in 37s
Build / Tag Version (push) Successful in 7s
Build / Publish (push) Successful in 14s
2024-04-21 21:33:38 -04:00
67b314b507 Added download function using fetch and links
All checks were successful
Build / Build NPM Project (push) Successful in 37s
Build / Tag Version (push) Successful in 7s
Build / Publish (push) Successful in 16s
2024-04-21 21:03:07 -04:00
f5d66f0d8f Fixed aset export
All checks were successful
Build / Build NPM Project (push) Successful in 35s
Build / Tag Version (push) Successful in 7s
Build / Publish (push) Successful in 13s
2024-04-16 14:16:30 -04:00
18c4366866 Added ASet
All checks were successful
Build / Build NPM Project (push) Successful in 37s
Build / Tag Version (push) Successful in 8s
Build / Publish (push) Successful in 15s
2024-04-16 14:05:41 -04:00
d9844797ec Fixing build?
All checks were successful
Build / Build NPM Project (push) Successful in 21s
Build / Tag Version (push) Successful in 4s
Build / Publish (push) Successful in 12s
2024-04-14 08:01:17 -04:00
9ae28849e3 trying to fix build?
Some checks failed
Build / Build NPM Project (push) Failing after 0s
Build / Tag Version (push) Has been skipped
Build / Publish (push) Has been skipped
2024-04-14 07:57:35 -04:00
7324e89ad8 Added sanitizedJSON
Some checks failed
Build / Build NPM Project (push) Failing after 0s
Build / Tag Version (push) Has been skipped
Build / Publish (push) Has been skipped
2024-04-14 07:53:58 -04:00
65f8414a5c Bump
Some checks failed
Build / Build NPM Project (push) Failing after 0s
Build / Tag Version (push) Has been skipped
Build / Publish (push) Has been skipped
2024-04-12 21:11:04 -04:00
86d2d34615 Fixed xhr
Some checks failed
Build / Build NPM Project (push) Failing after 0s
Build / Tag Version (push) Has been skipped
Build / Publish (push) Has been skipped
2024-04-12 20:40:10 -04:00
be8c297c47 Fixed xhr
Some checks failed
Build / Build NPM Project (push) Failing after 0s
Build / Tag Version (push) Has been skipped
Build / Publish (push) Has been skipped
2024-04-12 19:45:11 -04:00
85fc5f3017 Added mixin
Some checks failed
Build / Build NPM Project (push) Failing after 0s
Build / Tag Version (push) Has been skipped
Build / Publish (push) Has been skipped
2024-04-11 23:19:36 -04:00
c8ccc19996 Updated logger & emitter
Some checks failed
Build / Build NPM Project (push) Failing after 0s
Build / Tag Version (push) Has been skipped
Build / Publish (push) Has been skipped
2024-04-11 20:22:44 -04:00
77e6a40261 fixed gravatar default image
All checks were successful
Build / Build NPM Project (push) Successful in 14s
Build / Tag Version (push) Successful in 4s
Build / Publish (push) Successful in 7s
2024-03-20 20:45:41 -04:00
3deb536323 fixed gravatar default image
All checks were successful
Build / Build NPM Project (push) Successful in 14s
Build / Tag Version (push) Successful in 6s
Build / Publish (push) Successful in 7s
2024-03-20 20:44:53 -04:00
f6b0e63751 Updated gravatar function to supply default image
All checks were successful
Build / Build NPM Project (push) Successful in 20s
Build / Tag Version (push) Successful in 4s
Build / Publish (push) Successful in 8s
2024-03-20 19:26:13 -04:00
d52f9cfdc3 Fixed logger
All checks were successful
Build / Build NPM Project (push) Successful in 32s
Build / Tag Version (push) Successful in 10s
Build / Publish (push) Successful in 29s
2024-03-04 11:11:11 -05:00
0ffe3d6b13 Updated logger
All checks were successful
Build / Build NPM Project (push) Successful in 33s
Build / Tag Version (push) Successful in 8s
Build / Publish (push) Successful in 14s
2024-03-03 19:26:20 -05:00
d4bd054953 Made pad function a little easier to use
All checks were successful
Build / Build NPM Project (push) Successful in 31s
Build / Tag Version (push) Successful in 7s
Build / Publish (push) Successful in 14s
2024-02-29 10:30:48 -05:00
cf9bdca2ba Made pad function a little easier to use
All checks were successful
Build / Build NPM Project (push) Successful in 32s
Build / Tag Version (push) Successful in 8s
Build / Publish (push) Successful in 18s
2024-02-29 10:26:56 -05:00
0e2d720fdf Made pad function a little easier to use
Some checks failed
Build / Tag Version (push) Blocked by required conditions
Build / Publish (push) Blocked by required conditions
Build / Build NPM Project (push) Has been cancelled
2024-02-29 10:26:49 -05:00
061e27d92a Fixed build
All checks were successful
Build / Build NPM Project (push) Successful in 32s
Build / Tag Version (push) Successful in 7s
Build / Publish (push) Successful in 17s
2024-02-28 23:57:20 -05:00
63a5c5f6b7 Reverted that revert because I should be using npx anyways
All checks were successful
Build / Tag Version (push) Successful in 9s
Build / Publish (push) Successful in 18s
Build / Build NPM Project (push) Successful in 39s
2024-02-28 23:52:03 -05:00
64a0eac6df Reverted that revert because I should be using npx anyways
Some checks failed
Build / Build NPM Project (push) Failing after 7s
Build / Publish (push) Has been skipped
Build / Tag Version (push) Has been skipped
2024-02-28 23:51:56 -05:00
3e1341d876 Reverted that revert because I should be using npx anyways
Some checks failed
Build / Tag Version (push) Blocked by required conditions
Build / Publish (push) Blocked by required conditions
Build / Build NPM Project (push) Has been cancelled
2024-02-28 23:51:22 -05:00
b3457ed588 Reverted build changes
All checks were successful
Build / Build NPM Project (push) Successful in 33s
Build / Tag Version (push) Successful in 7s
Build / Publish (push) Successful in 13s
2024-02-28 23:50:16 -05:00
210f007e07 Added padding utility and updated logger object
All checks were successful
Build / Build NPM Project (push) Successful in 31s
Build / Tag Version (push) Successful in 7s
Build / Publish (push) Successful in 14s
2024-02-28 23:43:07 -05:00
24edc4a12d Changed logger events
All checks were successful
Build / Build NPM Project (push) Successful in 30s
Build / Tag Version (push) Successful in 12s
Build / Publish (push) Successful in 21s
2024-02-28 19:23:58 -05:00
18 changed files with 690 additions and 474 deletions

View File

@ -9,39 +9,28 @@ jobs:
build: build:
name: Build NPM Project name: Build NPM Project
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container: node:20-alpine
image: node
volumes:
- '/mnt/swarm/gitea/runner/cache:/cache'
steps: steps:
- name: Clone Repository - name: Clone Repository
uses: ztimson/actions/clone@develop uses: ztimson/actions/clone@develop
- name: Restore node_modules - name: Install & Build
uses: ztimson/actions/cache/restore@develop run: |
with: npm i
key: node_modules npm run build
- name: Install Dependencies
run: npm i
- name: Build Project
run: npm run build
- name: Test - name: Test
run: npm run test:coverage run: npm run test:coverage
- name: Cache node_modules - name: Upload to Registry
uses: ztimson/actions/cache@develop uses: ztimson/actions/npm/publish@develop
with:
key: node_modules
pattern: node_modules
- name: Cache Artifacts - name: Upload to NPM
uses: ztimson/actions/cache@develop uses: ztimson/actions/npm/publish@develop
with: with:
key: dist owner: ztimson
pattern: dist registry: https://registry.npmjs.org/
token: ${{secrets.NPM_TOKEN}}
tag: tag:
name: Tag Version name: Tag Version
needs: build needs: build
@ -59,31 +48,3 @@ jobs:
uses: ztimson/actions/tag@develop uses: ztimson/actions/tag@develop
with: with:
tag: ${{env.VERSION}} tag: ${{env.VERSION}}
publish:
name: Publish
needs: build
if: ${{github.ref_name}} == 'release'
runs-on: ubuntu-latest
container:
image: node
volumes:
- '/mnt/swarm/gitea/runner/cache:/cache'
steps:
- name: Clone Repository
uses: ztimson/actions/clone@develop
- name: Restore Artifacts
uses: ztimson/actions/cache/restore@develop
with:
key: dist
- name: Upload to Registry
uses: ztimson/actions/npm/publish@develop
- name: Upload to NPM
uses: ztimson/actions/npm/publish@develop
with:
owner: ztimson
registry: https://registry.npmjs.org/
token: ${{secrets.NPM_TOKEN}}

363
package-lock.json generated
View File

@ -1,16 +1,15 @@
{ {
"name": "@ztimson/js-utilities", "name": "@ztimson/utils",
"version": "0.0.0", "version": "0.10.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@ztimson/js-utilities", "name": "@ztimson/utils",
"version": "0.0.0", "version": "0.10.4",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/node": "^18.14.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-junit": "^16.0.0", "jest-junit": "^16.0.0",
"ts-jest": "^29.1.2", "ts-jest": "^29.1.2",
@ -688,9 +687,9 @@
"dev": true "dev": true
}, },
"node_modules/@esbuild/aix-ppc64": { "node_modules/@esbuild/aix-ppc64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz",
"integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==", "integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==",
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
@ -704,9 +703,9 @@
} }
}, },
"node_modules/@esbuild/android-arm": { "node_modules/@esbuild/android-arm": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.2.tgz",
"integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==", "integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@ -720,9 +719,9 @@
} }
}, },
"node_modules/@esbuild/android-arm64": { "node_modules/@esbuild/android-arm64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz",
"integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==", "integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -736,9 +735,9 @@
} }
}, },
"node_modules/@esbuild/android-x64": { "node_modules/@esbuild/android-x64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.2.tgz",
"integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==", "integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -752,9 +751,9 @@
} }
}, },
"node_modules/@esbuild/darwin-arm64": { "node_modules/@esbuild/darwin-arm64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz",
"integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==", "integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -768,9 +767,9 @@
} }
}, },
"node_modules/@esbuild/darwin-x64": { "node_modules/@esbuild/darwin-x64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz",
"integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==", "integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -784,9 +783,9 @@
} }
}, },
"node_modules/@esbuild/freebsd-arm64": { "node_modules/@esbuild/freebsd-arm64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz",
"integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==", "integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -800,9 +799,9 @@
} }
}, },
"node_modules/@esbuild/freebsd-x64": { "node_modules/@esbuild/freebsd-x64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz",
"integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==", "integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -816,9 +815,9 @@
} }
}, },
"node_modules/@esbuild/linux-arm": { "node_modules/@esbuild/linux-arm": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz",
"integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==", "integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@ -832,9 +831,9 @@
} }
}, },
"node_modules/@esbuild/linux-arm64": { "node_modules/@esbuild/linux-arm64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz",
"integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==", "integrity": "sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -848,9 +847,9 @@
} }
}, },
"node_modules/@esbuild/linux-ia32": { "node_modules/@esbuild/linux-ia32": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz",
"integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==", "integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@ -864,9 +863,9 @@
} }
}, },
"node_modules/@esbuild/linux-loong64": { "node_modules/@esbuild/linux-loong64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz",
"integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==", "integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==",
"cpu": [ "cpu": [
"loong64" "loong64"
], ],
@ -880,9 +879,9 @@
} }
}, },
"node_modules/@esbuild/linux-mips64el": { "node_modules/@esbuild/linux-mips64el": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz",
"integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==", "integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==",
"cpu": [ "cpu": [
"mips64el" "mips64el"
], ],
@ -896,9 +895,9 @@
} }
}, },
"node_modules/@esbuild/linux-ppc64": { "node_modules/@esbuild/linux-ppc64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz",
"integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==", "integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==",
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
@ -912,9 +911,9 @@
} }
}, },
"node_modules/@esbuild/linux-riscv64": { "node_modules/@esbuild/linux-riscv64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz",
"integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==", "integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==",
"cpu": [ "cpu": [
"riscv64" "riscv64"
], ],
@ -928,9 +927,9 @@
} }
}, },
"node_modules/@esbuild/linux-s390x": { "node_modules/@esbuild/linux-s390x": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz",
"integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==", "integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==",
"cpu": [ "cpu": [
"s390x" "s390x"
], ],
@ -944,9 +943,9 @@
} }
}, },
"node_modules/@esbuild/linux-x64": { "node_modules/@esbuild/linux-x64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz",
"integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==", "integrity": "sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -960,9 +959,9 @@
} }
}, },
"node_modules/@esbuild/netbsd-x64": { "node_modules/@esbuild/netbsd-x64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz",
"integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==", "integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -976,9 +975,9 @@
} }
}, },
"node_modules/@esbuild/openbsd-x64": { "node_modules/@esbuild/openbsd-x64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz",
"integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==", "integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -992,9 +991,9 @@
} }
}, },
"node_modules/@esbuild/sunos-x64": { "node_modules/@esbuild/sunos-x64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz",
"integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==", "integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -1008,9 +1007,9 @@
} }
}, },
"node_modules/@esbuild/win32-arm64": { "node_modules/@esbuild/win32-arm64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz",
"integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==", "integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1024,9 +1023,9 @@
} }
}, },
"node_modules/@esbuild/win32-ia32": { "node_modules/@esbuild/win32-ia32": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz",
"integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==", "integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@ -1040,9 +1039,9 @@
} }
}, },
"node_modules/@esbuild/win32-x64": { "node_modules/@esbuild/win32-x64": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz",
"integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==", "integrity": "sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -1494,9 +1493,9 @@
} }
}, },
"node_modules/@rollup/rollup-android-arm-eabi": { "node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.14.2.tgz",
"integrity": "sha512-MVNXSSYN6QXOulbHpLMKYi60ppyO13W9my1qogeiAqtjb2yR4LSmfU2+POvDkLzhjYLXz9Rf9+9a3zFHW1Lecg==", "integrity": "sha512-ahxSgCkAEk+P/AVO0vYr7DxOD3CwAQrT0Go9BJyGQ9Ef0QxVOfjDZMiF4Y2s3mLyPrjonchIMH/tbWHucJMykQ==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@ -1507,9 +1506,9 @@
] ]
}, },
"node_modules/@rollup/rollup-android-arm64": { "node_modules/@rollup/rollup-android-arm64": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.14.2.tgz",
"integrity": "sha512-T14aNLpqJ5wzKNf5jEDpv5zgyIqcpn1MlwCrUXLrwoADr2RkWA0vOWP4XxbO9aiO3dvMCQICZdKeDrFl7UMClw==", "integrity": "sha512-lAarIdxZWbFSHFSDao9+I/F5jDaKyCqAPMq5HqnfpBw8dKDiCaaqM0lq5h1pQTLeIqueeay4PieGR5jGZMWprw==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1520,9 +1519,9 @@
] ]
}, },
"node_modules/@rollup/rollup-darwin-arm64": { "node_modules/@rollup/rollup-darwin-arm64": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.14.2.tgz",
"integrity": "sha512-CqNNAyhRkTbo8VVZ5R85X73H3R5NX9ONnKbXuHisGWC0qRbTTxnF1U4V9NafzJbgGM0sHZpdO83pLPzq8uOZFw==", "integrity": "sha512-SWsr8zEUk82KSqquIMgZEg2GE5mCSfr9sE/thDROkX6pb3QQWPp8Vw8zOq2GyxZ2t0XoSIUlvHDkrf5Gmf7x3Q==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1533,9 +1532,9 @@
] ]
}, },
"node_modules/@rollup/rollup-darwin-x64": { "node_modules/@rollup/rollup-darwin-x64": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.14.2.tgz",
"integrity": "sha512-zRDtdJuRvA1dc9Mp6BWYqAsU5oeLixdfUvkTHuiYOHwqYuQ4YgSmi6+/lPvSsqc/I0Omw3DdICx4Tfacdzmhog==", "integrity": "sha512-o/HAIrQq0jIxJAhgtIvV5FWviYK4WB0WwV91SLUnsliw1lSAoLsmgEEgRWzDguAFeUEUUoIWXiJrPqU7vGiVkA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -1546,9 +1545,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm-gnueabihf": { "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.14.2.tgz",
"integrity": "sha512-oNk8YXDDnNyG4qlNb6is1ojTOGL/tRhbbKeE/YuccItzerEZT68Z9gHrY3ROh7axDc974+zYAPxK5SH0j/G+QQ==", "integrity": "sha512-nwlJ65UY9eGq91cBi6VyDfArUJSKOYt5dJQBq8xyLhvS23qO+4Nr/RreibFHjP6t+5ap2ohZrUJcHv5zk5ju/g==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@ -1559,9 +1558,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm64-gnu": { "node_modules/@rollup/rollup-linux-arm64-gnu": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.14.2.tgz",
"integrity": "sha512-Z3O60yxPtuCYobrtzjo0wlmvDdx2qZfeAWTyfOjEDqd08kthDKexLpV97KfAeUXPosENKd8uyJMRDfFMxcYkDQ==", "integrity": "sha512-Pg5TxxO2IVlMj79+c/9G0LREC9SY3HM+pfAwX7zj5/cAuwrbfj2Wv9JbMHIdPCfQpYsI4g9mE+2Bw/3aeSs2rQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1572,9 +1571,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm64-musl": { "node_modules/@rollup/rollup-linux-arm64-musl": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.14.2.tgz",
"integrity": "sha512-gpiG0qQJNdYEVad+1iAsGAbgAnZ8j07FapmnIAQgODKcOTjLEWM9sRb+MbQyVsYCnA0Im6M6QIq6ax7liws6eQ==", "integrity": "sha512-cAOTjGNm84gc6tS02D1EXtG7tDRsVSDTBVXOLbj31DkwfZwgTPYZ6aafSU7rD/4R2a34JOwlF9fQayuTSkoclA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1584,10 +1583,23 @@
"linux" "linux"
] ]
}, },
"node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
"version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.14.2.tgz",
"integrity": "sha512-4RyT6v1kXb7C0fn6zV33rvaX05P0zHoNzaXI/5oFHklfKm602j+N4mn2YvoezQViRLPnxP8M1NaY4s/5kXO5cw==",
"cpu": [
"ppc64"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-linux-riscv64-gnu": { "node_modules/@rollup/rollup-linux-riscv64-gnu": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.14.2.tgz",
"integrity": "sha512-+uCOcvVmFUYvVDr27aiyun9WgZk0tXe7ThuzoUTAukZJOwS5MrGbmSlNOhx1j80GdpqbOty05XqSl5w4dQvcOA==", "integrity": "sha512-KNUH6jC/vRGAKSorySTyc/yRYlCwN/5pnMjXylfBniwtJx5O7X17KG/0efj8XM3TZU7raYRXJFFReOzNmL1n1w==",
"cpu": [ "cpu": [
"riscv64" "riscv64"
], ],
@ -1597,10 +1609,23 @@
"linux" "linux"
] ]
}, },
"node_modules/@rollup/rollup-linux-s390x-gnu": {
"version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.14.2.tgz",
"integrity": "sha512-xPV4y73IBEXToNPa3h5lbgXOi/v0NcvKxU0xejiFw6DtIYQqOTMhZ2DN18/HrrP0PmiL3rGtRG9gz1QE8vFKXQ==",
"cpu": [
"s390x"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-linux-x64-gnu": { "node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.14.2.tgz",
"integrity": "sha512-HUNqM32dGzfBKuaDUBqFB7tP6VMN74eLZ33Q9Y1TBqRDn+qDonkAUyKWwF9BR9unV7QUzffLnz9GrnKvMqC/fw==", "integrity": "sha512-QBhtr07iFGmF9egrPOWyO5wciwgtzKkYPNLVCFZTmr4TWmY0oY2Dm/bmhHjKRwZoGiaKdNcKhFtUMBKvlchH+Q==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -1611,9 +1636,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-x64-musl": { "node_modules/@rollup/rollup-linux-x64-musl": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.14.2.tgz",
"integrity": "sha512-ch7M+9Tr5R4FK40FHQk8VnML0Szi2KRujUgHXd/HjuH9ifH72GUmw6lStZBo3c3GB82vHa0ZoUfjfcM7JiiMrQ==", "integrity": "sha512-8zfsQRQGH23O6qazZSFY5jP5gt4cFvRuKTpuBsC1ZnSWxV8ZKQpPqOZIUtdfMOugCcBvFGRa1pDC/tkf19EgBw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -1624,9 +1649,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-arm64-msvc": { "node_modules/@rollup/rollup-win32-arm64-msvc": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.14.2.tgz",
"integrity": "sha512-VD6qnR99dhmTQ1mJhIzXsRcTBvTjbfbGGwKAHcu+52cVl15AC/kplkhxzW/uT0Xl62Y/meBKDZvoJSJN+vTeGA==", "integrity": "sha512-H4s8UjgkPnlChl6JF5empNvFHp77Jx+Wfy2EtmYPe9G22XV+PMuCinZVHurNe8ggtwoaohxARJZbaH/3xjB/FA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1637,9 +1662,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-ia32-msvc": { "node_modules/@rollup/rollup-win32-ia32-msvc": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.14.2.tgz",
"integrity": "sha512-J9AFDq/xiRI58eR2NIDfyVmTYGyIZmRcvcAoJ48oDld/NTR8wyiPUu2X/v1navJ+N/FGg68LEbX3Ejd6l8B7MQ==", "integrity": "sha512-djqpAjm/i8erWYF0K6UY4kRO3X5+T4TypIqw60Q8MTqSBaQNpNXDhxdjpZ3ikgb+wn99svA7jxcXpiyg9MUsdw==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@ -1650,9 +1675,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-x64-msvc": { "node_modules/@rollup/rollup-win32-x64-msvc": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.14.2.tgz",
"integrity": "sha512-jqzNLhNDvIZOrt69Ce4UjGRpXJBzhUBzawMwnaDAwyHriki3XollsewxWzOzz+4yOFDkuJHtTsZFwMxhYJWmLQ==", "integrity": "sha512-teAqzLT0yTYZa8ZP7zhFKEx4cotS8Tkk5XiqNMJhD4CpaWB1BHARE4Qy+RzwnXvSAYv+Q3jAqCVBS+PS+Yee8Q==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -2532,9 +2557,9 @@
} }
}, },
"node_modules/esbuild": { "node_modules/esbuild": {
"version": "0.19.12", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz",
"integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", "integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"bin": { "bin": {
@ -2544,29 +2569,29 @@
"node": ">=12" "node": ">=12"
}, },
"optionalDependencies": { "optionalDependencies": {
"@esbuild/aix-ppc64": "0.19.12", "@esbuild/aix-ppc64": "0.20.2",
"@esbuild/android-arm": "0.19.12", "@esbuild/android-arm": "0.20.2",
"@esbuild/android-arm64": "0.19.12", "@esbuild/android-arm64": "0.20.2",
"@esbuild/android-x64": "0.19.12", "@esbuild/android-x64": "0.20.2",
"@esbuild/darwin-arm64": "0.19.12", "@esbuild/darwin-arm64": "0.20.2",
"@esbuild/darwin-x64": "0.19.12", "@esbuild/darwin-x64": "0.20.2",
"@esbuild/freebsd-arm64": "0.19.12", "@esbuild/freebsd-arm64": "0.20.2",
"@esbuild/freebsd-x64": "0.19.12", "@esbuild/freebsd-x64": "0.20.2",
"@esbuild/linux-arm": "0.19.12", "@esbuild/linux-arm": "0.20.2",
"@esbuild/linux-arm64": "0.19.12", "@esbuild/linux-arm64": "0.20.2",
"@esbuild/linux-ia32": "0.19.12", "@esbuild/linux-ia32": "0.20.2",
"@esbuild/linux-loong64": "0.19.12", "@esbuild/linux-loong64": "0.20.2",
"@esbuild/linux-mips64el": "0.19.12", "@esbuild/linux-mips64el": "0.20.2",
"@esbuild/linux-ppc64": "0.19.12", "@esbuild/linux-ppc64": "0.20.2",
"@esbuild/linux-riscv64": "0.19.12", "@esbuild/linux-riscv64": "0.20.2",
"@esbuild/linux-s390x": "0.19.12", "@esbuild/linux-s390x": "0.20.2",
"@esbuild/linux-x64": "0.19.12", "@esbuild/linux-x64": "0.20.2",
"@esbuild/netbsd-x64": "0.19.12", "@esbuild/netbsd-x64": "0.20.2",
"@esbuild/openbsd-x64": "0.19.12", "@esbuild/openbsd-x64": "0.20.2",
"@esbuild/sunos-x64": "0.19.12", "@esbuild/sunos-x64": "0.20.2",
"@esbuild/win32-arm64": "0.19.12", "@esbuild/win32-arm64": "0.20.2",
"@esbuild/win32-ia32": "0.19.12", "@esbuild/win32-ia32": "0.20.2",
"@esbuild/win32-x64": "0.19.12" "@esbuild/win32-x64": "0.20.2"
} }
}, },
"node_modules/escalade": { "node_modules/escalade": {
@ -4110,9 +4135,9 @@
} }
}, },
"node_modules/postcss": { "node_modules/postcss": {
"version": "8.4.34", "version": "8.4.38",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.34.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz",
"integrity": "sha512-4eLTO36woPSocqZ1zIrFD2K1v6wH7pY1uBh0JIM2KKfrVtGvPFiAku6aNOP0W1Wr9qwnaCsF0Z+CrVnryB2A8Q==", "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -4131,7 +4156,7 @@
"dependencies": { "dependencies": {
"nanoid": "^3.3.7", "nanoid": "^3.3.7",
"picocolors": "^1.0.0", "picocolors": "^1.0.0",
"source-map-js": "^1.0.2" "source-map-js": "^1.2.0"
}, },
"engines": { "engines": {
"node": "^10 || ^12 || >=14" "node": "^10 || ^12 || >=14"
@ -4264,9 +4289,9 @@
} }
}, },
"node_modules/rollup": { "node_modules/rollup": {
"version": "4.9.6", "version": "4.14.2",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.6.tgz", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.14.2.tgz",
"integrity": "sha512-05lzkCS2uASX0CiLFybYfVkwNbKZG5NFQ6Go0VWyogFTXXbR039UVsegViTntkk4OglHBdF54ccApXRRuXRbsg==", "integrity": "sha512-WkeoTWvuBoFjFAhsEOHKRoZ3r9GfTyhh7Vff1zwebEFLEFjT1lG3784xEgKiTa7E+e70vsC81roVL2MP4tgEEQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@types/estree": "1.0.5" "@types/estree": "1.0.5"
@ -4279,19 +4304,21 @@
"npm": ">=8.0.0" "npm": ">=8.0.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"@rollup/rollup-android-arm-eabi": "4.9.6", "@rollup/rollup-android-arm-eabi": "4.14.2",
"@rollup/rollup-android-arm64": "4.9.6", "@rollup/rollup-android-arm64": "4.14.2",
"@rollup/rollup-darwin-arm64": "4.9.6", "@rollup/rollup-darwin-arm64": "4.14.2",
"@rollup/rollup-darwin-x64": "4.9.6", "@rollup/rollup-darwin-x64": "4.14.2",
"@rollup/rollup-linux-arm-gnueabihf": "4.9.6", "@rollup/rollup-linux-arm-gnueabihf": "4.14.2",
"@rollup/rollup-linux-arm64-gnu": "4.9.6", "@rollup/rollup-linux-arm64-gnu": "4.14.2",
"@rollup/rollup-linux-arm64-musl": "4.9.6", "@rollup/rollup-linux-arm64-musl": "4.14.2",
"@rollup/rollup-linux-riscv64-gnu": "4.9.6", "@rollup/rollup-linux-powerpc64le-gnu": "4.14.2",
"@rollup/rollup-linux-x64-gnu": "4.9.6", "@rollup/rollup-linux-riscv64-gnu": "4.14.2",
"@rollup/rollup-linux-x64-musl": "4.9.6", "@rollup/rollup-linux-s390x-gnu": "4.14.2",
"@rollup/rollup-win32-arm64-msvc": "4.9.6", "@rollup/rollup-linux-x64-gnu": "4.14.2",
"@rollup/rollup-win32-ia32-msvc": "4.9.6", "@rollup/rollup-linux-x64-musl": "4.14.2",
"@rollup/rollup-win32-x64-msvc": "4.9.6", "@rollup/rollup-win32-arm64-msvc": "4.14.2",
"@rollup/rollup-win32-ia32-msvc": "4.14.2",
"@rollup/rollup-win32-x64-msvc": "4.14.2",
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
}, },
@ -4362,9 +4389,9 @@
} }
}, },
"node_modules/source-map-js": { "node_modules/source-map-js": {
"version": "1.0.2", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz",
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@ -4727,14 +4754,14 @@
} }
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "5.0.12", "version": "5.2.8",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.12.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.8.tgz",
"integrity": "sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==", "integrity": "sha512-OyZR+c1CE8yeHw5V5t59aXsUPPVTHMDjEZz8MgguLL/Q7NblxhZUlTu9xSPqlsUO/y+X7dlU05jdhvyycD55DA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"esbuild": "^0.19.3", "esbuild": "^0.20.1",
"postcss": "^8.4.32", "postcss": "^8.4.38",
"rollup": "^4.2.0" "rollup": "^4.13.0"
}, },
"bin": { "bin": {
"vite": "bin/vite.js" "vite": "bin/vite.js"

View File

@ -1,7 +1,7 @@
{ {
"name": "@ztimson/js-utilities", "name": "@ztimson/utils",
"version": "0.2.0", "version": "0.14.7",
"description": "JavaScript Utility library", "description": "Utility library",
"author": "Zak Timson", "author": "Zak Timson",
"license": "MIT", "license": "MIT",
"private": false, "private": false,
@ -9,18 +9,24 @@
"type": "git", "type": "git",
"url": "https://git.zakscode.com/ztimson/js-utilities" "url": "https://git.zakscode.com/ztimson/js-utilities"
}, },
"main": "./dist/js-utilities.js", "main": "./dist/index.cjs",
"module": "./dist/js-utilities.mjs", "module": "./dist/index.mjs",
"types": "./dist/src/index.d.ts", "types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
}
},
"scripts": { "scripts": {
"build": "vite build", "build": "npx tsc && npx vite build",
"test": "npx jest", "test": "npx jest",
"test:coverage": "npx jest --coverage", "test:coverage": "npx jest --coverage",
"watch": "vite build --watch" "watch": "npx vite build --watch"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/node": "^18.14.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-junit": "^16.0.0", "jest-junit": "^16.0.0",
"ts-jest": "^29.1.2", "ts-jest": "^29.1.2",
@ -28,12 +34,6 @@
"vite": "^5.0.12", "vite": "^5.0.12",
"vite-plugin-dts": "^3.7.2" "vite-plugin-dts": "^3.7.2"
}, },
"exports": {
".": {
"import": "./dist/js-utilities.mjs",
"require": "./dist/js-utilities.js"
}
},
"files": [ "files": [
"dist" "dist"
] ]

58
src/aset.ts Normal file
View File

@ -0,0 +1,58 @@
export class ASet<T> extends Array {
get size() {
return this.length;
}
constructor(elements: T[] = []) {
super();
if(!!elements?.['forEach'])
elements.forEach(el => this.add(el));
}
add(el: T) {
if(!this.has(el)) this.push(el);
}
delete(el: T) {
const index = this.indexOf(el);
if(index != -1) this.slice(index, 1);
}
difference(set: ASet<T>) {
return new ASet<T>(this.reduce((acc, el) => {
if(!set.has(el)) acc.push(el);
return acc;
}, []));
}
has(el: T) {
return this.indexOf(el) != -1;
}
intersection(set: ASet<T>) {
return new ASet<T>(this.reduce((acc, el) => {
if(set.has(el)) acc.push(el);
return acc;
}, []));
}
isDisjointFrom(set: ASet<T>) {
return this.intersection(set).size == 0;
}
isSubsetOf(set: ASet<T>) {
return this.findIndex(el => !set.has(el)) == -1;
}
isSuperset(set: ASet<T>) {
return set.findIndex(el => !this.has(el)) == -1;
}
symmetricDifference(set: ASet<T>) {
return new ASet([...this.difference(set), ...set.difference(this)]);
}
union(set: ASet<T> | Array<T>) {
return new ASet([...this, ...set]);
}
}

View File

@ -1,15 +1,3 @@
import {XHR} from './xhr';
XHR.addInterceptor((resp: Response, next: () => {}) => {
if(resp.status == 200) return next();
if(resp.status == 400) throw new BadRequestError(resp.statusText);
if(resp.status == 401) throw new UnauthorizedError(resp.statusText);
if(resp.status == 403) throw new ForbiddenError(resp.statusText);
if(resp.status == 404) throw new NotFoundError(resp.statusText);
if(resp.status == 500) throw new InternalServerError(resp.statusText);
throw new CustomError(resp.statusText, resp.status);
});
export class CustomError extends Error { export class CustomError extends Error {
static code = 500; static code = 500;

54
src/files.ts Normal file
View File

@ -0,0 +1,54 @@
import {PromiseProgress} from './promise-progress';
export function download(href: any, name: string) {
const a = document.createElement('a');
a.href = href;
a.download = name;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
export function downloadBlob(blob: Blob, name: string) {
const url = URL.createObjectURL(blob);
download(url, name);
URL.revokeObjectURL(url);
}
export function fileBrowser(options: {accept?: string, multiple?: boolean} = {}): Promise<File[]> {
return new Promise(res => {
const input = document.createElement('input');
input.type = 'file';
input.accept = options.accept || '*';
input.style.display='none';
input.multiple = !!options.multiple;
input.onblur = input.onchange = async () => {
res(Array.from(<any>input.files));
input.remove();
}
document.body.appendChild(input);
input.click();
});
}
export function uploadWithProgress<T>(options: {
url: string;
files: File[];
headers?: {[key: string]: string};
withCredentials?: boolean;
}): PromiseProgress<T> {
return new PromiseProgress<T>((res, rej, prog) => {
const xhr = new XMLHttpRequest();
const formData = new FormData();
options.files.forEach(f => formData.append('file', f));
xhr.withCredentials = !!options.withCredentials
xhr.upload.addEventListener('progress', (event) => event.lengthComputable ? prog(event.loaded / event.total) : null);
xhr.upload.addEventListener('load', (resp) => res(<any>resp));
xhr.upload.addEventListener('error', (err) => rej(err));
xhr.open('POST', options.url);
Object.entries(options.headers || {}).forEach(([key, value]) => xhr.setRequestHeader(key, value));
xhr.send(formData);
});
}

121
src/http.ts Normal file
View File

@ -0,0 +1,121 @@
import {clean} from './objects';
import {PromiseProgress} from './promise-progress';
export type DecodedResponse<T> = Response & {data: T | null}
export type HttpInterceptor = (response: Response, next: () => void) => void;
export type HttpRequestOptions = {
body?: any;
decode?: boolean;
fragment?: string;
headers?: {[key: string | symbol]: string | null | undefined};
method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';
query?: {key: string, value: string}[] | {[key: string]: string};
url?: string;
[key: string]: any;
}
export type HttpDefaults = {
headers?: {[key: string | symbol]: string | null | undefined};
interceptors?: HttpInterceptor[];
url?: string;
}
export class Http {
private static interceptors: {[key: string]: HttpInterceptor} = {};
static headers: {[key: string]: string | null | undefined} = {};
private interceptors: {[key: string]: HttpInterceptor} = {}
headers: {[key: string]: string | null | undefined} = {}
url!: string | null;
constructor(defaults: HttpDefaults = {}) {
this.url = defaults.url ?? null;
this.headers = defaults.headers || {};
if(defaults.interceptors) {
defaults.interceptors.forEach(i => Http.addInterceptor(i));
}
}
static addInterceptor(fn: HttpInterceptor): () => void {
const key = Object.keys(Http.interceptors).length.toString();
Http.interceptors[key] = fn;
return () => { Http.interceptors[key] = <any>null; }
}
addInterceptor(fn: HttpInterceptor): () => void {
const key = Object.keys(this.interceptors).length.toString();
this.interceptors[key] = fn;
return () => { this.interceptors[key] = <any>null; }
}
request<T>(opts: HttpRequestOptions = {}): PromiseProgress<DecodedResponse<T>> {
if(!this.url && !opts.url) throw new Error('URL needs to be set');
let url = (opts.url?.startsWith('http') ? opts.url : (this.url || '') + (opts.url || '')).replace(/([^:]\/)\/+/g, '$1');
if(opts.fragment) url.includes('#') ? url.replace(/#.*(\?|\n)/g, (match, arg1) => `#${opts.fragment}${arg1}`) : url += '#' + opts.fragment;
if(opts.query) {
const q = Array.isArray(opts.query) ? opts.query :
Object.keys(opts.query).map(k => ({key: k, value: (<any>opts.query)[k]}))
url += (url.includes('?') ? '&' : '?') + q.map(q => `${q.key}=${q.value}`).join('&');
}
// Prep headers
const headers = <any>clean({
'Content-Type': !opts.body ? undefined : (opts.body instanceof FormData ? 'multipart/form-data' : 'application/json'),
...Http.headers,
...this.headers,
...opts.headers
});
if(typeof opts.body == 'object' && opts.body != null && headers['Content-Type'] == 'application/json')
opts.body = JSON.stringify(opts.body);
// Send request
return new PromiseProgress((res, rej, prog) => {
fetch(url, {
headers,
method: opts.method || (opts.body ? 'POST' : 'GET'),
body: opts.body
}).then(async (resp: any) => {
for(let fn of [...Object.values(Http.interceptors), ...Object.values(this.interceptors)]) {
await new Promise<void>(res => fn(resp, () => res()));
}
const contentLength = resp.headers.get('Content-Length');
const total = contentLength ? parseInt(contentLength, 10) : 0;
let loaded = 0;
const reader = resp.body?.getReader();
const stream = new ReadableStream({
start(controller) {
function push() {
reader?.read().then((event: any) => {
if(event.done) return controller.close();
loaded += event.value.byteLength;
prog(loaded / total);
controller.enqueue(event.value);
push();
}).catch((error: any) => controller.error(error));
}
push();
}
});
resp.data = new Response(stream);
if(opts.decode !== false) {
const content = resp.headers.get('Content-Type')?.toLowerCase();
if(content?.includes('json')) resp.data = <T>await resp.data.json();
else if(content?.includes('text')) resp.data = <T>await resp.data.text();
else if(content?.includes('form')) resp.data = <T>await resp.data.formData();
else if(content?.includes('application')) resp.data = <T>await resp.data.blob();
}
if(resp.ok) res(resp);
else rej(resp);
})
});
}
}

View File

@ -1,10 +1,13 @@
export * from './array'; export * from './array';
export * from './aset';
export * from './files';
export * from './emitter'; export * from './emitter';
export * from './errors'; export * from './errors';
export * from './http';
export * from './logger'; export * from './logger';
export * from './math';
export * from './misc'; export * from './misc';
export * from './objects'; export * from './objects';
// export * from './redis'; export * from './promise-progress';
export * from './string'; export * from './string';
export * from './time'; export * from './time';
export * from './xhr';

View File

@ -42,62 +42,74 @@ export const CliBackground = {
} }
export enum LOG_LEVEL { export enum LOG_LEVEL {
VERBOSE, ERROR = 0,
INFO, WARN = 1,
WARN, INFO = 2,
ERROR LOG = 3,
DEBUG = 4,
} }
export type LoggerEvents = TypedEvents & { export type LoggerEvents = TypedEvents & {
'VERBOSE': (...args: any[]) => any;
'INFO': (...args: any[]) => any;
'WARN': (...args: any[]) => any;
'ERROR': (...args: any[]) => any; 'ERROR': (...args: any[]) => any;
'WARN': (...args: any[]) => any;
'INFO': (...args: any[]) => any;
'LOG': (...args: any[]) => any;
'DEBUG': (...args: any[]) => any;
}; };
export class Logger extends TypedEmitter<LoggerEvents> { export class Logger extends TypedEmitter<LoggerEvents> {
static LOG_LEVEL: LOG_LEVEL = LOG_LEVEL.INFO; static LOG_LEVEL: LOG_LEVEL = LOG_LEVEL.DEBUG;
constructor(public readonly namespace: string) { constructor(public readonly namespace?: string) {
super(); super();
} }
private pad(text: any, length: number, char: string, end = false) {
const t = text.toString();
const l = length - t.length;
if(l <= 0) return t;
const padding = Array(~~(l / char.length)).fill(char).join('');
return !end ? padding + t : t + padding;
}
private format(...text: string[]): string { private format(...text: string[]): string {
return `${new Date().toISOString()} [${this.namespace}] ${text.join(' ')}`; const now = new Date();
const timestamp = `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()} ${this.pad(now.getHours().toString(), 2, '0')}:${this.pad(now.getMinutes().toString(), 2, '0')}:${this.pad(now.getSeconds().toString(), 2, '0')}.${this.pad(now.getMilliseconds().toString(), 3, '0', true)}`;
return `${timestamp}${this.namespace ? ` [${this.namespace}]` : ''} ${text.join(' ')}`;
} }
debug(...args: string[]) { debug(...args: string[]) {
if(LOG_LEVEL.VERBOSE >= Logger.LOG_LEVEL) { if(Logger.LOG_LEVEL < LOG_LEVEL.DEBUG) return;
Logger.emit(LOG_LEVEL.VERBOSE, ...args); const str = this.format(...args);
console.debug(CliForeground.LIGHT_GREY + this.format(...args) + CliEffects.CLEAR); Logger.emit(LOG_LEVEL.DEBUG, str);
} console.debug(CliForeground.LIGHT_GREY + str + CliEffects.CLEAR);
}
error(...args: string[]) {
if(LOG_LEVEL.ERROR >= Logger.LOG_LEVEL) {
Logger.emit(LOG_LEVEL.ERROR, ...args);
console.error(CliForeground.RED + this.format(...args) + CliEffects.CLEAR);
}
}
info(...args: string[]) {
if(LOG_LEVEL.INFO >= Logger.LOG_LEVEL) {
Logger.emit(LOG_LEVEL.INFO, ...args);
console.info(CliForeground.CYAN + this.format(...args) + CliEffects.CLEAR);
}
} }
log(...args: string[]) { log(...args: string[]) {
if(LOG_LEVEL.INFO >= Logger.LOG_LEVEL) { if(Logger.LOG_LEVEL < LOG_LEVEL.LOG) return;
Logger.emit(LOG_LEVEL.INFO, ...args); const str = this.format(...args);
console.log(CliEffects.CLEAR + this.format(...args)); Logger.emit(LOG_LEVEL.LOG, str);
console.log(CliEffects.CLEAR + str);
} }
info(...args: string[]) {
if(Logger.LOG_LEVEL < LOG_LEVEL.INFO) return;
const str = this.format(...args);
Logger.emit(LOG_LEVEL.INFO, str);
console.info(CliForeground.BLUE + str + CliEffects.CLEAR);
} }
warn(...args: string[]) { warn(...args: string[]) {
if(LOG_LEVEL.WARN >= Logger.LOG_LEVEL) { if(Logger.LOG_LEVEL < LOG_LEVEL.WARN) return;
Logger.emit(LOG_LEVEL.WARN, ...args); const str = this.format(...args);
console.warn(CliForeground.YELLOW + this.format(...args) + CliEffects.CLEAR); Logger.emit(LOG_LEVEL.WARN, str);
} console.warn(CliForeground.YELLOW + str + CliEffects.CLEAR);
}
error(...args: string[]) {
if(Logger.LOG_LEVEL < LOG_LEVEL.ERROR) return;
const str = this.format(...args);
Logger.emit(LOG_LEVEL.ERROR, str);
console.error(CliForeground.RED + str + CliEffects.CLEAR);
} }
} }

45
src/math.ts Normal file
View File

@ -0,0 +1,45 @@
/**
* Convert decimal number to fraction
*
* @example
* ```js
* dec2Frac(1.25) // Outputs: "1 1/4"
* ```
*
* @param {number} num Number to convert
* @return {string} Fraction with remainder
*/
export function dec2Frac(num: number) {
const gcd = (a: number, b: number): number => {
if (b < 0.0000001) return a;
return gcd(b, ~~(a % b));
};
const len = num.toString().length - 2;
let denominator = Math.pow(10, len);
let numerator = num * denominator;
const divisor = gcd(numerator, denominator);
numerator = ~~(numerator / divisor);
denominator = ~~(denominator / divisor)
const remainder = ~~(numerator / denominator);
numerator -= remainder * denominator;
return `${remainder ? remainder + ' ' : ''}${~~(numerator)}/${~~(denominator)}`;
}
/**
* Convert fraction to decimal number
*
* @example
* ```js
* fracToDec('1 1/4') // Outputs: 1.25
* ```
*
* @param {string} frac Fraction to convert
* @return {number} Faction as a decimal
*/
export function fracToDec(frac: string) {
let split = frac.split(' ');
const whole = split.length == 2 ? Number(split[0]) : 0;
split = (<string>split.pop()).split('/');
return whole + (Number(split[0]) / Number(split[1]));
}

View File

@ -16,11 +16,12 @@ export function formEncode(data: any): string {
* Get profile image from Gravatar * Get profile image from Gravatar
* *
* @param {string} email Account email address * @param {string} email Account email address
* @param {string} def Default image, can be a link or '404', see: https://docs.gravatar.com/general/images/
* @returns {string} Gravatar URL * @returns {string} Gravatar URL
*/ */
export function gravatar(email: string) { export function gravatar(email: string, def='mp') {
if(!email) return ''; if(!email) return '';
return `https://www.gravatar.com/avatar/${md5(email)}`; return `https://www.gravatar.com/avatar/${md5(email)}?d=${def}`;
} }
/** Parts of a URL */ /** Parts of a URL */

View File

@ -35,6 +35,27 @@ export function deepCopy<T>(value: T): T {
return JSON.parse(JSON.stringify(value)); return JSON.parse(JSON.stringify(value));
} }
/**
* Merge any number of objects into the target
*
* @param target Destination of all properties
* @param sources Objects that will copied into target
* @return {any} The des
*/
export function deepMerge<T>(target: any, ...sources: any[]): T {
sources.forEach(s => {
for(const key in s) {
if(s[key] && typeof s[key] == 'object' && !Array.isArray(s[key])) {
if(!target[key]) target[key] = {};
deepMerge(target[key], s[key]);
} else {
target[key] = s[key];
}
}
});
return target;
}
/** /**
* Get/set a property of an object using dot notation * Get/set a property of an object using dot notation
* *
@ -115,7 +136,7 @@ export function flattenObj(obj: any, parent?: any, result: any = {}) {
*/ */
export function includes(target: any, values: any, allowMissing = false): boolean { export function includes(target: any, values: any, allowMissing = false): boolean {
if(target == undefined) return allowMissing; if(target == undefined) return allowMissing;
if(Array.isArray(values)) return values.findIndex((e, i) => !includes(target[i], values[i], allowMissing)) == -1; if(Array.isArray(values)) return values.findIndex((e: any, i: number) => !includes(target[i], values[i], allowMissing)) == -1;
const type = typeof values; const type = typeof values;
if(type != typeof target) return false; if(type != typeof target) return false;
if(type == 'object') { if(type == 'object') {
@ -140,3 +161,27 @@ export function isEqual(a: any, b: any): boolean {
if(keys.length != Object.keys(b).length) return false; if(keys.length != Object.keys(b).length) return false;
return Object.keys(a).every(key => isEqual(a[key], b[key])); return Object.keys(a).every(key => isEqual(a[key], b[key]));
} }
export function mixin(target: any, constructors: any[]) {
constructors.forEach(c => {
Object.getOwnPropertyNames(c.prototype).forEach((name) => {
Object.defineProperty(
target.prototype,
name,
Object.getOwnPropertyDescriptor(c.prototype, name) ||
Object.create(null)
);
});
});
}
export function sanitizedJSON(obj: any, space?: number) {
let cache: any[] = [];
return JSON.parse(JSON.stringify(obj, (key, value) => {
if (typeof value === 'object' && value !== null) {
if (cache.includes(value)) return;
cache.push(value);
}
return value;
}, space));
}

52
src/promise-progress.ts Normal file
View File

@ -0,0 +1,52 @@
export type ProgressCallback = (progress: number) => any;
export class PromiseProgress<T> extends Promise<T> {
private listeners: ProgressCallback[] = [];
private _progress = 0;
get progress() { return this._progress; }
set progress(p: number) {
if(p == this._progress) return;
this._progress = p;
this.listeners.forEach(l => l(p));
}
constructor(executor: (resolve: (value: T) => any, reject: (reason: any) => void, progress: (progress: number) => any) => void) {
super((resolve, reject) => executor(
(value: T) => resolve(value),
(reason: any) => reject(reason),
(progress: number) => this.progress = progress,
));
}
static from<T>(promise: Promise<T>): PromiseProgress<T> {
if(promise instanceof PromiseProgress) return promise;
return new PromiseProgress<T>((res, rej) => promise
.then((...args) => res(...args))
.catch((...args) => rej(...args)));
}
private from(promise: Promise<T>): PromiseProgress<T> {
const newPromise = PromiseProgress.from(promise);
this.onProgress(p => newPromise.progress = p);
return newPromise;
}
onProgress(callback: ProgressCallback) {
this.listeners.push(callback);
return this;
}
then(res?: (v: T) => any, rej?: (err: any) => any): PromiseProgress<any> {
const resp = super.then(res, rej);
return this.from(resp);
}
catch(rej?: (err: any) => any): PromiseProgress<any> {
return this.from(super.catch(rej));
}
finally(res?: () => any): PromiseProgress<any> {
return this.from(super.finally(res));
}
}

View File

@ -1,72 +0,0 @@
// import {createClient, RedisClientType} from 'redis';
// import {environment} from '../environments/environment';
//
// export type RedisKey = string | string[];
//
// export let Redis!: RedisClientType & {
// // get/set shimmed for JSON
// jGet: (redisKey: string) => Promise<any>,
// jSet: (redisKey: string, obj: any, opts?: any) => Promise<void>,
// // hGet/hSet shimmed for objects
// oGet: (redisKey: string) => Promise<any>;
// oSet: (redisKey: string, obj: any) => Promise<void>,
// // Helpers
// findKeys: (filter: RedisKey) => Promise<string[]>,
// forEach: (filter: RedisKey, cb: (key: string) => any) => Promise<void>,
// };
//
// export async function connectRedis(retry = 3) {
// Redis = <any>createClient({
// url: `redis://host:port`
// });
// if(!Redis && retry > 0) {
// await connectRedis(retry - 1);
// } else if(!!Redis) {
// Redis.jGet = async (redisKey: string) => {
// const val = await Redis.get(redisKey);
// return val ? JSON.parse(val) || val : null;
// };
// Redis.jSet = (redisKey: string, obj: any, opts?: any) => {
// return Redis.set(redisKey, JSON.stringify(obj), opts).then(() => {});
// };
// Redis.oGet = async (redisKey: string) => {
// if(!(await Redis.hLen(redisKey))) return null;
// const val = await Redis.hGetAll(redisKey);
// Object.entries(val).forEach(([key, v]) => val[key] = JSON.parse(v));
// return val;
// };
// Redis.oSet = (redisKey: string, obj: any) => {
// const r = Redis.multi();
// Object.entries(obj).forEach(([key, val]) => {
// r.hSet(redisKey, key, JSON.stringify(val));
// });
// return r.exec().then(() => {});
// };
// Redis.findKeys = async (filter: RedisKey): Promise<string[]> => {
// const found: string[] = [];
// await Redis.forEach(filter, (key: string) => found.push(key));
// return found;
// }
// Redis.forEach = async (filter: RedisKey, cb: (key: string) => any): Promise<void> => {
// for await (const k of Redis.scanIterator({MATCH: createKey(filter)})) {
// const rtn = cb(k);
// if(rtn instanceof Promise) await rtn;
// }
// }
// await Redis.connect();
// }
// }
//
// export function createKey(...keys: (string | string[])[]) {
// return keys.flat().map(k => k == null ? '*' : k).join(':');
// }
//
// export function namespacedKey(namespace: string, key: RedisKey): string {
// return createKey(namespace, ...(Array.isArray(key) ? key : [key]));
// }
//
// export function nameSpacer(namespace: string) {
// return (key: RedisKey) => {
// return namespacedKey(namespace, key);
// };
// }

View File

@ -52,6 +52,14 @@ export function insertAt(target: string, str: string, index: number): String {
return `${target.slice(0, index)}${str}${target.slice(index + 1)}`; return `${target.slice(0, index)}${str}${target.slice(index + 1)}`;
} }
export function pad(text: any, length: number, char: string, start = true) {
const t = text.toString();
const l = length - t.length;
if(l <= 0) return t;
const padding = Array(~~(l / char.length)).fill(char).join('');
return start ? padding + t : t + padding;
}
/** /**
* Generate a string of random characters. * Generate a string of random characters.
* *

View File

@ -1,92 +0,0 @@
export type FetchInterceptor = (resp: Response, next: () => any) => any;
export class XHR<T> {
private static interceptors: {[key: number]: FetchInterceptor} = {};
static headers: Record<string, string | null> = {};
private interceptors: {[key: string]: FetchInterceptor} = {};
constructor(public readonly baseUrl: string,
public readonly headers: Record<string, string | null> = {}
) { }
static addInterceptor(fn: FetchInterceptor): () => {};
static addInterceptor(key: string, fn: FetchInterceptor): () => {};
static addInterceptor(keyOrFn: string | FetchInterceptor, fn?: FetchInterceptor): () => {} {
const func: any = fn ? fn : keyOrFn;
const key: string = typeof keyOrFn == 'string' ? keyOrFn :
`_${Object.keys(XHR.interceptors).length.toString()}`;
XHR.interceptors[<any>key] = func;
return () => delete XHR.interceptors[<any>key];
}
addInterceptor(fn: FetchInterceptor): () => {};
addInterceptor(key: string, fn: FetchInterceptor): () => {};
addInterceptor(keyOrFn: string | FetchInterceptor, fn?: FetchInterceptor): () => {} {
const func: any = fn ? fn : keyOrFn;
const key: string = typeof keyOrFn == 'string' ? keyOrFn :
`_${Object.keys(this.interceptors).length.toString()}`;
this.interceptors[<any>key] = func;
return () => delete this.interceptors[<any>key];
}
getInterceptors() {
return [...Object.values(XHR.interceptors), ...Object.values(this.interceptors)];
}
fetch<T2 = T>(href?: string, body?: any, opts: any = {}): Promise<T2> {
const headers = {
'Content-Type': (body && !(body instanceof FormData)) ? 'application/json' : undefined,
...XHR.headers,
...this.headers,
...opts.headers
};
Object.keys(headers).forEach(h => { if(!headers[h]) delete headers[h]; });
return fetch(`${this.baseUrl}${href || ''}`.replace(/([^:]\/)\/+/g, '$1'), {
headers,
method: opts.method || (body ? 'POST' : 'GET'),
body: (headers['Content-Type']?.startsWith('application/json') && body) ? JSON.stringify(body) : body
}).then(async resp => {
for(let fn of this.getInterceptors()) {
const wait = new Promise(res =>
fn(resp, () => res(null)));
await wait;
}
if(resp.headers.has('Content-Type')) {
if(resp.headers.get('Content-Type')?.startsWith('application/json')) return await resp.json();
if(resp.headers.get('Content-Type')?.startsWith('text/plain')) return await resp.text();
}
return resp;
});
}
delete<T2 = void>(url?: string, opts?: any): Promise<T2> {
return this.fetch(url, null, {method: 'delete', ...opts});
}
get<T2 = T>(url?: string, opts?: any): Promise<T2> {
return this.fetch(url, null, {method: 'get', ...opts});
}
patch<T2 = T>(data: T2, url?: string, opts?: any): Promise<T2> {
return this.fetch(url, data, {method: 'patch', ...opts});
}
post<T2 = T>(data: T2, url?: string, opts?: any): Promise<T2> {
return this.fetch(url, data, {method: 'post', ...opts});
}
put<T2 = T>(data: Partial<T2>, url?: string, opts?: any): Promise<T2> {
return this.fetch(url, data, {method: 'put', ...opts});
}
new<T2 = T>(href: string, headers: Record<string, string | null>): XHR<T2> {
const fetch = new XHR<T2>(`${this.baseUrl}${href}`, {
...this.headers,
...headers,
});
Object.entries(this.interceptors).map(([key, value]) =>
fetch.addInterceptor(key, value));
return fetch;
}
}

View File

@ -1,18 +1,20 @@
{ {
"include": [ "include": ["src"],
"src/**/*"
],
"compilerOptions": { "compilerOptions": {
"composite": true, "target": "ES2020",
"declaration": true, "useDefineForClassFields": true,
"declarationMap": true, "module": "ESNext",
"experimentalDecorators": true, "lib": ["ESNext", "DOM", "DOM.Iterable"],
"esModuleInterop": true, "skipLibCheck": true,
"lib": ["ESNext", "DOM"],
"module": "ES6", /* Bundler mode */
"moduleResolution": "Node", "moduleResolution": "bundler",
"outDir": "./dist", "allowImportingTsExtensions": true,
"strict": true, "resolveJsonModule": true,
"target": "ESNext" "isolatedModules": true,
"noEmit": true,
/* Linting */
"strict": true
} }
} }

View File

@ -6,12 +6,15 @@ export default defineConfig({
build: { build: {
lib: { lib: {
entry: resolve(process.cwd(), 'src/index.ts'), entry: resolve(process.cwd(), 'src/index.ts'),
name: 'js-utilities', name: 'utils',
fileName: (module, entryName) => { fileName: (module, entryName) => {
if(module == 'es') return 'js-utilities.mjs'; if(module == 'es') return 'index.mjs';
if(module == 'umd') return 'js-utilities.js'; if(module == 'umd') return 'index.cjs';
} }
}, },
emptyOutDir: true,
minify: true,
sourcemap: true
}, },
plugins: [dts()], plugins: [dts()],
}); });