@devbro/pashmak 0.1.29 → 0.1.31
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/DatabaseServiceProvider.mjs +18 -3
- package/dist/DatabaseServiceProvider.mjs.map +1 -1
- package/dist/bin/DatabaseServiceProvider.cjs +60 -3
- package/dist/bin/global.cjs +69 -0
- package/dist/bin/index.cjs +65 -3
- package/dist/global.d.mts +12 -0
- package/dist/global.mjs +45 -0
- package/dist/global.mjs.map +1 -0
- package/package.json +6 -1
|
@@ -5,6 +5,7 @@ import { PostgresqlConnection } from "@devbro/neko-sql";
|
|
|
5
5
|
import { BaseModel } from "@devbro/neko-orm";
|
|
6
6
|
import { ctx } from "@devbro/neko-context";
|
|
7
7
|
import { config } from "@devbro/neko-config";
|
|
8
|
+
import { Global } from "./global.mjs";
|
|
8
9
|
class DatabaseServiceProvider extends Middleware {
|
|
9
10
|
static {
|
|
10
11
|
__name(this, "DatabaseServiceProvider");
|
|
@@ -18,9 +19,23 @@ class DatabaseServiceProvider extends Middleware {
|
|
|
18
19
|
ctx().set(["database", name], conn);
|
|
19
20
|
conns.push(conn);
|
|
20
21
|
}
|
|
21
|
-
BaseModel.setConnection(
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
BaseModel.setConnection(async () => {
|
|
23
|
+
const key = ["database", "default"];
|
|
24
|
+
let rc = ctx().get(key);
|
|
25
|
+
if (ctx().has(key)) {
|
|
26
|
+
rc = ctx().get(key);
|
|
27
|
+
} else if (Global.has(key)) {
|
|
28
|
+
rc = Global.get(key);
|
|
29
|
+
} else {
|
|
30
|
+
rc = await this.getConnection(db_configs["default"]);
|
|
31
|
+
try {
|
|
32
|
+
ctx().set(key, rc);
|
|
33
|
+
} catch {
|
|
34
|
+
Global.set(key, rc);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return rc;
|
|
38
|
+
});
|
|
24
39
|
await next();
|
|
25
40
|
} finally {
|
|
26
41
|
for (const conn of conns) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/DatabaseServiceProvider.mts"],"sourcesContent":["import { Middleware } from \"@devbro/neko-router\";\nimport { Request, Response } from \"@devbro/neko-router\";\nimport { PostgresqlConnection } from \"@devbro/neko-sql\";\nimport { PoolConfig } from \"pg\";\nimport { Connection } from \"@devbro/neko-sql\";\nimport { BaseModel } from \"@devbro/neko-orm\";\nimport { ctx } from \"@devbro/neko-context\";\nimport { config } from \"@devbro/neko-config\";\n\nexport class DatabaseServiceProvider extends Middleware {\n async call(\n req: Request,\n res: Response,\n next: () => Promise<void>,\n ): Promise<void> {\n const db_configs: Record<string, PoolConfig & { name: string }> =\n config.get(\"databases\");\n\n const conns = [];\n try {\n for (const [name, db_config] of Object.entries(db_configs)) {\n const conn = await this.getConnection(db_config);\n ctx().set([\"database\", name], conn);\n conns.push(conn);\n }\n BaseModel.setConnection(()
|
|
1
|
+
{"version":3,"sources":["../src/DatabaseServiceProvider.mts"],"sourcesContent":["import { Middleware } from \"@devbro/neko-router\";\nimport { Request, Response } from \"@devbro/neko-router\";\nimport { PostgresqlConnection } from \"@devbro/neko-sql\";\nimport { PoolConfig } from \"pg\";\nimport { Connection } from \"@devbro/neko-sql\";\nimport { BaseModel } from \"@devbro/neko-orm\";\nimport { ctx } from \"@devbro/neko-context\";\nimport { config } from \"@devbro/neko-config\";\nimport { Global } from \"./global.mjs\";\n\nexport class DatabaseServiceProvider extends Middleware {\n async call(\n req: Request,\n res: Response,\n next: () => Promise<void>,\n ): Promise<void> {\n const db_configs: Record<string, PoolConfig & { name: string }> =\n config.get(\"databases\");\n\n const conns = [];\n try {\n for (const [name, db_config] of Object.entries(db_configs)) {\n const conn = await this.getConnection(db_config);\n ctx().set([\"database\", name], conn);\n conns.push(conn);\n }\n BaseModel.setConnection(async () => {\n const key = [\"database\", \"default\"];\n let rc: Connection | undefined = ctx().get<Connection>(key);\n\n if (ctx().has(key)) {\n rc = ctx().get<Connection>(key);\n } else if (Global.has(key)) {\n rc = Global.get<Connection>(key);\n } else {\n rc = await this.getConnection(db_configs[\"default\"]);\n try {\n ctx().set(key, rc);\n } catch {\n // we are outside of context\n Global.set(key, rc);\n }\n }\n return rc!;\n });\n await next();\n } finally {\n for (const conn of conns) {\n await conn.disconnect();\n }\n }\n }\n\n private static instance: DatabaseServiceProvider;\n\n async register(): Promise<void> {}\n\n static getInstance(): DatabaseServiceProvider {\n if (!DatabaseServiceProvider.instance) {\n DatabaseServiceProvider.instance = new DatabaseServiceProvider();\n }\n return DatabaseServiceProvider.instance;\n }\n\n async getConnection(db_config: PoolConfig): Promise<PostgresqlConnection> {\n const conn = new PostgresqlConnection(db_config);\n if (!(await conn.connect())) {\n throw new Error(\"Failed to connect to the database\");\n }\n return conn;\n }\n}\n"],"mappings":";;AAAA,SAAS,kBAAkB;AAE3B,SAAS,4BAA4B;AAGrC,SAAS,iBAAiB;AAC1B,SAAS,WAAW;AACpB,SAAS,cAAc;AACvB,SAAS,cAAc;AAEhB,MAAM,gCAAgC,WAAW;AAAA,EAVxD,OAUwD;AAAA;AAAA;AAAA,EACtD,MAAM,KACJ,KACA,KACA,MACe;AACf,UAAM,aACJ,OAAO,IAAI,WAAW;AAExB,UAAM,QAAQ,CAAC;AACf,QAAI;AACF,iBAAW,CAAC,MAAM,SAAS,KAAK,OAAO,QAAQ,UAAU,GAAG;AAC1D,cAAM,OAAO,MAAM,KAAK,cAAc,SAAS;AAC/C,YAAI,EAAE,IAAI,CAAC,YAAY,IAAI,GAAG,IAAI;AAClC,cAAM,KAAK,IAAI;AAAA,MACjB;AACA,gBAAU,cAAc,YAAY;AAClC,cAAM,MAAM,CAAC,YAAY,SAAS;AAClC,YAAI,KAA6B,IAAI,EAAE,IAAgB,GAAG;AAE1D,YAAI,IAAI,EAAE,IAAI,GAAG,GAAG;AAClB,eAAK,IAAI,EAAE,IAAgB,GAAG;AAAA,QAChC,WAAW,OAAO,IAAI,GAAG,GAAG;AAC1B,eAAK,OAAO,IAAgB,GAAG;AAAA,QACjC,OAAO;AACL,eAAK,MAAM,KAAK,cAAc,WAAW,SAAS,CAAC;AACnD,cAAI;AACF,gBAAI,EAAE,IAAI,KAAK,EAAE;AAAA,UACnB,QAAQ;AAEN,mBAAO,IAAI,KAAK,EAAE;AAAA,UACpB;AAAA,QACF;AACA,eAAO;AAAA,MACT,CAAC;AACD,YAAM,KAAK;AAAA,IACb,UAAE;AACA,iBAAW,QAAQ,OAAO;AACxB,cAAM,KAAK,WAAW;AAAA,MACxB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAe;AAAA,EAEf,MAAM,WAA0B;AAAA,EAAC;AAAA,EAEjC,OAAO,cAAuC;AAC5C,QAAI,CAAC,wBAAwB,UAAU;AACrC,8BAAwB,WAAW,IAAI,wBAAwB;AAAA,IACjE;AACA,WAAO,wBAAwB;AAAA,EACjC;AAAA,EAEA,MAAM,cAAc,WAAsD;AACxE,UAAM,OAAO,IAAI,qBAAqB,SAAS;AAC/C,QAAI,CAAE,MAAM,KAAK,QAAQ,GAAI;AAC3B,YAAM,IAAI,MAAM,mCAAmC;AAAA,IACrD;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -42,6 +42,49 @@ var import_neko_sql = require("@devbro/neko-sql");
|
|
|
42
42
|
var import_neko_orm = require("@devbro/neko-orm");
|
|
43
43
|
var import_neko_context = require("@devbro/neko-context");
|
|
44
44
|
var import_neko_config = require("@devbro/neko-config");
|
|
45
|
+
|
|
46
|
+
// src/global.mts
|
|
47
|
+
var Global = class _Global {
|
|
48
|
+
static {
|
|
49
|
+
__name(this, "Global");
|
|
50
|
+
}
|
|
51
|
+
static _vars = {};
|
|
52
|
+
static set(key, value) {
|
|
53
|
+
this._vars[_Global.generateInternalKey(key)] = value;
|
|
54
|
+
}
|
|
55
|
+
static get(key) {
|
|
56
|
+
return this._vars[_Global.generateInternalKey(key)];
|
|
57
|
+
}
|
|
58
|
+
static getOrThrow(key) {
|
|
59
|
+
const rc = this.get(key);
|
|
60
|
+
if (rc === void 0) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`Key ${_Global.generateInternalKey(key)} not found in Global`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return rc;
|
|
66
|
+
}
|
|
67
|
+
static generateInternalKey(key) {
|
|
68
|
+
let new_key = "";
|
|
69
|
+
if (Array.isArray(key)) {
|
|
70
|
+
new_key = key.join(".");
|
|
71
|
+
} else {
|
|
72
|
+
new_key = key;
|
|
73
|
+
}
|
|
74
|
+
return new_key;
|
|
75
|
+
}
|
|
76
|
+
static has(key) {
|
|
77
|
+
return _Global.generateInternalKey(key) in _Global._vars;
|
|
78
|
+
}
|
|
79
|
+
static delete(key) {
|
|
80
|
+
delete _Global._vars[_Global.generateInternalKey(key)];
|
|
81
|
+
}
|
|
82
|
+
static keys() {
|
|
83
|
+
return Object.keys(_Global._vars);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// src/DatabaseServiceProvider.mts
|
|
45
88
|
var DatabaseServiceProvider = class _DatabaseServiceProvider extends Middleware {
|
|
46
89
|
static {
|
|
47
90
|
__name(this, "DatabaseServiceProvider");
|
|
@@ -55,9 +98,23 @@ var DatabaseServiceProvider = class _DatabaseServiceProvider extends Middleware
|
|
|
55
98
|
(0, import_neko_context.ctx)().set(["database", name], conn);
|
|
56
99
|
conns.push(conn);
|
|
57
100
|
}
|
|
58
|
-
import_neko_orm.BaseModel.setConnection(
|
|
59
|
-
|
|
60
|
-
|
|
101
|
+
import_neko_orm.BaseModel.setConnection(async () => {
|
|
102
|
+
const key = ["database", "default"];
|
|
103
|
+
let rc = (0, import_neko_context.ctx)().get(key);
|
|
104
|
+
if ((0, import_neko_context.ctx)().has(key)) {
|
|
105
|
+
rc = (0, import_neko_context.ctx)().get(key);
|
|
106
|
+
} else if (Global.has(key)) {
|
|
107
|
+
rc = Global.get(key);
|
|
108
|
+
} else {
|
|
109
|
+
rc = await this.getConnection(db_configs["default"]);
|
|
110
|
+
try {
|
|
111
|
+
(0, import_neko_context.ctx)().set(key, rc);
|
|
112
|
+
} catch {
|
|
113
|
+
Global.set(key, rc);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return rc;
|
|
117
|
+
});
|
|
61
118
|
await next();
|
|
62
119
|
} finally {
|
|
63
120
|
for (const conn of conns) {
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/global.mts
|
|
22
|
+
var global_exports = {};
|
|
23
|
+
__export(global_exports, {
|
|
24
|
+
Global: () => Global
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(global_exports);
|
|
27
|
+
var Global = class _Global {
|
|
28
|
+
static {
|
|
29
|
+
__name(this, "Global");
|
|
30
|
+
}
|
|
31
|
+
static _vars = {};
|
|
32
|
+
static set(key, value) {
|
|
33
|
+
this._vars[_Global.generateInternalKey(key)] = value;
|
|
34
|
+
}
|
|
35
|
+
static get(key) {
|
|
36
|
+
return this._vars[_Global.generateInternalKey(key)];
|
|
37
|
+
}
|
|
38
|
+
static getOrThrow(key) {
|
|
39
|
+
const rc = this.get(key);
|
|
40
|
+
if (rc === void 0) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`Key ${_Global.generateInternalKey(key)} not found in Global`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
return rc;
|
|
46
|
+
}
|
|
47
|
+
static generateInternalKey(key) {
|
|
48
|
+
let new_key = "";
|
|
49
|
+
if (Array.isArray(key)) {
|
|
50
|
+
new_key = key.join(".");
|
|
51
|
+
} else {
|
|
52
|
+
new_key = key;
|
|
53
|
+
}
|
|
54
|
+
return new_key;
|
|
55
|
+
}
|
|
56
|
+
static has(key) {
|
|
57
|
+
return _Global.generateInternalKey(key) in _Global._vars;
|
|
58
|
+
}
|
|
59
|
+
static delete(key) {
|
|
60
|
+
delete _Global._vars[_Global.generateInternalKey(key)];
|
|
61
|
+
}
|
|
62
|
+
static keys() {
|
|
63
|
+
return Object.keys(_Global._vars);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
Global
|
|
69
|
+
});
|
package/dist/bin/index.cjs
CHANGED
|
@@ -2829,6 +2829,53 @@ var init_console = __esm({
|
|
|
2829
2829
|
}
|
|
2830
2830
|
});
|
|
2831
2831
|
|
|
2832
|
+
// src/global.mts
|
|
2833
|
+
var Global;
|
|
2834
|
+
var init_global = __esm({
|
|
2835
|
+
"src/global.mts"() {
|
|
2836
|
+
"use strict";
|
|
2837
|
+
Global = class _Global {
|
|
2838
|
+
static {
|
|
2839
|
+
__name(this, "Global");
|
|
2840
|
+
}
|
|
2841
|
+
static _vars = {};
|
|
2842
|
+
static set(key, value) {
|
|
2843
|
+
this._vars[_Global.generateInternalKey(key)] = value;
|
|
2844
|
+
}
|
|
2845
|
+
static get(key) {
|
|
2846
|
+
return this._vars[_Global.generateInternalKey(key)];
|
|
2847
|
+
}
|
|
2848
|
+
static getOrThrow(key) {
|
|
2849
|
+
const rc = this.get(key);
|
|
2850
|
+
if (rc === void 0) {
|
|
2851
|
+
throw new Error(
|
|
2852
|
+
`Key ${_Global.generateInternalKey(key)} not found in Global`
|
|
2853
|
+
);
|
|
2854
|
+
}
|
|
2855
|
+
return rc;
|
|
2856
|
+
}
|
|
2857
|
+
static generateInternalKey(key) {
|
|
2858
|
+
let new_key = "";
|
|
2859
|
+
if (Array.isArray(key)) {
|
|
2860
|
+
new_key = key.join(".");
|
|
2861
|
+
} else {
|
|
2862
|
+
new_key = key;
|
|
2863
|
+
}
|
|
2864
|
+
return new_key;
|
|
2865
|
+
}
|
|
2866
|
+
static has(key) {
|
|
2867
|
+
return _Global.generateInternalKey(key) in _Global._vars;
|
|
2868
|
+
}
|
|
2869
|
+
static delete(key) {
|
|
2870
|
+
delete _Global._vars[_Global.generateInternalKey(key)];
|
|
2871
|
+
}
|
|
2872
|
+
static keys() {
|
|
2873
|
+
return Object.keys(_Global._vars);
|
|
2874
|
+
}
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
});
|
|
2878
|
+
|
|
2832
2879
|
// src/DatabaseServiceProvider.mts
|
|
2833
2880
|
var DatabaseServiceProvider_exports = {};
|
|
2834
2881
|
__export(DatabaseServiceProvider_exports, {
|
|
@@ -2843,6 +2890,7 @@ var init_DatabaseServiceProvider = __esm({
|
|
|
2843
2890
|
import_neko_orm = require("@devbro/neko-orm");
|
|
2844
2891
|
import_neko_context6 = require("@devbro/neko-context");
|
|
2845
2892
|
import_neko_config9 = require("@devbro/neko-config");
|
|
2893
|
+
init_global();
|
|
2846
2894
|
DatabaseServiceProvider = class _DatabaseServiceProvider extends Middleware {
|
|
2847
2895
|
static {
|
|
2848
2896
|
__name(this, "DatabaseServiceProvider");
|
|
@@ -2856,9 +2904,23 @@ var init_DatabaseServiceProvider = __esm({
|
|
|
2856
2904
|
(0, import_neko_context6.ctx)().set(["database", name], conn);
|
|
2857
2905
|
conns.push(conn);
|
|
2858
2906
|
}
|
|
2859
|
-
import_neko_orm.BaseModel.setConnection(
|
|
2860
|
-
|
|
2861
|
-
|
|
2907
|
+
import_neko_orm.BaseModel.setConnection(async () => {
|
|
2908
|
+
const key = ["database", "default"];
|
|
2909
|
+
let rc = (0, import_neko_context6.ctx)().get(key);
|
|
2910
|
+
if ((0, import_neko_context6.ctx)().has(key)) {
|
|
2911
|
+
rc = (0, import_neko_context6.ctx)().get(key);
|
|
2912
|
+
} else if (Global.has(key)) {
|
|
2913
|
+
rc = Global.get(key);
|
|
2914
|
+
} else {
|
|
2915
|
+
rc = await this.getConnection(db_configs["default"]);
|
|
2916
|
+
try {
|
|
2917
|
+
(0, import_neko_context6.ctx)().set(key, rc);
|
|
2918
|
+
} catch {
|
|
2919
|
+
Global.set(key, rc);
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
return rc;
|
|
2923
|
+
});
|
|
2862
2924
|
await next();
|
|
2863
2925
|
} finally {
|
|
2864
2926
|
for (const conn of conns) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare class Global {
|
|
2
|
+
static _vars: Record<string, any>;
|
|
3
|
+
static set(key: string | string[], value: any): void;
|
|
4
|
+
static get<T>(key: string | string[]): T | undefined;
|
|
5
|
+
static getOrThrow<T>(key: string | string[]): T;
|
|
6
|
+
static generateInternalKey(key: string | string[]): string;
|
|
7
|
+
static has(key: string | string[]): boolean;
|
|
8
|
+
static delete(key: string | string[]): void;
|
|
9
|
+
static keys(): string[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { Global };
|
package/dist/global.mjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class Global {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "Global");
|
|
6
|
+
}
|
|
7
|
+
static _vars = {};
|
|
8
|
+
static set(key, value) {
|
|
9
|
+
this._vars[Global.generateInternalKey(key)] = value;
|
|
10
|
+
}
|
|
11
|
+
static get(key) {
|
|
12
|
+
return this._vars[Global.generateInternalKey(key)];
|
|
13
|
+
}
|
|
14
|
+
static getOrThrow(key) {
|
|
15
|
+
const rc = this.get(key);
|
|
16
|
+
if (rc === void 0) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
`Key ${Global.generateInternalKey(key)} not found in Global`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
return rc;
|
|
22
|
+
}
|
|
23
|
+
static generateInternalKey(key) {
|
|
24
|
+
let new_key = "";
|
|
25
|
+
if (Array.isArray(key)) {
|
|
26
|
+
new_key = key.join(".");
|
|
27
|
+
} else {
|
|
28
|
+
new_key = key;
|
|
29
|
+
}
|
|
30
|
+
return new_key;
|
|
31
|
+
}
|
|
32
|
+
static has(key) {
|
|
33
|
+
return Global.generateInternalKey(key) in Global._vars;
|
|
34
|
+
}
|
|
35
|
+
static delete(key) {
|
|
36
|
+
delete Global._vars[Global.generateInternalKey(key)];
|
|
37
|
+
}
|
|
38
|
+
static keys() {
|
|
39
|
+
return Object.keys(Global._vars);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
Global
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=global.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/global.mts"],"sourcesContent":["export class Global {\n static _vars: Record<string, any> = {};\n\n static set(key: string | string[], value: any) {\n this._vars[Global.generateInternalKey(key)] = value;\n }\n\n static get<T>(key: string | string[]): T | undefined {\n return this._vars[Global.generateInternalKey(key)] as T;\n }\n\n static getOrThrow<T>(key: string | string[]): T {\n const rc = this.get<T>(key);\n if (rc === undefined) {\n throw new Error(\n `Key ${Global.generateInternalKey(key)} not found in Global`,\n );\n }\n return rc;\n }\n\n static generateInternalKey(key: string | string[]) {\n let new_key = \"\";\n if (Array.isArray(key)) {\n new_key = key.join(\".\");\n } else {\n new_key = key;\n }\n return new_key;\n }\n\n static has(key: string | string[]): boolean {\n return Global.generateInternalKey(key) in Global._vars;\n }\n static delete(key: string | string[]) {\n delete Global._vars[Global.generateInternalKey(key)];\n }\n\n static keys() {\n return Object.keys(Global._vars);\n }\n}\n"],"mappings":";;AAAO,MAAM,OAAO;AAAA,EAApB,OAAoB;AAAA;AAAA;AAAA,EAClB,OAAO,QAA6B,CAAC;AAAA,EAErC,OAAO,IAAI,KAAwB,OAAY;AAC7C,SAAK,MAAM,OAAO,oBAAoB,GAAG,CAAC,IAAI;AAAA,EAChD;AAAA,EAEA,OAAO,IAAO,KAAuC;AACnD,WAAO,KAAK,MAAM,OAAO,oBAAoB,GAAG,CAAC;AAAA,EACnD;AAAA,EAEA,OAAO,WAAc,KAA2B;AAC9C,UAAM,KAAK,KAAK,IAAO,GAAG;AAC1B,QAAI,OAAO,QAAW;AACpB,YAAM,IAAI;AAAA,QACR,OAAO,OAAO,oBAAoB,GAAG,CAAC;AAAA,MACxC;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEA,OAAO,oBAAoB,KAAwB;AACjD,QAAI,UAAU;AACd,QAAI,MAAM,QAAQ,GAAG,GAAG;AACtB,gBAAU,IAAI,KAAK,GAAG;AAAA,IACxB,OAAO;AACL,gBAAU;AAAA,IACZ;AACA,WAAO;AAAA,EACT;AAAA,EAEA,OAAO,IAAI,KAAiC;AAC1C,WAAO,OAAO,oBAAoB,GAAG,KAAK,OAAO;AAAA,EACnD;AAAA,EACA,OAAO,OAAO,KAAwB;AACpC,WAAO,OAAO,MAAM,OAAO,oBAAoB,GAAG,CAAC;AAAA,EACrD;AAAA,EAEA,OAAO,OAAO;AACZ,WAAO,OAAO,KAAK,OAAO,KAAK;AAAA,EACjC;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devbro/pashmak",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"description": "testing application for the entire repo",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -57,6 +57,11 @@
|
|
|
57
57
|
"import": "./dist/factories.mjs",
|
|
58
58
|
"require": "./dist/factories.js"
|
|
59
59
|
},
|
|
60
|
+
"./global": {
|
|
61
|
+
"types": "./dist/global.d.ts",
|
|
62
|
+
"import": "./dist/global.mjs",
|
|
63
|
+
"require": "./dist/global.js"
|
|
64
|
+
},
|
|
60
65
|
"./helper": {
|
|
61
66
|
"types": "./dist/helper.d.ts",
|
|
62
67
|
"import": "./dist/helper.mjs",
|