@worknice/js-sdk 0.0.8 → 0.1.0-rc.1

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.
Files changed (27) hide show
  1. package/dist/helpers/handleApproveLeaveRequestWebhook.d.ts +1 -1
  2. package/dist/helpers/handleApproveLeaveRequestWebhook.js.map +1 -1
  3. package/dist/helpers/handleCancelLeaveRequestWebhook.d.ts +1 -1
  4. package/dist/helpers/handleCancelLeaveRequestWebhook.js.map +1 -1
  5. package/dist/helpers/handleCreateIntegrationWebhook.d.ts +1 -1
  6. package/dist/helpers/handleCreateIntegrationWebhook.js.map +1 -1
  7. package/dist/helpers/handleCreateLeaveRequestWebhook.d.ts +1 -1
  8. package/dist/helpers/handleCreateLeaveRequestWebhook.js.map +1 -1
  9. package/dist/helpers/handleDenyLeaveRequestWebhook.d.ts +1 -1
  10. package/dist/helpers/handleDenyLeaveRequestWebhook.js.map +1 -1
  11. package/dist/helpers/handleGetAuthorizationUrlWebhook.d.ts +1 -1
  12. package/dist/helpers/handleGetAuthorizationUrlWebhook.js.map +1 -1
  13. package/dist/helpers/handleGetLeaveBalancesWebhook.d.ts +1 -1
  14. package/dist/helpers/handleGetLeaveBalancesWebhook.js.map +1 -1
  15. package/dist/helpers/handleGetLeaveCategoriesWebhook.d.ts +1 -1
  16. package/dist/helpers/handleGetLeaveCategoriesWebhook.js.map +1 -1
  17. package/dist/helpers/handleGetLeaveRequestHoursWebhook.d.ts +1 -1
  18. package/dist/helpers/handleGetLeaveRequestHoursWebhook.js.map +1 -1
  19. package/dist/helpers/handleProcessLeaveRequestWebhook.d.ts +1 -1
  20. package/dist/helpers/handleProcessLeaveRequestWebhook.js.map +1 -1
  21. package/dist/helpers/handleTriggerIntegrationSyncWebhook.d.ts +1 -1
  22. package/dist/helpers/handleTriggerIntegrationSyncWebhook.js.map +1 -1
  23. package/dist/helpers/index.d.ts +1 -1
  24. package/package.json +5 -5
  25. package/dist/webhooks.d.ts +0 -112
  26. package/dist/webhooks.js +0 -1
  27. package/dist/webhooks.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { ApproveLeaveRequestResponsePayload, ApproveLeaveRequestRequestPayload } from '../webhooks.js';
1
+ import { ApproveLeaveRequestResponsePayload, ApproveLeaveRequestRequestPayload } from '@worknice/utils/webhooks';
2
2
  import { HandlerOptions, TaskContext } from './_types.js';
3
3
  import '../_types-Cobjq3B-.js';
4
4
  import '../api/_generated.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/handleApproveLeaveRequestWebhook.ts"],"sourcesContent":["import type {\n ApproveLeaveRequestRequestPayload,\n ApproveLeaveRequestResponsePayload,\n} from \"../webhooks.js\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n ApproveLeaveRequestRequestPayload,\n Env,\n Req\n>;\n\ntype Tasks<Env, Req extends Request = Request> = {\n approveLeaveRequest: (context: Context<Env, Req>) => Promise<ApproveLeaveRequestResponsePayload>;\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string | undefined>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n};\n\nconst handleApproveLeaveRequestWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { approveLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n ApproveLeaveRequestRequestPayload,\n ApproveLeaveRequestResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken,\n handleRequest: approveLeaveRequest,\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleApproveLeaveRequestWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAgBtC,MAAM,mCAAmC,OACvC,SACA,EAAE,qBAAqB,aAAa,OAAO,GAC3C,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe;AAAA,IACf,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,2CAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/helpers/handleApproveLeaveRequestWebhook.ts"],"sourcesContent":["import type {\n ApproveLeaveRequestRequestPayload,\n ApproveLeaveRequestResponsePayload,\n} from \"@worknice/utils/webhooks\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n ApproveLeaveRequestRequestPayload,\n Env,\n Req\n>;\n\ntype Tasks<Env, Req extends Request = Request> = {\n approveLeaveRequest: (context: Context<Env, Req>) => Promise<ApproveLeaveRequestResponsePayload>;\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string | undefined>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n};\n\nconst handleApproveLeaveRequestWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { approveLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n ApproveLeaveRequestRequestPayload,\n ApproveLeaveRequestResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken,\n handleRequest: approveLeaveRequest,\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleApproveLeaveRequestWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAgBtC,MAAM,mCAAmC,OACvC,SACA,EAAE,qBAAqB,aAAa,OAAO,GAC3C,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe;AAAA,IACf,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,2CAAQ;","names":[]}
@@ -1,4 +1,4 @@
1
- import { CancelLeaveRequestResponsePayload, CancelLeaveRequestRequestPayload } from '../webhooks.js';
1
+ import { CancelLeaveRequestResponsePayload, CancelLeaveRequestRequestPayload } from '@worknice/utils/webhooks';
2
2
  import { HandlerOptions, TaskContext } from './_types.js';
3
3
  import '../_types-Cobjq3B-.js';
4
4
  import '../api/_generated.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/handleCancelLeaveRequestWebhook.ts"],"sourcesContent":["import type {\n CancelLeaveRequestRequestPayload,\n CancelLeaveRequestResponsePayload,\n} from \"../webhooks.js\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n CancelLeaveRequestRequestPayload,\n Env,\n Req\n>;\n\ntype Tasks<Env, Req extends Request = Request> = {\n cancelLeaveRequest: (context: Context<Env, Req>) => Promise<CancelLeaveRequestResponsePayload>;\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string | undefined>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n};\n\nconst handleCancelLeaveRequestWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { cancelLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n CancelLeaveRequestRequestPayload,\n CancelLeaveRequestResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken,\n handleRequest: cancelLeaveRequest,\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleCancelLeaveRequestWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAgBtC,MAAM,kCAAkC,OACtC,SACA,EAAE,oBAAoB,aAAa,OAAO,GAC1C,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe;AAAA,IACf,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,0CAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/helpers/handleCancelLeaveRequestWebhook.ts"],"sourcesContent":["import type {\n CancelLeaveRequestRequestPayload,\n CancelLeaveRequestResponsePayload,\n} from \"@worknice/utils/webhooks\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n CancelLeaveRequestRequestPayload,\n Env,\n Req\n>;\n\ntype Tasks<Env, Req extends Request = Request> = {\n cancelLeaveRequest: (context: Context<Env, Req>) => Promise<CancelLeaveRequestResponsePayload>;\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string | undefined>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n};\n\nconst handleCancelLeaveRequestWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { cancelLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n CancelLeaveRequestRequestPayload,\n CancelLeaveRequestResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken,\n handleRequest: cancelLeaveRequest,\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleCancelLeaveRequestWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAgBtC,MAAM,kCAAkC,OACtC,SACA,EAAE,oBAAoB,aAAa,OAAO,GAC1C,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe;AAAA,IACf,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,0CAAQ;","names":[]}
@@ -1,4 +1,4 @@
1
- import { CreateIntegrationRequestPayload } from '../webhooks.js';
1
+ import { CreateIntegrationRequestPayload } from '@worknice/utils/webhooks';
2
2
  import { HandlerOptions, TaskContext } from './_types.js';
3
3
  import '../_types-Cobjq3B-.js';
4
4
  import '../api/_generated.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/handleCreateIntegrationWebhook.ts"],"sourcesContent":["import type { CreateIntegrationRequestPayload } from \"../webhooks.js\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Tasks<Req extends Request = Request> = {\n persistDetails: (\n context: TaskContext<CreateIntegrationRequestPayload, null, Req>,\n ) => Promise<void>;\n};\n\nconst handleCreateIntegrationWebhook = async <Req extends Request = Request>(\n request: Req,\n { persistDetails }: Tasks<Req>,\n options?: HandlerOptions & { action?: \"initialize\" | \"authorize\" | \"activate\" },\n) =>\n handleRequestWithWorknice<CreateIntegrationRequestPayload, void, null, Req>(\n request,\n {\n getApiToken: async ({ payload }) => payload.apiToken,\n handleRequest: async (context) => {\n const { logger, payload, worknice } = context;\n logger.debug(\"Persisting details…\");\n await persistDetails(context);\n switch (options?.action ?? \"initialize\") {\n case \"initialize\": {\n logger.debug(\"Initializing integration…\");\n await worknice.initializeIntegration({ id: payload.integrationId });\n break;\n }\n case \"authorize\": {\n logger.debug(\"Authorizing integration…\");\n await worknice.authorizeIntegration({ integrationId: payload.integrationId });\n break;\n }\n case \"activate\": {\n logger.debug(\"Activating integration…\");\n await worknice.activateIntegration({ id: payload.integrationId });\n break;\n }\n }\n },\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: null,\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleCreateIntegrationWebhook;\n"],"mappings":"AAEA,OAAO,+BAA+B;AAQtC,MAAM,iCAAiC,OACrC,SACA,EAAE,eAAe,GACjB,YAEA;AAAA,EACE;AAAA,EACA;AAAA,IACE,aAAa,OAAO,EAAE,QAAQ,MAAM,QAAQ;AAAA,IAC5C,eAAe,OAAO,YAAY;AAChC,YAAM,EAAE,QAAQ,SAAS,SAAS,IAAI;AACtC,aAAO,MAAM,0BAAqB;AAClC,YAAM,eAAe,OAAO;AAC5B,cAAQ,SAAS,UAAU,cAAc;AAAA,QACvC,KAAK,cAAc;AACjB,iBAAO,MAAM,gCAA2B;AACxC,gBAAM,SAAS,sBAAsB,EAAE,IAAI,QAAQ,cAAc,CAAC;AAClE;AAAA,QACF;AAAA,QACA,KAAK,aAAa;AAChB,iBAAO,MAAM,+BAA0B;AACvC,gBAAM,SAAS,qBAAqB,EAAE,eAAe,QAAQ,cAAc,CAAC;AAC5E;AAAA,QACF;AAAA,QACA,KAAK,YAAY;AACf,iBAAO,MAAM,8BAAyB;AACtC,gBAAM,SAAS,oBAAoB,EAAE,IAAI,QAAQ,cAAc,CAAC;AAChE;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK;AAAA,QACL;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,yCAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/helpers/handleCreateIntegrationWebhook.ts"],"sourcesContent":["import type { CreateIntegrationRequestPayload } from \"@worknice/utils/webhooks\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Tasks<Req extends Request = Request> = {\n persistDetails: (\n context: TaskContext<CreateIntegrationRequestPayload, null, Req>,\n ) => Promise<void>;\n};\n\nconst handleCreateIntegrationWebhook = async <Req extends Request = Request>(\n request: Req,\n { persistDetails }: Tasks<Req>,\n options?: HandlerOptions & { action?: \"initialize\" | \"authorize\" | \"activate\" },\n) =>\n handleRequestWithWorknice<CreateIntegrationRequestPayload, void, null, Req>(\n request,\n {\n getApiToken: async ({ payload }) => payload.apiToken,\n handleRequest: async (context) => {\n const { logger, payload, worknice } = context;\n logger.debug(\"Persisting details…\");\n await persistDetails(context);\n switch (options?.action ?? \"initialize\") {\n case \"initialize\": {\n logger.debug(\"Initializing integration…\");\n await worknice.initializeIntegration({ id: payload.integrationId });\n break;\n }\n case \"authorize\": {\n logger.debug(\"Authorizing integration…\");\n await worknice.authorizeIntegration({ integrationId: payload.integrationId });\n break;\n }\n case \"activate\": {\n logger.debug(\"Activating integration…\");\n await worknice.activateIntegration({ id: payload.integrationId });\n break;\n }\n }\n },\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: null,\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleCreateIntegrationWebhook;\n"],"mappings":"AAEA,OAAO,+BAA+B;AAQtC,MAAM,iCAAiC,OACrC,SACA,EAAE,eAAe,GACjB,YAEA;AAAA,EACE;AAAA,EACA;AAAA,IACE,aAAa,OAAO,EAAE,QAAQ,MAAM,QAAQ;AAAA,IAC5C,eAAe,OAAO,YAAY;AAChC,YAAM,EAAE,QAAQ,SAAS,SAAS,IAAI;AACtC,aAAO,MAAM,0BAAqB;AAClC,YAAM,eAAe,OAAO;AAC5B,cAAQ,SAAS,UAAU,cAAc;AAAA,QACvC,KAAK,cAAc;AACjB,iBAAO,MAAM,gCAA2B;AACxC,gBAAM,SAAS,sBAAsB,EAAE,IAAI,QAAQ,cAAc,CAAC;AAClE;AAAA,QACF;AAAA,QACA,KAAK,aAAa;AAChB,iBAAO,MAAM,+BAA0B;AACvC,gBAAM,SAAS,qBAAqB,EAAE,eAAe,QAAQ,cAAc,CAAC;AAC5E;AAAA,QACF;AAAA,QACA,KAAK,YAAY;AACf,iBAAO,MAAM,8BAAyB;AACtC,gBAAM,SAAS,oBAAoB,EAAE,IAAI,QAAQ,cAAc,CAAC;AAChE;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK;AAAA,QACL;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,yCAAQ;","names":[]}
@@ -1,4 +1,4 @@
1
- import { CreateLeaveRequestResponsePayload, CreateLeaveRequestRequestPayload } from '../webhooks.js';
1
+ import { CreateLeaveRequestResponsePayload, CreateLeaveRequestRequestPayload } from '@worknice/utils/webhooks';
2
2
  import { HandlerOptions, TaskContext } from './_types.js';
3
3
  import '../_types-Cobjq3B-.js';
4
4
  import '../api/_generated.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/handleCreateLeaveRequestWebhook.ts"],"sourcesContent":["import type {\n CreateLeaveRequestRequestPayload,\n CreateLeaveRequestResponsePayload,\n} from \"../webhooks.js\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n CreateLeaveRequestRequestPayload,\n Env,\n Req\n>;\n\ntype Tasks<Env, Req extends Request = Request> = {\n createLeaveRequest: (context: Context<Env, Req>) => Promise<CreateLeaveRequestResponsePayload>;\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string | undefined>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n};\n\nconst handleCreateLeaveRequestWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { createLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n CreateLeaveRequestRequestPayload,\n CreateLeaveRequestResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken,\n handleRequest: createLeaveRequest,\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleCreateLeaveRequestWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAgBtC,MAAM,kCAAkC,OACtC,SACA,EAAE,oBAAoB,aAAa,OAAO,GAC1C,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe;AAAA,IACf,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,0CAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/helpers/handleCreateLeaveRequestWebhook.ts"],"sourcesContent":["import type {\n CreateLeaveRequestRequestPayload,\n CreateLeaveRequestResponsePayload,\n} from \"@worknice/utils/webhooks\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n CreateLeaveRequestRequestPayload,\n Env,\n Req\n>;\n\ntype Tasks<Env, Req extends Request = Request> = {\n createLeaveRequest: (context: Context<Env, Req>) => Promise<CreateLeaveRequestResponsePayload>;\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string | undefined>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n};\n\nconst handleCreateLeaveRequestWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { createLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n CreateLeaveRequestRequestPayload,\n CreateLeaveRequestResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken,\n handleRequest: createLeaveRequest,\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleCreateLeaveRequestWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAgBtC,MAAM,kCAAkC,OACtC,SACA,EAAE,oBAAoB,aAAa,OAAO,GAC1C,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe;AAAA,IACf,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,0CAAQ;","names":[]}
@@ -1,4 +1,4 @@
1
- import { DenyLeaveRequestResponsePayload, DenyLeaveRequestRequestPayload } from '../webhooks.js';
1
+ import { DenyLeaveRequestResponsePayload, DenyLeaveRequestRequestPayload } from '@worknice/utils/webhooks';
2
2
  import { HandlerOptions, TaskContext } from './_types.js';
3
3
  import '../_types-Cobjq3B-.js';
4
4
  import '../api/_generated.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/handleDenyLeaveRequestWebhook.ts"],"sourcesContent":["import type {\n DenyLeaveRequestRequestPayload,\n DenyLeaveRequestResponsePayload,\n} from \"../webhooks.js\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n DenyLeaveRequestRequestPayload,\n Env,\n Req\n>;\n\ntype Tasks<Env, Req extends Request = Request> = {\n denyLeaveRequest: (context: Context<Env, Req>) => Promise<DenyLeaveRequestResponsePayload>;\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string | undefined>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n};\n\nconst handleDenyLeaveRequestWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { denyLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n DenyLeaveRequestRequestPayload,\n DenyLeaveRequestResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken,\n handleRequest: denyLeaveRequest,\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleDenyLeaveRequestWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAgBtC,MAAM,gCAAgC,OACpC,SACA,EAAE,kBAAkB,aAAa,OAAO,GACxC,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe;AAAA,IACf,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,wCAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/helpers/handleDenyLeaveRequestWebhook.ts"],"sourcesContent":["import type {\n DenyLeaveRequestRequestPayload,\n DenyLeaveRequestResponsePayload,\n} from \"@worknice/utils/webhooks\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n DenyLeaveRequestRequestPayload,\n Env,\n Req\n>;\n\ntype Tasks<Env, Req extends Request = Request> = {\n denyLeaveRequest: (context: Context<Env, Req>) => Promise<DenyLeaveRequestResponsePayload>;\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string | undefined>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n};\n\nconst handleDenyLeaveRequestWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { denyLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n DenyLeaveRequestRequestPayload,\n DenyLeaveRequestResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken,\n handleRequest: denyLeaveRequest,\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleDenyLeaveRequestWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAgBtC,MAAM,gCAAgC,OACpC,SACA,EAAE,kBAAkB,aAAa,OAAO,GACxC,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe;AAAA,IACf,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,wCAAQ;","names":[]}
@@ -1,4 +1,4 @@
1
- import { GetAuthorizationUrlRequestPayload } from '../webhooks.js';
1
+ import { GetAuthorizationUrlRequestPayload } from '@worknice/utils/webhooks';
2
2
  import { HandlerOptions, TaskContext } from './_types.js';
3
3
  import '../_types-Cobjq3B-.js';
4
4
  import '../api/_generated.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/handleGetAuthorizationUrlWebhook.ts"],"sourcesContent":["import type {\n GetAuthorizationUrlRequestPayload,\n GetAuthorizationUrlResponsePayload,\n} from \"../webhooks.js\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Tasks<Req extends Request = Request> = {\n getAuthorisationUrl: (\n context: TaskContext<GetAuthorizationUrlRequestPayload, null, Req>,\n ) => Promise<string>;\n};\n\nconst handleGetAuthorizationUrlWebhook = async <Req extends Request = Request>(\n request: Req,\n { getAuthorisationUrl }: Tasks,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n GetAuthorizationUrlRequestPayload,\n GetAuthorizationUrlResponsePayload,\n null,\n Req\n >(\n request,\n {\n getApiToken: async () => undefined,\n handleRequest: async (context) => {\n const { logger } = context;\n logger.debug(\"Getting authorization url…\");\n return {\n authorizationUrl: await getAuthorisationUrl(context),\n };\n },\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: null,\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleGetAuthorizationUrlWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAQtC,MAAM,mCAAmC,OACvC,SACA,EAAE,oBAAoB,GACtB,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE,aAAa,YAAY;AAAA,IACzB,eAAe,OAAO,YAAY;AAChC,YAAM,EAAE,OAAO,IAAI;AACnB,aAAO,MAAM,iCAA4B;AACzC,aAAO;AAAA,QACL,kBAAkB,MAAM,oBAAoB,OAAO;AAAA,MACrD;AAAA,IACF;AAAA,IACA,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK;AAAA,QACL;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,2CAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/helpers/handleGetAuthorizationUrlWebhook.ts"],"sourcesContent":["import type {\n GetAuthorizationUrlRequestPayload,\n GetAuthorizationUrlResponsePayload,\n} from \"@worknice/utils/webhooks\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Tasks<Req extends Request = Request> = {\n getAuthorisationUrl: (\n context: TaskContext<GetAuthorizationUrlRequestPayload, null, Req>,\n ) => Promise<string>;\n};\n\nconst handleGetAuthorizationUrlWebhook = async <Req extends Request = Request>(\n request: Req,\n { getAuthorisationUrl }: Tasks,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n GetAuthorizationUrlRequestPayload,\n GetAuthorizationUrlResponsePayload,\n null,\n Req\n >(\n request,\n {\n getApiToken: async () => undefined,\n handleRequest: async (context) => {\n const { logger } = context;\n logger.debug(\"Getting authorization url…\");\n return {\n authorizationUrl: await getAuthorisationUrl(context),\n };\n },\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: null,\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleGetAuthorizationUrlWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAQtC,MAAM,mCAAmC,OACvC,SACA,EAAE,oBAAoB,GACtB,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE,aAAa,YAAY;AAAA,IACzB,eAAe,OAAO,YAAY;AAChC,YAAM,EAAE,OAAO,IAAI;AACnB,aAAO,MAAM,iCAA4B;AACzC,aAAO;AAAA,QACL,kBAAkB,MAAM,oBAAoB,OAAO;AAAA,MACrD;AAAA,IACF;AAAA,IACA,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK;AAAA,QACL;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,2CAAQ;","names":[]}
@@ -1,4 +1,4 @@
1
- import { GetLeaveBalancesRequestPayload, GetLeaveBalancesResponsePayload } from '../webhooks.js';
1
+ import { GetLeaveBalancesRequestPayload, GetLeaveBalancesResponsePayload } from '@worknice/utils/webhooks';
2
2
  import { HandlerOptions, TaskContext } from './_types.js';
3
3
  import '../_types-Cobjq3B-.js';
4
4
  import '../api/_generated.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/handleGetLeaveBalancesWebhook.ts"],"sourcesContent":["import type {\n GetLeaveBalancesRequestPayload,\n GetLeaveBalancesResponsePayload,\n} from \"../webhooks.js\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Tasks<Env, Req extends Request = Request> = {\n getEnv: (\n context: Pick<\n TaskContext<GetLeaveBalancesRequestPayload, Env, Req>,\n \"logger\" | \"payload\" | \"request\"\n >,\n ) => Promise<Env>;\n getLeaveBalances: (\n context: TaskContext<GetLeaveBalancesRequestPayload, Env, Req>,\n ) => Promise<GetLeaveBalancesResponsePayload>;\n};\n\nconst handleGetLeaveBalancesWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { getEnv, getLeaveBalances }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n GetLeaveBalancesRequestPayload,\n GetLeaveBalancesResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken: async () => undefined,\n handleRequest: async (context) => {\n const { logger } = context;\n logger.info(\"Retrieving leave balances…\");\n const result = await getLeaveBalances(context);\n logger.info(`Retrieved ${result.length} leave balances.`);\n return result;\n },\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleGetLeaveBalancesWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AActC,MAAM,gCAAgC,OACpC,SACA,EAAE,QAAQ,iBAAiB,GAC3B,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE,aAAa,YAAY;AAAA,IACzB,eAAe,OAAO,YAAY;AAChC,YAAM,EAAE,OAAO,IAAI;AACnB,aAAO,KAAK,iCAA4B;AACxC,YAAM,SAAS,MAAM,iBAAiB,OAAO;AAC7C,aAAO,KAAK,aAAa,OAAO,MAAM,kBAAkB;AACxD,aAAO;AAAA,IACT;AAAA,IACA,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,wCAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/helpers/handleGetLeaveBalancesWebhook.ts"],"sourcesContent":["import type {\n GetLeaveBalancesRequestPayload,\n GetLeaveBalancesResponsePayload,\n} from \"@worknice/utils/webhooks\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Tasks<Env, Req extends Request = Request> = {\n getEnv: (\n context: Pick<\n TaskContext<GetLeaveBalancesRequestPayload, Env, Req>,\n \"logger\" | \"payload\" | \"request\"\n >,\n ) => Promise<Env>;\n getLeaveBalances: (\n context: TaskContext<GetLeaveBalancesRequestPayload, Env, Req>,\n ) => Promise<GetLeaveBalancesResponsePayload>;\n};\n\nconst handleGetLeaveBalancesWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { getEnv, getLeaveBalances }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n GetLeaveBalancesRequestPayload,\n GetLeaveBalancesResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken: async () => undefined,\n handleRequest: async (context) => {\n const { logger } = context;\n logger.info(\"Retrieving leave balances…\");\n const result = await getLeaveBalances(context);\n logger.info(`Retrieved ${result.length} leave balances.`);\n return result;\n },\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleGetLeaveBalancesWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AActC,MAAM,gCAAgC,OACpC,SACA,EAAE,QAAQ,iBAAiB,GAC3B,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE,aAAa,YAAY;AAAA,IACzB,eAAe,OAAO,YAAY;AAChC,YAAM,EAAE,OAAO,IAAI;AACnB,aAAO,KAAK,iCAA4B;AACxC,YAAM,SAAS,MAAM,iBAAiB,OAAO;AAC7C,aAAO,KAAK,aAAa,OAAO,MAAM,kBAAkB;AACxD,aAAO;AAAA,IACT;AAAA,IACA,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,wCAAQ;","names":[]}
@@ -1,4 +1,4 @@
1
- import { GetLeaveCategoriesResponsePayload, GetLeaveCategoriesRequestPayload } from '../webhooks.js';
1
+ import { GetLeaveCategoriesResponsePayload, GetLeaveCategoriesRequestPayload } from '@worknice/utils/webhooks';
2
2
  import { HandlerOptions, TaskContext } from './_types.js';
3
3
  import '../_types-Cobjq3B-.js';
4
4
  import '../api/_generated.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/handleGetLeaveCategoriesWebhook.ts"],"sourcesContent":["import type {\n GetLeaveCategoriesRequestPayload,\n GetLeaveCategoriesResponsePayload,\n} from \"../webhooks.js\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n GetLeaveCategoriesRequestPayload,\n Env,\n Req\n>;\n\ntype Tasks<Env, Req extends Request = Request> = {\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string | undefined>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n getLeaveCategories: (context: Context<Env, Req>) => Promise<GetLeaveCategoriesResponsePayload>;\n};\n\nconst handleGetLeaveCategoriesWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { getApiToken, getEnv, getLeaveCategories }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n GetLeaveCategoriesRequestPayload,\n GetLeaveCategoriesResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken,\n handleRequest: async (context) => {\n const { logger } = context;\n logger.info(\"Retrieving leave categories…\");\n const result = await getLeaveCategories(context);\n logger.info(`Retrieved ${result.leaveCategories.length} leave categories.`);\n return result;\n },\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleGetLeaveCategoriesWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAgBtC,MAAM,kCAAkC,OACtC,SACA,EAAE,aAAa,QAAQ,mBAAmB,GAC1C,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe,OAAO,YAAY;AAChC,YAAM,EAAE,OAAO,IAAI;AACnB,aAAO,KAAK,mCAA8B;AAC1C,YAAM,SAAS,MAAM,mBAAmB,OAAO;AAC/C,aAAO,KAAK,aAAa,OAAO,gBAAgB,MAAM,oBAAoB;AAC1E,aAAO;AAAA,IACT;AAAA,IACA,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,0CAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/helpers/handleGetLeaveCategoriesWebhook.ts"],"sourcesContent":["import type {\n GetLeaveCategoriesRequestPayload,\n GetLeaveCategoriesResponsePayload,\n} from \"@worknice/utils/webhooks\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n GetLeaveCategoriesRequestPayload,\n Env,\n Req\n>;\n\ntype Tasks<Env, Req extends Request = Request> = {\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string | undefined>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n getLeaveCategories: (context: Context<Env, Req>) => Promise<GetLeaveCategoriesResponsePayload>;\n};\n\nconst handleGetLeaveCategoriesWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { getApiToken, getEnv, getLeaveCategories }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n GetLeaveCategoriesRequestPayload,\n GetLeaveCategoriesResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken,\n handleRequest: async (context) => {\n const { logger } = context;\n logger.info(\"Retrieving leave categories…\");\n const result = await getLeaveCategories(context);\n logger.info(`Retrieved ${result.leaveCategories.length} leave categories.`);\n return result;\n },\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleGetLeaveCategoriesWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAgBtC,MAAM,kCAAkC,OACtC,SACA,EAAE,aAAa,QAAQ,mBAAmB,GAC1C,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe,OAAO,YAAY;AAChC,YAAM,EAAE,OAAO,IAAI;AACnB,aAAO,KAAK,mCAA8B;AAC1C,YAAM,SAAS,MAAM,mBAAmB,OAAO;AAC/C,aAAO,KAAK,aAAa,OAAO,gBAAgB,MAAM,oBAAoB;AAC1E,aAAO;AAAA,IACT;AAAA,IACA,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,0CAAQ;","names":[]}
@@ -1,4 +1,4 @@
1
- import { GetLeaveRequestHoursRequestPayload, GetLeaveRequestHoursResponsePayload } from '../webhooks.js';
1
+ import { GetLeaveRequestHoursRequestPayload, GetLeaveRequestHoursResponsePayload } from '@worknice/utils/webhooks';
2
2
  import { HandlerOptions, TaskContext } from './_types.js';
3
3
  import '../_types-Cobjq3B-.js';
4
4
  import '../api/_generated.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/handleGetLeaveRequestHoursWebhook.ts"],"sourcesContent":["import type {\n GetLeaveRequestHoursRequestPayload,\n GetLeaveRequestHoursResponsePayload,\n} from \"../webhooks.js\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Tasks<Env, Req extends Request = Request> = {\n getEnv: (\n context: Pick<\n TaskContext<GetLeaveRequestHoursRequestPayload, Env, Req>,\n \"logger\" | \"payload\" | \"request\"\n >,\n ) => Promise<Env>;\n getLeaveRequestHours: (\n context: TaskContext<GetLeaveRequestHoursRequestPayload, Env, Req>,\n ) => Promise<GetLeaveRequestHoursResponsePayload>;\n};\n\nconst handleGetLeaveRequestHoursWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { getEnv, getLeaveRequestHours }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n GetLeaveRequestHoursRequestPayload,\n GetLeaveRequestHoursResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken: async () => undefined,\n handleRequest: async (context) => {\n const { logger } = context;\n logger.info(\"Retrieving leave request hours…\");\n const result = await getLeaveRequestHours(context);\n logger.info(\"Retrieved leave request hours.\");\n return result;\n },\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleGetLeaveRequestHoursWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AActC,MAAM,oCAAoC,OACxC,SACA,EAAE,QAAQ,qBAAqB,GAC/B,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE,aAAa,YAAY;AAAA,IACzB,eAAe,OAAO,YAAY;AAChC,YAAM,EAAE,OAAO,IAAI;AACnB,aAAO,KAAK,sCAAiC;AAC7C,YAAM,SAAS,MAAM,qBAAqB,OAAO;AACjD,aAAO,KAAK,gCAAgC;AAC5C,aAAO;AAAA,IACT;AAAA,IACA,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,4CAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/helpers/handleGetLeaveRequestHoursWebhook.ts"],"sourcesContent":["import type {\n GetLeaveRequestHoursRequestPayload,\n GetLeaveRequestHoursResponsePayload,\n} from \"@worknice/utils/webhooks\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Tasks<Env, Req extends Request = Request> = {\n getEnv: (\n context: Pick<\n TaskContext<GetLeaveRequestHoursRequestPayload, Env, Req>,\n \"logger\" | \"payload\" | \"request\"\n >,\n ) => Promise<Env>;\n getLeaveRequestHours: (\n context: TaskContext<GetLeaveRequestHoursRequestPayload, Env, Req>,\n ) => Promise<GetLeaveRequestHoursResponsePayload>;\n};\n\nconst handleGetLeaveRequestHoursWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { getEnv, getLeaveRequestHours }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n GetLeaveRequestHoursRequestPayload,\n GetLeaveRequestHoursResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken: async () => undefined,\n handleRequest: async (context) => {\n const { logger } = context;\n logger.info(\"Retrieving leave request hours…\");\n const result = await getLeaveRequestHours(context);\n logger.info(\"Retrieved leave request hours.\");\n return result;\n },\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleGetLeaveRequestHoursWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AActC,MAAM,oCAAoC,OACxC,SACA,EAAE,QAAQ,qBAAqB,GAC/B,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE,aAAa,YAAY;AAAA,IACzB,eAAe,OAAO,YAAY;AAChC,YAAM,EAAE,OAAO,IAAI;AACnB,aAAO,KAAK,sCAAiC;AAC7C,YAAM,SAAS,MAAM,qBAAqB,OAAO;AACjD,aAAO,KAAK,gCAAgC;AAC5C,aAAO;AAAA,IACT;AAAA,IACA,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,4CAAQ;","names":[]}
@@ -1,4 +1,4 @@
1
- import { ProcessLeaveRequestResponsePayload, ProcessLeaveRequestRequestPayload } from '../webhooks.js';
1
+ import { ProcessLeaveRequestResponsePayload, ProcessLeaveRequestRequestPayload } from '@worknice/utils/webhooks';
2
2
  import { HandlerOptions, TaskContext } from './_types.js';
3
3
  import '../_types-Cobjq3B-.js';
4
4
  import '../api/_generated.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/handleProcessLeaveRequestWebhook.ts"],"sourcesContent":["import type {\n ProcessLeaveRequestRequestPayload,\n ProcessLeaveRequestResponsePayload,\n} from \"../webhooks.js\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n ProcessLeaveRequestRequestPayload,\n Env,\n Req\n>;\n\ntype Tasks<Env, Req extends Request = Request> = {\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string | undefined>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n processLeaveRequest: (context: Context<Env, Req>) => Promise<ProcessLeaveRequestResponsePayload>;\n};\n\nconst handleProcessLeaveRequestWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { processLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n ProcessLeaveRequestRequestPayload,\n ProcessLeaveRequestResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken,\n handleRequest: processLeaveRequest,\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleProcessLeaveRequestWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAgBtC,MAAM,mCAAmC,OACvC,SACA,EAAE,qBAAqB,aAAa,OAAO,GAC3C,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe;AAAA,IACf,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,2CAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/helpers/handleProcessLeaveRequestWebhook.ts"],"sourcesContent":["import type {\n ProcessLeaveRequestRequestPayload,\n ProcessLeaveRequestResponsePayload,\n} from \"@worknice/utils/webhooks\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n ProcessLeaveRequestRequestPayload,\n Env,\n Req\n>;\n\ntype Tasks<Env, Req extends Request = Request> = {\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string | undefined>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n processLeaveRequest: (context: Context<Env, Req>) => Promise<ProcessLeaveRequestResponsePayload>;\n};\n\nconst handleProcessLeaveRequestWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n { processLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<\n ProcessLeaveRequestRequestPayload,\n ProcessLeaveRequestResponsePayload,\n Env,\n Req\n >(\n request,\n {\n getApiToken,\n handleRequest: processLeaveRequest,\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nexport default handleProcessLeaveRequestWebhook;\n"],"mappings":"AAKA,OAAO,+BAA+B;AAgBtC,MAAM,mCAAmC,OACvC,SACA,EAAE,qBAAqB,aAAa,OAAO,GAC3C,YAEA;AAAA,EAME;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe;AAAA,IACf,cAAc,OAAO,YAAY;AAC/B,YAAM,UAAU,MAAM,QAAQ,QAAQ,KAAK;AAC3C,aAAO;AAAA,QACL,KAAK,MAAM,OAAO,EAAE,GAAG,SAAS,QAAQ,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AACF;AAEF,IAAO,2CAAQ;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import { W as WorkniceClient } from '../_types-Cobjq3B-.js';
2
2
  import { PersonDataTransferLine } from '../employee-records/_types.js';
3
- import { TriggerIntegrationSyncRequestPayload } from '../webhooks.js';
3
+ import { TriggerIntegrationSyncRequestPayload } from '@worknice/utils/webhooks';
4
4
  import { HandlerOptions, TaskContext } from './_types.js';
5
5
  import { ConnectionStatus } from '../api/_generated.js';
6
6
  import '../api/WorkniceIntegrationLogger.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/handleTriggerIntegrationSyncWebhook.ts"],"sourcesContent":["import isInstantAfter from \"@worknice/utils/temporal/isInstantAfter\";\nimport isValidInstant from \"@worknice/utils/temporal/isValidInstant\";\nimport { Temporal } from \"temporal-polyfill\";\nimport { ConnectionStatus, type GetPeopleQuery, type WorkniceClient } from \"../api/_types.js\";\nimport type { PersonDataTransferLine } from \"../employee-records/_types.js\";\nimport comparePersonDataTransferLines from \"../employee-records/comparePersonDataTransferLines.js\";\nimport mergePersonDataTransferLines from \"../employee-records/mergePersonDataTransferLines.js\";\nimport validatePersonDataTransferLine from \"../employee-records/validatePersonDataTransferLine.js\";\nimport validatePersonDataTransferLineBankAccounts from \"../employee-records/validatePersonDataTransferLineBankAccounts.js\";\nimport validatePersonDataTransferLineDateOfBirth from \"../employee-records/validatePersonDataTransferLineDateOfBirth.js\";\nimport validatePersonDataTransferLineFullName from \"../employee-records/validatePersonDataTransferLineFullName.js\";\nimport validatePersonDataTransferLineGender from \"../employee-records/validatePersonDataTransferLineGender.js\";\nimport validatePersonDataTransferLinePersonalEmail from \"../employee-records/validatePersonDataTransferLinePersonalEmail.js\";\nimport validatePersonDataTransferLinePersonalPhone from \"../employee-records/validatePersonDataTransferLinePersonalPhone.js\";\nimport validatePersonDataTransferLineProfile from \"../employee-records/validatePersonDataTransferLineProfile.js\";\nimport validatePersonDataTransferLineResidentialAddress from \"../employee-records/validatePersonDataTransferLineResidentialAddress.js\";\nimport type { TriggerIntegrationSyncRequestPayload } from \"../webhooks.js\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\nimport validatePersonDataTransferLineTaxDetails from \"../employee-records/validatePersonDataTransferLineTaxDetails.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n TriggerIntegrationSyncRequestPayload,\n Env,\n Req\n> & {\n integration: Awaited<ReturnType<WorkniceClient[\"getIntegration\"]>>;\n};\n\ntype Person = Omit<PersonDataTransferLine, \"profile\"> & {\n profile: NonNullable<PersonDataTransferLine[\"profile\"]>;\n} & {\n metadata: {\n deleted: boolean;\n employeeCode: string | null;\n sourceId: string;\n targetId: string | null;\n updatedAt: string;\n };\n};\n\ntype Tasks<Env, Req extends Request = Request> = {\n createRemotePerson?: (\n person: Person,\n context: Context<Env, Req>,\n ) => Promise<{\n id: string;\n name: string;\n status?: ConnectionStatus.Connected | ConnectionStatus.Merged;\n }>;\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string>;\n getConfig: (context: Context<Env, Req>) => Promise<Config>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n getRemotePeople: (context: Context<Env, Req>) => Promise<Array<Person>>;\n updateRemotePerson?: (person: Person, context: Context<Env, Req>) => Promise<unknown>;\n};\n\ntype Config = {\n appName: string;\n automaticMatching?: boolean;\n mode?: \"connection-only\" | \"one-way\" | \"two-way\";\n syncFields?: {\n bankAccounts?: boolean;\n dateOfBirth?: boolean;\n emergencyContacts?: boolean;\n fullName?: boolean;\n gender?: boolean;\n personalEmail?: boolean;\n personalPhone?: boolean;\n postalAddress?: boolean;\n profile?: boolean;\n remuneration?: boolean;\n residentialAddress?: boolean;\n superFunds?: boolean;\n taxDetails?: boolean;\n tenure?: boolean;\n };\n};\n\n/**\n * The process for syncing has four steps:\n *\n * 1. Update person connections: Create new person connections for Worknice\n * people or remote people that don't have existing connections. If needed,\n * update names of existing person connections. If enabled, automatically\n * match connections.\n *\n * 2. Update merged people: Copy details from the Worknice people to remote\n * people or vice-versa (based on whichever one was updated most recently)\n * for person connections that are already marked as merged.\n *\n * 3. Merge matched people: Update both Worknice people and remote people for\n * person connections that are marked as matched using details from both\n * people merged together. Mark the connections as merged.\n *\n * 4. Add new people to the remote app: Create new people in the remote app for\n * connections are unmatched and local-only. Mark the connections as merged.\n */\n\nconst handleTriggerIntegrationSyncWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n {\n createRemotePerson,\n getApiToken,\n getConfig,\n getEnv,\n getRemotePeople,\n updateRemotePerson,\n }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<TriggerIntegrationSyncRequestPayload, undefined, Env, Req>(\n request,\n {\n getApiToken,\n handleRequest: async (context) => {\n const { logger, payload, worknice } = context;\n\n let cachedDataImport: Awaited<ReturnType<WorkniceClient[\"createDataImport\"]>>;\n\n const getDataImport = async () => {\n if (!cachedDataImport) {\n cachedDataImport = await worknice.createDataImport({\n integrationId: payload.integrationId,\n });\n }\n\n return cachedDataImport;\n };\n\n try {\n logger.connect(worknice, payload.integrationId);\n\n logger.indent(\"Retrieving Worknice data…\");\n\n const integration = await worknice.getIntegration({\n integrationId: payload.integrationId,\n });\n\n if (integration.archived) {\n logger.info(\"Integration is archived. Skipping sync.\");\n return;\n }\n\n if (integration.status !== \"SYNCING\") {\n logger.info(\"Integration does not have a syncing status. Skipping sync.\");\n return;\n }\n\n logger.info(\"Retrieved integration from Worknice.\");\n\n const personConnections = await worknice.getPersonConnections({\n integrationId: payload.integrationId,\n });\n\n logger.info(`Retrieved ${personConnections.length} person connection(s) from Worknice.`);\n\n const people = await worknice.getPeople({ orgId: integration.org.id });\n\n logger.info(`Retrieved ${people.length} person(s) from Worknice.`);\n\n logger.dedent(\"Completed retrieving Worknice data.\");\n\n const contextWithIntegration = {\n ...context,\n integration,\n };\n\n logger.indent(\"Loading configuration details…\");\n\n const config = await getConfig(contextWithIntegration);\n\n logger.info(\n config.automaticMatching\n ? \"Automatic matching enabled.\"\n : \"Automatic matching disabled.\",\n );\n logger.info(`Using a \"${config.mode}\" sync mode.`);\n\n logger.dedent(\"Finished loading configuration details.\");\n\n logger.indent(`Retrieving ${config.appName} data…`);\n\n let remotePeople: Person[];\n\n try {\n remotePeople = await getRemotePeople(contextWithIntegration);\n } catch (error) {\n logger.info(`An error occurred while retrieving data from ${config.appName}.`);\n throw error;\n }\n\n logger.info(`Retrieved ${remotePeople.length} people from ${config.appName}.`);\n\n logger.dedent(`Completed retrieving ${config.appName} data.`);\n\n logger.indent(\"Updating person connections…\");\n\n for (const remotePerson of remotePeople) {\n const remotePersonName = personToName(remotePerson);\n try {\n const remotePersonConnection = personConnections.find(\n (\n connection,\n ): connection is typeof connection & {\n status:\n | ConnectionStatus.Connected\n | ConnectionStatus.Merged\n | ConnectionStatus.RemoteOnly;\n } => connection.remote?.id === remotePerson.metadata.sourceId,\n );\n\n if (remotePerson.metadata.deleted) {\n // The remote person has been deleted. If they have a person\n // connection, it should be deleted.\n\n if (remotePersonConnection) {\n await worknice.deletePersonConnection({\n personConnectionId: remotePersonConnection.id,\n });\n\n logger.info(\n `Deleted connection for ${config.appName} person \"${remotePersonName}\" because they have been terminated.`,\n );\n }\n } else {\n // A connection for remote person should be added or updated in\n // Worknice.\n\n if (\n remotePersonConnection &&\n (remotePersonConnection.status === ConnectionStatus.Connected ||\n remotePersonConnection.status === ConnectionStatus.Merged)\n ) {\n // The remote person is already connected to a Worknice person.\n\n if (remotePersonConnection.remote?.name !== remotePersonName) {\n // The employee's name has changed in the remote app and that\n // needs to be reflected in the person connection in Worknice.\n\n const connection = await worknice.updatePersonConnection({\n personConnectionId: remotePersonConnection.id,\n personId: remotePersonConnection.person.id,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: remotePersonConnection.status,\n });\n\n personConnections.splice(\n personConnections.indexOf(remotePersonConnection),\n 1,\n connection,\n );\n\n logger.info(\n `Updated person connection remote name from \"${remotePersonConnection.remote?.name}\" to \"${remotePersonName}\".`,\n );\n }\n } else {\n // The remote person is not already connected to a Worknice person, but\n // could already have a remote-only connection.\n\n if (\n remotePersonConnection &&\n remotePersonConnection.remote?.name !== remotePersonName\n ) {\n // The person's name has changed in the remote and that\n // needs to be reflected in the person connection in\n // Worknice.\n\n const connection = await worknice.updatePersonConnection({\n personConnectionId: remotePersonConnection.id,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: remotePersonConnection.status,\n });\n\n personConnections.splice(\n personConnections.indexOf(remotePersonConnection),\n 1,\n connection,\n );\n\n logger.info(\n `Updated person connection remote name from \"${remotePersonConnection.remote?.name}\" to \"${remotePersonName}\".`,\n );\n }\n\n const matchingWorknicePerson =\n people.find(\n (person) =>\n person.id === remotePerson.metadata.targetId ||\n (person.employeeCode !== null &&\n person.employeeCode === remotePerson.metadata.employeeCode) ||\n (person.personalEmail !== null &&\n person.personalEmail === remotePerson.personalEmail?.personalEmail) ||\n (person.profileEmail !== null &&\n person.profileEmail === remotePerson.profile?.profileEmail),\n ) ?? null;\n\n if (config.automaticMatching === true && matchingWorknicePerson) {\n // There is a person in Worknice with an ID, employee code\n // or email address that matches the remote person. The\n // Worknice person should be automatically connected to the\n // remote person.\n\n const personConnection = personConnections.find(\n (\n connection,\n ): connection is typeof connection & {\n status:\n | ConnectionStatus.Connected\n | ConnectionStatus.LocalOnly\n | ConnectionStatus.Merged;\n } => connection.person?.id === matchingWorknicePerson.id,\n );\n\n if (\n personConnection?.status === ConnectionStatus.Connected ||\n personConnection?.status === ConnectionStatus.Merged\n ) {\n // The person is already matched with a different remote person.\n\n logger.info(\n `Unable to automatically match Worknice person \"${matchingWorknicePerson.displayName}\" to ${config.appName} person \"${remotePersonName}\" because the Worknice person has already been matched to a different ${config.appName} person.`,\n );\n } else {\n // The Worknice person is not yet matched to a remote person. The\n // Worknice person and remote person records should be matched.\n\n if (personConnection) {\n // The Worknice person already has a local-only connection in this\n // integration that can be updated to match to this remote person.\n\n if (remotePersonConnection) {\n // There are person connections for both the Worknice\n // person and the remote person that need to be combined\n // into a single person connection.\n\n await worknice.deletePersonConnection({\n personConnectionId: personConnection.id,\n });\n\n personConnections.splice(personConnections.indexOf(personConnection), 1);\n\n const updatedConnection = await worknice.updatePersonConnection({\n personConnectionId: remotePersonConnection.id,\n personId: matchingWorknicePerson.id,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: ConnectionStatus.Connected,\n });\n\n personConnections.splice(\n personConnections.indexOf(remotePersonConnection),\n 1,\n updatedConnection,\n );\n\n logger.info(\n `Automatically matched and combined person connections for Worknice person \"${matchingWorknicePerson.displayName}\" and ${config.appName} person \"${remotePersonName}\".`,\n );\n } else {\n // There is a local-only connection for this Worknice person\n // that should be updated to connect to this remote person.\n\n const updatedConnection = await worknice.updatePersonConnection({\n personConnectionId: personConnection.id,\n personId: personConnection.person.id,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: ConnectionStatus.Connected,\n });\n\n personConnections.splice(\n personConnections.indexOf(personConnection),\n 1,\n updatedConnection,\n );\n\n logger.info(\n `Automatically matched existing person connection for Worknice person \"${matchingWorknicePerson.displayName}\" to ${config.appName} person \"${remotePersonName}\".`,\n );\n }\n } else {\n // The Worknice person does not have a connection in this\n // integration and should be connected now.\n\n if (remotePersonConnection) {\n // There is a remote-only connection for this remote person that\n // should be updated to match to this Worknice person.\n\n const updatedConnection = await worknice.updatePersonConnection({\n personConnectionId: remotePersonConnection.id,\n personId: matchingWorknicePerson.id,\n remote: {\n ...remotePersonConnection.remote,\n name: remotePersonName,\n },\n status: ConnectionStatus.Connected,\n });\n\n personConnections.splice(\n personConnections.indexOf(remotePersonConnection),\n 1,\n updatedConnection,\n );\n\n logger.info(\n `Automatically matched existing person connection for ${config.appName} person \"${remotePersonName}\" to Worknice person \"${matchingWorknicePerson.displayName}\".`,\n );\n } else {\n // There is no connection for the remote person or the\n // Worknice person in this integration. A new connection\n // should be created.\n\n const newPersonConnection = await worknice.createPersonConnection({\n integrationId: payload.integrationId,\n personId: matchingWorknicePerson.id,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: ConnectionStatus.Connected,\n });\n\n personConnections.push(newPersonConnection);\n\n logger.info(\n `Created new person connection for ${config.appName} person \"${remotePersonName}\" and automatically matched to Worknice person \"${matchingWorknicePerson.displayName}\".`,\n );\n }\n }\n }\n } else if (remotePersonConnection === undefined) {\n // There is no person in Worknice which should be automatically\n // connected to this remote person and there is no existing connection\n // for this remote person.\n\n const newPersonConnection = await worknice.createPersonConnection({\n integrationId: payload.integrationId,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: ConnectionStatus.RemoteOnly,\n });\n\n personConnections.push(newPersonConnection);\n\n logger.info(\n `New person connection created for ${config.appName} person \"${remotePersonName}\".`,\n );\n }\n }\n }\n } catch (error) {\n logger.indent(\n `Unable to update person connection for ${config.appName} person \"${remotePersonName}\" because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n }\n }\n\n logger.dedent(\"Finished updating person connections.\");\n\n if (config.mode === \"one-way\" || config.mode === \"two-way\") {\n logger.indent(\"Updating people with connections marked as merged…\");\n\n const mergedConnections = personConnections.filter(\n (\n personConnection,\n ): personConnection is typeof personConnection & {\n status: ConnectionStatus.Merged;\n } => personConnection.status === ConnectionStatus.Merged,\n );\n\n for (const personConnection of mergedConnections) {\n const worknicePerson = people.find(\n (person) => person.id === personConnection.person.id,\n );\n const remotePerson = remotePeople.find(\n (person) => person.metadata.sourceId === personConnection.remote.id,\n );\n\n try {\n if (!worknicePerson) {\n throw Error(\n `Unable to find person in Worknice with the ID \"${personConnection.person.id}\".`,\n );\n }\n if (!remotePerson) {\n throw Error(\n `Unable to find person in ${config.appName} with the ID \"${personConnection.remote.id}\".`,\n );\n }\n } catch (error) {\n logger.indent(\n `Unable to update Worknice person \"${personConnection.person.displayName}\" and/or ${config.appName} person \"${personConnection.remote.name}\" because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n continue;\n }\n\n const remotePersonName = personToName(remotePerson);\n\n const worknicePersonDataTransferLine = {\n ...worknicePersonToPersonDataTransferLine(worknicePerson),\n metadata: {\n deleted: false,\n employeeCode: worknicePerson.employeeCode ?? null,\n sourceId: worknicePerson.id,\n targetId: remotePerson.metadata.sourceId,\n updatedAt: worknicePerson.updatedAt,\n },\n };\n\n const remotePersonDataTransferLine = remotePerson;\n\n const comparison = comparePersonDataTransferLines(\n worknicePersonDataTransferLine,\n remotePersonDataTransferLine,\n );\n\n if (\n comparison.hasDifferences &&\n ((config.syncFields?.bankAccounts &&\n comparison.sections.bankAccounts.hasDifferences) ||\n (config.syncFields?.dateOfBirth &&\n comparison.sections.dateOfBirth.hasDifferences) ||\n (config.syncFields?.fullName && comparison.sections.fullName.hasDifferences) ||\n (config.syncFields?.gender && comparison.sections.gender.hasDifferences) ||\n (config.syncFields?.personalEmail &&\n comparison.sections.personalEmail.hasDifferences) ||\n (config.syncFields?.personalPhone &&\n comparison.sections.personalPhone.hasDifferences) ||\n (config.syncFields?.residentialAddress &&\n comparison.sections.residentialAddress.hasDifferences) ||\n (config.syncFields?.taxDetails && comparison.sections.taxDetails.hasDifferences))\n ) {\n // Differences found between the Worknice person and the remote\n // person. Update either the Worknice person or the remote\n // person with details from the other.\n\n const worknicePersonUpdatedAt = Temporal.Instant.from(worknicePerson.updatedAt);\n\n if (!isValidInstant(remotePerson.metadata.updatedAt)) {\n throw Error(\n `Invalid updatedAt value for ${config.appName} person \"${remotePersonName}\". Must be in ISO 8601 format, including a date, a time, and a time zone offset.`,\n {\n cause: Error(`Unable to parse: ${remotePerson.metadata.updatedAt}`),\n },\n );\n }\n\n const remotePersonUpdatedAt = Temporal.Instant.from(\n remotePerson.metadata.updatedAt,\n );\n\n if (isInstantAfter(worknicePersonUpdatedAt, remotePersonUpdatedAt)) {\n if (config.mode === \"two-way\") {\n // The Worknice person was updated more recently than the remote\n // person. Update the remote person using details from Worknice.\n\n if (!updateRemotePerson) {\n throw Error(\n \"No updateRemotePerson function supplied to handleTriggerIntegrationSyncWebhook.\",\n );\n }\n\n try {\n await updateRemotePerson(\n worknicePersonDataTransferLine,\n contextWithIntegration,\n );\n logger.info(`Updated ${config.appName} person \"${remotePersonName}\".`);\n } catch (error) {\n logger.indent(\n `Unable to update ${config.appName} person \"${remotePersonName}\" because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n }\n }\n } else {\n // The remote person was updated more recently than the\n // Worknice person. Update the Worknice person using details\n // from the remote.\n\n try {\n const bankAccounts = validatePersonDataTransferLineBankAccounts(\n remotePersonDataTransferLine.bankAccounts,\n );\n const dateOfBirth = validatePersonDataTransferLineDateOfBirth(\n remotePersonDataTransferLine.dateOfBirth,\n );\n // emergencyContacts\n const fullName = validatePersonDataTransferLineFullName(\n remotePersonDataTransferLine.fullName,\n );\n const gender = validatePersonDataTransferLineGender(\n remotePersonDataTransferLine.gender,\n );\n const personalEmail = validatePersonDataTransferLinePersonalEmail(\n remotePersonDataTransferLine.personalEmail,\n );\n const personalPhone = validatePersonDataTransferLinePersonalPhone(\n remotePersonDataTransferLine.personalPhone,\n );\n // postalAddress\n // profile\n // remuneration\n const residentialAddress = validatePersonDataTransferLineResidentialAddress(\n remotePersonDataTransferLine.residentialAddress,\n );\n // // TODO: Enable syncing super funds. See PROD-2216.\n // const superFunds = validatePersonDataTransferLineSuperFunds(remotePersonDataTransferLine.superFunds);\n const taxDetails = validatePersonDataTransferLineTaxDetails(\n remotePersonDataTransferLine.taxDetails,\n );\n // // TODO: Enable syncing tenure. See PROD-1371.\n // const tenure = validatePersonDataTransferLineTenure(remotePersonDataTransferLine.tenure);\n\n const dataImport = await getDataImport();\n\n await worknice.createPersonDataImportLine({\n bankAccounts,\n config: {\n bankAccounts: config.syncFields?.bankAccounts ?? false,\n dateOfBirth: config.syncFields?.dateOfBirth ?? false,\n emergencyContacts: config.syncFields?.emergencyContacts ?? false,\n fullName: config.syncFields?.fullName ?? false,\n gender: config.syncFields?.gender ?? false,\n personalEmail: config.syncFields?.personalEmail ?? false,\n personalPhone: config.syncFields?.personalPhone ?? false,\n postalAddress: config.syncFields?.postalAddress ?? false,\n profile: config.syncFields?.profile ?? false,\n remuneration: config.syncFields?.remuneration ?? false,\n residentialAddress: config.syncFields?.residentialAddress ?? false,\n superFunds: config.syncFields?.superFunds ?? false,\n taxDetails: config.syncFields?.taxDetails ?? false,\n tenure: config.syncFields?.tenure ?? false,\n },\n dataImportId: dataImport.id,\n dateOfBirth,\n emergencyContacts: null,\n fullName,\n gender,\n personalEmail,\n personalPhone,\n personId: worknicePerson.id,\n postalAddress: null,\n residentialAddress,\n // TODO: Enable syncing super funds. See PROD-2216.\n superFunds: null,\n taxDetails,\n // TODO: Enable syncing tenure. See PROD-1371.\n tenure: null,\n });\n\n logger.info(`Updated Worknice person \"${worknicePerson.displayName}\".`);\n } catch (error) {\n logger.indent(\n `Unable to update Worknice person \"${worknicePerson.displayName}\" because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n }\n }\n }\n }\n\n logger.dedent(\"Finished updating people with connections marked as merged.\");\n }\n\n logger.indent(\"Merging unmerged connections…\");\n\n const connectedConnections = personConnections.filter(\n (\n personConnection,\n ): personConnection is typeof personConnection & {\n status: ConnectionStatus.Connected;\n } => personConnection.status === ConnectionStatus.Connected,\n );\n\n for (const personConnection of connectedConnections) {\n let worknicePerson = people.find((person) => person.id === personConnection.person.id);\n\n const remotePerson = remotePeople.find(\n (person) => person.metadata.sourceId === personConnection.remote.id,\n );\n\n try {\n if (!worknicePerson) {\n throw Error(\n `Unable to find person in Worknice with the ID \"${personConnection.person.id}\".`,\n );\n }\n if (!remotePerson) {\n throw Error(\n `Unable to find person in ${config.appName} with the ID \"${personConnection.remote.id}\".`,\n );\n }\n } catch (error) {\n logger.indent(\n `Unable to merge Worknice person \"${personConnection.person.displayName}\" with ${config.appName} person \"${personConnection.remote.name}\" because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n continue;\n }\n\n const remotePersonName = personToName(remotePerson);\n\n logger.indent(\n `Merging Worknice person \"${worknicePerson.displayName}\" with ${config.appName} person \"${remotePersonName}\"…`,\n );\n\n try {\n if (config.mode === \"one-way\" || config.mode === \"two-way\") {\n const worknicePersonUpdatedAt = Temporal.Instant.from(worknicePerson.updatedAt);\n\n if (!isValidInstant(remotePerson.metadata.updatedAt)) {\n throw Error(\n `Invalid updatedAt value for ${config.appName} person \"${remotePersonName}\". Must be in ISO 8601 format, including a date, a time, and a time zone offset.`,\n {\n cause: Error(`Unable to parse: ${remotePerson.metadata.updatedAt}`),\n },\n );\n }\n\n const remotePersonUpdatedAt = Temporal.Instant.from(\n remotePerson.metadata.updatedAt,\n );\n\n const [primaryDataTransferLine, secondaryDataTransferLine] = isInstantAfter(\n worknicePersonUpdatedAt,\n remotePersonUpdatedAt,\n )\n ? [worknicePersonToPersonDataTransferLine(worknicePerson), remotePerson]\n : [remotePerson, worknicePersonToPersonDataTransferLine(worknicePerson)];\n const mergedDataTransferLine = mergePersonDataTransferLines(\n primaryDataTransferLine,\n secondaryDataTransferLine,\n );\n\n const bankAccounts = validatePersonDataTransferLineBankAccounts(\n mergedDataTransferLine.bankAccounts,\n );\n const dateOfBirth = validatePersonDataTransferLineDateOfBirth(\n mergedDataTransferLine.dateOfBirth,\n );\n // emergencyContacts\n const fullName = validatePersonDataTransferLineFullName(\n mergedDataTransferLine.fullName,\n );\n const gender = validatePersonDataTransferLineGender(mergedDataTransferLine.gender);\n const personalEmail = validatePersonDataTransferLinePersonalEmail(\n mergedDataTransferLine.personalEmail,\n );\n const personalPhone = validatePersonDataTransferLinePersonalPhone(\n mergedDataTransferLine.personalPhone,\n );\n // postalAddress\n const profile = validatePersonDataTransferLineProfile(\n mergedDataTransferLine.profile,\n );\n // remuneration\n const residentialAddress = validatePersonDataTransferLineResidentialAddress(\n mergedDataTransferLine.residentialAddress,\n );\n // // TODO: Enable syncing super funds. See PROD-2216.\n // const superFunds = validatePersonDataTransferLineSuperFunds(mergedDataTransferLine.superFunds);\n const taxDetails = validatePersonDataTransferLineTaxDetails(\n mergedDataTransferLine.taxDetails,\n );\n // // TODO: Enable syncing tenure. See PROD-1371.\n // const tenure = validatePersonDataTransferLineTenure(mergedDataTransferLine.tenure);\n\n const dataImport = await getDataImport();\n\n await worknice.createPersonDataImportLine({\n bankAccounts,\n config: {\n bankAccounts: config.syncFields?.bankAccounts ?? false,\n dateOfBirth: config.syncFields?.dateOfBirth ?? false,\n emergencyContacts: config.syncFields?.emergencyContacts ?? false,\n fullName: config.syncFields?.fullName ?? false,\n gender: config.syncFields?.gender ?? false,\n personalEmail: config.syncFields?.personalEmail ?? false,\n personalPhone: config.syncFields?.personalPhone ?? false,\n postalAddress: config.syncFields?.postalAddress ?? false,\n profile: config.syncFields?.profile ?? false,\n remuneration: config.syncFields?.remuneration ?? false,\n residentialAddress: config.syncFields?.residentialAddress ?? false,\n superFunds: config.syncFields?.superFunds ?? false,\n taxDetails: config.syncFields?.taxDetails ?? false,\n tenure: config.syncFields?.tenure ?? false,\n },\n dataImportId: dataImport.id,\n dateOfBirth,\n emergencyContacts: null,\n fullName,\n gender,\n personalEmail,\n personalPhone,\n personId: worknicePerson.id,\n postalAddress: null,\n residentialAddress,\n // TODO: Enable syncing super funds. See PROD-2216.\n superFunds: null,\n taxDetails,\n // TODO: Enable syncing tenure. See PROD-1371.\n tenure: null,\n });\n\n worknicePerson = await worknice.updatePerson({\n displayName: profile?.displayName,\n employeeCode: remotePerson.metadata.employeeCode,\n personId: worknicePerson.id,\n profileEmail: profile?.profileEmail,\n profilePhone: profile?.profilePhone,\n });\n\n logger.info(`Updated Worknice person \"${worknicePerson.displayName}\".`);\n\n if (config.mode === \"two-way\") {\n if (!updateRemotePerson) {\n throw Error(\n \"No updateRemotePerson function supplied to handleTriggerIntegrationSyncWebhook.\",\n );\n }\n\n await updateRemotePerson(\n {\n bankAccounts,\n dateOfBirth,\n emergencyContacts: null,\n fullName,\n gender,\n metadata: {\n deleted: false,\n employeeCode: worknicePerson.employeeCode ?? null,\n sourceId: worknicePerson.id,\n targetId: remotePerson.metadata.sourceId,\n updatedAt: worknicePerson.updatedAt,\n },\n personalEmail,\n personalPhone,\n postalAddress: null,\n profile: {\n displayName: worknicePerson.displayName,\n profileEmail: worknicePerson.profileEmail ?? null,\n profilePhone: worknicePerson.profilePhone ?? null,\n },\n residentialAddress,\n // TODO: Enable syncing super funds. See PROD-2216.\n superFunds: null,\n taxDetails,\n // TODO: Enable syncing tenure. See PROD-1371.\n tenure: null,\n },\n contextWithIntegration,\n );\n\n logger.info(`Updated ${config.appName} person \"${remotePersonName}\".`);\n }\n }\n\n await worknice.updatePersonConnection({\n personConnectionId: personConnection.id,\n personId: personConnection.person.id,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: ConnectionStatus.Merged,\n });\n\n logger.dedent(`Finished merging.`);\n } catch (error) {\n logger.indent(\n `Unable to merge ${config.appName} person \"${remotePersonName}\" and Worknice person \"${worknicePerson.displayName}\" because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n logger.dedent();\n }\n }\n\n logger.dedent(\"Finished merging unmerged connections.\");\n\n if (config.mode === \"two-way\") {\n logger.indent(`Adding new people to ${config.appName}…`);\n\n const localOnlyConnections = personConnections.filter(\n (\n personConnection,\n ): personConnection is typeof personConnection & {\n status: ConnectionStatus.LocalOnly;\n } => personConnection.status === ConnectionStatus.LocalOnly,\n );\n\n for (const personConnection of localOnlyConnections) {\n const worknicePerson = people.find(\n (person) => person.id === personConnection.person.id,\n );\n\n if (!worknicePerson) {\n throw Error(\n `Unable to find person in Worknice with the ID \"${personConnection.person.id}\".`,\n );\n }\n\n try {\n if (!createRemotePerson) {\n throw Error(\n \"No createRemotePerson function supplied to handleTriggerIntegrationSyncWebhook.\",\n );\n }\n\n const { status, ...remote } = await createRemotePerson(\n {\n ...worknicePersonToPersonDataTransferLine(worknicePerson),\n metadata: {\n deleted: false,\n employeeCode: worknicePerson.employeeCode ?? null,\n sourceId: worknicePerson.id,\n targetId: null,\n updatedAt: worknicePerson.updatedAt,\n },\n },\n contextWithIntegration,\n );\n\n if (personConnections.some((connection) => connection.remote?.id === remote.id)) {\n throw Error(\n `A connection already exists for the ${config.appName} person \"${remote.name}\".`,\n );\n }\n\n await worknice.updatePersonConnection({\n personConnectionId: personConnection.id,\n personId: personConnection.person.id,\n remote,\n status: status ?? ConnectionStatus.Merged,\n });\n\n logger.info(`Added new person \"${remote.name}\" to ${config.appName}.`);\n } catch (error) {\n logger.indent(\n `Unable to add Worknice person \"${worknicePerson.displayName}\" to ${config.appName} because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n }\n }\n\n logger.dedent(`Finished adding new people to ${config.appName}.`);\n }\n\n await worknice.completeSync({ integrationId: payload.integrationId });\n\n logger.info(\"Sync completed.\");\n } catch (error) {\n await worknice.completeSync({ integrationId: payload.integrationId });\n throw error;\n }\n },\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nconst personToName = (person: Person) => {\n if (\n (person.fullName?.givenName ?? \"\").trim() !== \"\" &&\n (person.fullName?.familyName ?? \"\").trim() !== \"\"\n ) {\n return `${person.fullName?.givenName} ${person.fullName?.familyName}`;\n }\n\n if ((person.profile?.displayName ?? \"\").trim() !== \"\") {\n return `${person.profile?.displayName}`;\n }\n\n return `(unnamed person ${person.metadata.sourceId})`;\n};\n\nconst worknicePersonToPersonDataTransferLine = (\n worknicePerson: NonNullable<GetPeopleQuery[\"org\"][\"people\"][number]>,\n): Omit<Person, \"metadata\"> => ({\n ...validatePersonDataTransferLine({\n bankAccounts: worknicePerson.bankAccount1AllocationMethod\n ? {\n bankAccount1Allocation: worknicePerson.bankAccount1Allocation ?? null,\n bankAccount1AllocationMethod: worknicePerson.bankAccount1AllocationMethod,\n bankAccount1Bsb: worknicePerson.bankAccount1Bsb ?? null,\n bankAccount1Name: worknicePerson.bankAccount1Name ?? null,\n bankAccount1Number: worknicePerson.bankAccount1Number ?? null,\n bankAccount2Allocation: worknicePerson.bankAccount2Allocation ?? null,\n bankAccount2AllocationMethod: worknicePerson.bankAccount2AllocationMethod ?? null,\n bankAccount2Bsb: worknicePerson.bankAccount2Bsb ?? null,\n bankAccount2Name: worknicePerson.bankAccount2Name ?? null,\n bankAccount2Number: worknicePerson.bankAccount2Number ?? null,\n bankAccount3Allocation: worknicePerson.bankAccount3Allocation ?? null,\n bankAccount3AllocationMethod: worknicePerson.bankAccount3AllocationMethod ?? null,\n bankAccount3Bsb: worknicePerson.bankAccount3Bsb ?? null,\n bankAccount3Name: worknicePerson.bankAccount3Name ?? null,\n bankAccount3Number: worknicePerson.bankAccount3Number ?? null,\n bankAccount4Allocation: worknicePerson.bankAccount4Allocation ?? null,\n bankAccount4AllocationMethod: worknicePerson.bankAccount4AllocationMethod ?? null,\n bankAccount4Bsb: worknicePerson.bankAccount4Bsb ?? null,\n bankAccount4Name: worknicePerson.bankAccount4Name ?? null,\n bankAccount4Number: worknicePerson.bankAccount4Number ?? null,\n bankAccount5Allocation: worknicePerson.bankAccount5Allocation ?? null,\n bankAccount5AllocationMethod: worknicePerson.bankAccount5AllocationMethod ?? null,\n bankAccount5Bsb: worknicePerson.bankAccount5Bsb ?? null,\n bankAccount5Name: worknicePerson.bankAccount5Name ?? null,\n bankAccount5Number: worknicePerson.bankAccount5Number ?? null,\n }\n : null,\n dateOfBirth: worknicePerson.dateOfBirth ? { dateOfBirth: worknicePerson.dateOfBirth } : null,\n emergencyContacts: null,\n fullName: worknicePerson.givenName\n ? {\n familyName: worknicePerson.familyName ?? null,\n givenName: worknicePerson.givenName,\n otherGivenNames: worknicePerson.otherGivenNames ?? null,\n }\n : null,\n gender: worknicePerson.gender\n ? {\n gender: worknicePerson.gender,\n }\n : null,\n personalEmail: worknicePerson.personalEmail\n ? {\n personalEmail: worknicePerson.personalEmail,\n }\n : null,\n personalPhone: worknicePerson.personalPhone\n ? {\n personalPhone: worknicePerson.personalPhone,\n }\n : null,\n postalAddress: null,\n profile: null,\n residentialAddress: worknicePerson.residentialAddressLine1\n ? {\n residentialAddressCity: worknicePerson.residentialAddressCity ?? null,\n // FIXME: This should not default to \"Australia\". See PROD-1085.\n residentialAddressCountry: worknicePerson.residentialAddressCountry ?? \"Australia\",\n residentialAddressLine1: worknicePerson.residentialAddressLine1,\n residentialAddressLine2: worknicePerson.residentialAddressLine2 ?? null,\n residentialAddressPostcode: worknicePerson.residentialAddressPostcode ?? null,\n residentialAddressState: worknicePerson.residentialAddressState ?? null,\n }\n : null,\n // TODO: Enable syncing super funds. See PROD-2216.\n superFunds: null,\n taxDetails: worknicePerson.taxFileNumberExemption\n ? {\n hasLoanOrStudentDebt: worknicePerson.hasLoanOrStudentDebt ?? null,\n residencyStatus: worknicePerson.residencyStatus ?? null,\n taxFileNumber: worknicePerson.taxFileNumber ?? null,\n taxFileNumberExemption: worknicePerson.taxFileNumberExemption ?? null,\n taxFreeThresholdClaimed: worknicePerson.taxFreeThresholdClaimed ?? null,\n }\n : null,\n // TODO: Enable syncing tenure. See PROD-1371.\n tenure: null,\n }),\n profile: {\n displayName: worknicePerson.displayName,\n profileEmail: worknicePerson.profileEmail ?? null,\n profilePhone: worknicePerson.profilePhone ?? null,\n },\n});\n\nexport default handleTriggerIntegrationSyncWebhook;\n"],"mappings":"AAAA,OAAO,oBAAoB;AAC3B,OAAO,oBAAoB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,wBAAkE;AAE3E,OAAO,oCAAoC;AAC3C,OAAO,kCAAkC;AACzC,OAAO,oCAAoC;AAC3C,OAAO,gDAAgD;AACvD,OAAO,+CAA+C;AACtD,OAAO,4CAA4C;AACnD,OAAO,0CAA0C;AACjD,OAAO,iDAAiD;AACxD,OAAO,iDAAiD;AACxD,OAAO,2CAA2C;AAClD,OAAO,sDAAsD;AAG7D,OAAO,+BAA+B;AACtC,OAAO,8CAA8C;AAkFrD,MAAM,sCAAsC,OAC1C,SACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GACA,YAEA;AAAA,EACE;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe,OAAO,YAAY;AAChC,YAAM,EAAE,QAAQ,SAAS,SAAS,IAAI;AAEtC,UAAI;AAEJ,YAAM,gBAAgB,YAAY;AAChC,YAAI,CAAC,kBAAkB;AACrB,6BAAmB,MAAM,SAAS,iBAAiB;AAAA,YACjD,eAAe,QAAQ;AAAA,UACzB,CAAC;AAAA,QACH;AAEA,eAAO;AAAA,MACT;AAEA,UAAI;AACF,eAAO,QAAQ,UAAU,QAAQ,aAAa;AAE9C,eAAO,OAAO,gCAA2B;AAEzC,cAAM,cAAc,MAAM,SAAS,eAAe;AAAA,UAChD,eAAe,QAAQ;AAAA,QACzB,CAAC;AAED,YAAI,YAAY,UAAU;AACxB,iBA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AAAA,IACJ,eAAe;AAAA,IACf,SAAS;AAAA,IACT,oBAAoB,eAAe,0BAC/B;AAAA,MACE,wBAAwB,eAAe,0BAA0B;AAAA;AAAA,MAEjE,2BAA2B,eAAe,6BAA6B;AAAA,MACvE,yBAAyB,eAAe;AAAA,MACxC,yBAAyB,eAAe,2BAA2B;AAAA,MACnE,4BAA4B,eAAe,8BAA8B;AAAA,MACzE,yBAAyB,eAAe,2BAA2B;AAAA,IACrE,IACA;AAAA;AAAA,IAEJ,YAAY;AAAA,IACZ,YAAY,eAAe,yBACvB;AAAA,MACE,sBAAsB,eAAe,wBAAwB;AAAA,MAC7D,iBAAiB,eAAe,mBAAmB;AAAA,MACnD,eAAe,eAAe,iBAAiB;AAAA,MAC/C,wBAAwB,eAAe,0BAA0B;AAAA,MACjE,yBAAyB,eAAe,2BAA2B;AAAA,IACrE,IACA;AAAA;AAAA,IAEJ,QAAQ;AAAA,EACV,CAAC;AAAA,EACD,SAAS;AAAA,IACP,aAAa,eAAe;AAAA,IAC5B,cAAc,eAAe,gBAAgB;AAAA,IAC7C,cAAc,eAAe,gBAAgB;AAAA,EAC/C;AACF;AAEA,IAAO,8CAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/helpers/handleTriggerIntegrationSyncWebhook.ts"],"sourcesContent":["import isInstantAfter from \"@worknice/utils/temporal/isInstantAfter\";\nimport isValidInstant from \"@worknice/utils/temporal/isValidInstant\";\nimport { Temporal } from \"temporal-polyfill\";\nimport { ConnectionStatus, type GetPeopleQuery, type WorkniceClient } from \"../api/_types.js\";\nimport type { PersonDataTransferLine } from \"../employee-records/_types.js\";\nimport comparePersonDataTransferLines from \"../employee-records/comparePersonDataTransferLines.js\";\nimport mergePersonDataTransferLines from \"../employee-records/mergePersonDataTransferLines.js\";\nimport validatePersonDataTransferLine from \"../employee-records/validatePersonDataTransferLine.js\";\nimport validatePersonDataTransferLineBankAccounts from \"../employee-records/validatePersonDataTransferLineBankAccounts.js\";\nimport validatePersonDataTransferLineDateOfBirth from \"../employee-records/validatePersonDataTransferLineDateOfBirth.js\";\nimport validatePersonDataTransferLineFullName from \"../employee-records/validatePersonDataTransferLineFullName.js\";\nimport validatePersonDataTransferLineGender from \"../employee-records/validatePersonDataTransferLineGender.js\";\nimport validatePersonDataTransferLinePersonalEmail from \"../employee-records/validatePersonDataTransferLinePersonalEmail.js\";\nimport validatePersonDataTransferLinePersonalPhone from \"../employee-records/validatePersonDataTransferLinePersonalPhone.js\";\nimport validatePersonDataTransferLineProfile from \"../employee-records/validatePersonDataTransferLineProfile.js\";\nimport validatePersonDataTransferLineResidentialAddress from \"../employee-records/validatePersonDataTransferLineResidentialAddress.js\";\nimport type { TriggerIntegrationSyncRequestPayload } from \"@worknice/utils/webhooks\";\nimport type { HandlerOptions, TaskContext } from \"./_types.js\";\nimport handleRequestWithWorknice from \"./handleRequestWithWorknice.js\";\nimport validatePersonDataTransferLineTaxDetails from \"../employee-records/validatePersonDataTransferLineTaxDetails.js\";\n\ntype Context<Env, Req extends Request = Request> = TaskContext<\n TriggerIntegrationSyncRequestPayload,\n Env,\n Req\n> & {\n integration: Awaited<ReturnType<WorkniceClient[\"getIntegration\"]>>;\n};\n\ntype Person = Omit<PersonDataTransferLine, \"profile\"> & {\n profile: NonNullable<PersonDataTransferLine[\"profile\"]>;\n} & {\n metadata: {\n deleted: boolean;\n employeeCode: string | null;\n sourceId: string;\n targetId: string | null;\n updatedAt: string;\n };\n};\n\ntype Tasks<Env, Req extends Request = Request> = {\n createRemotePerson?: (\n person: Person,\n context: Context<Env, Req>,\n ) => Promise<{\n id: string;\n name: string;\n status?: ConnectionStatus.Connected | ConnectionStatus.Merged;\n }>;\n getApiToken: (\n context: Pick<Context<Env, Req>, \"env\" | \"logger\" | \"payload\" | \"request\">,\n ) => Promise<string>;\n getConfig: (context: Context<Env, Req>) => Promise<Config>;\n getEnv: (context: Pick<Context<Env, Req>, \"logger\" | \"payload\" | \"request\">) => Promise<Env>;\n getRemotePeople: (context: Context<Env, Req>) => Promise<Array<Person>>;\n updateRemotePerson?: (person: Person, context: Context<Env, Req>) => Promise<unknown>;\n};\n\ntype Config = {\n appName: string;\n automaticMatching?: boolean;\n mode?: \"connection-only\" | \"one-way\" | \"two-way\";\n syncFields?: {\n bankAccounts?: boolean;\n dateOfBirth?: boolean;\n emergencyContacts?: boolean;\n fullName?: boolean;\n gender?: boolean;\n personalEmail?: boolean;\n personalPhone?: boolean;\n postalAddress?: boolean;\n profile?: boolean;\n remuneration?: boolean;\n residentialAddress?: boolean;\n superFunds?: boolean;\n taxDetails?: boolean;\n tenure?: boolean;\n };\n};\n\n/**\n * The process for syncing has four steps:\n *\n * 1. Update person connections: Create new person connections for Worknice\n * people or remote people that don't have existing connections. If needed,\n * update names of existing person connections. If enabled, automatically\n * match connections.\n *\n * 2. Update merged people: Copy details from the Worknice people to remote\n * people or vice-versa (based on whichever one was updated most recently)\n * for person connections that are already marked as merged.\n *\n * 3. Merge matched people: Update both Worknice people and remote people for\n * person connections that are marked as matched using details from both\n * people merged together. Mark the connections as merged.\n *\n * 4. Add new people to the remote app: Create new people in the remote app for\n * connections are unmatched and local-only. Mark the connections as merged.\n */\n\nconst handleTriggerIntegrationSyncWebhook = async <Env, Req extends Request = Request>(\n request: Req,\n {\n createRemotePerson,\n getApiToken,\n getConfig,\n getEnv,\n getRemotePeople,\n updateRemotePerson,\n }: Tasks<Env, Req>,\n options?: HandlerOptions,\n) =>\n handleRequestWithWorknice<TriggerIntegrationSyncRequestPayload, undefined, Env, Req>(\n request,\n {\n getApiToken,\n handleRequest: async (context) => {\n const { logger, payload, worknice } = context;\n\n let cachedDataImport: Awaited<ReturnType<WorkniceClient[\"createDataImport\"]>>;\n\n const getDataImport = async () => {\n if (!cachedDataImport) {\n cachedDataImport = await worknice.createDataImport({\n integrationId: payload.integrationId,\n });\n }\n\n return cachedDataImport;\n };\n\n try {\n logger.connect(worknice, payload.integrationId);\n\n logger.indent(\"Retrieving Worknice data…\");\n\n const integration = await worknice.getIntegration({\n integrationId: payload.integrationId,\n });\n\n if (integration.archived) {\n logger.info(\"Integration is archived. Skipping sync.\");\n return;\n }\n\n if (integration.status !== \"SYNCING\") {\n logger.info(\"Integration does not have a syncing status. Skipping sync.\");\n return;\n }\n\n logger.info(\"Retrieved integration from Worknice.\");\n\n const personConnections = await worknice.getPersonConnections({\n integrationId: payload.integrationId,\n });\n\n logger.info(`Retrieved ${personConnections.length} person connection(s) from Worknice.`);\n\n const people = await worknice.getPeople({ orgId: integration.org.id });\n\n logger.info(`Retrieved ${people.length} person(s) from Worknice.`);\n\n logger.dedent(\"Completed retrieving Worknice data.\");\n\n const contextWithIntegration = {\n ...context,\n integration,\n };\n\n logger.indent(\"Loading configuration details…\");\n\n const config = await getConfig(contextWithIntegration);\n\n logger.info(\n config.automaticMatching\n ? \"Automatic matching enabled.\"\n : \"Automatic matching disabled.\",\n );\n logger.info(`Using a \"${config.mode}\" sync mode.`);\n\n logger.dedent(\"Finished loading configuration details.\");\n\n logger.indent(`Retrieving ${config.appName} data…`);\n\n let remotePeople: Person[];\n\n try {\n remotePeople = await getRemotePeople(contextWithIntegration);\n } catch (error) {\n logger.info(`An error occurred while retrieving data from ${config.appName}.`);\n throw error;\n }\n\n logger.info(`Retrieved ${remotePeople.length} people from ${config.appName}.`);\n\n logger.dedent(`Completed retrieving ${config.appName} data.`);\n\n logger.indent(\"Updating person connections…\");\n\n for (const remotePerson of remotePeople) {\n const remotePersonName = personToName(remotePerson);\n try {\n const remotePersonConnection = personConnections.find(\n (\n connection,\n ): connection is typeof connection & {\n status:\n | ConnectionStatus.Connected\n | ConnectionStatus.Merged\n | ConnectionStatus.RemoteOnly;\n } => connection.remote?.id === remotePerson.metadata.sourceId,\n );\n\n if (remotePerson.metadata.deleted) {\n // The remote person has been deleted. If they have a person\n // connection, it should be deleted.\n\n if (remotePersonConnection) {\n await worknice.deletePersonConnection({\n personConnectionId: remotePersonConnection.id,\n });\n\n logger.info(\n `Deleted connection for ${config.appName} person \"${remotePersonName}\" because they have been terminated.`,\n );\n }\n } else {\n // A connection for remote person should be added or updated in\n // Worknice.\n\n if (\n remotePersonConnection &&\n (remotePersonConnection.status === ConnectionStatus.Connected ||\n remotePersonConnection.status === ConnectionStatus.Merged)\n ) {\n // The remote person is already connected to a Worknice person.\n\n if (remotePersonConnection.remote?.name !== remotePersonName) {\n // The employee's name has changed in the remote app and that\n // needs to be reflected in the person connection in Worknice.\n\n const connection = await worknice.updatePersonConnection({\n personConnectionId: remotePersonConnection.id,\n personId: remotePersonConnection.person.id,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: remotePersonConnection.status,\n });\n\n personConnections.splice(\n personConnections.indexOf(remotePersonConnection),\n 1,\n connection,\n );\n\n logger.info(\n `Updated person connection remote name from \"${remotePersonConnection.remote?.name}\" to \"${remotePersonName}\".`,\n );\n }\n } else {\n // The remote person is not already connected to a Worknice person, but\n // could already have a remote-only connection.\n\n if (\n remotePersonConnection &&\n remotePersonConnection.remote?.name !== remotePersonName\n ) {\n // The person's name has changed in the remote and that\n // needs to be reflected in the person connection in\n // Worknice.\n\n const connection = await worknice.updatePersonConnection({\n personConnectionId: remotePersonConnection.id,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: remotePersonConnection.status,\n });\n\n personConnections.splice(\n personConnections.indexOf(remotePersonConnection),\n 1,\n connection,\n );\n\n logger.info(\n `Updated person connection remote name from \"${remotePersonConnection.remote?.name}\" to \"${remotePersonName}\".`,\n );\n }\n\n const matchingWorknicePerson =\n people.find(\n (person) =>\n person.id === remotePerson.metadata.targetId ||\n (person.employeeCode !== null &&\n person.employeeCode === remotePerson.metadata.employeeCode) ||\n (person.personalEmail !== null &&\n person.personalEmail === remotePerson.personalEmail?.personalEmail) ||\n (person.profileEmail !== null &&\n person.profileEmail === remotePerson.profile?.profileEmail),\n ) ?? null;\n\n if (config.automaticMatching === true && matchingWorknicePerson) {\n // There is a person in Worknice with an ID, employee code\n // or email address that matches the remote person. The\n // Worknice person should be automatically connected to the\n // remote person.\n\n const personConnection = personConnections.find(\n (\n connection,\n ): connection is typeof connection & {\n status:\n | ConnectionStatus.Connected\n | ConnectionStatus.LocalOnly\n | ConnectionStatus.Merged;\n } => connection.person?.id === matchingWorknicePerson.id,\n );\n\n if (\n personConnection?.status === ConnectionStatus.Connected ||\n personConnection?.status === ConnectionStatus.Merged\n ) {\n // The person is already matched with a different remote person.\n\n logger.info(\n `Unable to automatically match Worknice person \"${matchingWorknicePerson.displayName}\" to ${config.appName} person \"${remotePersonName}\" because the Worknice person has already been matched to a different ${config.appName} person.`,\n );\n } else {\n // The Worknice person is not yet matched to a remote person. The\n // Worknice person and remote person records should be matched.\n\n if (personConnection) {\n // The Worknice person already has a local-only connection in this\n // integration that can be updated to match to this remote person.\n\n if (remotePersonConnection) {\n // There are person connections for both the Worknice\n // person and the remote person that need to be combined\n // into a single person connection.\n\n await worknice.deletePersonConnection({\n personConnectionId: personConnection.id,\n });\n\n personConnections.splice(personConnections.indexOf(personConnection), 1);\n\n const updatedConnection = await worknice.updatePersonConnection({\n personConnectionId: remotePersonConnection.id,\n personId: matchingWorknicePerson.id,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: ConnectionStatus.Connected,\n });\n\n personConnections.splice(\n personConnections.indexOf(remotePersonConnection),\n 1,\n updatedConnection,\n );\n\n logger.info(\n `Automatically matched and combined person connections for Worknice person \"${matchingWorknicePerson.displayName}\" and ${config.appName} person \"${remotePersonName}\".`,\n );\n } else {\n // There is a local-only connection for this Worknice person\n // that should be updated to connect to this remote person.\n\n const updatedConnection = await worknice.updatePersonConnection({\n personConnectionId: personConnection.id,\n personId: personConnection.person.id,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: ConnectionStatus.Connected,\n });\n\n personConnections.splice(\n personConnections.indexOf(personConnection),\n 1,\n updatedConnection,\n );\n\n logger.info(\n `Automatically matched existing person connection for Worknice person \"${matchingWorknicePerson.displayName}\" to ${config.appName} person \"${remotePersonName}\".`,\n );\n }\n } else {\n // The Worknice person does not have a connection in this\n // integration and should be connected now.\n\n if (remotePersonConnection) {\n // There is a remote-only connection for this remote person that\n // should be updated to match to this Worknice person.\n\n const updatedConnection = await worknice.updatePersonConnection({\n personConnectionId: remotePersonConnection.id,\n personId: matchingWorknicePerson.id,\n remote: {\n ...remotePersonConnection.remote,\n name: remotePersonName,\n },\n status: ConnectionStatus.Connected,\n });\n\n personConnections.splice(\n personConnections.indexOf(remotePersonConnection),\n 1,\n updatedConnection,\n );\n\n logger.info(\n `Automatically matched existing person connection for ${config.appName} person \"${remotePersonName}\" to Worknice person \"${matchingWorknicePerson.displayName}\".`,\n );\n } else {\n // There is no connection for the remote person or the\n // Worknice person in this integration. A new connection\n // should be created.\n\n const newPersonConnection = await worknice.createPersonConnection({\n integrationId: payload.integrationId,\n personId: matchingWorknicePerson.id,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: ConnectionStatus.Connected,\n });\n\n personConnections.push(newPersonConnection);\n\n logger.info(\n `Created new person connection for ${config.appName} person \"${remotePersonName}\" and automatically matched to Worknice person \"${matchingWorknicePerson.displayName}\".`,\n );\n }\n }\n }\n } else if (remotePersonConnection === undefined) {\n // There is no person in Worknice which should be automatically\n // connected to this remote person and there is no existing connection\n // for this remote person.\n\n const newPersonConnection = await worknice.createPersonConnection({\n integrationId: payload.integrationId,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: ConnectionStatus.RemoteOnly,\n });\n\n personConnections.push(newPersonConnection);\n\n logger.info(\n `New person connection created for ${config.appName} person \"${remotePersonName}\".`,\n );\n }\n }\n }\n } catch (error) {\n logger.indent(\n `Unable to update person connection for ${config.appName} person \"${remotePersonName}\" because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n }\n }\n\n logger.dedent(\"Finished updating person connections.\");\n\n if (config.mode === \"one-way\" || config.mode === \"two-way\") {\n logger.indent(\"Updating people with connections marked as merged…\");\n\n const mergedConnections = personConnections.filter(\n (\n personConnection,\n ): personConnection is typeof personConnection & {\n status: ConnectionStatus.Merged;\n } => personConnection.status === ConnectionStatus.Merged,\n );\n\n for (const personConnection of mergedConnections) {\n const worknicePerson = people.find(\n (person) => person.id === personConnection.person.id,\n );\n const remotePerson = remotePeople.find(\n (person) => person.metadata.sourceId === personConnection.remote.id,\n );\n\n try {\n if (!worknicePerson) {\n throw Error(\n `Unable to find person in Worknice with the ID \"${personConnection.person.id}\".`,\n );\n }\n if (!remotePerson) {\n throw Error(\n `Unable to find person in ${config.appName} with the ID \"${personConnection.remote.id}\".`,\n );\n }\n } catch (error) {\n logger.indent(\n `Unable to update Worknice person \"${personConnection.person.displayName}\" and/or ${config.appName} person \"${personConnection.remote.name}\" because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n continue;\n }\n\n const remotePersonName = personToName(remotePerson);\n\n const worknicePersonDataTransferLine = {\n ...worknicePersonToPersonDataTransferLine(worknicePerson),\n metadata: {\n deleted: false,\n employeeCode: worknicePerson.employeeCode ?? null,\n sourceId: worknicePerson.id,\n targetId: remotePerson.metadata.sourceId,\n updatedAt: worknicePerson.updatedAt,\n },\n };\n\n const remotePersonDataTransferLine = remotePerson;\n\n const comparison = comparePersonDataTransferLines(\n worknicePersonDataTransferLine,\n remotePersonDataTransferLine,\n );\n\n if (\n comparison.hasDifferences &&\n ((config.syncFields?.bankAccounts &&\n comparison.sections.bankAccounts.hasDifferences) ||\n (config.syncFields?.dateOfBirth &&\n comparison.sections.dateOfBirth.hasDifferences) ||\n (config.syncFields?.fullName && comparison.sections.fullName.hasDifferences) ||\n (config.syncFields?.gender && comparison.sections.gender.hasDifferences) ||\n (config.syncFields?.personalEmail &&\n comparison.sections.personalEmail.hasDifferences) ||\n (config.syncFields?.personalPhone &&\n comparison.sections.personalPhone.hasDifferences) ||\n (config.syncFields?.residentialAddress &&\n comparison.sections.residentialAddress.hasDifferences) ||\n (config.syncFields?.taxDetails && comparison.sections.taxDetails.hasDifferences))\n ) {\n // Differences found between the Worknice person and the remote\n // person. Update either the Worknice person or the remote\n // person with details from the other.\n\n const worknicePersonUpdatedAt = Temporal.Instant.from(worknicePerson.updatedAt);\n\n if (!isValidInstant(remotePerson.metadata.updatedAt)) {\n throw Error(\n `Invalid updatedAt value for ${config.appName} person \"${remotePersonName}\". Must be in ISO 8601 format, including a date, a time, and a time zone offset.`,\n {\n cause: Error(`Unable to parse: ${remotePerson.metadata.updatedAt}`),\n },\n );\n }\n\n const remotePersonUpdatedAt = Temporal.Instant.from(\n remotePerson.metadata.updatedAt,\n );\n\n if (isInstantAfter(worknicePersonUpdatedAt, remotePersonUpdatedAt)) {\n if (config.mode === \"two-way\") {\n // The Worknice person was updated more recently than the remote\n // person. Update the remote person using details from Worknice.\n\n if (!updateRemotePerson) {\n throw Error(\n \"No updateRemotePerson function supplied to handleTriggerIntegrationSyncWebhook.\",\n );\n }\n\n try {\n await updateRemotePerson(\n worknicePersonDataTransferLine,\n contextWithIntegration,\n );\n logger.info(`Updated ${config.appName} person \"${remotePersonName}\".`);\n } catch (error) {\n logger.indent(\n `Unable to update ${config.appName} person \"${remotePersonName}\" because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n }\n }\n } else {\n // The remote person was updated more recently than the\n // Worknice person. Update the Worknice person using details\n // from the remote.\n\n try {\n const bankAccounts = validatePersonDataTransferLineBankAccounts(\n remotePersonDataTransferLine.bankAccounts,\n );\n const dateOfBirth = validatePersonDataTransferLineDateOfBirth(\n remotePersonDataTransferLine.dateOfBirth,\n );\n // emergencyContacts\n const fullName = validatePersonDataTransferLineFullName(\n remotePersonDataTransferLine.fullName,\n );\n const gender = validatePersonDataTransferLineGender(\n remotePersonDataTransferLine.gender,\n );\n const personalEmail = validatePersonDataTransferLinePersonalEmail(\n remotePersonDataTransferLine.personalEmail,\n );\n const personalPhone = validatePersonDataTransferLinePersonalPhone(\n remotePersonDataTransferLine.personalPhone,\n );\n // postalAddress\n // profile\n // remuneration\n const residentialAddress = validatePersonDataTransferLineResidentialAddress(\n remotePersonDataTransferLine.residentialAddress,\n );\n // // TODO: Enable syncing super funds. See PROD-2216.\n // const superFunds = validatePersonDataTransferLineSuperFunds(remotePersonDataTransferLine.superFunds);\n const taxDetails = validatePersonDataTransferLineTaxDetails(\n remotePersonDataTransferLine.taxDetails,\n );\n // // TODO: Enable syncing tenure. See PROD-1371.\n // const tenure = validatePersonDataTransferLineTenure(remotePersonDataTransferLine.tenure);\n\n const dataImport = await getDataImport();\n\n await worknice.createPersonDataImportLine({\n bankAccounts,\n config: {\n bankAccounts: config.syncFields?.bankAccounts ?? false,\n dateOfBirth: config.syncFields?.dateOfBirth ?? false,\n emergencyContacts: config.syncFields?.emergencyContacts ?? false,\n fullName: config.syncFields?.fullName ?? false,\n gender: config.syncFields?.gender ?? false,\n personalEmail: config.syncFields?.personalEmail ?? false,\n personalPhone: config.syncFields?.personalPhone ?? false,\n postalAddress: config.syncFields?.postalAddress ?? false,\n profile: config.syncFields?.profile ?? false,\n remuneration: config.syncFields?.remuneration ?? false,\n residentialAddress: config.syncFields?.residentialAddress ?? false,\n superFunds: config.syncFields?.superFunds ?? false,\n taxDetails: config.syncFields?.taxDetails ?? false,\n tenure: config.syncFields?.tenure ?? false,\n },\n dataImportId: dataImport.id,\n dateOfBirth,\n emergencyContacts: null,\n fullName,\n gender,\n personalEmail,\n personalPhone,\n personId: worknicePerson.id,\n postalAddress: null,\n residentialAddress,\n // TODO: Enable syncing super funds. See PROD-2216.\n superFunds: null,\n taxDetails,\n // TODO: Enable syncing tenure. See PROD-1371.\n tenure: null,\n });\n\n logger.info(`Updated Worknice person \"${worknicePerson.displayName}\".`);\n } catch (error) {\n logger.indent(\n `Unable to update Worknice person \"${worknicePerson.displayName}\" because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n }\n }\n }\n }\n\n logger.dedent(\"Finished updating people with connections marked as merged.\");\n }\n\n logger.indent(\"Merging unmerged connections…\");\n\n const connectedConnections = personConnections.filter(\n (\n personConnection,\n ): personConnection is typeof personConnection & {\n status: ConnectionStatus.Connected;\n } => personConnection.status === ConnectionStatus.Connected,\n );\n\n for (const personConnection of connectedConnections) {\n let worknicePerson = people.find((person) => person.id === personConnection.person.id);\n\n const remotePerson = remotePeople.find(\n (person) => person.metadata.sourceId === personConnection.remote.id,\n );\n\n try {\n if (!worknicePerson) {\n throw Error(\n `Unable to find person in Worknice with the ID \"${personConnection.person.id}\".`,\n );\n }\n if (!remotePerson) {\n throw Error(\n `Unable to find person in ${config.appName} with the ID \"${personConnection.remote.id}\".`,\n );\n }\n } catch (error) {\n logger.indent(\n `Unable to merge Worknice person \"${personConnection.person.displayName}\" with ${config.appName} person \"${personConnection.remote.name}\" because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n continue;\n }\n\n const remotePersonName = personToName(remotePerson);\n\n logger.indent(\n `Merging Worknice person \"${worknicePerson.displayName}\" with ${config.appName} person \"${remotePersonName}\"…`,\n );\n\n try {\n if (config.mode === \"one-way\" || config.mode === \"two-way\") {\n const worknicePersonUpdatedAt = Temporal.Instant.from(worknicePerson.updatedAt);\n\n if (!isValidInstant(remotePerson.metadata.updatedAt)) {\n throw Error(\n `Invalid updatedAt value for ${config.appName} person \"${remotePersonName}\". Must be in ISO 8601 format, including a date, a time, and a time zone offset.`,\n {\n cause: Error(`Unable to parse: ${remotePerson.metadata.updatedAt}`),\n },\n );\n }\n\n const remotePersonUpdatedAt = Temporal.Instant.from(\n remotePerson.metadata.updatedAt,\n );\n\n const [primaryDataTransferLine, secondaryDataTransferLine] = isInstantAfter(\n worknicePersonUpdatedAt,\n remotePersonUpdatedAt,\n )\n ? [worknicePersonToPersonDataTransferLine(worknicePerson), remotePerson]\n : [remotePerson, worknicePersonToPersonDataTransferLine(worknicePerson)];\n const mergedDataTransferLine = mergePersonDataTransferLines(\n primaryDataTransferLine,\n secondaryDataTransferLine,\n );\n\n const bankAccounts = validatePersonDataTransferLineBankAccounts(\n mergedDataTransferLine.bankAccounts,\n );\n const dateOfBirth = validatePersonDataTransferLineDateOfBirth(\n mergedDataTransferLine.dateOfBirth,\n );\n // emergencyContacts\n const fullName = validatePersonDataTransferLineFullName(\n mergedDataTransferLine.fullName,\n );\n const gender = validatePersonDataTransferLineGender(mergedDataTransferLine.gender);\n const personalEmail = validatePersonDataTransferLinePersonalEmail(\n mergedDataTransferLine.personalEmail,\n );\n const personalPhone = validatePersonDataTransferLinePersonalPhone(\n mergedDataTransferLine.personalPhone,\n );\n // postalAddress\n const profile = validatePersonDataTransferLineProfile(\n mergedDataTransferLine.profile,\n );\n // remuneration\n const residentialAddress = validatePersonDataTransferLineResidentialAddress(\n mergedDataTransferLine.residentialAddress,\n );\n // // TODO: Enable syncing super funds. See PROD-2216.\n // const superFunds = validatePersonDataTransferLineSuperFunds(mergedDataTransferLine.superFunds);\n const taxDetails = validatePersonDataTransferLineTaxDetails(\n mergedDataTransferLine.taxDetails,\n );\n // // TODO: Enable syncing tenure. See PROD-1371.\n // const tenure = validatePersonDataTransferLineTenure(mergedDataTransferLine.tenure);\n\n const dataImport = await getDataImport();\n\n await worknice.createPersonDataImportLine({\n bankAccounts,\n config: {\n bankAccounts: config.syncFields?.bankAccounts ?? false,\n dateOfBirth: config.syncFields?.dateOfBirth ?? false,\n emergencyContacts: config.syncFields?.emergencyContacts ?? false,\n fullName: config.syncFields?.fullName ?? false,\n gender: config.syncFields?.gender ?? false,\n personalEmail: config.syncFields?.personalEmail ?? false,\n personalPhone: config.syncFields?.personalPhone ?? false,\n postalAddress: config.syncFields?.postalAddress ?? false,\n profile: config.syncFields?.profile ?? false,\n remuneration: config.syncFields?.remuneration ?? false,\n residentialAddress: config.syncFields?.residentialAddress ?? false,\n superFunds: config.syncFields?.superFunds ?? false,\n taxDetails: config.syncFields?.taxDetails ?? false,\n tenure: config.syncFields?.tenure ?? false,\n },\n dataImportId: dataImport.id,\n dateOfBirth,\n emergencyContacts: null,\n fullName,\n gender,\n personalEmail,\n personalPhone,\n personId: worknicePerson.id,\n postalAddress: null,\n residentialAddress,\n // TODO: Enable syncing super funds. See PROD-2216.\n superFunds: null,\n taxDetails,\n // TODO: Enable syncing tenure. See PROD-1371.\n tenure: null,\n });\n\n worknicePerson = await worknice.updatePerson({\n displayName: profile?.displayName,\n employeeCode: remotePerson.metadata.employeeCode,\n personId: worknicePerson.id,\n profileEmail: profile?.profileEmail,\n profilePhone: profile?.profilePhone,\n });\n\n logger.info(`Updated Worknice person \"${worknicePerson.displayName}\".`);\n\n if (config.mode === \"two-way\") {\n if (!updateRemotePerson) {\n throw Error(\n \"No updateRemotePerson function supplied to handleTriggerIntegrationSyncWebhook.\",\n );\n }\n\n await updateRemotePerson(\n {\n bankAccounts,\n dateOfBirth,\n emergencyContacts: null,\n fullName,\n gender,\n metadata: {\n deleted: false,\n employeeCode: worknicePerson.employeeCode ?? null,\n sourceId: worknicePerson.id,\n targetId: remotePerson.metadata.sourceId,\n updatedAt: worknicePerson.updatedAt,\n },\n personalEmail,\n personalPhone,\n postalAddress: null,\n profile: {\n displayName: worknicePerson.displayName,\n profileEmail: worknicePerson.profileEmail ?? null,\n profilePhone: worknicePerson.profilePhone ?? null,\n },\n residentialAddress,\n // TODO: Enable syncing super funds. See PROD-2216.\n superFunds: null,\n taxDetails,\n // TODO: Enable syncing tenure. See PROD-1371.\n tenure: null,\n },\n contextWithIntegration,\n );\n\n logger.info(`Updated ${config.appName} person \"${remotePersonName}\".`);\n }\n }\n\n await worknice.updatePersonConnection({\n personConnectionId: personConnection.id,\n personId: personConnection.person.id,\n remote: {\n id: remotePerson.metadata.sourceId,\n name: remotePersonName,\n },\n status: ConnectionStatus.Merged,\n });\n\n logger.dedent(`Finished merging.`);\n } catch (error) {\n logger.indent(\n `Unable to merge ${config.appName} person \"${remotePersonName}\" and Worknice person \"${worknicePerson.displayName}\" because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n logger.dedent();\n }\n }\n\n logger.dedent(\"Finished merging unmerged connections.\");\n\n if (config.mode === \"two-way\") {\n logger.indent(`Adding new people to ${config.appName}…`);\n\n const localOnlyConnections = personConnections.filter(\n (\n personConnection,\n ): personConnection is typeof personConnection & {\n status: ConnectionStatus.LocalOnly;\n } => personConnection.status === ConnectionStatus.LocalOnly,\n );\n\n for (const personConnection of localOnlyConnections) {\n const worknicePerson = people.find(\n (person) => person.id === personConnection.person.id,\n );\n\n if (!worknicePerson) {\n throw Error(\n `Unable to find person in Worknice with the ID \"${personConnection.person.id}\".`,\n );\n }\n\n try {\n if (!createRemotePerson) {\n throw Error(\n \"No createRemotePerson function supplied to handleTriggerIntegrationSyncWebhook.\",\n );\n }\n\n const { status, ...remote } = await createRemotePerson(\n {\n ...worknicePersonToPersonDataTransferLine(worknicePerson),\n metadata: {\n deleted: false,\n employeeCode: worknicePerson.employeeCode ?? null,\n sourceId: worknicePerson.id,\n targetId: null,\n updatedAt: worknicePerson.updatedAt,\n },\n },\n contextWithIntegration,\n );\n\n if (personConnections.some((connection) => connection.remote?.id === remote.id)) {\n throw Error(\n `A connection already exists for the ${config.appName} person \"${remote.name}\".`,\n );\n }\n\n await worknice.updatePersonConnection({\n personConnectionId: personConnection.id,\n personId: personConnection.person.id,\n remote,\n status: status ?? ConnectionStatus.Merged,\n });\n\n logger.info(`Added new person \"${remote.name}\" to ${config.appName}.`);\n } catch (error) {\n logger.indent(\n `Unable to add Worknice person \"${worknicePerson.displayName}\" to ${config.appName} because of the following error:`,\n );\n logger.error(error);\n logger.dedent();\n }\n }\n\n logger.dedent(`Finished adding new people to ${config.appName}.`);\n }\n\n await worknice.completeSync({ integrationId: payload.integrationId });\n\n logger.info(\"Sync completed.\");\n } catch (error) {\n await worknice.completeSync({ integrationId: payload.integrationId });\n throw error;\n }\n },\n parseRequest: async (context) => {\n const payload = await context.request.json();\n return {\n env: await getEnv({ ...context, payload }),\n payload,\n };\n },\n },\n options,\n );\n\nconst personToName = (person: Person) => {\n if (\n (person.fullName?.givenName ?? \"\").trim() !== \"\" &&\n (person.fullName?.familyName ?? \"\").trim() !== \"\"\n ) {\n return `${person.fullName?.givenName} ${person.fullName?.familyName}`;\n }\n\n if ((person.profile?.displayName ?? \"\").trim() !== \"\") {\n return `${person.profile?.displayName}`;\n }\n\n return `(unnamed person ${person.metadata.sourceId})`;\n};\n\nconst worknicePersonToPersonDataTransferLine = (\n worknicePerson: NonNullable<GetPeopleQuery[\"org\"][\"people\"][number]>,\n): Omit<Person, \"metadata\"> => ({\n ...validatePersonDataTransferLine({\n bankAccounts: worknicePerson.bankAccount1AllocationMethod\n ? {\n bankAccount1Allocation: worknicePerson.bankAccount1Allocation ?? null,\n bankAccount1AllocationMethod: worknicePerson.bankAccount1AllocationMethod,\n bankAccount1Bsb: worknicePerson.bankAccount1Bsb ?? null,\n bankAccount1Name: worknicePerson.bankAccount1Name ?? null,\n bankAccount1Number: worknicePerson.bankAccount1Number ?? null,\n bankAccount2Allocation: worknicePerson.bankAccount2Allocation ?? null,\n bankAccount2AllocationMethod: worknicePerson.bankAccount2AllocationMethod ?? null,\n bankAccount2Bsb: worknicePerson.bankAccount2Bsb ?? null,\n bankAccount2Name: worknicePerson.bankAccount2Name ?? null,\n bankAccount2Number: worknicePerson.bankAccount2Number ?? null,\n bankAccount3Allocation: worknicePerson.bankAccount3Allocation ?? null,\n bankAccount3AllocationMethod: worknicePerson.bankAccount3AllocationMethod ?? null,\n bankAccount3Bsb: worknicePerson.bankAccount3Bsb ?? null,\n bankAccount3Name: worknicePerson.bankAccount3Name ?? null,\n bankAccount3Number: worknicePerson.bankAccount3Number ?? null,\n bankAccount4Allocation: worknicePerson.bankAccount4Allocation ?? null,\n bankAccount4AllocationMethod: worknicePerson.bankAccount4AllocationMethod ?? null,\n bankAccount4Bsb: worknicePerson.bankAccount4Bsb ?? null,\n bankAccount4Name: worknicePerson.bankAccount4Name ?? null,\n bankAccount4Number: worknicePerson.bankAccount4Number ?? null,\n bankAccount5Allocation: worknicePerson.bankAccount5Allocation ?? null,\n bankAccount5AllocationMethod: worknicePerson.bankAccount5AllocationMethod ?? null,\n bankAccount5Bsb: worknicePerson.bankAccount5Bsb ?? null,\n bankAccount5Name: worknicePerson.bankAccount5Name ?? null,\n bankAccount5Number: worknicePerson.bankAccount5Number ?? null,\n }\n : null,\n dateOfBirth: worknicePerson.dateOfBirth ? { dateOfBirth: worknicePerson.dateOfBirth } : null,\n emergencyContacts: null,\n fullName: worknicePerson.givenName\n ? {\n familyName: worknicePerson.familyName ?? null,\n givenName: worknicePerson.givenName,\n otherGivenNames: worknicePerson.otherGivenNames ?? null,\n }\n : null,\n gender: worknicePerson.gender\n ? {\n gender: worknicePerson.gender,\n }\n : null,\n personalEmail: worknicePerson.personalEmail\n ? {\n personalEmail: worknicePerson.personalEmail,\n }\n : null,\n personalPhone: worknicePerson.personalPhone\n ? {\n personalPhone: worknicePerson.personalPhone,\n }\n : null,\n postalAddress: null,\n profile: null,\n residentialAddress: worknicePerson.residentialAddressLine1\n ? {\n residentialAddressCity: worknicePerson.residentialAddressCity ?? null,\n // FIXME: This should not default to \"Australia\". See PROD-1085.\n residentialAddressCountry: worknicePerson.residentialAddressCountry ?? \"Australia\",\n residentialAddressLine1: worknicePerson.residentialAddressLine1,\n residentialAddressLine2: worknicePerson.residentialAddressLine2 ?? null,\n residentialAddressPostcode: worknicePerson.residentialAddressPostcode ?? null,\n residentialAddressState: worknicePerson.residentialAddressState ?? null,\n }\n : null,\n // TODO: Enable syncing super funds. See PROD-2216.\n superFunds: null,\n taxDetails: worknicePerson.taxFileNumberExemption\n ? {\n hasLoanOrStudentDebt: worknicePerson.hasLoanOrStudentDebt ?? null,\n residencyStatus: worknicePerson.residencyStatus ?? null,\n taxFileNumber: worknicePerson.taxFileNumber ?? null,\n taxFileNumberExemption: worknicePerson.taxFileNumberExemption ?? null,\n taxFreeThresholdClaimed: worknicePerson.taxFreeThresholdClaimed ?? null,\n }\n : null,\n // TODO: Enable syncing tenure. See PROD-1371.\n tenure: null,\n }),\n profile: {\n displayName: worknicePerson.displayName,\n profileEmail: worknicePerson.profileEmail ?? null,\n profilePhone: worknicePerson.profilePhone ?? null,\n },\n});\n\nexport default handleTriggerIntegrationSyncWebhook;\n"],"mappings":"AAAA,OAAO,oBAAoB;AAC3B,OAAO,oBAAoB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,wBAAkE;AAE3E,OAAO,oCAAoC;AAC3C,OAAO,kCAAkC;AACzC,OAAO,oCAAoC;AAC3C,OAAO,gDAAgD;AACvD,OAAO,+CAA+C;AACtD,OAAO,4CAA4C;AACnD,OAAO,0CAA0C;AACjD,OAAO,iDAAiD;AACxD,OAAO,iDAAiD;AACxD,OAAO,2CAA2C;AAClD,OAAO,sDAAsD;AAG7D,OAAO,+BAA+B;AACtC,OAAO,8CAA8C;AAkFrD,MAAM,sCAAsC,OAC1C,SACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GACA,YAEA;AAAA,EACE;AAAA,EACA;AAAA,IACE;AAAA,IACA,eAAe,OAAO,YAAY;AAChC,YAAM,EAAE,QAAQ,SAAS,SAAS,IAAI;AAEtC,UAAI;AAEJ,YAAM,gBAAgB,YAAY;AAChC,YAAI,CAAC,kBAAkB;AACrB,6BAAmB,MAAM,SAAS,iBAAiB;AAAA,YACjD,eAAe,QAAQ;AAAA,UACzB,CAAC;AAAA,QACH;AAEA,eAAO;AAAA,MACT;AAEA,UAAI;AACF,eAAO,QAAQ,UAAU,QAAQ,aAAa;AAE9C,eAAO,OAAO,gCAA2B;AAEzC,cAAM,cAAc,MAAM,SAAS,eAAe;AAAA,UAChD,eAAe,QAAQ;AAAA,QACzB,CAAC;AAED,YAAI,YAAY,UAAU;AACxB,iBAAO,KAAK,yCAAyC;AACrD;AAAA,QACF;AAEA,YAAI,YAAY,WAAW,WAAW;AACpC,iBAAO,KAAK,4DAA4D;AACxE;AAAA,QACF;AAEA,eAAO,KAAK,sCAAsC;AAElD,cAAM,oBAAoB,MAAM,SAAS,qBAAqB;AAAA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,yBAAyB,eAAe,2BAA2B;AAAA,MACnE,4BAA4B,eAAe,8BAA8B;AAAA,MACzE,yBAAyB,eAAe,2BAA2B;AAAA,IACrE,IACA;AAAA;AAAA,IAEJ,YAAY;AAAA,IACZ,YAAY,eAAe,yBACvB;AAAA,MACE,sBAAsB,eAAe,wBAAwB;AAAA,MAC7D,iBAAiB,eAAe,mBAAmB;AAAA,MACnD,eAAe,eAAe,iBAAiB;AAAA,MAC/C,wBAAwB,eAAe,0BAA0B;AAAA,MACjE,yBAAyB,eAAe,2BAA2B;AAAA,IACrE,IACA;AAAA;AAAA,IAEJ,QAAQ;AAAA,EACV,CAAC;AAAA,EACD,SAAS;AAAA,IACP,aAAa,eAAe;AAAA,IAC5B,cAAc,eAAe,gBAAgB;AAAA,IAC7C,cAAc,eAAe,gBAAgB;AAAA,EAC/C;AACF;AAEA,IAAO,8CAAQ;","names":[]}
@@ -11,7 +11,7 @@ export { default as handleProcessLeaveRequestWebhook } from './handleProcessLeav
11
11
  export { default as handleRequest } from './handleRequest.js';
12
12
  export { default as handleRequestWithWorknice } from './handleRequestWithWorknice.js';
13
13
  export { default as handleTriggerIntegrationSyncWebhook } from './handleTriggerIntegrationSyncWebhook.js';
14
- import '../webhooks.js';
14
+ import '@worknice/utils/webhooks';
15
15
  import './_types.js';
16
16
  import '../_types-Cobjq3B-.js';
17
17
  import '../api/_generated.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@worknice/js-sdk",
3
3
  "description": "",
4
- "version": "0.0.8",
4
+ "version": "0.1.0-rc.1",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "files": [
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "dedent": "^0.7.0",
38
38
  "uuid": "^11.0.5",
39
- "@worknice/utils": "^0.1.1"
39
+ "@worknice/utils": "^0.2.0-rc.2"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@anolilab/semantic-release-pnpm": "^1.1.10",
@@ -65,8 +65,8 @@
65
65
  "temporal-polyfill": "^0.2.1"
66
66
  },
67
67
  "scripts": {
68
- "build": "cp ../../apps/notebook/src/utils/webhooks.ts ./src && rm -rf ./dist && tsup",
69
- "dev": "cp ../../apps/notebook/src/utils/webhooks.ts ./src && pnpm dev:codegen && pnpm run --stream \"/^dev:.*/\"",
68
+ "build": "rm -rf ./dist && tsup",
69
+ "dev": "pnpm dev:codegen && pnpm run --stream \"/^dev:.*/\"",
70
70
  "dev:test": "vitest",
71
71
  "dev:tsup": "rm -rf ./dist && tsup --watch",
72
72
  "dev:codegen": "graphql-codegen -c graphql.config.json -w",
@@ -75,6 +75,6 @@
75
75
  "test:unit": "vitest run",
76
76
  "test:lint": "eslint src --color",
77
77
  "test:prettier": "prettier -c '**/*.{js,ts,tsx,css}'",
78
- "test:types": "cp ../../apps/notebook/src/utils/webhooks.ts ./src && tsc --noEmit --pretty"
78
+ "test:types": "tsc --noEmit --pretty"
79
79
  }
80
80
  }
@@ -1,112 +0,0 @@
1
- type ApproveLeaveRequestRequestPayload = {
2
- integrationId: string;
3
- remoteId: string;
4
- };
5
- type ApproveLeaveRequestResponsePayload = {
6
- ok: true;
7
- };
8
- type CancelLeaveRequestRequestPayload = {
9
- integrationId: string;
10
- remoteId: string;
11
- };
12
- type CancelLeaveRequestResponsePayload = {
13
- ok: true;
14
- };
15
- type CreateIntegrationRequestPayload = {
16
- apiToken: string;
17
- integrationId: string;
18
- };
19
- type CreateLeaveRequestRequestPayload = {
20
- endDate: string;
21
- endTime: string | null;
22
- hours: string | null;
23
- hoursBreakdown: string | null;
24
- integrationId: string;
25
- leaveCategory: {
26
- id: string;
27
- name: string;
28
- };
29
- leaveRequestId: string;
30
- notes: string | null;
31
- personConnectionId: string;
32
- responsibleId: string;
33
- startDate: string;
34
- startTime: string | null;
35
- };
36
- type CreateLeaveRequestResponsePayload = {
37
- ok: true;
38
- remoteId: string;
39
- };
40
- type DenyLeaveRequestRequestPayload = {
41
- integrationId: string;
42
- remoteId: string;
43
- };
44
- type DenyLeaveRequestResponsePayload = {
45
- ok: true;
46
- };
47
- type GetAuthorizationUrlRequestPayload = {
48
- integrationId: string;
49
- };
50
- type GetAuthorizationUrlResponsePayload = {
51
- authorizationUrl: string;
52
- };
53
- type GetLeaveBalancesRequestPayload = {
54
- integrationId: string;
55
- remoteId: string;
56
- };
57
- type GetLeaveBalancesResponsePayload = Array<{
58
- accruedAmount: string;
59
- id: string;
60
- leaveCategory: {
61
- id: string;
62
- name: string;
63
- };
64
- }>;
65
- type GetLeaveCategoriesRequestPayload = {
66
- integrationId: string;
67
- };
68
- type GetLeaveCategoriesResponsePayload = {
69
- leaveCategories: Array<{
70
- id: string;
71
- name: string;
72
- }>;
73
- };
74
- type GetLeaveRequestHoursRequestPayload = {
75
- connectionId: string;
76
- endDate: string;
77
- integrationId: string;
78
- leaveCategoryId: string;
79
- startDate: string;
80
- };
81
- type GetLeaveRequestHoursResponsePayload = {
82
- hours: string;
83
- hoursBreakdown?: string | null;
84
- ok: true;
85
- };
86
- type PersonConnectedRequestPayload = {
87
- id: string;
88
- integration: {
89
- id: string;
90
- };
91
- person: {
92
- displayName: string;
93
- id: string;
94
- } | null;
95
- remote: {
96
- id: string;
97
- name: string;
98
- } | null;
99
- status: "CONNECTED" | "LOCAL_ONLY" | "MERGED" | "REMOTE_ONLY";
100
- };
101
- type ProcessLeaveRequestRequestPayload = {
102
- integrationId: string;
103
- remoteId: string;
104
- };
105
- type ProcessLeaveRequestResponsePayload = {
106
- ok: true;
107
- };
108
- type TriggerIntegrationSyncRequestPayload = {
109
- integrationId: string;
110
- };
111
-
112
- export type { ApproveLeaveRequestRequestPayload, ApproveLeaveRequestResponsePayload, CancelLeaveRequestRequestPayload, CancelLeaveRequestResponsePayload, CreateIntegrationRequestPayload, CreateLeaveRequestRequestPayload, CreateLeaveRequestResponsePayload, DenyLeaveRequestRequestPayload, DenyLeaveRequestResponsePayload, GetAuthorizationUrlRequestPayload, GetAuthorizationUrlResponsePayload, GetLeaveBalancesRequestPayload, GetLeaveBalancesResponsePayload, GetLeaveCategoriesRequestPayload, GetLeaveCategoriesResponsePayload, GetLeaveRequestHoursRequestPayload, GetLeaveRequestHoursResponsePayload, PersonConnectedRequestPayload, ProcessLeaveRequestRequestPayload, ProcessLeaveRequestResponsePayload, TriggerIntegrationSyncRequestPayload };
package/dist/webhooks.js DELETED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=webhooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}