@factorialco/api-client 3.0.0-beta.2026100139 → 3.0.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/README.md +70 -28
- package/dist/cjs/errors.d.ts +96 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +155 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/generated/sdk.gen.d.ts +27 -1
- package/dist/cjs/generated/sdk.gen.d.ts.map +1 -1
- package/dist/cjs/generated/sdk.gen.js +27 -1
- package/dist/cjs/generated/sdk.gen.js.map +1 -1
- package/dist/cjs/generated/types.gen.d.ts +3 -3
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/pagination.d.ts +5 -3
- package/dist/cjs/pagination.d.ts.map +1 -1
- package/dist/cjs/pagination.js +5 -6
- package/dist/cjs/pagination.js.map +1 -1
- package/dist/cjs/sdk.d.ts +976 -956
- package/dist/cjs/sdk.d.ts.map +1 -1
- package/dist/cjs/sdk.js +871 -347
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/errors.d.ts +96 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +149 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/generated/sdk.gen.d.ts +27 -1
- package/dist/esm/generated/sdk.gen.d.ts.map +1 -1
- package/dist/esm/generated/sdk.gen.js +27 -1
- package/dist/esm/generated/sdk.gen.js.map +1 -1
- package/dist/esm/generated/types.gen.d.ts +3 -3
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pagination.d.ts +5 -3
- package/dist/esm/pagination.d.ts.map +1 -1
- package/dist/esm/pagination.js +5 -6
- package/dist/esm/pagination.js.map +1 -1
- package/dist/esm/sdk.d.ts +976 -956
- package/dist/esm/sdk.d.ts.map +1 -1
- package/dist/esm/sdk.js +864 -342
- package/dist/esm/sdk.js.map +1 -1
- package/package.json +6 -2
|
@@ -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.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,yDAAyD;AACzD,MAAM,WAAW,qBAAqB;IACpC,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;IACd,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,oCAAoC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAG,OAAO,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;gBAEjB,IAAI,EAAE,qBAAqB;CAwBxC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAO9E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,OAAO,EAAE,OAAO,GAAG,SAAS,GAC3B,OAAO,CAaT"}
|
|
@@ -0,0 +1,149 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* Thrown for every non-2xx response from the Factorial API.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* try {
|
|
15
|
+
* await client.employees.employees.get({ path: { id: "1" } });
|
|
16
|
+
* } catch (err) {
|
|
17
|
+
* if (err instanceof FactorialApiError) {
|
|
18
|
+
* console.error(err.status, err.method, err.url, err.body);
|
|
19
|
+
* } else {
|
|
20
|
+
* throw err; // transport failure (e.g. a fetch TypeError)
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export class FactorialApiError extends Error {
|
|
26
|
+
/** HTTP status code, e.g. `401`. */
|
|
27
|
+
status;
|
|
28
|
+
/** HTTP reason phrase, e.g. `"Unauthorized"`. Empty over HTTP/2. */
|
|
29
|
+
statusText;
|
|
30
|
+
/** HTTP method of the failed request, e.g. `"GET"`. */
|
|
31
|
+
method;
|
|
32
|
+
/** Full request URL, including the query string. */
|
|
33
|
+
url;
|
|
34
|
+
/**
|
|
35
|
+
* Response body: the parsed JSON when the body was valid JSON, the raw string
|
|
36
|
+
* for non-JSON bodies, `undefined` when the body was empty.
|
|
37
|
+
*/
|
|
38
|
+
body;
|
|
39
|
+
/**
|
|
40
|
+
* Response headers. Rate-limit and request-id headers live here.
|
|
41
|
+
*
|
|
42
|
+
* Non-enumerable, so logging the error stays readable.
|
|
43
|
+
*/
|
|
44
|
+
headers;
|
|
45
|
+
/**
|
|
46
|
+
* The raw `Response`. Its body stream has already been consumed to populate
|
|
47
|
+
* {@link FactorialApiError.body} — read that instead.
|
|
48
|
+
*
|
|
49
|
+
* Non-enumerable, so logging the error stays readable.
|
|
50
|
+
*/
|
|
51
|
+
response;
|
|
52
|
+
constructor(init) {
|
|
53
|
+
super(formatMessage(init));
|
|
54
|
+
this.name = "FactorialApiError";
|
|
55
|
+
this.status = init.status;
|
|
56
|
+
this.statusText = init.statusText;
|
|
57
|
+
this.method = init.method;
|
|
58
|
+
this.url = init.url;
|
|
59
|
+
this.body = init.body;
|
|
60
|
+
// `headers` and `response` are hidden from enumeration: console.error(err)
|
|
61
|
+
// and JSON.stringify(err) would otherwise dump the whole Response object,
|
|
62
|
+
// burying the fields that identify the failure.
|
|
63
|
+
Object.defineProperty(this, "headers", {
|
|
64
|
+
value: init.headers ?? new Headers(),
|
|
65
|
+
enumerable: false,
|
|
66
|
+
writable: false,
|
|
67
|
+
configurable: true,
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(this, "response", {
|
|
70
|
+
value: init.response,
|
|
71
|
+
enumerable: false,
|
|
72
|
+
writable: false,
|
|
73
|
+
configurable: true,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* `instanceof`-safe check for {@link FactorialApiError}.
|
|
79
|
+
*
|
|
80
|
+
* Prefer `err instanceof FactorialApiError`. Use this helper when two copies of
|
|
81
|
+
* the package may be loaded at once (the ESM + CJS dual-package hazard), where
|
|
82
|
+
* `instanceof` can fail across realm boundaries.
|
|
83
|
+
*/
|
|
84
|
+
export function isFactorialApiError(error) {
|
|
85
|
+
return (error instanceof FactorialApiError ||
|
|
86
|
+
(typeof error === "object" &&
|
|
87
|
+
error !== null &&
|
|
88
|
+
error.name === "FactorialApiError"));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Converts the raw value thrown by the underlying fetch client for a non-2xx
|
|
92
|
+
* response (the parsed JSON body, the raw text, or `""`) into a
|
|
93
|
+
* {@link FactorialApiError}.
|
|
94
|
+
*
|
|
95
|
+
* Registered as the client's error interceptor by `FactorialClient`. Values
|
|
96
|
+
* that do not describe an HTTP error response are returned untouched:
|
|
97
|
+
*
|
|
98
|
+
* - no `Response` — a transport failure such as a `fetch` `TypeError`
|
|
99
|
+
* - an ok `Response` — a failure while parsing a 2xx body
|
|
100
|
+
* - an `Error` instance — already a usable error, e.g. thrown by a user
|
|
101
|
+
* interceptor
|
|
102
|
+
*/
|
|
103
|
+
export function toFactorialApiError(error, response, request) {
|
|
104
|
+
if (response === undefined || response.ok)
|
|
105
|
+
return error;
|
|
106
|
+
if (error instanceof Error)
|
|
107
|
+
return error;
|
|
108
|
+
return new FactorialApiError({
|
|
109
|
+
status: response.status,
|
|
110
|
+
statusText: response.statusText,
|
|
111
|
+
method: request?.method ?? "UNKNOWN",
|
|
112
|
+
url: request?.url ?? response.url,
|
|
113
|
+
// An empty body reaches us as "" because JSON.parse("") throws upstream.
|
|
114
|
+
body: error === "" ? undefined : error,
|
|
115
|
+
headers: response.headers,
|
|
116
|
+
response,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/** Longest body excerpt appended to the error message. */
|
|
120
|
+
const EXCERPT_MAX_LENGTH = 200;
|
|
121
|
+
function formatMessage({ status, statusText, method, url, body, }) {
|
|
122
|
+
const head = `Factorial API ${status}${statusText ? ` ${statusText}` : ""}: ${method} ${url}`;
|
|
123
|
+
const excerpt = bodyExcerpt(body);
|
|
124
|
+
return excerpt ? `${head} — ${excerpt}` : head;
|
|
125
|
+
}
|
|
126
|
+
function bodyExcerpt(body) {
|
|
127
|
+
if (body === undefined || body === null || body === "")
|
|
128
|
+
return undefined;
|
|
129
|
+
let text;
|
|
130
|
+
if (typeof body === "string") {
|
|
131
|
+
text = body;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
try {
|
|
135
|
+
text = JSON.stringify(body) ?? String(body);
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// Circular structures and BigInt values make JSON.stringify throw.
|
|
139
|
+
text = String(body);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const oneLine = text.replace(/\s+/g, " ").trim();
|
|
143
|
+
if (!oneLine)
|
|
144
|
+
return undefined;
|
|
145
|
+
return oneLine.length > EXCERPT_MAX_LENGTH
|
|
146
|
+
? `${oneLine.slice(0, EXCERPT_MAX_LENGTH)}…`
|
|
147
|
+
: oneLine;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAuBH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,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;;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,SAAS,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC;QAAC,MAAM,CAAC;YACP,mEAAmE;YACnE,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;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"}
|
|
@@ -728,7 +728,33 @@ export declare const getApi20261001ResourcesCompensationsPayrollResultsById: <Th
|
|
|
728
728
|
/**
|
|
729
729
|
* Bulk creates a Payroll result
|
|
730
730
|
*
|
|
731
|
-
* Imports payroll result amounts for employees of
|
|
731
|
+
* Imports payroll result amounts for employees of an existing payroll run, for example the
|
|
732
|
+
* figures returned by an external payroll provider. Only Factorial ids are accepted.
|
|
733
|
+
*
|
|
734
|
+
* The import is atomic: the whole request is validated before anything is written, and any
|
|
735
|
+
* error rejects it entirely. A 4xx or 5xx response means nothing was written, so a failed
|
|
736
|
+
* request can be retried as is.
|
|
737
|
+
*
|
|
738
|
+
* The request is rejected when:
|
|
739
|
+
* - it has no results, an employee entry has no items, it carries more than 1,000 amounts,
|
|
740
|
+
* or it repeats an employee or a concept for the same employee
|
|
741
|
+
* - the payroll run, an employee or a payroll concept does not exist in the company
|
|
742
|
+
* - an employee is not part of the payroll run, that is, is not one of the employees
|
|
743
|
+
* Factorial lists in that run. On regular runs the employee's contract must cover the run
|
|
744
|
+
* period, they must not have been terminated more than 60 days before the run starts and,
|
|
745
|
+
* when the run's cycle is limited to a people group, they must belong to it. Off-cycle
|
|
746
|
+
* runs only apply the people group and a 365-day termination window. The error lists
|
|
747
|
+
* these employees in `errors.employee_ids`, so they can be removed and the rest resent.
|
|
748
|
+
* - a concept is a base salary concept or is disabled
|
|
749
|
+
* - an employee entry does not include the company's net_pay concept (find its id with
|
|
750
|
+
* compensations/concepts)
|
|
751
|
+
* - an amount is outside the signed 32-bit integer range
|
|
752
|
+
*
|
|
753
|
+
* Re-posting an (employee, concept) pair replaces its amount and keeps the row id. Pairs not
|
|
754
|
+
* included in the request are left untouched; there is no delete. Split larger payrolls into
|
|
755
|
+
* requests of up to 1,000 amounts, keeping all of an employee's items in the same request.
|
|
756
|
+
* Requires the "Import payroll results" permission.
|
|
757
|
+
*
|
|
732
758
|
*/
|
|
733
759
|
export declare const postApi20261001ResourcesCompensationsPayrollResultsBulkCreate: <ThrowOnError extends boolean = false>(options?: Options<PostApi20261001ResourcesCompensationsPayrollResultsBulkCreateData, ThrowOnError>) => RequestResult<PostApi20261001ResourcesCompensationsPayrollResultsBulkCreateResponses, unknown, ThrowOnError>;
|
|
734
760
|
/**
|