restafary 12.1.3 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ChangeLog CHANGED
@@ -1,3 +1,32 @@
1
+ 2026.01.31, v13.0.0
2
+
3
+ feature:
4
+ - decce23 restafary: drop support of node < 22
5
+ - 1212faa restafary: try-to-catch v4.0.4
6
+ - 3d7534f restafary: try-catch v4.0.9
7
+ - fbe5a9e restafary: supertape v12.2.0
8
+ - 1d4b6c4 restafary: redzip v4.0.0
9
+ - 8d055a5 restafary: redlint v5.4.0
10
+ - d36663f restafary: putout v41.16.0
11
+ - 1e78022 restafary: mime-types v3.0.2
12
+ - 980c339 restafary: madrun v12.1.3
13
+ - 0eccfa8 restafary: file-type v21.3.0
14
+ - 1b2b342 restafary: express v5.2.1
15
+ - 5ccc6a4 restafary: eslint-plugin-putout v30.0.2
16
+ - fe047b3 restafary: babel-loader v10.0.0
17
+ - 2dcdc5c restafary: @cloudcmd/stub v5.0.0
18
+ - 4bd8430 restafary: putout v37.4.0
19
+ - 776e201 restafary: webpack-cli v6.0.0
20
+ - 11d696f restafary: eslint-plugin-putout v23.3.0
21
+ - 494074e restafary: putout v36.0.4
22
+ - d802f00 restafary: c8 v10.1.2
23
+
24
+ 2024.05.21, v12.1.4
25
+
26
+ feature:
27
+ - 33dd725 node: prefix
28
+ - c301b26 restafary: eslint v9.3.0
29
+
1
30
  2024.03.29, v12.1.3
2
31
 
3
32
  feature:
package/README.md CHANGED
@@ -36,8 +36,9 @@
36
36
  ## How to use?
37
37
 
38
38
  ```js
39
+ const http = require('node:http');
39
40
  const restafary = require('restafary');
40
- const http = require('http');
41
+
41
42
  const express = require('express');
42
43
 
43
44
  const app = express();
package/client/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- /* global XMLHttpRequest */
4
3
  let FS = '/api/v1/fs';
5
4
  const isFn = (a) => typeof a === 'function';
6
5
 
package/dist/restafary.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.restafary=t():e.restafary=t()}(globalThis,(()=>(()=>{"use strict";var e={817:e=>{let t="/api/v1/fs";const r=e=>"function"==typeof e;function o({url:e,data:t,method:o,callback:n}){!function(e,t){const{url:o,data:a,method:n}=e,l=new XMLHttpRequest;if(!r(t))throw Error("Callback should be function!");l.open(n,o,!0),l.addEventListener("error",t),l.addEventListener("load",(()=>{if(l.status>=200&&l.status<400)return t(null,l.responseText);t(Error(l.responseText))})),l.send(a)}({method:o,data:t,url:a(e)},n)}function a(e){return encodeURI(e).replace(/#/g,"%23")}e.exports.prefix=e=>{t=e},e.exports.delete=(e,a,n)=>{!n&&r(a)&&(n=a,a=null),o({method:"DELETE",url:t+e,data:a,callback:n})},e.exports.patch=(e,a,n)=>{!n&&r(a)&&(n=a,a=null),o({method:"PATCH",url:t+e,data:a,callback:n})},e.exports.write=(e,a,n)=>{!n&&r(a)&&(n=a,a=null),o({method:"PUT",url:t+e,data:a,callback:n})},e.exports.read=(e,r)=>{o({method:"GET",url:t+e,callback:r})},e.exports._escape=a}},t={};return function r(o){var a=t[o];if(void 0!==a)return a.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}(817)})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.restafary=t():e.restafary=t()}(globalThis,()=>(()=>{"use strict";var e={817(e){let t="/api/v1/fs";const r=e=>"function"==typeof e;function o({url:e,data:t,method:o,callback:n}){!function(e,t){const{url:o,data:a,method:n}=e,l=new XMLHttpRequest;if(!r(t))throw Error("Callback should be function!");l.open(n,o,!0),l.addEventListener("error",t),l.addEventListener("load",()=>{if(l.status>=200&&l.status<400)return t(null,l.responseText);t(Error(l.responseText))}),l.send(a)}({method:o,data:t,url:a(e)},n)}function a(e){return encodeURI(e).replace(/#/g,"%23")}e.exports.prefix=e=>{t=e},e.exports.delete=(e,a,n)=>{!n&&r(a)&&(n=a,a=null),o({method:"DELETE",url:t+e,data:a,callback:n})},e.exports.patch=(e,a,n)=>{!n&&r(a)&&(n=a,a=null),o({method:"PATCH",url:t+e,data:a,callback:n})},e.exports.write=(e,a,n)=>{!n&&r(a)&&(n=a,a=null),o({method:"PUT",url:t+e,data:a,callback:n})},e.exports.read=(e,r)=>{o({method:"GET",url:t+e,callback:r})},e.exports._escape=a}},t={};return function r(o){var a=t[o];if(void 0!==a)return a.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}(817)})());
2
2
  //# sourceMappingURL=restafary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"restafary.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAmB,UAAID,IAEvBD,EAAgB,UAAIC,GACrB,CATD,CASGK,YAAY,I,kCCNf,IAAIC,EAAK,aACT,MAAMC,EAAQC,GAAmB,mBAANA,EAwD3B,SAASC,GAAY,IAACC,EAAG,KAAEC,EAAI,OAAEC,EAAM,SAAEC,KAazC,SAAcC,EAAQD,GAClB,MAAM,IACFH,EAAG,KACHC,EAAI,OACJC,GACAE,EAEEC,EAAU,IAAIC,eAEpB,IAAKT,EAAKM,GACN,MAAMI,MAAM,gCAShBF,EAAQG,KAAKN,EAAQF,GAAK,GAC1BK,EAAQI,iBAAiB,QAASN,GAClCE,EAAQI,iBAAiB,QATZC,KACT,GAAIL,EAAQM,QAAU,KAAON,EAAQM,OAAS,IAC1C,OAAOR,EAAS,KAAME,EAAQO,cAElCT,EAASI,MAAMF,EAAQO,cAAc,IAOzCP,EAAQQ,KAAKZ,EACjB,CApCIa,CAAK,CAACZ,SAAQD,OAAMD,IAAKe,EAAOf,IAAOG,EAC3C,CAOA,SAASY,EAAOC,GACZ,OAAOC,UAAUD,GAAKE,QAAQ,KAAM,MACxC,CAjEA1B,EAAOD,QAAQ4B,OAAUA,IACrBvB,EAAKuB,CAAM,EAGf3B,EAAOD,QAAPC,OAAwB,CAACQ,EAAKC,EAAME,MAC3BA,GAAYN,EAAKI,KAClBE,EAAWF,EACXA,EAAO,MAGXF,EAAY,CACRG,OAAQ,SACRF,IAAKJ,EAAKI,EACVC,OACAE,YACF,EAGNX,EAAOD,QAAQ6B,MAAQ,CAACpB,EAAKC,EAAME,MAC1BA,GAAYN,EAAKI,KAClBE,EAAWF,EACXA,EAAO,MAGXF,EAAY,CACRG,OAAQ,QACRF,IAAKJ,EAAKI,EACVC,OACAE,YACF,EAGNX,EAAOD,QAAQ8B,MAAQ,CAACrB,EAAKC,EAAME,MAC1BA,GAAYN,EAAKI,KAClBE,EAAWF,EACXA,EAAO,MAGXF,EAAY,CACRG,OAAQ,MACRF,IAAKJ,EAAKI,EACVC,OACAE,YACF,EAGNX,EAAOD,QAAQ+B,KAAO,CAACtB,EAAKG,KACxBJ,EAAY,CACRG,OAAQ,MACRF,IAAKJ,EAAKI,EACVG,YACF,EAWNX,EAAOD,QAAQgC,QAAUR,C,GCnErBS,EAA2B,CAAC,E,OAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAapC,QAGrB,IAAIC,EAASgC,EAAyBE,GAAY,CAGjDnC,QAAS,CAAC,GAOX,OAHAsC,EAAoBH,GAAUlC,EAAQA,EAAOD,QAASkC,GAG/CjC,EAAOD,OACf,CCnB0BkC,CAAoB,I","sources":["file://restafary/webpack/universalModuleDefinition","file://restafary/client/index.js","file://restafary/webpack/bootstrap","file://restafary/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"restafary\"] = factory();\n\telse\n\t\troot[\"restafary\"] = factory();\n})(globalThis, () => {\nreturn ","'use strict';\n\n/* global XMLHttpRequest */\nlet FS = '/api/v1/fs';\nconst isFn = (a) => typeof a === 'function';\n\nmodule.exports.prefix = (prefix) => {\n FS = prefix;\n};\n\nmodule.exports.delete = (url, data, callback) => {\n if (!callback && isFn(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'DELETE',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.patch = (url, data, callback) => {\n if (!callback && isFn(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PATCH',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.write = (url, data, callback) => {\n if (!callback && isFn(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PUT',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.read = (url, callback) => {\n sendRequest({\n method: 'GET',\n url: FS + url,\n callback,\n });\n};\n\nfunction sendRequest({url, data, method, callback}) {\n ajax({method, data, url: escape(url)}, callback);\n}\n\n/*\n * when we send ajax request -\n * no need in hash so we escape #\n */\nmodule.exports._escape = escape;\nfunction escape(str) {\n return encodeURI(str).replace(/#/g, '%23');\n}\n\nfunction ajax(params, callback) {\n const {\n url,\n data,\n method,\n } = params;\n \n const request = new XMLHttpRequest();\n \n if (!isFn(callback))\n throw Error('Callback should be function!');\n \n const load = () => {\n if (request.status >= 200 && request.status < 400)\n return callback(null, request.responseText);\n \n callback(Error(request.responseText));\n };\n \n request.open(method, url, true);\n request.addEventListener('error', callback);\n request.addEventListener('load', load);\n \n request.send(data);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module used 'module' so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(817);\n"],"names":["root","factory","exports","module","define","amd","globalThis","FS","isFn","a","sendRequest","url","data","method","callback","params","request","XMLHttpRequest","Error","open","addEventListener","load","status","responseText","send","ajax","escape","str","encodeURI","replace","prefix","patch","write","read","_escape","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"restafary.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAmB,UAAID,IAEvBD,EAAgB,UAAIC,GACrB,CATD,CASGK,WAAY,I,iCCPf,IAAIC,EAAK,aACT,MAAMC,EAAQC,GAAmB,mBAANA,EAwD3B,SAASC,GAAY,IAACC,EAAG,KAAEC,EAAI,OAAEC,EAAM,SAAEC,KAazC,SAAcC,EAAQD,GAClB,MAAM,IACFH,EAAG,KACHC,EAAI,OACJC,GACAE,EAEEC,EAAU,IAAIC,eAEpB,IAAKT,EAAKM,GACN,MAAMI,MAAM,gCAShBF,EAAQG,KAAKN,EAAQF,GAAK,GAC1BK,EAAQI,iBAAiB,QAASN,GAClCE,EAAQI,iBAAiB,OATZC,KACT,GAAIL,EAAQM,QAAU,KAAON,EAAQM,OAAS,IAC1C,OAAOR,EAAS,KAAME,EAAQO,cAElCT,EAASI,MAAMF,EAAQO,iBAO3BP,EAAQQ,KAAKZ,EACjB,CApCIa,CAAK,CAACZ,SAAQD,OAAMD,IAAKe,EAAOf,IAAOG,EAC3C,CAOA,SAASY,EAAOC,GACZ,OAAOC,UAAUD,GAAKE,QAAQ,KAAM,MACxC,CAjEA1B,EAAOD,QAAQ4B,OAAUA,IACrBvB,EAAKuB,GAGT3B,EAAOD,QAAPC,OAAwB,CAACQ,EAAKC,EAAME,MAC3BA,GAAYN,EAAKI,KAClBE,EAAWF,EACXA,EAAO,MAGXF,EAAY,CACRG,OAAQ,SACRF,IAAKJ,EAAKI,EACVC,OACAE,cAIRX,EAAOD,QAAQ6B,MAAQ,CAACpB,EAAKC,EAAME,MAC1BA,GAAYN,EAAKI,KAClBE,EAAWF,EACXA,EAAO,MAGXF,EAAY,CACRG,OAAQ,QACRF,IAAKJ,EAAKI,EACVC,OACAE,cAIRX,EAAOD,QAAQ8B,MAAQ,CAACrB,EAAKC,EAAME,MAC1BA,GAAYN,EAAKI,KAClBE,EAAWF,EACXA,EAAO,MAGXF,EAAY,CACRG,OAAQ,MACRF,IAAKJ,EAAKI,EACVC,OACAE,cAIRX,EAAOD,QAAQ+B,KAAO,CAACtB,EAAKG,KACxBJ,EAAY,CACRG,OAAQ,MACRF,IAAKJ,EAAKI,EACVG,cAYRX,EAAOD,QAAQgC,QAAUR,C,GClErBS,EAA2B,CAAC,E,OAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAapC,QAGrB,IAAIC,EAASgC,EAAyBE,GAAY,CAGjDnC,QAAS,CAAC,GAOX,OAHAsC,EAAoBH,GAAUlC,EAAQA,EAAOD,QAASkC,GAG/CjC,EAAOD,OACf,CCnB0BkC,CAAoB,I","sources":["file://restafary/webpack/universalModuleDefinition","file://restafary/client/index.js","file://restafary/webpack/bootstrap","file://restafary/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"restafary\"] = factory();\n\telse\n\t\troot[\"restafary\"] = factory();\n})(globalThis, () => {\nreturn ","'use strict';\n\nlet FS = '/api/v1/fs';\nconst isFn = (a) => typeof a === 'function';\n\nmodule.exports.prefix = (prefix) => {\n FS = prefix;\n};\n\nmodule.exports.delete = (url, data, callback) => {\n if (!callback && isFn(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'DELETE',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.patch = (url, data, callback) => {\n if (!callback && isFn(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PATCH',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.write = (url, data, callback) => {\n if (!callback && isFn(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PUT',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.read = (url, callback) => {\n sendRequest({\n method: 'GET',\n url: FS + url,\n callback,\n });\n};\n\nfunction sendRequest({url, data, method, callback}) {\n ajax({method, data, url: escape(url)}, callback);\n}\n\n/*\n * when we send ajax request -\n * no need in hash so we escape #\n */\nmodule.exports._escape = escape;\nfunction escape(str) {\n return encodeURI(str).replace(/#/g, '%23');\n}\n\nfunction ajax(params, callback) {\n const {\n url,\n data,\n method,\n } = params;\n \n const request = new XMLHttpRequest();\n \n if (!isFn(callback))\n throw Error('Callback should be function!');\n \n const load = () => {\n if (request.status >= 200 && request.status < 400)\n return callback(null, request.responseText);\n \n callback(Error(request.responseText));\n };\n \n request.open(method, url, true);\n request.addEventListener('error', callback);\n request.addEventListener('load', load);\n \n request.send(data);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module used 'module' so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(817);\n"],"names":["root","factory","exports","module","define","amd","globalThis","FS","isFn","a","sendRequest","url","data","method","callback","params","request","XMLHttpRequest","Error","open","addEventListener","load","status","responseText","send","ajax","escape","str","encodeURI","replace","prefix","patch","write","read","_escape","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"ignoreList":[],"sourceRoot":""}
@@ -20,15 +20,15 @@ return /******/ (() => { // webpackBootstrap
20
20
  /******/ "use strict";
21
21
  /******/ var __webpack_modules__ = ({
22
22
 
23
- /***/ "./client/index.js":
23
+ /***/ "./client/index.js"
24
24
  /*!*************************!*\
25
25
  !*** ./client/index.js ***!
26
26
  \*************************/
27
- /***/ ((module) => {
27
+ (module) {
28
28
 
29
- eval("\n\n/* global XMLHttpRequest */\nlet FS = '/api/v1/fs';\nconst isFn = (a) => typeof a === 'function';\n\nmodule.exports.prefix = (prefix) => {\n FS = prefix;\n};\n\nmodule.exports[\"delete\"] = (url, data, callback) => {\n if (!callback && isFn(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'DELETE',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.patch = (url, data, callback) => {\n if (!callback && isFn(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PATCH',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.write = (url, data, callback) => {\n if (!callback && isFn(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PUT',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.read = (url, callback) => {\n sendRequest({\n method: 'GET',\n url: FS + url,\n callback,\n });\n};\n\nfunction sendRequest({url, data, method, callback}) {\n ajax({method, data, url: escape(url)}, callback);\n}\n\n/*\n * when we send ajax request -\n * no need in hash so we escape #\n */\nmodule.exports._escape = escape;\nfunction escape(str) {\n return encodeURI(str).replace(/#/g, '%23');\n}\n\nfunction ajax(params, callback) {\n const {\n url,\n data,\n method,\n } = params;\n \n const request = new XMLHttpRequest();\n \n if (!isFn(callback))\n throw Error('Callback should be function!');\n \n const load = () => {\n if (request.status >= 200 && request.status < 400)\n return callback(null, request.responseText);\n \n callback(Error(request.responseText));\n };\n \n request.open(method, url, true);\n request.addEventListener('error', callback);\n request.addEventListener('load', load);\n \n request.send(data);\n}\n\n\n//# sourceURL=file://restafary/client/index.js");
29
+ eval("{\n\nlet FS = '/api/v1/fs';\nconst isFn = (a) => typeof a === 'function';\n\nmodule.exports.prefix = (prefix) => {\n FS = prefix;\n};\n\nmodule.exports[\"delete\"] = (url, data, callback) => {\n if (!callback && isFn(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'DELETE',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.patch = (url, data, callback) => {\n if (!callback && isFn(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PATCH',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.write = (url, data, callback) => {\n if (!callback && isFn(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PUT',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.read = (url, callback) => {\n sendRequest({\n method: 'GET',\n url: FS + url,\n callback,\n });\n};\n\nfunction sendRequest({url, data, method, callback}) {\n ajax({method, data, url: escape(url)}, callback);\n}\n\n/*\n * when we send ajax request -\n * no need in hash so we escape #\n */\nmodule.exports._escape = escape;\nfunction escape(str) {\n return encodeURI(str).replace(/#/g, '%23');\n}\n\nfunction ajax(params, callback) {\n const {\n url,\n data,\n method,\n } = params;\n \n const request = new XMLHttpRequest();\n \n if (!isFn(callback))\n throw Error('Callback should be function!');\n \n const load = () => {\n if (request.status >= 200 && request.status < 400)\n return callback(null, request.responseText);\n \n callback(Error(request.responseText));\n };\n \n request.open(method, url, true);\n request.addEventListener('error', callback);\n request.addEventListener('load', load);\n \n request.send(data);\n}\n\n\n//# sourceURL=file://restafary/client/index.js\n}");
30
30
 
31
- /***/ })
31
+ /***/ }
32
32
 
33
33
  /******/ });
34
34
  /************************************************************************/
@@ -42,6 +42,12 @@ eval("\n\n/* global XMLHttpRequest */\nlet FS = '/api/v1/fs';\nconst isFn = (a)
42
42
  /******/ if (cachedModule !== undefined) {
43
43
  /******/ return cachedModule.exports;
44
44
  /******/ }
45
+ /******/ // Check if module exists (development only)
46
+ /******/ if (__webpack_modules__[moduleId] === undefined) {
47
+ /******/ var e = new Error("Cannot find module '" + moduleId + "'");
48
+ /******/ e.code = 'MODULE_NOT_FOUND';
49
+ /******/ throw e;
50
+ /******/ }
45
51
  /******/ // Create a new module (and put it into the cache)
46
52
  /******/ var module = __webpack_module_cache__[moduleId] = {
47
53
  /******/ // no module.id needed
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "restafary",
3
- "version": "12.1.3",
3
+ "version": "13.0.0",
4
4
  "type": "commonjs",
5
5
  "description": "REST for CRUD file operations",
6
6
  "main": "server/restafary.js",
7
7
  "engines": {
8
- "node": ">=18"
8
+ "node": ">=22"
9
9
  },
10
10
  "babel": {
11
11
  "presets": [
@@ -38,42 +38,43 @@
38
38
  "ashify": "^2.0.0",
39
39
  "checkup": "^1.3.0",
40
40
  "currify": "^4.0.0",
41
- "file-type": "^19.0.0",
41
+ "file-type": "^21.3.0",
42
42
  "files-io": "^4.0.0",
43
43
  "flop": "^12.0.0",
44
44
  "jonny": "^3.0.0",
45
45
  "mellow": "^3.0.1",
46
- "mime-types": "^2.1.28",
46
+ "mime-types": "^3.0.2",
47
47
  "patchfile": "^4.0.0",
48
48
  "pipe-io": "^4.0.1",
49
49
  "ponse": "^7.0.0",
50
50
  "pullout": "^5.0.1",
51
- "redzip": "^3.0.0",
52
- "try-to-catch": "^3.0.0",
51
+ "redzip": "^4.0.0",
52
+ "try-to-catch": "^4.0.4",
53
53
  "win32": "^7.0.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/cli": "^7.0.0",
57
57
  "@babel/core": "^7.0.0",
58
+ "@babel/eslint-parser": "^7.24.5",
58
59
  "@babel/preset-env": "^7.0.0",
59
- "@cloudcmd/stub": "^4.0.1",
60
+ "@cloudcmd/stub": "^5.0.0",
60
61
  "@iocmd/wait": "^2.1.0",
61
- "babel-loader": "^9.1.2",
62
- "c8": "^9.1.0",
63
- "eslint": "^8.13.0",
64
- "eslint-plugin-n": "^16.0.0",
65
- "eslint-plugin-putout": "^22.3.1",
66
- "express": "^4.13.4",
67
- "madrun": "^10.0.1",
62
+ "babel-loader": "^10.0.0",
63
+ "c8": "^10.1.2",
64
+ "eslint": "^9.3.0",
65
+ "eslint-plugin-putout": "^30.0.2",
66
+ "express": "^5.2.1",
67
+ "madrun": "^12.1.3",
68
68
  "mock-require": "^3.0.2",
69
69
  "nodemon": "^3.0.1",
70
- "nyc": "^15.0.0",
71
- "putout": "^35.0.4",
70
+ "putout": "^41.16.0",
71
+ "redlint": "^5.4.0",
72
+ "rimraf": "^6.1.2",
72
73
  "serve-once": "^3.0.2",
73
- "supertape": "^10.0.0",
74
- "try-catch": "^3.0.1",
74
+ "supertape": "^12.2.0",
75
+ "try-catch": "^4.0.9",
75
76
  "webpack": "^5.11.0",
76
- "webpack-cli": "^5.0.1"
77
+ "webpack-cli": "^6.0.0"
77
78
  },
78
79
  "repository": {
79
80
  "type": "git",
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ const {callbackify} = require('node:util');
3
4
  const check = require('checkup');
4
5
  const {remove} = require('flop');
5
- const {callbackify} = require('util');
6
6
 
7
7
  const pullout = require('pullout');
8
8
 
package/server/fs/get.js CHANGED
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const {Readable} = require('stream');
3
+ const {Buffer} = require('node:buffer');
4
+ const {Readable} = require('node:stream');
4
5
 
5
- const {parse} = require('querystring');
6
+ const {parse} = require('node:querystring');
6
7
  const check = require('checkup');
7
8
  const ashify = require('ashify');
8
9
  const {read} = require('win32');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const {callbackify} = require('util');
3
+ const {callbackify} = require('node:util');
4
4
 
5
5
  const check = require('checkup');
6
6
  const pullout = require('pullout');
package/server/fs/put.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const {callbackify} = require('util');
3
+ const {callbackify} = require('node:util');
4
4
 
5
5
  const check = require('checkup');
6
6
  const {write} = require('redzip');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const {join} = require('path');
3
+ const {join} = require('node:path');
4
4
 
5
5
  module.exports.handleDotFolder = (root, cwd) => {
6
6
  if (root.startsWith('./')) {
@@ -1,21 +1,22 @@
1
1
  'use strict';
2
2
 
3
3
  const process = require('node:process');
4
+
4
5
  const {
5
6
  basename,
6
7
  extname,
7
8
  join,
8
- } = require('path');
9
+ } = require('node:path');
9
10
 
10
11
  const {webToWin} = require('mellow');
11
12
 
12
13
  const ponse = require('ponse');
13
14
  const currify = require('currify');
14
- const tryToCatch = require('try-to-catch');
15
+ const {tryToCatch: _tryToCatch} = require('try-to-catch');
15
16
  const pipe = require('pipe-io');
16
17
  const {contentType} = require('mime-types');
17
18
  const {handleDotFolder} = require('./handle-dot-dir');
18
-
19
+ const isUndefined = (a) => typeof a === 'undefined';
19
20
  const isFn = (a) => typeof a === 'function';
20
21
 
21
22
  const DIR = './';
@@ -39,12 +40,17 @@ module.exports = currify(async (options, request, response, next) => {
39
40
  const res = response;
40
41
  const isFile = /^\/restafary\.js(\.map)?$/.test(req.url);
41
42
 
42
- const {prefix = '/fs', root = '/'} = options;
43
+ const {
44
+ prefix = '/fs',
45
+ root = '/',
46
+ tryToCatch = _tryToCatch,
47
+ } = options;
43
48
 
44
49
  const params = {
45
50
  root,
46
51
  request,
47
52
  response,
53
+ tryToCatch,
48
54
  };
49
55
 
50
56
  let name = ponse.getPathName(req);
@@ -66,7 +72,7 @@ module.exports = currify(async (options, request, response, next) => {
66
72
  if (options.name)
67
73
  params.name = options.name;
68
74
 
69
- if (options.gzip !== undefined)
75
+ if (!isUndefined(options.gzip))
70
76
  params.gzip = options.gzip;
71
77
 
72
78
  if (options.query)
@@ -118,7 +124,7 @@ function getMsg(name, req) {
118
124
  }
119
125
 
120
126
  function checkPath(name, root) {
121
- const drive = name.split('/')[1];
127
+ const [, drive] = name.split('/');
122
128
  const isRoot = root === '/';
123
129
  const isDrive = /^[a-z]$/i.test(drive);
124
130
 
@@ -126,6 +132,7 @@ function checkPath(name, root) {
126
132
  }
127
133
 
128
134
  async function onFS(params, callback) {
135
+ const {tryToCatch} = params;
129
136
  const pathError = 'Could not write file/create directory in root on windows!';
130
137
  const p = params;
131
138
  const {name} = p;
@@ -141,7 +148,7 @@ async function onFS(params, callback) {
141
148
  if (isFn(params.root))
142
149
  root = params.root();
143
150
  else
144
- root = params.root;
151
+ ({root} = params);
145
152
 
146
153
  root = handleDotFolder(root, CWD);
147
154
  const rootWin = root.replace('/', '\\');
@@ -194,6 +201,7 @@ async function onFS(params, callback) {
194
201
  type,
195
202
  pathWeb,
196
203
  stream,
204
+ tryToCatch,
197
205
  });
198
206
 
199
207
  if (streamError)
@@ -223,7 +231,7 @@ function format(msg, name) {
223
231
  return `${msg}: ${status}${name}`;
224
232
  }
225
233
 
226
- async function getContentType({type, pathWeb, stream}) {
234
+ async function getContentType({type, pathWeb, stream, tryToCatch}) {
227
235
  const {fileTypeStream} = await import('file-type');
228
236
 
229
237
  if (!type)