restafary 11.5.1 → 12.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 +11 -0
- package/README.md +1 -1
- package/dist/restafary.js +1 -1
- package/dist/restafary.js.map +1 -1
- package/package.json +8 -8
- package/server/restafary.js +6 -7
package/ChangeLog
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
2024.02.02, v12.0.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 0e505ef restafary: file-type v19.0.0
|
|
5
|
+
- a11c37a restafary: supertape v10.0.0
|
|
6
|
+
- dd9b5b9 restafary: madrun v10.0.1
|
|
7
|
+
- 66644c9 restafary: eslint-plugin-putout v22.3.1
|
|
8
|
+
- 55e7a68 restafary: putout v35.0.4
|
|
9
|
+
- b611e9a restafary: c8 v9.1.0
|
|
10
|
+
- 866e1a6 drop support of node < 18
|
|
11
|
+
|
|
1
12
|
2023.08.09, v11.5.1
|
|
2
13
|
|
|
3
14
|
feature:
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
| | | | |`asc` or `desc` |
|
|
24
24
|
| | |`raw` | |get file or raw dir content |
|
|
25
25
|
| | |`size` | |get file or dir size |
|
|
26
|
-
| | |`raw-size | |get raw size |
|
|
26
|
+
| | |`raw-size` | |get raw size |
|
|
27
27
|
| | |`hash` | |get file hash |
|
|
28
28
|
| | |`download` | |content disposition attachment |
|
|
29
29
|
| |`PUT` | |file content |create/write file |
|
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={
|
|
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={648: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}(648)})()));
|
|
2
2
|
//# sourceMappingURL=restafary.js.map
|
package/dist/restafary.js.map
CHANGED
|
@@ -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,
|
|
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,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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__(648);\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":""}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "restafary",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.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": ">=
|
|
8
|
+
"node": ">=18"
|
|
9
9
|
},
|
|
10
10
|
"babel": {
|
|
11
11
|
"presets": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"ashify": "^2.0.0",
|
|
35
35
|
"checkup": "^1.3.0",
|
|
36
36
|
"currify": "^4.0.0",
|
|
37
|
-
"file-type": "^
|
|
37
|
+
"file-type": "^19.0.0",
|
|
38
38
|
"files-io": "^4.0.0",
|
|
39
39
|
"flop": "^11.0.0",
|
|
40
40
|
"jonny": "^3.0.0",
|
|
@@ -55,18 +55,18 @@
|
|
|
55
55
|
"@cloudcmd/stub": "^4.0.1",
|
|
56
56
|
"@iocmd/wait": "^2.1.0",
|
|
57
57
|
"babel-loader": "^9.1.2",
|
|
58
|
-
"c8": "^
|
|
58
|
+
"c8": "^9.1.0",
|
|
59
59
|
"eslint": "^8.13.0",
|
|
60
60
|
"eslint-plugin-n": "^16.0.0",
|
|
61
|
-
"eslint-plugin-putout": "^
|
|
61
|
+
"eslint-plugin-putout": "^22.3.1",
|
|
62
62
|
"express": "^4.13.4",
|
|
63
|
-
"madrun": "^
|
|
63
|
+
"madrun": "^10.0.1",
|
|
64
64
|
"mock-require": "^3.0.2",
|
|
65
65
|
"nodemon": "^3.0.1",
|
|
66
66
|
"nyc": "^15.0.0",
|
|
67
|
-
"putout": "^
|
|
67
|
+
"putout": "^35.0.4",
|
|
68
68
|
"serve-once": "^2.0.0",
|
|
69
|
-
"supertape": "^
|
|
69
|
+
"supertape": "^10.0.0",
|
|
70
70
|
"try-catch": "^3.0.1",
|
|
71
71
|
"webpack": "^5.11.0",
|
|
72
72
|
"webpack-cli": "^5.0.1"
|
package/server/restafary.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const process = require('node:process');
|
|
3
4
|
const {
|
|
4
5
|
basename,
|
|
5
6
|
extname,
|
|
@@ -104,14 +105,12 @@ function getMsg(name, req) {
|
|
|
104
105
|
|
|
105
106
|
name = basename(name);
|
|
106
107
|
|
|
107
|
-
if (method !== 'put')
|
|
108
|
+
if (method !== 'put')
|
|
108
109
|
msg = method;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
msg = 'save';
|
|
114
|
-
}
|
|
110
|
+
else if (query === 'dir')
|
|
111
|
+
msg = 'make dir';
|
|
112
|
+
else
|
|
113
|
+
msg = 'save';
|
|
115
114
|
|
|
116
115
|
msg = format(msg, name);
|
|
117
116
|
|