fix(core): update
This commit is contained in:
parent
45593168b0
commit
d77c104915
@ -25,12 +25,12 @@
|
||||
"@git.zone/tsrun": "^1.2.44",
|
||||
"@git.zone/tstest": "^1.0.77",
|
||||
"@push.rocks/tapbundle": "^5.0.8",
|
||||
"@types/node": "^20.11.20"
|
||||
"@types/node": "^20.11.24"
|
||||
},
|
||||
"dependencies": {
|
||||
"@push.rocks/smartstring": "^4.0.13",
|
||||
"@types/buffer-json": "^2.0.3",
|
||||
"buffer-json": "^2.0.0",
|
||||
"@push.rocks/smartbuffer": "^1.0.7",
|
||||
"@push.rocks/smartenv": "^5.0.12",
|
||||
"@push.rocks/smartstring": "^4.0.14",
|
||||
"fast-json-stable-stringify": "^2.1.0",
|
||||
"lodash.clonedeep": "^4.5.0"
|
||||
},
|
||||
|
109
pnpm-lock.yaml
generated
109
pnpm-lock.yaml
generated
@ -5,15 +5,15 @@ settings:
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
dependencies:
|
||||
'@push.rocks/smartbuffer':
|
||||
specifier: ^1.0.7
|
||||
version: 1.0.7
|
||||
'@push.rocks/smartenv':
|
||||
specifier: ^5.0.12
|
||||
version: 5.0.12
|
||||
'@push.rocks/smartstring':
|
||||
specifier: ^4.0.13
|
||||
version: 4.0.13
|
||||
'@types/buffer-json':
|
||||
specifier: ^2.0.3
|
||||
version: 2.0.3
|
||||
buffer-json:
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
specifier: ^4.0.14
|
||||
version: 4.0.14
|
||||
fast-json-stable-stringify:
|
||||
specifier: ^2.1.0
|
||||
version: 2.1.0
|
||||
@ -23,20 +23,20 @@ dependencies:
|
||||
|
||||
devDependencies:
|
||||
'@git.zone/tsbuild':
|
||||
specifier: ^2.1.72
|
||||
specifier: ^2.1.66
|
||||
version: 2.1.72
|
||||
'@git.zone/tsrun':
|
||||
specifier: ^1.2.46
|
||||
version: 1.2.46(@types/node@20.11.20)
|
||||
specifier: ^1.2.44
|
||||
version: 1.2.46(@types/node@20.11.24)
|
||||
'@git.zone/tstest':
|
||||
specifier: ^1.0.86
|
||||
version: 1.0.86(@types/node@20.11.20)(sinon@17.0.1)
|
||||
specifier: ^1.0.77
|
||||
version: 1.0.86(@types/node@20.11.24)(sinon@17.0.1)
|
||||
'@push.rocks/tapbundle':
|
||||
specifier: ^5.0.15
|
||||
specifier: ^5.0.8
|
||||
version: 5.0.15(sinon@17.0.1)
|
||||
'@types/node':
|
||||
specifier: ^20.11.20
|
||||
version: 20.11.20
|
||||
specifier: ^20.11.24
|
||||
version: 20.11.24
|
||||
|
||||
packages:
|
||||
|
||||
@ -103,7 +103,7 @@ packages:
|
||||
'@push.rocks/smartjson': 5.0.10
|
||||
'@push.rocks/smartrx': 3.0.7
|
||||
'@push.rocks/smartsocket': 2.0.24
|
||||
'@push.rocks/smartstring': 4.0.13
|
||||
'@push.rocks/smartstring': 4.0.14
|
||||
'@push.rocks/smarturl': 3.0.7
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
@ -390,13 +390,13 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@git.zone/tsrun@1.2.46(@types/node@20.11.20):
|
||||
/@git.zone/tsrun@1.2.46(@types/node@20.11.24):
|
||||
resolution: {integrity: sha512-8miFVBle9Mnjx+uPGI/P+EuWcIOXWjBAkdjN5IYbdp5Ytt4xQODCLh4JSnC9h56UeU1nUxCAxZeJs2e9TXrivA==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@push.rocks/smartfile': 10.0.41
|
||||
'@push.rocks/smartshell': 3.0.3
|
||||
ts-node: 10.9.2(@types/node@20.11.20)(typescript@5.1.6)
|
||||
ts-node: 10.9.2(@types/node@20.11.24)(typescript@5.1.6)
|
||||
typescript: 5.1.6
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
@ -404,13 +404,13 @@ packages:
|
||||
- '@types/node'
|
||||
dev: true
|
||||
|
||||
/@git.zone/tstest@1.0.86(@types/node@20.11.20)(sinon@17.0.1):
|
||||
/@git.zone/tstest@1.0.86(@types/node@20.11.24)(sinon@17.0.1):
|
||||
resolution: {integrity: sha512-ec95MNeA21L+ob+lvLVCmwPTTC1BY+v/JHLYZ9DOZ9+9buLgx+cJ7VkwGBJCnlWJtqEtJosUrFKTih36iNuT3g==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@api.global/typedserver': 3.0.24
|
||||
'@git.zone/tsbundle': 2.0.15
|
||||
'@git.zone/tsrun': 1.2.46(@types/node@20.11.20)
|
||||
'@git.zone/tsrun': 1.2.46(@types/node@20.11.24)
|
||||
'@push.rocks/consolecolor': 2.0.1
|
||||
'@push.rocks/smartbrowser': 2.0.6
|
||||
'@push.rocks/smartdelay': 3.0.5
|
||||
@ -616,6 +616,10 @@ packages:
|
||||
- utf-8-validate
|
||||
dev: true
|
||||
|
||||
/@push.rocks/smartbuffer@1.0.7:
|
||||
resolution: {integrity: sha512-ESs16KRJuHo0wXxAZjwu0uiBgwUC6EodHtERFHAo2XfT+fw40DPnAvIi37RJPA8FZ7kIkpzRcuTCuFW81UH7VA==}
|
||||
dev: false
|
||||
|
||||
/@push.rocks/smartcache@1.0.16:
|
||||
resolution: {integrity: sha512-UAXf74eDuH4/RebJhydIbHlYVR3ACYJjniEY/9ZePblu7bIPgwFZqLBE9g1lcKVogbH9yY62dk3rSpgBzenyfQ==}
|
||||
dependencies:
|
||||
@ -731,7 +735,7 @@ packages:
|
||||
/@push.rocks/smartjson@5.0.10:
|
||||
resolution: {integrity: sha512-yuntSMGZ+XNHMrbS9RxotaD+eOgoNTcuDoWsttis+N3Mkc9DIam0pt/ER4NU8TgfMmhT/hKwQH+3DJceDzntoA==}
|
||||
dependencies:
|
||||
'@push.rocks/smartstring': 4.0.13
|
||||
'@push.rocks/smartstring': 4.0.14
|
||||
'@types/buffer-json': 2.0.3
|
||||
buffer-json: 2.0.0
|
||||
fast-json-stable-stringify: 2.1.0
|
||||
@ -943,16 +947,14 @@ packages:
|
||||
'@push.rocks/smartrx': 3.0.7
|
||||
dev: true
|
||||
|
||||
/@push.rocks/smartstring@4.0.13:
|
||||
resolution: {integrity: sha512-iEAch6fYC+VijBYWFfRif5Wj5KxdUgC2Xnn0NNgDFrBmI14HsECcPbZ0YdESawRVD27pLYYZJCCbu/M/Llo1kg==}
|
||||
/@push.rocks/smartstring@4.0.14:
|
||||
resolution: {integrity: sha512-0zwtB+3yT1rFOtZY6+H6c8DIpKPrqQH/zx+P667nykvLgopH1t/kjGWNvaLC2mJOT3l+GjUd58DUO7DlTZzOSA==}
|
||||
dependencies:
|
||||
'@push.rocks/isounique': 1.0.5
|
||||
'@push.rocks/smartenv': 5.0.12
|
||||
'@types/randomatic': 3.1.5
|
||||
buffer: 6.0.3
|
||||
crypto-random-string: 5.0.0
|
||||
js-base64: 3.7.7
|
||||
normalize-newline: 4.1.0
|
||||
randomatic: 3.1.1
|
||||
strip-indent: 4.0.0
|
||||
url: 0.11.3
|
||||
@ -1348,7 +1350,7 @@ packages:
|
||||
/@types/accepts@1.3.7:
|
||||
resolution: {integrity: sha512-Pay9fq2lM2wXPWbteBsRAGiWH2hig4ZE2asK+mm7kUzlxRTfL961rj89I6zV/E3PcIkDqyuBEcMxFT7rccugeQ==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/babel__code-frame@7.0.6:
|
||||
@ -1359,11 +1361,12 @@ packages:
|
||||
resolution: {integrity: sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==}
|
||||
dependencies:
|
||||
'@types/connect': 3.4.38
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/buffer-json@2.0.3:
|
||||
resolution: {integrity: sha512-ItD4UfF3Q5jA+PEV6ZUWEHvlWaXJbd0rpuBKOIrEebM053FHaJddKsgUf0vy7nLSTs44nqFj3Mh8J3TiT0xv4g==}
|
||||
dev: true
|
||||
|
||||
/@types/chai-dom@0.0.9:
|
||||
resolution: {integrity: sha512-jj4F2NJog2/GBYsyJ8+NvhnWUBbPY4MUAKLdPJE6+568rw12GGXvj0ycUuP5nndVrnJgozmJAoMTvxvjJATXWw==}
|
||||
@ -1378,21 +1381,21 @@ packages:
|
||||
/@types/clean-css@4.2.11:
|
||||
resolution: {integrity: sha512-Y8n81lQVTAfP2TOdtJJEsCoYl1AnOkqDqMvXb9/7pfgZZ7r8YrEyurrAvAoAjHOGXKRybay+5CsExqIH6liccw==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
source-map: 0.6.1
|
||||
dev: true
|
||||
|
||||
/@types/co-body@6.1.3:
|
||||
resolution: {integrity: sha512-UhuhrQ5hclX6UJctv5m4Rfp52AfG9o9+d9/HwjxhVB5NjXxr5t9oKgJxN8xRHgr35oo8meUEHUPFWiKg6y71aA==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
'@types/qs': 6.9.11
|
||||
dev: true
|
||||
|
||||
/@types/connect@3.4.38:
|
||||
resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/content-disposition@0.5.8:
|
||||
@ -1413,13 +1416,13 @@ packages:
|
||||
'@types/connect': 3.4.38
|
||||
'@types/express': 4.17.21
|
||||
'@types/keygrip': 1.0.6
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/cors@2.8.17:
|
||||
resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/debounce@1.2.4:
|
||||
@ -1433,7 +1436,7 @@ packages:
|
||||
/@types/express-serve-static-core@4.17.43:
|
||||
resolution: {integrity: sha512-oaYtiBirUOPQGSWNGPWnzyAFJ0BP3cwvN4oWZQY+zUBwpVIGsKUkpBpSztp74drYcjavs7SKFZ4DX1V2QeN8rg==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
'@types/qs': 6.9.11
|
||||
'@types/range-parser': 1.2.7
|
||||
'@types/send': 0.17.4
|
||||
@ -1451,21 +1454,21 @@ packages:
|
||||
/@types/from2@2.3.5:
|
||||
resolution: {integrity: sha512-giavnjf3kNlJnE+HpZA1CQ3UKHxgehzsTuIMGda8pGMbOiLYGVNADEskey44OZcADHm/HOoBany8IV+0x28XFw==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/fs-extra@11.0.4:
|
||||
resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==}
|
||||
dependencies:
|
||||
'@types/jsonfile': 6.1.4
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/glob@8.1.0:
|
||||
resolution: {integrity: sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==}
|
||||
dependencies:
|
||||
'@types/minimatch': 5.1.2
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/html-minifier@4.0.5:
|
||||
@ -1515,7 +1518,7 @@ packages:
|
||||
/@types/jsonfile@6.1.4:
|
||||
resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/keygrip@1.0.6:
|
||||
@ -1538,7 +1541,7 @@ packages:
|
||||
'@types/http-errors': 2.0.4
|
||||
'@types/keygrip': 1.0.6
|
||||
'@types/koa-compose': 3.2.8
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/mime-types@2.1.4:
|
||||
@ -1565,8 +1568,8 @@ packages:
|
||||
resolution: {integrity: sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==}
|
||||
dev: true
|
||||
|
||||
/@types/node@20.11.20:
|
||||
resolution: {integrity: sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==}
|
||||
/@types/node@20.11.24:
|
||||
resolution: {integrity: sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==}
|
||||
dependencies:
|
||||
undici-types: 5.26.5
|
||||
dev: true
|
||||
@ -1598,7 +1601,7 @@ packages:
|
||||
resolution: {integrity: sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==}
|
||||
dependencies:
|
||||
'@types/mime': 1.3.5
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/serve-static@1.15.5:
|
||||
@ -1606,7 +1609,7 @@ packages:
|
||||
dependencies:
|
||||
'@types/http-errors': 2.0.4
|
||||
'@types/mime': 3.0.4
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/sinon-chai@3.2.12:
|
||||
@ -1633,7 +1636,7 @@ packages:
|
||||
/@types/through2@2.0.41:
|
||||
resolution: {integrity: sha512-ryQ0tidWkb1O1JuYvWKyMLYEtOWDqF5mHerJzKz/gQpoAaJq2l/dsMPBF0B5BNVT34rbARYJ5/tsZwLfUi2kwQ==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/trusted-types@2.0.7:
|
||||
@ -1661,20 +1664,20 @@ packages:
|
||||
/@types/ws@7.4.7:
|
||||
resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/ws@8.5.10:
|
||||
resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
|
||||
/@types/yauzl@2.10.3:
|
||||
resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
@ -1973,6 +1976,7 @@ packages:
|
||||
|
||||
/base64-js@1.5.1:
|
||||
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
||||
dev: true
|
||||
|
||||
/base64id@2.0.0:
|
||||
resolution: {integrity: sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==}
|
||||
@ -2062,6 +2066,7 @@ packages:
|
||||
|
||||
/buffer-json@2.0.0:
|
||||
resolution: {integrity: sha512-+jjPFVqyfF1esi9fvfUs3NqM0pH1ziZ36VP4hmA/y/Ssfo/5w5xHKfTw9BwQjoJ1w/oVtpLomqwUHKdefGyuHw==}
|
||||
dev: true
|
||||
|
||||
/buffer@5.7.1:
|
||||
resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}
|
||||
@ -2075,6 +2080,7 @@ packages:
|
||||
dependencies:
|
||||
base64-js: 1.5.1
|
||||
ieee754: 1.2.1
|
||||
dev: true
|
||||
|
||||
/bytes@3.1.2:
|
||||
resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==}
|
||||
@ -2612,7 +2618,7 @@ packages:
|
||||
dependencies:
|
||||
'@types/cookie': 0.4.1
|
||||
'@types/cors': 2.8.17
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
accepts: 1.3.8
|
||||
base64id: 2.0.0
|
||||
cookie: 0.4.2
|
||||
@ -3314,6 +3320,7 @@ packages:
|
||||
|
||||
/ieee754@1.2.1:
|
||||
resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
|
||||
dev: true
|
||||
|
||||
/ignore@5.3.1:
|
||||
resolution: {integrity: sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==}
|
||||
@ -4158,6 +4165,7 @@ packages:
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
replace-buffer: 1.2.1
|
||||
dev: true
|
||||
|
||||
/normalize-path@3.0.0:
|
||||
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
|
||||
@ -4615,6 +4623,7 @@ packages:
|
||||
/replace-buffer@1.2.1:
|
||||
resolution: {integrity: sha512-ly3OKwKu+3T55DjP5PjIMzxgz9lFx6dQnBmAIxryZyRKl8f22juy12ShOyuq8WrQE5UlFOseZgQZDua0iF9DHw==}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/require-directory@2.1.1:
|
||||
resolution: {integrity: sha1-jGStX9MNqxyXbiNE/+f3kqam30I=}
|
||||
@ -5191,7 +5200,7 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/ts-node@10.9.2(@types/node@20.11.20)(typescript@5.1.6):
|
||||
/ts-node@10.9.2(@types/node@20.11.24)(typescript@5.1.6):
|
||||
resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
@ -5210,7 +5219,7 @@ packages:
|
||||
'@tsconfig/node12': 1.0.11
|
||||
'@tsconfig/node14': 1.0.3
|
||||
'@tsconfig/node16': 1.0.4
|
||||
'@types/node': 20.11.20
|
||||
'@types/node': 20.11.24
|
||||
acorn: 8.11.3
|
||||
acorn-walk: 8.3.2
|
||||
arg: 4.1.3
|
||||
|
@ -61,12 +61,15 @@ tap.test('stringify should handle plain string', async () => {
|
||||
|
||||
tap.test('should work with buffers', async () => {
|
||||
const someObject = {
|
||||
myBuffer: Buffer.from('hello'),
|
||||
myBuffer: new TextEncoder().encode('hello')
|
||||
};
|
||||
console.log(someObject.myBuffer);
|
||||
const stringified = smartjson.stringify(someObject);
|
||||
|
||||
console.log(stringified);
|
||||
const decoded = smartjson.parse(stringified);
|
||||
expect(decoded.myBuffer.toString()).toEqual('hello');
|
||||
console.log(decoded.myBuffer);
|
||||
let text = new TextDecoder().decode(decoded.myBuffer);
|
||||
expect(text).toEqual('hello');
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartjson',
|
||||
version: '5.0.11',
|
||||
version: '5.0.12',
|
||||
description: 'typed json handlers'
|
||||
}
|
||||
|
121
ts/bufferhandling.ts
Normal file
121
ts/bufferhandling.ts
Normal file
@ -0,0 +1,121 @@
|
||||
import * as plugins from './smartjson.plugins.js';
|
||||
|
||||
// Define interfaces and types for better type checking and readability
|
||||
interface IBufferLike {
|
||||
type: 'Buffer';
|
||||
data: string | any[]; // `any[]` for array data representation
|
||||
}
|
||||
|
||||
interface IEncodedBuffer {
|
||||
type: 'EncodedBuffer',
|
||||
data: string;
|
||||
}
|
||||
|
||||
type TParseReviver = (this: any, key: string, value: any) => any;
|
||||
type TParseReplacer = (this: any, key: string, value: any) => any;
|
||||
|
||||
// Utility functions to handle base64 encoding/decoding in a cross-platform way
|
||||
function base64Encode(data: Uint8Array): string {
|
||||
return btoa(String.fromCharCode(...data));
|
||||
}
|
||||
|
||||
function base64Decode(str: string): Uint8Array {
|
||||
return new Uint8Array(Array.from(atob(str)).map((char) => char.charCodeAt(0)));
|
||||
}
|
||||
|
||||
// Main functionality with cross-platform support
|
||||
function stringify(value: any, space?: string | number): string {
|
||||
return JSON.stringify(value, replacer, space);
|
||||
}
|
||||
|
||||
function parse(text: string): any {
|
||||
return JSON.parse(text, reviver);
|
||||
}
|
||||
|
||||
const replacer: TParseReplacer = (key, value) => {
|
||||
// Check if value is IBufferLike
|
||||
if (isBufferLike(value)) {
|
||||
let bufferData: Uint8Array;
|
||||
|
||||
// Handle IBufferLike objects with a .data property
|
||||
if ('data' in value && isArray(value.data)) {
|
||||
if (value.data.length > 0) {
|
||||
bufferData = new Uint8Array(value.data);
|
||||
} else {
|
||||
return ''; // Return empty string for empty data arrays
|
||||
}
|
||||
}
|
||||
// Handle Uint8Array directly
|
||||
else if (value instanceof Uint8Array) {
|
||||
bufferData = value;
|
||||
} else {
|
||||
// If not a recognized format, return value as is
|
||||
return value;
|
||||
}
|
||||
|
||||
// Encode the bufferData (Uint8Array) to base64
|
||||
const base64Data = 'base64:' + base64Encode(bufferData);
|
||||
return {
|
||||
type: 'EncodedBuffer',
|
||||
data: base64Data,
|
||||
};
|
||||
}
|
||||
|
||||
// Return value unchanged if not buffer-like
|
||||
return value;
|
||||
};
|
||||
|
||||
const reviver: TParseReviver = (key, value) => {
|
||||
if (isEncodedBuffer(value)) {
|
||||
if (isString(value.data) && value.data.startsWith('base64:')) {
|
||||
// Correctly slice the 'base64:' prefix before decoding
|
||||
const base64Data = value.data.slice(7); // Skip 'base64:' prefix
|
||||
const buffer = base64Decode(base64Data);
|
||||
// Assuming the rest of your application can work directly with Uint8Array,
|
||||
// otherwise, you might need to convert it to another format
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
function isEncodedBuffer(x: any): x is IEncodedBuffer {
|
||||
return isObject(x) && (x as any).type === 'EncodedBuffer' && isString((x as any).data);
|
||||
}
|
||||
|
||||
function isBufferLike(x: any): x is IBufferLike | Uint8Array {
|
||||
return (
|
||||
(isObject(x) &&
|
||||
((x as any).type === 'Buffer' &&
|
||||
(isArray((x as any).data) || isString((x as any).data)))) ||
|
||||
x instanceof Uint8Array
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* We use this function to check if a value is an array
|
||||
* @param x
|
||||
* @returns
|
||||
*/
|
||||
function isArray(x: any): x is any[] {
|
||||
return Array.isArray(x);
|
||||
}
|
||||
|
||||
/**
|
||||
* We use this function to check if a value is a string
|
||||
* @param x
|
||||
* @returns
|
||||
*/
|
||||
function isString(x: any): x is string {
|
||||
return typeof x === 'string';
|
||||
}
|
||||
|
||||
/**
|
||||
* We use this function to check if a value is an object
|
||||
* @param x
|
||||
*/
|
||||
function isObject(x: any): x is object {
|
||||
return typeof x === 'object' && x !== null;
|
||||
}
|
||||
|
||||
export { stringify, parse, replacer, reviver };
|
@ -1,9 +1,10 @@
|
||||
import * as plugins from './smartjson.plugins.js';
|
||||
import * as bufferhandling from './bufferhandling.js';
|
||||
|
||||
/**
|
||||
* allows you to parse a json
|
||||
*/
|
||||
export const parse = plugins.bufferJson.parse;
|
||||
export const parse = bufferhandling.parse;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -15,7 +16,7 @@ export const stringify = (
|
||||
simpleOrderArray?: string[],
|
||||
optionsArg: plugins.IStableJsonTypes['Options'] = {}
|
||||
): string => {
|
||||
const bufferedJson = plugins.bufferJson.stringify(objArg);
|
||||
const bufferedJson = bufferhandling.stringify(objArg);
|
||||
objArg = JSON.parse(bufferedJson);
|
||||
let returnJson = plugins.stableJson(objArg, optionsArg);
|
||||
return returnJson;
|
||||
|
@ -1,16 +1,16 @@
|
||||
// @pushrocks scope
|
||||
import * as smartenv from '@push.rocks/smartenv';
|
||||
import * as smartstring from '@push.rocks/smartstring';
|
||||
|
||||
export { smartstring };
|
||||
export { smartenv, smartstring };
|
||||
|
||||
// third party scope
|
||||
import lodashCloneDeep from 'lodash.clonedeep';
|
||||
import stableJson2 from 'fast-json-stable-stringify';
|
||||
import bufferJson from 'buffer-json';
|
||||
|
||||
const stableJson = stableJson2 as any;
|
||||
|
||||
export { bufferJson, lodashCloneDeep, stableJson };
|
||||
export { lodashCloneDeep, stableJson };
|
||||
|
||||
export interface IStableJsonTypes {
|
||||
Comparator: (
|
||||
|
Loading…
Reference in New Issue
Block a user