@studyportals/campaign-management-api-interface 0.16.1 → 0.16.2-4
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/index.d.ts +2 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +3 -2
- package/src/domain/organisations/minimal-organisations-studies-count.dto.d.ts +6 -0
- package/src/domain/organisations/minimal-organisations-studies-count.dto.js +12 -0
- package/src/domain/organisations/minimal-organisations-studies-count.dto.js.map +1 -0
- package/src/organisations-campaign-management-api.client.d.ts +9 -0
- package/src/organisations-campaign-management-api.client.js +45 -0
- package/src/organisations-campaign-management-api.client.js.map +1 -0
package/index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ import { NumberMap, Pricing, ICampaignAuditorData } from "./src/domain/auditor/c
|
|
|
8
8
|
import { PrivateCampaignManagementAPIClient } from "./src/private-campaign-management-api.client";
|
|
9
9
|
import { UserCampaignManagementAPIClient } from "./src/user-campaign-management-api.client";
|
|
10
10
|
import { StudyCampaignManagementAPIClient } from "./src/study-campaign-management-api.client";
|
|
11
|
-
|
|
11
|
+
import { MinimalOrganisationStudiesCountDto } from "./src/domain/organisations/minimal-organisations-studies-count.dto";
|
|
12
|
+
export { AuditorCampaignManagementAPIClient, CampaignManagementAPIClient, PrivateCampaignManagementAPIClient, UserCampaignManagementAPIClient, StudyCampaignManagementAPIClient, AuditorEntityType, AuditorOperation, GetAuditorDto, CampaignsEntitiesConfigDto, MinimalOrganisationStudiesCountDto, NumberMap, Pricing, ICampaignAuditorData };
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Pricing = exports.CampaignsEntitiesConfigDto = exports.GetAuditorDto = exports.AuditorOperation = exports.AuditorEntityType = exports.StudyCampaignManagementAPIClient = exports.UserCampaignManagementAPIClient = exports.PrivateCampaignManagementAPIClient = exports.CampaignManagementAPIClient = exports.AuditorCampaignManagementAPIClient = void 0;
|
|
3
|
+
exports.Pricing = exports.MinimalOrganisationStudiesCountDto = exports.CampaignsEntitiesConfigDto = exports.GetAuditorDto = exports.AuditorOperation = exports.AuditorEntityType = exports.StudyCampaignManagementAPIClient = exports.UserCampaignManagementAPIClient = exports.PrivateCampaignManagementAPIClient = exports.CampaignManagementAPIClient = exports.AuditorCampaignManagementAPIClient = void 0;
|
|
4
4
|
const auditor_campaign_management_api_client_1 = require("./src/auditor-campaign-management-api.client");
|
|
5
5
|
Object.defineProperty(exports, "AuditorCampaignManagementAPIClient", { enumerable: true, get: function () { return auditor_campaign_management_api_client_1.AuditorCampaignManagementAPIClient; } });
|
|
6
6
|
const campaign_management_api_client_1 = require("./src/campaign-management-api.client");
|
|
@@ -21,4 +21,6 @@ const user_campaign_management_api_client_1 = require("./src/user-campaign-manag
|
|
|
21
21
|
Object.defineProperty(exports, "UserCampaignManagementAPIClient", { enumerable: true, get: function () { return user_campaign_management_api_client_1.UserCampaignManagementAPIClient; } });
|
|
22
22
|
const study_campaign_management_api_client_1 = require("./src/study-campaign-management-api.client");
|
|
23
23
|
Object.defineProperty(exports, "StudyCampaignManagementAPIClient", { enumerable: true, get: function () { return study_campaign_management_api_client_1.StudyCampaignManagementAPIClient; } });
|
|
24
|
+
const minimal_organisations_studies_count_dto_1 = require("./src/domain/organisations/minimal-organisations-studies-count.dto");
|
|
25
|
+
Object.defineProperty(exports, "MinimalOrganisationStudiesCountDto", { enumerable: true, get: function () { return minimal_organisations_studies_count_dto_1.MinimalOrganisationStudiesCountDto; } });
|
|
24
26
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,yGAAkG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,yGAAkG;AAc9F,mHAdK,2EAAkC,OAcL;AAbtC,yFAAmF;AAc/E,4GAdK,4DAA2B,OAcL;AAb/B,kGAAwF;AAmBpF,kGAnBK,4CAAiB,OAmBL;AAlBrB,8FAAqF;AAmBjF,iGAnBK,yCAAgB,OAmBL;AAlBpB,0EAAqE;AAqBjE,8FArBK,+BAAa,OAqBL;AApBjB,mGAA+F;AAuB3F,2GAvBK,wDAA0B,OAuBL;AAtB9B,gGAAgH;AA4B5G,wFA5BgB,+BAAO,OA4BhB;AA3BX,yGAAkG;AAS9F,mHATK,2EAAkC,OASL;AARtC,mGAA4F;AASxF,gHATK,qEAA+B,OASL;AARnC,qGAA8F;AAS1F,iHATK,uEAAgC,OASL;AARpC,gIAAwH;AAqBpH,mHArBK,4EAAkC,OAqBL"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studyportals/campaign-management-api-interface",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2-4",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"compile": "rm -fR bin && npx tsc",
|
|
6
|
-
"test-u": "jest -c jest.config.unit.json --
|
|
6
|
+
"test-u": "jest -c jest.config.unit.json --maxWorkers=1",
|
|
7
7
|
"test-i": "nyc mocha src tests-i",
|
|
8
8
|
"prepare-deployment": "npm run test-u && npm run compile && cp package.json bin/package.json && rm -fR bin/tests-u",
|
|
9
9
|
"deploy": "npm run prepare-deployment && npm publish ./bin --access=public",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"eslint": "^8.33.0",
|
|
23
23
|
"jest": "^29.4.2",
|
|
24
24
|
"jest-mock-extended": "^3.0.1",
|
|
25
|
+
"superagent": "^8.1.2",
|
|
25
26
|
"superagent-mocker": "^0.5.2",
|
|
26
27
|
"ts-jest": "^29.0.5",
|
|
27
28
|
"ts-node": "^10.2.1"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MinimalOrganisationStudiesCountDto = void 0;
|
|
4
|
+
class MinimalOrganisationStudiesCountDto {
|
|
5
|
+
constructor(id, name, totalStudies) {
|
|
6
|
+
this.id = id;
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.totalStudies = totalStudies;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.MinimalOrganisationStudiesCountDto = MinimalOrganisationStudiesCountDto;
|
|
12
|
+
//# sourceMappingURL=minimal-organisations-studies-count.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minimal-organisations-studies-count.dto.js","sourceRoot":"","sources":["../../../../src/domain/organisations/minimal-organisations-studies-count.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,kCAAkC;IAC3C,YACoB,EAAU,EACV,IAAY,EACZ,YAAoB;QAFpB,OAAE,GAAF,EAAE,CAAQ;QACV,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAQ;IACrC,CAAC;CACP;AAND,gFAMC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { MinimalOrganisationStudiesCountDto } from "./domain/organisations/minimal-organisations-studies-count.dto";
|
|
3
|
+
export declare class OrganisationsCampaignManagementAPIClient {
|
|
4
|
+
private readonly baseUrl;
|
|
5
|
+
constructor(baseUrl: string);
|
|
6
|
+
getMinimalOrganisationsIncludingChildrenStudiesCount(organisationID: number, jwt?: string): Promise<MinimalOrganisationStudiesCountDto>;
|
|
7
|
+
private getRequest;
|
|
8
|
+
private buildBaseUrl;
|
|
9
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OrganisationsCampaignManagementAPIClient = void 0;
|
|
13
|
+
require("reflect-metadata");
|
|
14
|
+
const inversify_1 = require("inversify");
|
|
15
|
+
const superagent = require("superagent");
|
|
16
|
+
let OrganisationsCampaignManagementAPIClient = class OrganisationsCampaignManagementAPIClient {
|
|
17
|
+
constructor(baseUrl) {
|
|
18
|
+
this.baseUrl = baseUrl;
|
|
19
|
+
}
|
|
20
|
+
async getMinimalOrganisationsIncludingChildrenStudiesCount(organisationID, jwt = "") {
|
|
21
|
+
try {
|
|
22
|
+
const path = `organisations/minimal-including-children-studies-count/${organisationID}`;
|
|
23
|
+
const result = await this.getRequest(path, jwt);
|
|
24
|
+
return result.body;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw new Error(`getMinimalOrganisationsIncludingChildrenStudiesCount error: ${error}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async getRequest(relative = "", jwt = "") {
|
|
31
|
+
return await superagent.get(this.buildBaseUrl(relative))
|
|
32
|
+
.set("Content-Type", "application/json")
|
|
33
|
+
.set("Authorization", jwt)
|
|
34
|
+
.send();
|
|
35
|
+
}
|
|
36
|
+
buildBaseUrl(relative) {
|
|
37
|
+
return `${this.baseUrl}/${relative}`;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
OrganisationsCampaignManagementAPIClient = __decorate([
|
|
41
|
+
(0, inversify_1.injectable)(),
|
|
42
|
+
__metadata("design:paramtypes", [String])
|
|
43
|
+
], OrganisationsCampaignManagementAPIClient);
|
|
44
|
+
exports.OrganisationsCampaignManagementAPIClient = OrganisationsCampaignManagementAPIClient;
|
|
45
|
+
//# sourceMappingURL=organisations-campaign-management-api.client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organisations-campaign-management-api.client.js","sourceRoot":"","sources":["../../src/organisations-campaign-management-api.client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAA0B;AAG1B,yCAAuC;AAEvC,yCAAyC;AAIlC,IAAM,wCAAwC,GAA9C,MAAM,wCAAwC;IACpD,YACkB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAC7B,CAAC;IAEE,KAAK,CAAC,oDAAoD,CAAC,cAAsB,EAAE,GAAG,GAAG,EAAE;QACjG,IAAI;YACH,MAAM,IAAI,GAAG,0DAA0D,cAAc,EAAE,CAAC;YACxF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAEhD,OAAO,MAAM,CAAC,IAA0C,CAAC;SACzD;QAAC,OAAO,KAAK,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,+DAA+D,KAAK,EAAE,CAAC,CAAC;SACxF;IACF,CAAC;IAGO,KAAK,CAAC,UAAU,CAAC,WAAmB,EAAE,EAAE,GAAG,GAAG,EAAE;QACvD,OAAO,MAAM,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;aACtD,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC;aACvC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC;aACzB,IAAI,EAAE,CAAC;IACV,CAAC;IAGO,YAAY,CAAC,QAAgB;QACpC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,QAAQ,EAAE,CAAC;IACtC,CAAC;CACD,CAAA;AA5BY,wCAAwC;IADpD,IAAA,sBAAU,GAAE;;GACA,wCAAwC,CA4BpD;AA5BY,4FAAwC"}
|