@tryfinch/finch-api 5.4.1 → 5.5.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.
- package/CHANGELOG.md +41 -0
- package/README.md +16 -19
- package/_shims/auto/types.d.ts +3 -1
- package/_shims/index.d.ts +2 -0
- package/_shims/node-runtime.d.ts.map +1 -1
- package/_shims/node-runtime.js +5 -2
- package/_shims/node-runtime.js.map +1 -1
- package/_shims/node-runtime.mjs +4 -2
- package/_shims/node-runtime.mjs.map +1 -1
- package/_shims/node-types.d.ts +1 -1
- package/_shims/registry.d.ts +2 -0
- package/_shims/registry.d.ts.map +1 -1
- package/_shims/registry.js +3 -1
- package/_shims/registry.js.map +1 -1
- package/_shims/registry.mjs +2 -0
- package/_shims/registry.mjs.map +1 -1
- package/_shims/web-runtime.d.ts.map +1 -1
- package/_shims/web-runtime.js +8 -0
- package/_shims/web-runtime.js.map +1 -1
- package/_shims/web-runtime.mjs +8 -0
- package/_shims/web-runtime.mjs.map +1 -1
- package/_shims/web-types.d.ts +2 -1
- package/core.d.ts +1 -1
- package/core.d.ts.map +1 -1
- package/core.js +43 -34
- package/core.js.map +1 -1
- package/core.mjs +41 -32
- package/core.mjs.map +1 -1
- package/error.d.ts.map +1 -1
- package/error.js +15 -5
- package/error.js.map +1 -1
- package/error.mjs +15 -5
- package/error.mjs.map +1 -1
- package/index.d.mts +19 -13
- package/index.d.ts +19 -13
- package/index.d.ts.map +1 -1
- package/index.js +8 -10
- package/index.js.map +1 -1
- package/index.mjs +8 -10
- package/index.mjs.map +1 -1
- package/package.json +4 -2
- package/pagination.d.ts +8 -7
- package/pagination.d.ts.map +1 -1
- package/pagination.js.map +1 -1
- package/pagination.mjs.map +1 -1
- package/resources/account.d.ts +3 -3
- package/resources/account.d.ts.map +1 -1
- package/resources/hris/benefits/benefits.d.ts +41 -36
- package/resources/hris/benefits/benefits.d.ts.map +1 -1
- package/resources/hris/benefits/benefits.js +9 -7
- package/resources/hris/benefits/benefits.js.map +1 -1
- package/resources/hris/benefits/benefits.mjs +9 -7
- package/resources/hris/benefits/benefits.mjs.map +1 -1
- package/resources/hris/benefits/index.d.ts +1 -1
- package/resources/hris/benefits/index.d.ts.map +1 -1
- package/resources/hris/benefits/index.js.map +1 -1
- package/resources/hris/benefits/index.mjs.map +1 -1
- package/resources/hris/benefits/individuals.d.ts +14 -18
- package/resources/hris/benefits/individuals.d.ts.map +1 -1
- package/resources/hris/benefits/individuals.js +27 -0
- package/resources/hris/benefits/individuals.js.map +1 -1
- package/resources/hris/benefits/individuals.mjs +4 -0
- package/resources/hris/benefits/individuals.mjs.map +1 -1
- package/resources/hris/company.d.ts +4 -4
- package/resources/hris/company.d.ts.map +1 -1
- package/resources/hris/directory.d.ts +16 -6
- package/resources/hris/directory.d.ts.map +1 -1
- package/resources/hris/directory.js +9 -2
- package/resources/hris/directory.js.map +1 -1
- package/resources/hris/directory.mjs +9 -2
- package/resources/hris/directory.mjs.map +1 -1
- package/resources/hris/employments.d.ts +9 -11
- package/resources/hris/employments.d.ts.map +1 -1
- package/resources/hris/employments.js +25 -0
- package/resources/hris/employments.js.map +1 -1
- package/resources/hris/employments.mjs +2 -0
- package/resources/hris/employments.mjs.map +1 -1
- package/resources/hris/hris.d.ts +61 -56
- package/resources/hris/hris.d.ts.map +1 -1
- package/resources/hris/hris.js +27 -28
- package/resources/hris/hris.js.map +1 -1
- package/resources/hris/hris.mjs +27 -28
- package/resources/hris/hris.mjs.map +1 -1
- package/resources/hris/index.d.ts +2 -2
- package/resources/hris/index.d.ts.map +1 -1
- package/resources/hris/index.js.map +1 -1
- package/resources/hris/index.mjs +1 -1
- package/resources/hris/index.mjs.map +1 -1
- package/resources/hris/individuals.d.ts +7 -9
- package/resources/hris/individuals.d.ts.map +1 -1
- package/resources/hris/individuals.js +25 -0
- package/resources/hris/individuals.js.map +1 -1
- package/resources/hris/individuals.mjs +2 -0
- package/resources/hris/individuals.mjs.map +1 -1
- package/resources/hris/pay-statements.d.ts +13 -15
- package/resources/hris/pay-statements.d.ts.map +1 -1
- package/resources/hris/pay-statements.js +25 -0
- package/resources/hris/pay-statements.js.map +1 -1
- package/resources/hris/pay-statements.mjs +2 -0
- package/resources/hris/pay-statements.mjs.map +1 -1
- package/resources/hris/payments.d.ts +10 -12
- package/resources/hris/payments.d.ts.map +1 -1
- package/resources/hris/payments.js +25 -0
- package/resources/hris/payments.js.map +1 -1
- package/resources/hris/payments.mjs +2 -0
- package/resources/hris/payments.mjs.map +1 -1
- package/resources/providers.d.ts +3 -5
- package/resources/providers.d.ts.map +1 -1
- package/resources/providers.js +25 -0
- package/resources/providers.js.map +1 -1
- package/resources/providers.mjs +2 -0
- package/resources/providers.mjs.map +1 -1
- package/resources/request-forwarding.d.ts +3 -3
- package/resources/request-forwarding.d.ts.map +1 -1
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js +3 -12
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs +4 -13
- package/resources/webhooks.mjs.map +1 -1
- package/shims/node.d.ts +1 -1
- package/shims/node.d.ts.map +1 -1
- package/shims/web.d.ts +1 -1
- package/shims/web.d.ts.map +1 -1
- package/src/_shims/auto/types.d.ts +3 -1
- package/src/_shims/index.d.ts +2 -0
- package/src/_shims/node-runtime.ts +6 -2
- package/src/_shims/node-types.d.ts +1 -1
- package/src/_shims/registry.ts +3 -0
- package/src/_shims/web-runtime.ts +12 -0
- package/src/_shims/web-types.d.ts +2 -1
- package/src/core.ts +26 -9
- package/src/error.ts +15 -5
- package/src/index.ts +22 -16
- package/src/pagination.ts +8 -7
- package/src/resources/account.ts +3 -3
- package/src/resources/hris/benefits/benefits.ts +47 -43
- package/src/resources/hris/benefits/index.ts +1 -0
- package/src/resources/hris/benefits/individuals.ts +14 -20
- package/src/resources/hris/company.ts +4 -4
- package/src/resources/hris/directory.ts +18 -10
- package/src/resources/hris/employments.ts +9 -11
- package/src/resources/hris/hris.ts +61 -63
- package/src/resources/hris/index.ts +7 -1
- package/src/resources/hris/individuals.ts +7 -9
- package/src/resources/hris/pay-statements.ts +13 -15
- package/src/resources/hris/payments.ts +10 -12
- package/src/resources/providers.ts +3 -5
- package/src/resources/request-forwarding.ts +3 -3
- package/src/resources/webhooks.ts +4 -15
- package/src/shims/node.ts +1 -1
- package/src/shims/web.ts +1 -1
- package/src/version.ts +1 -1
- package/uploads.js +5 -9
- package/uploads.js.map +1 -1
- package/uploads.mjs +5 -9
- package/uploads.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Core from "../../ch/finch-api/core";
|
|
4
4
|
import { APIResource } from "../../ch/finch-api/resource";
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
5
|
+
import * as EmploymentsAPI from "../../ch/finch-api/resources/hris/employments";
|
|
6
|
+
import * as HRISAPI from "../../ch/finch-api/resources/hris/hris";
|
|
7
7
|
import { ResponsesPage } from "../../ch/finch-api/pagination";
|
|
8
8
|
|
|
9
9
|
export class Employments extends APIResource {
|
|
@@ -27,8 +27,6 @@ export class Employments extends APIResource {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export class EmploymentDataResponsesPage extends ResponsesPage<EmploymentDataResponse> {}
|
|
30
|
-
// alias so we can export it in the namespace
|
|
31
|
-
type _EmploymentDataResponsesPage = EmploymentDataResponsesPage;
|
|
32
30
|
|
|
33
31
|
export interface EmploymentData {
|
|
34
32
|
/**
|
|
@@ -63,12 +61,12 @@ export interface EmploymentData {
|
|
|
63
61
|
* annualized income, but may be in units of bi-weekly, semi-monthly, daily, etc,
|
|
64
62
|
* depending on what information the provider returns.
|
|
65
63
|
*/
|
|
66
|
-
income?:
|
|
64
|
+
income?: HRISAPI.Income | null;
|
|
67
65
|
|
|
68
66
|
/**
|
|
69
67
|
* The array of income history.
|
|
70
68
|
*/
|
|
71
|
-
income_history?: Array<
|
|
69
|
+
income_history?: Array<HRISAPI.Income | null> | null;
|
|
72
70
|
|
|
73
71
|
/**
|
|
74
72
|
* `true` if the individual an an active employee or contractor at the company.
|
|
@@ -80,7 +78,7 @@ export interface EmploymentData {
|
|
|
80
78
|
*/
|
|
81
79
|
last_name?: string | null;
|
|
82
80
|
|
|
83
|
-
location?:
|
|
81
|
+
location?: HRISAPI.Location | null;
|
|
84
82
|
|
|
85
83
|
/**
|
|
86
84
|
* The manager object representing the manager of the individual within the org.
|
|
@@ -187,8 +185,8 @@ export namespace EmploymentRetrieveManyParams {
|
|
|
187
185
|
}
|
|
188
186
|
|
|
189
187
|
export namespace Employments {
|
|
190
|
-
export import EmploymentData =
|
|
191
|
-
export import EmploymentDataResponse =
|
|
192
|
-
export
|
|
193
|
-
export import EmploymentRetrieveManyParams =
|
|
188
|
+
export import EmploymentData = EmploymentsAPI.EmploymentData;
|
|
189
|
+
export import EmploymentDataResponse = EmploymentsAPI.EmploymentDataResponse;
|
|
190
|
+
export import EmploymentDataResponsesPage = EmploymentsAPI.EmploymentDataResponsesPage;
|
|
191
|
+
export import EmploymentRetrieveManyParams = EmploymentsAPI.EmploymentRetrieveManyParams;
|
|
194
192
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from "../../ch/finch-api/resource";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import * as
|
|
4
|
+
import * as HRISAPI from "../../ch/finch-api/resources/hris/hris";
|
|
5
|
+
import * as CompanyAPI from "../../ch/finch-api/resources/hris/company";
|
|
6
|
+
import * as DirectoryAPI from "../../ch/finch-api/resources/hris/directory";
|
|
7
|
+
import * as EmploymentsAPI from "../../ch/finch-api/resources/hris/employments";
|
|
8
|
+
import * as IndividualsAPI from "../../ch/finch-api/resources/hris/individuals";
|
|
9
|
+
import * as PayStatementsAPI from "../../ch/finch-api/resources/hris/pay-statements";
|
|
10
|
+
import * as PaymentsAPI from "../../ch/finch-api/resources/hris/payments";
|
|
11
|
+
import * as BenefitsAPI from "../../ch/finch-api/resources/hris/benefits/benefits";
|
|
12
12
|
|
|
13
13
|
export class HRIS extends APIResource {
|
|
14
|
-
company: CompanyResource = new CompanyResource(this.client);
|
|
15
|
-
directory: Directory = new Directory(this.client);
|
|
16
|
-
individuals: Individuals = new Individuals(this.client);
|
|
17
|
-
employments: Employments = new Employments(this.client);
|
|
18
|
-
payments: Payments = new Payments(this.client);
|
|
19
|
-
payStatements: PayStatements = new PayStatements(this.client);
|
|
20
|
-
benefits: Benefits = new Benefits(this.client);
|
|
14
|
+
company: CompanyAPI.CompanyResource = new CompanyAPI.CompanyResource(this.client);
|
|
15
|
+
directory: DirectoryAPI.Directory = new DirectoryAPI.Directory(this.client);
|
|
16
|
+
individuals: IndividualsAPI.Individuals = new IndividualsAPI.Individuals(this.client);
|
|
17
|
+
employments: EmploymentsAPI.Employments = new EmploymentsAPI.Employments(this.client);
|
|
18
|
+
payments: PaymentsAPI.Payments = new PaymentsAPI.Payments(this.client);
|
|
19
|
+
payStatements: PayStatementsAPI.PayStatements = new PayStatementsAPI.PayStatements(this.client);
|
|
20
|
+
benefits: BenefitsAPI.Benefits = new BenefitsAPI.Benefits(this.client);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -116,52 +116,50 @@ export interface Paging {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
export namespace HRIS {
|
|
119
|
-
export import Income =
|
|
120
|
-
export import Location =
|
|
121
|
-
export import Money =
|
|
122
|
-
export import Paging =
|
|
123
|
-
|
|
124
|
-
export import
|
|
125
|
-
export import
|
|
126
|
-
|
|
127
|
-
export import
|
|
128
|
-
export import
|
|
129
|
-
export import
|
|
130
|
-
|
|
131
|
-
export import
|
|
132
|
-
export import
|
|
133
|
-
export import
|
|
134
|
-
export import
|
|
135
|
-
export import
|
|
136
|
-
|
|
137
|
-
export import
|
|
138
|
-
export import
|
|
139
|
-
export import
|
|
140
|
-
export import
|
|
141
|
-
export import
|
|
142
|
-
|
|
143
|
-
export import
|
|
144
|
-
export import
|
|
145
|
-
export import
|
|
146
|
-
export import
|
|
147
|
-
|
|
148
|
-
export import
|
|
149
|
-
export import
|
|
150
|
-
export import
|
|
151
|
-
export import
|
|
152
|
-
export import
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
export import
|
|
157
|
-
export import
|
|
158
|
-
export import
|
|
159
|
-
export import
|
|
160
|
-
export import
|
|
161
|
-
export import
|
|
162
|
-
export import
|
|
163
|
-
export import
|
|
164
|
-
export import
|
|
165
|
-
export import BenefitCreateParams = API.BenefitCreateParams;
|
|
166
|
-
export import BenefitUpdateParams = API.BenefitUpdateParams;
|
|
119
|
+
export import Income = HRISAPI.Income;
|
|
120
|
+
export import Location = HRISAPI.Location;
|
|
121
|
+
export import Money = HRISAPI.Money;
|
|
122
|
+
export import Paging = HRISAPI.Paging;
|
|
123
|
+
export import CompanyResource = CompanyAPI.CompanyResource;
|
|
124
|
+
export import Company = CompanyAPI.Company;
|
|
125
|
+
export import Directory = DirectoryAPI.Directory;
|
|
126
|
+
export import IndividualInDirectory = DirectoryAPI.IndividualInDirectory;
|
|
127
|
+
export import DirectoryListParams = DirectoryAPI.DirectoryListParams;
|
|
128
|
+
export import DirectoryListIndividualsParams = DirectoryAPI.DirectoryListIndividualsParams;
|
|
129
|
+
export import Individuals = IndividualsAPI.Individuals;
|
|
130
|
+
export import Individual = IndividualsAPI.Individual;
|
|
131
|
+
export import IndividualResponse = IndividualsAPI.IndividualResponse;
|
|
132
|
+
export import IndividualResponsesPage = IndividualsAPI.IndividualResponsesPage;
|
|
133
|
+
export import IndividualRetrieveManyParams = IndividualsAPI.IndividualRetrieveManyParams;
|
|
134
|
+
export import Employments = EmploymentsAPI.Employments;
|
|
135
|
+
export import EmploymentData = EmploymentsAPI.EmploymentData;
|
|
136
|
+
export import EmploymentDataResponse = EmploymentsAPI.EmploymentDataResponse;
|
|
137
|
+
export import EmploymentDataResponsesPage = EmploymentsAPI.EmploymentDataResponsesPage;
|
|
138
|
+
export import EmploymentRetrieveManyParams = EmploymentsAPI.EmploymentRetrieveManyParams;
|
|
139
|
+
export import Payments = PaymentsAPI.Payments;
|
|
140
|
+
export import Payment = PaymentsAPI.Payment;
|
|
141
|
+
export import PaymentsSinglePage = PaymentsAPI.PaymentsSinglePage;
|
|
142
|
+
export import PaymentListParams = PaymentsAPI.PaymentListParams;
|
|
143
|
+
export import PayStatements = PayStatementsAPI.PayStatements;
|
|
144
|
+
export import PayStatement = PayStatementsAPI.PayStatement;
|
|
145
|
+
export import PayStatementResponse = PayStatementsAPI.PayStatementResponse;
|
|
146
|
+
export import PayStatementResponseBody = PayStatementsAPI.PayStatementResponseBody;
|
|
147
|
+
export import PayStatementResponsesPage = PayStatementsAPI.PayStatementResponsesPage;
|
|
148
|
+
export import PayStatementRetrieveManyParams = PayStatementsAPI.PayStatementRetrieveManyParams;
|
|
149
|
+
export import Benefits = BenefitsAPI.Benefits;
|
|
150
|
+
export import BenefitContribution = BenefitsAPI.BenefitContribution;
|
|
151
|
+
export import BenefitFrequency = BenefitsAPI.BenefitFrequency;
|
|
152
|
+
export import BenefitType = BenefitsAPI.BenefitType;
|
|
153
|
+
/**
|
|
154
|
+
* @deprecated use `BenefitContribution` instead
|
|
155
|
+
*/
|
|
156
|
+
export import BenfitContribution = BenefitsAPI.BenfitContribution;
|
|
157
|
+
export import CompanyBenefit = BenefitsAPI.CompanyBenefit;
|
|
158
|
+
export import CreateCompanyBenefitsResponse = BenefitsAPI.CreateCompanyBenefitsResponse;
|
|
159
|
+
export import SupportedBenefit = BenefitsAPI.SupportedBenefit;
|
|
160
|
+
export import UpdateCompanyBenefitResponse = BenefitsAPI.UpdateCompanyBenefitResponse;
|
|
161
|
+
export import CompanyBenefitsSinglePage = BenefitsAPI.CompanyBenefitsSinglePage;
|
|
162
|
+
export import SupportedBenefitsSinglePage = BenefitsAPI.SupportedBenefitsSinglePage;
|
|
163
|
+
export import BenefitCreateParams = BenefitsAPI.BenefitCreateParams;
|
|
164
|
+
export import BenefitUpdateParams = BenefitsAPI.BenefitUpdateParams;
|
|
167
165
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
|
+
BenefitContribution,
|
|
4
5
|
BenefitFrequency,
|
|
5
6
|
BenefitType,
|
|
6
7
|
BenfitContribution,
|
|
@@ -30,7 +31,12 @@ export {
|
|
|
30
31
|
IndividualResponsesPage,
|
|
31
32
|
Individuals,
|
|
32
33
|
} from './individuals';
|
|
33
|
-
export {
|
|
34
|
+
export {
|
|
35
|
+
IndividualInDirectory,
|
|
36
|
+
DirectoryListParams,
|
|
37
|
+
DirectoryListIndividualsParams,
|
|
38
|
+
Directory,
|
|
39
|
+
} from './directory';
|
|
34
40
|
export {
|
|
35
41
|
PayStatement,
|
|
36
42
|
PayStatementResponse,
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import * as Core from "../../ch/finch-api/core";
|
|
4
4
|
import { APIResource } from "../../ch/finch-api/resource";
|
|
5
5
|
import { isRequestOptions } from "../../ch/finch-api/core";
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
6
|
+
import * as IndividualsAPI from "../../ch/finch-api/resources/hris/individuals";
|
|
7
|
+
import * as HRISAPI from "../../ch/finch-api/resources/hris/hris";
|
|
8
8
|
import { ResponsesPage } from "../../ch/finch-api/pagination";
|
|
9
9
|
|
|
10
10
|
export class Individuals extends APIResource {
|
|
@@ -32,8 +32,6 @@ export class Individuals extends APIResource {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export class IndividualResponsesPage extends ResponsesPage<IndividualResponse> {}
|
|
35
|
-
// alias so we can export it in the namespace
|
|
36
|
-
type _IndividualResponsesPage = IndividualResponsesPage;
|
|
37
35
|
|
|
38
36
|
export interface Individual {
|
|
39
37
|
/**
|
|
@@ -72,7 +70,7 @@ export interface Individual {
|
|
|
72
70
|
*/
|
|
73
71
|
preferred_name?: string | null;
|
|
74
72
|
|
|
75
|
-
residence?:
|
|
73
|
+
residence?: HRISAPI.Location | null;
|
|
76
74
|
|
|
77
75
|
/**
|
|
78
76
|
* Note: This property is only available if enabled for your account. Please reach
|
|
@@ -120,8 +118,8 @@ export namespace IndividualRetrieveManyParams {
|
|
|
120
118
|
}
|
|
121
119
|
|
|
122
120
|
export namespace Individuals {
|
|
123
|
-
export import Individual =
|
|
124
|
-
export import IndividualResponse =
|
|
125
|
-
export
|
|
126
|
-
export import IndividualRetrieveManyParams =
|
|
121
|
+
export import Individual = IndividualsAPI.Individual;
|
|
122
|
+
export import IndividualResponse = IndividualsAPI.IndividualResponse;
|
|
123
|
+
export import IndividualResponsesPage = IndividualsAPI.IndividualResponsesPage;
|
|
124
|
+
export import IndividualRetrieveManyParams = IndividualsAPI.IndividualRetrieveManyParams;
|
|
127
125
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Core from "../../ch/finch-api/core";
|
|
4
4
|
import { APIResource } from "../../ch/finch-api/resource";
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
5
|
+
import * as PayStatementsAPI from "../../ch/finch-api/resources/hris/pay-statements";
|
|
6
|
+
import * as HRISAPI from "../../ch/finch-api/resources/hris/hris";
|
|
7
|
+
import * as BenefitsAPI from "../../ch/finch-api/resources/hris/benefits/benefits";
|
|
8
8
|
import { ResponsesPage } from "../../ch/finch-api/pagination";
|
|
9
9
|
|
|
10
10
|
export class PayStatements extends APIResource {
|
|
@@ -27,8 +27,6 @@ export class PayStatements extends APIResource {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export class PayStatementResponsesPage extends ResponsesPage<PayStatementResponse> {}
|
|
30
|
-
// alias so we can export it in the namespace
|
|
31
|
-
type _PayStatementResponsesPage = PayStatementResponsesPage;
|
|
32
30
|
|
|
33
31
|
export interface PayStatement {
|
|
34
32
|
/**
|
|
@@ -43,14 +41,14 @@ export interface PayStatement {
|
|
|
43
41
|
|
|
44
42
|
employer_contributions?: Array<PayStatement.EmployerContribution | null> | null;
|
|
45
43
|
|
|
46
|
-
gross_pay?:
|
|
44
|
+
gross_pay?: HRISAPI.Money | null;
|
|
47
45
|
|
|
48
46
|
/**
|
|
49
47
|
* A stable Finch `id` (UUID v4) for an individual in the company
|
|
50
48
|
*/
|
|
51
49
|
individual_id?: string;
|
|
52
50
|
|
|
53
|
-
net_pay?:
|
|
51
|
+
net_pay?: HRISAPI.Money | null;
|
|
54
52
|
|
|
55
53
|
/**
|
|
56
54
|
* The payment method.
|
|
@@ -140,7 +138,7 @@ export namespace PayStatement {
|
|
|
140
138
|
/**
|
|
141
139
|
* Type of benefit.
|
|
142
140
|
*/
|
|
143
|
-
type?:
|
|
141
|
+
type?: BenefitsAPI.BenefitType | null;
|
|
144
142
|
}
|
|
145
143
|
|
|
146
144
|
export interface EmployerContribution {
|
|
@@ -162,7 +160,7 @@ export namespace PayStatement {
|
|
|
162
160
|
/**
|
|
163
161
|
* Type of benefit.
|
|
164
162
|
*/
|
|
165
|
-
type?:
|
|
163
|
+
type?: BenefitsAPI.BenefitType | null;
|
|
166
164
|
}
|
|
167
165
|
|
|
168
166
|
export interface Tax {
|
|
@@ -202,7 +200,7 @@ export interface PayStatementResponse {
|
|
|
202
200
|
}
|
|
203
201
|
|
|
204
202
|
export interface PayStatementResponseBody {
|
|
205
|
-
paging?:
|
|
203
|
+
paging?: HRISAPI.Paging;
|
|
206
204
|
|
|
207
205
|
/**
|
|
208
206
|
* The array of pay statements for the current payment.
|
|
@@ -237,9 +235,9 @@ export namespace PayStatementRetrieveManyParams {
|
|
|
237
235
|
}
|
|
238
236
|
|
|
239
237
|
export namespace PayStatements {
|
|
240
|
-
export import PayStatement =
|
|
241
|
-
export import PayStatementResponse =
|
|
242
|
-
export import PayStatementResponseBody =
|
|
243
|
-
export
|
|
244
|
-
export import PayStatementRetrieveManyParams =
|
|
238
|
+
export import PayStatement = PayStatementsAPI.PayStatement;
|
|
239
|
+
export import PayStatementResponse = PayStatementsAPI.PayStatementResponse;
|
|
240
|
+
export import PayStatementResponseBody = PayStatementsAPI.PayStatementResponseBody;
|
|
241
|
+
export import PayStatementResponsesPage = PayStatementsAPI.PayStatementResponsesPage;
|
|
242
|
+
export import PayStatementRetrieveManyParams = PayStatementsAPI.PayStatementRetrieveManyParams;
|
|
245
243
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Core from "../../ch/finch-api/core";
|
|
4
4
|
import { APIResource } from "../../ch/finch-api/resource";
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
5
|
+
import * as PaymentsAPI from "../../ch/finch-api/resources/hris/payments";
|
|
6
|
+
import * as HRISAPI from "../../ch/finch-api/resources/hris/hris";
|
|
7
7
|
import { SinglePage } from "../../ch/finch-api/pagination";
|
|
8
8
|
|
|
9
9
|
export class Payments extends APIResource {
|
|
@@ -19,8 +19,6 @@ export class Payments extends APIResource {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export class PaymentsSinglePage extends SinglePage<Payment> {}
|
|
22
|
-
// alias so we can export it in the namespace
|
|
23
|
-
type _PaymentsSinglePage = PaymentsSinglePage;
|
|
24
22
|
|
|
25
23
|
export interface Payment {
|
|
26
24
|
/**
|
|
@@ -28,22 +26,22 @@ export interface Payment {
|
|
|
28
26
|
*/
|
|
29
27
|
id?: string;
|
|
30
28
|
|
|
31
|
-
company_debit?:
|
|
29
|
+
company_debit?: HRISAPI.Money | null;
|
|
32
30
|
|
|
33
31
|
debit_date?: string | null;
|
|
34
32
|
|
|
35
|
-
employee_taxes?:
|
|
33
|
+
employee_taxes?: HRISAPI.Money | null;
|
|
36
34
|
|
|
37
|
-
employer_taxes?:
|
|
35
|
+
employer_taxes?: HRISAPI.Money | null;
|
|
38
36
|
|
|
39
|
-
gross_pay?:
|
|
37
|
+
gross_pay?: HRISAPI.Money | null;
|
|
40
38
|
|
|
41
39
|
/**
|
|
42
40
|
* Array of every individual on this payment.
|
|
43
41
|
*/
|
|
44
42
|
individual_ids?: Array<string> | null;
|
|
45
43
|
|
|
46
|
-
net_pay?:
|
|
44
|
+
net_pay?: HRISAPI.Money | null;
|
|
47
45
|
|
|
48
46
|
pay_date?: string | null;
|
|
49
47
|
|
|
@@ -79,7 +77,7 @@ export interface PaymentListParams {
|
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
export namespace Payments {
|
|
82
|
-
export import Payment =
|
|
83
|
-
export
|
|
84
|
-
export import PaymentListParams =
|
|
80
|
+
export import Payment = PaymentsAPI.Payment;
|
|
81
|
+
export import PaymentsSinglePage = PaymentsAPI.PaymentsSinglePage;
|
|
82
|
+
export import PaymentListParams = PaymentsAPI.PaymentListParams;
|
|
85
83
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Core from "../ch/finch-api/core";
|
|
4
4
|
import { APIResource } from "../ch/finch-api/resource";
|
|
5
|
-
import * as
|
|
5
|
+
import * as ProvidersAPI from "../ch/finch-api/resources/providers";
|
|
6
6
|
import { SinglePage } from "../ch/finch-api/pagination";
|
|
7
7
|
|
|
8
8
|
export class Providers extends APIResource {
|
|
@@ -15,8 +15,6 @@ export class Providers extends APIResource {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export class ProvidersSinglePage extends SinglePage<Provider> {}
|
|
18
|
-
// alias so we can export it in the namespace
|
|
19
|
-
type _ProvidersSinglePage = ProvidersSinglePage;
|
|
20
18
|
|
|
21
19
|
export interface Provider {
|
|
22
20
|
/**
|
|
@@ -62,6 +60,6 @@ export interface Provider {
|
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
export namespace Providers {
|
|
65
|
-
export import Provider =
|
|
66
|
-
export
|
|
63
|
+
export import Provider = ProvidersAPI.Provider;
|
|
64
|
+
export import ProvidersSinglePage = ProvidersAPI.ProvidersSinglePage;
|
|
67
65
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Core from "../ch/finch-api/core";
|
|
4
4
|
import { APIResource } from "../ch/finch-api/resource";
|
|
5
|
-
import * as
|
|
5
|
+
import * as RequestForwardingAPI from "../ch/finch-api/resources/request-forwarding";
|
|
6
6
|
|
|
7
7
|
export class RequestForwarding extends APIResource {
|
|
8
8
|
/**
|
|
@@ -116,6 +116,6 @@ export interface RequestForwardingForwardParams {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
export namespace RequestForwarding {
|
|
119
|
-
export import RequestForwardingForwardResponse =
|
|
120
|
-
export import RequestForwardingForwardParams =
|
|
119
|
+
export import RequestForwardingForwardResponse = RequestForwardingAPI.RequestForwardingForwardResponse;
|
|
120
|
+
export import RequestForwardingForwardParams = RequestForwardingAPI.RequestForwardingForwardParams;
|
|
121
121
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from "../ch/finch-api/resource";
|
|
4
4
|
import { createHmac } from 'crypto';
|
|
5
|
-
import {
|
|
5
|
+
import { getRequiredHeader, HeadersLike } from "../ch/finch-api/core";
|
|
6
6
|
|
|
7
7
|
export class Webhooks extends APIResource {
|
|
8
8
|
/**
|
|
@@ -90,20 +90,9 @@ export class Webhooks extends APIResource {
|
|
|
90
90
|
): void {
|
|
91
91
|
const parsedSecret = this.parseSecret(secret);
|
|
92
92
|
|
|
93
|
-
const eventId =
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
}
|
|
93
|
+
const eventId = getRequiredHeader(headers, 'finch-event-id');
|
|
94
|
+
const msgTimestamp = getRequiredHeader(headers, 'finch-timestamp');
|
|
95
|
+
const msgSignature = getRequiredHeader(headers, 'finch-signature');
|
|
107
96
|
|
|
108
97
|
const now = Math.floor(Date.now() / 1000);
|
|
109
98
|
const timestampSeconds = parseInt(msgTimestamp, 10);
|
package/src/shims/node.ts
CHANGED
package/src/shims/web.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '5.
|
|
1
|
+
export const VERSION = '5.5.0'; // x-release-please-version
|
package/uploads.js
CHANGED
|
@@ -41,18 +41,17 @@ exports.isUploadable = isUploadable;
|
|
|
41
41
|
* @returns a {@link File} with the given properties
|
|
42
42
|
*/
|
|
43
43
|
async function toFile(value, name, options = {}) {
|
|
44
|
-
var _a, _b, _c;
|
|
45
44
|
// If it's a promise, resolve it.
|
|
46
45
|
value = await value;
|
|
47
46
|
if ((0, exports.isResponseLike)(value)) {
|
|
48
47
|
const blob = await value.blob();
|
|
49
|
-
name || (name =
|
|
48
|
+
name || (name = new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file');
|
|
50
49
|
return new index_1.File([blob], name, options);
|
|
51
50
|
}
|
|
52
51
|
const bits = await getBytes(value);
|
|
53
|
-
name || (name =
|
|
52
|
+
name || (name = getName(value) ?? 'unknown_file');
|
|
54
53
|
if (!options.type) {
|
|
55
|
-
const type =
|
|
54
|
+
const type = bits[0]?.type;
|
|
56
55
|
if (typeof type === 'string') {
|
|
57
56
|
options = { ...options, type };
|
|
58
57
|
}
|
|
@@ -61,7 +60,6 @@ async function toFile(value, name, options = {}) {
|
|
|
61
60
|
}
|
|
62
61
|
exports.toFile = toFile;
|
|
63
62
|
async function getBytes(value) {
|
|
64
|
-
var _a;
|
|
65
63
|
let parts = [];
|
|
66
64
|
if (typeof value === 'string' ||
|
|
67
65
|
ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
|
|
@@ -78,7 +76,7 @@ async function getBytes(value) {
|
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
78
|
else {
|
|
81
|
-
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${
|
|
79
|
+
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`);
|
|
82
80
|
}
|
|
83
81
|
return parts;
|
|
84
82
|
}
|
|
@@ -87,12 +85,10 @@ function propsForError(value) {
|
|
|
87
85
|
return `[${props.map((p) => `"${p}"`).join(', ')}]`;
|
|
88
86
|
}
|
|
89
87
|
function getName(value) {
|
|
90
|
-
var _a;
|
|
91
88
|
return (getStringFromMaybeBuffer(value.name) ||
|
|
92
89
|
getStringFromMaybeBuffer(value.filename) ||
|
|
93
|
-
(
|
|
94
90
|
// For fs.ReadStream
|
|
95
|
-
|
|
91
|
+
getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop());
|
|
96
92
|
}
|
|
97
93
|
const getStringFromMaybeBuffer = (x) => {
|
|
98
94
|
if (typeof x === 'string')
|
package/uploads.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":";;;AACA,6CAQwB;AAExB,2CAA8C;AAArC,qGAAA,YAAY,OAAA;AAiDd,MAAM,cAAc,GAAG,CAAC,KAAU,EAAyB,EAAE,CAClE,KAAK,IAAI,IAAI;IACb,OAAO,KAAK,KAAK,QAAQ;IACzB,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;IAC7B,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AAJtB,QAAA,cAAc,kBAIQ;AAE5B,MAAM,UAAU,GAAG,CAAC,KAAU,EAAqB,EAAE,CAC1D,KAAK,IAAI,IAAI;IACb,OAAO,KAAK,KAAK,QAAQ;IAC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,GAAG,EAAE,IAAI,CAAC,CAAC,CACzF,CAAC;KACH;SAAM;QACL,MAAM,IAAI,SAAS,CACjB,wGAAwG,KAAK,UAAU,CACxH,CAAC;KACH;AACH,CAAC,CAAC"}
|
package/uploads.mjs
CHANGED
|
@@ -33,18 +33,17 @@ export const isUploadable = (value) => {
|
|
|
33
33
|
* @returns a {@link File} with the given properties
|
|
34
34
|
*/
|
|
35
35
|
export async function toFile(value, name, options = {}) {
|
|
36
|
-
var _a, _b, _c;
|
|
37
36
|
// If it's a promise, resolve it.
|
|
38
37
|
value = await value;
|
|
39
38
|
if (isResponseLike(value)) {
|
|
40
39
|
const blob = await value.blob();
|
|
41
|
-
name || (name =
|
|
40
|
+
name || (name = new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file');
|
|
42
41
|
return new File([blob], name, options);
|
|
43
42
|
}
|
|
44
43
|
const bits = await getBytes(value);
|
|
45
|
-
name || (name =
|
|
44
|
+
name || (name = getName(value) ?? 'unknown_file');
|
|
46
45
|
if (!options.type) {
|
|
47
|
-
const type =
|
|
46
|
+
const type = bits[0]?.type;
|
|
48
47
|
if (typeof type === 'string') {
|
|
49
48
|
options = { ...options, type };
|
|
50
49
|
}
|
|
@@ -52,7 +51,6 @@ export async function toFile(value, name, options = {}) {
|
|
|
52
51
|
return new File(bits, name, options);
|
|
53
52
|
}
|
|
54
53
|
async function getBytes(value) {
|
|
55
|
-
var _a;
|
|
56
54
|
let parts = [];
|
|
57
55
|
if (typeof value === 'string' ||
|
|
58
56
|
ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
|
|
@@ -69,7 +67,7 @@ async function getBytes(value) {
|
|
|
69
67
|
}
|
|
70
68
|
}
|
|
71
69
|
else {
|
|
72
|
-
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${
|
|
70
|
+
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`);
|
|
73
71
|
}
|
|
74
72
|
return parts;
|
|
75
73
|
}
|
|
@@ -78,12 +76,10 @@ function propsForError(value) {
|
|
|
78
76
|
return `[${props.map((p) => `"${p}"`).join(', ')}]`;
|
|
79
77
|
}
|
|
80
78
|
function getName(value) {
|
|
81
|
-
var _a;
|
|
82
79
|
return (getStringFromMaybeBuffer(value.name) ||
|
|
83
80
|
getStringFromMaybeBuffer(value.filename) ||
|
|
84
|
-
(
|
|
85
81
|
// For fs.ReadStream
|
|
86
|
-
|
|
82
|
+
getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop());
|
|
87
83
|
}
|
|
88
84
|
const getStringFromMaybeBuffer = (x) => {
|
|
89
85
|
if (typeof x === 'string')
|