@nomalism-com/api 0.17.9 → 0.17.11

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.
@@ -2,11 +2,14 @@ import { SavedProviderProposal as Entity, shared } from '@nomalism-com/types';
2
2
  import { IModuleConstructor } from '../..';
3
3
  export import IEntity = Entity.Entity;
4
4
  export import ICreateRequest = Entity.ICreateRequest;
5
+ export import IUpdateRequest = Entity.IUpdateRequest;
5
6
  export default class Repository implements Entity.IRepository {
6
7
  route: string;
7
8
  publicRoute: string;
8
9
  private api;
9
10
  constructor({ api, route, publicRoute }: IModuleConstructor);
11
+ findByProviderId(selector: shared.IFindByIdRequest): Promise<Entity.IFindManyResponse[]>;
10
12
  create(body: ICreateRequest): Promise<IEntity>;
13
+ update(selector: shared.IFindByIdRequest, body: IUpdateRequest): Promise<IEntity>;
11
14
  deleteOne(selector: shared.IFindByIdRequest): Promise<IEntity | null>;
12
15
  }
@@ -43,6 +43,19 @@ var Repository = (function () {
43
43
  this.route = route;
44
44
  this.publicRoute = publicRoute;
45
45
  }
46
+ Repository.prototype.findByProviderId = function (selector) {
47
+ return __awaiter(this, void 0, void 0, function () {
48
+ var response;
49
+ return __generator(this, function (_a) {
50
+ switch (_a.label) {
51
+ case 0: return [4, this.api.get("".concat(this.route).concat(selector.id))];
52
+ case 1:
53
+ response = _a.sent();
54
+ return [2, response.data];
55
+ }
56
+ });
57
+ });
58
+ };
46
59
  Repository.prototype.create = function (body) {
47
60
  return __awaiter(this, void 0, void 0, function () {
48
61
  var response;
@@ -56,6 +69,19 @@ var Repository = (function () {
56
69
  });
57
70
  });
58
71
  };
72
+ Repository.prototype.update = function (selector, body) {
73
+ return __awaiter(this, void 0, void 0, function () {
74
+ var response;
75
+ return __generator(this, function (_a) {
76
+ switch (_a.label) {
77
+ case 0: return [4, this.api.post("".concat(this.route).concat(selector.id), body)];
78
+ case 1:
79
+ response = _a.sent();
80
+ return [2, response.data];
81
+ }
82
+ });
83
+ });
84
+ };
59
85
  Repository.prototype.deleteOne = function (selector) {
60
86
  return __awaiter(this, void 0, void 0, function () {
61
87
  var response;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "typescript",
10
10
  "helper"
11
11
  ],
12
- "version": "0.17.9",
12
+ "version": "0.17.11",
13
13
  "main": "dist/index.js",
14
14
  "types": "./dist/index.d.ts",
15
15
  "files": [
@@ -47,7 +47,7 @@
47
47
  "typescript": "^5.3.3"
48
48
  },
49
49
  "dependencies": {
50
- "@nomalism-com/types": "^0.17.25",
50
+ "@nomalism-com/types": "^0.17.31",
51
51
  "axios": "^0.27.2"
52
52
  }
53
53
  }