namirasoft-core 1.0.5 → 1.0.7
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/dist/PackageService.d.ts +13 -0
- package/dist/PackageService.js +53 -0
- package/dist/PackageService.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/PackageService.ts +59 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class PackageService {
|
|
2
|
+
static get(path: string): PackageService | null;
|
|
3
|
+
static getMain(): PackageService | null;
|
|
4
|
+
static getThis(): PackageService | null;
|
|
5
|
+
private json;
|
|
6
|
+
constructor(json: any);
|
|
7
|
+
getName(): string;
|
|
8
|
+
getTitle(): string;
|
|
9
|
+
getDescription(): string;
|
|
10
|
+
getIcon(): string;
|
|
11
|
+
getLogo(): string;
|
|
12
|
+
getVersion(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PackageService = void 0;
|
|
7
|
+
let findUp = require("find-up");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
class PackageService {
|
|
10
|
+
static get(path) {
|
|
11
|
+
if (path) {
|
|
12
|
+
const json = JSON.parse(fs_1.default.readFileSync(path, 'utf8'));
|
|
13
|
+
if (json)
|
|
14
|
+
return new PackageService(json);
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
static getMain() {
|
|
19
|
+
const paths = findUp.findUpSync('package.json');
|
|
20
|
+
if (paths)
|
|
21
|
+
return this.get(paths[0]);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
static getThis() {
|
|
25
|
+
const paths = findUp.findUpSync('package.json');
|
|
26
|
+
if (paths)
|
|
27
|
+
return this.get(paths[paths.length - 1]);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
constructor(json) {
|
|
31
|
+
this.json = json;
|
|
32
|
+
}
|
|
33
|
+
getName() {
|
|
34
|
+
return this.json.name;
|
|
35
|
+
}
|
|
36
|
+
getTitle() {
|
|
37
|
+
return this.json.title;
|
|
38
|
+
}
|
|
39
|
+
getDescription() {
|
|
40
|
+
return this.json.description;
|
|
41
|
+
}
|
|
42
|
+
getIcon() {
|
|
43
|
+
return this.json.icon;
|
|
44
|
+
}
|
|
45
|
+
getLogo() {
|
|
46
|
+
return this.json.logo;
|
|
47
|
+
}
|
|
48
|
+
getVersion() {
|
|
49
|
+
return this.json.version;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.PackageService = PackageService;
|
|
53
|
+
//# sourceMappingURL=PackageService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PackageService.js","sourceRoot":"","sources":["../src/PackageService.ts"],"names":[],"mappings":";;;;;;AAAA,IAAI,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAChC,4CAAoB;AAEpB,MAAa,cAAc;IAEvB,MAAM,CAAC,GAAG,CAAC,IAAY;QAEnB,IAAI,IAAI,EACR;YACI,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;YACvD,IAAI,IAAI;gBACJ,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;SACvC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,CAAC,OAAO;QAEV,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QAChD,IAAI,KAAK;YACL,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,CAAC,OAAO;QAEV,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QAChD,IAAI,KAAK;YACL,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,YAAY,IAAS;QAEjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IACD,OAAO;QAEH,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAC1B,CAAC;IACD,QAAQ;QAEJ,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IAC3B,CAAC;IACD,cAAc;QAEV,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;IACjC,CAAC;IACD,OAAO;QAEH,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAC1B,CAAC;IACD,OAAO;QAEH,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAC1B,CAAC;IACD,UAAU;QAEN,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IAC7B,CAAC;CACJ;AAvDD,wCAuDC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./IStorage";
|
|
|
11
11
|
export * from "./IStorageLocal";
|
|
12
12
|
export * from "./IStorageMemory";
|
|
13
13
|
export * from "./ObjectService";
|
|
14
|
+
export * from "./PackageService";
|
|
14
15
|
export * from "./ParsedNameValue";
|
|
15
16
|
export * from "./PhoneOperation";
|
|
16
17
|
export * from "./SignOperation";
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __exportStar(require("./IStorage"), exports);
|
|
|
27
27
|
__exportStar(require("./IStorageLocal"), exports);
|
|
28
28
|
__exportStar(require("./IStorageMemory"), exports);
|
|
29
29
|
__exportStar(require("./ObjectService"), exports);
|
|
30
|
+
__exportStar(require("./PackageService"), exports);
|
|
30
31
|
__exportStar(require("./ParsedNameValue"), exports);
|
|
31
32
|
__exportStar(require("./PhoneOperation"), exports);
|
|
32
33
|
__exportStar(require("./SignOperation"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,+CAA6B;AAC7B,8CAA4B;AAC5B,mDAAiC;AACjC,4CAA0B;AAC1B,qDAAmC;AACnC,mDAAiC;AACjC,iDAA+B;AAC/B,8CAA4B;AAC5B,6CAA2B;AAC3B,kDAAgC;AAChC,mDAAiC;AACjC,kDAAgC;AAChC,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,oDAAkC;AAClC,kDAAgC;AAChC,iDAA+B;AAC/B,qDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,+CAA6B;AAC7B,8CAA4B;AAC5B,mDAAiC;AACjC,4CAA0B;AAC1B,qDAAmC;AACnC,mDAAiC;AACjC,iDAA+B;AAC/B,8CAA4B;AAC5B,6CAA2B;AAC3B,kDAAgC;AAChC,mDAAiC;AACjC,kDAAgC;AAChC,mDAAiC;AACjC,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,oDAAkC;AAClC,kDAAgC;AAChC,iDAA+B;AAC/B,qDAAmC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "namirasoft-core",
|
|
3
3
|
"description": "Namira Software Corporation Core NPM Package",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.7",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"scripts": {},
|
|
8
8
|
"author": "Amir Abolhasani",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@types/md5": "^2.3.
|
|
12
|
-
"axios": "^1.
|
|
11
|
+
"@types/md5": "^2.3.5",
|
|
12
|
+
"axios": "^1.6.0",
|
|
13
|
+
"find-up": "^6.3.0",
|
|
13
14
|
"md5": "^2.3.0",
|
|
14
15
|
"moment": "^2.29.4",
|
|
15
16
|
"phone": "^3.1.41"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
let findUp = require("find-up");
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
|
|
4
|
+
export class PackageService
|
|
5
|
+
{
|
|
6
|
+
static get(path: string): PackageService | null
|
|
7
|
+
{
|
|
8
|
+
if (path)
|
|
9
|
+
{
|
|
10
|
+
const json = JSON.parse(fs.readFileSync(path, 'utf8'));
|
|
11
|
+
if (json)
|
|
12
|
+
return new PackageService(json);
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
static getMain(): PackageService | null
|
|
17
|
+
{
|
|
18
|
+
const paths = findUp.findUpSync('package.json');
|
|
19
|
+
if (paths)
|
|
20
|
+
return this.get(paths[0]);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
static getThis(): PackageService | null
|
|
24
|
+
{
|
|
25
|
+
const paths = findUp.findUpSync('package.json');
|
|
26
|
+
if (paths)
|
|
27
|
+
return this.get(paths[paths.length - 1]);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
private json: any;
|
|
31
|
+
constructor(json: any)
|
|
32
|
+
{
|
|
33
|
+
this.json = json;
|
|
34
|
+
}
|
|
35
|
+
getName(): string
|
|
36
|
+
{
|
|
37
|
+
return this.json.name;
|
|
38
|
+
}
|
|
39
|
+
getTitle(): string
|
|
40
|
+
{
|
|
41
|
+
return this.json.title;
|
|
42
|
+
}
|
|
43
|
+
getDescription(): string
|
|
44
|
+
{
|
|
45
|
+
return this.json.description;
|
|
46
|
+
}
|
|
47
|
+
getIcon(): string
|
|
48
|
+
{
|
|
49
|
+
return this.json.icon;
|
|
50
|
+
}
|
|
51
|
+
getLogo(): string
|
|
52
|
+
{
|
|
53
|
+
return this.json.logo;
|
|
54
|
+
}
|
|
55
|
+
getVersion(): string
|
|
56
|
+
{
|
|
57
|
+
return this.json.version;
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./IStorage";
|
|
|
11
11
|
export * from "./IStorageLocal";
|
|
12
12
|
export * from "./IStorageMemory";
|
|
13
13
|
export * from "./ObjectService";
|
|
14
|
+
export * from "./PackageService";
|
|
14
15
|
export * from "./ParsedNameValue";
|
|
15
16
|
export * from "./PhoneOperation";
|
|
16
17
|
export * from "./SignOperation";
|