@bwi-mentorspaces/application-utils-npm 0.0.57 → 0.0.59
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/calendar/cronofy/cronofy.api.d.ts +48 -0
- package/calendar/cronofy/cronofy.api.js +119 -0
- package/calendar/cronofy/cronofy.api.js.map +1 -0
- package/calendar/cronofy/index.d.ts +2 -0
- package/calendar/cronofy/index.js +6 -0
- package/calendar/cronofy/index.js.map +1 -0
- package/calendar/cronofy/models/_/cronofy.config.d.ts +8 -0
- package/calendar/cronofy/models/_/cronofy.config.js +3 -0
- package/calendar/cronofy/models/_/cronofy.config.js.map +1 -0
- package/calendar/cronofy/models/_/cronofy.data.d.ts +70 -0
- package/calendar/cronofy/models/_/cronofy.data.js +3 -0
- package/calendar/cronofy/models/_/cronofy.data.js.map +1 -0
- package/calendar/cronofy/models/index.d.ts +3 -0
- package/calendar/cronofy/models/index.js +3 -0
- package/calendar/cronofy/models/index.js.map +1 -0
- package/calendar/enum/index.d.ts +6 -0
- package/calendar/enum/index.js +11 -0
- package/calendar/enum/index.js.map +1 -0
- package/calendar/index.d.ts +33 -0
- package/calendar/index.js +55 -0
- package/calendar/index.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ICronofyAccessToken, ICronofyApplicationCalendar, ICronofyConfig, ICronofyElementTokenParams, ICronofyElementTokenResponse } from "./models";
|
|
2
|
+
import { ICronofyAvailabilityRulesPostParams } from "./models/_/cronofy.data";
|
|
3
|
+
export declare class CronofyAPI {
|
|
4
|
+
private _cronofy;
|
|
5
|
+
constructor(config: ICronofyConfig);
|
|
6
|
+
/**
|
|
7
|
+
* Create a Cronofy application calendar.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} calendarId Id for the new Cronofy application calendar
|
|
10
|
+
* @returns {Promise<ICronofyApplicationCalendar>} Returns Cronofy application calendar data
|
|
11
|
+
*/
|
|
12
|
+
createApplicationCalendar(calendarId: string): Promise<ICronofyApplicationCalendar>;
|
|
13
|
+
/**
|
|
14
|
+
* Refresh a Cronofy account access token using a refresh token.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} refreshToken Cronofy refresh token
|
|
17
|
+
* @returns {Promise<ICronofyAccessToken>} Returns Cronofy access token data
|
|
18
|
+
*/
|
|
19
|
+
refreshAccessToken(refreshToken: string): Promise<ICronofyAccessToken>;
|
|
20
|
+
/**
|
|
21
|
+
* Request an access token from Cronofy with an authorization code.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} authCode Authorization code obtained from Cronofy
|
|
24
|
+
* @param {string} redirectUri Redirect URI used when obtaining the auth code
|
|
25
|
+
* @returns {Promise<ICronofyAccessToken>} Returns Cronofy access token data
|
|
26
|
+
*/
|
|
27
|
+
requestAccessToken(authCode: string, redirectUri: string): Promise<ICronofyAccessToken>;
|
|
28
|
+
/**
|
|
29
|
+
* Request an element token from Cronofy.
|
|
30
|
+
*
|
|
31
|
+
* @param {ICronofyElementTokenParams} params Parameters for the Cronofy request element token API
|
|
32
|
+
* @returns {Promise<ICronofyElementTokenResponse>} Returns Cronofy element token data
|
|
33
|
+
*/
|
|
34
|
+
requestElementToken(params: ICronofyElementTokenParams): Promise<ICronofyElementTokenResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Revokes authorization for a Cronofy linked calendar.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} token Access or refresh token associated with the account to revoke
|
|
39
|
+
*/
|
|
40
|
+
revokeAuthorization(token: string): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Create or update a Cronofy availability rule.
|
|
43
|
+
*
|
|
44
|
+
* @param {ICronofyAvailabilityRulesPostParams} params Parameters for the Cronofy availability rules POST API
|
|
45
|
+
* @returns {Promise<boolean>} Returns true if the request was successful
|
|
46
|
+
*/
|
|
47
|
+
upsertAvailabilityRule(accessToken: string, params: ICronofyAvailabilityRulesPostParams): Promise<any>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.CronofyAPI = void 0;
|
|
25
|
+
const cronofy_1 = __importDefault(require("cronofy"));
|
|
26
|
+
const tsyringe_1 = require("tsyringe");
|
|
27
|
+
let CronofyAPI = class CronofyAPI {
|
|
28
|
+
constructor(config) {
|
|
29
|
+
this._cronofy = new cronofy_1.default({
|
|
30
|
+
client_id: config.clientId,
|
|
31
|
+
client_secret: config.clientSecret,
|
|
32
|
+
data_center: config.dataCenter,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Create a Cronofy application calendar.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} calendarId Id for the new Cronofy application calendar
|
|
39
|
+
* @returns {Promise<ICronofyApplicationCalendar>} Returns Cronofy application calendar data
|
|
40
|
+
*/
|
|
41
|
+
createApplicationCalendar(calendarId) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const options = { application_calendar_id: calendarId };
|
|
44
|
+
const appCalendar = yield this._cronofy.applicationCalendar(options);
|
|
45
|
+
return appCalendar;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Refresh a Cronofy account access token using a refresh token.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} refreshToken Cronofy refresh token
|
|
52
|
+
* @returns {Promise<ICronofyAccessToken>} Returns Cronofy access token data
|
|
53
|
+
*/
|
|
54
|
+
refreshAccessToken(refreshToken) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const options = { refresh_token: refreshToken };
|
|
57
|
+
const accessToken = yield this._cronofy.refreshAccessToken(options);
|
|
58
|
+
return accessToken;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Request an access token from Cronofy with an authorization code.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} authCode Authorization code obtained from Cronofy
|
|
65
|
+
* @param {string} redirectUri Redirect URI used when obtaining the auth code
|
|
66
|
+
* @returns {Promise<ICronofyAccessToken>} Returns Cronofy access token data
|
|
67
|
+
*/
|
|
68
|
+
requestAccessToken(authCode, redirectUri) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const options = {
|
|
71
|
+
code: authCode,
|
|
72
|
+
redirect_uri: redirectUri,
|
|
73
|
+
};
|
|
74
|
+
const accessToken = yield this._cronofy.requestAccessToken(options);
|
|
75
|
+
return accessToken;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Request an element token from Cronofy.
|
|
80
|
+
*
|
|
81
|
+
* @param {ICronofyElementTokenParams} params Parameters for the Cronofy request element token API
|
|
82
|
+
* @returns {Promise<ICronofyElementTokenResponse>} Returns Cronofy element token data
|
|
83
|
+
*/
|
|
84
|
+
requestElementToken(params) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
const elementToken = yield this._cronofy.requestElementToken(params);
|
|
87
|
+
return elementToken;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Revokes authorization for a Cronofy linked calendar.
|
|
92
|
+
*
|
|
93
|
+
* @param {string} token Access or refresh token associated with the account to revoke
|
|
94
|
+
*/
|
|
95
|
+
revokeAuthorization(token) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const options = { token };
|
|
98
|
+
yield this._cronofy.revokeAuthorization(options);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create or update a Cronofy availability rule.
|
|
103
|
+
*
|
|
104
|
+
* @param {ICronofyAvailabilityRulesPostParams} params Parameters for the Cronofy availability rules POST API
|
|
105
|
+
* @returns {Promise<boolean>} Returns true if the request was successful
|
|
106
|
+
*/
|
|
107
|
+
upsertAvailabilityRule(accessToken, params) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
const res = yield this._cronofy.upsertAvailabilityRule(Object.assign({ access_token: accessToken }, params));
|
|
110
|
+
return res && res.availability_rule && res && res.availability_rule.availability_rule_id;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
CronofyAPI = __decorate([
|
|
115
|
+
(0, tsyringe_1.injectable)(),
|
|
116
|
+
__metadata("design:paramtypes", [Object])
|
|
117
|
+
], CronofyAPI);
|
|
118
|
+
exports.CronofyAPI = CronofyAPI;
|
|
119
|
+
//# sourceMappingURL=cronofy.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cronofy.api.js","sourceRoot":"","sources":["../../../calendar/cronofy/cronofy.api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAA8B;AAC9B,uCAAsC;AAM/B,IAAM,UAAU,GAAhB,MAAM,UAAU;IAGnB,YAAY,MAAsB;QAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAO,CAAC;YACxB,SAAS,EAAE,MAAM,CAAC,QAAQ;YAC1B,aAAa,EAAE,MAAM,CAAC,YAAY;YAClC,WAAW,EAAE,MAAM,CAAC,UAAU;SACjC,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACU,yBAAyB,CAAC,UAAkB;;YACrD,MAAM,OAAO,GAAG,EAAE,uBAAuB,EAAE,UAAU,EAAE,CAAC;YACxD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YACrE,OAAO,WAAW,CAAC;QACvB,CAAC;KAAA;IAED;;;;;OAKG;IACU,kBAAkB,CAAC,YAAoB;;YAChD,MAAM,OAAO,GAAG,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;YAChD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;YACpE,OAAO,WAAW,CAAC;QACvB,CAAC;KAAA;IAED;;;;;;OAMG;IACU,kBAAkB,CAAC,QAAgB,EAAE,WAAmB;;YACjE,MAAM,OAAO,GAAG;gBACZ,IAAI,EAAE,QAAQ;gBACd,YAAY,EAAE,WAAW;aAC5B,CAAC;YACF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;YACpE,OAAO,WAAW,CAAC;QACvB,CAAC;KAAA;IAED;;;;;OAKG;IACU,mBAAmB,CAAC,MAAkC;;YAC/D,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;YACrE,OAAO,YAAY,CAAC;QACxB,CAAC;KAAA;IAED;;;;OAIG;IACU,mBAAmB,CAAC,KAAa;;YAC1C,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,CAAC;YAC1B,MAAM,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACrD,CAAC;KAAA;IAED;;;;;OAKG;IACU,sBAAsB,CAAC,WAAmB,EAAE,MAA2C;;YAChG,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,sBAAsB,iBAAG,YAAY,EAAE,WAAW,IAAK,MAAM,EAAG,CAAC;YACjG,OAAO,GAAG,IAAI,GAAG,CAAC,iBAAiB,IAAI,GAAG,IAAI,GAAG,CAAC,iBAAiB,CAAC,oBAAoB,CAAC;QAC7F,CAAC;KAAA;CACJ,CAAA;AAlFY,UAAU;IADtB,IAAA,qBAAU,GAAE;;GACA,UAAU,CAkFtB;AAlFY,gCAAU"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CronofyAPI = void 0;
|
|
4
|
+
const cronofy_api_1 = require("./cronofy.api");
|
|
5
|
+
Object.defineProperty(exports, "CronofyAPI", { enumerable: true, get: function () { return cronofy_api_1.CronofyAPI; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../calendar/cronofy/index.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAClC,2FADA,wBAAU,OACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cronofy.config.js","sourceRoot":"","sources":["../../../../../calendar/cronofy/models/_/cronofy.config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cronofy Access Token data interface
|
|
3
|
+
*/
|
|
4
|
+
export interface ICronofyAccessToken {
|
|
5
|
+
access_token: string;
|
|
6
|
+
token_type: 'bearer';
|
|
7
|
+
expires_in: number;
|
|
8
|
+
refresh_token: string;
|
|
9
|
+
scope: string;
|
|
10
|
+
sub: string;
|
|
11
|
+
account_id: string;
|
|
12
|
+
linking_profile: {
|
|
13
|
+
provider_name: string;
|
|
14
|
+
profile_id: string;
|
|
15
|
+
profile_name: string;
|
|
16
|
+
provider_service: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Cronofy Application Calendar data interface
|
|
21
|
+
*/
|
|
22
|
+
export interface ICronofyApplicationCalendar {
|
|
23
|
+
access_token: string;
|
|
24
|
+
token_type: 'bearer';
|
|
25
|
+
expires_in: number;
|
|
26
|
+
refresh_token: string;
|
|
27
|
+
scope: string;
|
|
28
|
+
sub: string;
|
|
29
|
+
application_calendar_id: string;
|
|
30
|
+
linking_profile: {
|
|
31
|
+
provider_name: string;
|
|
32
|
+
profile_id: string;
|
|
33
|
+
profile_name: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Cronofy Element Token Request Parameters data interface
|
|
38
|
+
*/
|
|
39
|
+
export interface ICronofyElementTokenParams {
|
|
40
|
+
version?: string;
|
|
41
|
+
permissions: string[];
|
|
42
|
+
subs: string[];
|
|
43
|
+
origin: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Cronofy Element Token Response data interface
|
|
47
|
+
*/
|
|
48
|
+
export interface ICronofyElementTokenResponse {
|
|
49
|
+
permissions: string[];
|
|
50
|
+
origin: string;
|
|
51
|
+
token: string;
|
|
52
|
+
expires_in: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Cronofy availability rules post request parameters interface
|
|
56
|
+
*/
|
|
57
|
+
export interface ICronofyAvailabilityRulesPostParams {
|
|
58
|
+
availability_rule_id: string;
|
|
59
|
+
tzid: string;
|
|
60
|
+
calendar_ids?: string[];
|
|
61
|
+
weekly_periods: ICronofyAvailabilityRulesWeeklyPeriod[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Cronofy availability rules weekly period interface
|
|
65
|
+
*/
|
|
66
|
+
export interface ICronofyAvailabilityRulesWeeklyPeriod {
|
|
67
|
+
day: string;
|
|
68
|
+
start_time: string;
|
|
69
|
+
end_time: string;
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cronofy.data.js","sourceRoot":"","sources":["../../../../../calendar/cronofy/models/_/cronofy.data.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ICronofyConfig } from "./_/cronofy.config";
|
|
2
|
+
import { ICronofyAccessToken, ICronofyElementTokenParams, ICronofyElementTokenResponse, ICronofyApplicationCalendar, ICronofyAvailabilityRulesPostParams, ICronofyAvailabilityRulesWeeklyPeriod } from "./_/cronofy.data";
|
|
3
|
+
export { ICronofyAccessToken, ICronofyConfig, ICronofyElementTokenParams, ICronofyElementTokenResponse, ICronofyApplicationCalendar, ICronofyAvailabilityRulesPostParams, ICronofyAvailabilityRulesWeeklyPeriod };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../calendar/cronofy/models/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Client Type enum
|
|
6
|
+
*/
|
|
7
|
+
var ClientType;
|
|
8
|
+
(function (ClientType) {
|
|
9
|
+
ClientType["Cronofy"] = "cronofy";
|
|
10
|
+
})(ClientType = exports.ClientType || (exports.ClientType = {}));
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../calendar/enum/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,UAEX;AAFD,WAAY,UAAU;IAClB,iCAAmB,CAAA;AACvB,CAAC,EAFW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAErB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ClientType } from "./enum";
|
|
2
|
+
import { ICronofyConfig } from "./cronofy/models";
|
|
3
|
+
/**
|
|
4
|
+
* Calendar declarations
|
|
5
|
+
*/
|
|
6
|
+
interface ICalendar<T> {
|
|
7
|
+
client: T;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Calendar implementation
|
|
11
|
+
*/
|
|
12
|
+
export declare class Calendar<T> implements ICalendar<T> {
|
|
13
|
+
private _client;
|
|
14
|
+
private _config;
|
|
15
|
+
private _clientType;
|
|
16
|
+
/**
|
|
17
|
+
* Session constructor
|
|
18
|
+
* @param {ClientType} clientType client type
|
|
19
|
+
* @param {ICronofyConfig} config session configuration
|
|
20
|
+
*/
|
|
21
|
+
constructor(clientType: ClientType, config: ICronofyConfig);
|
|
22
|
+
/**
|
|
23
|
+
* getter for client
|
|
24
|
+
* @returns {T} client of type T
|
|
25
|
+
*/
|
|
26
|
+
get client(): T;
|
|
27
|
+
/**
|
|
28
|
+
* initialize method
|
|
29
|
+
* @returns {void} promise of type void
|
|
30
|
+
*/
|
|
31
|
+
private init;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
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.Calendar = void 0;
|
|
13
|
+
const tsyringe_1 = require("tsyringe");
|
|
14
|
+
const enum_1 = require("./enum");
|
|
15
|
+
const cronofy_api_1 = require("./cronofy/cronofy.api");
|
|
16
|
+
/**
|
|
17
|
+
* Calendar implementation
|
|
18
|
+
*/
|
|
19
|
+
let Calendar = class Calendar {
|
|
20
|
+
/**
|
|
21
|
+
* Session constructor
|
|
22
|
+
* @param {ClientType} clientType client type
|
|
23
|
+
* @param {ICronofyConfig} config session configuration
|
|
24
|
+
*/
|
|
25
|
+
constructor(clientType, config) {
|
|
26
|
+
this._clientType = clientType;
|
|
27
|
+
this._config = config;
|
|
28
|
+
this.init();
|
|
29
|
+
}
|
|
30
|
+
// getter / setter
|
|
31
|
+
/**
|
|
32
|
+
* getter for client
|
|
33
|
+
* @returns {T} client of type T
|
|
34
|
+
*/
|
|
35
|
+
get client() {
|
|
36
|
+
return this._client;
|
|
37
|
+
}
|
|
38
|
+
// methods
|
|
39
|
+
/**
|
|
40
|
+
* initialize method
|
|
41
|
+
* @returns {void} promise of type void
|
|
42
|
+
*/
|
|
43
|
+
init() {
|
|
44
|
+
// change to switch when adding new client types
|
|
45
|
+
if (this._clientType == enum_1.ClientType.Cronofy) {
|
|
46
|
+
this._client = new cronofy_api_1.CronofyAPI(this._config);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
Calendar = __decorate([
|
|
51
|
+
(0, tsyringe_1.injectable)(),
|
|
52
|
+
__metadata("design:paramtypes", [String, Object])
|
|
53
|
+
], Calendar);
|
|
54
|
+
exports.Calendar = Calendar;
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../calendar/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAsC;AACtC,iCAAoC;AAEpC,uDAAmD;AAUnD;;GAEG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAQ;IAMjB;;;;OAIG;IACH,YAAY,UAAsB,EAAE,MAAsB;QACtD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAED,kBAAkB;IAClB;;;OAGG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,UAAU;IACV;;;OAGG;IACK,IAAI;QACR,gDAAgD;QAChD,IAAI,IAAI,CAAC,WAAW,IAAI,iBAAU,CAAC,OAAO,EAAE;YACxC,IAAI,CAAC,OAAO,GAAG,IAAI,wBAAU,CAAC,IAAI,CAAC,OAAO,CAAiB,CAAC;SAC/D;IACL,CAAC;CACJ,CAAA;AArCY,QAAQ;IADpB,IAAA,qBAAU,GAAE;;GACA,QAAQ,CAqCpB;AArCY,4BAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bwi-mentorspaces/application-utils-npm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.59",
|
|
4
4
|
"description": "Mentor Spaces npm packages for reusable models, utils, and abstracted, commonly used processes for DB Repo, Logging, etc.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mentor Spaces",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"aws-lambda": "^1.0.7",
|
|
43
43
|
"axios": "^0.24.0",
|
|
44
|
+
"cronofy": "^3.8.0",
|
|
44
45
|
"crypto-js": "^4.1.1",
|
|
45
46
|
"express": "^4.17.2",
|
|
46
47
|
"guid-typescript": "^1.0.9",
|