@factorialco/api-client 3.0.0-beta.2027010100 → 4.0.0-beta.2027010101

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 (42) hide show
  1. package/README.md +70 -28
  2. package/dist/cjs/errors.d.ts +96 -0
  3. package/dist/cjs/errors.d.ts.map +1 -0
  4. package/dist/cjs/errors.js +155 -0
  5. package/dist/cjs/errors.js.map +1 -0
  6. package/dist/cjs/generated/sdk.gen.d.ts +2 -2
  7. package/dist/cjs/generated/sdk.gen.js +2 -2
  8. package/dist/cjs/generated/types.gen.d.ts +20 -3
  9. package/dist/cjs/generated/types.gen.d.ts.map +1 -1
  10. package/dist/cjs/index.d.ts +2 -0
  11. package/dist/cjs/index.d.ts.map +1 -1
  12. package/dist/cjs/index.js +6 -1
  13. package/dist/cjs/index.js.map +1 -1
  14. package/dist/cjs/pagination.d.ts +5 -3
  15. package/dist/cjs/pagination.d.ts.map +1 -1
  16. package/dist/cjs/pagination.js +5 -6
  17. package/dist/cjs/pagination.js.map +1 -1
  18. package/dist/cjs/sdk.d.ts +976 -956
  19. package/dist/cjs/sdk.d.ts.map +1 -1
  20. package/dist/cjs/sdk.js +871 -347
  21. package/dist/cjs/sdk.js.map +1 -1
  22. package/dist/esm/errors.d.ts +96 -0
  23. package/dist/esm/errors.d.ts.map +1 -0
  24. package/dist/esm/errors.js +149 -0
  25. package/dist/esm/errors.js.map +1 -0
  26. package/dist/esm/generated/sdk.gen.d.ts +2 -2
  27. package/dist/esm/generated/sdk.gen.js +2 -2
  28. package/dist/esm/generated/types.gen.d.ts +20 -3
  29. package/dist/esm/generated/types.gen.d.ts.map +1 -1
  30. package/dist/esm/index.d.ts +2 -0
  31. package/dist/esm/index.d.ts.map +1 -1
  32. package/dist/esm/index.js +3 -0
  33. package/dist/esm/index.js.map +1 -1
  34. package/dist/esm/pagination.d.ts +5 -3
  35. package/dist/esm/pagination.d.ts.map +1 -1
  36. package/dist/esm/pagination.js +5 -6
  37. package/dist/esm/pagination.js.map +1 -1
  38. package/dist/esm/sdk.d.ts +976 -956
  39. package/dist/esm/sdk.d.ts.map +1 -1
  40. package/dist/esm/sdk.js +864 -342
  41. package/dist/esm/sdk.js.map +1 -1
  42. package/package.json +6 -2
package/README.md CHANGED
@@ -10,15 +10,18 @@ The SDK uses standard semver (`MAJOR.MINOR.PATCH`), independent of the Factorial
10
10
  |-------------|----------------------|
11
11
  | `1.x.y` | `2026-04-01` |
12
12
  | `2.x.y` | `2026-07-01` |
13
+ | `3.x.y` | `2026-10-01` |
13
14
 
14
- Factorial releases new API versions quarterly (Jan/Apr/Jul/Oct).
15
+ Factorial releases new API versions quarterly (Jan/Apr/Jul/Oct). A new major is
16
+ usually cut for a new API version, but can also be cut for a breaking change to
17
+ the SDK itself — which is why `2.x` and `3.x` target the same API version.
15
18
 
16
19
  See the [Factorial API versioning docs](https://apidoc.factorialhr.com/docs/api-versioning) for details.
17
20
 
18
21
  ## Installation
19
22
 
20
23
  ```sh
21
- npm install @factorialco/api-client@2026-07-01
24
+ npm install @factorialco/api-client@2026-10-01
22
25
  ```
23
26
 
24
27
  ## Quick start
@@ -30,8 +33,10 @@ const client = new FactorialClient({
30
33
  apiKey: process.env.FACTORIAL_API_KEY,
31
34
  });
32
35
 
33
- const { data: { data: { data, meta } = {}, error } = {}, error } = await client.employees.employees.list();
34
- console.log(`${meta.total} employees total`);
36
+ const { data: page } = await client.employees.employees.list({
37
+ query: { only_active: true, only_managers: false },
38
+ });
39
+ console.log(`${page.meta?.total} employees total`);
35
40
  ```
36
41
 
37
42
  ## Authentication
@@ -90,8 +95,8 @@ Every resource exposes the standard methods available in the API:
90
95
 
91
96
  ```ts
92
97
  // List (single page, up to 100 items)
93
- const { data: { data, meta } = {}, error } = await client.employees.employees.list({
94
- query: { only_active: true },
98
+ const { data: page } = await client.employees.employees.list({
99
+ query: { only_active: true, only_managers: false },
95
100
  });
96
101
 
97
102
  // Get by ID
@@ -115,40 +120,53 @@ await client.timeoff.leaves.delete({ path: { id: 99 } });
115
120
 
116
121
  // Named actions
117
122
  await client.timeoff.leaves.approve({ body: { id: 99 } });
118
- await client.attendance.shifts.clockIn({ body: { employee_id: 1, , now: new Date().toISOString().slice(0, 19) } });
123
+ await client.attendance.shifts.clockIn({
124
+ body: { employee_id: 1, now: new Date().toISOString().slice(0, 19) },
125
+ });
119
126
  ```
120
127
 
121
128
  ## Pagination
122
129
 
123
- The Factorial API uses **cursor-based pagination**. All list endpoints return
124
- `{ data: { data, meta } = {}, error }` where `meta` contains `has_next_page`, `end_cursor`, and `total`.
130
+ The Factorial API uses **cursor-based pagination**. Every list endpoint resolves
131
+ to `{ data: { data, meta }, request, response }`, where `meta` carries
132
+ `has_next_page`, `end_cursor`, and `total`. The spec marks `data` and `meta`
133
+ optional, so access them with `?.`. A non-2xx response throws — see
134
+ [Error handling](#error-handling).
125
135
 
126
136
  ### Single page
127
137
 
128
138
  ```ts
129
- const { data: { data, meta } = {}, error } = await client.employees.employees.list({ query: { limit: 50 } });
130
-
131
- // Fetch next page manually
132
- if (meta.has_next_page) {
133
- const page2 = await client.employees.employees.list({
134
- query: { limit: 50, after_id: meta.end_cursor },
135
- });
136
- }
139
+ const { data: page } = await client.employees.employees.list({
140
+ query: { only_active: true, only_managers: false },
141
+ });
142
+ console.log(page.data?.length, page.meta?.has_next_page);
137
143
  ```
138
144
 
145
+ `limit` and `after_id` work at runtime but are absent from the OpenAPI spec, so
146
+ they are not part of the typed `query`. Prefer `paginate({ limit })` below; to
147
+ cursor by hand, cast the query.
148
+
139
149
  ### Stream all pages (async iterator)
140
150
 
141
151
  ```ts
142
- for await (const employee of client.employees.employees.paginate()) {
152
+ for await (const employee of client.employees.employees.paginate({
153
+ query: { only_active: true, only_managers: false },
154
+ })) {
143
155
  console.log(employee.full_name);
144
156
  }
145
157
  ```
146
158
 
159
+ `paginate()` and `all()` accept `limit` (items per request, max 100) and
160
+ `maxItems` (a cap on the total fetched) alongside the endpoint's own options.
161
+
147
162
  ### Collect all into array
148
163
 
149
164
  ```ts
150
165
  // Optional safety cap via maxItems
151
- const all = await client.employees.employees.all({ maxItems: 500 });
166
+ const all = await client.employees.employees.all({
167
+ query: { only_active: true, only_managers: false },
168
+ maxItems: 500,
169
+ });
152
170
  ```
153
171
 
154
172
  Both `paginate()` and `all()` are available on every list endpoint.
@@ -172,23 +190,47 @@ There is no server-side aggregation endpoint; compute totals client-side.
172
190
 
173
191
  ## Error handling
174
192
 
175
- The client is configured with `throwOnError: true`, so any non-2xx response
176
- (bad/expired token, wrong base URL, `4xx`/`5xx`) **throws** rather than silently
177
- resolving to empty data. Wrap calls in `try`/`catch`:
193
+ Any non-2xx response (bad/expired token, wrong base URL, `4xx`/`5xx`) **throws a
194
+ `FactorialApiError`** rather than resolving to empty data. Results carry no
195
+ `error` field — wrap calls in `try`/`catch`:
178
196
 
179
197
  ```ts
198
+ import { FactorialApiError, FactorialClient } from "@factorialco/api-client";
199
+
180
200
  try {
181
- const { data } = await client.employees.employees.list();
201
+ const { data } = await client.employees.employees.get({ path: { id: "42" } });
182
202
  console.log(data);
183
203
  } catch (err) {
184
- // For HTTP errors, `err` is the API's parsed error body.
185
- // For transport failures (DNS/connection), `err` is a TypeError.
186
- console.error("Request failed:", err);
204
+ if (err instanceof FactorialApiError) {
205
+ console.error(err.status); // 404
206
+ console.error(err.method); // "GET"
207
+ console.error(err.url); // full request URL
208
+ console.error(err.body); // parsed error body from the API
209
+ console.error(err.message); // "Factorial API 404 Not Found: GET https://… — {…}"
210
+ } else {
211
+ // Transport failure (DNS, connection reset, abort) — not an HTTP response.
212
+ throw err;
213
+ }
187
214
  }
188
215
  ```
189
216
 
190
- You can opt out per client (restoring the `{ data, error }` return shape) with
191
- `new FactorialClient({ ..., throwOnError: false })`.
217
+ `FactorialApiError` fields:
218
+
219
+ | Field | Type | Notes |
220
+ |-------|------|-------|
221
+ | `status` | `number` | HTTP status code |
222
+ | `statusText` | `string` | Reason phrase; empty over HTTP/2 |
223
+ | `method` | `string` | Request method |
224
+ | `url` | `string` | Full request URL, including the query string |
225
+ | `body` | `unknown` | Parsed JSON, the raw string for non-JSON, `undefined` when empty |
226
+ | `headers` | `Headers` | Response headers; non-enumerable |
227
+ | `response` | `Response` | Raw response; non-enumerable, body already consumed |
228
+
229
+ `headers` and `response` are non-enumerable so `console.error(err)` stays
230
+ readable — they are still accessible directly.
231
+
232
+ Across package copies (the ESM + CJS dual-package hazard) `instanceof` can fail;
233
+ `isFactorialApiError(err)` is a name-based fallback for that case.
192
234
 
193
235
  ## Webhooks
194
236
 
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Error types for the Factorial API client.
3
+ *
4
+ * Every non-2xx HTTP response is thrown as a {@link FactorialApiError} carrying
5
+ * the status, method, URL and parsed body. Transport failures (DNS, connection
6
+ * reset, aborted request) are *not* wrapped — they surface as the underlying
7
+ * error, typically a `TypeError` from `fetch`.
8
+ */
9
+ /** Constructor payload for {@link FactorialApiError}. */
10
+ export interface FactorialApiErrorInit {
11
+ /** HTTP status code, e.g. `401`. */
12
+ status: number;
13
+ /** HTTP reason phrase, e.g. `"Unauthorized"`. Empty over HTTP/2. */
14
+ statusText: string;
15
+ /** HTTP method of the failed request, e.g. `"GET"`. */
16
+ method: string;
17
+ /** Full request URL, including the query string. */
18
+ url: string;
19
+ /**
20
+ * Response body: the parsed JSON when the body was valid JSON, the raw string
21
+ * for non-JSON bodies, `undefined` when the body was empty.
22
+ */
23
+ body: unknown;
24
+ /** Response headers. Rate-limit and request-id headers live here. */
25
+ headers?: Headers;
26
+ /** The raw `Response`, when one was produced. */
27
+ response?: Response;
28
+ }
29
+ /**
30
+ * Thrown for every non-2xx response from the Factorial API.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * try {
35
+ * await client.employees.employees.get({ path: { id: "1" } });
36
+ * } catch (err) {
37
+ * if (err instanceof FactorialApiError) {
38
+ * console.error(err.status, err.method, err.url, err.body);
39
+ * } else {
40
+ * throw err; // transport failure (e.g. a fetch TypeError)
41
+ * }
42
+ * }
43
+ * ```
44
+ */
45
+ export declare class FactorialApiError extends Error {
46
+ /** HTTP status code, e.g. `401`. */
47
+ readonly status: number;
48
+ /** HTTP reason phrase, e.g. `"Unauthorized"`. Empty over HTTP/2. */
49
+ readonly statusText: string;
50
+ /** HTTP method of the failed request, e.g. `"GET"`. */
51
+ readonly method: string;
52
+ /** Full request URL, including the query string. */
53
+ readonly url: string;
54
+ /**
55
+ * Response body: the parsed JSON when the body was valid JSON, the raw string
56
+ * for non-JSON bodies, `undefined` when the body was empty.
57
+ */
58
+ readonly body: unknown;
59
+ /**
60
+ * Response headers. Rate-limit and request-id headers live here.
61
+ *
62
+ * Non-enumerable, so logging the error stays readable.
63
+ */
64
+ readonly headers: Headers;
65
+ /**
66
+ * The raw `Response`. Its body stream has already been consumed to populate
67
+ * {@link FactorialApiError.body} — read that instead.
68
+ *
69
+ * Non-enumerable, so logging the error stays readable.
70
+ */
71
+ readonly response?: Response;
72
+ constructor(init: FactorialApiErrorInit);
73
+ }
74
+ /**
75
+ * `instanceof`-safe check for {@link FactorialApiError}.
76
+ *
77
+ * Prefer `err instanceof FactorialApiError`. Use this helper when two copies of
78
+ * the package may be loaded at once (the ESM + CJS dual-package hazard), where
79
+ * `instanceof` can fail across realm boundaries.
80
+ */
81
+ export declare function isFactorialApiError(error: unknown): error is FactorialApiError;
82
+ /**
83
+ * Converts the raw value thrown by the underlying fetch client for a non-2xx
84
+ * response (the parsed JSON body, the raw text, or `""`) into a
85
+ * {@link FactorialApiError}.
86
+ *
87
+ * Registered as the client's error interceptor by `FactorialClient`. Values
88
+ * that do not describe an HTTP error response are returned untouched:
89
+ *
90
+ * - no `Response` — a transport failure such as a `fetch` `TypeError`
91
+ * - an ok `Response` — a failure while parsing a 2xx body
92
+ * - an `Error` instance — already a usable error, e.g. thrown by a user
93
+ * interceptor
94
+ */
95
+ export declare function toFactorialApiError(error: unknown, response: Response | undefined, request: Request | undefined): unknown;
96
+ //# sourceMappingURL=errors.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AAS,GAC3B,OAAO,CAaT"}
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ /**
3
+ * Error types for the Factorial API client.
4
+ *
5
+ * Every non-2xx HTTP response is thrown as a {@link FactorialApiError} carrying
6
+ * the status, method, URL and parsed body. Transport failures (DNS, connection
7
+ * reset, aborted request) are *not* wrapped — they surface as the underlying
8
+ * error, typically a `TypeError` from `fetch`.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.FactorialApiError = void 0;
12
+ exports.isFactorialApiError = isFactorialApiError;
13
+ exports.toFactorialApiError = toFactorialApiError;
14
+ /**
15
+ * Thrown for every non-2xx response from the Factorial API.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * try {
20
+ * await client.employees.employees.get({ path: { id: "1" } });
21
+ * } catch (err) {
22
+ * if (err instanceof FactorialApiError) {
23
+ * console.error(err.status, err.method, err.url, err.body);
24
+ * } else {
25
+ * throw err; // transport failure (e.g. a fetch TypeError)
26
+ * }
27
+ * }
28
+ * ```
29
+ */
30
+ class FactorialApiError extends Error {
31
+ /** HTTP status code, e.g. `401`. */
32
+ status;
33
+ /** HTTP reason phrase, e.g. `"Unauthorized"`. Empty over HTTP/2. */
34
+ statusText;
35
+ /** HTTP method of the failed request, e.g. `"GET"`. */
36
+ method;
37
+ /** Full request URL, including the query string. */
38
+ url;
39
+ /**
40
+ * Response body: the parsed JSON when the body was valid JSON, the raw string
41
+ * for non-JSON bodies, `undefined` when the body was empty.
42
+ */
43
+ body;
44
+ /**
45
+ * Response headers. Rate-limit and request-id headers live here.
46
+ *
47
+ * Non-enumerable, so logging the error stays readable.
48
+ */
49
+ headers;
50
+ /**
51
+ * The raw `Response`. Its body stream has already been consumed to populate
52
+ * {@link FactorialApiError.body} — read that instead.
53
+ *
54
+ * Non-enumerable, so logging the error stays readable.
55
+ */
56
+ response;
57
+ constructor(init) {
58
+ super(formatMessage(init));
59
+ this.name = "FactorialApiError";
60
+ this.status = init.status;
61
+ this.statusText = init.statusText;
62
+ this.method = init.method;
63
+ this.url = init.url;
64
+ this.body = init.body;
65
+ // `headers` and `response` are hidden from enumeration: console.error(err)
66
+ // and JSON.stringify(err) would otherwise dump the whole Response object,
67
+ // burying the fields that identify the failure.
68
+ Object.defineProperty(this, "headers", {
69
+ value: init.headers ?? new Headers(),
70
+ enumerable: false,
71
+ writable: false,
72
+ configurable: true,
73
+ });
74
+ Object.defineProperty(this, "response", {
75
+ value: init.response,
76
+ enumerable: false,
77
+ writable: false,
78
+ configurable: true,
79
+ });
80
+ }
81
+ }
82
+ exports.FactorialApiError = FactorialApiError;
83
+ /**
84
+ * `instanceof`-safe check for {@link FactorialApiError}.
85
+ *
86
+ * Prefer `err instanceof FactorialApiError`. Use this helper when two copies of
87
+ * the package may be loaded at once (the ESM + CJS dual-package hazard), where
88
+ * `instanceof` can fail across realm boundaries.
89
+ */
90
+ function isFactorialApiError(error) {
91
+ return (error instanceof FactorialApiError ||
92
+ (typeof error === "object" &&
93
+ error !== null &&
94
+ error.name === "FactorialApiError"));
95
+ }
96
+ /**
97
+ * Converts the raw value thrown by the underlying fetch client for a non-2xx
98
+ * response (the parsed JSON body, the raw text, or `""`) into a
99
+ * {@link FactorialApiError}.
100
+ *
101
+ * Registered as the client's error interceptor by `FactorialClient`. Values
102
+ * that do not describe an HTTP error response are returned untouched:
103
+ *
104
+ * - no `Response` — a transport failure such as a `fetch` `TypeError`
105
+ * - an ok `Response` — a failure while parsing a 2xx body
106
+ * - an `Error` instance — already a usable error, e.g. thrown by a user
107
+ * interceptor
108
+ */
109
+ function toFactorialApiError(error, response, request) {
110
+ if (response === undefined || response.ok)
111
+ return error;
112
+ if (error instanceof Error)
113
+ return error;
114
+ return new FactorialApiError({
115
+ status: response.status,
116
+ statusText: response.statusText,
117
+ method: request?.method ?? "UNKNOWN",
118
+ url: request?.url ?? response.url,
119
+ // An empty body reaches us as "" because JSON.parse("") throws upstream.
120
+ body: error === "" ? undefined : error,
121
+ headers: response.headers,
122
+ response,
123
+ });
124
+ }
125
+ /** Longest body excerpt appended to the error message. */
126
+ const EXCERPT_MAX_LENGTH = 200;
127
+ function formatMessage({ status, statusText, method, url, body, }) {
128
+ const head = `Factorial API ${status}${statusText ? ` ${statusText}` : ""}: ${method} ${url}`;
129
+ const excerpt = bodyExcerpt(body);
130
+ return excerpt ? `${head} — ${excerpt}` : head;
131
+ }
132
+ function bodyExcerpt(body) {
133
+ if (body === undefined || body === null || body === "")
134
+ return undefined;
135
+ let text;
136
+ if (typeof body === "string") {
137
+ text = body;
138
+ }
139
+ else {
140
+ try {
141
+ text = JSON.stringify(body) ?? String(body);
142
+ }
143
+ catch {
144
+ // Circular structures and BigInt values make JSON.stringify throw.
145
+ text = String(body);
146
+ }
147
+ }
148
+ const oneLine = text.replace(/\s+/g, " ").trim();
149
+ if (!oneLine)
150
+ return undefined;
151
+ return oneLine.length > EXCERPT_MAX_LENGTH
152
+ ? `${oneLine.slice(0, EXCERPT_MAX_LENGTH)}…`
153
+ : oneLine;
154
+ }
155
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAoGH,kDAOC;AAeD,kDAiBC;AApHD;;;;;;;;;;;;;;;GAeG;AACH,MAAa,iBAAkB,SAAQ,KAAK;IAC1C,oCAAoC;IAC3B,MAAM,CAAS;IACxB,oEAAoE;IAC3D,UAAU,CAAS;IAC5B,uDAAuD;IAC9C,MAAM,CAAS;IACxB,oDAAoD;IAC3C,GAAG,CAAS;IACrB;;;OAGG;IACM,IAAI,CAAU;IACvB;;;;OAIG;IACM,OAAO,CAAW;IAC3B;;;;;OAKG;IACM,QAAQ,CAAY;IAE7B,YAAY,IAA2B;QACrC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,I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C;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACjD,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,OAAO,OAAO,CAAC,MAAM,GAAG,kBAAkB;QACxC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAC,GAAG;QAC5C,CAAC,CAAC,OAAO,CAAC;AACd,CAAC"}
@@ -1295,13 +1295,13 @@ export declare const getApi20270101ResourcesEmployeeUpdatesAbsencesById: <ThrowO
1295
1295
  /**
1296
1296
  * Reads all Contract changes
1297
1297
  *
1298
- * This endpoint can be used to retrieve a list of contract changes `employee updates` details.
1298
+ * This endpoint can be used to retrieve a list of contract changes `employee updates` details. It covers updates to the contract conditions as well as the activity changes of fixed-discontinuous contracts, told apart by `type`.
1299
1299
  */
1300
1300
  export declare const getApi20270101ResourcesEmployeeUpdatesContractChanges: <ThrowOnError extends boolean = false>(options?: Options<GetApi20270101ResourcesEmployeeUpdatesContractChangesData, ThrowOnError>) => RequestResult<GetApi20270101ResourcesEmployeeUpdatesContractChangesResponses, unknown, ThrowOnError>;
1301
1301
  /**
1302
1302
  * Reads a single Contract change
1303
1303
  *
1304
- * This endpoint can be used to retrieve a list of contract changes `employee updates` details.
1304
+ * This endpoint can be used to retrieve a list of contract changes `employee updates` details. It covers updates to the contract conditions as well as the activity changes of fixed-discontinuous contracts, told apart by `type`.
1305
1305
  */
1306
1306
  export declare const getApi20270101ResourcesEmployeeUpdatesContractChangesById: <ThrowOnError extends boolean = false>(options: Options<GetApi20270101ResourcesEmployeeUpdatesContractChangesByIdData, ThrowOnError>) => RequestResult<GetApi20270101ResourcesEmployeeUpdatesContractChangesByIdResponses, unknown, ThrowOnError>;
1307
1307
  /**
@@ -2648,7 +2648,7 @@ exports.getApi20270101ResourcesEmployeeUpdatesAbsencesById = getApi20270101Resou
2648
2648
  /**
2649
2649
  * Reads all Contract changes
2650
2650
  *
2651
- * This endpoint can be used to retrieve a list of contract changes `employee updates` details.
2651
+ * This endpoint can be used to retrieve a list of contract changes `employee updates` details. It covers updates to the contract conditions as well as the activity changes of fixed-discontinuous contracts, told apart by `type`.
2652
2652
  */
2653
2653
  const getApi20270101ResourcesEmployeeUpdatesContractChanges = (options) => (options?.client ?? client_gen_js_1.client).get({
2654
2654
  security: [{ scheme: 'bearer', type: 'http' }, { name: 'x-api-key', type: 'apiKey' }],
@@ -2659,7 +2659,7 @@ exports.getApi20270101ResourcesEmployeeUpdatesContractChanges = getApi20270101Re
2659
2659
  /**
2660
2660
  * Reads a single Contract change
2661
2661
  *
2662
- * This endpoint can be used to retrieve a list of contract changes `employee updates` details.
2662
+ * This endpoint can be used to retrieve a list of contract changes `employee updates` details. It covers updates to the contract conditions as well as the activity changes of fixed-discontinuous contracts, told apart by `type`.
2663
2663
  */
2664
2664
  const getApi20270101ResourcesEmployeeUpdatesContractChangesById = (options) => (options.client ?? client_gen_js_1.client).get({
2665
2665
  security: [{ scheme: 'bearer', type: 'http' }, { name: 'x-api-key', type: 'apiKey' }],
@@ -3337,6 +3337,14 @@ export type EmployeeUpdatesContractChange = {
3337
3337
  * The status of the contract change incidence
3338
3338
  */
3339
3339
  status: string;
3340
+ /**
3341
+ * The kind of contract change. `contract` is an update to the contract conditions. `contract_deactivation` and `contract_reactivation` close and reopen an activity period of a fixed-discontinuous contract, and carry the conditions of the contract version in force on that date.
3342
+ */
3343
+ type: string;
3344
+ /**
3345
+ * The date the activity period closed or reopened, for a `contract_deactivation` or `contract_reactivation`. Null for a plain `contract` change, whose date is `effective_on`. The other dates on this payload belong to the contract version in force on this date, not to the activity change itself.
3346
+ */
3347
+ activity_changed_on?: string;
3340
3348
  /**
3341
3349
  * The effective date of the contract
3342
3350
  */
@@ -3489,6 +3497,9 @@ export type EmployeeUpdatesContractChange = {
3489
3497
  * The work type name on the contract change
3490
3498
  */
3491
3499
  fr_work_type_name?: string;
3500
+ /**
3501
+ * The ids of the additional compensations on the contract change
3502
+ */
3492
3503
  compensation_ids?: Array<string>;
3493
3504
  /**
3494
3505
  * The contract type id on the contract change
@@ -3514,7 +3525,13 @@ export type EmployeeUpdatesContractChange = {
3514
3525
  * The contract type name on the contract change
3515
3526
  */
3516
3527
  pt_contract_type_name?: string;
3528
+ /**
3529
+ * Time the contract change incidence was created
3530
+ */
3517
3531
  created_at: string;
3532
+ /**
3533
+ * Time the contract change incidence was last updated
3534
+ */
3518
3535
  updated_at: string;
3519
3536
  };
3520
3537
  export type EmployeeUpdatesNewHire = {
@@ -3990,7 +4007,7 @@ export type ExpensesExpense = {
3990
4007
  */
3991
4008
  external_authorization_id?: string;
3992
4009
  /**
3993
- * The id of the card
4010
+ * The id of the Factorial card the expense was paid with. It is set on every expense raised from a Factorial card payment or dispute and null on every other expense, including one paid with a card from another provider, so it is how to tell Factorial card spend apart. GraphQL exposes it as the `factorialCard` relation and deprecates the raw id.
3994
4011
  */
3995
4012
  expenses_card_id?: string;
3996
4013
  /**
@@ -4046,11 +4063,11 @@ export type ExpensesExpense = {
4046
4063
  */
4047
4064
  document_type?: string;
4048
4065
  /**
4049
- * The payment of the expense
4066
+ * Who paid, one of 'reimbursable' (the employee paid with their own money and is owed it back) or 'not_reimbursable' (the company paid, with a Factorial card, another corporate card or company cash).
4050
4067
  */
4051
4068
  payment?: 'reimbursable' | 'not_reimbursable';
4052
4069
  /**
4053
- * The method of the payment
4070
+ * How the expense was paid, as the id of an option in the company's payment-method list, or null when the employee left it empty. The built-in ids are 'personal_debit_card', 'personal_credit_card' and 'cash' under a reimbursable payment, and 'factorial_card', 'corporate_debit_card', 'corporate_credit_card' and 'company_cash' under a not-reimbursable one; a company can add options with ids of its own. A corporate card from another provider is one of the 'corporate_*' options, chosen by the employee. To tell Factorial card spend apart, use `expenses_card_id` — the `factorialCard` relation in GraphQL — rather than 'factorial_card'.
4054
4071
  */
4055
4072
  payment_method?: string;
4056
4073
  /**