@tryfinch/finch-api 9.0.0 → 9.8.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 (107) hide show
  1. package/CHANGELOG.md +217 -0
  2. package/README.md +2 -2
  3. package/client.d.mts +4 -3
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +4 -3
  6. package/client.d.ts.map +1 -1
  7. package/client.js +37 -10
  8. package/client.js.map +1 -1
  9. package/client.mjs +37 -10
  10. package/client.mjs.map +1 -1
  11. package/internal/parse.d.mts.map +1 -1
  12. package/internal/parse.d.ts.map +1 -1
  13. package/internal/parse.js +5 -0
  14. package/internal/parse.js.map +1 -1
  15. package/internal/parse.mjs +5 -0
  16. package/internal/parse.mjs.map +1 -1
  17. package/internal/tslib.js +17 -17
  18. package/internal/types.d.mts +6 -6
  19. package/internal/types.d.mts.map +1 -1
  20. package/internal/types.d.ts +6 -6
  21. package/internal/types.d.ts.map +1 -1
  22. package/internal/utils/env.js +2 -2
  23. package/internal/utils/env.js.map +1 -1
  24. package/internal/utils/env.mjs +2 -2
  25. package/internal/utils/env.mjs.map +1 -1
  26. package/internal/utils/log.d.mts.map +1 -1
  27. package/internal/utils/log.d.ts.map +1 -1
  28. package/internal/utils/log.js +2 -0
  29. package/internal/utils/log.js.map +1 -1
  30. package/internal/utils/log.mjs +2 -0
  31. package/internal/utils/log.mjs.map +1 -1
  32. package/internal/utils/query.d.mts +2 -0
  33. package/internal/utils/query.d.mts.map +1 -0
  34. package/internal/utils/query.d.ts +2 -0
  35. package/internal/utils/query.d.ts.map +1 -0
  36. package/internal/utils/query.js +10 -0
  37. package/internal/utils/query.js.map +1 -0
  38. package/internal/utils/query.mjs +6 -0
  39. package/internal/utils/query.mjs.map +1 -0
  40. package/internal/utils.d.mts +1 -0
  41. package/internal/utils.d.ts +1 -0
  42. package/internal/utils.js +1 -0
  43. package/internal/utils.js.map +1 -1
  44. package/internal/utils.mjs +1 -0
  45. package/package.json +12 -1
  46. package/resources/access-tokens.d.mts +5 -0
  47. package/resources/access-tokens.d.mts.map +1 -1
  48. package/resources/access-tokens.d.ts +5 -0
  49. package/resources/access-tokens.d.ts.map +1 -1
  50. package/resources/account.d.mts +4 -0
  51. package/resources/account.d.mts.map +1 -1
  52. package/resources/account.d.ts +4 -0
  53. package/resources/account.d.ts.map +1 -1
  54. package/resources/connect/sessions.d.mts +6 -2
  55. package/resources/connect/sessions.d.mts.map +1 -1
  56. package/resources/connect/sessions.d.ts +6 -2
  57. package/resources/connect/sessions.d.ts.map +1 -1
  58. package/resources/hris/benefits/benefits.d.mts +6 -6
  59. package/resources/hris/benefits/benefits.d.mts.map +1 -1
  60. package/resources/hris/benefits/benefits.d.ts +6 -6
  61. package/resources/hris/benefits/benefits.d.ts.map +1 -1
  62. package/resources/hris/benefits/individuals.d.mts +12 -12
  63. package/resources/hris/benefits/individuals.d.mts.map +1 -1
  64. package/resources/hris/benefits/individuals.d.ts +12 -12
  65. package/resources/hris/benefits/individuals.d.ts.map +1 -1
  66. package/resources/hris/employments.d.mts +12 -7
  67. package/resources/hris/employments.d.mts.map +1 -1
  68. package/resources/hris/employments.d.ts +12 -7
  69. package/resources/hris/employments.d.ts.map +1 -1
  70. package/resources/hris/individuals.d.mts +5 -5
  71. package/resources/hris/individuals.d.mts.map +1 -1
  72. package/resources/hris/individuals.d.ts +5 -5
  73. package/resources/hris/individuals.d.ts.map +1 -1
  74. package/resources/sandbox/directory.d.mts +5 -0
  75. package/resources/sandbox/directory.d.mts.map +1 -1
  76. package/resources/sandbox/directory.d.ts +5 -0
  77. package/resources/sandbox/directory.d.ts.map +1 -1
  78. package/resources/sandbox/employment.d.mts +10 -0
  79. package/resources/sandbox/employment.d.mts.map +1 -1
  80. package/resources/sandbox/employment.d.ts +10 -0
  81. package/resources/sandbox/employment.d.ts.map +1 -1
  82. package/resources/webhooks.d.mts +5 -1
  83. package/resources/webhooks.d.mts.map +1 -1
  84. package/resources/webhooks.d.ts +5 -1
  85. package/resources/webhooks.d.ts.map +1 -1
  86. package/src/client.ts +48 -15
  87. package/src/internal/parse.ts +6 -0
  88. package/src/internal/types.ts +6 -8
  89. package/src/internal/utils/env.ts +2 -2
  90. package/src/internal/utils/log.ts +2 -0
  91. package/src/internal/utils/query.ts +7 -0
  92. package/src/internal/utils.ts +1 -0
  93. package/src/resources/access-tokens.ts +6 -0
  94. package/src/resources/account.ts +12 -0
  95. package/src/resources/connect/sessions.ts +6 -2
  96. package/src/resources/hris/benefits/benefits.ts +8 -8
  97. package/src/resources/hris/benefits/individuals.ts +17 -14
  98. package/src/resources/hris/employments.ts +13 -7
  99. package/src/resources/hris/individuals.ts +5 -5
  100. package/src/resources/sandbox/directory.ts +6 -0
  101. package/src/resources/sandbox/employment.ts +12 -0
  102. package/src/resources/webhooks.ts +9 -1
  103. package/src/version.ts +1 -1
  104. package/version.d.mts +1 -1
  105. package/version.d.ts +1 -1
  106. package/version.js +1 -1
  107. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -11,7 +11,7 @@ import type { APIResponseProps } from './internal/parse';
11
11
  import { getPlatformHeaders } from './internal/detect-platform';
12
12
  import * as Shims from './internal/shims';
13
13
  import * as Opts from './internal/request-options';
14
- import * as qs from './internal/qs';
14
+ import { stringifyQuery } from './internal/utils/query';
15
15
  import { VERSION } from './version';
16
16
  import * as Errors from './core/error';
17
17
  import * as Pagination from './core/pagination';
@@ -241,6 +241,18 @@ export class Finch {
241
241
  this.fetch = options.fetch ?? Shims.getDefaultFetch();
242
242
  this.#encoder = Opts.FallbackEncoder;
243
243
 
244
+ const customHeadersEnv = readEnv('FINCH_CUSTOM_HEADERS');
245
+ if (customHeadersEnv) {
246
+ const parsed: Record<string, string> = {};
247
+ for (const line of customHeadersEnv.split('\n')) {
248
+ const colon = line.indexOf(':');
249
+ if (colon >= 0) {
250
+ parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
251
+ }
252
+ }
253
+ options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
254
+ }
255
+
244
256
  this._options = options;
245
257
 
246
258
  this.accessToken = accessToken;
@@ -333,8 +345,8 @@ export class Finch {
333
345
  return buildHeaders([{ Authorization }]);
334
346
  }
335
347
 
336
- protected stringifyQuery(query: Record<string, unknown>): string {
337
- return qs.stringify(query, { arrayFormat: 'brackets' });
348
+ protected stringifyQuery(query: object | Record<string, unknown>): string {
349
+ return stringifyQuery(query);
338
350
  }
339
351
 
340
352
  private getUserAgent(): string {
@@ -366,12 +378,13 @@ export class Finch {
366
378
  : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
367
379
 
368
380
  const defaultQuery = this.defaultQuery();
369
- if (!isEmptyObj(defaultQuery)) {
370
- query = { ...defaultQuery, ...query };
381
+ const pathQuery = Object.fromEntries(url.searchParams);
382
+ if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
383
+ query = { ...pathQuery, ...defaultQuery, ...query };
371
384
  }
372
385
 
373
386
  if (typeof query === 'object' && query && !Array.isArray(query)) {
374
- url.search = this.stringifyQuery(query as Record<string, unknown>);
387
+ url.search = this.stringifyQuery(query);
375
388
  }
376
389
 
377
390
  return url.toString();
@@ -555,7 +568,7 @@ export class Finch {
555
568
  loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
556
569
 
557
570
  const errText = await response.text().catch((err: any) => castToError(err).message);
558
- const errJSON = safeJSON(errText);
571
+ const errJSON = safeJSON(errText) as any;
559
572
  const errMessage = errJSON ? undefined : errText;
560
573
 
561
574
  loggerFor(this).debug(
@@ -592,9 +605,14 @@ export class Finch {
592
605
  getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
593
606
  path: string,
594
607
  Page: new (...args: any[]) => PageClass,
595
- opts?: RequestOptions,
608
+ opts?: PromiseOrValue<RequestOptions>,
596
609
  ): Pagination.PagePromise<PageClass, Item> {
597
- return this.requestAPIList(Page, { method: 'get', path, ...opts });
610
+ return this.requestAPIList(
611
+ Page,
612
+ opts && 'then' in opts ?
613
+ opts.then((opts) => ({ method: 'get', path, ...opts }))
614
+ : { method: 'get', path, ...opts },
615
+ );
598
616
  }
599
617
 
600
618
  requestAPIList<
@@ -602,7 +620,7 @@ export class Finch {
602
620
  PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
603
621
  >(
604
622
  Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
605
- options: FinalRequestOptions,
623
+ options: PromiseOrValue<FinalRequestOptions>,
606
624
  ): Pagination.PagePromise<PageClass, Item> {
607
625
  const request = this.makeRequest(options, null, undefined);
608
626
  return new Pagination.PagePromise<PageClass, Item>(this as any as Finch, request, Page);
@@ -615,9 +633,10 @@ export class Finch {
615
633
  controller: AbortController,
616
634
  ): Promise<Response> {
617
635
  const { signal, method, ...options } = init || {};
618
- if (signal) signal.addEventListener('abort', () => controller.abort());
636
+ const abort = this._makeAbort(controller);
637
+ if (signal) signal.addEventListener('abort', abort, { once: true });
619
638
 
620
- const timeout = setTimeout(() => controller.abort(), ms);
639
+ const timeout = setTimeout(abort, ms);
621
640
 
622
641
  const isReadableBody =
623
642
  ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
@@ -694,9 +713,9 @@ export class Finch {
694
713
  }
695
714
  }
696
715
 
697
- // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
698
- // just do what it says, but otherwise calculate a default
699
- if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
716
+ // If the API asks us to wait a certain amount of time, just do what it
717
+ // says, but otherwise calculate a default
718
+ if (timeoutMillis === undefined) {
700
719
  const maxRetries = options.maxRetries ?? this.maxRetries;
701
720
  timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
702
721
  }
@@ -785,6 +804,12 @@ export class Finch {
785
804
  return headers.values;
786
805
  }
787
806
 
807
+ private _makeAbort(controller: AbortController) {
808
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
809
+ // would capture all request options, and cause a memory leak.
810
+ return () => controller.abort();
811
+ }
812
+
788
813
  private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
789
814
  bodyHeaders: HeadersLike;
790
815
  body: BodyInit | undefined;
@@ -817,6 +842,14 @@ export class Finch {
817
842
  (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
818
843
  ) {
819
844
  return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
845
+ } else if (
846
+ typeof body === 'object' &&
847
+ headers.values.get('content-type') === 'application/x-www-form-urlencoded'
848
+ ) {
849
+ return {
850
+ bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
851
+ body: this.stringifyQuery(body),
852
+ };
820
853
  } else {
821
854
  return this.#encoder({ body, headers });
822
855
  }
@@ -29,6 +29,12 @@ export async function defaultParseResponse<T>(client: Finch, props: APIResponseP
29
29
  const mediaType = contentType?.split(';')[0]?.trim();
30
30
  const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
31
31
  if (isJSON) {
32
+ const contentLength = response.headers.get('content-length');
33
+ if (contentLength === '0') {
34
+ // if there is no content we can't do anything
35
+ return undefined as T;
36
+ }
37
+
32
38
  const json = await response.json();
33
39
  return json as T;
34
40
  }
@@ -40,7 +40,6 @@ type OverloadedParameters<T> =
40
40
  : T extends (...args: infer A) => unknown ? A
41
41
  : never;
42
42
 
43
- /* eslint-disable */
44
43
  /**
45
44
  * These imports attempt to get types from a parent package's dependencies.
46
45
  * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
@@ -63,19 +62,18 @@ type OverloadedParameters<T> =
63
62
  *
64
63
  * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
65
64
  */
66
- /** @ts-ignore For users with \@types/node */
65
+ /** @ts-ignore For users with \@types/node */ /* prettier-ignore */
67
66
  type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit>;
68
- /** @ts-ignore For users with undici */
67
+ /** @ts-ignore For users with undici */ /* prettier-ignore */
69
68
  type UndiciRequestInit = NotAny<import('../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici/index.d.ts').RequestInit>;
70
- /** @ts-ignore For users with \@types/bun */
69
+ /** @ts-ignore For users with \@types/bun */ /* prettier-ignore */
71
70
  type BunRequestInit = globalThis.FetchRequestInit;
72
- /** @ts-ignore For users with node-fetch@2 */
71
+ /** @ts-ignore For users with node-fetch@2 */ /* prettier-ignore */
73
72
  type NodeFetch2RequestInit = NotAny<import('../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit>;
74
- /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
73
+ /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ /* prettier-ignore */
75
74
  type NodeFetch3RequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
76
- /** @ts-ignore For users who use Deno */
75
+ /** @ts-ignore For users who use Deno */ /* prettier-ignore */
77
76
  type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
78
- /* eslint-enable */
79
77
 
80
78
  type RequestInits =
81
79
  | NotAny<UndiciTypesRequestInit>
@@ -9,10 +9,10 @@
9
9
  */
10
10
  export const readEnv = (env: string): string | undefined => {
11
11
  if (typeof (globalThis as any).process !== 'undefined') {
12
- return (globalThis as any).process.env?.[env]?.trim() ?? undefined;
12
+ return (globalThis as any).process.env?.[env]?.trim() || undefined;
13
13
  }
14
14
  if (typeof (globalThis as any).Deno !== 'undefined') {
15
- return (globalThis as any).Deno.env?.get?.(env)?.trim();
15
+ return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
16
16
  }
17
17
  return undefined;
18
18
  };
@@ -107,6 +107,8 @@ export const formatRequestDetails = (details: {
107
107
  name,
108
108
  (
109
109
  name.toLowerCase() === 'authorization' ||
110
+ name.toLowerCase() === 'api-key' ||
111
+ name.toLowerCase() === 'x-api-key' ||
110
112
  name.toLowerCase() === 'cookie' ||
111
113
  name.toLowerCase() === 'set-cookie'
112
114
  ) ?
@@ -0,0 +1,7 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import * as qs from '../qs/stringify';
4
+
5
+ export function stringifyQuery(query: object | Record<string, unknown>) {
6
+ return qs.stringify(query, { arrayFormat: 'brackets' });
7
+ }
@@ -6,3 +6,4 @@ export * from './utils/env';
6
6
  export * from './utils/log';
7
7
  export * from './utils/uuid';
8
8
  export * from './utils/sleep';
9
+ export * from './utils/query';
@@ -98,6 +98,12 @@ export interface CreateAccessTokenResponse {
98
98
  * for this connection
99
99
  */
100
100
  customer_id?: string | null;
101
+
102
+ /**
103
+ * The name of your customer you provided to Finch when a connect session was
104
+ * created for this connection
105
+ */
106
+ customer_name?: string | null;
101
107
  }
102
108
 
103
109
  export interface AccessTokenCreateParams {
@@ -180,6 +180,18 @@ export namespace Introspection {
180
180
  * The source ID of the entity
181
181
  */
182
182
  source_id: string | null;
183
+
184
+ /**
185
+ * The status of the entity connection
186
+ */
187
+ status:
188
+ | 'pending'
189
+ | 'processing'
190
+ | 'connected'
191
+ | 'error_no_account_setup'
192
+ | 'error_permissions'
193
+ | 'reauth'
194
+ | 'disconnected';
183
195
  }
184
196
  }
185
197
 
@@ -63,7 +63,9 @@ export interface SessionNewParams {
63
63
  customer_name: string;
64
64
 
65
65
  /**
66
- * The Finch products to request access to
66
+ * The Finch products to request access to. Use `benefits` to access deductions
67
+ * endpoints — `deduction` is a deprecated alias that is still accepted but should
68
+ * not be combined with `benefits`.
67
69
  */
68
70
  products: Array<
69
71
  | 'benefits'
@@ -140,7 +142,9 @@ export interface SessionReauthenticateParams {
140
142
  minutes_to_expire?: number;
141
143
 
142
144
  /**
143
- * The products to request access to (optional for reauthentication)
145
+ * The products to request access to (optional for reauthentication). Use
146
+ * `benefits` to access deductions endpoints — `deduction` is a deprecated alias
147
+ * that is still accepted but should not be combined with `benefits`.
144
148
  */
145
149
  products?: Array<
146
150
  | 'benefits'
@@ -141,12 +141,12 @@ export type CompanyBenefitsSinglePage = SinglePage<CompanyBenefit>;
141
141
  export type SupportedBenefitsSinglePage = SinglePage<SupportedBenefit>;
142
142
 
143
143
  export type BenefitContribution =
144
- | BenefitContribution.UnionMember0
145
- | BenefitContribution.UnionMember1
146
- | BenefitContribution.UnionMember2;
144
+ | BenefitContribution.BenefitContributionFixed
145
+ | BenefitContribution.BenefitContributionPercent
146
+ | BenefitContribution.BenefitContributionTiered;
147
147
 
148
148
  export namespace BenefitContribution {
149
- export interface UnionMember0 {
149
+ export interface BenefitContributionFixed {
150
150
  /**
151
151
  * Contribution amount in cents.
152
152
  */
@@ -158,7 +158,7 @@ export namespace BenefitContribution {
158
158
  type: 'fixed';
159
159
  }
160
160
 
161
- export interface UnionMember1 {
161
+ export interface BenefitContributionPercent {
162
162
  /**
163
163
  * Contribution amount in basis points (1/100th of a percent).
164
164
  */
@@ -170,12 +170,12 @@ export namespace BenefitContribution {
170
170
  type: 'percent';
171
171
  }
172
172
 
173
- export interface UnionMember2 {
173
+ export interface BenefitContributionTiered {
174
174
  /**
175
175
  * Array of tier objects defining employer match tiers based on employee
176
176
  * contribution thresholds.
177
177
  */
178
- tiers: Array<UnionMember2.Tier>;
178
+ tiers: Array<BenefitContributionTiered.Tier>;
179
179
 
180
180
  /**
181
181
  * Tiered contribution type (only valid for company_contribution).
@@ -183,7 +183,7 @@ export namespace BenefitContribution {
183
183
  type: 'tiered';
184
184
  }
185
185
 
186
- export namespace UnionMember2 {
186
+ export namespace BenefitContributionTiered {
187
187
  export interface Tier {
188
188
  match: number;
189
189
 
@@ -116,7 +116,7 @@ export interface EnrolledIndividualBenefitResponse {
116
116
  }
117
117
 
118
118
  export interface IndividualBenefit {
119
- body: IndividualBenefit.UnionMember0 | IndividualBenefit.BatchError;
119
+ body: IndividualBenefit.IndividualBenefit | IndividualBenefit.BatchError;
120
120
 
121
121
  code: number;
122
122
 
@@ -124,7 +124,7 @@ export interface IndividualBenefit {
124
124
  }
125
125
 
126
126
  export namespace IndividualBenefit {
127
- export interface UnionMember0 {
127
+ export interface IndividualBenefit {
128
128
  /**
129
129
  * If the benefit supports annual maximum, the amount in cents for this individual.
130
130
  */
@@ -142,16 +142,19 @@ export namespace IndividualBenefit {
142
142
  * matching structures.
143
143
  */
144
144
  company_contribution:
145
- | UnionMember0.UnionMember0
146
- | UnionMember0.UnionMember1
147
- | UnionMember0.UnionMember2
145
+ | IndividualBenefit.CompanyContributionFixed
146
+ | IndividualBenefit.CompanyContributionPercent
147
+ | IndividualBenefit.CompanyContributionTiered
148
148
  | null;
149
149
 
150
150
  /**
151
151
  * Employee deduction configuration. Supports both fixed amounts (in cents) and
152
152
  * percentage-based contributions (in basis points where 100 = 1%).
153
153
  */
154
- employee_deduction: UnionMember0.UnionMember0 | UnionMember0.UnionMember1 | null;
154
+ employee_deduction:
155
+ | IndividualBenefit.EmployeeDeductionContributionFixed
156
+ | IndividualBenefit.EmployeeDeductionContributionPercent
157
+ | null;
155
158
 
156
159
  /**
157
160
  * Type for HSA contribution limit if the benefit is a HSA.
@@ -159,8 +162,8 @@ export namespace IndividualBenefit {
159
162
  hsa_contribution_limit?: 'individual' | 'family' | null;
160
163
  }
161
164
 
162
- export namespace UnionMember0 {
163
- export interface UnionMember0 {
165
+ export namespace IndividualBenefit {
166
+ export interface CompanyContributionFixed {
164
167
  /**
165
168
  * Contribution amount in cents (for type=fixed) or basis points (for type=percent,
166
169
  * where 100 = 1%). Not used for type=tiered.
@@ -174,7 +177,7 @@ export namespace IndividualBenefit {
174
177
  type: 'fixed';
175
178
  }
176
179
 
177
- export interface UnionMember1 {
180
+ export interface CompanyContributionPercent {
178
181
  /**
179
182
  * Contribution amount in cents (for type=fixed) or basis points (for type=percent,
180
183
  * where 100 = 1%). Not used for type=tiered.
@@ -188,12 +191,12 @@ export namespace IndividualBenefit {
188
191
  type: 'percent';
189
192
  }
190
193
 
191
- export interface UnionMember2 {
194
+ export interface CompanyContributionTiered {
192
195
  /**
193
196
  * Array of tier objects defining employer match tiers based on employee
194
197
  * contribution thresholds. Required when type=tiered.
195
198
  */
196
- tiers: Array<UnionMember2.Tier>;
199
+ tiers: Array<CompanyContributionTiered.Tier>;
197
200
 
198
201
  /**
199
202
  * Contribution type. Supported values: "fixed" (amount in cents), "percent"
@@ -202,7 +205,7 @@ export namespace IndividualBenefit {
202
205
  type: 'tiered';
203
206
  }
204
207
 
205
- export namespace UnionMember2 {
208
+ export namespace CompanyContributionTiered {
206
209
  export interface Tier {
207
210
  match: number;
208
211
 
@@ -210,7 +213,7 @@ export namespace IndividualBenefit {
210
213
  }
211
214
  }
212
215
 
213
- export interface UnionMember0 {
216
+ export interface EmployeeDeductionContributionFixed {
214
217
  /**
215
218
  * Contribution amount in cents (for type=fixed) or basis points (for type=percent,
216
219
  * where 100 = 1%).
@@ -224,7 +227,7 @@ export namespace IndividualBenefit {
224
227
  type: 'fixed';
225
228
  }
226
229
 
227
- export interface UnionMember1 {
230
+ export interface EmployeeDeductionContributionPercent {
228
231
  /**
229
232
  * Contribution amount in cents (for type=fixed) or basis points (for type=percent,
230
233
  * where 100 = 1%).
@@ -36,10 +36,10 @@ export class Employments extends APIResource {
36
36
 
37
37
  export type EmploymentDataResponsesPage = ResponsesPage<EmploymentDataResponse>;
38
38
 
39
- export type EmploymentData = EmploymentData.UnionMember0 | EmploymentData.BatchError;
39
+ export type EmploymentData = EmploymentData.EmploymentData | EmploymentData.BatchError;
40
40
 
41
41
  export namespace EmploymentData {
42
- export interface UnionMember0 {
42
+ export interface EmploymentData {
43
43
  /**
44
44
  * A stable Finch `id` (UUID v4) for an individual in the company.
45
45
  */
@@ -53,12 +53,12 @@ export namespace EmploymentData {
53
53
  /**
54
54
  * The department object.
55
55
  */
56
- department: UnionMember0.Department | null;
56
+ department: EmploymentData.Department | null;
57
57
 
58
58
  /**
59
59
  * The employment object.
60
60
  */
61
- employment: UnionMember0.Employment | null;
61
+ employment: EmploymentData.Employment | null;
62
62
 
63
63
  /**
64
64
  * The detailed employment status of the individual.
@@ -80,6 +80,12 @@ export namespace EmploymentData {
80
80
  */
81
81
  first_name: string | null;
82
82
 
83
+ /**
84
+ * The FLSA status of the individual. Available options: `exempt`, `non_exempt`,
85
+ * `unknown`.
86
+ */
87
+ flsa_status: 'exempt' | 'non_exempt' | 'unknown' | null;
88
+
83
89
  /**
84
90
  * `true` if the individual an an active employee or contractor at the company.
85
91
  */
@@ -97,7 +103,7 @@ export namespace EmploymentData {
97
103
  /**
98
104
  * The manager object representing the manager of the individual within the org.
99
105
  */
100
- manager: UnionMember0.Manager | null;
106
+ manager: EmploymentData.Manager | null;
101
107
 
102
108
  /**
103
109
  * The legal middle name of the individual.
@@ -116,7 +122,7 @@ export namespace EmploymentData {
116
122
  * employer in the system. Custom fields are not currently supported for assisted
117
123
  * connections.
118
124
  */
119
- custom_fields?: Array<UnionMember0.CustomField> | null;
125
+ custom_fields?: Array<EmploymentData.CustomField> | null;
120
126
 
121
127
  /**
122
128
  * The employee's income as reported by the provider. This may not always be
@@ -141,7 +147,7 @@ export namespace EmploymentData {
141
147
  work_id?: string | null;
142
148
  }
143
149
 
144
- export namespace UnionMember0 {
150
+ export namespace EmploymentData {
145
151
  /**
146
152
  * The department object.
147
153
  */
@@ -34,10 +34,10 @@ export class Individuals extends APIResource {
34
34
 
35
35
  export type IndividualResponsesPage = ResponsesPage<IndividualResponse>;
36
36
 
37
- export type Individual = Individual.UnionMember0 | Individual.BatchError;
37
+ export type Individual = Individual.Individual | Individual.BatchError;
38
38
 
39
39
  export namespace Individual {
40
- export interface UnionMember0 {
40
+ export interface Individual {
41
41
  /**
42
42
  * A stable Finch `id` (UUID v4) for an individual in the company.
43
43
  */
@@ -79,7 +79,7 @@ export namespace Individual {
79
79
  */
80
80
  middle_name: string | null;
81
81
 
82
- phone_numbers: Array<UnionMember0.PhoneNumber | null> | null;
82
+ phone_numbers: Array<Individual.PhoneNumber | null> | null;
83
83
 
84
84
  /**
85
85
  * The preferred name of the individual.
@@ -88,7 +88,7 @@ export namespace Individual {
88
88
 
89
89
  residence: HRISAPI.Location | null;
90
90
 
91
- emails?: Array<UnionMember0.Email> | null;
91
+ emails?: Array<Individual.Email> | null;
92
92
 
93
93
  /**
94
94
  * Social Security Number of the individual in **encrypted** format. This field is
@@ -106,7 +106,7 @@ export namespace Individual {
106
106
  ssn?: string | null;
107
107
  }
108
108
 
109
- export namespace UnionMember0 {
109
+ export namespace Individual {
110
110
  export interface PhoneNumber {
111
111
  data: string | null;
112
112
 
@@ -109,6 +109,12 @@ export namespace DirectoryCreateParams {
109
109
  */
110
110
  first_name?: string | null;
111
111
 
112
+ /**
113
+ * The FLSA status of the individual. Available options: `exempt`, `non_exempt`,
114
+ * `unknown`.
115
+ */
116
+ flsa_status?: 'exempt' | 'non_exempt' | 'unknown' | null;
117
+
112
118
  /**
113
119
  * The gender of the individual.
114
120
  */
@@ -78,6 +78,12 @@ export interface EmploymentUpdateResponse {
78
78
  */
79
79
  first_name?: string | null;
80
80
 
81
+ /**
82
+ * The FLSA status of the individual. Available options: `exempt`, `non_exempt`,
83
+ * `unknown`.
84
+ */
85
+ flsa_status?: 'exempt' | 'non_exempt' | 'unknown' | null;
86
+
81
87
  /**
82
88
  * The employee's income as reported by the provider. This may not always be
83
89
  * annualized income, but may be in units of bi-weekly, semi-monthly, daily, etc,
@@ -214,6 +220,12 @@ export interface EmploymentUpdateParams {
214
220
  */
215
221
  first_name?: string | null;
216
222
 
223
+ /**
224
+ * The FLSA status of the individual. Available options: `exempt`, `non_exempt`,
225
+ * `unknown`.
226
+ */
227
+ flsa_status?: 'exempt' | 'non_exempt' | 'unknown' | null;
228
+
217
229
  /**
218
230
  * The employee's income as reported by the provider. This may not always be
219
231
  * annualized income, but may be in units of bi-weekly, semi-monthly, daily, etc,
@@ -576,6 +576,11 @@ export interface BaseWebhookEvent {
576
576
  * Unique Finch ID of the connection associated with the webhook event.
577
577
  */
578
578
  connection_id?: string;
579
+
580
+ /**
581
+ * Unique Finch id of the entity for which data has been updated.
582
+ */
583
+ entity_id?: string;
579
584
  }
580
585
 
581
586
  export interface CompanyEvent extends BaseWebhookEvent {
@@ -638,7 +643,10 @@ export interface JobCompletionEvent extends BaseWebhookEvent {
638
643
  | 'job.benefit_register.completed'
639
644
  | 'job.benefit_unenroll.completed'
640
645
  | 'job.benefit_update.completed'
641
- | 'job.data_sync_all.completed';
646
+ | 'job.data_sync_all.completed'
647
+ | 'job.w4_form_employee_sync.completed'
648
+ | 'job.initial_data_sync_org.succeeded'
649
+ | 'job.initial_data_sync_payroll.succeeded';
642
650
  }
643
651
 
644
652
  export namespace JobCompletionEvent {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '9.0.0'; // x-release-please-version
1
+ export const VERSION = '9.8.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "9.0.0";
1
+ export declare const VERSION = "9.8.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "9.0.0";
1
+ export declare const VERSION = "9.8.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '9.0.0'; // x-release-please-version
4
+ exports.VERSION = '9.8.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '9.0.0'; // x-release-please-version
1
+ export const VERSION = '9.8.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map