@tryfinch/finch-api 5.0.0 → 5.1.0

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 (149) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +33 -0
  3. package/_shims/{ReadableStream.node.d.ts → ReadableStream-node.d.ts} +1 -1
  4. package/_shims/ReadableStream-node.d.ts.map +1 -0
  5. package/_shims/{ReadableStream.node.js → ReadableStream-node.js} +1 -1
  6. package/_shims/ReadableStream-node.js.map +1 -0
  7. package/_shims/{ReadableStream.node.mjs → ReadableStream-node.mjs} +1 -1
  8. package/_shims/ReadableStream-node.mjs.map +1 -0
  9. package/_shims/{agent.node.d.ts → agent-node.d.ts} +1 -1
  10. package/_shims/agent-node.d.ts.map +1 -0
  11. package/_shims/{agent.node.js → agent-node.js} +1 -1
  12. package/_shims/{agent.node.js.map → agent-node.js.map} +1 -1
  13. package/_shims/{agent.node.mjs → agent-node.mjs} +1 -1
  14. package/_shims/{agent.node.mjs.map → agent-node.mjs.map} +1 -1
  15. package/_shims/agent.d.ts +1 -1
  16. package/_shims/agent.js +1 -1
  17. package/_shims/agent.mjs +1 -1
  18. package/_shims/{fileFromPath.node.d.ts → fileFromPath-node.d.ts} +2 -2
  19. package/_shims/{fileFromPath.node.d.ts.map → fileFromPath-node.d.ts.map} +1 -1
  20. package/_shims/{fileFromPath.node.js → fileFromPath-node.js} +1 -1
  21. package/_shims/{fileFromPath.node.js.map → fileFromPath-node.js.map} +1 -1
  22. package/_shims/{fileFromPath.node.mjs → fileFromPath-node.mjs} +1 -1
  23. package/_shims/{fileFromPath.node.mjs.map → fileFromPath-node.mjs.map} +1 -1
  24. package/_shims/fileFromPath.d.ts +2 -2
  25. package/_shims/fileFromPath.d.ts.map +1 -1
  26. package/_shims/fileFromPath.js +1 -1
  27. package/_shims/fileFromPath.mjs +1 -1
  28. package/_shims/{getMultipartRequestOptions.node.d.ts → getMultipartRequestOptions-node.d.ts} +2 -2
  29. package/_shims/getMultipartRequestOptions-node.d.ts.map +1 -0
  30. package/_shims/{getMultipartRequestOptions.node.js → getMultipartRequestOptions-node.js} +1 -1
  31. package/_shims/{getMultipartRequestOptions.node.js.map → getMultipartRequestOptions-node.js.map} +1 -1
  32. package/_shims/{getMultipartRequestOptions.node.mjs → getMultipartRequestOptions-node.mjs} +1 -1
  33. package/_shims/{getMultipartRequestOptions.node.mjs.map → getMultipartRequestOptions-node.mjs.map} +1 -1
  34. package/_shims/getMultipartRequestOptions.d.ts +1 -1
  35. package/_shims/getMultipartRequestOptions.d.ts.map +1 -1
  36. package/_shims/{node-readable.node.d.ts → node-readable-node.d.ts} +1 -1
  37. package/_shims/{node-readable.node.d.ts.map → node-readable-node.d.ts.map} +1 -1
  38. package/_shims/{node-readable.node.js → node-readable-node.js} +1 -1
  39. package/_shims/node-readable-node.js.map +1 -0
  40. package/_shims/{node-readable.node.mjs → node-readable-node.mjs} +1 -1
  41. package/_shims/node-readable-node.mjs.map +1 -0
  42. package/core.d.ts +2 -1
  43. package/core.d.ts.map +1 -1
  44. package/core.js +3 -1
  45. package/core.js.map +1 -1
  46. package/core.mjs +1 -1
  47. package/core.mjs.map +1 -1
  48. package/error.d.ts +1 -1
  49. package/error.d.ts.map +1 -1
  50. package/error.js +2 -2
  51. package/error.js.map +1 -1
  52. package/error.mjs +2 -2
  53. package/error.mjs.map +1 -1
  54. package/index.d.mts +6 -1
  55. package/index.d.ts +6 -1
  56. package/index.d.ts.map +1 -1
  57. package/index.js +9 -3
  58. package/index.js.map +1 -1
  59. package/index.mjs +9 -3
  60. package/index.mjs.map +1 -1
  61. package/package.json +9 -4
  62. package/resources/index.d.ts +1 -0
  63. package/resources/index.d.ts.map +1 -1
  64. package/resources/index.js +14 -1
  65. package/resources/index.js.map +1 -1
  66. package/resources/index.mjs +1 -0
  67. package/resources/index.mjs.map +1 -1
  68. package/resources/webhooks.d.ts +22 -0
  69. package/resources/webhooks.d.ts.map +1 -0
  70. package/resources/webhooks.js +118 -0
  71. package/resources/webhooks.js.map +1 -0
  72. package/resources/webhooks.mjs +114 -0
  73. package/resources/webhooks.mjs.map +1 -0
  74. package/src/_shims/ReadableStream.d.ts +5 -5
  75. package/src/_shims/agent.ts +1 -1
  76. package/src/_shims/{fetch.node.d.ts → fetch-node.d.ts} +8 -8
  77. package/src/_shims/fetch.d.ts +10 -10
  78. package/src/_shims/{fileFromPath.node.ts → fileFromPath-node.ts} +1 -1
  79. package/src/_shims/fileFromPath.ts +2 -2
  80. package/src/_shims/{formdata.node.d.ts → form-data-node.d.ts} +4 -4
  81. package/src/_shims/{formdata.d.ts → form-data.d.ts} +4 -4
  82. package/src/_shims/{getMultipartRequestOptions.node.ts → getMultipartRequestOptions-node.ts} +3 -3
  83. package/src/_shims/getMultipartRequestOptions.ts +3 -3
  84. package/src/core.ts +11 -10
  85. package/src/error.ts +3 -3
  86. package/src/index.ts +17 -7
  87. package/src/pagination.ts +3 -3
  88. package/src/resource.ts +1 -1
  89. package/src/resources/account.ts +3 -3
  90. package/src/resources/ats/applications.ts +6 -6
  91. package/src/resources/ats/ats.ts +7 -7
  92. package/src/resources/ats/candidates.ts +5 -5
  93. package/src/resources/ats/index.ts +6 -6
  94. package/src/resources/ats/jobs.ts +5 -5
  95. package/src/resources/ats/offers.ts +5 -5
  96. package/src/resources/ats/stages.ts +4 -4
  97. package/src/resources/hris/benefits/benefits.ts +6 -6
  98. package/src/resources/hris/benefits/index.ts +2 -2
  99. package/src/resources/hris/benefits/individuals.ts +6 -6
  100. package/src/resources/hris/company.ts +4 -4
  101. package/src/resources/hris/directory.ts +5 -5
  102. package/src/resources/hris/employments.ts +5 -5
  103. package/src/resources/hris/hris.ts +9 -9
  104. package/src/resources/hris/index.ts +8 -8
  105. package/src/resources/hris/individuals.ts +6 -6
  106. package/src/resources/hris/pay-statements.ts +6 -6
  107. package/src/resources/hris/payments.ts +5 -5
  108. package/src/resources/index.ts +6 -5
  109. package/src/resources/providers.ts +4 -4
  110. package/src/resources/webhooks.ts +151 -0
  111. package/src/tsconfig.json +11 -0
  112. package/src/uploads.ts +6 -6
  113. package/src/version.ts +1 -1
  114. package/uploads.d.ts +1 -1
  115. package/uploads.d.ts.map +1 -1
  116. package/uploads.js +4 -4
  117. package/uploads.js.map +1 -1
  118. package/uploads.mjs +1 -1
  119. package/uploads.mjs.map +1 -1
  120. package/version.d.ts +1 -1
  121. package/version.js +1 -1
  122. package/version.mjs +1 -1
  123. package/_shims/ReadableStream.node.d.ts.map +0 -1
  124. package/_shims/ReadableStream.node.js.map +0 -1
  125. package/_shims/ReadableStream.node.mjs.map +0 -1
  126. package/_shims/agent.node.d.ts.map +0 -1
  127. package/_shims/getMultipartRequestOptions.node.d.ts.map +0 -1
  128. package/_shims/node-readable.node.js.map +0 -1
  129. package/_shims/node-readable.node.mjs.map +0 -1
  130. package/src/_shims/fetch.deno.ts +0 -23
  131. package/src/_shims/formdata.deno.ts +0 -16
  132. /package/_shims/{fetch.node.d.ts → fetch-node.d.ts} +0 -0
  133. /package/_shims/{fetch.node.js → fetch-node.js} +0 -0
  134. /package/_shims/{fetch.node.mjs → fetch-node.mjs} +0 -0
  135. /package/_shims/{formdata.node.d.ts → form-data-node.d.ts} +0 -0
  136. /package/_shims/{formdata.node.js → form-data-node.js} +0 -0
  137. /package/_shims/{formdata.node.mjs → form-data-node.mjs} +0 -0
  138. /package/_shims/{formdata.d.ts → form-data.d.ts} +0 -0
  139. /package/_shims/{formdata.js → form-data.js} +0 -0
  140. /package/_shims/{formdata.mjs → form-data.mjs} +0 -0
  141. /package/src/_shims/{ReadableStream.node.ts → ReadableStream-node.ts} +0 -0
  142. /package/src/_shims/{agent.node.ts → agent-node.ts} +0 -0
  143. /package/src/_shims/{fetch.node.js → fetch-node.js} +0 -0
  144. /package/src/_shims/{fetch.node.mjs → fetch-node.mjs} +0 -0
  145. /package/src/_shims/{formdata.node.js → form-data-node.js} +0 -0
  146. /package/src/_shims/{formdata.node.mjs → form-data-node.mjs} +0 -0
  147. /package/src/_shims/{formdata.js → form-data.js} +0 -0
  148. /package/src/_shims/{formdata.mjs → form-data.mjs} +0 -0
  149. /package/src/_shims/{node-readable.node.ts → node-readable-node.ts} +0 -0
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../core';
4
- import { APIResource } from '../resource';
5
- import * as API from './index';
3
+ import * as Core from '../core.js';
4
+ import { APIResource } from '../resource.js';
5
+ import * as API from './index.js';
6
6
 
7
7
  export class Account extends APIResource {
8
8
  /**
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../core';
4
- import { APIResource } from '../../resource';
5
- import { isRequestOptions } from '../../core';
6
- import * as Stages from './stages';
7
- import * as API from './index';
8
- import { ApplicationsPage, ApplicationsPageParams } from '../../pagination';
3
+ import * as Core from '../../core.js';
4
+ import { APIResource } from '../../resource.js';
5
+ import { isRequestOptions } from '../../core.js';
6
+ import * as Stages from './stages.js';
7
+ import * as API from './index.js';
8
+ import { ApplicationsPage, ApplicationsPageParams } from '../../pagination.js';
9
9
 
10
10
  export class Applications extends APIResource {
11
11
  /**
@@ -1,12 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import { Candidates } from './candidates';
5
- import { Applications } from './applications';
6
- import { Stages } from './stages';
7
- import { Jobs } from './jobs';
8
- import { Offers } from './offers';
9
- import * as API from './index';
3
+ import { APIResource } from '../../resource.js';
4
+ import { Candidates } from './candidates.js';
5
+ import { Applications } from './applications.js';
6
+ import { Stages } from './stages.js';
7
+ import { Jobs } from './jobs.js';
8
+ import { Offers } from './offers.js';
9
+ import * as API from './index.js';
10
10
 
11
11
  export class ATS extends APIResource {
12
12
  candidates: Candidates = new Candidates(this.client);
@@ -1,10 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../core';
4
- import { APIResource } from '../../resource';
5
- import { isRequestOptions } from '../../core';
6
- import * as API from './index';
7
- import { CandidatesPage, CandidatesPageParams } from '../../pagination';
3
+ import * as Core from '../../core.js';
4
+ import { APIResource } from '../../resource.js';
5
+ import { isRequestOptions } from '../../core.js';
6
+ import * as API from './index.js';
7
+ import { CandidatesPage, CandidatesPageParams } from '../../pagination.js';
8
8
 
9
9
  export class Candidates extends APIResource {
10
10
  /**
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- export { ATS } from './ats';
4
- export { Application, ApplicationListParams, Applications } from './applications';
5
- export { Candidate, CandidateListParams, Candidates } from './candidates';
6
- export { Job, JobListParams, Jobs } from './jobs';
7
- export { Offer, OfferListParams, Offers } from './offers';
8
- export { Stage, StagesSinglePage, Stages } from './stages';
3
+ export { ATS } from './ats.js';
4
+ export { Application, ApplicationListParams, Applications } from './applications.js';
5
+ export { Candidate, CandidateListParams, Candidates } from './candidates.js';
6
+ export { Job, JobListParams, Jobs } from './jobs.js';
7
+ export { Offer, OfferListParams, Offers } from './offers.js';
8
+ export { Stage, StagesSinglePage, Stages } from './stages.js';
@@ -1,10 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../core';
4
- import { APIResource } from '../../resource';
5
- import { isRequestOptions } from '../../core';
6
- import * as API from './index';
7
- import { JobsPage, JobsPageParams } from '../../pagination';
3
+ import * as Core from '../../core.js';
4
+ import { APIResource } from '../../resource.js';
5
+ import { isRequestOptions } from '../../core.js';
6
+ import * as API from './index.js';
7
+ import { JobsPage, JobsPageParams } from '../../pagination.js';
8
8
 
9
9
  export class Jobs extends APIResource {
10
10
  /**
@@ -1,10 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../core';
4
- import { APIResource } from '../../resource';
5
- import { isRequestOptions } from '../../core';
6
- import * as API from './index';
7
- import { OffersPage, OffersPageParams } from '../../pagination';
3
+ import * as Core from '../../core.js';
4
+ import { APIResource } from '../../resource.js';
5
+ import { isRequestOptions } from '../../core.js';
6
+ import * as API from './index.js';
7
+ import { OffersPage, OffersPageParams } from '../../pagination.js';
8
8
 
9
9
  export class Offers extends APIResource {
10
10
  /**
@@ -1,9 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../core';
4
- import { APIResource } from '../../resource';
5
- import * as API from './index';
6
- import { SinglePage } from '../../pagination';
3
+ import * as Core from '../../core.js';
4
+ import { APIResource } from '../../resource.js';
5
+ import * as API from './index.js';
6
+ import { SinglePage } from '../../pagination.js';
7
7
 
8
8
  export class Stages extends APIResource {
9
9
  /**
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../../core';
4
- import { APIResource } from '../../../resource';
5
- import { isRequestOptions } from '../../../core';
6
- import { Individuals } from './individuals';
7
- import * as API from './index';
8
- import { SinglePage } from '../../../pagination';
3
+ import * as Core from '../../../core.js';
4
+ import { APIResource } from '../../../resource.js';
5
+ import { isRequestOptions } from '../../../core.js';
6
+ import { Individuals } from './individuals.js';
7
+ import * as API from './index.js';
8
+ import { SinglePage } from '../../../pagination.js';
9
9
 
10
10
  export class Benefits extends APIResource {
11
11
  individuals: Individuals = new Individuals(this.client);
@@ -13,7 +13,7 @@ export {
13
13
  CompanyBenefitsSinglePage,
14
14
  SupportedBenefitsSinglePage,
15
15
  Benefits,
16
- } from './benefits';
16
+ } from './benefits.js';
17
17
  export {
18
18
  EnrolledIndividual,
19
19
  IndividualBenefit,
@@ -26,4 +26,4 @@ export {
26
26
  IndividualBenefitsSinglePage,
27
27
  UnenrolledIndividualsSinglePage,
28
28
  Individuals,
29
- } from './individuals';
29
+ } from './individuals.js';
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../../core';
4
- import { APIResource } from '../../../resource';
5
- import { isRequestOptions } from '../../../core';
6
- import * as Benefits from './index';
7
- import * as API from './index';
8
- import { SinglePage } from '../../../pagination';
3
+ import * as Core from '../../../core.js';
4
+ import { APIResource } from '../../../resource.js';
5
+ import { isRequestOptions } from '../../../core.js';
6
+ import * as Benefits from './index.js';
7
+ import * as API from './index.js';
8
+ import { SinglePage } from '../../../pagination.js';
9
9
 
10
10
  export class Individuals extends APIResource {
11
11
  /**
@@ -1,9 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../core';
4
- import { APIResource } from '../../resource';
5
- import * as HRIS from './index';
6
- import * as API from './index';
3
+ import * as Core from '../../core.js';
4
+ import { APIResource } from '../../resource.js';
5
+ import * as HRIS from './index.js';
6
+ import * as API from './index.js';
7
7
 
8
8
  export class CompanyResource extends APIResource {
9
9
  /**
@@ -1,10 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../core';
4
- import { APIResource } from '../../resource';
5
- import { isRequestOptions } from '../../core';
6
- import * as API from './index';
7
- import { IndividualsPage, IndividualsPageParams } from '../../pagination';
3
+ import * as Core from '../../core.js';
4
+ import { APIResource } from '../../resource.js';
5
+ import { isRequestOptions } from '../../core.js';
6
+ import * as API from './index.js';
7
+ import { IndividualsPage, IndividualsPageParams } from '../../pagination.js';
8
8
 
9
9
  export class Directory extends APIResource {
10
10
  /**
@@ -1,10 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../core';
4
- import { APIResource } from '../../resource';
5
- import * as HRIS from './index';
6
- import * as API from './index';
7
- import { ResponsesPage } from '../../pagination';
3
+ import * as Core from '../../core.js';
4
+ import { APIResource } from '../../resource.js';
5
+ import * as HRIS from './index.js';
6
+ import * as API from './index.js';
7
+ import { ResponsesPage } from '../../pagination.js';
8
8
 
9
9
  export class Employments extends APIResource {
10
10
  /**
@@ -1,14 +1,14 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import { CompanyResource } from './company';
5
- import { Directory } from './directory';
6
- import { Individuals } from './individuals';
7
- import { Employments } from './employments';
8
- import { Payments } from './payments';
9
- import { PayStatements } from './pay-statements';
10
- import { Benefits } from './benefits/benefits';
11
- import * as API from './index';
3
+ import { APIResource } from '../../resource.js';
4
+ import { CompanyResource } from './company.js';
5
+ import { Directory } from './directory.js';
6
+ import { Individuals } from './individuals.js';
7
+ import { Employments } from './employments.js';
8
+ import { Payments } from './payments.js';
9
+ import { PayStatements } from './pay-statements.js';
10
+ import { Benefits } from './benefits/benefits.js';
11
+ import * as API from './index.js';
12
12
 
13
13
  export class HRIS extends APIResource {
14
14
  company: CompanyResource = new CompanyResource(this.client);
@@ -13,24 +13,24 @@ export {
13
13
  CompanyBenefitsSinglePage,
14
14
  SupportedBenefitsSinglePage,
15
15
  Benefits,
16
- } from './benefits/index';
17
- export { Company, CompanyResource } from './company';
16
+ } from './benefits/index.js';
17
+ export { Company, CompanyResource } from './company.js';
18
18
  export {
19
19
  EmploymentData,
20
20
  EmploymentDataResponse,
21
21
  EmploymentRetrieveManyParams,
22
22
  EmploymentDataResponsesPage,
23
23
  Employments,
24
- } from './employments';
25
- export { Income, Location, Money, Paging, HRIS } from './hris';
24
+ } from './employments.js';
25
+ export { Income, Location, Money, Paging, HRIS } from './hris.js';
26
26
  export {
27
27
  Individual,
28
28
  IndividualResponse,
29
29
  IndividualRetrieveManyParams,
30
30
  IndividualResponsesPage,
31
31
  Individuals,
32
- } from './individuals';
33
- export { IndividualInDirectory, DirectoryListIndividualsParams, Directory } from './directory';
32
+ } from './individuals.js';
33
+ export { IndividualInDirectory, DirectoryListIndividualsParams, Directory } from './directory.js';
34
34
  export {
35
35
  PayStatement,
36
36
  PayStatementResponse,
@@ -38,5 +38,5 @@ export {
38
38
  PayStatementRetrieveManyParams,
39
39
  PayStatementResponsesPage,
40
40
  PayStatements,
41
- } from './pay-statements';
42
- export { Payment, PaymentListParams, PaymentsSinglePage, Payments } from './payments';
41
+ } from './pay-statements.js';
42
+ export { Payment, PaymentListParams, PaymentsSinglePage, Payments } from './payments.js';
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../core';
4
- import { APIResource } from '../../resource';
5
- import { isRequestOptions } from '../../core';
6
- import * as HRIS from './index';
7
- import * as API from './index';
8
- import { ResponsesPage } from '../../pagination';
3
+ import * as Core from '../../core.js';
4
+ import { APIResource } from '../../resource.js';
5
+ import { isRequestOptions } from '../../core.js';
6
+ import * as HRIS from './index.js';
7
+ import * as API from './index.js';
8
+ import { ResponsesPage } from '../../pagination.js';
9
9
 
10
10
  export class Individuals extends APIResource {
11
11
  /**
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../core';
4
- import { APIResource } from '../../resource';
5
- import * as HRIS from './index';
6
- import * as Benefits from './benefits/index';
7
- import * as API from './index';
8
- import { ResponsesPage } from '../../pagination';
3
+ import * as Core from '../../core.js';
4
+ import { APIResource } from '../../resource.js';
5
+ import * as HRIS from './index.js';
6
+ import * as Benefits from './benefits/index.js';
7
+ import * as API from './index.js';
8
+ import { ResponsesPage } from '../../pagination.js';
9
9
 
10
10
  export class PayStatements extends APIResource {
11
11
  /**
@@ -1,10 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../../core';
4
- import { APIResource } from '../../resource';
5
- import * as HRIS from './index';
6
- import * as API from './index';
7
- import { SinglePage } from '../../pagination';
3
+ import * as Core from '../../core.js';
4
+ import { APIResource } from '../../resource.js';
5
+ import * as HRIS from './index.js';
6
+ import * as API from './index.js';
7
+ import { SinglePage } from '../../pagination.js';
8
8
 
9
9
  export class Payments extends APIResource {
10
10
  /**
@@ -1,7 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- export {} from './top-level';
4
- export { ATS } from './ats/ats';
5
- export { DisconnectResponse, Introspection, Account } from './account';
6
- export { Income, Location, Money, Paging, HRIS } from './hris/hris';
7
- export { Provider, ProvidersSinglePage, Providers } from './providers';
3
+ export {} from './top-level.js';
4
+ export { ATS } from './ats/ats.js';
5
+ export { DisconnectResponse, Introspection, Account } from './account.js';
6
+ export { Income, Location, Money, Paging, HRIS } from './hris/hris.js';
7
+ export { Provider, ProvidersSinglePage, Providers } from './providers.js';
8
+ export { Webhooks } from './webhooks.js';
@@ -1,9 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from '../core';
4
- import { APIResource } from '../resource';
5
- import * as API from './index';
6
- import { SinglePage } from '../pagination';
3
+ import * as Core from '../core.js';
4
+ import { APIResource } from '../resource.js';
5
+ import * as API from './index.js';
6
+ import { SinglePage } from '../pagination.js';
7
7
 
8
8
  export class Providers extends APIResource {
9
9
  /**
@@ -0,0 +1,151 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import { APIResource } from '../resource.js';
4
+ import { createHmac } from 'crypto';
5
+ import { getHeader, HeadersLike } from '../core.js';
6
+
7
+ export class Webhooks extends APIResource {
8
+ /**
9
+ * Validates that the given payload was sent by Finch and parses the payload.
10
+ */
11
+ unwrap(
12
+ payload: string,
13
+ headers: HeadersLike,
14
+ secret: string | undefined | null = this.client.webhookSecret,
15
+ ): Object {
16
+ this.verifySignature(payload, headers, secret);
17
+ return JSON.parse(payload);
18
+ }
19
+
20
+ private parseSecret(secret: string | null | undefined): Uint8Array {
21
+ if (!secret) {
22
+ throw new Error(
23
+ "The webhook secret must either be set using the env var, FINCH_WEBHOOK_SECRET, on the client class, Finch({ webhook_secret: '123' }), or passed to this function",
24
+ );
25
+ }
26
+
27
+ const buf = Buffer.from(secret, 'base64');
28
+ if (buf.toString('base64') !== secret) {
29
+ throw new Error(`Given secret is not valid`);
30
+ }
31
+
32
+ return new Uint8Array(buf);
33
+ }
34
+
35
+ private signPayload(
36
+ payload: string,
37
+ { eventId, timestamp, secret }: { eventId: string; timestamp: Date; secret: Uint8Array },
38
+ ) {
39
+ const encoder = new TextEncoder();
40
+ const toSign = encoder.encode(`${eventId}.${timestamp.getTime() / 1000}.${payload}`);
41
+
42
+ const hmac = createHmac('sha256', secret);
43
+ hmac.update(toSign);
44
+
45
+ return `v1,${hmac.digest('base64')}`;
46
+ }
47
+
48
+ /** Make an assertion, if not `true`, then throw. */
49
+ private assert(expr: unknown, msg = ''): asserts expr {
50
+ if (!expr) {
51
+ throw new Error(msg);
52
+ }
53
+ }
54
+
55
+ /** Compare to array buffers or data views in a way that timing based attacks
56
+ * cannot gain information about the platform. */
57
+ private timingSafeEqual(
58
+ a: ArrayBufferView | ArrayBufferLike | DataView,
59
+ b: ArrayBufferView | ArrayBufferLike | DataView,
60
+ ): boolean {
61
+ if (a.byteLength !== b.byteLength) {
62
+ return false;
63
+ }
64
+ if (!(a instanceof DataView)) {
65
+ a = new DataView(ArrayBuffer.isView(a) ? a.buffer : a);
66
+ }
67
+ if (!(b instanceof DataView)) {
68
+ b = new DataView(ArrayBuffer.isView(b) ? b.buffer : b);
69
+ }
70
+ this.assert(a instanceof DataView);
71
+ this.assert(b instanceof DataView);
72
+ const length = a.byteLength;
73
+ let out = 0;
74
+ let i = -1;
75
+ while (++i < length) {
76
+ out |= a.getUint8(i) ^ b.getUint8(i);
77
+ }
78
+ return out === 0;
79
+ }
80
+
81
+ /**
82
+ * Validates whether or not the webhook payload was sent by Finch.
83
+ *
84
+ * An error will be raised if the webhook payload was not sent by Finch.
85
+ */
86
+ verifySignature(
87
+ body: string,
88
+ headers: HeadersLike,
89
+ secret: string | undefined | null = this.client.webhookSecret,
90
+ ): void {
91
+ const parsedSecret = this.parseSecret(secret);
92
+
93
+ const eventId = getHeader(headers, 'finch-event-id');
94
+ if (!eventId) {
95
+ throw new Error('Could not find finch-event-id header');
96
+ }
97
+
98
+ const msgTimestamp = getHeader(headers, 'finch-timestamp');
99
+ if (!msgTimestamp) {
100
+ throw new Error('Could not find finch-timestamp header');
101
+ }
102
+
103
+ const msgSignature = getHeader(headers, 'finch-signature');
104
+ if (!msgSignature) {
105
+ throw new Error('Could not find finch-signature header');
106
+ }
107
+
108
+ const now = Math.floor(Date.now() / 1000);
109
+ const timestampSeconds = parseInt(msgTimestamp, 10);
110
+ if (isNaN(timestampSeconds)) {
111
+ throw new Error(`Invalid timestamp header: ${msgTimestamp}`);
112
+ }
113
+
114
+ if (typeof body !== 'string') {
115
+ throw new Error(
116
+ 'Webhook body must be passed as the raw JSON string sent from the server (do not parse it first).',
117
+ );
118
+ }
119
+
120
+ const webhook_tolerance_in_seconds = 5 * 60; // 5 minutes
121
+ if (now - timestampSeconds > webhook_tolerance_in_seconds) {
122
+ throw new Error('Webhook timestamp is too old');
123
+ }
124
+
125
+ if (timestampSeconds > now + webhook_tolerance_in_seconds) {
126
+ throw new Error('Webhook timestamp is too new');
127
+ }
128
+
129
+ const timestamp = new Date(timestampSeconds * 1000);
130
+
131
+ const computedSignature = this.signPayload(body, { eventId, timestamp, secret: parsedSecret });
132
+ const expectedSignature = computedSignature.split(',')[1];
133
+
134
+ const passedSignatures = msgSignature.split(' ');
135
+
136
+ const encoder = new globalThis.TextEncoder();
137
+ for (const versionedSignature of passedSignatures) {
138
+ const [version, signature] = versionedSignature.split(',');
139
+ if (version !== 'v1') {
140
+ continue;
141
+ }
142
+
143
+ if (this.timingSafeEqual(encoder.encode(signature), encoder.encode(expectedSignature))) {
144
+ // valid!
145
+ return;
146
+ }
147
+ }
148
+
149
+ throw new Error('None of the given webhook signatures match the expected signature');
150
+ }
151
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ // this config is included in the published src directory to prevent TS errors
3
+ // from appearing when users go to source, and VSCode opens the source .ts file
4
+ // via declaration maps
5
+ "include": ["index.ts"],
6
+ "compilerOptions": {
7
+ "target": "es2015",
8
+ "lib": ["DOM"],
9
+ "moduleResolution": "node"
10
+ }
11
+ }
package/src/uploads.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { type RequestOptions } from './core';
2
- import { type Readable } from './_shims/node-readable';
1
+ import { type RequestOptions } from './core.js';
2
+ import { type Readable } from './_shims/node-readable.js';
3
3
  import { type BodyInit } from './_shims/fetch.js';
4
- import { FormData, File, type Blob, type FilePropertyBag } from './_shims/formdata.js';
5
- import { getMultipartRequestOptions } from './_shims/getMultipartRequestOptions';
6
- import { fileFromPath } from './_shims/fileFromPath';
7
- import { type FsReadStream, isFsReadStream } from './_shims/node-readable';
4
+ import { FormData, File, type Blob, type FilePropertyBag } from './_shims/form-data.js';
5
+ import { getMultipartRequestOptions } from './_shims/getMultipartRequestOptions.js';
6
+ import { fileFromPath } from './_shims/fileFromPath.js';
7
+ import { type FsReadStream, isFsReadStream } from './_shims/node-readable.js';
8
8
 
9
9
  export { fileFromPath };
10
10
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '5.0.0'; // x-release-please-version
1
+ export const VERSION = '5.1.0'; // x-release-please-version
package/uploads.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type RequestOptions } from './core.js';
2
2
  import { type Readable } from '@tryfinch/finch-api/_shims/node-readable';
3
3
  import { type BodyInit } from '@tryfinch/finch-api/_shims/fetch';
4
- import { FormData, type Blob, type FilePropertyBag } from '@tryfinch/finch-api/_shims/formdata';
4
+ import { FormData, type Blob, type FilePropertyBag } from '@tryfinch/finch-api/_shims/form-data';
5
5
  import { fileFromPath } from '@tryfinch/finch-api/_shims/fileFromPath';
6
6
  import { type FsReadStream } from '@tryfinch/finch-api/_shims/node-readable';
7
7
  export { fileFromPath };
package/uploads.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ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,MAAM,YAAY,UAAW,GAAG,wBAEtC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;AAEnG;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAC1B,KAAK,EAAE,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,EAC7C,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,OAAO,GAAE,eAAe,GAAG,SAAc,GACxC,OAAO,CAAC,QAAQ,CAAC,CAuBnB;AAoDD,qBAAa,aAAa;IACL,IAAI,EAAE,QAAQ,GAAG,QAAQ;gBAAzB,IAAI,EAAE,QAAQ,GAAG,QAAQ;IAC5C,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;CACF;AAED,eAAO,MAAM,eAAe,SAAU,GAAG,0BACsD,CAAC;AAEhG;;;GAGG;AACH,eAAO,MAAM,gCAAgC,iHAO5C,CAAC;AAEF,eAAO,MAAM,2BAA2B,iHAKvC,CAAC;AAEF,eAAO,MAAM,UAAU,wDAA6D,QAAQ,QAAQ,CAInG,CAAC"}
package/uploads.js CHANGED
@@ -12,7 +12,7 @@ exports.createForm =
12
12
  exports.isResponseLike =
13
13
  exports.fileFromPath =
14
14
  void 0;
15
- const formdata_1 = require('@tryfinch/finch-api/_shims/formdata');
15
+ const form_data_1 = require('@tryfinch/finch-api/_shims/form-data');
16
16
  const getMultipartRequestOptions_1 = require('@tryfinch/finch-api/_shims/getMultipartRequestOptions');
17
17
  const fileFromPath_1 = require('@tryfinch/finch-api/_shims/fileFromPath');
18
18
  Object.defineProperty(exports, 'fileFromPath', {
@@ -76,7 +76,7 @@ async function toFile(value, name, options = {}) {
76
76
  (_a = new URL(value.url).pathname.split(/[\\/]/).pop()) !== null && _a !== void 0 ?
77
77
  _a
78
78
  : 'unknown_file');
79
- return new formdata_1.File([blob], name, options);
79
+ return new form_data_1.File([blob], name, options);
80
80
  }
81
81
  const bits = await getBytes(value);
82
82
  name || (name = (_b = getName(value)) !== null && _b !== void 0 ? _b : 'unknown_file');
@@ -86,7 +86,7 @@ async function toFile(value, name, options = {}) {
86
86
  options = { ...options, type };
87
87
  }
88
88
  }
89
- return new formdata_1.File(bits, name, options);
89
+ return new form_data_1.File(bits, name, options);
90
90
  }
91
91
  exports.toFile = toFile;
92
92
  async function getBytes(value) {
@@ -165,7 +165,7 @@ const multipartFormRequestOptions = async (opts) => {
165
165
  };
166
166
  exports.multipartFormRequestOptions = multipartFormRequestOptions;
167
167
  const createForm = async (body) => {
168
- const form = new formdata_1.FormData();
168
+ const form = new form_data_1.FormData();
169
169
  await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
170
170
  return form;
171
171
  };