@ah-oh/ao-workspaces-api-sdk 1.0.14
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/CHANGELOG.md +85 -0
- package/README.md +11 -0
- package/package.json +24 -0
- package/src/index.d.ts +15 -0
- package/src/index.js +19 -0
- package/src/index.js.map +1 -0
- package/src/lib/auth.constants.d.ts +3 -0
- package/src/lib/auth.constants.js +7 -0
- package/src/lib/auth.constants.js.map +1 -0
- package/src/lib/auth.module.d.ts +9 -0
- package/src/lib/auth.module.js +84 -0
- package/src/lib/auth.module.js.map +1 -0
- package/src/lib/customer-center.service.d.ts +25 -0
- package/src/lib/customer-center.service.js +88 -0
- package/src/lib/customer-center.service.js.map +1 -0
- package/src/lib/guards/auth.guard.d.ts +7 -0
- package/src/lib/guards/auth.guard.js +32 -0
- package/src/lib/guards/auth.guard.js.map +1 -0
- package/src/lib/guards/company.guard.d.ts +4 -0
- package/src/lib/guards/company.guard.js +23 -0
- package/src/lib/guards/company.guard.js.map +1 -0
- package/src/lib/guards/permissions.decorator.d.ts +2 -0
- package/src/lib/guards/permissions.decorator.js +7 -0
- package/src/lib/guards/permissions.decorator.js.map +1 -0
- package/src/lib/guards/sethub-permissions.guard.d.ts +7 -0
- package/src/lib/guards/sethub-permissions.guard.js +34 -0
- package/src/lib/guards/sethub-permissions.guard.js.map +1 -0
- package/src/lib/guards/super-admin.guard.d.ts +4 -0
- package/src/lib/guards/super-admin.guard.js +21 -0
- package/src/lib/guards/super-admin.guard.js.map +1 -0
- package/src/lib/guards/szales-basic-auth.guard.d.ts +7 -0
- package/src/lib/guards/szales-basic-auth.guard.js +43 -0
- package/src/lib/guards/szales-basic-auth.guard.js.map +1 -0
- package/src/lib/mail-settings.service.d.ts +99 -0
- package/src/lib/mail-settings.service.js +302 -0
- package/src/lib/mail-settings.service.js.map +1 -0
- package/src/lib/models/api-key.model.d.ts +1 -0
- package/src/lib/models/api-key.model.js +6 -0
- package/src/lib/models/api-key.model.js.map +1 -0
- package/src/lib/models/auth.options.d.ts +13 -0
- package/src/lib/models/auth.options.js +3 -0
- package/src/lib/models/auth.options.js.map +1 -0
- package/src/lib/models/customer-center.options.d.ts +4 -0
- package/src/lib/models/customer-center.options.js +3 -0
- package/src/lib/models/customer-center.options.js.map +1 -0
- package/src/lib/models/eb-exception.d.ts +9 -0
- package/src/lib/models/eb-exception.js +11 -0
- package/src/lib/models/eb-exception.js.map +1 -0
- package/src/lib/models/sethub-permission.model.d.ts +1 -0
- package/src/lib/models/sethub-permission.model.js +6 -0
- package/src/lib/models/sethub-permission.model.js.map +1 -0
- package/src/lib/models/user-session.model.d.ts +1 -0
- package/src/lib/models/user-session.model.js +12 -0
- package/src/lib/models/user-session.model.js.map +1 -0
- package/src/lib/utils/axios-error.handler.d.ts +1 -0
- package/src/lib/utils/axios-error.handler.js +14 -0
- package/src/lib/utils/axios-error.handler.js.map +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
## 1.0.14 (2026-03-19)
|
|
2
|
+
|
|
3
|
+
This was a version bump only for api-sdk to align it with other projects, there were no code changes.
|
|
4
|
+
|
|
5
|
+
## 1.0.13 (2026-03-19)
|
|
6
|
+
|
|
7
|
+
This was a version bump only for api-sdk to align it with other projects, there were no code changes.
|
|
8
|
+
|
|
9
|
+
## 1.0.12 (2026-03-19)
|
|
10
|
+
|
|
11
|
+
This was a version bump only for api-sdk to align it with other projects, there were no code changes.
|
|
12
|
+
|
|
13
|
+
## 1.0.11 (2026-03-19)
|
|
14
|
+
|
|
15
|
+
This was a version bump only for api-sdk to align it with other projects, there were no code changes.
|
|
16
|
+
|
|
17
|
+
## 1.0.10 (2026-03-19)
|
|
18
|
+
|
|
19
|
+
This was a version bump only for api-sdk to align it with other projects, there were no code changes.
|
|
20
|
+
|
|
21
|
+
## 1.0.9 (2026-03-19)
|
|
22
|
+
|
|
23
|
+
This was a version bump only for api-sdk to align it with other projects, there were no code changes.
|
|
24
|
+
|
|
25
|
+
## 1.0.8 (2026-03-19)
|
|
26
|
+
|
|
27
|
+
### 🩹 Fixes
|
|
28
|
+
|
|
29
|
+
- update URLs to remove '-next' suffix for consistency across environment and configuration files ([e7eae65](https://github.com/ah-oh/ao-workspaces/commit/e7eae65))
|
|
30
|
+
|
|
31
|
+
### ❤️ Thank You
|
|
32
|
+
|
|
33
|
+
- jannks
|
|
34
|
+
|
|
35
|
+
## 1.0.7 (2026-03-18)
|
|
36
|
+
|
|
37
|
+
### 🚀 Features
|
|
38
|
+
|
|
39
|
+
- refactor auth module to use centralized auth constants ([b3cfc41](https://github.com/ah-oh/ao-workspaces/commit/b3cfc41))
|
|
40
|
+
|
|
41
|
+
### ❤️ Thank You
|
|
42
|
+
|
|
43
|
+
- jannks @jannks
|
|
44
|
+
|
|
45
|
+
## 1.0.6 (2026-03-17)
|
|
46
|
+
|
|
47
|
+
This was a version bump only for api-sdk to align it with other projects, there were no code changes.
|
|
48
|
+
|
|
49
|
+
## 1.0.5 (2026-03-12)
|
|
50
|
+
|
|
51
|
+
### 🚀 Features
|
|
52
|
+
|
|
53
|
+
- **mail-settings:** implement Microsoft Graph API integration for mail management ([f6c9225](https://github.com/ah-oh/ao-workspaces/commit/f6c9225))
|
|
54
|
+
|
|
55
|
+
### ❤️ Thank You
|
|
56
|
+
|
|
57
|
+
- jannks @jannks
|
|
58
|
+
|
|
59
|
+
## 1.0.4 (2026-02-27)
|
|
60
|
+
|
|
61
|
+
This was a version bump only for api-sdk to align it with other projects, there were no code changes.
|
|
62
|
+
|
|
63
|
+
## 1.0.3 (2026-02-27)
|
|
64
|
+
|
|
65
|
+
This was a version bump only for api-sdk to align it with other projects, there were no code changes.
|
|
66
|
+
|
|
67
|
+
## 1.0.2 (2026-02-27)
|
|
68
|
+
|
|
69
|
+
This was a version bump only for api-sdk to align it with other projects, there were no code changes.
|
|
70
|
+
|
|
71
|
+
## 1.0.1 (2026-02-27)
|
|
72
|
+
|
|
73
|
+
### 🚀 Features
|
|
74
|
+
|
|
75
|
+
- add support for api-sdk in release workflow and update version to 1.0.0 ([3519e6c](https://github.com/ah-oh/ao-workspaces/commit/3519e6c))
|
|
76
|
+
- update package names and registry scopes to align with new organization structure ([98681ac](https://github.com/ah-oh/ao-workspaces/commit/98681ac))
|
|
77
|
+
- update API endpoints to use /workspaces-api and add proxy configuration for local development ([76cdbfe](https://github.com/ah-oh/ao-workspaces/commit/76cdbfe))
|
|
78
|
+
- update project configurations and dependencies, enhance dashboard features, and improve media handling ([92e2aef](https://github.com/ah-oh/ao-workspaces/commit/92e2aef))
|
|
79
|
+
- add @ao-workspaces/types dependency and update project tags for api-sdk and customer-center-lib ([72e8909](https://github.com/ah-oh/ao-workspaces/commit/72e8909))
|
|
80
|
+
- add permission and user-related DTOs and interfaces ([5d57a07](https://github.com/ah-oh/ao-workspaces/commit/5d57a07))
|
|
81
|
+
|
|
82
|
+
### ❤️ Thank You
|
|
83
|
+
|
|
84
|
+
- jannks @jannks
|
|
85
|
+
- SorayaFerdani
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# customer-center-sdk
|
|
2
|
+
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
|
+
|
|
5
|
+
## Building
|
|
6
|
+
|
|
7
|
+
Run `nx build customer-center-sdk` to build the library.
|
|
8
|
+
|
|
9
|
+
## Running unit tests
|
|
10
|
+
|
|
11
|
+
Run `nx test customer-center-sdk` to execute the unit tests via [Jest](https://jestjs.io).
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ah-oh/ao-workspaces-api-sdk",
|
|
3
|
+
"version": "1.0.14",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/ah-oh/ao-workspaces.git",
|
|
10
|
+
"directory": "libs/api-sdk"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"tslib": "^2.3.0",
|
|
17
|
+
"@ah-oh/ao-workspaces-types": "^0.0.5"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@nestjs/common": ">=9.0.0",
|
|
21
|
+
"@nestjs/core": ">=9.0.0",
|
|
22
|
+
"axios": ">=1.0.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './lib/guards/auth.guard';
|
|
2
|
+
export * from './lib/guards/szales-basic-auth.guard';
|
|
3
|
+
export * from './lib/guards/permissions.decorator';
|
|
4
|
+
export * from './lib/guards/company.guard';
|
|
5
|
+
export * from './lib/guards/sethub-permissions.guard';
|
|
6
|
+
export * from './lib/guards/super-admin.guard';
|
|
7
|
+
export * from './lib/models/customer-center.options';
|
|
8
|
+
export * from './lib/models/eb-exception';
|
|
9
|
+
export * from './lib/models/sethub-permission.model';
|
|
10
|
+
export * from './lib/models/user-session.model';
|
|
11
|
+
export * from './lib/models/auth.options';
|
|
12
|
+
export * from './lib/models/api-key.model';
|
|
13
|
+
export * from './lib/auth.module';
|
|
14
|
+
export * from './lib/customer-center.service';
|
|
15
|
+
export * from './lib/mail-settings.service';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./lib/guards/auth.guard"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./lib/guards/szales-basic-auth.guard"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./lib/guards/permissions.decorator"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./lib/guards/company.guard"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./lib/guards/sethub-permissions.guard"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./lib/guards/super-admin.guard"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./lib/models/customer-center.options"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./lib/models/eb-exception"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./lib/models/sethub-permission.model"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./lib/models/user-session.model"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./lib/models/auth.options"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./lib/models/api-key.model"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./lib/auth.module"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./lib/customer-center.service"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./lib/mail-settings.service"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/api-sdk/src/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC;AACxC,+EAAqD;AACrD,6EAAmD;AACnD,qEAA2C;AAC3C,gFAAsD;AACtD,yEAA+C;AAE/C,+EAAqD;AACrD,oEAA0C;AAC1C,+EAAqD;AACrD,0EAAgD;AAChD,oEAA0C;AAC1C,qEAA2C;AAE3C,4DAAkC;AAClC,wEAA8C;AAC9C,sEAA4C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AUTH_MODULE = exports.AUTH_TOKEN = exports.AUTH_MODULE_OPTIONS = void 0;
|
|
4
|
+
exports.AUTH_MODULE_OPTIONS = 'AuthModuleOptions';
|
|
5
|
+
exports.AUTH_TOKEN = 'AuthModuleToken';
|
|
6
|
+
exports.AUTH_MODULE = 'AuthModule';
|
|
7
|
+
//# sourceMappingURL=auth.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.constants.js","sourceRoot":"","sources":["../../../../../libs/api-sdk/src/lib/auth.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG,mBAAmB,CAAC;AAC1C,QAAA,UAAU,GAAG,iBAAiB,CAAC;AAC/B,QAAA,WAAW,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { AuthModuleAsyncOptions, AuthModuleOptions } from './models/auth.options';
|
|
3
|
+
export { AUTH_MODULE_OPTIONS, AUTH_TOKEN, AUTH_MODULE } from './auth.constants';
|
|
4
|
+
export declare class AuthModule {
|
|
5
|
+
static forRoot(options: AuthModuleOptions): DynamicModule;
|
|
6
|
+
static forRootAsync(options: AuthModuleAsyncOptions): DynamicModule;
|
|
7
|
+
private static createAsyncProviders;
|
|
8
|
+
private static createAsyncOptionsProvider;
|
|
9
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var AuthModule_1;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AuthModule = exports.AUTH_MODULE = exports.AUTH_TOKEN = exports.AUTH_MODULE_OPTIONS = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const common_1 = require("@nestjs/common");
|
|
7
|
+
const auth_constants_1 = require("./auth.constants");
|
|
8
|
+
const customer_center_service_1 = require("./customer-center.service");
|
|
9
|
+
const mail_settings_service_1 = require("./mail-settings.service");
|
|
10
|
+
var auth_constants_2 = require("./auth.constants");
|
|
11
|
+
Object.defineProperty(exports, "AUTH_MODULE_OPTIONS", { enumerable: true, get: function () { return auth_constants_2.AUTH_MODULE_OPTIONS; } });
|
|
12
|
+
Object.defineProperty(exports, "AUTH_TOKEN", { enumerable: true, get: function () { return auth_constants_2.AUTH_TOKEN; } });
|
|
13
|
+
Object.defineProperty(exports, "AUTH_MODULE", { enumerable: true, get: function () { return auth_constants_2.AUTH_MODULE; } });
|
|
14
|
+
const getAuthOptions = (options) => new customer_center_service_1.CustomerCenterService(options);
|
|
15
|
+
const createAuthProvider = (options) => {
|
|
16
|
+
return {
|
|
17
|
+
provide: auth_constants_1.AUTH_TOKEN,
|
|
18
|
+
useValue: getAuthOptions(options),
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
let AuthModule = AuthModule_1 = class AuthModule {
|
|
22
|
+
static forRoot(options) {
|
|
23
|
+
const provider = createAuthProvider(options);
|
|
24
|
+
return {
|
|
25
|
+
module: AuthModule_1,
|
|
26
|
+
providers: [
|
|
27
|
+
{ provide: auth_constants_1.AUTH_MODULE_OPTIONS, useValue: options },
|
|
28
|
+
provider,
|
|
29
|
+
mail_settings_service_1.MailSettingsService,
|
|
30
|
+
],
|
|
31
|
+
exports: [provider, mail_settings_service_1.MailSettingsService],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
static forRootAsync(options) {
|
|
35
|
+
const provider = {
|
|
36
|
+
inject: [auth_constants_1.AUTH_MODULE_OPTIONS],
|
|
37
|
+
provide: auth_constants_1.AUTH_TOKEN,
|
|
38
|
+
useFactory: async (options) => getAuthOptions(options),
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
module: AuthModule_1,
|
|
42
|
+
imports: options.imports,
|
|
43
|
+
providers: [...this.createAsyncProviders(options), provider, mail_settings_service_1.MailSettingsService],
|
|
44
|
+
exports: [provider, mail_settings_service_1.MailSettingsService],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
static createAsyncProviders(options) {
|
|
48
|
+
if (options.useExisting || options.useFactory) {
|
|
49
|
+
return [this.createAsyncOptionsProvider(options)];
|
|
50
|
+
}
|
|
51
|
+
const useClass = options.useClass;
|
|
52
|
+
return [
|
|
53
|
+
this.createAsyncOptionsProvider(options),
|
|
54
|
+
{
|
|
55
|
+
provide: useClass,
|
|
56
|
+
useClass,
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
static createAsyncOptionsProvider(options) {
|
|
61
|
+
if (options.useFactory) {
|
|
62
|
+
return {
|
|
63
|
+
provide: auth_constants_1.AUTH_MODULE_OPTIONS,
|
|
64
|
+
useFactory: options.useFactory,
|
|
65
|
+
inject: options.inject || [],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const inject = [
|
|
69
|
+
(options.useClass ||
|
|
70
|
+
options.useExisting),
|
|
71
|
+
];
|
|
72
|
+
return {
|
|
73
|
+
provide: auth_constants_1.AUTH_MODULE_OPTIONS,
|
|
74
|
+
useFactory: async (optionsFactory) => await optionsFactory.createHttpModuleOptions(),
|
|
75
|
+
inject,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
exports.AuthModule = AuthModule;
|
|
80
|
+
exports.AuthModule = AuthModule = AuthModule_1 = tslib_1.__decorate([
|
|
81
|
+
(0, common_1.Global)(),
|
|
82
|
+
(0, common_1.Module)({})
|
|
83
|
+
], AuthModule);
|
|
84
|
+
//# sourceMappingURL=auth.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../../../../libs/api-sdk/src/lib/auth.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAA+E;AAE/E,qDAAmE;AACnE,uEAAkE;AAClE,mEAA8D;AAO9D,mDAAgF;AAAvE,qHAAA,mBAAmB,OAAA;AAAE,4GAAA,UAAU,OAAA;AAAE,6GAAA,WAAW,OAAA;AAErD,MAAM,cAAc,GAAG,CAAC,OAA0B,EAAyB,EAAE,CACzE,IAAI,+CAAqB,CAAC,OAAO,CAAC,CAAC;AAEvC,MAAM,kBAAkB,GAAG,CAAC,OAA0B,EAAY,EAAE;IAChE,OAAO;QACH,OAAO,EAAE,2BAAU;QACnB,QAAQ,EAAE,cA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,CAAC;IACN,CAAC;IAEO,MAAM,CAAC,0BAA0B,CACrC,OAA+B;QAE/B,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACrB,OAAO;gBACH,OAAO,EAAE,oCAAmB;gBAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;aAC/B,CAAC;QACN,CAAC;QAED,MAAM,MAAM,GAAG;YACX,CAAC,OAAO,CAAC,QAAQ;gBACb,OAAO,CAAC,WAAW,CAA4B;SACtD,CAAC;QAEF,OAAO;YACH,OAAO,EAAE,oCAAmB;YAC5B,UAAU,EAAE,KAAK,EAAE,cAAiC,EAAE,EAAE,CACpD,MAAM,cAAc,CAAC,uBAAuB,EAAE;YAClD,MAAM;SACT,CAAC;IACN,CAAC;CACJ,CAAA;AAvEY,gCAAU;qBAAV,UAAU;IAFtB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,UAAU,CAuEtB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ApiKey, ApiKeyType } from './models/api-key.model';
|
|
2
|
+
import { AuthModuleOptions } from './models/auth.options';
|
|
3
|
+
import { Product, UserSession } from './models/user-session.model';
|
|
4
|
+
export declare class CustomerCenterService {
|
|
5
|
+
private readonly options;
|
|
6
|
+
private BASE_URL;
|
|
7
|
+
constructor(options: AuthModuleOptions);
|
|
8
|
+
verifyInstanceToken(token: string): Promise<UserSession>;
|
|
9
|
+
sendCompanyRefreshTokenMail(id: string, expiresIn: number): Promise<{
|
|
10
|
+
done: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
tokenSignIn(dto: {
|
|
13
|
+
tokenId: string;
|
|
14
|
+
tokenKey: string;
|
|
15
|
+
product: Product;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
token: string;
|
|
18
|
+
}>;
|
|
19
|
+
getApiKey(args: {
|
|
20
|
+
company: string;
|
|
21
|
+
type: ApiKeyType;
|
|
22
|
+
ip: string;
|
|
23
|
+
authorization: string;
|
|
24
|
+
}): Promise<ApiKey>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomerCenterService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const axios_1 = require("axios");
|
|
7
|
+
const auth_constants_1 = require("./auth.constants");
|
|
8
|
+
const axios_error_handler_1 = require("./utils/axios-error.handler");
|
|
9
|
+
let CustomerCenterService = class CustomerCenterService {
|
|
10
|
+
options;
|
|
11
|
+
BASE_URL = 'https://admin.ah-oh.com';
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.options = options;
|
|
14
|
+
this.BASE_URL = this.options.baseUrl;
|
|
15
|
+
}
|
|
16
|
+
async verifyInstanceToken(token) {
|
|
17
|
+
const options = {
|
|
18
|
+
method: 'GET',
|
|
19
|
+
baseURL: this.BASE_URL,
|
|
20
|
+
url: `/auth-api/auth/verify/${token}`,
|
|
21
|
+
headers: { accept: 'application/json' },
|
|
22
|
+
};
|
|
23
|
+
try {
|
|
24
|
+
const res = await axios_1.default.request(options);
|
|
25
|
+
return res.data;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async sendCompanyRefreshTokenMail(id, expiresIn) {
|
|
32
|
+
const options = {
|
|
33
|
+
method: 'GET',
|
|
34
|
+
baseURL: this.BASE_URL,
|
|
35
|
+
url: `/public/companies/${id}/${expiresIn}/mail`,
|
|
36
|
+
headers: { accept: 'application/json' },
|
|
37
|
+
};
|
|
38
|
+
try {
|
|
39
|
+
const res = await axios_1.default.request(options);
|
|
40
|
+
return res.data;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async tokenSignIn(dto) {
|
|
47
|
+
const options = {
|
|
48
|
+
method: 'POST',
|
|
49
|
+
baseURL: this.BASE_URL,
|
|
50
|
+
url: `/auth-api/token/auth/sign-in`,
|
|
51
|
+
headers: { accept: 'application/json' },
|
|
52
|
+
data: dto,
|
|
53
|
+
};
|
|
54
|
+
try {
|
|
55
|
+
const res = await axios_1.default.request(options);
|
|
56
|
+
return res.data;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async getApiKey(args) {
|
|
63
|
+
const options = {
|
|
64
|
+
method: 'GET',
|
|
65
|
+
baseURL: this.BASE_URL,
|
|
66
|
+
url: `/api-keys/${args.company}/${args.type}/with-key`,
|
|
67
|
+
headers: {
|
|
68
|
+
accept: 'application/json',
|
|
69
|
+
'x-real-ip': args.ip,
|
|
70
|
+
authorization: args.authorization,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
try {
|
|
74
|
+
const res = await axios_1.default.request(options);
|
|
75
|
+
return res.data;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.CustomerCenterService = CustomerCenterService;
|
|
83
|
+
exports.CustomerCenterService = CustomerCenterService = tslib_1.__decorate([
|
|
84
|
+
(0, common_1.Injectable)(),
|
|
85
|
+
tslib_1.__param(0, (0, common_1.Inject)(auth_constants_1.AUTH_MODULE_OPTIONS)),
|
|
86
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
87
|
+
], CustomerCenterService);
|
|
88
|
+
//# sourceMappingURL=customer-center.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customer-center.service.js","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FjC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
+
import { CustomerCenterService } from '../customer-center.service';
|
|
3
|
+
export declare class AuthGuard implements CanActivate {
|
|
4
|
+
private readonly customerCenterService;
|
|
5
|
+
constructor(customerCenterService: CustomerCenterService);
|
|
6
|
+
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthGuard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const auth_module_1 = require("../auth.module");
|
|
7
|
+
const customer_center_service_1 = require("../customer-center.service");
|
|
8
|
+
let AuthGuard = class AuthGuard {
|
|
9
|
+
customerCenterService;
|
|
10
|
+
constructor(customerCenterService) {
|
|
11
|
+
this.customerCenterService = customerCenterService;
|
|
12
|
+
}
|
|
13
|
+
async canActivate(context) {
|
|
14
|
+
const request = context.switchToHttp().getRequest();
|
|
15
|
+
let token = request.headers.dev ??
|
|
16
|
+
request.cookies['jwt'] ??
|
|
17
|
+
request.headers.authorization;
|
|
18
|
+
token = token?.replace('Bearer ', '');
|
|
19
|
+
if (!token?.length) {
|
|
20
|
+
throw new common_1.UnauthorizedException('No authentication token provided');
|
|
21
|
+
}
|
|
22
|
+
request.session = await this.customerCenterService.verifyInstanceToken(token);
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.AuthGuard = AuthGuard;
|
|
27
|
+
exports.AuthGuard = AuthGuard = tslib_1.__decorate([
|
|
28
|
+
(0, common_1.Injectable)(),
|
|
29
|
+
tslib_1.__param(0, (0, common_1.Inject)(auth_module_1.AUTH_TOKEN)),
|
|
30
|
+
tslib_1.__metadata("design:paramtypes", [customer_center_service_1.CustomerCenterService])
|
|
31
|
+
], AuthGuard);
|
|
32
|
+
//# sourceMappingURL=auth.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/guards/auth.guard.ts"],"names":[],"mappings":";;;;AAAA,2CAMwB;AAExB,gDAA4C;AAC5C,wEAAmE;AAG5D,IAAM,SAAS,GAAf,MAAM,SAAS;IAGG;IAFrB,YAEqB,qBAA4C;QAA5C,0BAAqB,GAArB,qBAAqB,CAAuB;IAC9D,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,OAAyB;QACvC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QAEpD,IAAI,KAAK,GACL,OAAO,CAAC,OAAO,CAAC,GAAG;YACnB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;YACtB,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC;QAElC,KAAK,GAAG,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAEtC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,8BAAqB,CAAC,kCAAkC,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,mBAAmB,CAClE,KAAK,CACR,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AA1BY,8BAAS;oBAAT,SAAS;IADrB,IAAA,mBAAU,GAAE;IAGJ,mBAAA,IAAA,eAAM,EAAC,wBAAU,CAAC,CAAA;6CACqB,+CAAqB;GAHxD,SAAS,CA0BrB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyGuard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const user_session_model_1 = require("../models/user-session.model");
|
|
7
|
+
let CompanyGuard = class CompanyGuard {
|
|
8
|
+
async canActivate(context) {
|
|
9
|
+
const request = context.switchToHttp().getRequest();
|
|
10
|
+
const companyId = request.params.companyId;
|
|
11
|
+
const session = request.session;
|
|
12
|
+
if (user_session_model_1.AllAccessRoles.includes(session.role) ||
|
|
13
|
+
(companyId && session.enabledCompanies?.includes(companyId))) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
throw new common_1.HttpException('Missing permission', common_1.HttpStatus.BAD_REQUEST);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.CompanyGuard = CompanyGuard;
|
|
20
|
+
exports.CompanyGuard = CompanyGuard = tslib_1.__decorate([
|
|
21
|
+
(0, common_1.Injectable)()
|
|
22
|
+
], CompanyGuard);
|
|
23
|
+
//# sourceMappingURL=company.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"company.guard.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/guards/company.guard.ts"],"names":[],"mappings":";;;;AAAA,2CAMwB;AAExB,qEAA2E;AAGpE,IAAM,YAAY,GAAlB,MAAM,YAAY;IACrB,KAAK,CAAC,WAAW,CAAC,OAAyB;QACvC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QAEpD,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;QAC3C,MAAM,OAAO,GAAgB,OAAO,CAAC,OAAO,CAAC;QAC7C,IACI,mCAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;YACrC,CAAC,SAAS,IAAI,OAAO,CAAC,gBAAgB,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,EAC9D,CAAC;YACC,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,IAAI,sBAAa,CAAC,oBAAoB,EAAE,mBAAU,CAAC,WAAW,CAAC,CAAC;IAC1E,CAAC;CACJ,CAAA;AAfY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAexB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Permissions = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const Permissions = (...permissions) => (0, common_1.SetMetadata)('permissions', permissions);
|
|
6
|
+
exports.Permissions = Permissions;
|
|
7
|
+
//# sourceMappingURL=permissions.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.decorator.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/guards/permissions.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;AAEvD,MAAM,WAAW,GAAG,CAAC,GAAG,WAAqB,EAA2B,EAAE,CAC7E,IAAA,oBAAW,EAAC,aAAa,EAAE,WAAW,CAAC,CAAC;AAD/B,QAAA,WAAW,eACoB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
+
import { Reflector } from '@nestjs/core';
|
|
3
|
+
export declare class SetHubPermissionsGuard implements CanActivate {
|
|
4
|
+
private reflector;
|
|
5
|
+
constructor(reflector: Reflector);
|
|
6
|
+
canActivate(context: ExecutionContext): boolean;
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetHubPermissionsGuard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const core_1 = require("@nestjs/core");
|
|
7
|
+
const user_session_model_1 = require("../models/user-session.model");
|
|
8
|
+
let SetHubPermissionsGuard = class SetHubPermissionsGuard {
|
|
9
|
+
reflector;
|
|
10
|
+
constructor(reflector) {
|
|
11
|
+
this.reflector = reflector;
|
|
12
|
+
}
|
|
13
|
+
canActivate(context) {
|
|
14
|
+
const permissions = this.reflector.get('permissions', context.getHandler());
|
|
15
|
+
if (!permissions) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
const request = context.switchToHttp().getRequest();
|
|
19
|
+
const { setHubPermission, product, role } = request.session;
|
|
20
|
+
if (user_session_model_1.AllAccessRoles.includes(role) ||
|
|
21
|
+
(setHubPermission &&
|
|
22
|
+
product === user_session_model_1.Product.SETHUB &&
|
|
23
|
+
permissions.every((p) => setHubPermission[p] === true))) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
throw new common_1.HttpException('Missing permission', common_1.HttpStatus.UNAUTHORIZED);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.SetHubPermissionsGuard = SetHubPermissionsGuard;
|
|
30
|
+
exports.SetHubPermissionsGuard = SetHubPermissionsGuard = tslib_1.__decorate([
|
|
31
|
+
(0, common_1.Injectable)(),
|
|
32
|
+
tslib_1.__metadata("design:paramtypes", [core_1.Reflector])
|
|
33
|
+
], SetHubPermissionsGuard);
|
|
34
|
+
//# sourceMappingURL=sethub-permissions.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sethub-permissions.guard.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/guards/sethub-permissions.guard.ts"],"names":[],"mappings":";;;;AAAA,2CAMwB;AACxB,uCAAyC;AAGzC,qEAAuE;AAGhE,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACX;IAApB,YAAoB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAE5C,WAAW,CAAC,OAAyB;QACjC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAClC,aAAa,EACb,OAAO,CAAC,UAAU,EAAE,CACvB,CAAC;QACF,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QACpD,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;QAE5D,IACI,mCAAc,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC7B,CAAC,gBAAgB;gBACb,OAAO,KAAK,4BAAO,CAAC,MAAM;gBAC1B,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,EAC7D,CAAC;YACC,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,IAAI,sBAAa,CAAC,oBAAoB,EAAE,mBAAU,CAAC,YAAY,CAAC,CAAC;IAC3E,CAAC;CACJ,CAAA;AAzBY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;6CAEsB,gBAAS;GAD/B,sBAAsB,CAyBlC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SuperAdminGuard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const user_session_model_1 = require("../models/user-session.model");
|
|
7
|
+
let SuperAdminGuard = class SuperAdminGuard {
|
|
8
|
+
async canActivate(context) {
|
|
9
|
+
const request = context.switchToHttp().getRequest();
|
|
10
|
+
const session = request.session;
|
|
11
|
+
if (user_session_model_1.AllAccessRoles.includes(session.role)) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
throw new common_1.HttpException('Missing permission', common_1.HttpStatus.BAD_REQUEST);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.SuperAdminGuard = SuperAdminGuard;
|
|
18
|
+
exports.SuperAdminGuard = SuperAdminGuard = tslib_1.__decorate([
|
|
19
|
+
(0, common_1.Injectable)()
|
|
20
|
+
], SuperAdminGuard);
|
|
21
|
+
//# sourceMappingURL=super-admin.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"super-admin.guard.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/guards/super-admin.guard.ts"],"names":[],"mappings":";;;;AAAA,2CAMwB;AAExB,qEAA2E;AAGpE,IAAM,eAAe,GAArB,MAAM,eAAe;IACxB,KAAK,CAAC,WAAW,CAAC,OAAyB;QACvC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QAEpD,MAAM,OAAO,GAAgB,OAAO,CAAC,OAAO,CAAC;QAC7C,IAAI,mCAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,IAAI,sBAAa,CAAC,oBAAoB,EAAE,mBAAU,CAAC,WAAW,CAAC,CAAC;IAC1E,CAAC;CACJ,CAAA;AAXY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;GACA,eAAe,CAW3B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
+
import { CustomerCenterService } from '../customer-center.service';
|
|
3
|
+
export declare class SzalesBasicAuthGuard implements CanActivate {
|
|
4
|
+
private readonly customerCenterService;
|
|
5
|
+
constructor(customerCenterService: CustomerCenterService);
|
|
6
|
+
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SzalesBasicAuthGuard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const auth_module_1 = require("../auth.module");
|
|
7
|
+
const customer_center_service_1 = require("../customer-center.service");
|
|
8
|
+
const user_session_model_1 = require("../models/user-session.model");
|
|
9
|
+
let SzalesBasicAuthGuard = class SzalesBasicAuthGuard {
|
|
10
|
+
customerCenterService;
|
|
11
|
+
constructor(customerCenterService) {
|
|
12
|
+
this.customerCenterService = customerCenterService;
|
|
13
|
+
}
|
|
14
|
+
async canActivate(context) {
|
|
15
|
+
const request = context.switchToHttp().getRequest();
|
|
16
|
+
const authHeader = request.headers.authorization;
|
|
17
|
+
if (!authHeader) {
|
|
18
|
+
throw new common_1.UnauthorizedException('Missing authorization header');
|
|
19
|
+
}
|
|
20
|
+
if (authHeader.startsWith('Basic ')) {
|
|
21
|
+
const base64Credentials = authHeader.substring(6);
|
|
22
|
+
const credentials = Buffer.from(base64Credentials, 'base64').toString('utf8');
|
|
23
|
+
console.log(credentials);
|
|
24
|
+
const [username, password] = credentials.split(':');
|
|
25
|
+
const { token } = await this.customerCenterService.tokenSignIn({
|
|
26
|
+
tokenId: username,
|
|
27
|
+
tokenKey: password,
|
|
28
|
+
product: user_session_model_1.Product.SZALES,
|
|
29
|
+
});
|
|
30
|
+
request.session =
|
|
31
|
+
await this.customerCenterService.verifyInstanceToken(token);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
throw new common_1.UnauthorizedException('Invalid API key');
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.SzalesBasicAuthGuard = SzalesBasicAuthGuard;
|
|
38
|
+
exports.SzalesBasicAuthGuard = SzalesBasicAuthGuard = tslib_1.__decorate([
|
|
39
|
+
(0, common_1.Injectable)(),
|
|
40
|
+
tslib_1.__param(0, (0, common_1.Inject)(auth_module_1.AUTH_TOKEN)),
|
|
41
|
+
tslib_1.__metadata("design:paramtypes", [customer_center_service_1.CustomerCenterService])
|
|
42
|
+
], SzalesBasicAuthGuard);
|
|
43
|
+
//# sourceMappingURL=szales-basic-auth.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"szales-basic-auth.guard.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/guards/szales-basic-auth.guard.ts"],"names":[],"mappings":";;;;AAAA,2CAMwB;AAExB,gDAA4C;AAC5C,wEAAmE;AACnE,qEAAuD;AAGhD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAGR;IAFrB,YAEqB,qBAA4C;QAA5C,0BAAqB,GAArB,qBAAqB,CAAuB;IAC9D,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,OAAyB;QACvC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QACpD,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC;QAEjD,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,MAAM,IAAI,8BAAqB,CAAC,8BAA8B,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClC,MAAM,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAClD,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAC3B,iBAAiB,EACjB,QAAQ,CACX,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAEnB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAEzB,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAEpD,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC;gBAC3D,OAAO,EAAE,QAAQ;gBACjB,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,4BAAO,CAAC,MAAM;aAC1B,CAAC,CAAC;YAEH,OAAO,CAAC,OAAO;gBACX,MAAM,IAAI,CAAC,qBAAqB,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YAEhE,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,IAAI,8BAAqB,CAAC,iBAAiB,CAAC,CAAC;IACvD,CAAC;CACJ,CAAA;AAtCY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAGJ,mBAAA,IAAA,eAAM,EAAC,wBAAU,CAAC,CAAA;6CACqB,+CAAqB;GAHxD,oBAAoB,CAsChC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { IMailConnectionTestResult, IMailSetting, IMicrosoftMailFolder, IMicrosoftMailListResponse, IMicrosoftMailMessage, IMicrosoftMailMessageDetail } from '@ah-oh/ao-workspaces-types';
|
|
2
|
+
import { AuthModuleOptions } from './models/auth.options';
|
|
3
|
+
interface ListMessagesQuery {
|
|
4
|
+
top?: number;
|
|
5
|
+
skip?: number;
|
|
6
|
+
filter?: string;
|
|
7
|
+
search?: string;
|
|
8
|
+
folderId?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class MailSettingsService {
|
|
11
|
+
private readonly options;
|
|
12
|
+
private readonly BASE_URL;
|
|
13
|
+
constructor(options: AuthModuleOptions);
|
|
14
|
+
findMailSettings(args: {
|
|
15
|
+
companyId: string;
|
|
16
|
+
authorization: string;
|
|
17
|
+
}): Promise<IMailSetting[]>;
|
|
18
|
+
findOneMailSetting(args: {
|
|
19
|
+
companyId: string;
|
|
20
|
+
id: string;
|
|
21
|
+
authorization: string;
|
|
22
|
+
}): Promise<IMailSetting>;
|
|
23
|
+
createMailSetting(args: {
|
|
24
|
+
companyId: string;
|
|
25
|
+
dto: Record<string, unknown>;
|
|
26
|
+
authorization: string;
|
|
27
|
+
}): Promise<IMailSetting>;
|
|
28
|
+
updateMailSetting(args: {
|
|
29
|
+
companyId: string;
|
|
30
|
+
id: string;
|
|
31
|
+
dto: Record<string, unknown>;
|
|
32
|
+
authorization: string;
|
|
33
|
+
}): Promise<IMailSetting>;
|
|
34
|
+
deleteMailSetting(args: {
|
|
35
|
+
companyId: string;
|
|
36
|
+
id: string;
|
|
37
|
+
authorization: string;
|
|
38
|
+
}): Promise<IMailSetting>;
|
|
39
|
+
setMicrosoftRefreshToken(args: {
|
|
40
|
+
companyId: string;
|
|
41
|
+
mailSettingId: string;
|
|
42
|
+
accessCode: string;
|
|
43
|
+
authorization: string;
|
|
44
|
+
}): Promise<IMailSetting>;
|
|
45
|
+
testConnection(args: {
|
|
46
|
+
companyId: string;
|
|
47
|
+
dto: Record<string, unknown>;
|
|
48
|
+
authorization: string;
|
|
49
|
+
}): Promise<IMailConnectionTestResult>;
|
|
50
|
+
testSendMicrosoft(args: {
|
|
51
|
+
companyId: string;
|
|
52
|
+
mailSettingId: string;
|
|
53
|
+
receiver: string;
|
|
54
|
+
authorization: string;
|
|
55
|
+
}): Promise<IMailConnectionTestResult>;
|
|
56
|
+
sendMail(args: {
|
|
57
|
+
companyId: string;
|
|
58
|
+
mailSettingId: string;
|
|
59
|
+
dto: Record<string, unknown>;
|
|
60
|
+
authorization: string;
|
|
61
|
+
}): Promise<unknown>;
|
|
62
|
+
listFolders(args: {
|
|
63
|
+
companyId: string;
|
|
64
|
+
mailSettingId: string;
|
|
65
|
+
authorization: string;
|
|
66
|
+
}): Promise<IMicrosoftMailFolder[]>;
|
|
67
|
+
listMessages(args: {
|
|
68
|
+
companyId: string;
|
|
69
|
+
mailSettingId: string;
|
|
70
|
+
query?: ListMessagesQuery;
|
|
71
|
+
authorization: string;
|
|
72
|
+
}): Promise<IMicrosoftMailListResponse>;
|
|
73
|
+
getMessage(args: {
|
|
74
|
+
companyId: string;
|
|
75
|
+
mailSettingId: string;
|
|
76
|
+
messageId: string;
|
|
77
|
+
authorization: string;
|
|
78
|
+
}): Promise<IMicrosoftMailMessageDetail>;
|
|
79
|
+
markAsRead(args: {
|
|
80
|
+
companyId: string;
|
|
81
|
+
mailSettingId: string;
|
|
82
|
+
messageId: string;
|
|
83
|
+
authorization: string;
|
|
84
|
+
}): Promise<void>;
|
|
85
|
+
deleteMessage(args: {
|
|
86
|
+
companyId: string;
|
|
87
|
+
mailSettingId: string;
|
|
88
|
+
messageId: string;
|
|
89
|
+
authorization: string;
|
|
90
|
+
}): Promise<void>;
|
|
91
|
+
moveMessage(args: {
|
|
92
|
+
companyId: string;
|
|
93
|
+
mailSettingId: string;
|
|
94
|
+
messageId: string;
|
|
95
|
+
destinationFolderId: string;
|
|
96
|
+
authorization: string;
|
|
97
|
+
}): Promise<IMicrosoftMailMessage>;
|
|
98
|
+
}
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MailSettingsService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const axios_1 = require("axios");
|
|
7
|
+
const auth_constants_1 = require("./auth.constants");
|
|
8
|
+
const axios_error_handler_1 = require("./utils/axios-error.handler");
|
|
9
|
+
let MailSettingsService = class MailSettingsService {
|
|
10
|
+
options;
|
|
11
|
+
BASE_URL;
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.options = options;
|
|
14
|
+
this.BASE_URL = this.options.baseUrl;
|
|
15
|
+
}
|
|
16
|
+
async findMailSettings(args) {
|
|
17
|
+
const config = {
|
|
18
|
+
method: 'GET',
|
|
19
|
+
baseURL: this.BASE_URL,
|
|
20
|
+
url: `/mail-settings/${args.companyId}`,
|
|
21
|
+
headers: {
|
|
22
|
+
accept: 'application/json',
|
|
23
|
+
authorization: args.authorization,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
try {
|
|
27
|
+
const res = await axios_1.default.request(config);
|
|
28
|
+
return res.data;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async findOneMailSetting(args) {
|
|
35
|
+
const config = {
|
|
36
|
+
method: 'GET',
|
|
37
|
+
baseURL: this.BASE_URL,
|
|
38
|
+
url: `/mail-settings/${args.companyId}/${args.id}`,
|
|
39
|
+
headers: {
|
|
40
|
+
accept: 'application/json',
|
|
41
|
+
authorization: args.authorization,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
try {
|
|
45
|
+
const res = await axios_1.default.request(config);
|
|
46
|
+
return res.data;
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async createMailSetting(args) {
|
|
53
|
+
const config = {
|
|
54
|
+
method: 'PUT',
|
|
55
|
+
baseURL: this.BASE_URL,
|
|
56
|
+
url: `/mail-settings/${args.companyId}`,
|
|
57
|
+
headers: {
|
|
58
|
+
accept: 'application/json',
|
|
59
|
+
authorization: args.authorization,
|
|
60
|
+
},
|
|
61
|
+
data: args.dto,
|
|
62
|
+
};
|
|
63
|
+
try {
|
|
64
|
+
const res = await axios_1.default.request(config);
|
|
65
|
+
return res.data;
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async updateMailSetting(args) {
|
|
72
|
+
const config = {
|
|
73
|
+
method: 'POST',
|
|
74
|
+
baseURL: this.BASE_URL,
|
|
75
|
+
url: `/mail-settings/${args.companyId}/${args.id}`,
|
|
76
|
+
headers: {
|
|
77
|
+
accept: 'application/json',
|
|
78
|
+
authorization: args.authorization,
|
|
79
|
+
},
|
|
80
|
+
data: args.dto,
|
|
81
|
+
};
|
|
82
|
+
try {
|
|
83
|
+
const res = await axios_1.default.request(config);
|
|
84
|
+
return res.data;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async deleteMailSetting(args) {
|
|
91
|
+
const config = {
|
|
92
|
+
method: 'DELETE',
|
|
93
|
+
baseURL: this.BASE_URL,
|
|
94
|
+
url: `/mail-settings/${args.companyId}/${args.id}`,
|
|
95
|
+
headers: {
|
|
96
|
+
accept: 'application/json',
|
|
97
|
+
authorization: args.authorization,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
try {
|
|
101
|
+
const res = await axios_1.default.request(config);
|
|
102
|
+
return res.data;
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async setMicrosoftRefreshToken(args) {
|
|
109
|
+
const config = {
|
|
110
|
+
method: 'POST',
|
|
111
|
+
baseURL: this.BASE_URL,
|
|
112
|
+
url: `/mail-settings/${args.companyId}/${args.mailSettingId}/microsoft-refresh-token`,
|
|
113
|
+
headers: {
|
|
114
|
+
accept: 'application/json',
|
|
115
|
+
authorization: args.authorization,
|
|
116
|
+
},
|
|
117
|
+
data: { accessCode: args.accessCode },
|
|
118
|
+
};
|
|
119
|
+
try {
|
|
120
|
+
const res = await axios_1.default.request(config);
|
|
121
|
+
return res.data;
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async testConnection(args) {
|
|
128
|
+
const config = {
|
|
129
|
+
method: 'POST',
|
|
130
|
+
baseURL: this.BASE_URL,
|
|
131
|
+
url: `/mail-settings/${args.companyId}/test-connection`,
|
|
132
|
+
headers: {
|
|
133
|
+
accept: 'application/json',
|
|
134
|
+
authorization: args.authorization,
|
|
135
|
+
},
|
|
136
|
+
data: args.dto,
|
|
137
|
+
};
|
|
138
|
+
try {
|
|
139
|
+
const res = await axios_1.default.request(config);
|
|
140
|
+
return res.data;
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async testSendMicrosoft(args) {
|
|
147
|
+
const config = {
|
|
148
|
+
method: 'POST',
|
|
149
|
+
baseURL: this.BASE_URL,
|
|
150
|
+
url: `/mail-settings/${args.companyId}/test-send-microsoft`,
|
|
151
|
+
headers: {
|
|
152
|
+
accept: 'application/json',
|
|
153
|
+
authorization: args.authorization,
|
|
154
|
+
},
|
|
155
|
+
data: {
|
|
156
|
+
mailSettingId: args.mailSettingId,
|
|
157
|
+
receiver: args.receiver,
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
try {
|
|
161
|
+
const res = await axios_1.default.request(config);
|
|
162
|
+
return res.data;
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
async sendMail(args) {
|
|
169
|
+
const config = {
|
|
170
|
+
method: 'POST',
|
|
171
|
+
baseURL: this.BASE_URL,
|
|
172
|
+
url: `/mail-settings/${args.companyId}/${args.mailSettingId}/send-mail`,
|
|
173
|
+
headers: {
|
|
174
|
+
accept: 'application/json',
|
|
175
|
+
authorization: args.authorization,
|
|
176
|
+
},
|
|
177
|
+
data: args.dto,
|
|
178
|
+
};
|
|
179
|
+
try {
|
|
180
|
+
const res = await axios_1.default.request(config);
|
|
181
|
+
return res.data;
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
async listFolders(args) {
|
|
188
|
+
const config = {
|
|
189
|
+
method: 'GET',
|
|
190
|
+
baseURL: this.BASE_URL,
|
|
191
|
+
url: `/mail-settings/${args.companyId}/${args.mailSettingId}/folders`,
|
|
192
|
+
headers: {
|
|
193
|
+
accept: 'application/json',
|
|
194
|
+
authorization: args.authorization,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
try {
|
|
198
|
+
const res = await axios_1.default.request(config);
|
|
199
|
+
return res.data;
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
async listMessages(args) {
|
|
206
|
+
const config = {
|
|
207
|
+
method: 'GET',
|
|
208
|
+
baseURL: this.BASE_URL,
|
|
209
|
+
url: `/mail-settings/${args.companyId}/${args.mailSettingId}/messages`,
|
|
210
|
+
headers: {
|
|
211
|
+
accept: 'application/json',
|
|
212
|
+
authorization: args.authorization,
|
|
213
|
+
},
|
|
214
|
+
params: args.query,
|
|
215
|
+
};
|
|
216
|
+
try {
|
|
217
|
+
const res = await axios_1.default.request(config);
|
|
218
|
+
return res.data;
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
async getMessage(args) {
|
|
225
|
+
const config = {
|
|
226
|
+
method: 'GET',
|
|
227
|
+
baseURL: this.BASE_URL,
|
|
228
|
+
url: `/mail-settings/${args.companyId}/${args.mailSettingId}/messages/${args.messageId}`,
|
|
229
|
+
headers: {
|
|
230
|
+
accept: 'application/json',
|
|
231
|
+
authorization: args.authorization,
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
try {
|
|
235
|
+
const res = await axios_1.default.request(config);
|
|
236
|
+
return res.data;
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
async markAsRead(args) {
|
|
243
|
+
const config = {
|
|
244
|
+
method: 'PATCH',
|
|
245
|
+
baseURL: this.BASE_URL,
|
|
246
|
+
url: `/mail-settings/${args.companyId}/${args.mailSettingId}/messages/${args.messageId}/read`,
|
|
247
|
+
headers: {
|
|
248
|
+
accept: 'application/json',
|
|
249
|
+
authorization: args.authorization,
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
try {
|
|
253
|
+
await axios_1.default.request(config);
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
async deleteMessage(args) {
|
|
260
|
+
const config = {
|
|
261
|
+
method: 'DELETE',
|
|
262
|
+
baseURL: this.BASE_URL,
|
|
263
|
+
url: `/mail-settings/${args.companyId}/${args.mailSettingId}/messages/${args.messageId}`,
|
|
264
|
+
headers: {
|
|
265
|
+
accept: 'application/json',
|
|
266
|
+
authorization: args.authorization,
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
try {
|
|
270
|
+
await axios_1.default.request(config);
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
async moveMessage(args) {
|
|
277
|
+
const config = {
|
|
278
|
+
method: 'POST',
|
|
279
|
+
baseURL: this.BASE_URL,
|
|
280
|
+
url: `/mail-settings/${args.companyId}/${args.mailSettingId}/messages/${args.messageId}/move`,
|
|
281
|
+
headers: {
|
|
282
|
+
accept: 'application/json',
|
|
283
|
+
authorization: args.authorization,
|
|
284
|
+
},
|
|
285
|
+
data: { destinationFolderId: args.destinationFolderId },
|
|
286
|
+
};
|
|
287
|
+
try {
|
|
288
|
+
const res = await axios_1.default.request(config);
|
|
289
|
+
return res.data;
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
(0, axios_error_handler_1.handleAxiosError)(error);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
exports.MailSettingsService = MailSettingsService;
|
|
297
|
+
exports.MailSettingsService = MailSettingsService = tslib_1.__decorate([
|
|
298
|
+
(0, common_1.Injectable)(),
|
|
299
|
+
tslib_1.__param(0, (0, common_1.Inject)(auth_constants_1.AUTH_MODULE_OPTIONS)),
|
|
300
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
301
|
+
], MailSettingsService);
|
|
302
|
+
//# sourceMappingURL=mail-settings.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mail-settings.service.js","sourceRoot":"","sources":["../../../../../libs/api-sdk/src/lib/mail-settings.service.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AACpD,iCAAkD;AAUlD,qDAAuD;AAEvD,qEAA+D;AAWxD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAKX;IAJF,QAAQ,CAAS;IAElC,YAEmB,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;QAE3C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,IAG7B;QACC,MAAM,MAAM,GAAuB;YACjC,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,GAAG,EAAE,kBAAkB,IAAI,CAAC,SAAS,EAAE;YACvC,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,aAAa,EAAE,IAAI,CAAC,aAAa;aAClC;SACF,CAAC;QACF,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,OAAO,CAAiB,MAAM,CAAC,CAAC;YACxD,OAAO,GAAG,CAAC,IAAI,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAA,sCAAgB,EAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,IAI/B;QACC,MAAM,MAAM,GAAuB;YACjC,MAAM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I,EAAE,EAAE,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE;SACxD,CAAC;QACF,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,OAAO,CAAwB,MAAM,CAAC,CAAC;YAC/D,OAAO,GAAG,CAAC,IAAI,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAA,sCAAgB,EAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;CACF,CAAA;AArWY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAKR,mBAAA,IAAA,eAAM,EAAC,oCAAmB,CAAC,CAAA;;GAJnB,mBAAmB,CAqW/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ApiKeyType, IApiKey as ApiKey } from '@ah-oh/ao-workspaces-types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiKeyType = void 0;
|
|
4
|
+
var ao_workspaces_types_1 = require("@ah-oh/ao-workspaces-types");
|
|
5
|
+
Object.defineProperty(exports, "ApiKeyType", { enumerable: true, get: function () { return ao_workspaces_types_1.ApiKeyType; } });
|
|
6
|
+
//# sourceMappingURL=api-key.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key.model.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/models/api-key.model.ts"],"names":[],"mappings":";;;AAAA,kEAA2E;AAAlE,iHAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InjectionToken, ModuleMetadata, Type } from '@nestjs/common';
|
|
2
|
+
export interface AuthModuleOptions {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
}
|
|
5
|
+
export interface AuthModuleFactory {
|
|
6
|
+
createHttpModuleOptions: () => Promise<AuthModuleOptions> | AuthModuleOptions;
|
|
7
|
+
}
|
|
8
|
+
export interface AuthModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
|
9
|
+
inject?: InjectionToken[];
|
|
10
|
+
useClass?: Type<AuthModuleFactory>;
|
|
11
|
+
useExisting?: Type<AuthModuleFactory>;
|
|
12
|
+
useFactory?: (...args: any[]) => Promise<AuthModuleOptions> | AuthModuleOptions;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.options.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/models/auth.options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customer-center.options.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/models/customer-center.options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HttpException, HttpStatus } from '@nestjs/common';
|
|
2
|
+
export interface EbExceptionMessage {
|
|
3
|
+
type: 'error' | 'warning';
|
|
4
|
+
message: string;
|
|
5
|
+
formFields?: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare class EbException extends HttpException {
|
|
8
|
+
constructor(message: EbExceptionMessage, status: HttpStatus);
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EbException = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
class EbException extends common_1.HttpException {
|
|
6
|
+
constructor(message, status) {
|
|
7
|
+
super(message, status);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.EbException = EbException;
|
|
11
|
+
//# sourceMappingURL=eb-exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eb-exception.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/models/eb-exception.ts"],"names":[],"mappings":";;;AAAA,2CAA2D;AAQ3D,MAAa,WAAY,SAAQ,sBAAa;IAC1C,YAAY,OAA2B,EAAE,MAAkB;QACvD,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3B,CAAC;CACJ;AAJD,kCAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SetHubPermissionKey as SetHubPermission } from '@ah-oh/ao-workspaces-types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetHubPermission = void 0;
|
|
4
|
+
var ao_workspaces_types_1 = require("@ah-oh/ao-workspaces-types");
|
|
5
|
+
Object.defineProperty(exports, "SetHubPermission", { enumerable: true, get: function () { return ao_workspaces_types_1.SetHubPermissionKey; } });
|
|
6
|
+
//# sourceMappingURL=sethub-permission.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sethub-permission.model.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/models/sethub-permission.model.ts"],"names":[],"mappings":";;;AAAA,kEAAqF;AAA5E,uHAAA,mBAAmB,OAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AccessRole, AllAccessRoles, AdminAccessRoles, UserAccessRoles, Product, UserStatus, SetHubPermissionKey as SetHubPermission, IUserSession as UserSession, } from '@ah-oh/ao-workspaces-types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetHubPermission = exports.UserStatus = exports.Product = exports.UserAccessRoles = exports.AdminAccessRoles = exports.AllAccessRoles = exports.AccessRole = void 0;
|
|
4
|
+
var ao_workspaces_types_1 = require("@ah-oh/ao-workspaces-types");
|
|
5
|
+
Object.defineProperty(exports, "AccessRole", { enumerable: true, get: function () { return ao_workspaces_types_1.AccessRole; } });
|
|
6
|
+
Object.defineProperty(exports, "AllAccessRoles", { enumerable: true, get: function () { return ao_workspaces_types_1.AllAccessRoles; } });
|
|
7
|
+
Object.defineProperty(exports, "AdminAccessRoles", { enumerable: true, get: function () { return ao_workspaces_types_1.AdminAccessRoles; } });
|
|
8
|
+
Object.defineProperty(exports, "UserAccessRoles", { enumerable: true, get: function () { return ao_workspaces_types_1.UserAccessRoles; } });
|
|
9
|
+
Object.defineProperty(exports, "Product", { enumerable: true, get: function () { return ao_workspaces_types_1.Product; } });
|
|
10
|
+
Object.defineProperty(exports, "UserStatus", { enumerable: true, get: function () { return ao_workspaces_types_1.UserStatus; } });
|
|
11
|
+
Object.defineProperty(exports, "SetHubPermission", { enumerable: true, get: function () { return ao_workspaces_types_1.SetHubPermissionKey; } });
|
|
12
|
+
//# sourceMappingURL=user-session.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-session.model.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/models/user-session.model.ts"],"names":[],"mappings":";;;AAAA,kEASoC;AARhC,iHAAA,UAAU,OAAA;AACV,qHAAA,cAAc,OAAA;AACd,uHAAA,gBAAgB,OAAA;AAChB,sHAAA,eAAe,OAAA;AACf,8GAAA,OAAO,OAAA;AACP,iHAAA,UAAU,OAAA;AACV,uHAAA,mBAAmB,OAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleAxiosError(error: unknown): never;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleAxiosError = handleAxiosError;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const axios_1 = require("axios");
|
|
6
|
+
function handleAxiosError(error) {
|
|
7
|
+
if (error instanceof axios_1.AxiosError) {
|
|
8
|
+
const status = error.response?.status ?? common_1.HttpStatus.BAD_GATEWAY;
|
|
9
|
+
const message = error.response?.data?.message ?? error.message;
|
|
10
|
+
throw new common_1.HttpException(message, status);
|
|
11
|
+
}
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=axios-error.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios-error.handler.js","sourceRoot":"","sources":["../../../../../../libs/api-sdk/src/lib/utils/axios-error.handler.ts"],"names":[],"mappings":";;AAGA,4CAOC;AAVD,2CAA2D;AAC3D,iCAAmC;AAEnC,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,IAAI,KAAK,YAAY,kBAAU,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,MAAM,IAAI,mBAAU,CAAC,WAAW,CAAC;QAChE,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC;QAC/D,MAAM,IAAI,sBAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,KAAK,CAAC;AACd,CAAC"}
|