@snugdesk/core 0.2.4 → 0.2.5
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/fesm2022/snugdesk-core-src-lib-models-dynamodb.mjs +25 -0
- package/fesm2022/snugdesk-core-src-lib-models-dynamodb.mjs.map +1 -0
- package/fesm2022/snugdesk-core.mjs +214 -108
- package/fesm2022/snugdesk-core.mjs.map +1 -1
- package/index.d.ts +52 -31
- package/package.json +5 -1
- package/src/lib/models/dynamodb/index.d.ts +176 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var ModelAttributeTypes;
|
|
2
|
+
(function (ModelAttributeTypes) {
|
|
3
|
+
ModelAttributeTypes["binary"] = "binary";
|
|
4
|
+
ModelAttributeTypes["binarySet"] = "binarySet";
|
|
5
|
+
ModelAttributeTypes["bool"] = "bool";
|
|
6
|
+
ModelAttributeTypes["list"] = "list";
|
|
7
|
+
ModelAttributeTypes["map"] = "map";
|
|
8
|
+
ModelAttributeTypes["number"] = "number";
|
|
9
|
+
ModelAttributeTypes["numberSet"] = "numberSet";
|
|
10
|
+
ModelAttributeTypes["string"] = "string";
|
|
11
|
+
ModelAttributeTypes["stringSet"] = "stringSet";
|
|
12
|
+
ModelAttributeTypes["_null"] = "_null";
|
|
13
|
+
})(ModelAttributeTypes || (ModelAttributeTypes = {}));
|
|
14
|
+
var ModelSortDirection;
|
|
15
|
+
(function (ModelSortDirection) {
|
|
16
|
+
ModelSortDirection["ASC"] = "ASC";
|
|
17
|
+
ModelSortDirection["DESC"] = "DESC";
|
|
18
|
+
})(ModelSortDirection || (ModelSortDirection = {}));
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Generated bundle index. Do not edit.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export { ModelAttributeTypes, ModelSortDirection };
|
|
25
|
+
//# sourceMappingURL=snugdesk-core-src-lib-models-dynamodb.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snugdesk-core-src-lib-models-dynamodb.mjs","sources":["../../../projects/snugdesk-core/src/lib/models/dynamodb/common.model.ts","../../../projects/snugdesk-core/src/lib/models/dynamodb/snugdesk-core-src-lib-models-dynamodb.ts"],"sourcesContent":["import { GraphQLResult } from '@aws-amplify/api-graphql';\n\nexport enum ModelAttributeTypes {\n binary = 'binary',\n binarySet = 'binarySet',\n bool = 'bool',\n list = 'list',\n map = 'map',\n number = 'number',\n numberSet = 'numberSet',\n string = 'string',\n stringSet = 'stringSet',\n _null = '_null',\n}\n\nexport enum ModelSortDirection {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport type ModelSizeInput = {\n ne?: number | null;\n eq?: number | null;\n le?: number | null;\n lt?: number | null;\n ge?: number | null;\n gt?: number | null;\n between?: Array<number | null> | null;\n};\n\nexport type ModelBooleanInput = {\n ne?: boolean | null;\n eq?: boolean | null;\n attributeExists?: boolean | null;\n attributeType?: ModelAttributeTypes | null;\n};\n\nexport type ModelIDInput = {\n ne?: string | null;\n eq?: string | null;\n le?: string | null;\n lt?: string | null;\n ge?: string | null;\n gt?: string | null;\n contains?: string | null;\n notContains?: string | null;\n between?: Array<string | null> | null;\n beginsWith?: string | null;\n attributeExists?: boolean | null;\n attributeType?: ModelAttributeTypes | null;\n size?: ModelSizeInput | null;\n};\n\nexport type ModelIntInput = {\n ne?: number | null;\n eq?: number | null;\n le?: number | null;\n lt?: number | null;\n ge?: number | null;\n gt?: number | null;\n between?: Array<number | null> | null;\n attributeExists?: boolean | null;\n attributeType?: ModelAttributeTypes | null;\n};\n\nexport type ModelStringInput = {\n ne?: string | null;\n eq?: string | null;\n le?: string | null;\n lt?: string | null;\n ge?: string | null;\n gt?: string | null;\n contains?: string | null;\n notContains?: string | null;\n between?: Array<string | null> | null;\n beginsWith?: string | null;\n attributeExists?: boolean | null;\n attributeType?: ModelAttributeTypes | null;\n size?: ModelSizeInput | null;\n};\n\nexport type ModelIDKeyConditionInput = {\n eq?: string | null;\n le?: string | null;\n lt?: string | null;\n ge?: string | null;\n gt?: string | null;\n between?: Array<string | null> | null;\n beginsWith?: string | null;\n};\n\nexport type ModelIntKeyConditionInput = {\n eq?: number | null;\n le?: number | null;\n lt?: number | null;\n ge?: number | null;\n gt?: number | null;\n between?: Array<number | null> | null;\n};\n\nexport type ModelStringKeyConditionInput = {\n eq?: string | null;\n le?: string | null;\n lt?: string | null;\n ge?: string | null;\n gt?: string | null;\n between?: Array<string | null> | null;\n beginsWith?: string | null;\n};\n\nexport type List<T> = {\n items: Array<T | null>;\n nextToken?: string | null;\n};\n\nexport interface SubscriptionResponse<T> {\n value: GraphQLResult<T>;\n}\n\nexport type Country = {\n code: string;\n nameEn: string;\n nameLocal?: string | null;\n currency?: CountryCurrency | null;\n officialLanguage?: Language | null;\n callingCode?: string | null;\n region?: string | null;\n flag?: string | null;\n};\n\nexport type CountryCurrency = {\n code: string;\n nameEn: string;\n};\n\nexport type Language = {\n code: string;\n nameEn: string;\n nameLocal?: string | null;\n};\n\nexport type PhoneNumber = {\n countryCode?: string | null;\n dialCode?: string | null;\n e164Number?: string | null;\n internationalNumber?: string | null;\n nationalNumber?: string | null;\n number?: string | null;\n};\n\nexport type S3Object = {\n key: string;\n bucket: string;\n location: string;\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"IAEY;AAAZ,CAAA,UAAY,mBAAmB,EAAA;AAC7B,IAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,mBAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,mBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,mBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,mBAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,mBAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,mBAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,mBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACjB,CAAC,EAXW,mBAAmB,KAAnB,mBAAmB,GAAA,EAAA,CAAA,CAAA;IAanB;AAAZ,CAAA,UAAY,kBAAkB,EAAA;AAC5B,IAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,kBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACf,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,GAAA,EAAA,CAAA,CAAA;;ACf9B;;AAEG;;;;"}
|
|
@@ -1800,10 +1800,13 @@ var InteractionStatus;
|
|
|
1800
1800
|
var InteractionProvider;
|
|
1801
1801
|
(function (InteractionProvider) {
|
|
1802
1802
|
InteractionProvider["AVAYA_IPO"] = "AVAYA_IPO";
|
|
1803
|
+
InteractionProvider["FACEBOOK"] = "FACEBOOK";
|
|
1804
|
+
InteractionProvider["INSTAGRAM"] = "INSTAGRAM";
|
|
1805
|
+
InteractionProvider["OZONETEL"] = "OZONETEL";
|
|
1806
|
+
InteractionProvider["SNUGDESK"] = "SNUGDESK";
|
|
1807
|
+
InteractionProvider["TELEGRAM"] = "TELEGRAM";
|
|
1803
1808
|
InteractionProvider["TELNYX"] = "TELNYX";
|
|
1804
1809
|
InteractionProvider["WHATSAPP"] = "WHATSAPP";
|
|
1805
|
-
InteractionProvider["TELEGRAM"] = "TELEGRAM";
|
|
1806
|
-
InteractionProvider["SNUGDESK"] = "SNUGDESK";
|
|
1807
1810
|
})(InteractionProvider || (InteractionProvider = {}));
|
|
1808
1811
|
var InteractionRouteLogic;
|
|
1809
1812
|
(function (InteractionRouteLogic) {
|
|
@@ -2637,6 +2640,214 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
2637
2640
|
}]
|
|
2638
2641
|
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
2639
2642
|
|
|
2643
|
+
const FIELDS_USER = `
|
|
2644
|
+
id
|
|
2645
|
+
externalId
|
|
2646
|
+
tenantId
|
|
2647
|
+
email
|
|
2648
|
+
name
|
|
2649
|
+
image {
|
|
2650
|
+
key
|
|
2651
|
+
bucket
|
|
2652
|
+
location
|
|
2653
|
+
}
|
|
2654
|
+
phoneNumber {
|
|
2655
|
+
countryCode
|
|
2656
|
+
dialCode
|
|
2657
|
+
e164Number
|
|
2658
|
+
internationalNumber
|
|
2659
|
+
nationalNumber
|
|
2660
|
+
number
|
|
2661
|
+
}
|
|
2662
|
+
preferences {
|
|
2663
|
+
timezoneName
|
|
2664
|
+
language {
|
|
2665
|
+
code
|
|
2666
|
+
nameEn
|
|
2667
|
+
nameLocal
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
notificationSettings {
|
|
2671
|
+
allowPush
|
|
2672
|
+
allowEmail
|
|
2673
|
+
allowSMS
|
|
2674
|
+
allowWhatsApp
|
|
2675
|
+
}
|
|
2676
|
+
type
|
|
2677
|
+
activatedAt
|
|
2678
|
+
blockedAt
|
|
2679
|
+
createdAt
|
|
2680
|
+
updatedAt
|
|
2681
|
+
deletedAt
|
|
2682
|
+
`;
|
|
2683
|
+
var UserStatus;
|
|
2684
|
+
(function (UserStatus) {
|
|
2685
|
+
UserStatus["READY"] = "READY";
|
|
2686
|
+
UserStatus["NOT_READY"] = "NOT_READY";
|
|
2687
|
+
UserStatus["INVITED"] = "INVITED";
|
|
2688
|
+
UserStatus["BUSY"] = "BUSY";
|
|
2689
|
+
UserStatus["AFTER_CALL_WORK"] = "AFTER_CALL_WORK";
|
|
2690
|
+
})(UserStatus || (UserStatus = {}));
|
|
2691
|
+
var UserType;
|
|
2692
|
+
(function (UserType) {
|
|
2693
|
+
UserType["AGENT"] = "AGENT";
|
|
2694
|
+
UserType["SUPERVISOR"] = "SUPERVISOR";
|
|
2695
|
+
UserType["ADMINISTRATOR"] = "ADMINISTRATOR";
|
|
2696
|
+
})(UserType || (UserType = {}));
|
|
2697
|
+
class UserService {
|
|
2698
|
+
appSyncService;
|
|
2699
|
+
constructor(appSyncService) {
|
|
2700
|
+
this.appSyncService = appSyncService;
|
|
2701
|
+
}
|
|
2702
|
+
async getUserById(id) {
|
|
2703
|
+
if (!id || !uuid.validate(id)) {
|
|
2704
|
+
throw { code: 400, message: `Invalid id: ${id}` };
|
|
2705
|
+
}
|
|
2706
|
+
const user = await this.GetUser(id);
|
|
2707
|
+
if (!user || !!user.deletedAt) {
|
|
2708
|
+
throw { code: 400, message: `User not found` };
|
|
2709
|
+
}
|
|
2710
|
+
if (!user.activatedAt) {
|
|
2711
|
+
throw { code: 403, message: `User not activated.` };
|
|
2712
|
+
}
|
|
2713
|
+
if (!!user.blockedAt) {
|
|
2714
|
+
throw { code: 403, message: `User has been blocked.` };
|
|
2715
|
+
}
|
|
2716
|
+
return user;
|
|
2717
|
+
}
|
|
2718
|
+
async GetUser(id) {
|
|
2719
|
+
const statement = `query GetUser($id: ID!) {
|
|
2720
|
+
getUser(id: $id) {
|
|
2721
|
+
${FIELDS_USER}
|
|
2722
|
+
}
|
|
2723
|
+
}`;
|
|
2724
|
+
const gqlAPIServiceArguments = { id };
|
|
2725
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2726
|
+
return response.data.getUser;
|
|
2727
|
+
}
|
|
2728
|
+
OnUserByIdListener(id) {
|
|
2729
|
+
const statement = `subscription OnUserById($id: ID!) {
|
|
2730
|
+
OnUserById(id: $id) {
|
|
2731
|
+
${FIELDS_USER}
|
|
2732
|
+
}
|
|
2733
|
+
}`;
|
|
2734
|
+
const gqlAPIServiceArguments = { id };
|
|
2735
|
+
return this.appSyncService.subscribe(statement, gqlAPIServiceArguments);
|
|
2736
|
+
/* as Observable<SubscriptionResponse<Pick<__SubscriptionContainer, "OnUserById">>>; */
|
|
2737
|
+
}
|
|
2738
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2739
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, providedIn: 'root' });
|
|
2740
|
+
}
|
|
2741
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, decorators: [{
|
|
2742
|
+
type: Injectable,
|
|
2743
|
+
args: [{
|
|
2744
|
+
providedIn: 'root',
|
|
2745
|
+
}]
|
|
2746
|
+
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
2747
|
+
|
|
2748
|
+
const FIELDS_TEAM = `
|
|
2749
|
+
id
|
|
2750
|
+
tenantId
|
|
2751
|
+
name
|
|
2752
|
+
description
|
|
2753
|
+
image {
|
|
2754
|
+
key
|
|
2755
|
+
bucket
|
|
2756
|
+
location
|
|
2757
|
+
}
|
|
2758
|
+
ticketFields
|
|
2759
|
+
createdAt
|
|
2760
|
+
updatedAt
|
|
2761
|
+
deletedAt
|
|
2762
|
+
`;
|
|
2763
|
+
const FIELDS_TEAM_MEMBER = `
|
|
2764
|
+
id
|
|
2765
|
+
teamId
|
|
2766
|
+
team {
|
|
2767
|
+
${FIELDS_TEAM}
|
|
2768
|
+
}
|
|
2769
|
+
userId
|
|
2770
|
+
user {
|
|
2771
|
+
${FIELDS_USER}
|
|
2772
|
+
}
|
|
2773
|
+
isManager
|
|
2774
|
+
createdAt
|
|
2775
|
+
updatedAt
|
|
2776
|
+
deletedAt
|
|
2777
|
+
`;
|
|
2778
|
+
class TeamService {
|
|
2779
|
+
appSyncService;
|
|
2780
|
+
constructor(appSyncService) {
|
|
2781
|
+
this.appSyncService = appSyncService;
|
|
2782
|
+
}
|
|
2783
|
+
async GetTeam(id) {
|
|
2784
|
+
const statement = `query GetTeam($id: ID!) {
|
|
2785
|
+
getTeam(id: $id) {
|
|
2786
|
+
${FIELDS_TEAM}
|
|
2787
|
+
}
|
|
2788
|
+
}`;
|
|
2789
|
+
const gqlAPIServiceArguments = {
|
|
2790
|
+
id,
|
|
2791
|
+
};
|
|
2792
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2793
|
+
return response.data.getTeam;
|
|
2794
|
+
}
|
|
2795
|
+
async ListTeamMembershipsByUserId(userId, createdAt, sortDirection, filter, limit, nextToken) {
|
|
2796
|
+
const statement = `query ListTeamMembershipsByUserId($userId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelTeamMemberFilterInput, $limit: Int, $nextToken: String) {
|
|
2797
|
+
listTeamMembershipsByUserId(
|
|
2798
|
+
userId: $userId
|
|
2799
|
+
createdAt: $createdAt
|
|
2800
|
+
sortDirection: $sortDirection
|
|
2801
|
+
filter: $filter
|
|
2802
|
+
limit: $limit
|
|
2803
|
+
nextToken: $nextToken
|
|
2804
|
+
) {
|
|
2805
|
+
items {
|
|
2806
|
+
id
|
|
2807
|
+
teamId
|
|
2808
|
+
team {
|
|
2809
|
+
${FIELDS_TEAM}
|
|
2810
|
+
}
|
|
2811
|
+
userId
|
|
2812
|
+
isManager
|
|
2813
|
+
createdAt
|
|
2814
|
+
updatedAt
|
|
2815
|
+
deletedAt
|
|
2816
|
+
}
|
|
2817
|
+
nextToken
|
|
2818
|
+
}
|
|
2819
|
+
}`;
|
|
2820
|
+
const gqlAPIServiceArguments = {
|
|
2821
|
+
userId,
|
|
2822
|
+
};
|
|
2823
|
+
if (createdAt) {
|
|
2824
|
+
gqlAPIServiceArguments.createdAt = createdAt;
|
|
2825
|
+
}
|
|
2826
|
+
if (sortDirection) {
|
|
2827
|
+
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
2828
|
+
}
|
|
2829
|
+
if (filter) {
|
|
2830
|
+
gqlAPIServiceArguments.filter = filter;
|
|
2831
|
+
}
|
|
2832
|
+
if (limit) {
|
|
2833
|
+
gqlAPIServiceArguments.limit = limit;
|
|
2834
|
+
}
|
|
2835
|
+
if (nextToken) {
|
|
2836
|
+
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2837
|
+
}
|
|
2838
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2839
|
+
return response.data.listTeamMembershipsByUserId;
|
|
2840
|
+
}
|
|
2841
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TeamService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2842
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TeamService, providedIn: 'root' });
|
|
2843
|
+
}
|
|
2844
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TeamService, decorators: [{
|
|
2845
|
+
type: Injectable,
|
|
2846
|
+
args: [{
|
|
2847
|
+
providedIn: 'root',
|
|
2848
|
+
}]
|
|
2849
|
+
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
2850
|
+
|
|
2640
2851
|
const FIELDS_TENANT_EXPANDED = `
|
|
2641
2852
|
id
|
|
2642
2853
|
externalId
|
|
@@ -2819,111 +3030,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
2819
3030
|
}]
|
|
2820
3031
|
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
2821
3032
|
|
|
2822
|
-
const FIELDS_USER_EXPANDED = `
|
|
2823
|
-
id
|
|
2824
|
-
externalId
|
|
2825
|
-
tenantId
|
|
2826
|
-
email
|
|
2827
|
-
name
|
|
2828
|
-
image {
|
|
2829
|
-
key
|
|
2830
|
-
bucket
|
|
2831
|
-
location
|
|
2832
|
-
}
|
|
2833
|
-
phoneNumber {
|
|
2834
|
-
countryCode
|
|
2835
|
-
dialCode
|
|
2836
|
-
e164Number
|
|
2837
|
-
internationalNumber
|
|
2838
|
-
nationalNumber
|
|
2839
|
-
number
|
|
2840
|
-
}
|
|
2841
|
-
preferences {
|
|
2842
|
-
timezoneName
|
|
2843
|
-
language {
|
|
2844
|
-
code
|
|
2845
|
-
nameEn
|
|
2846
|
-
nameLocal
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
|
-
notificationSettings {
|
|
2850
|
-
allowPush
|
|
2851
|
-
allowEmail
|
|
2852
|
-
allowSMS
|
|
2853
|
-
allowWhatsApp
|
|
2854
|
-
}
|
|
2855
|
-
type
|
|
2856
|
-
activatedAt
|
|
2857
|
-
blockedAt
|
|
2858
|
-
createdAt
|
|
2859
|
-
updatedAt
|
|
2860
|
-
deletedAt
|
|
2861
|
-
`;
|
|
2862
|
-
var UserStatus;
|
|
2863
|
-
(function (UserStatus) {
|
|
2864
|
-
UserStatus["READY"] = "READY";
|
|
2865
|
-
UserStatus["NOT_READY"] = "NOT_READY";
|
|
2866
|
-
UserStatus["INVITED"] = "INVITED";
|
|
2867
|
-
UserStatus["BUSY"] = "BUSY";
|
|
2868
|
-
UserStatus["AFTER_CALL_WORK"] = "AFTER_CALL_WORK";
|
|
2869
|
-
})(UserStatus || (UserStatus = {}));
|
|
2870
|
-
var UserType;
|
|
2871
|
-
(function (UserType) {
|
|
2872
|
-
UserType["AGENT"] = "AGENT";
|
|
2873
|
-
UserType["SUPERVISOR"] = "SUPERVISOR";
|
|
2874
|
-
UserType["ADMINISTRATOR"] = "ADMINISTRATOR";
|
|
2875
|
-
})(UserType || (UserType = {}));
|
|
2876
|
-
class UserService {
|
|
2877
|
-
appSyncService;
|
|
2878
|
-
constructor(appSyncService) {
|
|
2879
|
-
this.appSyncService = appSyncService;
|
|
2880
|
-
}
|
|
2881
|
-
async getUserById(id) {
|
|
2882
|
-
if (!id || !uuid.validate(id)) {
|
|
2883
|
-
throw { code: 400, message: `Invalid id: ${id}` };
|
|
2884
|
-
}
|
|
2885
|
-
const user = await this.GetUser(id);
|
|
2886
|
-
if (!user || !!user.deletedAt) {
|
|
2887
|
-
throw { code: 400, message: `User not found` };
|
|
2888
|
-
}
|
|
2889
|
-
if (!user.activatedAt) {
|
|
2890
|
-
throw { code: 403, message: `User not activated.` };
|
|
2891
|
-
}
|
|
2892
|
-
if (!!user.blockedAt) {
|
|
2893
|
-
throw { code: 403, message: `User has been blocked.` };
|
|
2894
|
-
}
|
|
2895
|
-
return user;
|
|
2896
|
-
}
|
|
2897
|
-
async GetUser(id) {
|
|
2898
|
-
const statement = `query GetUser($id: ID!) {
|
|
2899
|
-
getUser(id: $id) {
|
|
2900
|
-
${FIELDS_USER_EXPANDED}
|
|
2901
|
-
}
|
|
2902
|
-
}`;
|
|
2903
|
-
const gqlAPIServiceArguments = { id };
|
|
2904
|
-
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2905
|
-
return response.data.getUser;
|
|
2906
|
-
}
|
|
2907
|
-
OnUserByIdListener(id) {
|
|
2908
|
-
const statement = `subscription OnUserById($id: ID!) {
|
|
2909
|
-
OnUserById(id: $id) {
|
|
2910
|
-
${FIELDS_USER_EXPANDED}
|
|
2911
|
-
}
|
|
2912
|
-
}`;
|
|
2913
|
-
const gqlAPIServiceArguments = { id };
|
|
2914
|
-
return this.appSyncService.subscribe(statement, gqlAPIServiceArguments);
|
|
2915
|
-
/* as Observable<SubscriptionResponse<Pick<__SubscriptionContainer, "OnUserById">>>; */
|
|
2916
|
-
}
|
|
2917
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2918
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, providedIn: 'root' });
|
|
2919
|
-
}
|
|
2920
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, decorators: [{
|
|
2921
|
-
type: Injectable,
|
|
2922
|
-
args: [{
|
|
2923
|
-
providedIn: 'root',
|
|
2924
|
-
}]
|
|
2925
|
-
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
2926
|
-
|
|
2927
3033
|
class CustomValidators {
|
|
2928
3034
|
/**
|
|
2929
3035
|
* Validator that checks for whitespace-only input.
|
|
@@ -3027,5 +3133,5 @@ class CleanDeep {
|
|
|
3027
3133
|
* Generated bundle index. Do not edit.
|
|
3028
3134
|
*/
|
|
3029
3135
|
|
|
3030
|
-
export { AMPLIFY_CONFIG, AppSyncHelperService, CleanDeep, CustomPipesModule, CustomValidators, DomainNamePipe, EntityConversationService, EntityService, ErrorComponent, FIELDS_ENTITY_CONVERSATION, FIELDS_ENTITY_CONVERSATION_EXPANDED, FIELDS_INTERACTION_WIDGET, FooterComponent, FormatEpochTimestampPipe, InteractionChannel, InteractionContext, InteractionDirection, InteractionEndpointService, InteractionProvider, InteractionRouteLogic, InteractionService, InteractionStatus, InteractionWidgetService, LoaderComponent,
|
|
3136
|
+
export { AMPLIFY_CONFIG, AppSyncHelperService, CleanDeep, CustomPipesModule, CustomValidators, DomainNamePipe, EntityConversationService, EntityService, ErrorComponent, FIELDS_ENTITY_CONVERSATION, FIELDS_ENTITY_CONVERSATION_EXPANDED, FIELDS_INTERACTION_WIDGET, FIELDS_USER, FooterComponent, FormatEpochTimestampPipe, InteractionChannel, InteractionContext, InteractionDirection, InteractionEndpointService, InteractionProvider, InteractionRouteLogic, InteractionService, InteractionStatus, InteractionWidgetService, LoaderComponent, OpenSearchHelperService, S3HelperService, SafeHtmlPipe, SearchInnerFieldPipe, SearchPipe, SingularizePipe, SnugdeskAuthenticationService, SnugdeskCoreModule, SnugdeskIPRegistryService, TeamService, TenantService, UserService, UserSessionService, UserStatus, UserType, provideAmplifyConfig };
|
|
3031
3137
|
//# sourceMappingURL=snugdesk-core.mjs.map
|