@envoy/envoy-integrations-sdk 2.3.1 → 2.3.3
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/README.md +24 -16
- package/dist/base/EnvoyAPI.d.ts.map +1 -1
- package/dist/base/EnvoyAPI.js +23 -23
- package/dist/factories/entryEventBodyFactory.d.ts.map +1 -1
- package/dist/factories/entryEventBodyFactory.js +38 -30
- package/dist/factories/eventBodyFactory.d.ts.map +1 -1
- package/dist/factories/inviteEventBodyFactory.d.ts.map +1 -1
- package/dist/factories/inviteEventBodyFactory.js +11 -10
- package/dist/factories/routeBodyFactory.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/EnvoyEntryEvent.d.ts.map +1 -1
- package/dist/internal/EnvoyInviteEvent.d.ts.map +1 -1
- package/dist/internal/EnvoyStorageCommand.d.ts.map +1 -1
- package/dist/mocks/EnvoyPluginJobMock.d.ts.map +1 -1
- package/dist/mocks/EnvoyPluginStoragePipelineMock.d.ts.map +1 -1
- package/dist/mocks/EnvoyPluginStoragePipelineMock.js +1 -1
- package/dist/payloads/EntryPayload.d.ts.map +1 -1
- package/dist/payloads/InvitePayload.d.ts +1 -0
- package/dist/payloads/InvitePayload.d.ts.map +1 -1
- package/dist/payloads/NotificationPayload.d.ts.map +1 -1
- package/dist/resources/FlowResource.d.ts +2 -1
- package/dist/resources/FlowResource.d.ts.map +1 -1
- package/dist/resources/ReservationResource.d.ts +5 -5
- package/dist/resources/ReservationResource.d.ts.map +1 -1
- package/dist/resources/SignInFieldPageResource.d.ts.map +1 -1
- package/dist/resources/TakeoverResource.d.ts +1 -0
- package/dist/resources/TakeoverResource.d.ts.map +1 -1
- package/dist/sdk/EnvoyMeta.d.ts.map +1 -1
- package/dist/sdk/EnvoyPluginAPI.d.ts.map +1 -1
- package/dist/sdk/EnvoyPluginJobAttachment.d.ts.map +1 -1
- package/dist/sdk/EnvoyPluginSDK.d.ts +1 -1
- package/dist/sdk/EnvoyPluginSDK.d.ts.map +1 -1
- package/dist/sdk/EnvoyPluginSDK.js +1 -1
- package/dist/sdk/EnvoyPluginStorage.d.ts.map +1 -1
- package/dist/sdk/EnvoyPluginStorage.js +6 -2
- package/dist/sdk/EnvoyRequest.d.ts +1 -1
- package/dist/sdk/EnvoyRequest.d.ts.map +1 -1
- package/dist/sdk/EnvoyUserAPI.d.ts +1 -1
- package/dist/sdk/EnvoyUserAPI.d.ts.map +1 -1
- package/dist/sdk/EnvoyUserAPI.js +8 -8
- package/dist/sdk/filters.d.ts.map +1 -1
- package/dist/sdk/filters.js +1 -1
- package/dist/sdk/handlers.d.ts.map +1 -1
- package/dist/sdk/handlers.js +3 -1
- package/dist/sdk/loggers.js +2 -5
- package/dist/sdk/middleware.d.ts.map +1 -1
- package/dist/sdk/middleware.js +1 -1
- package/dist/util/EnvoySignatureVerifier.d.ts.map +1 -1
- package/dist/util/json-api/JSONAPIPaginationParams.d.ts.map +1 -1
- package/dist/util/json-api/JSONAPIResponse.d.ts.map +1 -1
- package/package.json +18 -10
- package/src/base/EnvoyAPI.ts +23 -25
- package/src/factories/entryEventBodyFactory.ts +59 -48
- package/src/factories/eventBodyFactory.ts +8 -10
- package/src/factories/inviteEventBodyFactory.ts +26 -24
- package/src/factories/metaFactory.ts +1 -1
- package/src/factories/routeBodyFactory.ts +9 -11
- package/src/index.ts +2 -0
- package/src/internal/EnvoyEntryEvent.ts +7 -7
- package/src/internal/EnvoyInviteEvent.ts +10 -10
- package/src/internal/EnvoyOption.ts +3 -3
- package/src/internal/EnvoyOptionsRouteParams.ts +3 -3
- package/src/internal/EnvoyPluginJobUpdate.ts +4 -4
- package/src/internal/EnvoyRemoteValueRouteResponseBody.ts +1 -1
- package/src/internal/EnvoySelectedValuesRouteParams.ts +1 -1
- package/src/internal/EnvoyStorageCommand.ts +21 -20
- package/src/mocks/EnvoyPluginJobMock.ts +2 -4
- package/src/mocks/EnvoyPluginStoragePipelineMock.ts +12 -4
- package/src/payloads/EntryPayload.ts +56 -60
- package/src/payloads/InvitePayload.ts +51 -50
- package/src/payloads/NotificationPayload.ts +38 -38
- package/src/resources/FlowResource.ts +2 -1
- package/src/resources/ReservationResource.ts +27 -21
- package/src/resources/SignInFieldPageResource.ts +6 -5
- package/src/resources/SignInFieldResource.ts +3 -3
- package/src/resources/TakeoverResource.ts +1 -0
- package/src/sdk/EnvoyMeta.ts +57 -57
- package/src/sdk/EnvoyPluginAPI.ts +5 -1
- package/src/sdk/EnvoyPluginJobAttachment.ts +14 -13
- package/src/sdk/EnvoyPluginSDK.ts +4 -4
- package/src/sdk/EnvoyPluginStorage.ts +8 -4
- package/src/sdk/EnvoyRequest.ts +62 -28
- package/src/sdk/EnvoyStorageItem.ts +2 -2
- package/src/sdk/EnvoyUserAPI.ts +51 -50
- package/src/sdk/filters.ts +6 -15
- package/src/sdk/handlers.ts +84 -76
- package/src/sdk/loggers.ts +15 -15
- package/src/sdk/middleware.ts +12 -10
- package/src/util/EnvoySignatureVerifier.ts +6 -14
- package/src/util/json-api/JSONAPIPaginationParams.ts +1 -2
- package/src/util/json-api/JSONAPIResponse.ts +3 -3
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
type NotificationPayload = {
|
|
2
2
|
recipient: {
|
|
3
3
|
name: {
|
|
4
|
-
full: string
|
|
5
|
-
}
|
|
6
|
-
email: string | null
|
|
7
|
-
user_id: number | null
|
|
8
|
-
employee_id: number | null
|
|
9
|
-
phone_number: string | null
|
|
10
|
-
}
|
|
11
|
-
message?: string
|
|
4
|
+
full: string;
|
|
5
|
+
};
|
|
6
|
+
email: string | null;
|
|
7
|
+
user_id: number | null;
|
|
8
|
+
employee_id: number | null;
|
|
9
|
+
phone_number: string | null;
|
|
10
|
+
};
|
|
11
|
+
message?: string;
|
|
12
12
|
details?: Array<{
|
|
13
|
-
label: string
|
|
14
|
-
value: string
|
|
15
|
-
}
|
|
13
|
+
label: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}>;
|
|
16
16
|
actions?: Array<{
|
|
17
|
-
label: string
|
|
18
|
-
callback_url: string
|
|
19
|
-
}
|
|
17
|
+
label: string;
|
|
18
|
+
callback_url: string;
|
|
19
|
+
}>;
|
|
20
20
|
attachments?: Array<{
|
|
21
|
-
url: string
|
|
22
|
-
}
|
|
21
|
+
url: string;
|
|
22
|
+
}>;
|
|
23
23
|
channel_overrides?: {
|
|
24
24
|
slack?: {
|
|
25
|
-
dm_only?: boolean
|
|
26
|
-
footer_text?: string
|
|
27
|
-
short_details?: boolean
|
|
28
|
-
large_image?: boolean
|
|
29
|
-
attachments?: Array<Record<string, any
|
|
30
|
-
message?: string
|
|
31
|
-
text?: string
|
|
32
|
-
}
|
|
25
|
+
dm_only?: boolean;
|
|
26
|
+
footer_text?: string;
|
|
27
|
+
short_details?: boolean;
|
|
28
|
+
large_image?: boolean;
|
|
29
|
+
attachments?: Array<Record<string, any>>;
|
|
30
|
+
message?: string;
|
|
31
|
+
text?: string;
|
|
32
|
+
};
|
|
33
33
|
email?: {
|
|
34
|
-
from: string
|
|
35
|
-
subject: string
|
|
36
|
-
html_body: string
|
|
37
|
-
text_body: string
|
|
34
|
+
from: string;
|
|
35
|
+
subject: string;
|
|
36
|
+
html_body: string;
|
|
37
|
+
text_body: string;
|
|
38
38
|
reply_to?: {
|
|
39
39
|
name: {
|
|
40
|
-
full: string
|
|
41
|
-
}
|
|
42
|
-
email: string
|
|
43
|
-
}
|
|
40
|
+
full: string;
|
|
41
|
+
};
|
|
42
|
+
email: string;
|
|
43
|
+
};
|
|
44
44
|
bcc?: Array<{
|
|
45
45
|
name: {
|
|
46
|
-
full: string
|
|
47
|
-
}
|
|
48
|
-
email: string
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
46
|
+
full: string;
|
|
47
|
+
};
|
|
48
|
+
email: string;
|
|
49
|
+
}>;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
export default NotificationPayload;
|
|
@@ -23,12 +23,13 @@ export interface FlowAttributes {
|
|
|
23
23
|
enabled: boolean;
|
|
24
24
|
'created-at': string;
|
|
25
25
|
'updated-at': string;
|
|
26
|
+
type: string;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* @category API Resource
|
|
30
31
|
*/
|
|
31
|
-
export type FlowRelationships = 'location' | 'sign-in-field-page' | 'agreement-page';
|
|
32
|
+
export type FlowRelationships = 'location' | 'sign-in-field-page' | 'agreement-page' | 'global-flow';
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* @category API Resource
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import JSONAPIModel from
|
|
1
|
+
import JSONAPIModel from '../util/json-api/JSONAPIModel';
|
|
2
2
|
|
|
3
3
|
export interface ReservationAttributes {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
'is-partial-day': boolean;
|
|
5
|
+
'updated-at': number;
|
|
6
|
+
'is-assignable': boolean;
|
|
7
|
+
name: string;
|
|
8
|
+
'assigned-to': string | null;
|
|
9
|
+
'neighborhood-id': number;
|
|
10
|
+
'created-at': number;
|
|
11
|
+
neighborhood: number | null;
|
|
12
|
+
'parent-desk-id': string | null;
|
|
13
|
+
availability: string | null;
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
'x-pos': number | null;
|
|
16
|
+
'y-pos': number | null;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface ReservationCreationAttributes {
|
|
@@ -25,16 +25,22 @@ export interface ReservationCreationAttributes {
|
|
|
25
25
|
locationId?: number | null;
|
|
26
26
|
inviteId?: number | null;
|
|
27
27
|
entryId?: number | null;
|
|
28
|
-
startTime?: number | null;
|
|
29
|
-
endTime?: number | null;
|
|
28
|
+
startTime?: number | null; // Unix timestamp
|
|
29
|
+
endTime?: number | null; // Unix timestamp
|
|
30
30
|
|
|
31
31
|
meta?: {
|
|
32
32
|
autoAssignDesk?: boolean;
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export type ReservationRelationships =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
export type ReservationRelationships =
|
|
37
|
+
| 'location'
|
|
38
|
+
| 'desk'
|
|
39
|
+
| 'company'
|
|
40
|
+
| 'floor'
|
|
41
|
+
| 'employee'
|
|
42
|
+
| 'entry'
|
|
43
|
+
| 'invite'
|
|
44
|
+
| 'user';
|
|
45
|
+
|
|
46
|
+
export type ReservationModel = JSONAPIModel<ReservationAttributes, ReservationRelationships, 'reservations'>;
|
|
@@ -11,11 +11,12 @@ export type SignInFieldPageAttributes = {
|
|
|
11
11
|
/**
|
|
12
12
|
* @category API Resource
|
|
13
13
|
*/
|
|
14
|
-
export type SignInFieldPageRelationships =
|
|
15
|
-
| '
|
|
16
|
-
| 'actionable-sign-in-
|
|
17
|
-
| 'sign-in-
|
|
18
|
-
| 'sign-in-
|
|
14
|
+
export type SignInFieldPageRelationships =
|
|
15
|
+
| 'flow'
|
|
16
|
+
| 'actionable-sign-in-field-actions'
|
|
17
|
+
| 'actionable-sign-in-fields'
|
|
18
|
+
| 'sign-in-field-actions'
|
|
19
|
+
| 'sign-in-fields';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* @category API Resource
|
|
@@ -15,9 +15,9 @@ export interface SignInFieldAttributes {
|
|
|
15
15
|
'display-name': string;
|
|
16
16
|
}>;
|
|
17
17
|
options?: Array<{
|
|
18
|
-
value: string
|
|
19
|
-
position: number
|
|
20
|
-
}
|
|
18
|
+
value: string;
|
|
19
|
+
position: number;
|
|
20
|
+
}>;
|
|
21
21
|
position?: number;
|
|
22
22
|
'store-response'?: boolean;
|
|
23
23
|
'created-at'?: string;
|
package/src/sdk/EnvoyMeta.ts
CHANGED
|
@@ -2,60 +2,60 @@
|
|
|
2
2
|
* @category Meta
|
|
3
3
|
*/
|
|
4
4
|
export type EnvoyMetaJob<Event extends string = string> = {
|
|
5
|
-
id: string
|
|
6
|
-
name: Event
|
|
7
|
-
identifier: string
|
|
5
|
+
id: string;
|
|
6
|
+
name: Event;
|
|
7
|
+
identifier: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @category Meta
|
|
12
12
|
*/
|
|
13
13
|
export type EnvoyMetaLocation = {
|
|
14
|
-
id: string
|
|
15
|
-
type: 'locations'
|
|
14
|
+
id: string;
|
|
15
|
+
type: 'locations';
|
|
16
16
|
attributes: {
|
|
17
|
-
name: string
|
|
18
|
-
'company-name-override': string | null
|
|
19
|
-
timezone: string
|
|
20
|
-
locale: string | null
|
|
21
|
-
address: string
|
|
22
|
-
'address-line-one': string | null
|
|
23
|
-
'address-line-two': string | null
|
|
24
|
-
city: string | null
|
|
25
|
-
state: string | null
|
|
26
|
-
country: string | null
|
|
27
|
-
zip: string | null
|
|
28
|
-
longitude: number | null
|
|
29
|
-
latitude: number | null
|
|
30
|
-
'created-at': string
|
|
31
|
-
}
|
|
17
|
+
name: string;
|
|
18
|
+
'company-name-override': string | null;
|
|
19
|
+
timezone: string;
|
|
20
|
+
locale: string | null;
|
|
21
|
+
address: string;
|
|
22
|
+
'address-line-one': string | null;
|
|
23
|
+
'address-line-two': string | null;
|
|
24
|
+
city: string | null;
|
|
25
|
+
state: string | null;
|
|
26
|
+
country: string | null;
|
|
27
|
+
zip: string | null;
|
|
28
|
+
longitude: number | null;
|
|
29
|
+
latitude: number | null;
|
|
30
|
+
'created-at': string;
|
|
31
|
+
};
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* @category Meta
|
|
36
36
|
*/
|
|
37
37
|
export type EnvoyMetaCompany = {
|
|
38
|
-
id: string
|
|
39
|
-
type: 'companies'
|
|
38
|
+
id: string;
|
|
39
|
+
type: 'companies';
|
|
40
40
|
attributes: {
|
|
41
|
-
name: string
|
|
42
|
-
active: boolean
|
|
43
|
-
'created-at': string
|
|
44
|
-
}
|
|
41
|
+
name: string;
|
|
42
|
+
active: boolean;
|
|
43
|
+
'created-at': string;
|
|
44
|
+
};
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* @category Meta
|
|
49
49
|
*/
|
|
50
50
|
export type EnvoyMetaZone = {
|
|
51
|
-
id: string
|
|
52
|
-
type: 'zones'
|
|
51
|
+
id: string;
|
|
52
|
+
type: 'zones';
|
|
53
53
|
attributes: {
|
|
54
|
-
address: string | null
|
|
55
|
-
'logo-url': string | null
|
|
56
|
-
name: string
|
|
57
|
-
'time-zone': string
|
|
58
|
-
}
|
|
54
|
+
address: string | null;
|
|
55
|
+
'logo-url': string | null;
|
|
56
|
+
name: string;
|
|
57
|
+
'time-zone': string;
|
|
58
|
+
};
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
/**
|
|
@@ -65,11 +65,11 @@ export type EnvoyMetaZone = {
|
|
|
65
65
|
* @category Meta
|
|
66
66
|
*/
|
|
67
67
|
export type EnvoyMetaAuth = {
|
|
68
|
-
token_type: 'Bearer'
|
|
69
|
-
access_token: string
|
|
70
|
-
expires_in: number
|
|
71
|
-
refresh_token: string | null
|
|
72
|
-
refresh_token_expires_in: number | null
|
|
68
|
+
token_type: 'Bearer';
|
|
69
|
+
access_token: string;
|
|
70
|
+
expires_in: number;
|
|
71
|
+
refresh_token: string | null;
|
|
72
|
+
refresh_token_expires_in: number | null;
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -78,15 +78,15 @@ export type EnvoyMetaAuth = {
|
|
|
78
78
|
* @category Meta
|
|
79
79
|
*/
|
|
80
80
|
export type EnvoyEventMeta<Event extends string = string, Config = Record<string, unknown>> = {
|
|
81
|
-
event: Event
|
|
82
|
-
plugin_id: string
|
|
83
|
-
install_id: string
|
|
84
|
-
config: Config
|
|
85
|
-
job: EnvoyMetaJob<Event
|
|
86
|
-
location: EnvoyMetaLocation
|
|
87
|
-
company: EnvoyMetaCompany
|
|
88
|
-
zone: EnvoyMetaZone
|
|
89
|
-
auth: EnvoyMetaAuth | null
|
|
81
|
+
event: Event;
|
|
82
|
+
plugin_id: string;
|
|
83
|
+
install_id: string;
|
|
84
|
+
config: Config;
|
|
85
|
+
job: EnvoyMetaJob<Event>;
|
|
86
|
+
location: EnvoyMetaLocation;
|
|
87
|
+
company: EnvoyMetaCompany;
|
|
88
|
+
zone: EnvoyMetaZone;
|
|
89
|
+
auth: EnvoyMetaAuth | null;
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
/**
|
|
@@ -96,16 +96,16 @@ export type EnvoyEventMeta<Event extends string = string, Config = Record<string
|
|
|
96
96
|
* @category Meta
|
|
97
97
|
*/
|
|
98
98
|
export type EnvoyRouteMeta<Config = Record<string, unknown>, Params = Record<string, unknown>> = {
|
|
99
|
-
route: string
|
|
100
|
-
plugin_id: string
|
|
101
|
-
install_id: string
|
|
102
|
-
config: Config
|
|
103
|
-
params: Params
|
|
104
|
-
location: EnvoyMetaLocation
|
|
105
|
-
company: EnvoyMetaCompany
|
|
106
|
-
zone: EnvoyMetaZone
|
|
107
|
-
auth: EnvoyMetaAuth | null
|
|
108
|
-
forwarded_bearer_token?: string
|
|
99
|
+
route: string;
|
|
100
|
+
plugin_id: string;
|
|
101
|
+
install_id: string;
|
|
102
|
+
config: Config;
|
|
103
|
+
params: Params;
|
|
104
|
+
location: EnvoyMetaLocation;
|
|
105
|
+
company: EnvoyMetaCompany;
|
|
106
|
+
zone: EnvoyMetaZone;
|
|
107
|
+
auth: EnvoyMetaAuth | null;
|
|
108
|
+
forwarded_bearer_token?: string;
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
/**
|
|
@@ -70,7 +70,11 @@ export default class EnvoyPluginAPI extends EnvoyAPI {
|
|
|
70
70
|
/**
|
|
71
71
|
* Gets a plugin access token using `client_credentials` as the grant type.
|
|
72
72
|
*/
|
|
73
|
-
static async loginAsPlugin(
|
|
73
|
+
static async loginAsPlugin(
|
|
74
|
+
id = envoyClientId,
|
|
75
|
+
secret = envoyClientSecret,
|
|
76
|
+
scope: string[] = ['plugin', 'token.refresh'],
|
|
77
|
+
): Promise<EnvoyMetaAuth> {
|
|
74
78
|
try {
|
|
75
79
|
const { data } = await axios({
|
|
76
80
|
auth: {
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* @category Attachment
|
|
5
5
|
*/
|
|
6
6
|
export interface EnvoyPluginTextJobAttachment {
|
|
7
|
-
type?: 'text' | 'password' | string
|
|
8
|
-
label: string
|
|
9
|
-
value: string
|
|
7
|
+
type?: 'text' | 'password' | string;
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -15,8 +15,8 @@ export interface EnvoyPluginTextJobAttachment {
|
|
|
15
15
|
* @category Attachment
|
|
16
16
|
*/
|
|
17
17
|
export interface EnvoyPluginLinkJobAttachment extends EnvoyPluginTextJobAttachment {
|
|
18
|
-
type: 'link'
|
|
19
|
-
url: string
|
|
18
|
+
type: 'link';
|
|
19
|
+
url: string;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -26,12 +26,12 @@ export interface EnvoyPluginLinkJobAttachment extends EnvoyPluginTextJobAttachme
|
|
|
26
26
|
* @category Attachment
|
|
27
27
|
*/
|
|
28
28
|
export interface EnvoyPluginCredentialJobAttachment extends EnvoyPluginTextJobAttachment {
|
|
29
|
-
type: 'credential_image'
|
|
30
|
-
title: string
|
|
29
|
+
type: 'credential_image';
|
|
30
|
+
title: string;
|
|
31
31
|
image: {
|
|
32
|
-
type: 's3'
|
|
33
|
-
link: string
|
|
34
|
-
}
|
|
32
|
+
type: 's3';
|
|
33
|
+
link: string;
|
|
34
|
+
};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
@@ -41,8 +41,9 @@ export interface EnvoyPluginCredentialJobAttachment extends EnvoyPluginTextJobAt
|
|
|
41
41
|
*
|
|
42
42
|
* @category Attachment
|
|
43
43
|
*/
|
|
44
|
-
type EnvoyPluginJobAttachment =
|
|
45
|
-
|
|
|
46
|
-
|
|
|
44
|
+
type EnvoyPluginJobAttachment =
|
|
45
|
+
| EnvoyPluginTextJobAttachment
|
|
46
|
+
| EnvoyPluginLinkJobAttachment
|
|
47
|
+
| EnvoyPluginCredentialJobAttachment;
|
|
47
48
|
|
|
48
49
|
export default EnvoyPluginJobAttachment;
|
|
@@ -13,8 +13,8 @@ import InvitePayload, { normalizeInvitePayload } from '../payloads/InvitePayload
|
|
|
13
13
|
* @category Request
|
|
14
14
|
*/
|
|
15
15
|
export interface EnvoyRequestBody<Meta, Payload> {
|
|
16
|
-
meta: Meta
|
|
17
|
-
payload: Payload
|
|
16
|
+
meta: Meta;
|
|
17
|
+
payload: Payload;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -24,7 +24,7 @@ export interface EnvoyRequestBody<Meta, Payload> {
|
|
|
24
24
|
*
|
|
25
25
|
* @category SDK
|
|
26
26
|
*/
|
|
27
|
-
export default class EnvoyPluginSDK<Meta =
|
|
27
|
+
export default class EnvoyPluginSDK<Meta extends object = Record<string, any>, Payload = unknown> {
|
|
28
28
|
/**
|
|
29
29
|
* Body of the request.
|
|
30
30
|
* use `meta` or `payload` to access the relevant properties,
|
|
@@ -96,7 +96,7 @@ export default class EnvoyPluginSDK<Meta = unknown, Payload = unknown> {
|
|
|
96
96
|
const meta = this.meta as unknown as EnvoyRouteMeta;
|
|
97
97
|
const { auth } = meta;
|
|
98
98
|
let accessToken: string | undefined = auth?.access_token;
|
|
99
|
-
if (!accessToken &&
|
|
99
|
+
if (!accessToken && 'forwarded_bearer_token' in meta) {
|
|
100
100
|
accessToken = meta.forwarded_bearer_token;
|
|
101
101
|
}
|
|
102
102
|
if (!accessToken) {
|
|
@@ -33,7 +33,7 @@ export default class EnvoyPluginStorage {
|
|
|
33
33
|
* Wrapper for single pipeline get.
|
|
34
34
|
*/
|
|
35
35
|
get<Value = unknown>(key: string) {
|
|
36
|
-
return this.pipeline().get(key).executeSingle<EnvoyStorageItem<Value> | { key: string
|
|
36
|
+
return this.pipeline().get(key).executeSingle<EnvoyStorageItem<Value> | { key: string; value: undefined }>();
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
@@ -51,7 +51,9 @@ export default class EnvoyPluginStorage {
|
|
|
51
51
|
* Wrapper for single pipeline setUnique.
|
|
52
52
|
*/
|
|
53
53
|
setUnique(key: string, options: EnvoyStorageSetUniqueOptions = {}) {
|
|
54
|
-
return this.pipeline()
|
|
54
|
+
return this.pipeline()
|
|
55
|
+
.setUnique(key, options)
|
|
56
|
+
.executeSingle<EnvoyStorageItem<string> | { key: string; value: undefined }>();
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
/**
|
|
@@ -60,7 +62,9 @@ export default class EnvoyPluginStorage {
|
|
|
60
62
|
* Wrapper for single pipeline setUnique.
|
|
61
63
|
*/
|
|
62
64
|
setUniqueNum(key: string, options: EnvoyStorageSetUniqueNumOptions = {}) {
|
|
63
|
-
return this.pipeline()
|
|
65
|
+
return this.pipeline()
|
|
66
|
+
.setUniqueNum(key, options)
|
|
67
|
+
.executeSingle<EnvoyStorageItem<number> | { key: string; value: undefined }>();
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
/**
|
|
@@ -69,7 +73,7 @@ export default class EnvoyPluginStorage {
|
|
|
69
73
|
* Wrapper for single pipeline unset.
|
|
70
74
|
*/
|
|
71
75
|
unset<Value = unknown>(key: string) {
|
|
72
|
-
return this.pipeline().unset(key).executeSingle<EnvoyStorageItem<Value> | { key: string
|
|
76
|
+
return this.pipeline().unset(key).executeSingle<EnvoyStorageItem<Value> | { key: string; value: undefined }>();
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
/**
|