@proteinjs/db-settings 1.1.19 → 1.1.20
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 +11 -0
- package/LICENSE +21 -0
- package/dist/generated/index.d.ts +1 -1
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +2 -2
- 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/generated/index.ts +6 -9
- package/package.json +6 -5
- package/src/Settings.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.1.20](https://github.com/brentbahry/db/compare/@proteinjs/db-settings@1.1.19...@proteinjs/db-settings@1.1.20) (2024-08-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* refactored to implement new @proteinjs/logger/Logger api ([66578f2](https://github.com/brentbahry/db/commit/66578f267d9293c0d5703c63e53d8edf68325f52))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.1.18](https://github.com/brentbahry/db/compare/@proteinjs/db-settings@1.1.17...@proteinjs/db-settings@1.1.18) (2024-08-11)
|
|
7
18
|
|
|
8
19
|
|
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,9 +1,9 @@
|
|
|
1
1
|
/** Load Dependency Source Graphs */
|
|
2
2
|
import '@proteinjs/db';
|
|
3
|
+
import '@proteinjs/logger';
|
|
3
4
|
import '@proteinjs/reflection';
|
|
4
5
|
import '@proteinjs/service';
|
|
5
6
|
import '@proteinjs/user';
|
|
6
|
-
import '@proteinjs/util';
|
|
7
7
|
import 'moment';
|
|
8
8
|
export * from '../index';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,eAAe,CAAC;AACvB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,iBAAiB,CAAC;AACzB,OAAO,QAAQ,CAAC;AAyBhB,cAAc,UAAU,CAAC"}
|
package/dist/generated/index.js
CHANGED
|
@@ -16,13 +16,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
require("@proteinjs/db");
|
|
19
|
+
require("@proteinjs/logger");
|
|
19
20
|
require("@proteinjs/reflection");
|
|
20
21
|
require("@proteinjs/service");
|
|
21
22
|
require("@proteinjs/user");
|
|
22
|
-
require("@proteinjs/util");
|
|
23
23
|
require("moment");
|
|
24
24
|
/** Generate Source Graph */
|
|
25
|
-
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\"}]}";
|
|
26
26
|
/** Generate Source Links */
|
|
27
27
|
var Settings_1 = require("../src/Settings");
|
|
28
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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,6BAA2B;AAC3B,iCAA+B;AAC/B,8BAA4B;AAC5B,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":"AACA,OAAO,EAAE,eAAe,EAAsB,MAAM,4BAA4B,CAAC;AAIjF,eAAO,MAAM,WAAW,gBAA4F,CAAC;AAErH,qBAAa,QAAS,YAAW,eAAe;IAC9C,OAAO,CAAC,MAAM,
|
|
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,CAA+C;IACtD,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,7 +37,7 @@ 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
|
|
40
|
+
var logger_1 = require("@proteinjs/logger");
|
|
41
41
|
var SettingsService_1 = require("./services/SettingsService");
|
|
42
42
|
var tables_1 = require("./tables/tables");
|
|
43
43
|
var user_1 = require("@proteinjs/user");
|
|
@@ -45,7 +45,7 @@ var getSettings = function () { return (typeof self === 'undefined' ? new Settin
|
|
|
45
45
|
exports.getSettings = getSettings;
|
|
46
46
|
var Settings = /** @class */ (function () {
|
|
47
47
|
function Settings() {
|
|
48
|
-
this.logger = new
|
|
48
|
+
this.logger = new logger_1.Logger({ name: this.constructor.name });
|
|
49
49
|
this.serviceMetadata = {
|
|
50
50
|
auth: {
|
|
51
51
|
allUsers: true,
|
|
@@ -81,7 +81,7 @@ var Settings = /** @class */ (function () {
|
|
|
81
81
|
case 1:
|
|
82
82
|
rowsUpdated = _a.sent();
|
|
83
83
|
if (!(rowsUpdated == 0)) return [3 /*break*/, 3];
|
|
84
|
-
this.logger.info("Creating new setting:
|
|
84
|
+
this.logger.info({ message: "Creating new setting", obj: { name: name, value: value } });
|
|
85
85
|
return [4 /*yield*/, db.insert(tables_1.tables.Setting, { name: name, value: value })];
|
|
86
86
|
case 2:
|
|
87
87
|
_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,4CAA2C;AAC3C,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,eAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QACtD,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,EAAE,OAAO,EAAE,sBAAsB,EAAE,GAAG,EAAE,EAAE,IAAI,MAAA,EAAE,KAAK,OAAA,EAAE,EAAE,CAAC,CAAC;wBAC5E,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"}
|
package/generated/index.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/** Load Dependency Source Graphs */
|
|
2
2
|
|
|
3
3
|
import '@proteinjs/db';
|
|
4
|
+
import '@proteinjs/logger';
|
|
4
5
|
import '@proteinjs/reflection';
|
|
5
6
|
import '@proteinjs/service';
|
|
6
7
|
import '@proteinjs/user';
|
|
7
|
-
import '@proteinjs/util';
|
|
8
8
|
import 'moment';
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
/** Generate Source Graph */
|
|
12
11
|
|
|
13
|
-
const sourceGraph =
|
|
14
|
-
|
|
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"}]}';
|
|
15
14
|
|
|
16
15
|
/** Generate Source Links */
|
|
17
16
|
|
|
@@ -19,15 +18,13 @@ import { Settings } from '../src/Settings';
|
|
|
19
18
|
import { SettingTable } from '../src/tables/SettingTable';
|
|
20
19
|
|
|
21
20
|
const sourceLinks = {
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
'@proteinjs/db-settings/Settings': Settings,
|
|
22
|
+
'@proteinjs/db-settings/SettingTable': SettingTable,
|
|
24
23
|
};
|
|
25
24
|
|
|
26
|
-
|
|
27
25
|
/** Load Source Graph and Links */
|
|
28
26
|
|
|
29
27
|
import { SourceRepository } from '@proteinjs/reflection';
|
|
30
28
|
SourceRepository.merge(sourceGraph, sourceLinks);
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
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.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"description": "Db settings",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"watch": "reflection-watch"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@proteinjs/db": "^1.5.
|
|
24
|
+
"@proteinjs/db": "^1.5.7",
|
|
25
|
+
"@proteinjs/logger": "1.0.4",
|
|
25
26
|
"@proteinjs/reflection": "1.1.8",
|
|
26
27
|
"@proteinjs/service": "1.0.27",
|
|
27
28
|
"@proteinjs/user": "1.1.3",
|
|
28
|
-
"@proteinjs/util": "1.4.0",
|
|
29
29
|
"moment": "2.29.4"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -42,5 +42,6 @@
|
|
|
42
42
|
"typescript": "5.2.2"
|
|
43
43
|
},
|
|
44
44
|
"main": "./dist/generated/index.js",
|
|
45
|
-
"types": "./dist/generated/index.d.ts"
|
|
46
|
-
|
|
45
|
+
"types": "./dist/generated/index.d.ts",
|
|
46
|
+
"gitHead": "16c2c7eac3d6c1f01a5bca9b24c1e949e295757e"
|
|
47
|
+
}
|
package/src/Settings.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Logger } from '@proteinjs/
|
|
1
|
+
import { Logger } from '@proteinjs/logger';
|
|
2
2
|
import { SettingsService, getSettingsService } from './services/SettingsService';
|
|
3
3
|
import { tables } from './tables/tables';
|
|
4
4
|
import { getScopedDb } from '@proteinjs/user';
|
|
@@ -6,7 +6,7 @@ import { getScopedDb } from '@proteinjs/user';
|
|
|
6
6
|
export const getSettings = () => (typeof self === 'undefined' ? new Settings() : (getSettingsService() as Settings));
|
|
7
7
|
|
|
8
8
|
export class Settings implements SettingsService {
|
|
9
|
-
private logger = new Logger(this.constructor.name);
|
|
9
|
+
private logger = new Logger({ name: this.constructor.name });
|
|
10
10
|
public serviceMetadata = {
|
|
11
11
|
auth: {
|
|
12
12
|
allUsers: true,
|
|
@@ -27,7 +27,7 @@ export class Settings implements SettingsService {
|
|
|
27
27
|
const db = getScopedDb();
|
|
28
28
|
const rowsUpdated = await db.update(tables.Setting, { value }, { name });
|
|
29
29
|
if (rowsUpdated == 0) {
|
|
30
|
-
this.logger.info(`Creating new setting:
|
|
30
|
+
this.logger.info({ message: `Creating new setting`, obj: { name, value } });
|
|
31
31
|
await db.insert(tables.Setting, { name, value });
|
|
32
32
|
}
|
|
33
33
|
}
|