shadowly 1.0.1 → 1.0.4
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/LICENSE +6 -6
- package/dist/class.js +10 -49
- package/dist/class.js.map +1 -0
- package/dist/error.js +2 -6
- package/dist/error.js.map +1 -0
- package/dist/index.js +3 -7
- package/dist/index.js.map +1 -0
- package/package.json +1 -1
- package/tsconfig.json +18 -7
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Copyright 2025 Pro203S
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
-
|
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
-
|
|
1
|
+
Copyright 2025 Pro203S
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
7
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/dist/class.js
CHANGED
|
@@ -1,40 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const fs = __importStar(require("node:fs"));
|
|
37
|
-
const error_1 = require("./error");
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import { ShadowlyError } from "./error";
|
|
38
3
|
function isValidJson(text) {
|
|
39
4
|
if (typeof text !== "string")
|
|
40
5
|
return false;
|
|
@@ -42,16 +7,11 @@ function isValidJson(text) {
|
|
|
42
7
|
JSON.parse(text);
|
|
43
8
|
return true;
|
|
44
9
|
}
|
|
45
|
-
catch {
|
|
10
|
+
catch (_a) {
|
|
46
11
|
return false;
|
|
47
12
|
}
|
|
48
13
|
}
|
|
49
|
-
class Shadowly {
|
|
50
|
-
DB_PATH;
|
|
51
|
-
path;
|
|
52
|
-
content;
|
|
53
|
-
parent;
|
|
54
|
-
parentKey;
|
|
14
|
+
export default class Shadowly {
|
|
55
15
|
/**
|
|
56
16
|
* Shadowly의 새 인스턴스를 만듭니다.
|
|
57
17
|
* @param path JSON 파일 경로
|
|
@@ -60,10 +20,10 @@ class Shadowly {
|
|
|
60
20
|
this.path = path;
|
|
61
21
|
this.DB_PATH = path;
|
|
62
22
|
if (!fs.existsSync(path))
|
|
63
|
-
throw new
|
|
23
|
+
throw new ShadowlyError("ENOTFOUND", path + " not found.");
|
|
64
24
|
const file = fs.readFileSync(path, "utf-8");
|
|
65
25
|
if (!isValidJson(file))
|
|
66
|
-
throw new
|
|
26
|
+
throw new ShadowlyError("EINVALID", path + " is not valid.");
|
|
67
27
|
this.content = JSON.parse(file);
|
|
68
28
|
}
|
|
69
29
|
/**
|
|
@@ -128,7 +88,7 @@ class Shadowly {
|
|
|
128
88
|
delete cur[key];
|
|
129
89
|
}
|
|
130
90
|
else {
|
|
131
|
-
throw new
|
|
91
|
+
throw new ShadowlyError("ETYPE", "Current value is not an object/array.");
|
|
132
92
|
}
|
|
133
93
|
this.persist();
|
|
134
94
|
return this;
|
|
@@ -138,7 +98,8 @@ class Shadowly {
|
|
|
138
98
|
* @returns 작업 수행 후 Shadowly 인스턴스
|
|
139
99
|
*/
|
|
140
100
|
back() {
|
|
141
|
-
|
|
101
|
+
var _a;
|
|
102
|
+
return (_a = this.parent) !== null && _a !== void 0 ? _a : this;
|
|
142
103
|
}
|
|
143
104
|
/**
|
|
144
105
|
* steps만큼 뒤로 이동합니다.
|
|
@@ -169,4 +130,4 @@ class Shadowly {
|
|
|
169
130
|
fs.writeFileSync(r.DB_PATH, JSON.stringify(r.content, null, 2), "utf-8");
|
|
170
131
|
}
|
|
171
132
|
}
|
|
172
|
-
|
|
133
|
+
//# sourceMappingURL=class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class.js","sourceRoot":"","sources":["../src/class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,SAAS,WAAW,CAAC,IAAY;IAC7B,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC3C,IAAI,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,WAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAiBD,MAAM,CAAC,OAAO,OAAO,QAAQ;IASzB;;;OAGG;IACH,YAAY,IAAY;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAEpB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;YACpB,MAAM,IAAI,aAAa,CAAC,WAAW,EAAE,IAAI,GAAG,aAAa,CAAC,CAAC;QAE/D,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;YAClB,MAAM,IAAI,aAAa,CAAC,UAAU,EAAE,IAAI,GAAG,gBAAgB,CAAC,CAAC;QAEjE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,C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C;QACpC,OAAO,GAA6B,CAAC;IACzC,CAAC;IAEO,OAAO;QACX,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;CACJ"}
|
package/dist/error.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ShadowlyError = void 0;
|
|
4
|
-
class ShadowlyError extends Error {
|
|
5
|
-
code;
|
|
1
|
+
export class ShadowlyError extends Error {
|
|
6
2
|
constructor(code, message) {
|
|
7
3
|
super(code + ": " + message);
|
|
8
4
|
this.name = "Shadowly";
|
|
@@ -10,4 +6,4 @@ class ShadowlyError extends Error {
|
|
|
10
6
|
Error.captureStackTrace(this, this.constructor);
|
|
11
7
|
}
|
|
12
8
|
}
|
|
13
|
-
|
|
9
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,aAAc,SAAQ,KAAK;IAGpC,YACI,IAAY,EACZ,OAAe;QAEf,KAAK,CAAC,IAAI,GAAG,IAAI,GAAG,OAAO,CAAC,CAAC;QAE7B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;CACJ"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const class_1 = __importDefault(require("./class"));
|
|
7
|
-
exports.default = class_1.default;
|
|
1
|
+
import Shadowly from "./class";
|
|
2
|
+
export default Shadowly;
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,SAAS,CAAC;AAE/B,eAAe,QAAQ,CAAC"}
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "CommonJS",
|
|
5
|
-
"rootDir": "src",
|
|
6
3
|
"outDir": "dist",
|
|
4
|
+
"target": "ES6",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES6",
|
|
8
|
+
"DOM"
|
|
9
|
+
],
|
|
10
|
+
"moduleResolution": "Node",
|
|
11
|
+
"esModuleInterop": true,
|
|
7
12
|
"declaration": true,
|
|
8
13
|
"strict": true,
|
|
9
|
-
"
|
|
10
|
-
"
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"types": [
|
|
16
|
+
"node"
|
|
17
|
+
],
|
|
18
|
+
"rootDir": "src"
|
|
11
19
|
},
|
|
12
|
-
"
|
|
13
|
-
|
|
20
|
+
"include": [
|
|
21
|
+
"src/**/*"
|
|
22
|
+
],
|
|
23
|
+
"exclude": ["tests"]
|
|
24
|
+
}
|