@bisondesk/commons-sdk 1.0.21 → 1.0.23-B
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/lib/constants.d.ts +34 -4
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +94 -8
- package/lib/constants.js.map +1 -1
- package/lib/dayjs-utils.d.ts +7 -0
- package/lib/dayjs-utils.d.ts.map +1 -0
- package/lib/dayjs-utils.js +28 -0
- package/lib/dayjs-utils.js.map +1 -0
- package/lib/discussions.d.ts +43 -0
- package/lib/discussions.d.ts.map +1 -0
- package/lib/discussions.js +5 -0
- package/lib/discussions.js.map +1 -0
- package/lib/errors.d.ts +36 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +67 -0
- package/lib/errors.js.map +1 -0
- package/lib/exact.d.ts +10 -0
- package/lib/exact.d.ts.map +1 -0
- package/lib/exact.js +3 -0
- package/lib/exact.js.map +1 -0
- package/lib/ids.d.ts +2 -1
- package/lib/ids.d.ts.map +1 -1
- package/lib/ids.js +2 -1
- package/lib/ids.js.map +1 -1
- package/lib/insurance.d.ts +19 -0
- package/lib/insurance.d.ts.map +1 -0
- package/lib/insurance.js +3 -0
- package/lib/insurance.js.map +1 -0
- package/lib/messages.d.ts +56 -0
- package/lib/messages.d.ts.map +1 -0
- package/lib/messages.js +3 -0
- package/lib/messages.js.map +1 -0
- package/lib/notifications.d.ts +35 -0
- package/lib/notifications.d.ts.map +1 -0
- package/lib/notifications.js +9 -0
- package/lib/notifications.js.map +1 -0
- package/lib/pdf-gen.d.ts +40 -0
- package/lib/pdf-gen.d.ts.map +1 -0
- package/lib/pdf-gen.js +3 -0
- package/lib/pdf-gen.js.map +1 -0
- package/lib/storage.d.ts +63 -0
- package/lib/storage.d.ts.map +1 -0
- package/lib/storage.js +14 -0
- package/lib/storage.js.map +1 -0
- package/lib/types.d.ts +85 -2
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +6 -3
- package/src/constants.ts +97 -7
- package/src/dayjs-utils.ts +27 -0
- package/src/discussions.ts +50 -0
- package/src/errors.ts +79 -0
- package/src/exact.ts +9 -0
- package/src/ids.ts +1 -0
- package/src/insurance.ts +21 -0
- package/src/messages.ts +65 -0
- package/src/notifications.ts +40 -0
- package/src/pdf-gen.ts +43 -0
- package/src/storage.ts +83 -0
- package/src/types.ts +97 -2
- package/tsconfig.tsbuildinfo +1 -2892
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BusinessEntityIds } from './constants';
|
|
2
|
+
|
|
3
|
+
export enum NotificationVisibility {
|
|
4
|
+
UNREAD = 'unread',
|
|
5
|
+
READ = 'read',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type NewNotificationsEvent<T = unknown> = {
|
|
9
|
+
tenantId: string;
|
|
10
|
+
notifications: NewNotification<T>[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type BaseNotification<T = {}> = {
|
|
14
|
+
sourceId: string; // userId
|
|
15
|
+
destinationId: string; // userId
|
|
16
|
+
businessEntityId: BusinessEntityIds;
|
|
17
|
+
recordId: string;
|
|
18
|
+
recordTitle?: string;
|
|
19
|
+
meta: T;
|
|
20
|
+
origin: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type NewNotification<T = unknown> = BaseNotification<T>;
|
|
24
|
+
|
|
25
|
+
export type Notification<T = unknown> = BaseNotification<T> & {
|
|
26
|
+
id: string;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
visibility: NotificationVisibility;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type NotificationReadUpdates = {
|
|
32
|
+
notificationIds: string[] | undefined; // not passing a value means read all
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type NotificationsInfo = {
|
|
36
|
+
unreadCount: number;
|
|
37
|
+
unseen: boolean;
|
|
38
|
+
latestSeenAt?: string;
|
|
39
|
+
latestNotificationAt?: string;
|
|
40
|
+
};
|
package/src/pdf-gen.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BusinessEntityIds } from './constants';
|
|
2
|
+
import { AttachmentValue } from './types';
|
|
3
|
+
|
|
4
|
+
export type TemplateData = { [key: string]: unknown };
|
|
5
|
+
|
|
6
|
+
export type NewPdfTemplateGroup = {
|
|
7
|
+
exampleData?: TemplateData;
|
|
8
|
+
title: string;
|
|
9
|
+
id: string; // [a-z][a-z0-9_]*
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type PdfTemplateGroup = NewPdfTemplateGroup & {
|
|
13
|
+
modifiedAt: string;
|
|
14
|
+
modifiedBy: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type BasePdfTemplate = {
|
|
18
|
+
branch: string;
|
|
19
|
+
docx: AttachmentValue;
|
|
20
|
+
groupId: string;
|
|
21
|
+
language: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type PdfTemplate = BasePdfTemplate & {
|
|
25
|
+
id: string;
|
|
26
|
+
modifiedAt: string;
|
|
27
|
+
modifiedBy: string;
|
|
28
|
+
pdf: AttachmentValue;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type NewPdfTemplate = BasePdfTemplate & {
|
|
32
|
+
id?: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type GeneratePdfEvent = {
|
|
36
|
+
branch: string;
|
|
37
|
+
businessEntityId: BusinessEntityIds;
|
|
38
|
+
data: TemplateData;
|
|
39
|
+
groupId: string;
|
|
40
|
+
language: string;
|
|
41
|
+
outputFilename?: string;
|
|
42
|
+
tenantId: string;
|
|
43
|
+
};
|
package/src/storage.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type Joi from 'joi';
|
|
2
|
+
import { Requester } from './types';
|
|
3
|
+
|
|
4
|
+
export type UploadInfo = {
|
|
5
|
+
id: string;
|
|
6
|
+
uploadUrl: string;
|
|
7
|
+
downloadPath: string;
|
|
8
|
+
method: 'POST' | 'PATCH' | 'PUT';
|
|
9
|
+
headers?: {
|
|
10
|
+
[name: string]: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type VideoDownloadInfo = {
|
|
15
|
+
url: string;
|
|
16
|
+
quality: string;
|
|
17
|
+
size: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type VideoInfo = {
|
|
21
|
+
status: 'SUCCESS' | 'PROCESSING' | 'ERROR';
|
|
22
|
+
downloads: VideoDownloadInfo[];
|
|
23
|
+
id: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export enum UploadProviders {
|
|
27
|
+
Vimeo = 'vimeo',
|
|
28
|
+
S3 = 's3',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type BaseUploadUrlRequest = {
|
|
32
|
+
contentType: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type VimeoUploadRequest = BaseUploadUrlRequest & {
|
|
36
|
+
size: number;
|
|
37
|
+
name: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type S3UploadRequest = BaseUploadUrlRequest & {
|
|
41
|
+
// is the file supposed to be shared by all tenants that need it, or will each tenant have its copy
|
|
42
|
+
shared: boolean;
|
|
43
|
+
fileName: string;
|
|
44
|
+
businessEntityId: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type UploadUrlRequest<Provider extends UploadProviders> =
|
|
48
|
+
Provider extends UploadProviders.Vimeo
|
|
49
|
+
? VimeoUploadRequest
|
|
50
|
+
: Provider extends UploadProviders.S3
|
|
51
|
+
? S3UploadRequest
|
|
52
|
+
: {};
|
|
53
|
+
|
|
54
|
+
export type UploadProvider = {
|
|
55
|
+
validationSchema: Joi.ObjectSchema<any>;
|
|
56
|
+
getVideoListInfo: (requester: Requester, videoIds: string[]) => Promise<VideoInfo[]>;
|
|
57
|
+
getUploadInfo(
|
|
58
|
+
requester: Requester,
|
|
59
|
+
request: UploadUrlRequest<UploadProviders>
|
|
60
|
+
): Promise<UploadInfo>;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type UploadProvidersDefinition = {
|
|
64
|
+
[key in UploadProviders]: UploadProvider;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export enum MediaExportResolution {
|
|
68
|
+
Low = 'low',
|
|
69
|
+
High = 'high',
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type MediaExportRequest = {
|
|
73
|
+
urls: string[];
|
|
74
|
+
resolution?: MediaExportResolution;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type MediaExportEvent = {
|
|
78
|
+
s3Keys: string[];
|
|
79
|
+
outputId: string;
|
|
80
|
+
tenantId: string;
|
|
81
|
+
entityId: string;
|
|
82
|
+
resolution: MediaExportResolution;
|
|
83
|
+
};
|
package/src/types.ts
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
|
+
import { AppRoles } from './constants';
|
|
2
|
+
|
|
1
3
|
export type PaginatedList<T, M = {}> = {
|
|
2
4
|
results: T[];
|
|
3
5
|
totalCount: number;
|
|
4
6
|
meta: M;
|
|
5
7
|
};
|
|
6
8
|
|
|
9
|
+
export type NextList<T, M = {}> = {
|
|
10
|
+
results: T[];
|
|
11
|
+
nextToken?: string;
|
|
12
|
+
meta: M;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type PaginatedRequest = {
|
|
16
|
+
limit?: number;
|
|
17
|
+
offset?: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
7
20
|
export type Requester = {
|
|
8
21
|
lang: string;
|
|
9
|
-
roles:
|
|
22
|
+
roles: AppRoles[];
|
|
10
23
|
tenantId: string;
|
|
11
24
|
tenantLang: string;
|
|
12
25
|
userAgent?: string;
|
|
13
|
-
source
|
|
26
|
+
source?: string;
|
|
14
27
|
userId: string;
|
|
15
28
|
isApi: boolean;
|
|
16
29
|
};
|
|
@@ -37,3 +50,85 @@ export type CognitoInfo = {
|
|
|
37
50
|
appClientId: string;
|
|
38
51
|
region: Region;
|
|
39
52
|
};
|
|
53
|
+
|
|
54
|
+
export type SearchPermissions = {
|
|
55
|
+
users: string[];
|
|
56
|
+
roles: AppRoles[];
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type PhoneNumberValue = {
|
|
60
|
+
country: string;
|
|
61
|
+
e164: string;
|
|
62
|
+
international: string;
|
|
63
|
+
national: string;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type PhoneNumberRawValue = {
|
|
67
|
+
defaultCountry?: string;
|
|
68
|
+
input: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type LocationValue = {
|
|
72
|
+
addressLine1?: string;
|
|
73
|
+
addressLine2?: string;
|
|
74
|
+
city?: string;
|
|
75
|
+
country: string;
|
|
76
|
+
postalCode?: string;
|
|
77
|
+
gps?: {
|
|
78
|
+
lat: number;
|
|
79
|
+
lon: number;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export type LinkValue = {
|
|
84
|
+
text?: string;
|
|
85
|
+
url: string;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export type Document = {
|
|
89
|
+
type: string; // passport, driving_license, ...
|
|
90
|
+
displayName: string;
|
|
91
|
+
file: AttachmentValue;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type AttachmentValue = {
|
|
95
|
+
contentType: string;
|
|
96
|
+
fileName: string;
|
|
97
|
+
id: string;
|
|
98
|
+
previewSrc?: string;
|
|
99
|
+
size: number;
|
|
100
|
+
uploadedAt: string;
|
|
101
|
+
uploadedBy: string;
|
|
102
|
+
url: string;
|
|
103
|
+
descriptions?: string | MultiLangValue;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export type VatLayerResponse = { vatNumber: string } & (
|
|
107
|
+
| { formatValid: false; viesValid: false }
|
|
108
|
+
| {
|
|
109
|
+
formatValid: true;
|
|
110
|
+
viesValid: boolean;
|
|
111
|
+
countryCode: string;
|
|
112
|
+
name: string;
|
|
113
|
+
addressLines: string[];
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
export type VatValidationResponse = {
|
|
118
|
+
vatNumber: string;
|
|
119
|
+
formatValid?: boolean;
|
|
120
|
+
countryCode?: string;
|
|
121
|
+
} & (
|
|
122
|
+
| { viesValid: false }
|
|
123
|
+
| {
|
|
124
|
+
viesValid: true;
|
|
125
|
+
name?: string;
|
|
126
|
+
normalizedAddress?: LocationValue;
|
|
127
|
+
officialAddress?: string[];
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
export type VatValidationRequest = {
|
|
132
|
+
defaultCountry?: string;
|
|
133
|
+
input: string;
|
|
134
|
+
};
|