@bisondesk/commons-sdk 1.0.23-B → 1.0.23
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 +4 -34
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +8 -94
- package/lib/constants.js.map +1 -1
- package/lib/ids.d.ts +1 -2
- package/lib/ids.d.ts.map +1 -1
- package/lib/ids.js +1 -2
- package/lib/ids.js.map +1 -1
- package/lib/types.d.ts +2 -85
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +3 -6
- package/src/constants.ts +7 -97
- package/src/ids.ts +0 -1
- package/src/types.ts +2 -97
- package/tsconfig.tsbuildinfo +2892 -1
- package/lib/dayjs-utils.d.ts +0 -7
- package/lib/dayjs-utils.d.ts.map +0 -1
- package/lib/dayjs-utils.js +0 -28
- package/lib/dayjs-utils.js.map +0 -1
- package/lib/discussions.d.ts +0 -43
- package/lib/discussions.d.ts.map +0 -1
- package/lib/discussions.js +0 -5
- package/lib/discussions.js.map +0 -1
- package/lib/errors.d.ts +0 -36
- package/lib/errors.d.ts.map +0 -1
- package/lib/errors.js +0 -67
- package/lib/errors.js.map +0 -1
- package/lib/exact.d.ts +0 -10
- package/lib/exact.d.ts.map +0 -1
- package/lib/exact.js +0 -3
- package/lib/exact.js.map +0 -1
- package/lib/insurance.d.ts +0 -19
- package/lib/insurance.d.ts.map +0 -1
- package/lib/insurance.js +0 -3
- package/lib/insurance.js.map +0 -1
- package/lib/messages.d.ts +0 -56
- package/lib/messages.d.ts.map +0 -1
- package/lib/messages.js +0 -3
- package/lib/messages.js.map +0 -1
- package/lib/notifications.d.ts +0 -35
- package/lib/notifications.d.ts.map +0 -1
- package/lib/notifications.js +0 -9
- package/lib/notifications.js.map +0 -1
- package/lib/pdf-gen.d.ts +0 -40
- package/lib/pdf-gen.d.ts.map +0 -1
- package/lib/pdf-gen.js +0 -3
- package/lib/pdf-gen.js.map +0 -1
- package/lib/storage.d.ts +0 -63
- package/lib/storage.d.ts.map +0 -1
- package/lib/storage.js +0 -14
- package/lib/storage.js.map +0 -1
- package/src/dayjs-utils.ts +0 -27
- package/src/discussions.ts +0 -50
- package/src/errors.ts +0 -79
- package/src/exact.ts +0 -9
- package/src/insurance.ts +0 -21
- package/src/messages.ts +0 -65
- package/src/notifications.ts +0 -40
- package/src/pdf-gen.ts +0 -43
- package/src/storage.ts +0 -83
package/src/errors.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { ValidationError, ValidationErrorItem } from 'joi';
|
|
2
|
-
|
|
3
|
-
export class XError extends Error {
|
|
4
|
-
errorCtx: any;
|
|
5
|
-
|
|
6
|
-
constructor(message?: string, errorCtx?: any) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = 'XError';
|
|
9
|
-
this.errorCtx = errorCtx;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class WrappedError extends Error {
|
|
14
|
-
errorCtx: any;
|
|
15
|
-
|
|
16
|
-
constructor(err: Error, errorCtx?: any) {
|
|
17
|
-
super(err.message);
|
|
18
|
-
this.name = err.name;
|
|
19
|
-
this.stack = err.stack;
|
|
20
|
-
this.errorCtx = errorCtx;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export class AsyncStopError extends Error {
|
|
25
|
-
constructor(message?: string) {
|
|
26
|
-
super(message);
|
|
27
|
-
this.name = 'AsyncStopError';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export class ForbiddenError extends Error {
|
|
32
|
-
constructor(message?: string) {
|
|
33
|
-
super(message);
|
|
34
|
-
this.name = 'ForbiddenError';
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export class EntryAlreadyExistsError extends Error {
|
|
39
|
-
constructor(message?: string) {
|
|
40
|
-
super(message);
|
|
41
|
-
this.name = 'EntryAlreadyExistsError';
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
type FieldValidationError = {
|
|
46
|
-
message: string;
|
|
47
|
-
path: Array<string | number>;
|
|
48
|
-
type: string;
|
|
49
|
-
};
|
|
50
|
-
export class InvalidArgumentsError extends Error {
|
|
51
|
-
validationErrors?: { errors: FieldValidationError[] };
|
|
52
|
-
isValidation = true;
|
|
53
|
-
errorCtx: any;
|
|
54
|
-
|
|
55
|
-
constructor(message?: string, errors?: ValidationError, errorCtx?: any) {
|
|
56
|
-
super(message);
|
|
57
|
-
this.name = 'InvalidArgumentsError';
|
|
58
|
-
this.errorCtx = errorCtx;
|
|
59
|
-
|
|
60
|
-
if (errors != null) {
|
|
61
|
-
this.validationErrors = {
|
|
62
|
-
errors: errors.details.map(
|
|
63
|
-
({ path, type, message }: ValidationErrorItem): FieldValidationError => ({
|
|
64
|
-
message,
|
|
65
|
-
path,
|
|
66
|
-
type: type === 'custom' ? message : type,
|
|
67
|
-
})
|
|
68
|
-
),
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export class UnauthorizedError extends Error {
|
|
75
|
-
constructor(message?: string) {
|
|
76
|
-
super(message);
|
|
77
|
-
this.name = 'UnauthorizedError';
|
|
78
|
-
}
|
|
79
|
-
}
|
package/src/exact.ts
DELETED
package/src/insurance.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type InsuranceEntry = {
|
|
2
|
-
checkedAt: string;
|
|
3
|
-
insured: boolean;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
export type InsuranceCheckEvent = {
|
|
7
|
-
contractId: string;
|
|
8
|
-
tenantId: string;
|
|
9
|
-
vin: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type InsuranceCheckResponseEvent = InsuranceCheckEvent & {
|
|
13
|
-
insurance: InsuranceEntry;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type InsuranceHistoryRequest = {
|
|
17
|
-
contractId: string;
|
|
18
|
-
tenantId: string;
|
|
19
|
-
limit?: number;
|
|
20
|
-
nextToken?: string;
|
|
21
|
-
};
|
package/src/messages.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { AttachmentValue } from './types';
|
|
2
|
-
|
|
3
|
-
export type EmailAddress = {
|
|
4
|
-
name?: string;
|
|
5
|
-
email: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type EmailDestination = EmailAddress & {
|
|
9
|
-
organizationId?: string;
|
|
10
|
-
contactId?: string;
|
|
11
|
-
addressType: 'TO' | 'CC' | 'BCC';
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type EmailContent = {
|
|
15
|
-
subject: string;
|
|
16
|
-
body: {
|
|
17
|
-
text?: string;
|
|
18
|
-
html?: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type EmailMessage = {
|
|
23
|
-
id: string;
|
|
24
|
-
sentAt: string;
|
|
25
|
-
sentBy: string;
|
|
26
|
-
content?: AttachmentValue;
|
|
27
|
-
subject: string;
|
|
28
|
-
source: EmailAddress;
|
|
29
|
-
replyTo?: EmailAddress;
|
|
30
|
-
destinations: EmailDestination[];
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type EmailMessageEvent = {
|
|
34
|
-
tenantId: string;
|
|
35
|
-
message: EmailMessage;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export type TemplatedEmailRequest = {
|
|
39
|
-
data: Record<string, unknown>;
|
|
40
|
-
destinations: EmailDestination[];
|
|
41
|
-
replyTo?: EmailAddress;
|
|
42
|
-
source: EmailAddress;
|
|
43
|
-
subject: string;
|
|
44
|
-
template: string;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type EmailRequest = {
|
|
48
|
-
references?: string[] | string;
|
|
49
|
-
/* messageId of the email to reply to */
|
|
50
|
-
inReplyTo?: string;
|
|
51
|
-
destinations: EmailDestination[];
|
|
52
|
-
replyTo?: EmailAddress;
|
|
53
|
-
source: EmailAddress;
|
|
54
|
-
subject: string;
|
|
55
|
-
attachments?: AttachmentValue[];
|
|
56
|
-
body:
|
|
57
|
-
| {
|
|
58
|
-
text?: string;
|
|
59
|
-
html: string;
|
|
60
|
-
}
|
|
61
|
-
| {
|
|
62
|
-
html?: string;
|
|
63
|
-
text: string;
|
|
64
|
-
};
|
|
65
|
-
};
|
package/src/notifications.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
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
|
-
};
|