@worknice/js-sdk 0.2.0-rc.1 → 0.2.0-rc.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/dist/{_types-Cobjq3B-.d.ts → _types-Crem3H1y.d.ts} +54 -15
- package/dist/api/WorkniceIntegrationLogger.d.ts +1 -1
- package/dist/api/_generated.d.ts +27 -7
- package/dist/api/_generated.js.map +1 -1
- package/dist/api/_types.d.ts +2 -2
- package/dist/api/createApiOperation.d.ts +1 -1
- package/dist/api/createWorkniceClient.d.ts +1 -1
- package/dist/api/createWorkniceClient.js +2 -0
- package/dist/api/createWorkniceClient.js.map +1 -1
- package/dist/api/operations/activateIntegration.d.ts +1 -1
- package/dist/api/operations/authorizeIntegration.d.ts +1 -1
- package/dist/api/operations/completeSync.d.ts +1 -1
- package/dist/api/operations/createApiToken.d.ts +1 -1
- package/dist/api/operations/createDataImport.d.ts +1 -1
- package/dist/api/operations/createPerson.d.ts +13 -0
- package/dist/api/operations/createPerson.js +24 -0
- package/dist/api/operations/createPerson.js.map +1 -0
- package/dist/api/operations/createPersonConnection.d.ts +21 -8
- package/dist/api/operations/createPersonConnection.js +2 -1
- package/dist/api/operations/createPersonConnection.js.map +1 -1
- package/dist/api/operations/createPersonDataImportLine.d.ts +1 -1
- package/dist/api/operations/deleteApiToken.d.ts +1 -1
- package/dist/api/operations/deletePersonConnection.d.ts +1 -1
- package/dist/api/operations/getApiTokens.d.ts +1 -1
- package/dist/api/operations/getIntegration.d.ts +1 -1
- package/dist/api/operations/getMyApps.d.ts +1 -1
- package/dist/api/operations/getPeople.d.ts +1 -1
- package/dist/api/operations/getPersonConnections.d.ts +15 -8
- package/dist/api/operations/getPersonConnections.js +2 -1
- package/dist/api/operations/getPersonConnections.js.map +1 -1
- package/dist/api/operations/initializeIntegration.d.ts +1 -1
- package/dist/api/operations/updatePerson.d.ts +1 -1
- package/dist/api/operations/updatePersonConnection.d.ts +14 -1
- package/dist/api/operations/updatePersonConnection.js +1 -0
- package/dist/api/operations/updatePersonConnection.js.map +1 -1
- package/dist/helpers/_types.d.ts +1 -1
- package/dist/helpers/handleApproveLeaveRequestWebhook.d.ts +1 -1
- package/dist/helpers/handleCancelLeaveRequestWebhook.d.ts +1 -1
- package/dist/helpers/handleCreateIntegrationWebhook.d.ts +1 -1
- package/dist/helpers/handleCreateLeaveRequestWebhook.d.ts +1 -1
- package/dist/helpers/handleDenyLeaveRequestWebhook.d.ts +1 -1
- package/dist/helpers/handleGetAuthorizationUrlWebhook.d.ts +1 -1
- package/dist/helpers/handleGetLeaveBalancesWebhook.d.ts +1 -1
- package/dist/helpers/handleGetLeaveCategoriesWebhook.d.ts +1 -1
- package/dist/helpers/handleGetLeaveRequestHoursWebhook.d.ts +1 -1
- package/dist/helpers/handleProcessLeaveRequestWebhook.d.ts +1 -1
- package/dist/helpers/handleRequest.d.ts +1 -1
- package/dist/helpers/handleRequestWithWorknice.d.ts +1 -1
- package/dist/helpers/handleTriggerIntegrationSyncWebhook.d.ts +15 -1
- package/dist/helpers/handleTriggerIntegrationSyncWebhook.js +39 -13
- package/dist/helpers/handleTriggerIntegrationSyncWebhook.js.map +1 -1
- package/dist/helpers/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FetchOptions, S as SuccessfulQueryResult } from '../../_types-
|
|
1
|
+
import { F as FetchOptions, S as SuccessfulQueryResult } from '../../_types-Crem3H1y.js';
|
|
2
2
|
import { ConnectionStatus } from '../_generated.js';
|
|
3
3
|
|
|
4
4
|
declare const updatePersonConnection: (context: {
|
|
@@ -7,8 +7,10 @@ declare const updatePersonConnection: (context: {
|
|
|
7
7
|
personConnectionId: string;
|
|
8
8
|
personId: string;
|
|
9
9
|
remote: {
|
|
10
|
+
description?: string | null;
|
|
10
11
|
id: string;
|
|
11
12
|
name: string;
|
|
13
|
+
url?: string | null;
|
|
12
14
|
};
|
|
13
15
|
status: ConnectionStatus.Connected;
|
|
14
16
|
} | {
|
|
@@ -19,15 +21,19 @@ declare const updatePersonConnection: (context: {
|
|
|
19
21
|
personConnectionId: string;
|
|
20
22
|
personId: string;
|
|
21
23
|
remote: {
|
|
24
|
+
description?: string | null;
|
|
22
25
|
id: string;
|
|
23
26
|
name: string;
|
|
27
|
+
url?: string | null;
|
|
24
28
|
};
|
|
25
29
|
status: ConnectionStatus.Merged;
|
|
26
30
|
} | {
|
|
27
31
|
personConnectionId: string;
|
|
28
32
|
remote: {
|
|
33
|
+
description?: string | null;
|
|
29
34
|
id: string;
|
|
30
35
|
name: string;
|
|
36
|
+
url?: string | null;
|
|
31
37
|
};
|
|
32
38
|
status: ConnectionStatus.RemoteOnly;
|
|
33
39
|
}, fetchOptions?: FetchOptions) => Promise<({
|
|
@@ -42,6 +48,7 @@ declare const updatePersonConnection: (context: {
|
|
|
42
48
|
updatedAt: string;
|
|
43
49
|
} | null;
|
|
44
50
|
remote?: {
|
|
51
|
+
description?: string | null;
|
|
45
52
|
name: string;
|
|
46
53
|
id: string;
|
|
47
54
|
url?: string | null;
|
|
@@ -49,6 +56,7 @@ declare const updatePersonConnection: (context: {
|
|
|
49
56
|
} & {
|
|
50
57
|
status: ConnectionStatus.Connected;
|
|
51
58
|
remote: {
|
|
59
|
+
description?: string | null;
|
|
52
60
|
name: string;
|
|
53
61
|
id: string;
|
|
54
62
|
url?: string | null;
|
|
@@ -70,6 +78,7 @@ declare const updatePersonConnection: (context: {
|
|
|
70
78
|
updatedAt: string;
|
|
71
79
|
} | null;
|
|
72
80
|
remote?: {
|
|
81
|
+
description?: string | null;
|
|
73
82
|
name: string;
|
|
74
83
|
id: string;
|
|
75
84
|
url?: string | null;
|
|
@@ -77,6 +86,7 @@ declare const updatePersonConnection: (context: {
|
|
|
77
86
|
} & {
|
|
78
87
|
status: ConnectionStatus.Merged;
|
|
79
88
|
remote: {
|
|
89
|
+
description?: string | null;
|
|
80
90
|
name: string;
|
|
81
91
|
id: string;
|
|
82
92
|
url?: string | null;
|
|
@@ -98,6 +108,7 @@ declare const updatePersonConnection: (context: {
|
|
|
98
108
|
updatedAt: string;
|
|
99
109
|
} | null;
|
|
100
110
|
remote?: {
|
|
111
|
+
description?: string | null;
|
|
101
112
|
name: string;
|
|
102
113
|
id: string;
|
|
103
114
|
url?: string | null;
|
|
@@ -122,6 +133,7 @@ declare const updatePersonConnection: (context: {
|
|
|
122
133
|
updatedAt: string;
|
|
123
134
|
} | null;
|
|
124
135
|
remote?: {
|
|
136
|
+
description?: string | null;
|
|
125
137
|
name: string;
|
|
126
138
|
id: string;
|
|
127
139
|
url?: string | null;
|
|
@@ -129,6 +141,7 @@ declare const updatePersonConnection: (context: {
|
|
|
129
141
|
} & {
|
|
130
142
|
status: ConnectionStatus.RemoteOnly;
|
|
131
143
|
remote: {
|
|
144
|
+
description?: string | null;
|
|
132
145
|
name: string;
|
|
133
146
|
id: string;
|
|
134
147
|
url?: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/api/operations/updatePersonConnection.ts"],"sourcesContent":["import gql from \"dedent\";\nimport disambiguatePersonConnections from \"../../utils/disambiguatePersonConnections.js\";\nimport {\n ConnectionStatus,\n type UpdatePersonConnectionMutation,\n type UpdatePersonConnectionMutationVariables,\n} from \"../_types.js\";\nimport createApiOperation from \"../createApiOperation.js\";\n\nconst updatePersonConnection = createApiOperation(\n ({ fetchFromApi }) =>\n async (\n variables:\n | {\n personConnectionId: string;\n personId: string;\n remote: {\n id: string;\n name: string;\n };\n status: ConnectionStatus.Connected;\n }\n | {\n personConnectionId: string;\n personId: string;\n status: ConnectionStatus.LocalOnly;\n }\n | {\n personConnectionId: string;\n personId: string;\n remote: {\n id: string;\n name: string;\n };\n status: ConnectionStatus.Merged;\n }\n | {\n personConnectionId: string;\n remote: {\n id: string;\n name: string;\n };\n status: ConnectionStatus.RemoteOnly;\n },\n fetchOptions,\n ) => {\n const result = await fetchFromApi<\n UpdatePersonConnectionMutation,\n UpdatePersonConnectionMutationVariables\n >(\n gql`\n mutation UpdatePersonConnection(\n $personConnectionId: ID!\n $personId: ID\n $remote: ConnectionRemoteInput\n $status: ConnectionStatus!\n ) {\n updatePersonConnection(\n connectionId: $personConnectionId\n personId: $personId\n remote: $remote\n status: $status\n ) {\n __typename\n createdAt\n id\n person {\n displayName\n id\n updatedAt\n }\n remote {\n name\n id\n url\n }\n status\n updatedAt\n }\n }\n `,\n variables.status === ConnectionStatus.Connected ||\n variables.status === ConnectionStatus.Merged\n ? {\n personConnectionId: variables.personConnectionId,\n personId: variables.personId,\n remote: variables.remote,\n status: variables.status,\n }\n : variables.status === ConnectionStatus.LocalOnly\n ? {\n personConnectionId: variables.personConnectionId,\n personId: variables.personId,\n remote: null,\n status: variables.status,\n }\n : {\n personConnectionId: variables.personConnectionId,\n personId: null,\n remote: variables.remote,\n status: variables.status,\n },\n fetchOptions,\n );\n\n return disambiguatePersonConnections(result.data.updatePersonConnection);\n },\n);\n\nexport default updatePersonConnection;\n"],"mappings":"AAAA,OAAO,SAAS;AAChB,OAAO,mCAAmC;AAC1C;AAAA,EACE;AAAA,OAGK;AACP,OAAO,wBAAwB;AAE/B,MAAM,yBAAyB;AAAA,EAC7B,CAAC,EAAE,aAAa,MACd,OACE,
|
|
1
|
+
{"version":3,"sources":["../../../src/api/operations/updatePersonConnection.ts"],"sourcesContent":["import gql from \"dedent\";\nimport disambiguatePersonConnections from \"../../utils/disambiguatePersonConnections.js\";\nimport {\n ConnectionStatus,\n type UpdatePersonConnectionMutation,\n type UpdatePersonConnectionMutationVariables,\n} from \"../_types.js\";\nimport createApiOperation from \"../createApiOperation.js\";\n\nconst updatePersonConnection = createApiOperation(\n ({ fetchFromApi }) =>\n async (\n variables:\n | {\n personConnectionId: string;\n personId: string;\n remote: {\n description?: string | null;\n id: string;\n name: string;\n url?: string | null;\n };\n status: ConnectionStatus.Connected;\n }\n | {\n personConnectionId: string;\n personId: string;\n status: ConnectionStatus.LocalOnly;\n }\n | {\n personConnectionId: string;\n personId: string;\n remote: {\n description?: string | null;\n id: string;\n name: string;\n url?: string | null;\n };\n status: ConnectionStatus.Merged;\n }\n | {\n personConnectionId: string;\n remote: {\n description?: string | null;\n id: string;\n name: string;\n url?: string | null;\n };\n status: ConnectionStatus.RemoteOnly;\n },\n fetchOptions,\n ) => {\n const result = await fetchFromApi<\n UpdatePersonConnectionMutation,\n UpdatePersonConnectionMutationVariables\n >(\n gql`\n mutation UpdatePersonConnection(\n $personConnectionId: ID!\n $personId: ID\n $remote: ConnectionRemoteInput\n $status: ConnectionStatus!\n ) {\n updatePersonConnection(\n connectionId: $personConnectionId\n personId: $personId\n remote: $remote\n status: $status\n ) {\n __typename\n createdAt\n id\n person {\n displayName\n id\n updatedAt\n }\n remote {\n description\n name\n id\n url\n }\n status\n updatedAt\n }\n }\n `,\n variables.status === ConnectionStatus.Connected ||\n variables.status === ConnectionStatus.Merged\n ? {\n personConnectionId: variables.personConnectionId,\n personId: variables.personId,\n remote: variables.remote,\n status: variables.status,\n }\n : variables.status === ConnectionStatus.LocalOnly\n ? {\n personConnectionId: variables.personConnectionId,\n personId: variables.personId,\n remote: null,\n status: variables.status,\n }\n : {\n personConnectionId: variables.personConnectionId,\n personId: null,\n remote: variables.remote,\n status: variables.status,\n },\n fetchOptions,\n );\n\n return disambiguatePersonConnections(result.data.updatePersonConnection);\n },\n);\n\nexport default updatePersonConnection;\n"],"mappings":"AAAA,OAAO,SAAS;AAChB,OAAO,mCAAmC;AAC1C;AAAA,EACE;AAAA,OAGK;AACP,OAAO,wBAAwB;AAE/B,MAAM,yBAAyB;AAAA,EAC7B,CAAC,EAAE,aAAa,MACd,OACE,WAsCA,iBACG;AACH,UAAM,SAAS,MAAM;AAAA,MAInB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAgCA,UAAU,WAAW,iBAAiB,aACpC,UAAU,WAAW,iBAAiB,SACpC;AAAA,QACE,oBAAoB,UAAU;AAAA,QAC9B,UAAU,UAAU;AAAA,QACpB,QAAQ,UAAU;AAAA,QAClB,QAAQ,UAAU;AAAA,MACpB,IACA,UAAU,WAAW,iBAAiB,YACpC;AAAA,QACE,oBAAoB,UAAU;AAAA,QAC9B,UAAU,UAAU;AAAA,QACpB,QAAQ;AAAA,QACR,QAAQ,UAAU;AAAA,MACpB,IACA;AAAA,QACE,oBAAoB,UAAU;AAAA,QAC9B,UAAU;AAAA,QACV,QAAQ,UAAU;AAAA,QAClB,QAAQ,UAAU;AAAA,MACpB;AAAA,MACN;AAAA,IACF;AAEA,WAAO,8BAA8B,OAAO,KAAK,sBAAsB;AAAA,EACzE;AACJ;AAEA,IAAO,iCAAQ;","names":[]}
|
package/dist/helpers/_types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApproveLeaveRequestResponsePayload, ApproveLeaveRequestRequestPayload } from '@worknice/utils/webhooks';
|
|
2
2
|
import { HandlerOptions, TaskContext } from './_types.js';
|
|
3
|
-
import '../_types-
|
|
3
|
+
import '../_types-Crem3H1y.js';
|
|
4
4
|
import '../api/_generated.js';
|
|
5
5
|
import '../api/WorkniceIntegrationLogger.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CancelLeaveRequestResponsePayload, CancelLeaveRequestRequestPayload } from '@worknice/utils/webhooks';
|
|
2
2
|
import { HandlerOptions, TaskContext } from './_types.js';
|
|
3
|
-
import '../_types-
|
|
3
|
+
import '../_types-Crem3H1y.js';
|
|
4
4
|
import '../api/_generated.js';
|
|
5
5
|
import '../api/WorkniceIntegrationLogger.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CreateIntegrationRequestPayload } from '@worknice/utils/webhooks';
|
|
2
2
|
import { HandlerOptions, TaskContext } from './_types.js';
|
|
3
|
-
import '../_types-
|
|
3
|
+
import '../_types-Crem3H1y.js';
|
|
4
4
|
import '../api/_generated.js';
|
|
5
5
|
import '../api/WorkniceIntegrationLogger.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CreateLeaveRequestResponsePayload, CreateLeaveRequestRequestPayload } from '@worknice/utils/webhooks';
|
|
2
2
|
import { HandlerOptions, TaskContext } from './_types.js';
|
|
3
|
-
import '../_types-
|
|
3
|
+
import '../_types-Crem3H1y.js';
|
|
4
4
|
import '../api/_generated.js';
|
|
5
5
|
import '../api/WorkniceIntegrationLogger.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DenyLeaveRequestResponsePayload, DenyLeaveRequestRequestPayload } from '@worknice/utils/webhooks';
|
|
2
2
|
import { HandlerOptions, TaskContext } from './_types.js';
|
|
3
|
-
import '../_types-
|
|
3
|
+
import '../_types-Crem3H1y.js';
|
|
4
4
|
import '../api/_generated.js';
|
|
5
5
|
import '../api/WorkniceIntegrationLogger.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetAuthorizationUrlRequestPayload } from '@worknice/utils/webhooks';
|
|
2
2
|
import { HandlerOptions, TaskContext } from './_types.js';
|
|
3
|
-
import '../_types-
|
|
3
|
+
import '../_types-Crem3H1y.js';
|
|
4
4
|
import '../api/_generated.js';
|
|
5
5
|
import '../api/WorkniceIntegrationLogger.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetLeaveBalancesRequestPayload, GetLeaveBalancesResponsePayload } from '@worknice/utils/webhooks';
|
|
2
2
|
import { HandlerOptions, TaskContext } from './_types.js';
|
|
3
|
-
import '../_types-
|
|
3
|
+
import '../_types-Crem3H1y.js';
|
|
4
4
|
import '../api/_generated.js';
|
|
5
5
|
import '../api/WorkniceIntegrationLogger.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetLeaveCategoriesResponsePayload, GetLeaveCategoriesRequestPayload } from '@worknice/utils/webhooks';
|
|
2
2
|
import { HandlerOptions, TaskContext } from './_types.js';
|
|
3
|
-
import '../_types-
|
|
3
|
+
import '../_types-Crem3H1y.js';
|
|
4
4
|
import '../api/_generated.js';
|
|
5
5
|
import '../api/WorkniceIntegrationLogger.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetLeaveRequestHoursRequestPayload, GetLeaveRequestHoursResponsePayload } from '@worknice/utils/webhooks';
|
|
2
2
|
import { HandlerOptions, TaskContext } from './_types.js';
|
|
3
|
-
import '../_types-
|
|
3
|
+
import '../_types-Crem3H1y.js';
|
|
4
4
|
import '../api/_generated.js';
|
|
5
5
|
import '../api/WorkniceIntegrationLogger.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProcessLeaveRequestResponsePayload, ProcessLeaveRequestRequestPayload } from '@worknice/utils/webhooks';
|
|
2
2
|
import { HandlerOptions, TaskContext } from './_types.js';
|
|
3
|
-
import '../_types-
|
|
3
|
+
import '../_types-Crem3H1y.js';
|
|
4
4
|
import '../api/_generated.js';
|
|
5
5
|
import '../api/WorkniceIntegrationLogger.js';
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as WorkniceClient } from '../_types-
|
|
1
|
+
import { W as WorkniceClient } from '../_types-Crem3H1y.js';
|
|
2
2
|
import { PersonDataTransferLine } from '../employee-records/_types.js';
|
|
3
3
|
import { TriggerIntegrationSyncRequestPayload } from '@worknice/utils/webhooks';
|
|
4
4
|
import { HandlerOptions, TaskContext } from './_types.js';
|
|
@@ -33,6 +33,20 @@ type Tasks<Env, Req extends Request = Request> = {
|
|
|
33
33
|
};
|
|
34
34
|
type Config = {
|
|
35
35
|
appName: string;
|
|
36
|
+
/**
|
|
37
|
+
* If true, new people will be automatically created in Worknice when a new
|
|
38
|
+
* person is detected in the remote app, otherwise a person connection is
|
|
39
|
+
* created with a "remote-only" status.
|
|
40
|
+
*/
|
|
41
|
+
automaticCreation?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* If true, connections will be automatically matched if any of the
|
|
44
|
+
* following conditions are met:
|
|
45
|
+
*
|
|
46
|
+
* - Worknice person employee code matches remote person employee code
|
|
47
|
+
* - Worknice person personal email matches remote person personal email
|
|
48
|
+
* - Worknice person profile email matches remote person profile email
|
|
49
|
+
*/
|
|
36
50
|
automaticMatching?: boolean;
|
|
37
51
|
mode?: "connection-only" | "one-way" | "two-way";
|
|
38
52
|
syncFields?: {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import isInstantAfter from "@worknice/utils/temporal/isInstantAfter";
|
|
2
2
|
import isValidInstant from "@worknice/utils/temporal/isValidInstant";
|
|
3
3
|
import { Temporal } from "temporal-polyfill";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ConnectionStatus,
|
|
6
|
+
PersonRole
|
|
7
|
+
} from "../api/_types.js";
|
|
5
8
|
import comparePersonDataTransferLines from "../employee-records/comparePersonDataTransferLines.js";
|
|
6
9
|
import mergePersonDataTransferLines from "../employee-records/mergePersonDataTransferLines.js";
|
|
7
10
|
import validatePersonDataTransferLine from "../employee-records/validatePersonDataTransferLine.js";
|
|
@@ -65,6 +68,9 @@ const handleTriggerIntegrationSyncWebhook = async (request, {
|
|
|
65
68
|
};
|
|
66
69
|
logger.indent("Loading configuration details\u2026");
|
|
67
70
|
const config = await getConfig(contextWithIntegration);
|
|
71
|
+
logger.info(
|
|
72
|
+
config.automaticCreation ? "Automatic creation enabled." : "Automatic creation disabled."
|
|
73
|
+
);
|
|
68
74
|
logger.info(
|
|
69
75
|
config.automaticMatching ? "Automatic matching enabled." : "Automatic matching disabled."
|
|
70
76
|
);
|
|
@@ -227,18 +233,38 @@ const handleTriggerIntegrationSyncWebhook = async (request, {
|
|
|
227
233
|
}
|
|
228
234
|
}
|
|
229
235
|
} else if (remotePersonConnection === void 0) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
236
|
+
if (config.automaticCreation === true) {
|
|
237
|
+
const person = await worknice.createPerson({
|
|
238
|
+
displayName: remotePersonName,
|
|
239
|
+
role: PersonRole.Employee
|
|
240
|
+
});
|
|
241
|
+
const newPersonConnection = await worknice.createPersonConnection({
|
|
242
|
+
integrationId: payload.integrationId,
|
|
243
|
+
personId: person.id,
|
|
244
|
+
remote: {
|
|
245
|
+
id: remotePerson.metadata.sourceId,
|
|
246
|
+
name: remotePersonName
|
|
247
|
+
},
|
|
248
|
+
status: ConnectionStatus.Connected
|
|
249
|
+
});
|
|
250
|
+
personConnections.push(newPersonConnection);
|
|
251
|
+
logger.info(
|
|
252
|
+
`Automatically created new person "${remotePersonName}" in Worknice from "${remotePersonName}" in ${config.appName}.`
|
|
253
|
+
);
|
|
254
|
+
} else {
|
|
255
|
+
const newPersonConnection = await worknice.createPersonConnection({
|
|
256
|
+
integrationId: payload.integrationId,
|
|
257
|
+
remote: {
|
|
258
|
+
id: remotePerson.metadata.sourceId,
|
|
259
|
+
name: remotePersonName
|
|
260
|
+
},
|
|
261
|
+
status: ConnectionStatus.RemoteOnly
|
|
262
|
+
});
|
|
263
|
+
personConnections.push(newPersonConnection);
|
|
264
|
+
logger.info(
|
|
265
|
+
`New person connection created for ${config.appName} person "${remotePersonName}".`
|
|
266
|
+
);
|
|
267
|
+
}
|
|
242
268
|
}
|
|
243
269
|
}
|
|
244
270
|
}
|