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

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 (200) hide show
  1. package/dist/_types-Cobjq3B-.d.ts +761 -0
  2. package/dist/api/ApiError.d.ts +13 -0
  3. package/dist/api/ApiError.js +29 -0
  4. package/dist/api/ApiError.js.map +1 -0
  5. package/dist/api/WorkniceIntegrationLogger.d.ts +125 -0
  6. package/dist/api/WorkniceIntegrationLogger.js +203 -0
  7. package/dist/api/WorkniceIntegrationLogger.js.map +1 -0
  8. package/dist/api/_generated.d.ts +5722 -0
  9. package/dist/api/_generated.js +402 -0
  10. package/dist/api/_generated.js.map +1 -0
  11. package/dist/api/_types.d.ts +2 -0
  12. package/dist/api/_types.js +2 -0
  13. package/dist/api/_types.js.map +1 -0
  14. package/dist/api/assertNotNull.d.ts +5 -0
  15. package/dist/api/assertNotNull.js +14 -0
  16. package/dist/api/assertNotNull.js.map +1 -0
  17. package/dist/api/createApiOperation.d.ts +11 -0
  18. package/dist/api/createApiOperation.js +6 -0
  19. package/dist/api/createApiOperation.js.map +1 -0
  20. package/dist/api/createWorkniceClient.d.ts +2 -0
  21. package/dist/api/createWorkniceClient.js +125 -0
  22. package/dist/api/createWorkniceClient.js.map +1 -0
  23. package/dist/api/operations/activateIntegration.d.ts +22 -0
  24. package/dist/api/operations/activateIntegration.js +29 -0
  25. package/dist/api/operations/activateIntegration.js.map +1 -0
  26. package/dist/api/operations/authorizeIntegration.d.ts +20 -0
  27. package/dist/api/operations/authorizeIntegration.js +23 -0
  28. package/dist/api/operations/authorizeIntegration.js.map +1 -0
  29. package/dist/api/operations/completeSync.d.ts +20 -0
  30. package/dist/api/operations/completeSync.js +23 -0
  31. package/dist/api/operations/completeSync.js.map +1 -0
  32. package/dist/api/operations/createApiToken.d.ts +14 -0
  33. package/dist/api/operations/createApiToken.js +31 -0
  34. package/dist/api/operations/createApiToken.js.map +1 -0
  35. package/dist/api/operations/createDataImport.d.ts +12 -0
  36. package/dist/api/operations/createDataImport.js +25 -0
  37. package/dist/api/operations/createDataImport.js.map +1 -0
  38. package/dist/api/operations/createPersonConnection.d.ts +139 -0
  39. package/dist/api/operations/createPersonConnection.js +66 -0
  40. package/dist/api/operations/createPersonConnection.js.map +1 -0
  41. package/dist/api/operations/createPersonDataImportLine.d.ts +26 -0
  42. package/dist/api/operations/createPersonDataImportLine.js +57 -0
  43. package/dist/api/operations/createPersonDataImportLine.js.map +1 -0
  44. package/dist/api/operations/deleteApiToken.d.ts +10 -0
  45. package/dist/api/operations/deleteApiToken.js +21 -0
  46. package/dist/api/operations/deleteApiToken.js.map +1 -0
  47. package/dist/api/operations/deletePersonConnection.d.ts +10 -0
  48. package/dist/api/operations/deletePersonConnection.js +21 -0
  49. package/dist/api/operations/deletePersonConnection.js.map +1 -0
  50. package/dist/api/operations/getApiTokens.d.ts +14 -0
  51. package/dist/api/operations/getApiTokens.js +39 -0
  52. package/dist/api/operations/getApiTokens.js.map +1 -0
  53. package/dist/api/operations/getIntegration.d.ts +65 -0
  54. package/dist/api/operations/getIntegration.js +32 -0
  55. package/dist/api/operations/getIntegration.js.map +1 -0
  56. package/dist/api/operations/getMyApps.d.ts +37 -0
  57. package/dist/api/operations/getMyApps.js +62 -0
  58. package/dist/api/operations/getMyApps.js.map +1 -0
  59. package/dist/api/operations/getPeople.d.ts +66 -0
  60. package/dist/api/operations/getPeople.js +80 -0
  61. package/dist/api/operations/getPeople.js.map +1 -0
  62. package/dist/api/operations/getPersonConnections.d.ts +114 -0
  63. package/dist/api/operations/getPersonConnections.js +44 -0
  64. package/dist/api/operations/getPersonConnections.js.map +1 -0
  65. package/dist/api/operations/initializeIntegration.d.ts +20 -0
  66. package/dist/api/operations/initializeIntegration.js +23 -0
  67. package/dist/api/operations/initializeIntegration.js.map +1 -0
  68. package/dist/api/operations/updatePerson.d.ts +70 -0
  69. package/dist/api/operations/updatePerson.js +90 -0
  70. package/dist/api/operations/updatePerson.js.map +1 -0
  71. package/dist/api/operations/updatePersonConnection.d.ts +139 -0
  72. package/dist/api/operations/updatePersonConnection.js +66 -0
  73. package/dist/api/operations/updatePersonConnection.js.map +1 -0
  74. package/dist/employee-records/EQUALITY_CHECKS.d.ts +10 -0
  75. package/dist/employee-records/EQUALITY_CHECKS.js +116 -0
  76. package/dist/employee-records/EQUALITY_CHECKS.js.map +1 -0
  77. package/dist/employee-records/_types.d.ts +198 -0
  78. package/dist/employee-records/_types.js +1 -0
  79. package/dist/employee-records/_types.js.map +1 -0
  80. package/dist/employee-records/comparePersonDataTransferLines.d.ts +6 -0
  81. package/dist/employee-records/comparePersonDataTransferLines.js +397 -0
  82. package/dist/employee-records/comparePersonDataTransferLines.js.map +1 -0
  83. package/dist/employee-records/index.d.ts +20 -0
  84. package/dist/employee-records/index.js +33 -0
  85. package/dist/employee-records/index.js.map +1 -0
  86. package/dist/employee-records/mergePersonDataTransferLines.d.ts +6 -0
  87. package/dist/employee-records/mergePersonDataTransferLines.js +23 -0
  88. package/dist/employee-records/mergePersonDataTransferLines.js.map +1 -0
  89. package/dist/employee-records/validatePersonDataTransferLine.d.ts +6 -0
  90. package/dist/employee-records/validatePersonDataTransferLine.js +33 -0
  91. package/dist/employee-records/validatePersonDataTransferLine.js.map +1 -0
  92. package/dist/employee-records/validatePersonDataTransferLineBankAccounts.d.ts +6 -0
  93. package/dist/employee-records/validatePersonDataTransferLineBankAccounts.js +241 -0
  94. package/dist/employee-records/validatePersonDataTransferLineBankAccounts.js.map +1 -0
  95. package/dist/employee-records/validatePersonDataTransferLineDateOfBirth.d.ts +6 -0
  96. package/dist/employee-records/validatePersonDataTransferLineDateOfBirth.js +17 -0
  97. package/dist/employee-records/validatePersonDataTransferLineDateOfBirth.js.map +1 -0
  98. package/dist/employee-records/validatePersonDataTransferLineEmergencyContacts.d.ts +6 -0
  99. package/dist/employee-records/validatePersonDataTransferLineEmergencyContacts.js +6 -0
  100. package/dist/employee-records/validatePersonDataTransferLineEmergencyContacts.js.map +1 -0
  101. package/dist/employee-records/validatePersonDataTransferLineFullName.d.ts +6 -0
  102. package/dist/employee-records/validatePersonDataTransferLineFullName.js +20 -0
  103. package/dist/employee-records/validatePersonDataTransferLineFullName.js.map +1 -0
  104. package/dist/employee-records/validatePersonDataTransferLineGender.d.ts +6 -0
  105. package/dist/employee-records/validatePersonDataTransferLineGender.js +13 -0
  106. package/dist/employee-records/validatePersonDataTransferLineGender.js.map +1 -0
  107. package/dist/employee-records/validatePersonDataTransferLinePersonalEmail.d.ts +6 -0
  108. package/dist/employee-records/validatePersonDataTransferLinePersonalEmail.js +15 -0
  109. package/dist/employee-records/validatePersonDataTransferLinePersonalEmail.js.map +1 -0
  110. package/dist/employee-records/validatePersonDataTransferLinePersonalPhone.d.ts +6 -0
  111. package/dist/employee-records/validatePersonDataTransferLinePersonalPhone.js +15 -0
  112. package/dist/employee-records/validatePersonDataTransferLinePersonalPhone.js.map +1 -0
  113. package/dist/employee-records/validatePersonDataTransferLinePostalAddress.d.ts +6 -0
  114. package/dist/employee-records/validatePersonDataTransferLinePostalAddress.js +39 -0
  115. package/dist/employee-records/validatePersonDataTransferLinePostalAddress.js.map +1 -0
  116. package/dist/employee-records/validatePersonDataTransferLineProfile.d.ts +6 -0
  117. package/dist/employee-records/validatePersonDataTransferLineProfile.js +17 -0
  118. package/dist/employee-records/validatePersonDataTransferLineProfile.js.map +1 -0
  119. package/dist/employee-records/validatePersonDataTransferLineResidentialAddress.d.ts +6 -0
  120. package/dist/employee-records/validatePersonDataTransferLineResidentialAddress.js +39 -0
  121. package/dist/employee-records/validatePersonDataTransferLineResidentialAddress.js.map +1 -0
  122. package/dist/employee-records/validatePersonDataTransferLineSuperFunds.d.ts +6 -0
  123. package/dist/employee-records/validatePersonDataTransferLineSuperFunds.js +46 -0
  124. package/dist/employee-records/validatePersonDataTransferLineSuperFunds.js.map +1 -0
  125. package/dist/employee-records/validatePersonDataTransferLineTaxDetails.d.ts +6 -0
  126. package/dist/employee-records/validatePersonDataTransferLineTaxDetails.js +46 -0
  127. package/dist/employee-records/validatePersonDataTransferLineTaxDetails.js.map +1 -0
  128. package/dist/employee-records/validatePersonDataTransferLineTenure.d.ts +6 -0
  129. package/dist/employee-records/validatePersonDataTransferLineTenure.js +20 -0
  130. package/dist/employee-records/validatePersonDataTransferLineTenure.js.map +1 -0
  131. package/dist/helpers/_types.d.ts +22 -0
  132. package/dist/helpers/_types.js +1 -0
  133. package/dist/helpers/_types.js.map +1 -0
  134. package/dist/helpers/handleApproveLeaveRequestWebhook.d.ts +15 -0
  135. package/dist/helpers/handleApproveLeaveRequestWebhook.js +21 -0
  136. package/dist/helpers/handleApproveLeaveRequestWebhook.js.map +1 -0
  137. package/dist/helpers/handleCancelLeaveRequestWebhook.d.ts +15 -0
  138. package/dist/helpers/handleCancelLeaveRequestWebhook.js +21 -0
  139. package/dist/helpers/handleCancelLeaveRequestWebhook.js.map +1 -0
  140. package/dist/helpers/handleCreateIntegrationWebhook.d.ts +14 -0
  141. package/dist/helpers/handleCreateIntegrationWebhook.js +42 -0
  142. package/dist/helpers/handleCreateIntegrationWebhook.js.map +1 -0
  143. package/dist/helpers/handleCreateLeaveRequestWebhook.d.ts +15 -0
  144. package/dist/helpers/handleCreateLeaveRequestWebhook.js +21 -0
  145. package/dist/helpers/handleCreateLeaveRequestWebhook.js.map +1 -0
  146. package/dist/helpers/handleDenyLeaveRequestWebhook.d.ts +15 -0
  147. package/dist/helpers/handleDenyLeaveRequestWebhook.js +21 -0
  148. package/dist/helpers/handleDenyLeaveRequestWebhook.js.map +1 -0
  149. package/dist/helpers/handleGetAuthorizationUrlWebhook.d.ts +12 -0
  150. package/dist/helpers/handleGetAuthorizationUrlWebhook.js +27 -0
  151. package/dist/helpers/handleGetAuthorizationUrlWebhook.js.map +1 -0
  152. package/dist/helpers/handleGetLeaveBalancesWebhook.d.ts +13 -0
  153. package/dist/helpers/handleGetLeaveBalancesWebhook.js +27 -0
  154. package/dist/helpers/handleGetLeaveBalancesWebhook.js.map +1 -0
  155. package/dist/helpers/handleGetLeaveCategoriesWebhook.d.ts +15 -0
  156. package/dist/helpers/handleGetLeaveCategoriesWebhook.js +27 -0
  157. package/dist/helpers/handleGetLeaveCategoriesWebhook.js.map +1 -0
  158. package/dist/helpers/handleGetLeaveRequestHoursWebhook.d.ts +13 -0
  159. package/dist/helpers/handleGetLeaveRequestHoursWebhook.js +27 -0
  160. package/dist/helpers/handleGetLeaveRequestHoursWebhook.js.map +1 -0
  161. package/dist/helpers/handleProcessLeaveRequestWebhook.d.ts +15 -0
  162. package/dist/helpers/handleProcessLeaveRequestWebhook.js +21 -0
  163. package/dist/helpers/handleProcessLeaveRequestWebhook.js.map +1 -0
  164. package/dist/helpers/handleRequest.d.ts +12 -0
  165. package/dist/helpers/handleRequest.js +58 -0
  166. package/dist/helpers/handleRequest.js.map +1 -0
  167. package/dist/helpers/handleRequestWithWorknice.d.ts +23 -0
  168. package/dist/helpers/handleRequestWithWorknice.js +44 -0
  169. package/dist/helpers/handleRequestWithWorknice.js.map +1 -0
  170. package/dist/helpers/handleTriggerIntegrationSyncWebhook.d.ts +76 -0
  171. package/dist/helpers/handleTriggerIntegrationSyncWebhook.js +750 -0
  172. package/dist/helpers/handleTriggerIntegrationSyncWebhook.js.map +1 -0
  173. package/dist/helpers/index.d.ts +19 -0
  174. package/dist/helpers/index.js +29 -0
  175. package/dist/helpers/index.js.map +1 -0
  176. package/dist/index.d.ts +20 -0
  177. package/dist/index.js +10 -0
  178. package/dist/index.js.map +1 -0
  179. package/dist/utils/disambiguatePersonConnections.d.ts +25 -0
  180. package/dist/utils/disambiguatePersonConnections.js +18 -0
  181. package/dist/utils/disambiguatePersonConnections.js.map +1 -0
  182. package/dist/utils/errorToString.d.ts +22 -0
  183. package/dist/utils/errorToString.js +30 -0
  184. package/dist/utils/errorToString.js.map +1 -0
  185. package/dist/utils/isNotNullable.d.ts +10 -0
  186. package/dist/utils/isNotNullable.js +6 -0
  187. package/dist/utils/isNotNullable.js.map +1 -0
  188. package/dist/utils/isSamePlainDate.d.ts +3 -0
  189. package/dist/utils/isSamePlainDate.js +5 -0
  190. package/dist/utils/isSamePlainDate.js.map +1 -0
  191. package/dist/utils/isValidPlainDate.d.ts +1 -0
  192. package/dist/utils/isValidPlainDate.js +5 -0
  193. package/dist/utils/isValidPlainDate.js.map +1 -0
  194. package/dist/utils/parsePlainDate.d.ts +1 -0
  195. package/dist/utils/parsePlainDate.js +5 -0
  196. package/dist/utils/parsePlainDate.js.map +1 -0
  197. package/dist/webhooks.d.ts +112 -0
  198. package/dist/webhooks.js +1 -0
  199. package/dist/webhooks.js.map +1 -0
  200. package/package.json +2 -2
@@ -0,0 +1,46 @@
1
+ const validatePersonDataTransferLineSuperFunds = (value) => {
2
+ if (value === null) return null;
3
+ const { superFund1MemberName, superFund1MemberNumber, superFund1Nomination, superFund1Usi } = value;
4
+ if (superFund1Nomination === null) {
5
+ throw Error("Invalid super fund 1 nomination");
6
+ }
7
+ if (superFund1Nomination === "REGULATED") {
8
+ if (superFund1MemberName === null || superFund1MemberName.trim() === "") {
9
+ throw Error("Invalid super fund 1 member name");
10
+ }
11
+ if (superFund1MemberNumber === null || superFund1MemberNumber.trim() === "") {
12
+ throw Error("Invalid super fund 1 member number");
13
+ }
14
+ if (superFund1Usi === null || superFund1Usi.trim() === "") {
15
+ throw Error("Invalid super fund 1 USI");
16
+ }
17
+ return {
18
+ superFund1MemberName,
19
+ superFund1MemberNumber,
20
+ superFund1Nomination: "REGULATED",
21
+ superFund1Usi
22
+ };
23
+ }
24
+ if (superFund1MemberName !== null) {
25
+ throw Error("Invalid super fund 1 member name (only REGULATED funds require a member name)");
26
+ }
27
+ if (superFund1MemberNumber !== null) {
28
+ throw Error(
29
+ "Invalid super fund 1 member number (only REGULATED funds require a member number)"
30
+ );
31
+ }
32
+ if (superFund1Usi !== null) {
33
+ throw Error("Invalid super fund 1 USI (only REGULATED funds require a USI)");
34
+ }
35
+ return {
36
+ superFund1MemberName,
37
+ superFund1MemberNumber,
38
+ superFund1Nomination,
39
+ superFund1Usi
40
+ };
41
+ };
42
+ var validatePersonDataTransferLineSuperFunds_default = validatePersonDataTransferLineSuperFunds;
43
+ export {
44
+ validatePersonDataTransferLineSuperFunds_default as default
45
+ };
46
+ //# sourceMappingURL=validatePersonDataTransferLineSuperFunds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/employee-records/validatePersonDataTransferLineSuperFunds.ts"],"sourcesContent":["import type { PartialPersonDataTransferLine, PersonDataTransferLine } from \"./_types.js\";\n\nconst validatePersonDataTransferLineSuperFunds = (\n value: PartialPersonDataTransferLine[\"superFunds\"],\n): PersonDataTransferLine[\"superFunds\"] => {\n if (value === null) return null;\n const { superFund1MemberName, superFund1MemberNumber, superFund1Nomination, superFund1Usi } =\n value;\n\n if (superFund1Nomination === null) {\n throw Error(\"Invalid super fund 1 nomination\");\n }\n\n if (superFund1Nomination === \"REGULATED\") {\n if (superFund1MemberName === null || superFund1MemberName.trim() === \"\") {\n throw Error(\"Invalid super fund 1 member name\");\n }\n if (superFund1MemberNumber === null || superFund1MemberNumber.trim() === \"\") {\n throw Error(\"Invalid super fund 1 member number\");\n }\n if (superFund1Usi === null || superFund1Usi.trim() === \"\") {\n throw Error(\"Invalid super fund 1 USI\");\n }\n return {\n superFund1MemberName,\n superFund1MemberNumber,\n superFund1Nomination: \"REGULATED\",\n superFund1Usi,\n };\n }\n\n if (superFund1MemberName !== null) {\n throw Error(\"Invalid super fund 1 member name (only REGULATED funds require a member name)\");\n }\n\n if (superFund1MemberNumber !== null) {\n throw Error(\n \"Invalid super fund 1 member number (only REGULATED funds require a member number)\",\n );\n }\n\n if (superFund1Usi !== null) {\n throw Error(\"Invalid super fund 1 USI (only REGULATED funds require a USI)\");\n }\n\n return {\n superFund1MemberName,\n superFund1MemberNumber,\n superFund1Nomination,\n superFund1Usi,\n };\n};\n\nexport default validatePersonDataTransferLineSuperFunds;\n"],"mappings":"AAEA,MAAM,2CAA2C,CAC/C,UACyC;AACzC,MAAI,UAAU,KAAM,QAAO;AAC3B,QAAM,EAAE,sBAAsB,wBAAwB,sBAAsB,cAAc,IACxF;AAEF,MAAI,yBAAyB,MAAM;AACjC,UAAM,MAAM,iCAAiC;AAAA,EAC/C;AAEA,MAAI,yBAAyB,aAAa;AACxC,QAAI,yBAAyB,QAAQ,qBAAqB,KAAK,MAAM,IAAI;AACvE,YAAM,MAAM,kCAAkC;AAAA,IAChD;AACA,QAAI,2BAA2B,QAAQ,uBAAuB,KAAK,MAAM,IAAI;AAC3E,YAAM,MAAM,oCAAoC;AAAA,IAClD;AACA,QAAI,kBAAkB,QAAQ,cAAc,KAAK,MAAM,IAAI;AACzD,YAAM,MAAM,0BAA0B;AAAA,IACxC;AACA,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,sBAAsB;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AAEA,MAAI,yBAAyB,MAAM;AACjC,UAAM,MAAM,+EAA+E;AAAA,EAC7F;AAEA,MAAI,2BAA2B,MAAM;AACnC,UAAM;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AAEA,MAAI,kBAAkB,MAAM;AAC1B,UAAM,MAAM,+DAA+D;AAAA,EAC7E;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,IAAO,mDAAQ;","names":[]}
@@ -0,0 +1,6 @@
1
+ import { PartialPersonDataTransferLine, PersonDataTransferLine } from './_types.js';
2
+ import '../api/_generated.js';
3
+
4
+ declare const validatePersonDataTransferLineTaxDetails: (value: PartialPersonDataTransferLine["taxDetails"]) => PersonDataTransferLine["taxDetails"];
5
+
6
+ export { validatePersonDataTransferLineTaxDetails as default };
@@ -0,0 +1,46 @@
1
+ const validatePersonDataTransferLineTaxDetails = (value) => {
2
+ if (value === null) return null;
3
+ const {
4
+ hasLoanOrStudentDebt,
5
+ residencyStatus,
6
+ taxFreeThresholdClaimed,
7
+ taxFileNumber,
8
+ taxFileNumberExemption
9
+ } = value;
10
+ if (hasLoanOrStudentDebt === null) {
11
+ throw Error('Missing value for "has loan or student debt"');
12
+ }
13
+ if (residencyStatus === null) {
14
+ throw Error("Missing residency status");
15
+ }
16
+ if (taxFreeThresholdClaimed === null) {
17
+ throw Error('Missing value for "tax free threshold claimed"');
18
+ }
19
+ if (taxFileNumberExemption === null) {
20
+ throw Error("Missing tax file number exemption");
21
+ }
22
+ if (taxFileNumberExemption === "NONE") {
23
+ if (taxFileNumber === null) {
24
+ throw Error("Missing tax file number");
25
+ }
26
+ return {
27
+ hasLoanOrStudentDebt,
28
+ residencyStatus,
29
+ taxFreeThresholdClaimed,
30
+ taxFileNumber,
31
+ taxFileNumberExemption
32
+ };
33
+ }
34
+ return {
35
+ hasLoanOrStudentDebt,
36
+ residencyStatus,
37
+ taxFreeThresholdClaimed,
38
+ taxFileNumber: null,
39
+ taxFileNumberExemption
40
+ };
41
+ };
42
+ var validatePersonDataTransferLineTaxDetails_default = validatePersonDataTransferLineTaxDetails;
43
+ export {
44
+ validatePersonDataTransferLineTaxDetails_default as default
45
+ };
46
+ //# sourceMappingURL=validatePersonDataTransferLineTaxDetails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/employee-records/validatePersonDataTransferLineTaxDetails.ts"],"sourcesContent":["import type { PartialPersonDataTransferLine, PersonDataTransferLine } from \"./_types.js\";\n\nconst validatePersonDataTransferLineTaxDetails = (\n value: PartialPersonDataTransferLine[\"taxDetails\"],\n): PersonDataTransferLine[\"taxDetails\"] => {\n if (value === null) return null;\n\n const {\n hasLoanOrStudentDebt,\n residencyStatus,\n taxFreeThresholdClaimed,\n taxFileNumber,\n taxFileNumberExemption,\n } = value;\n\n if (hasLoanOrStudentDebt === null) {\n throw Error('Missing value for \"has loan or student debt\"');\n }\n\n if (residencyStatus === null) {\n throw Error(\"Missing residency status\");\n }\n\n if (taxFreeThresholdClaimed === null) {\n throw Error('Missing value for \"tax free threshold claimed\"');\n }\n\n if (taxFileNumberExemption === null) {\n throw Error(\"Missing tax file number exemption\");\n }\n\n if (taxFileNumberExemption === \"NONE\") {\n if (taxFileNumber === null) {\n throw Error(\"Missing tax file number\");\n }\n\n // TODO: Check the TFN is a valid format. See PROD-2194.\n\n return {\n hasLoanOrStudentDebt,\n residencyStatus,\n taxFreeThresholdClaimed,\n taxFileNumber,\n taxFileNumberExemption,\n };\n }\n\n return {\n hasLoanOrStudentDebt,\n residencyStatus,\n taxFreeThresholdClaimed,\n taxFileNumber: null,\n taxFileNumberExemption,\n };\n};\n\nexport default validatePersonDataTransferLineTaxDetails;\n"],"mappings":"AAEA,MAAM,2CAA2C,CAC/C,UACyC;AACzC,MAAI,UAAU,KAAM,QAAO;AAE3B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,MAAI,yBAAyB,MAAM;AACjC,UAAM,MAAM,8CAA8C;AAAA,EAC5D;AAEA,MAAI,oBAAoB,MAAM;AAC5B,UAAM,MAAM,0BAA0B;AAAA,EACxC;AAEA,MAAI,4BAA4B,MAAM;AACpC,UAAM,MAAM,gDAAgD;AAAA,EAC9D;AAEA,MAAI,2BAA2B,MAAM;AACnC,UAAM,MAAM,mCAAmC;AAAA,EACjD;AAEA,MAAI,2BAA2B,QAAQ;AACrC,QAAI,kBAAkB,MAAM;AAC1B,YAAM,MAAM,yBAAyB;AAAA,IACvC;AAIA,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,EACF;AACF;AAEA,IAAO,mDAAQ;","names":[]}
@@ -0,0 +1,6 @@
1
+ import { PartialPersonDataTransferLine, PersonDataTransferLine } from './_types.js';
2
+ import '../api/_generated.js';
3
+
4
+ declare const validatePersonDataTransferLineTenure: (value: PartialPersonDataTransferLine["tenure"]) => PersonDataTransferLine["tenure"];
5
+
6
+ export { validatePersonDataTransferLineTenure as default };
@@ -0,0 +1,20 @@
1
+ import isValidPlainDate from "@worknice/utils/temporal/isValidPlainDate";
2
+ const validatePersonDataTransferLineTenure = (value) => {
3
+ if (value === null) return null;
4
+ const { endDate, startDate } = value;
5
+ if (endDate !== null && !isValidPlainDate(endDate)) {
6
+ throw Error("Invalid end date");
7
+ }
8
+ if (!isValidPlainDate(startDate)) {
9
+ throw Error("Invalid start date");
10
+ }
11
+ return {
12
+ endDate,
13
+ startDate
14
+ };
15
+ };
16
+ var validatePersonDataTransferLineTenure_default = validatePersonDataTransferLineTenure;
17
+ export {
18
+ validatePersonDataTransferLineTenure_default as default
19
+ };
20
+ //# sourceMappingURL=validatePersonDataTransferLineTenure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/employee-records/validatePersonDataTransferLineTenure.ts"],"sourcesContent":["import isValidPlainDate from \"@worknice/utils/temporal/isValidPlainDate\";\nimport type { PartialPersonDataTransferLine, PersonDataTransferLine } from \"./_types.js\";\n\nconst validatePersonDataTransferLineTenure = (\n value: PartialPersonDataTransferLine[\"tenure\"],\n): PersonDataTransferLine[\"tenure\"] => {\n if (value === null) return null;\n\n const { endDate, startDate } = value;\n\n if (endDate !== null && !isValidPlainDate(endDate)) {\n throw Error(\"Invalid end date\");\n }\n\n if (!isValidPlainDate(startDate)) {\n throw Error(\"Invalid start date\");\n }\n\n return {\n endDate,\n startDate,\n };\n};\n\nexport default validatePersonDataTransferLineTenure;\n"],"mappings":"AAAA,OAAO,sBAAsB;AAG7B,MAAM,uCAAuC,CAC3C,UACqC;AACrC,MAAI,UAAU,KAAM,QAAO;AAE3B,QAAM,EAAE,SAAS,UAAU,IAAI;AAE/B,MAAI,YAAY,QAAQ,CAAC,iBAAiB,OAAO,GAAG;AAClD,UAAM,MAAM,kBAAkB;AAAA,EAChC;AAEA,MAAI,CAAC,iBAAiB,SAAS,GAAG;AAChC,UAAM,MAAM,oBAAoB;AAAA,EAClC;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAEA,IAAO,+CAAQ;","names":[]}
@@ -0,0 +1,22 @@
1
+ import { W as WorkniceClient } from '../_types-Cobjq3B-.js';
2
+ import WorkniceIntegrationLogger, { Logger } from '../api/WorkniceIntegrationLogger.js';
3
+ import '../api/_generated.js';
4
+
5
+ type HandlerOptions = {
6
+ apiUrl?: string;
7
+ /**
8
+ * @deprecated Use `debugLogType: "info"` instead.
9
+ */
10
+ debug?: boolean;
11
+ debugLogType?: "debug" | "info";
12
+ logger?: Logger;
13
+ };
14
+ type TaskContext<Payload, Env = null, Req extends Request = Request> = {
15
+ env: Env;
16
+ logger: WorkniceIntegrationLogger;
17
+ payload: Payload;
18
+ request: Req;
19
+ worknice: WorkniceClient;
20
+ };
21
+
22
+ export type { HandlerOptions, TaskContext };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=_types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,15 @@
1
+ import { ApproveLeaveRequestResponsePayload, ApproveLeaveRequestRequestPayload } from '../webhooks.js';
2
+ import { HandlerOptions, TaskContext } from './_types.js';
3
+ import '../_types-Cobjq3B-.js';
4
+ import '../api/_generated.js';
5
+ import '../api/WorkniceIntegrationLogger.js';
6
+
7
+ type Context<Env, Req extends Request = Request> = TaskContext<ApproveLeaveRequestRequestPayload, Env, Req>;
8
+ type Tasks<Env, Req extends Request = Request> = {
9
+ approveLeaveRequest: (context: Context<Env, Req>) => Promise<ApproveLeaveRequestResponsePayload>;
10
+ getApiToken: (context: Pick<Context<Env, Req>, "env" | "logger" | "payload" | "request">) => Promise<string | undefined>;
11
+ getEnv: (context: Pick<Context<Env, Req>, "logger" | "payload" | "request">) => Promise<Env>;
12
+ };
13
+ declare const handleApproveLeaveRequestWebhook: <Env, Req extends Request = Request>(request: Req, { approveLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>, options?: HandlerOptions) => Promise<Response>;
14
+
15
+ export { handleApproveLeaveRequestWebhook as default };
@@ -0,0 +1,21 @@
1
+ import handleRequestWithWorknice from "./handleRequestWithWorknice.js";
2
+ const handleApproveLeaveRequestWebhook = async (request, { approveLeaveRequest, getApiToken, getEnv }, options) => handleRequestWithWorknice(
3
+ request,
4
+ {
5
+ getApiToken,
6
+ handleRequest: approveLeaveRequest,
7
+ parseRequest: async (context) => {
8
+ const payload = await context.request.json();
9
+ return {
10
+ env: await getEnv({ ...context, payload }),
11
+ payload
12
+ };
13
+ }
14
+ },
15
+ options
16
+ );
17
+ var handleApproveLeaveRequestWebhook_default = handleApproveLeaveRequestWebhook;
18
+ export {
19
+ handleApproveLeaveRequestWebhook_default as default
20
+ };
21
+ //# sourceMappingURL=handleApproveLeaveRequestWebhook.js.map
@@ -0,0 +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":[]}
@@ -0,0 +1,15 @@
1
+ import { CancelLeaveRequestResponsePayload, CancelLeaveRequestRequestPayload } from '../webhooks.js';
2
+ import { HandlerOptions, TaskContext } from './_types.js';
3
+ import '../_types-Cobjq3B-.js';
4
+ import '../api/_generated.js';
5
+ import '../api/WorkniceIntegrationLogger.js';
6
+
7
+ type Context<Env, Req extends Request = Request> = TaskContext<CancelLeaveRequestRequestPayload, Env, Req>;
8
+ type Tasks<Env, Req extends Request = Request> = {
9
+ cancelLeaveRequest: (context: Context<Env, Req>) => Promise<CancelLeaveRequestResponsePayload>;
10
+ getApiToken: (context: Pick<Context<Env, Req>, "env" | "logger" | "payload" | "request">) => Promise<string | undefined>;
11
+ getEnv: (context: Pick<Context<Env, Req>, "logger" | "payload" | "request">) => Promise<Env>;
12
+ };
13
+ declare const handleCancelLeaveRequestWebhook: <Env, Req extends Request = Request>(request: Req, { cancelLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>, options?: HandlerOptions) => Promise<Response>;
14
+
15
+ export { handleCancelLeaveRequestWebhook as default };
@@ -0,0 +1,21 @@
1
+ import handleRequestWithWorknice from "./handleRequestWithWorknice.js";
2
+ const handleCancelLeaveRequestWebhook = async (request, { cancelLeaveRequest, getApiToken, getEnv }, options) => handleRequestWithWorknice(
3
+ request,
4
+ {
5
+ getApiToken,
6
+ handleRequest: cancelLeaveRequest,
7
+ parseRequest: async (context) => {
8
+ const payload = await context.request.json();
9
+ return {
10
+ env: await getEnv({ ...context, payload }),
11
+ payload
12
+ };
13
+ }
14
+ },
15
+ options
16
+ );
17
+ var handleCancelLeaveRequestWebhook_default = handleCancelLeaveRequestWebhook;
18
+ export {
19
+ handleCancelLeaveRequestWebhook_default as default
20
+ };
21
+ //# sourceMappingURL=handleCancelLeaveRequestWebhook.js.map
@@ -0,0 +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":[]}
@@ -0,0 +1,14 @@
1
+ import { CreateIntegrationRequestPayload } from '../webhooks.js';
2
+ import { HandlerOptions, TaskContext } from './_types.js';
3
+ import '../_types-Cobjq3B-.js';
4
+ import '../api/_generated.js';
5
+ import '../api/WorkniceIntegrationLogger.js';
6
+
7
+ type Tasks<Req extends Request = Request> = {
8
+ persistDetails: (context: TaskContext<CreateIntegrationRequestPayload, null, Req>) => Promise<void>;
9
+ };
10
+ declare const handleCreateIntegrationWebhook: <Req extends Request = Request>(request: Req, { persistDetails }: Tasks<Req>, options?: HandlerOptions & {
11
+ action?: "initialize" | "authorize" | "activate";
12
+ }) => Promise<Response>;
13
+
14
+ export { handleCreateIntegrationWebhook as default };
@@ -0,0 +1,42 @@
1
+ import handleRequestWithWorknice from "./handleRequestWithWorknice.js";
2
+ const handleCreateIntegrationWebhook = async (request, { persistDetails }, options) => handleRequestWithWorknice(
3
+ request,
4
+ {
5
+ getApiToken: async ({ payload }) => payload.apiToken,
6
+ handleRequest: async (context) => {
7
+ const { logger, payload, worknice } = context;
8
+ logger.debug("Persisting details\u2026");
9
+ await persistDetails(context);
10
+ switch (options?.action ?? "initialize") {
11
+ case "initialize": {
12
+ logger.debug("Initializing integration\u2026");
13
+ await worknice.initializeIntegration({ id: payload.integrationId });
14
+ break;
15
+ }
16
+ case "authorize": {
17
+ logger.debug("Authorizing integration\u2026");
18
+ await worknice.authorizeIntegration({ integrationId: payload.integrationId });
19
+ break;
20
+ }
21
+ case "activate": {
22
+ logger.debug("Activating integration\u2026");
23
+ await worknice.activateIntegration({ id: payload.integrationId });
24
+ break;
25
+ }
26
+ }
27
+ },
28
+ parseRequest: async (context) => {
29
+ const payload = await context.request.json();
30
+ return {
31
+ env: null,
32
+ payload
33
+ };
34
+ }
35
+ },
36
+ options
37
+ );
38
+ var handleCreateIntegrationWebhook_default = handleCreateIntegrationWebhook;
39
+ export {
40
+ handleCreateIntegrationWebhook_default as default
41
+ };
42
+ //# sourceMappingURL=handleCreateIntegrationWebhook.js.map
@@ -0,0 +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":[]}
@@ -0,0 +1,15 @@
1
+ import { CreateLeaveRequestResponsePayload, CreateLeaveRequestRequestPayload } from '../webhooks.js';
2
+ import { HandlerOptions, TaskContext } from './_types.js';
3
+ import '../_types-Cobjq3B-.js';
4
+ import '../api/_generated.js';
5
+ import '../api/WorkniceIntegrationLogger.js';
6
+
7
+ type Context<Env, Req extends Request = Request> = TaskContext<CreateLeaveRequestRequestPayload, Env, Req>;
8
+ type Tasks<Env, Req extends Request = Request> = {
9
+ createLeaveRequest: (context: Context<Env, Req>) => Promise<CreateLeaveRequestResponsePayload>;
10
+ getApiToken: (context: Pick<Context<Env, Req>, "env" | "logger" | "payload" | "request">) => Promise<string | undefined>;
11
+ getEnv: (context: Pick<Context<Env, Req>, "logger" | "payload" | "request">) => Promise<Env>;
12
+ };
13
+ declare const handleCreateLeaveRequestWebhook: <Env, Req extends Request = Request>(request: Req, { createLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>, options?: HandlerOptions) => Promise<Response>;
14
+
15
+ export { handleCreateLeaveRequestWebhook as default };
@@ -0,0 +1,21 @@
1
+ import handleRequestWithWorknice from "./handleRequestWithWorknice.js";
2
+ const handleCreateLeaveRequestWebhook = async (request, { createLeaveRequest, getApiToken, getEnv }, options) => handleRequestWithWorknice(
3
+ request,
4
+ {
5
+ getApiToken,
6
+ handleRequest: createLeaveRequest,
7
+ parseRequest: async (context) => {
8
+ const payload = await context.request.json();
9
+ return {
10
+ env: await getEnv({ ...context, payload }),
11
+ payload
12
+ };
13
+ }
14
+ },
15
+ options
16
+ );
17
+ var handleCreateLeaveRequestWebhook_default = handleCreateLeaveRequestWebhook;
18
+ export {
19
+ handleCreateLeaveRequestWebhook_default as default
20
+ };
21
+ //# sourceMappingURL=handleCreateLeaveRequestWebhook.js.map
@@ -0,0 +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":[]}
@@ -0,0 +1,15 @@
1
+ import { DenyLeaveRequestResponsePayload, DenyLeaveRequestRequestPayload } from '../webhooks.js';
2
+ import { HandlerOptions, TaskContext } from './_types.js';
3
+ import '../_types-Cobjq3B-.js';
4
+ import '../api/_generated.js';
5
+ import '../api/WorkniceIntegrationLogger.js';
6
+
7
+ type Context<Env, Req extends Request = Request> = TaskContext<DenyLeaveRequestRequestPayload, Env, Req>;
8
+ type Tasks<Env, Req extends Request = Request> = {
9
+ denyLeaveRequest: (context: Context<Env, Req>) => Promise<DenyLeaveRequestResponsePayload>;
10
+ getApiToken: (context: Pick<Context<Env, Req>, "env" | "logger" | "payload" | "request">) => Promise<string | undefined>;
11
+ getEnv: (context: Pick<Context<Env, Req>, "logger" | "payload" | "request">) => Promise<Env>;
12
+ };
13
+ declare const handleDenyLeaveRequestWebhook: <Env, Req extends Request = Request>(request: Req, { denyLeaveRequest, getApiToken, getEnv }: Tasks<Env, Req>, options?: HandlerOptions) => Promise<Response>;
14
+
15
+ export { handleDenyLeaveRequestWebhook as default };
@@ -0,0 +1,21 @@
1
+ import handleRequestWithWorknice from "./handleRequestWithWorknice.js";
2
+ const handleDenyLeaveRequestWebhook = async (request, { denyLeaveRequest, getApiToken, getEnv }, options) => handleRequestWithWorknice(
3
+ request,
4
+ {
5
+ getApiToken,
6
+ handleRequest: denyLeaveRequest,
7
+ parseRequest: async (context) => {
8
+ const payload = await context.request.json();
9
+ return {
10
+ env: await getEnv({ ...context, payload }),
11
+ payload
12
+ };
13
+ }
14
+ },
15
+ options
16
+ );
17
+ var handleDenyLeaveRequestWebhook_default = handleDenyLeaveRequestWebhook;
18
+ export {
19
+ handleDenyLeaveRequestWebhook_default as default
20
+ };
21
+ //# sourceMappingURL=handleDenyLeaveRequestWebhook.js.map
@@ -0,0 +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":[]}
@@ -0,0 +1,12 @@
1
+ import { GetAuthorizationUrlRequestPayload } from '../webhooks.js';
2
+ import { HandlerOptions, TaskContext } from './_types.js';
3
+ import '../_types-Cobjq3B-.js';
4
+ import '../api/_generated.js';
5
+ import '../api/WorkniceIntegrationLogger.js';
6
+
7
+ type Tasks<Req extends Request = Request> = {
8
+ getAuthorisationUrl: (context: TaskContext<GetAuthorizationUrlRequestPayload, null, Req>) => Promise<string>;
9
+ };
10
+ declare const handleGetAuthorizationUrlWebhook: <Req extends Request = Request>(request: Req, { getAuthorisationUrl }: Tasks, options?: HandlerOptions) => Promise<Response>;
11
+
12
+ export { handleGetAuthorizationUrlWebhook as default };
@@ -0,0 +1,27 @@
1
+ import handleRequestWithWorknice from "./handleRequestWithWorknice.js";
2
+ const handleGetAuthorizationUrlWebhook = async (request, { getAuthorisationUrl }, options) => handleRequestWithWorknice(
3
+ request,
4
+ {
5
+ getApiToken: async () => void 0,
6
+ handleRequest: async (context) => {
7
+ const { logger } = context;
8
+ logger.debug("Getting authorization url\u2026");
9
+ return {
10
+ authorizationUrl: await getAuthorisationUrl(context)
11
+ };
12
+ },
13
+ parseRequest: async (context) => {
14
+ const payload = await context.request.json();
15
+ return {
16
+ env: null,
17
+ payload
18
+ };
19
+ }
20
+ },
21
+ options
22
+ );
23
+ var handleGetAuthorizationUrlWebhook_default = handleGetAuthorizationUrlWebhook;
24
+ export {
25
+ handleGetAuthorizationUrlWebhook_default as default
26
+ };
27
+ //# sourceMappingURL=handleGetAuthorizationUrlWebhook.js.map
@@ -0,0 +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":[]}
@@ -0,0 +1,13 @@
1
+ import { GetLeaveBalancesRequestPayload, GetLeaveBalancesResponsePayload } from '../webhooks.js';
2
+ import { HandlerOptions, TaskContext } from './_types.js';
3
+ import '../_types-Cobjq3B-.js';
4
+ import '../api/_generated.js';
5
+ import '../api/WorkniceIntegrationLogger.js';
6
+
7
+ type Tasks<Env, Req extends Request = Request> = {
8
+ getEnv: (context: Pick<TaskContext<GetLeaveBalancesRequestPayload, Env, Req>, "logger" | "payload" | "request">) => Promise<Env>;
9
+ getLeaveBalances: (context: TaskContext<GetLeaveBalancesRequestPayload, Env, Req>) => Promise<GetLeaveBalancesResponsePayload>;
10
+ };
11
+ declare const handleGetLeaveBalancesWebhook: <Env, Req extends Request = Request>(request: Req, { getEnv, getLeaveBalances }: Tasks<Env, Req>, options?: HandlerOptions) => Promise<Response>;
12
+
13
+ export { handleGetLeaveBalancesWebhook as default };
@@ -0,0 +1,27 @@
1
+ import handleRequestWithWorknice from "./handleRequestWithWorknice.js";
2
+ const handleGetLeaveBalancesWebhook = async (request, { getEnv, getLeaveBalances }, options) => handleRequestWithWorknice(
3
+ request,
4
+ {
5
+ getApiToken: async () => void 0,
6
+ handleRequest: async (context) => {
7
+ const { logger } = context;
8
+ logger.info("Retrieving leave balances\u2026");
9
+ const result = await getLeaveBalances(context);
10
+ logger.info(`Retrieved ${result.length} leave balances.`);
11
+ return result;
12
+ },
13
+ parseRequest: async (context) => {
14
+ const payload = await context.request.json();
15
+ return {
16
+ env: await getEnv({ ...context, payload }),
17
+ payload
18
+ };
19
+ }
20
+ },
21
+ options
22
+ );
23
+ var handleGetLeaveBalancesWebhook_default = handleGetLeaveBalancesWebhook;
24
+ export {
25
+ handleGetLeaveBalancesWebhook_default as default
26
+ };
27
+ //# sourceMappingURL=handleGetLeaveBalancesWebhook.js.map
@@ -0,0 +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":[]}
@@ -0,0 +1,15 @@
1
+ import { GetLeaveCategoriesResponsePayload, GetLeaveCategoriesRequestPayload } from '../webhooks.js';
2
+ import { HandlerOptions, TaskContext } from './_types.js';
3
+ import '../_types-Cobjq3B-.js';
4
+ import '../api/_generated.js';
5
+ import '../api/WorkniceIntegrationLogger.js';
6
+
7
+ type Context<Env, Req extends Request = Request> = TaskContext<GetLeaveCategoriesRequestPayload, Env, Req>;
8
+ type Tasks<Env, Req extends Request = Request> = {
9
+ getApiToken: (context: Pick<Context<Env, Req>, "env" | "logger" | "payload" | "request">) => Promise<string | undefined>;
10
+ getEnv: (context: Pick<Context<Env, Req>, "logger" | "payload" | "request">) => Promise<Env>;
11
+ getLeaveCategories: (context: Context<Env, Req>) => Promise<GetLeaveCategoriesResponsePayload>;
12
+ };
13
+ declare const handleGetLeaveCategoriesWebhook: <Env, Req extends Request = Request>(request: Req, { getApiToken, getEnv, getLeaveCategories }: Tasks<Env, Req>, options?: HandlerOptions) => Promise<Response>;
14
+
15
+ export { handleGetLeaveCategoriesWebhook as default };
@@ -0,0 +1,27 @@
1
+ import handleRequestWithWorknice from "./handleRequestWithWorknice.js";
2
+ const handleGetLeaveCategoriesWebhook = async (request, { getApiToken, getEnv, getLeaveCategories }, options) => handleRequestWithWorknice(
3
+ request,
4
+ {
5
+ getApiToken,
6
+ handleRequest: async (context) => {
7
+ const { logger } = context;
8
+ logger.info("Retrieving leave categories\u2026");
9
+ const result = await getLeaveCategories(context);
10
+ logger.info(`Retrieved ${result.leaveCategories.length} leave categories.`);
11
+ return result;
12
+ },
13
+ parseRequest: async (context) => {
14
+ const payload = await context.request.json();
15
+ return {
16
+ env: await getEnv({ ...context, payload }),
17
+ payload
18
+ };
19
+ }
20
+ },
21
+ options
22
+ );
23
+ var handleGetLeaveCategoriesWebhook_default = handleGetLeaveCategoriesWebhook;
24
+ export {
25
+ handleGetLeaveCategoriesWebhook_default as default
26
+ };
27
+ //# sourceMappingURL=handleGetLeaveCategoriesWebhook.js.map
@@ -0,0 +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":[]}
@@ -0,0 +1,13 @@
1
+ import { GetLeaveRequestHoursRequestPayload, GetLeaveRequestHoursResponsePayload } from '../webhooks.js';
2
+ import { HandlerOptions, TaskContext } from './_types.js';
3
+ import '../_types-Cobjq3B-.js';
4
+ import '../api/_generated.js';
5
+ import '../api/WorkniceIntegrationLogger.js';
6
+
7
+ type Tasks<Env, Req extends Request = Request> = {
8
+ getEnv: (context: Pick<TaskContext<GetLeaveRequestHoursRequestPayload, Env, Req>, "logger" | "payload" | "request">) => Promise<Env>;
9
+ getLeaveRequestHours: (context: TaskContext<GetLeaveRequestHoursRequestPayload, Env, Req>) => Promise<GetLeaveRequestHoursResponsePayload>;
10
+ };
11
+ declare const handleGetLeaveRequestHoursWebhook: <Env, Req extends Request = Request>(request: Req, { getEnv, getLeaveRequestHours }: Tasks<Env, Req>, options?: HandlerOptions) => Promise<Response>;
12
+
13
+ export { handleGetLeaveRequestHoursWebhook as default };