@proteinjs/db-settings 1.0.17 → 1.0.18
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.md +12 -0
- package/LICENSE +21 -0
- package/dist/generated/index.d.ts +1 -0
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +2 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/src/Settings.d.ts.map +1 -1
- package/dist/src/Settings.js +3 -3
- package/dist/src/Settings.js.map +1 -1
- package/dist/src/tables/SettingTable.d.ts +4 -2
- package/dist/src/tables/SettingTable.d.ts.map +1 -1
- package/dist/src/tables/SettingTable.js +2 -1
- package/dist/src/tables/SettingTable.js.map +1 -1
- package/generated/index.ts +6 -8
- package/package.json +6 -4
- package/src/Settings.ts +3 -3
- package/src/tables/SettingTable.ts +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.18](https://github.com/brentbahry/db/compare/@proteinjs/db-settings@1.0.17...@proteinjs/db-settings@1.0.18) (2024-05-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update settings table to be a scoped table ([db57b82](https://github.com/brentbahry/db/commit/db57b82dafe32b1111592837696216c9bb45b4fc))
|
|
12
|
+
* update version of proteinjs/user ([1146e5e](https://github.com/brentbahry/db/commit/1146e5edb0eca8d53780fd02c2d13e8ff681c9e5))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
## [1.0.15](https://github.com/brentbahry/db/compare/@proteinjs/db-settings@1.0.14...@proteinjs/db-settings@1.0.15) (2024-05-10)
|
|
7
19
|
|
|
8
20
|
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Brent Bahry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,eAAe,CAAC;AACvB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,iBAAiB,CAAC;AACzB,OAAO,QAAQ,CAAC;AAyBhB,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,eAAe,CAAC;AACvB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,QAAQ,CAAC;AAyBhB,cAAc,UAAU,CAAC"}
|
package/dist/generated/index.js
CHANGED
|
@@ -18,10 +18,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
require("@proteinjs/db");
|
|
19
19
|
require("@proteinjs/reflection");
|
|
20
20
|
require("@proteinjs/service");
|
|
21
|
+
require("@proteinjs/user");
|
|
21
22
|
require("@proteinjs/util");
|
|
22
23
|
require("moment");
|
|
23
24
|
/** Generate Source Graph */
|
|
24
|
-
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-settings/Settings\",\"value\":{\"packageName\":\"@proteinjs/db-settings\",\"name\":\"Settings\",\"filePath\":\"/
|
|
25
|
+
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-settings/Settings\",\"value\":{\"packageName\":\"@proteinjs/db-settings\",\"name\":\"Settings\",\"filePath\":\"/home/runner/work/db/db/packages/settings/src/Settings.ts\",\"qualifiedName\":\"@proteinjs/db-settings/Settings\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"serviceMetadata\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"get\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultValue\",\"type\":{\"packageName\":\"\",\"name\":\"T\",\"filePath\":null,\"qualifiedName\":\"/T\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"set\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"value\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db-settings\",\"name\":\"SettingsService\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-settings/SettingsService\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db-settings/SettingsService\",\"value\":{\"packageName\":\"@proteinjs/db-settings\",\"name\":\"SettingsService\",\"filePath\":\"/home/runner/work/db/db/packages/settings/src/services/SettingsService.ts\",\"qualifiedName\":\"@proteinjs/db-settings/SettingsService\",\"properties\":[],\"methods\":[{\"name\":\"get\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<T>\",\"filePath\":null,\"qualifiedName\":\"/Promise<T>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultValue\",\"type\":{\"packageName\":\"\",\"name\":\"T\",\"filePath\":null,\"qualifiedName\":\"/T\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"set\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"value\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/service/Service\"},{\"v\":\"@proteinjs/db-settings/Setting\",\"value\":{\"packageName\":\"@proteinjs/db-settings\",\"name\":\"Setting\",\"filePath\":\"/home/runner/work/db/db/packages/settings/src/tables/SettingTable.ts\",\"qualifiedName\":\"@proteinjs/db-settings/Setting\",\"properties\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"value\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/user\",\"name\":\"ScopedRecord\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/ScopedRecord\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/user/ScopedRecord\"},{\"v\":\"@proteinjs/db-settings/SettingTable\",\"value\":{\"packageName\":\"@proteinjs/db-settings\",\"name\":\"SettingTable\",\"filePath\":\"/home/runner/work/db/db/packages/settings/src/tables/SettingTable.ts\",\"qualifiedName\":\"@proteinjs/db-settings/SettingTable\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"name\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"\",\"name\":\"Table<Setting>['auth']\",\"filePath\":null,\"qualifiedName\":\"/Table<Setting>['auth']\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"columns\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Table\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Table\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"@proteinjs/db-settings/Setting\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/db/Table\"}],\"edges\":[{\"v\":\"@proteinjs/db-settings/Settings\",\"w\":\"@proteinjs/db-settings/SettingsService\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-settings/SettingsService\",\"w\":\"@proteinjs/service/Service\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/db-settings/Setting\",\"w\":\"@proteinjs/user/ScopedRecord\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/db-settings/SettingTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"}]}";
|
|
25
26
|
/** Generate Source Links */
|
|
26
27
|
var Settings_1 = require("../src/Settings");
|
|
27
28
|
var SettingTable_1 = require("../src/tables/SettingTable");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,iCAA+B;AAC/B,8BAA4B;AAC5B,2BAAyB;AACzB,kBAAgB;AAGhB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,iCAA+B;AAC/B,8BAA4B;AAC5B,2BAAyB;AACzB,2BAAyB;AACzB,kBAAgB;AAGhB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,wqNAAwqN,CAAC;AAG7rN,4BAA4B;AAE5B,4CAA2C;AAC3C,2DAA0D;AAE1D,IAAM,WAAW,GAAG;IACnB,iCAAiC,EAAE,mBAAQ;IAC3C,qCAAqC,EAAE,2BAAY;CACnD,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/Settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/Settings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAsB,MAAM,4BAA4B,CAAC;AAIjF,eAAO,MAAM,WAAW,gBAA4F,CAAC;AAErH,qBAAa,QAAS,YAAW,eAAe;IAC9C,OAAO,CAAC,MAAM,CAAqC;IAC5C,eAAe;;;;MAIpB;IAEI,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC;IAUrC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;CAQnC"}
|
package/dist/src/Settings.js
CHANGED
|
@@ -37,10 +37,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.Settings = exports.getSettings = void 0;
|
|
40
|
-
var db_1 = require("@proteinjs/db");
|
|
41
40
|
var util_1 = require("@proteinjs/util");
|
|
42
41
|
var SettingsService_1 = require("./services/SettingsService");
|
|
43
42
|
var tables_1 = require("./tables/tables");
|
|
43
|
+
var user_1 = require("@proteinjs/user");
|
|
44
44
|
var getSettings = function () { return (typeof self === 'undefined' ? new Settings() : (0, SettingsService_1.getSettingsService)()); };
|
|
45
45
|
exports.getSettings = getSettings;
|
|
46
46
|
var Settings = /** @class */ (function () {
|
|
@@ -58,7 +58,7 @@ var Settings = /** @class */ (function () {
|
|
|
58
58
|
return __generator(this, function (_a) {
|
|
59
59
|
switch (_a.label) {
|
|
60
60
|
case 0:
|
|
61
|
-
db = (0,
|
|
61
|
+
db = (0, user_1.getScopedDb)();
|
|
62
62
|
return [4 /*yield*/, db.get(tables_1.tables.Setting, { name: name })];
|
|
63
63
|
case 1:
|
|
64
64
|
setting = _a.sent();
|
|
@@ -76,7 +76,7 @@ var Settings = /** @class */ (function () {
|
|
|
76
76
|
return __generator(this, function (_a) {
|
|
77
77
|
switch (_a.label) {
|
|
78
78
|
case 0:
|
|
79
|
-
db = (0,
|
|
79
|
+
db = (0, user_1.getScopedDb)();
|
|
80
80
|
return [4 /*yield*/, db.update(tables_1.tables.Setting, { value: value }, { name: name })];
|
|
81
81
|
case 1:
|
|
82
82
|
rowsUpdated = _a.sent();
|
package/dist/src/Settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","sourceRoot":"","sources":["../../src/Settings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"Settings.js","sourceRoot":"","sources":["../../src/Settings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAyC;AACzC,8DAAiF;AACjF,0CAAyC;AACzC,wCAA8C;AAEvC,IAAM,WAAW,GAAG,cAAM,OAAA,CAAC,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAE,IAAA,oCAAkB,GAAe,CAAC,EAAnF,CAAmF,CAAC;AAAxG,QAAA,WAAW,eAA6F;AAErH;IAAA;QACU,WAAM,GAAG,IAAI,aAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC5C,oBAAe,GAAG;YACvB,IAAI,EAAE;gBACJ,QAAQ,EAAE,IAAI;aACf;SACF,CAAC;IAoBJ,CAAC;IAlBO,sBAAG,GAAT,UAAa,IAAY,EAAE,YAAgB;;;;;;wBACnC,EAAE,GAAG,IAAA,kBAAW,GAAE,CAAC;wBACT,qBAAM,EAAE,CAAC,GAAG,CAAC,eAAM,CAAC,OAAO,EAAE,EAAE,IAAI,MAAA,EAAE,CAAC,EAAA;;wBAAhD,OAAO,GAAG,SAAsC;wBACtD,IAAI,CAAC,OAAO,EAAE;4BACZ,sBAAO,YAAY,EAAC;yBACrB;wBAED,sBAAO,OAAO,CAAC,KAAK,EAAC;;;;KACtB;IAEK,sBAAG,GAAT,UAAU,IAAY,EAAE,KAAU;;;;;;wBAC1B,EAAE,GAAG,IAAA,kBAAW,GAAE,CAAC;wBACL,qBAAM,EAAE,CAAC,MAAM,CAAC,eAAM,CAAC,OAAO,EAAE,EAAE,KAAK,OAAA,EAAE,EAAE,EAAE,IAAI,MAAA,EAAE,CAAC,EAAA;;wBAAlE,WAAW,GAAG,SAAoD;6BACpE,CAAA,WAAW,IAAI,CAAC,CAAA,EAAhB,wBAAgB;wBAClB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAyB,IAAI,CAAE,CAAC,CAAC;wBAClD,qBAAM,EAAE,CAAC,MAAM,CAAC,eAAM,CAAC,OAAO,EAAE,EAAE,IAAI,MAAA,EAAE,KAAK,OAAA,EAAE,CAAC,EAAA;;wBAAhD,SAAgD,CAAC;;;;;;KAEpD;IACH,eAAC;AAAD,CAAC,AA1BD,IA0BC;AA1BY,4BAAQ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Table
|
|
2
|
-
|
|
1
|
+
import { Table } from '@proteinjs/db';
|
|
2
|
+
import { ScopedRecord } from '@proteinjs/user';
|
|
3
|
+
export interface Setting extends ScopedRecord {
|
|
3
4
|
name: string;
|
|
4
5
|
value: any;
|
|
5
6
|
}
|
|
@@ -7,6 +8,7 @@ export declare class SettingTable extends Table<Setting> {
|
|
|
7
8
|
name: string;
|
|
8
9
|
auth: Table<Setting>['auth'];
|
|
9
10
|
columns: {
|
|
11
|
+
scope: import("@proteinjs/db").Column<string, any>;
|
|
10
12
|
id: import("@proteinjs/db").Column<string, any>;
|
|
11
13
|
created: import("@proteinjs/db").Column<import("moment").Moment, any>;
|
|
12
14
|
updated: import("@proteinjs/db").Column<import("moment").Moment, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingTable.d.ts","sourceRoot":"","sources":["../../../src/tables/SettingTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"SettingTable.d.ts","sourceRoot":"","sources":["../../../src/tables/SettingTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA8B,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,YAAY,EAA2B,MAAM,iBAAiB,CAAC;AAExE,MAAM,WAAW,OAAQ,SAAQ,YAAY;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;CACZ;AAED,qBAAa,YAAa,SAAQ,KAAK,CAAC,OAAO,CAAC;IACvC,IAAI,SAAa;IACjB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAOjC;IACK,OAAO;;;;;;;;;;MAGX;CACJ"}
|
|
@@ -17,6 +17,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.SettingTable = void 0;
|
|
19
19
|
var db_1 = require("@proteinjs/db");
|
|
20
|
+
var user_1 = require("@proteinjs/user");
|
|
20
21
|
var SettingTable = /** @class */ (function (_super) {
|
|
21
22
|
__extends(SettingTable, _super);
|
|
22
23
|
function SettingTable() {
|
|
@@ -30,7 +31,7 @@ var SettingTable = /** @class */ (function (_super) {
|
|
|
30
31
|
all: 'authenticated',
|
|
31
32
|
},
|
|
32
33
|
};
|
|
33
|
-
_this.columns = (0,
|
|
34
|
+
_this.columns = (0, user_1.withScopedRecordColumns)({
|
|
34
35
|
name: new db_1.StringColumn('name'),
|
|
35
36
|
value: new db_1.ObjectColumn('value'),
|
|
36
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingTable.js","sourceRoot":"","sources":["../../../src/tables/SettingTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"SettingTable.js","sourceRoot":"","sources":["../../../src/tables/SettingTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oCAAkE;AAClE,wCAAwE;AAOxE;IAAkC,gCAAc;IAAhD;QAAA,qEAcC;QAbQ,UAAI,GAAG,SAAS,CAAC;QACjB,UAAI,GAA2B;YACpC,EAAE,EAAE;gBACF,GAAG,EAAE,eAAe;aACrB;YACD,OAAO,EAAE;gBACP,GAAG,EAAE,eAAe;aACrB;SACF,CAAC;QACK,aAAO,GAAG,IAAA,8BAAuB,EAAU;YAChD,IAAI,EAAE,IAAI,iBAAY,CAAC,MAAM,CAAC;YAC9B,KAAK,EAAE,IAAI,iBAAY,CAAC,OAAO,CAAC;SACjC,CAAC,CAAC;;IACL,CAAC;IAAD,mBAAC;AAAD,CAAC,AAdD,CAAkC,UAAK,GActC;AAdY,oCAAY"}
|
package/generated/index.ts
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
import '@proteinjs/db';
|
|
4
4
|
import '@proteinjs/reflection';
|
|
5
5
|
import '@proteinjs/service';
|
|
6
|
+
import '@proteinjs/user';
|
|
6
7
|
import '@proteinjs/util';
|
|
7
8
|
import 'moment';
|
|
8
9
|
|
|
9
|
-
|
|
10
10
|
/** Generate Source Graph */
|
|
11
11
|
|
|
12
|
-
const sourceGraph =
|
|
13
|
-
|
|
12
|
+
const sourceGraph =
|
|
13
|
+
'{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"@proteinjs/db-settings/Settings","value":{"packageName":"@proteinjs/db-settings","name":"Settings","filePath":"/home/runner/work/db/db/packages/settings/src/Settings.ts","qualifiedName":"@proteinjs/db-settings/Settings","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"logger","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"serviceMetadata","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[{"name":"get","returnType":null,"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"name","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"defaultValue","type":{"packageName":"","name":"T","filePath":null,"qualifiedName":"/T","typeParameters":null,"directParents":null}}]},{"name":"set","returnType":null,"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"name","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"value","type":{"packageName":"","name":"any","filePath":null,"qualifiedName":"/any","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParentInterfaces":[{"packageName":"@proteinjs/db-settings","name":"SettingsService","filePath":null,"qualifiedName":"@proteinjs/db-settings/SettingsService","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"directParentClasses":[],"sourceType":2}},{"v":"@proteinjs/db-settings/SettingsService","value":{"packageName":"@proteinjs/db-settings","name":"SettingsService","filePath":"/home/runner/work/db/db/packages/settings/src/services/SettingsService.ts","qualifiedName":"@proteinjs/db-settings/SettingsService","properties":[],"methods":[{"name":"get","returnType":{"packageName":"","name":"Promise<T>","filePath":null,"qualifiedName":"/Promise<T>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"name","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"defaultValue","type":{"packageName":"","name":"T","filePath":null,"qualifiedName":"/T","typeParameters":null,"directParents":null}}]},{"name":"set","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"name","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"value","type":{"packageName":"","name":"any","filePath":null,"qualifiedName":"/any","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/service","name":"Service","filePath":null,"qualifiedName":"@proteinjs/service/Service","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/service/Service"},{"v":"@proteinjs/db-settings/Setting","value":{"packageName":"@proteinjs/db-settings","name":"Setting","filePath":"/home/runner/work/db/db/packages/settings/src/tables/SettingTable.ts","qualifiedName":"@proteinjs/db-settings/Setting","properties":[{"name":"name","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"value","type":{"packageName":"","name":"any","filePath":null,"qualifiedName":"/any","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/user","name":"ScopedRecord","filePath":null,"qualifiedName":"@proteinjs/user/ScopedRecord","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/user/ScopedRecord"},{"v":"@proteinjs/db-settings/SettingTable","value":{"packageName":"@proteinjs/db-settings","name":"SettingTable","filePath":"/home/runner/work/db/db/packages/settings/src/tables/SettingTable.ts","qualifiedName":"@proteinjs/db-settings/SettingTable","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"name","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"auth","type":{"packageName":"","name":"Table<Setting>[\'auth\']","filePath":null,"qualifiedName":"/Table<Setting>[\'auth\']","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"columns","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParentInterfaces":[],"directParentClasses":[{"packageName":"@proteinjs/db","name":"Table","filePath":null,"qualifiedName":"@proteinjs/db/Table","isAbstract":false,"isStatic":false,"visibility":"public","properties":[],"methods":[],"typeParameters":["@proteinjs/db-settings/Setting"],"directParentInterfaces":[],"directParentClasses":[]}],"sourceType":2}},{"v":"@proteinjs/db/Table"}],"edges":[{"v":"@proteinjs/db-settings/Settings","w":"@proteinjs/db-settings/SettingsService","value":"implements interface"},{"v":"@proteinjs/db-settings/SettingsService","w":"@proteinjs/service/Service","value":"extends interface"},{"v":"@proteinjs/db-settings/Setting","w":"@proteinjs/user/ScopedRecord","value":"extends interface"},{"v":"@proteinjs/db-settings/SettingTable","w":"@proteinjs/db/Table","value":"extends class"}]}';
|
|
14
14
|
|
|
15
15
|
/** Generate Source Links */
|
|
16
16
|
|
|
@@ -18,15 +18,13 @@ import { Settings } from '../src/Settings';
|
|
|
18
18
|
import { SettingTable } from '../src/tables/SettingTable';
|
|
19
19
|
|
|
20
20
|
const sourceLinks = {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
'@proteinjs/db-settings/Settings': Settings,
|
|
22
|
+
'@proteinjs/db-settings/SettingTable': SettingTable,
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
|
|
26
25
|
/** Load Source Graph and Links */
|
|
27
26
|
|
|
28
27
|
import { SourceRepository } from '@proteinjs/reflection';
|
|
29
28
|
SourceRepository.merge(sourceGraph, sourceLinks);
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
export * from '../index';
|
|
30
|
+
export * from '../index';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proteinjs/db-settings",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"description": "Db settings",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
"watch": "reflection-watch"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@proteinjs/db": "^1.0.
|
|
24
|
+
"@proteinjs/db": "^1.0.20",
|
|
25
25
|
"@proteinjs/reflection": "1.1.5",
|
|
26
26
|
"@proteinjs/service": "1.0.13",
|
|
27
|
+
"@proteinjs/user": "1.0.16",
|
|
27
28
|
"@proteinjs/util": "1.1.2",
|
|
28
29
|
"moment": "2.29.4"
|
|
29
30
|
},
|
|
@@ -41,5 +42,6 @@
|
|
|
41
42
|
"typescript": "5.2.2"
|
|
42
43
|
},
|
|
43
44
|
"main": "./dist/generated/index.js",
|
|
44
|
-
"types": "./dist/generated/index.d.ts"
|
|
45
|
-
|
|
45
|
+
"types": "./dist/generated/index.d.ts",
|
|
46
|
+
"gitHead": "b716a20a520493473f1666ac47535c7717a30913"
|
|
47
|
+
}
|
package/src/Settings.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getDb } from '@proteinjs/db';
|
|
2
1
|
import { Logger } from '@proteinjs/util';
|
|
3
2
|
import { SettingsService, getSettingsService } from './services/SettingsService';
|
|
4
3
|
import { tables } from './tables/tables';
|
|
4
|
+
import { getScopedDb } from '@proteinjs/user';
|
|
5
5
|
|
|
6
6
|
export const getSettings = () => (typeof self === 'undefined' ? new Settings() : (getSettingsService() as Settings));
|
|
7
7
|
|
|
@@ -14,7 +14,7 @@ export class Settings implements SettingsService {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
async get<T>(name: string, defaultValue?: T) {
|
|
17
|
-
const db =
|
|
17
|
+
const db = getScopedDb();
|
|
18
18
|
const setting = await db.get(tables.Setting, { name });
|
|
19
19
|
if (!setting) {
|
|
20
20
|
return defaultValue;
|
|
@@ -24,7 +24,7 @@ export class Settings implements SettingsService {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
async set(name: string, value: any) {
|
|
27
|
-
const db =
|
|
27
|
+
const db = getScopedDb();
|
|
28
28
|
const rowsUpdated = await db.update(tables.Setting, { value }, { name });
|
|
29
29
|
if (rowsUpdated == 0) {
|
|
30
30
|
this.logger.info(`Creating new setting: ${name}`);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Table, StringColumn,
|
|
1
|
+
import { Table, StringColumn, ObjectColumn } from '@proteinjs/db';
|
|
2
|
+
import { ScopedRecord, withScopedRecordColumns } from '@proteinjs/user';
|
|
2
3
|
|
|
3
|
-
export interface Setting extends
|
|
4
|
+
export interface Setting extends ScopedRecord {
|
|
4
5
|
name: string;
|
|
5
6
|
value: any;
|
|
6
7
|
}
|
|
@@ -15,7 +16,7 @@ export class SettingTable extends Table<Setting> {
|
|
|
15
16
|
all: 'authenticated',
|
|
16
17
|
},
|
|
17
18
|
};
|
|
18
|
-
public columns =
|
|
19
|
+
public columns = withScopedRecordColumns<Setting>({
|
|
19
20
|
name: new StringColumn('name'),
|
|
20
21
|
value: new ObjectColumn('value'),
|
|
21
22
|
});
|