exodus-framework 2.0.9971 → 2.0.9972

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.
@@ -4,6 +4,8 @@ declare class EcosystemService extends Service {
4
4
  getSystemVariable(tenantId: string, key: string): Promise<System>;
5
5
  setSystemVariable(tenantId: string, key: string, value: string): Promise<void>;
6
6
  createSystemVariable(tenantId: string, key: string, value: string): Promise<System>;
7
+ createDataSystemVariable(tenantId: string, key: string, data: any): Promise<System>;
8
+ setDataSystemVariable(tenantId: string, key: string, data: any): Promise<void>;
7
9
  }
8
10
  export default EcosystemService;
9
11
  //# sourceMappingURL=ecosystem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ecosystem.d.ts","sourceRoot":"","sources":["../../src/services/ecosystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,cAAM,gBAAiB,SAAQ,OAAO;IAC9B,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAI/C,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAS9D,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAOxE;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"ecosystem.d.ts","sourceRoot":"","sources":["../../src/services/ecosystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,cAAM,gBAAiB,SAAQ,OAAO;IAC9B,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAK/C,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAU9D,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAQjE,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;IAQjE,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;CASrE;AAED,eAAe,gBAAgB,CAAC"}
@@ -42,5 +42,30 @@ class EcosystemService extends _app.Service {
42
42
  value
43
43
  });
44
44
  }
45
+ async createDataSystemVariable(tenantId, key, data) {
46
+ const Entity = await _database.default.getService().getEntity(_System.System, tenantId);
47
+ const variable = await Entity.findOne({
48
+ where: {
49
+ key
50
+ }
51
+ });
52
+ if (variable) throw new Error('System variable has exists: ' + key);
53
+ return await Entity.create({
54
+ key,
55
+ data
56
+ });
57
+ }
58
+ async setDataSystemVariable(tenantId, key, data) {
59
+ const Entity = await _database.default.getService().getEntity(_System.System, tenantId);
60
+ const variable = await Entity.findOne({
61
+ where: {
62
+ key
63
+ }
64
+ });
65
+ if (!variable) throw new Error('System variable not found: ' + key);
66
+ variable.data = data;
67
+ variable.changed('data', true);
68
+ await variable.save();
69
+ }
45
70
  }
46
71
  var _default = exports.default = EcosystemService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exodus-framework",
3
- "version": "2.0.9971",
3
+ "version": "2.0.9972",
4
4
  "description": "Exodus Framework",
5
5
  "author": "jhownpaixao",
6
6
  "license": "ISC",