@dereekb/zoho 10.2.0
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/LICENSE +21 -0
- package/README.md +11 -0
- package/index.cjs.d.ts +1 -0
- package/index.cjs.js +3353 -0
- package/index.esm.js +4396 -0
- package/nestjs/CHANGELOG.md +16 -0
- package/nestjs/README.md +11 -0
- package/nestjs/package.json +6 -0
- package/nestjs/src/index.d.ts +1 -0
- package/nestjs/src/index.js +5 -0
- package/nestjs/src/index.js.map +1 -0
- package/nestjs/src/lib/accounts/accounts.api.d.ts +11 -0
- package/nestjs/src/lib/accounts/accounts.api.js +33 -0
- package/nestjs/src/lib/accounts/accounts.api.js.map +1 -0
- package/nestjs/src/lib/accounts/accounts.config.d.ts +15 -0
- package/nestjs/src/lib/accounts/accounts.config.js +48 -0
- package/nestjs/src/lib/accounts/accounts.config.js.map +1 -0
- package/nestjs/src/lib/accounts/accounts.service.d.ts +34 -0
- package/nestjs/src/lib/accounts/accounts.service.js +152 -0
- package/nestjs/src/lib/accounts/accounts.service.js.map +1 -0
- package/nestjs/src/lib/accounts/index.d.ts +3 -0
- package/nestjs/src/lib/accounts/index.js +7 -0
- package/nestjs/src/lib/accounts/index.js.map +1 -0
- package/nestjs/src/lib/index.d.ts +3 -0
- package/nestjs/src/lib/index.js +7 -0
- package/nestjs/src/lib/index.js.map +1 -0
- package/nestjs/src/lib/recruit/index.d.ts +3 -0
- package/nestjs/src/lib/recruit/index.js +7 -0
- package/nestjs/src/lib/recruit/index.js.map +1 -0
- package/nestjs/src/lib/recruit/recruit.api.d.ts +16 -0
- package/nestjs/src/lib/recruit/recruit.api.js +47 -0
- package/nestjs/src/lib/recruit/recruit.api.js.map +1 -0
- package/nestjs/src/lib/recruit/recruit.config.d.ts +10 -0
- package/nestjs/src/lib/recruit/recruit.config.js +14 -0
- package/nestjs/src/lib/recruit/recruit.config.js.map +1 -0
- package/nestjs/src/lib/recruit/recruit.module.d.ts +7 -0
- package/nestjs/src/lib/recruit/recruit.module.js +54 -0
- package/nestjs/src/lib/recruit/recruit.module.js.map +1 -0
- package/nestjs/src/lib/zoho.config.d.ts +27 -0
- package/nestjs/src/lib/zoho.config.js +52 -0
- package/nestjs/src/lib/zoho.config.js.map +1 -0
- package/package.json +30 -0
- package/src/index.d.ts +1 -0
- package/src/lib/accounts/accounts.api.d.ts +27 -0
- package/src/lib/accounts/accounts.config.d.ts +45 -0
- package/src/lib/accounts/accounts.d.ts +75 -0
- package/src/lib/accounts/accounts.error.api.d.ts +28 -0
- package/src/lib/accounts/accounts.factory.d.ts +34 -0
- package/src/lib/accounts/index.d.ts +5 -0
- package/src/lib/index.d.ts +6 -0
- package/src/lib/recruit/index.d.ts +5 -0
- package/src/lib/recruit/recruit.api.d.ts +144 -0
- package/src/lib/recruit/recruit.config.d.ts +23 -0
- package/src/lib/recruit/recruit.d.ts +108 -0
- package/src/lib/recruit/recruit.error.api.d.ts +29 -0
- package/src/lib/recruit/recruit.factory.d.ts +16 -0
- package/src/lib/zoho.api.page.d.ts +37 -0
- package/src/lib/zoho.config.d.ts +35 -0
- package/src/lib/zoho.error.api.d.ts +145 -0
- package/src/lib/zoho.type.d.ts +20 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
|
+
|
|
5
|
+
# [10.2.0](https://github.com/dereekb/dbx-components/compare/v10.1.30-dev...v10.2.0) (2024-11-07)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* zoho recruit ([#26](https://github.com/dereekb/dbx-components/issues/26)) ([8e028fd](https://github.com/dereekb/dbx-components/commit/8e028fd6fc57fb276ce04d37ce010fb5a42d4157))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# Changelog
|
|
15
|
+
|
|
16
|
+
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
package/nestjs/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/zoho/nestjs/src/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ZohoAccounts, ZohoAccountsContext } from '@dereekb/zoho';
|
|
2
|
+
import { ZohoAccountsServiceConfig } from './accounts.config';
|
|
3
|
+
import { ZohoAccountsAccessTokenCacheService } from './accounts.service';
|
|
4
|
+
export declare class ZohoAccountsApi {
|
|
5
|
+
readonly config: ZohoAccountsServiceConfig;
|
|
6
|
+
readonly cacheService: ZohoAccountsAccessTokenCacheService;
|
|
7
|
+
readonly zohoAccounts: ZohoAccounts;
|
|
8
|
+
get accountsContext(): ZohoAccountsContext;
|
|
9
|
+
constructor(config: ZohoAccountsServiceConfig, cacheService: ZohoAccountsAccessTokenCacheService);
|
|
10
|
+
get accessToken(): (input?: import("@dereekb/zoho").ZohoAccountsAccessTokenInput | undefined) => Promise<import("@dereekb/zoho").ZohoAccountsAccessTokenResponse>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZohoAccountsApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const zoho_1 = require("@dereekb/zoho");
|
|
7
|
+
const accounts_config_1 = require("./accounts.config");
|
|
8
|
+
const accounts_service_1 = require("./accounts.service");
|
|
9
|
+
let ZohoAccountsApi = exports.ZohoAccountsApi = class ZohoAccountsApi {
|
|
10
|
+
get accountsContext() {
|
|
11
|
+
return this.zohoAccounts.accountsContext;
|
|
12
|
+
}
|
|
13
|
+
constructor(config, cacheService) {
|
|
14
|
+
this.config = config;
|
|
15
|
+
this.cacheService = cacheService;
|
|
16
|
+
const accessTokenCache = config.zohoAccounts.accessTokenCache ? config.zohoAccounts.accessTokenCache : cacheService.loadZohoAccessTokenCache(config.zohoAccounts.serviceAccessTokenKey);
|
|
17
|
+
this.zohoAccounts = (0, zoho_1.zohoAccountsFactory)(config.factoryConfig ?? {})({
|
|
18
|
+
accessTokenCache,
|
|
19
|
+
...config.zohoAccounts
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
// MARK: Accessors
|
|
23
|
+
get accessToken() {
|
|
24
|
+
return (0, zoho_1.accessToken)(this.accountsContext);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.ZohoAccountsApi = ZohoAccountsApi = tslib_1.__decorate([
|
|
28
|
+
(0, common_1.Injectable)(),
|
|
29
|
+
tslib_1.__param(0, (0, common_1.Inject)(accounts_config_1.ZohoAccountsServiceConfig)),
|
|
30
|
+
tslib_1.__param(1, (0, common_1.Inject)(accounts_service_1.ZohoAccountsAccessTokenCacheService)),
|
|
31
|
+
tslib_1.__metadata("design:paramtypes", [accounts_config_1.ZohoAccountsServiceConfig, accounts_service_1.ZohoAccountsAccessTokenCacheService])
|
|
32
|
+
], ZohoAccountsApi);
|
|
33
|
+
//# sourceMappingURL=accounts.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.api.js","sourceRoot":"","sources":["../../../../../../../packages/zoho/nestjs/src/lib/accounts/accounts.api.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AACpD,wCAAoG;AACpG,uDAA8D;AAC9D,yDAAyE;AAGlE,IAAM,eAAe,6BAArB,MAAM,eAAe;IAG1B,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC;IAC3C,CAAC;IAED,YAA+D,MAAiC,EAA+D,YAAiD;QAAjJ,WAAM,GAAN,MAAM,CAA2B;QAA+D,iBAAY,GAAZ,YAAY,CAAqC;QAC9M,MAAM,gBAAgB,GAAG,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,YAAY,CAAC,wBAAwB,CAAC,MAAM,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;QACxL,IAAI,CAAC,YAAY,GAAG,IAAA,0BAAmB,EAAC,MAAM,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;YAClE,gBAAgB;YAChB,GAAG,MAAM,CAAC,YAAY;SACvB,CAAC,CAAC;IACL,CAAC;IAED,kBAAkB;IAClB,IAAI,WAAW;QACb,OAAO,IAAA,kBAAW,EAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;CACF,CAAA;0BAnBY,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAQE,mBAAA,IAAA,eAAM,EAAC,2CAAyB,CAAC,CAAA;IAAqD,mBAAA,IAAA,eAAM,EAAC,sDAAmC,CAAC,CAAA;6CAAvE,2CAAyB,EAA6E,sDAAmC;GAPrM,eAAe,CAmB3B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ZohoAccountsConfig, ZohoAccountsFactoryConfig, ZohoServiceAccessTokenKey } from '@dereekb/zoho';
|
|
2
|
+
import { ZohoConfigServiceReaderConfig } from '../zoho.config';
|
|
3
|
+
export interface ZohoAccountsServiceApiConfig extends ZohoAccountsConfig {
|
|
4
|
+
readonly serviceAccessTokenKey: ZohoServiceAccessTokenKey;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for ZohoService
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class ZohoAccountsServiceConfig {
|
|
10
|
+
readonly zohoAccounts: ZohoAccountsServiceApiConfig;
|
|
11
|
+
readonly factoryConfig?: ZohoAccountsFactoryConfig;
|
|
12
|
+
static assertValidConfig(config: ZohoAccountsServiceConfig): void;
|
|
13
|
+
}
|
|
14
|
+
export type ZohoAccountsServiceConfigFromConfigServiceInput = ZohoConfigServiceReaderConfig;
|
|
15
|
+
export declare function zohoAccountsServiceConfigFromConfigService(input: ZohoAccountsServiceConfigFromConfigServiceInput): ZohoAccountsServiceConfig;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.zohoAccountsServiceConfigFromConfigService = exports.ZohoAccountsServiceConfig = void 0;
|
|
4
|
+
const zoho_config_1 = require("../zoho.config");
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for ZohoService
|
|
7
|
+
*/
|
|
8
|
+
class ZohoAccountsServiceConfig {
|
|
9
|
+
static assertValidConfig(config) {
|
|
10
|
+
const { zohoAccounts } = config;
|
|
11
|
+
if (!zohoAccounts) {
|
|
12
|
+
throw new Error('ZohoAccountsServiceConfig.zohoAccounts is required');
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
if (!zohoAccounts.serviceAccessTokenKey) {
|
|
16
|
+
throw new Error('ZohoAccountsServiceConfig.zohoAccounts.serviceAccessTokenKey is required');
|
|
17
|
+
}
|
|
18
|
+
else if (!zohoAccounts.refreshToken) {
|
|
19
|
+
throw new Error('ZohoAccountsServiceConfig.zohoAccounts.refreshToken is required');
|
|
20
|
+
}
|
|
21
|
+
else if (!zohoAccounts.apiUrl) {
|
|
22
|
+
throw new Error('ZohoAccountsServiceConfig.zohoAccounts.apiUrl is required');
|
|
23
|
+
}
|
|
24
|
+
else if (!zohoAccounts.clientId) {
|
|
25
|
+
throw new Error('ZohoAccountsServiceConfig.zohoAccounts.clientId is required');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ZohoAccountsServiceConfig = ZohoAccountsServiceConfig;
|
|
31
|
+
function zohoAccountsServiceConfigFromConfigService(input) {
|
|
32
|
+
const { serviceAccessTokenKey } = input;
|
|
33
|
+
const getFromConfigService = (0, zoho_config_1.zohoConfigServiceReaderFunction)(input);
|
|
34
|
+
const zohoAccounts = {
|
|
35
|
+
serviceAccessTokenKey,
|
|
36
|
+
apiUrl: getFromConfigService('ACCOUNTS_URL'),
|
|
37
|
+
refreshToken: getFromConfigService('ACCOUNTS_REFRESH_TOKEN'),
|
|
38
|
+
clientId: getFromConfigService('ACCOUNTS_CLIENT_ID'),
|
|
39
|
+
clientSecret: getFromConfigService('ACCOUNTS_CLIENT_SECRET') // ZOHO_ACCOUNTS_CLIENT_SECRET, ZOHO_RECRUIT_ACCOUNTS_CLIENT_SECRET
|
|
40
|
+
};
|
|
41
|
+
const config = {
|
|
42
|
+
zohoAccounts
|
|
43
|
+
};
|
|
44
|
+
ZohoAccountsServiceConfig.assertValidConfig(config);
|
|
45
|
+
return config;
|
|
46
|
+
}
|
|
47
|
+
exports.zohoAccountsServiceConfigFromConfigService = zohoAccountsServiceConfigFromConfigService;
|
|
48
|
+
//# sourceMappingURL=accounts.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.config.js","sourceRoot":"","sources":["../../../../../../../packages/zoho/nestjs/src/lib/accounts/accounts.config.ts"],"names":[],"mappings":";;;AACA,gDAAgG;AAMhG;;GAEG;AACH,MAAsB,yBAAyB;IAI7C,MAAM,CAAC,iBAAiB,CAAC,MAAiC;QACxD,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;QAEhC,IAAI,CAAC,YAAY,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;SACvE;aAAM;YACL,IAAI,CAAC,YAAY,CAAC,qBAAqB,EAAE;gBACvC,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;aAC7F;iBAAM,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;gBACrC,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;aACpF;iBAAM,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;gBAC/B,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;aAC9E;iBAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;gBACjC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;aAChF;SACF;IACH,CAAC;CACF;AArBD,8DAqBC;AAID,SAAgB,0CAA0C,CAAC,KAAsD;IAC/G,MAAM,EAAE,qBAAqB,EAAE,GAAG,KAAK,CAAC;IACxC,MAAM,oBAAoB,GAAG,IAAA,6CAA+B,EAAC,KAAK,CAAC,CAAC;IAEpE,MAAM,YAAY,GAA8C;QAC9D,qBAAqB;QACrB,MAAM,EAAE,oBAAoB,CAAC,cAAc,CAAC;QAC5C,YAAY,EAAE,oBAAoB,CAAC,wBAAwB,CAAC;QAC5D,QAAQ,EAAE,oBAAoB,CAAC,oBAAoB,CAAC;QACpD,YAAY,EAAE,oBAAoB,CAAC,wBAAwB,CAAC,CAAC,mEAAmE;KACjI,CAAC;IAEF,MAAM,MAAM,GAA8B;QACxC,YAAY;KACb,CAAC;IAEF,yBAAyB,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACpD,OAAO,MAAM,CAAC;AAChB,CAAC;AAlBD,gGAkBC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ZohoAccessToken, ZohoAccessTokenCache, ZohoServiceAccessTokenKey } from '@dereekb/zoho';
|
|
2
|
+
import { Maybe } from '@dereekb/util';
|
|
3
|
+
export type ZohoAccountsAccessTokenCacheRecord = Record<ZohoServiceAccessTokenKey, Maybe<ZohoAccessToken>>;
|
|
4
|
+
/**
|
|
5
|
+
* Service used for retrieving ZohoAccessTokenCache for Zoho services.
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class ZohoAccountsAccessTokenCacheService {
|
|
8
|
+
/**
|
|
9
|
+
* Loads an ZohoAccessTokenCache for the given service key.
|
|
10
|
+
*
|
|
11
|
+
* @param service
|
|
12
|
+
*/
|
|
13
|
+
abstract loadZohoAccessTokenCache(service: ZohoServiceAccessTokenKey): ZohoAccessTokenCache;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates a ZohoAccountsAccessTokenCacheService that uses in-memory storage.
|
|
17
|
+
*
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare function memoryZohoAccountsAccessTokenCacheService(existingCache?: ZohoAccountsAccessTokenCacheRecord): ZohoAccountsAccessTokenCacheService;
|
|
21
|
+
export interface FileSystemZohoAccountsAccessTokenCacheService extends ZohoAccountsAccessTokenCacheService {
|
|
22
|
+
readTokenFile(): Promise<Maybe<ZohoAccountsAccessTokenCacheRecord>>;
|
|
23
|
+
writeTokenFile(tokens: ZohoAccountsAccessTokenCacheRecord): Promise<void>;
|
|
24
|
+
deleteTokenFile(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export declare const DEFAULT_FILE_ZOHO_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = ".tmp/zoho-access-tokens.json";
|
|
27
|
+
/**
|
|
28
|
+
* Creates a ZohoAccountsAccessTokenCacheService that reads and writes the access token to the file system.
|
|
29
|
+
*
|
|
30
|
+
* Useful for testing.
|
|
31
|
+
*
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
export declare function fileZohoAccountsAccessTokenCacheService(filename?: string, useMemoryCache?: boolean): FileSystemZohoAccountsAccessTokenCacheService;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fileZohoAccountsAccessTokenCacheService = exports.DEFAULT_FILE_ZOHO_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = exports.memoryZohoAccountsAccessTokenCacheService = exports.ZohoAccountsAccessTokenCacheService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const util_1 = require("@dereekb/util");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
/**
|
|
10
|
+
* Service used for retrieving ZohoAccessTokenCache for Zoho services.
|
|
11
|
+
*/
|
|
12
|
+
let ZohoAccountsAccessTokenCacheService = exports.ZohoAccountsAccessTokenCacheService = class ZohoAccountsAccessTokenCacheService {
|
|
13
|
+
};
|
|
14
|
+
exports.ZohoAccountsAccessTokenCacheService = ZohoAccountsAccessTokenCacheService = tslib_1.__decorate([
|
|
15
|
+
(0, common_1.Injectable)()
|
|
16
|
+
], ZohoAccountsAccessTokenCacheService);
|
|
17
|
+
// MARK: Memory Access Token Cache
|
|
18
|
+
/**
|
|
19
|
+
* Creates a ZohoAccountsAccessTokenCacheService that uses in-memory storage.
|
|
20
|
+
*
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
function memoryZohoAccountsAccessTokenCacheService(existingCache) {
|
|
24
|
+
const tokens = existingCache ?? {};
|
|
25
|
+
function loadZohoAccessTokenCache(service) {
|
|
26
|
+
const accessTokenCache = {
|
|
27
|
+
loadCachedToken: async function () {
|
|
28
|
+
const token = tokens[service];
|
|
29
|
+
console.log('retrieving access token from memory: ', { token, service });
|
|
30
|
+
return token;
|
|
31
|
+
},
|
|
32
|
+
updateCachedToken: async function (accessToken) {
|
|
33
|
+
tokens[service] = accessToken;
|
|
34
|
+
console.log('updating access token in memory: ', { accessToken, service });
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return accessTokenCache;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
loadZohoAccessTokenCache
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.memoryZohoAccountsAccessTokenCacheService = memoryZohoAccountsAccessTokenCacheService;
|
|
44
|
+
// MARK: File System Access Token Cache
|
|
45
|
+
exports.DEFAULT_FILE_ZOHO_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoho-access-tokens.json';
|
|
46
|
+
/**
|
|
47
|
+
* Creates a ZohoAccountsAccessTokenCacheService that reads and writes the access token to the file system.
|
|
48
|
+
*
|
|
49
|
+
* Useful for testing.
|
|
50
|
+
*
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
function fileZohoAccountsAccessTokenCacheService(filename = exports.DEFAULT_FILE_ZOHO_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH, useMemoryCache = true) {
|
|
54
|
+
let loadedTokens = null;
|
|
55
|
+
async function loadTokens() {
|
|
56
|
+
if (!loadedTokens) {
|
|
57
|
+
return (await readTokenFile()) ?? {};
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return loadedTokens;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function readTokenFile() {
|
|
64
|
+
return new Promise((resolve) => {
|
|
65
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(filename), { recursive: true }); // make the directory first
|
|
66
|
+
(0, fs_1.readFile)(filename, {}, (x, data) => {
|
|
67
|
+
let result = undefined;
|
|
68
|
+
if (!x) {
|
|
69
|
+
try {
|
|
70
|
+
result = JSON.parse(data.toString());
|
|
71
|
+
(0, util_1.forEachKeyValue)(result, {
|
|
72
|
+
forEach: (x) => {
|
|
73
|
+
if (x[1]) {
|
|
74
|
+
x[1].expiresAt = new Date(x[1].expiresAt);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
console.error('Failed reading token file: ', e);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
resolve(result);
|
|
84
|
+
});
|
|
85
|
+
}).then((x) => {
|
|
86
|
+
// update loaded tokens
|
|
87
|
+
if (useMemoryCache) {
|
|
88
|
+
loadedTokens = {
|
|
89
|
+
...loadedTokens,
|
|
90
|
+
...x
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return x;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
async function writeTokenFile(tokens) {
|
|
97
|
+
return new Promise((resolve, reject) => {
|
|
98
|
+
(0, fs_1.writeFile)(filename, JSON.stringify(tokens), {}, (x) => {
|
|
99
|
+
if (!x) {
|
|
100
|
+
resolve();
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
reject(x);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async function deleteTokenFile() {
|
|
109
|
+
return new Promise((resolve, reject) => {
|
|
110
|
+
(0, fs_1.rm)(filename, (x) => {
|
|
111
|
+
if (!x) {
|
|
112
|
+
resolve();
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
reject(x);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function loadZohoAccessTokenCache(service) {
|
|
121
|
+
const accessTokenCache = {
|
|
122
|
+
loadCachedToken: async function () {
|
|
123
|
+
const tokens = await loadTokens();
|
|
124
|
+
const token = tokens[service];
|
|
125
|
+
// console.log('retrieving access token from file: ', { token, service });
|
|
126
|
+
return token;
|
|
127
|
+
},
|
|
128
|
+
updateCachedToken: async function (accessToken) {
|
|
129
|
+
const tokens = await loadTokens();
|
|
130
|
+
if (tokens) {
|
|
131
|
+
tokens[service] = accessToken;
|
|
132
|
+
}
|
|
133
|
+
// console.log('updating access token in file: ', { accessToken, service });
|
|
134
|
+
try {
|
|
135
|
+
await writeTokenFile(tokens);
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
console.error('Failed updating access token in file: ', e);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
return accessTokenCache;
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
loadZohoAccessTokenCache,
|
|
146
|
+
readTokenFile,
|
|
147
|
+
writeTokenFile,
|
|
148
|
+
deleteTokenFile
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
exports.fileZohoAccountsAccessTokenCacheService = fileZohoAccountsAccessTokenCacheService;
|
|
152
|
+
//# sourceMappingURL=accounts.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.service.js","sourceRoot":"","sources":["../../../../../../../packages/zoho/nestjs/src/lib/accounts/accounts.service.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./accounts.api"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./accounts.config"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./accounts.service"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/zoho/nestjs/src/lib/accounts/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,4DAAkC;AAClC,6DAAmC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./accounts"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./recruit"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./zoho.config"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/zoho/nestjs/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,oDAA0B;AAC1B,wDAA8B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./recruit.api"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./recruit.config"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./recruit.module"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/zoho/nestjs/src/lib/recruit/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,2DAAiC;AACjC,2DAAiC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ZohoRecruit, ZohoRecruitContext } from '@dereekb/zoho';
|
|
2
|
+
import { ZohoRecruitServiceConfig } from './recruit.config';
|
|
3
|
+
import { ZohoAccountsApi } from '../accounts/accounts.api';
|
|
4
|
+
export declare class ZohoRecruitApi {
|
|
5
|
+
readonly config: ZohoRecruitServiceConfig;
|
|
6
|
+
readonly zohoAccountsApi: ZohoAccountsApi;
|
|
7
|
+
readonly zohoRecruit: ZohoRecruit;
|
|
8
|
+
get recruitContext(): ZohoRecruitContext;
|
|
9
|
+
constructor(config: ZohoRecruitServiceConfig, zohoAccountsApi: ZohoAccountsApi);
|
|
10
|
+
get insertRecord(): import("@dereekb/zoho").ZohoRecruitInsertRecordFunction;
|
|
11
|
+
get upsertRecord(): import("@dereekb/zoho").ZohoRecruitUpsertRecordFunction;
|
|
12
|
+
get updateRecord(): import("@dereekb/zoho").ZohoRecruitUpdateRecordFunction;
|
|
13
|
+
get getRecordById(): import("@dereekb/zoho").ZohoRecruitGetRecordByIdFunction;
|
|
14
|
+
get getRecords(): import("@dereekb/zoho").ZohoRecruitGetRecordsFunction;
|
|
15
|
+
get searchRecords(): import("@dereekb/zoho").ZohoRecruitSearchRecordsFunction;
|
|
16
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZohoRecruitApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const zoho_1 = require("@dereekb/zoho");
|
|
7
|
+
const recruit_config_1 = require("./recruit.config");
|
|
8
|
+
const accounts_api_1 = require("../accounts/accounts.api");
|
|
9
|
+
let ZohoRecruitApi = exports.ZohoRecruitApi = class ZohoRecruitApi {
|
|
10
|
+
get recruitContext() {
|
|
11
|
+
return this.zohoRecruit.recruitContext;
|
|
12
|
+
}
|
|
13
|
+
constructor(config, zohoAccountsApi) {
|
|
14
|
+
this.config = config;
|
|
15
|
+
this.zohoAccountsApi = zohoAccountsApi;
|
|
16
|
+
this.zohoRecruit = (0, zoho_1.zohoRecruitFactory)({
|
|
17
|
+
...config.factoryConfig,
|
|
18
|
+
accountsContext: zohoAccountsApi.accountsContext
|
|
19
|
+
})(config.zohoRecruit);
|
|
20
|
+
}
|
|
21
|
+
// MARK: Accessors
|
|
22
|
+
get insertRecord() {
|
|
23
|
+
return (0, zoho_1.insertRecord)(this.recruitContext);
|
|
24
|
+
}
|
|
25
|
+
get upsertRecord() {
|
|
26
|
+
return (0, zoho_1.upsertRecord)(this.recruitContext);
|
|
27
|
+
}
|
|
28
|
+
get updateRecord() {
|
|
29
|
+
return (0, zoho_1.updateRecord)(this.recruitContext);
|
|
30
|
+
}
|
|
31
|
+
get getRecordById() {
|
|
32
|
+
return (0, zoho_1.getRecordById)(this.recruitContext);
|
|
33
|
+
}
|
|
34
|
+
get getRecords() {
|
|
35
|
+
return (0, zoho_1.getRecords)(this.recruitContext);
|
|
36
|
+
}
|
|
37
|
+
get searchRecords() {
|
|
38
|
+
return (0, zoho_1.searchRecords)(this.recruitContext);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.ZohoRecruitApi = ZohoRecruitApi = tslib_1.__decorate([
|
|
42
|
+
(0, common_1.Injectable)(),
|
|
43
|
+
tslib_1.__param(0, (0, common_1.Inject)(recruit_config_1.ZohoRecruitServiceConfig)),
|
|
44
|
+
tslib_1.__param(1, (0, common_1.Inject)(accounts_api_1.ZohoAccountsApi)),
|
|
45
|
+
tslib_1.__metadata("design:paramtypes", [recruit_config_1.ZohoRecruitServiceConfig, accounts_api_1.ZohoAccountsApi])
|
|
46
|
+
], ZohoRecruitApi);
|
|
47
|
+
//# sourceMappingURL=recruit.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recruit.api.js","sourceRoot":"","sources":["../../../../../../../packages/zoho/nestjs/src/lib/recruit/recruit.api.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AACpD,wCAAwK;AACxK,qDAA4D;AAC5D,2DAA2D;AAGpD,IAAM,cAAc,4BAApB,MAAM,cAAc;IAGzB,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;IACzC,CAAC;IAED,YAA8D,MAAgC,EAA2C,eAAgC;QAA3G,WAAM,GAAN,MAAM,CAA0B;QAA2C,oBAAe,GAAf,eAAe,CAAiB;QACvK,IAAI,CAAC,WAAW,GAAG,IAAA,yBAAkB,EAAC;YACpC,GAAG,MAAM,CAAC,aAAa;YACvB,eAAe,EAAE,eAAe,CAAC,eAAe;SACjD,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;IAED,kBAAkB;IAClB,IAAI,YAAY;QACd,OAAO,IAAA,mBAAY,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAA,mBAAY,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAA,mBAAY,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAA,oBAAa,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAA,iBAAU,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAA,oBAAa,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;CACF,CAAA;yBAtCY,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAQE,mBAAA,IAAA,eAAM,EAAC,yCAAwB,CAAC,CAAA;IAAoD,mBAAA,IAAA,eAAM,EAAC,8BAAe,CAAC,CAAA;6CAAlD,yCAAwB,EAA4D,8BAAe;GAP9J,cAAc,CAsC1B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ZohoRecruitConfig, ZohoRecruitFactoryConfig } from '@dereekb/zoho';
|
|
2
|
+
export type ZohoRecruitServiceApiConfig = ZohoRecruitConfig & {};
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for ZohoRecruitService
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class ZohoRecruitServiceConfig {
|
|
7
|
+
readonly zohoRecruit: ZohoRecruitServiceApiConfig;
|
|
8
|
+
readonly factoryConfig?: ZohoRecruitFactoryConfig;
|
|
9
|
+
static assertValidConfig(config: ZohoRecruitServiceConfig): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZohoRecruitServiceConfig = void 0;
|
|
4
|
+
const zoho_config_1 = require("../zoho.config");
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for ZohoRecruitService
|
|
7
|
+
*/
|
|
8
|
+
class ZohoRecruitServiceConfig {
|
|
9
|
+
static assertValidConfig(config) {
|
|
10
|
+
(0, zoho_config_1.assertValidZohoConfig)(config.zohoRecruit);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.ZohoRecruitServiceConfig = ZohoRecruitServiceConfig;
|
|
14
|
+
//# sourceMappingURL=recruit.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recruit.config.js","sourceRoot":"","sources":["../../../../../../../packages/zoho/nestjs/src/lib/recruit/recruit.config.ts"],"names":[],"mappings":";;;AACA,gDAAuD;AAIvD;;GAEG;AACH,MAAsB,wBAAwB;IAI5C,MAAM,CAAC,iBAAiB,CAAC,MAAgC;QACvD,IAAA,mCAAqB,EAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5C,CAAC;CACF;AAPD,4DAOC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ConfigService } from '@nestjs/config';
|
|
2
|
+
import { ZohoRecruitServiceConfig } from './recruit.config';
|
|
3
|
+
import { ZohoAccountsServiceConfig } from '../accounts/accounts.config';
|
|
4
|
+
export declare function zohoRecruitServiceConfigFactory(configService: ConfigService): ZohoRecruitServiceConfig;
|
|
5
|
+
export declare function zohoRecruitAccountServiceConfigFactory(configService: ConfigService): ZohoAccountsServiceConfig;
|
|
6
|
+
export declare class ZohoRecruitModule {
|
|
7
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZohoRecruitModule = exports.zohoRecruitAccountServiceConfigFactory = exports.zohoRecruitServiceConfigFactory = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const config_1 = require("@nestjs/config");
|
|
7
|
+
const recruit_api_1 = require("./recruit.api");
|
|
8
|
+
const recruit_config_1 = require("./recruit.config");
|
|
9
|
+
const zoho_config_1 = require("../zoho.config");
|
|
10
|
+
const accounts_api_1 = require("../accounts/accounts.api");
|
|
11
|
+
const accounts_config_1 = require("../accounts/accounts.config");
|
|
12
|
+
const zoho_1 = require("@dereekb/zoho");
|
|
13
|
+
function zohoRecruitServiceConfigFactory(configService) {
|
|
14
|
+
const getFromConfigService = (0, zoho_config_1.zohoConfigServiceReaderFunction)(zoho_1.ZOHO_RECRUIT_SERVICE_NAME, configService);
|
|
15
|
+
const config = {
|
|
16
|
+
zohoRecruit: {
|
|
17
|
+
apiUrl: getFromConfigService(zoho_config_1.ZOHO_API_URL_CONFIG_KEY)
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
recruit_config_1.ZohoRecruitServiceConfig.assertValidConfig(config);
|
|
21
|
+
return config;
|
|
22
|
+
}
|
|
23
|
+
exports.zohoRecruitServiceConfigFactory = zohoRecruitServiceConfigFactory;
|
|
24
|
+
function zohoRecruitAccountServiceConfigFactory(configService) {
|
|
25
|
+
return (0, accounts_config_1.zohoAccountsServiceConfigFromConfigService)({
|
|
26
|
+
configService,
|
|
27
|
+
serviceAccessTokenKey: 'recruit'
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
exports.zohoRecruitAccountServiceConfigFactory = zohoRecruitAccountServiceConfigFactory;
|
|
31
|
+
let ZohoRecruitModule = exports.ZohoRecruitModule = class ZohoRecruitModule {
|
|
32
|
+
};
|
|
33
|
+
exports.ZohoRecruitModule = ZohoRecruitModule = tslib_1.__decorate([
|
|
34
|
+
(0, common_1.Module)({
|
|
35
|
+
imports: [config_1.ConfigModule],
|
|
36
|
+
providers: [
|
|
37
|
+
{
|
|
38
|
+
provide: recruit_config_1.ZohoRecruitServiceConfig,
|
|
39
|
+
inject: [config_1.ConfigService],
|
|
40
|
+
useFactory: zohoRecruitServiceConfigFactory
|
|
41
|
+
},
|
|
42
|
+
recruit_api_1.ZohoRecruitApi,
|
|
43
|
+
// Accounts
|
|
44
|
+
{
|
|
45
|
+
provide: accounts_config_1.ZohoAccountsServiceConfig,
|
|
46
|
+
inject: [config_1.ConfigService],
|
|
47
|
+
useFactory: zohoRecruitAccountServiceConfigFactory
|
|
48
|
+
},
|
|
49
|
+
accounts_api_1.ZohoAccountsApi
|
|
50
|
+
],
|
|
51
|
+
exports: [recruit_api_1.ZohoRecruitApi]
|
|
52
|
+
})
|
|
53
|
+
], ZohoRecruitModule);
|
|
54
|
+
//# sourceMappingURL=recruit.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recruit.module.js","sourceRoot":"","sources":["../../../../../../../packages/zoho/nestjs/src/lib/recruit/recruit.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AACxC,2CAA6D;AAC7D,+CAA+C;AAC/C,qDAA4D;AAC5D,gDAA0F;AAC1F,2DAA2D;AAC3D,iEAAoH;AACpH,wCAA0D;AAE1D,SAAgB,+BAA+B,CAAC,aAA4B;IAC1E,MAAM,oBAAoB,GAAG,IAAA,6CAA+B,EAAC,gCAAyB,EAAE,aAAa,CAAC,CAAC;IAEvG,MAAM,MAAM,GAA6B;QACvC,WAAW,EAAE;YACX,MAAM,EAAE,oBAAoB,CAAC,qCAAuB,CAAC;SACtD;KACF,CAAC;IAEF,yCAAwB,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC;AAChB,CAAC;AAXD,0EAWC;AAED,SAAgB,sCAAsC,CAAC,aAA4B;IACjF,OAAO,IAAA,4DAA0C,EAAC;QAChD,aAAa;QACb,qBAAqB,EAAE,SAAS;KACjC,CAAC,CAAC;AACL,CAAC;AALD,wFAKC;AAqBM,IAAM,iBAAiB,+BAAvB,MAAM,iBAAiB;CAAG,CAAA;4BAApB,iBAAiB;IAnB7B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qBAAY,CAAC;QACvB,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,yCAAwB;gBACjC,MAAM,EAAE,CAAC,sBAAa,CAAC;gBACvB,UAAU,EAAE,+BAA+B;aAC5C;YACD,4BAAc;YACd,WAAW;YACX;gBACE,OAAO,EAAE,2CAAyB;gBAClC,MAAM,EAAE,CAAC,sBAAa,CAAC;gBACvB,UAAU,EAAE,sCAAsC;aACnD;YACD,8BAAe;SAChB;QACD,OAAO,EAAE,CAAC,4BAAc,CAAC;KAC1B,CAAC;GACW,iBAAiB,CAAG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ZohoConfig, ZohoServiceAccessTokenKey } from '@dereekb/zoho';
|
|
2
|
+
import { ConfigService } from '@nestjs/config';
|
|
3
|
+
export declare const ZOHO_API_URL_CONFIG_KEY = "API_URL";
|
|
4
|
+
export interface ZohoConfigServiceReaderConfig {
|
|
5
|
+
readonly configService: ConfigService;
|
|
6
|
+
readonly serviceAccessTokenKey: ZohoServiceAccessTokenKey;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Reads a config value from the ConfigService for the input key.
|
|
10
|
+
*
|
|
11
|
+
* @param input
|
|
12
|
+
*/
|
|
13
|
+
export type ZohoConfigServiceReaderFunction = (configKey: string) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new ZohoConfigServiceReaderFunction that reads from the input ConfigService.
|
|
16
|
+
* @param input
|
|
17
|
+
*/
|
|
18
|
+
export declare function zohoConfigServiceReaderFunction(input: ZohoConfigServiceReaderConfig): ZohoConfigServiceReaderFunction;
|
|
19
|
+
export declare function zohoConfigServiceReaderFunction(serviceAccessTokenKey: ZohoServiceAccessTokenKey, configService: ConfigService): ZohoConfigServiceReaderFunction;
|
|
20
|
+
/**
|
|
21
|
+
* Reads the ZohoConfig config from the ConfigService.
|
|
22
|
+
*
|
|
23
|
+
* @param configService
|
|
24
|
+
* @param prefix
|
|
25
|
+
*/
|
|
26
|
+
export declare function readZohoConfigFromConfigService(configService: ConfigService, servicePrefix?: string, assertValid?: boolean): ZohoConfig;
|
|
27
|
+
export declare function assertValidZohoConfig(config: ZohoConfig): void;
|