@kombo-api/sdk 0.2.0 → 0.2.1
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/esm/funcs/generalSendPassthroughRequest.d.ts +1 -0
- package/esm/funcs/generalSendPassthroughRequest.d.ts.map +1 -1
- package/esm/funcs/generalSendPassthroughRequest.js +1 -0
- package/esm/funcs/generalSendPassthroughRequest.js.map +1 -1
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/models/deletehrisabsencesabsenceidpositiveresponse.d.ts.map +1 -1
- package/esm/models/deletehrisabsencesabsenceidpositiveresponse.js +2 -6
- package/esm/models/deletehrisabsencesabsenceidpositiveresponse.js.map +1 -1
- package/esm/models/getatsjobspositiveresponse.d.ts.map +1 -1
- package/esm/models/getatsjobspositiveresponse.js +6 -26
- package/esm/models/getatsjobspositiveresponse.js.map +1 -1
- package/esm/models/gethrisabsencespositiveresponse.d.ts.map +1 -1
- package/esm/models/gethrisabsencespositiveresponse.js +2 -6
- package/esm/models/gethrisabsencespositiveresponse.js.map +1 -1
- package/esm/models/gethrisemployeespositiveresponse.d.ts +4 -0
- package/esm/models/gethrisemployeespositiveresponse.d.ts.map +1 -1
- package/esm/models/gethrisemployeespositiveresponse.js +11 -46
- package/esm/models/gethrisemployeespositiveresponse.js.map +1 -1
- package/esm/models/gethrisemploymentspositiveresponse.d.ts.map +1 -1
- package/esm/models/gethrisemploymentspositiveresponse.js +4 -16
- package/esm/models/gethrisemploymentspositiveresponse.js.map +1 -1
- package/esm/models/postconnectcreatelinkrequestbody.d.ts +2 -0
- package/esm/models/postconnectcreatelinkrequestbody.d.ts.map +1 -1
- package/esm/models/postconnectcreatelinkrequestbody.js +2 -0
- package/esm/models/postconnectcreatelinkrequestbody.js.map +1 -1
- package/esm/models/posthrisabsencespositiveresponse.d.ts.map +1 -1
- package/esm/models/posthrisabsencespositiveresponse.js +2 -6
- package/esm/models/posthrisabsencespositiveresponse.js.map +1 -1
- package/esm/sdk/general.d.ts +1 -0
- package/esm/sdk/general.d.ts.map +1 -1
- package/esm/sdk/general.js +1 -0
- package/esm/sdk/general.js.map +1 -1
- package/esm/types/enums.d.ts +10 -6
- package/esm/types/enums.d.ts.map +1 -1
- package/esm/types/enums.js +38 -1
- package/esm/types/enums.js.map +1 -1
- package/esm/types/index.d.ts +0 -1
- package/esm/types/index.d.ts.map +1 -1
- package/esm/types/index.js +0 -1
- package/esm/types/index.js.map +1 -1
- package/examples/package-lock.json +4 -2
- package/jsr.json +1 -1
- package/package.json +6 -3
- package/src/funcs/generalSendPassthroughRequest.ts +1 -0
- package/src/lib/config.ts +3 -3
- package/src/models/deletehrisabsencesabsenceidpositiveresponse.ts +5 -6
- package/src/models/getatsjobspositiveresponse.ts +7 -26
- package/src/models/gethrisabsencespositiveresponse.ts +3 -6
- package/src/models/gethrisemployeespositiveresponse.ts +16 -46
- package/src/models/gethrisemploymentspositiveresponse.ts +5 -16
- package/src/models/postconnectcreatelinkrequestbody.ts +2 -0
- package/src/models/posthrisabsencespositiveresponse.ts +3 -6
- package/src/sdk/general.ts +1 -0
- package/src/types/enums.ts +55 -6
- package/src/types/index.ts +0 -1
- package/tests/basic-behavior.spec.ts +162 -0
- package/tests/error-handling.spec.ts +604 -0
- package/tests/helpers/test-context.ts +147 -0
- package/tests/job-board.spec.ts +32 -0
- package/vitest.config.ts +8 -0
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
-
import
|
|
7
|
+
import * as openEnums from "../types/enums.js";
|
|
8
|
+
import { ClosedEnum, OpenEnum } from "../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
10
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
11
|
|
|
@@ -542,55 +543,35 @@ export const GetAtsJobsPositiveResponseEmploymentType$inboundSchema: z.ZodType<
|
|
|
542
543
|
GetAtsJobsPositiveResponseEmploymentType,
|
|
543
544
|
z.ZodTypeDef,
|
|
544
545
|
unknown
|
|
545
|
-
> =
|
|
546
|
-
.union([
|
|
547
|
-
z.nativeEnum(GetAtsJobsPositiveResponseEmploymentType),
|
|
548
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
549
|
-
]);
|
|
546
|
+
> = openEnums.inboundSchema(GetAtsJobsPositiveResponseEmploymentType);
|
|
550
547
|
|
|
551
548
|
/** @internal */
|
|
552
549
|
export const GetAtsJobsPositiveResponseStatus$inboundSchema: z.ZodType<
|
|
553
550
|
GetAtsJobsPositiveResponseStatus,
|
|
554
551
|
z.ZodTypeDef,
|
|
555
552
|
unknown
|
|
556
|
-
> =
|
|
557
|
-
.union([
|
|
558
|
-
z.nativeEnum(GetAtsJobsPositiveResponseStatus),
|
|
559
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
560
|
-
]);
|
|
553
|
+
> = openEnums.inboundSchema(GetAtsJobsPositiveResponseStatus);
|
|
561
554
|
|
|
562
555
|
/** @internal */
|
|
563
556
|
export const Visibility$inboundSchema: z.ZodType<
|
|
564
557
|
Visibility,
|
|
565
558
|
z.ZodTypeDef,
|
|
566
559
|
unknown
|
|
567
|
-
> =
|
|
568
|
-
.union([
|
|
569
|
-
z.nativeEnum(Visibility),
|
|
570
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
571
|
-
]);
|
|
560
|
+
> = openEnums.inboundSchema(Visibility);
|
|
572
561
|
|
|
573
562
|
/** @internal */
|
|
574
563
|
export const RemoteWorkStatus$inboundSchema: z.ZodType<
|
|
575
564
|
RemoteWorkStatus,
|
|
576
565
|
z.ZodTypeDef,
|
|
577
566
|
unknown
|
|
578
|
-
> =
|
|
579
|
-
.union([
|
|
580
|
-
z.nativeEnum(RemoteWorkStatus),
|
|
581
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
582
|
-
]);
|
|
567
|
+
> = openEnums.inboundSchema(RemoteWorkStatus);
|
|
583
568
|
|
|
584
569
|
/** @internal */
|
|
585
570
|
export const SalaryPeriod$inboundSchema: z.ZodType<
|
|
586
571
|
SalaryPeriod,
|
|
587
572
|
z.ZodTypeDef,
|
|
588
573
|
unknown
|
|
589
|
-
> =
|
|
590
|
-
.union([
|
|
591
|
-
z.nativeEnum(SalaryPeriod),
|
|
592
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
593
|
-
]);
|
|
574
|
+
> = openEnums.inboundSchema(SalaryPeriod);
|
|
594
575
|
|
|
595
576
|
/** @internal */
|
|
596
577
|
export const GetAtsJobsPositiveResponseLocation$inboundSchema: z.ZodType<
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
-
import
|
|
7
|
+
import * as openEnums from "../types/enums.js";
|
|
8
|
+
import { ClosedEnum, OpenEnum } from "../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
10
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
11
|
|
|
@@ -173,11 +174,7 @@ export const GetHrisAbsencesPositiveResponseStatus$inboundSchema: z.ZodType<
|
|
|
173
174
|
GetHrisAbsencesPositiveResponseStatus,
|
|
174
175
|
z.ZodTypeDef,
|
|
175
176
|
unknown
|
|
176
|
-
> =
|
|
177
|
-
.union([
|
|
178
|
-
z.nativeEnum(GetHrisAbsencesPositiveResponseStatus),
|
|
179
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
180
|
-
]);
|
|
177
|
+
> = openEnums.inboundSchema(GetHrisAbsencesPositiveResponseStatus);
|
|
181
178
|
|
|
182
179
|
/** @internal */
|
|
183
180
|
export const GetHrisAbsencesPositiveResponseTypeUnit$inboundSchema:
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
-
import
|
|
7
|
+
import * as openEnums from "../types/enums.js";
|
|
8
|
+
import { ClosedEnum, OpenEnum } from "../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
10
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
11
|
|
|
@@ -355,6 +356,10 @@ export type Manager = {
|
|
|
355
356
|
* The globally unique ID of this object generated by Kombo. We recommend using this as a stable primary key for syncing.
|
|
356
357
|
*/
|
|
357
358
|
id: string;
|
|
359
|
+
/**
|
|
360
|
+
* The employee’s organization-internal employee number.
|
|
361
|
+
*/
|
|
362
|
+
employee_number: string | null;
|
|
358
363
|
/**
|
|
359
364
|
* The employee’s work email address. If the email address is invalid, we will set this to `null`.
|
|
360
365
|
*/
|
|
@@ -688,44 +693,28 @@ export const GetHrisEmployeesPositiveResponseGender$inboundSchema: z.ZodType<
|
|
|
688
693
|
GetHrisEmployeesPositiveResponseGender,
|
|
689
694
|
z.ZodTypeDef,
|
|
690
695
|
unknown
|
|
691
|
-
> =
|
|
692
|
-
.union([
|
|
693
|
-
z.nativeEnum(GetHrisEmployeesPositiveResponseGender),
|
|
694
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
695
|
-
]);
|
|
696
|
+
> = openEnums.inboundSchema(GetHrisEmployeesPositiveResponseGender);
|
|
696
697
|
|
|
697
698
|
/** @internal */
|
|
698
699
|
export const Ethnicity$inboundSchema: z.ZodType<
|
|
699
700
|
Ethnicity,
|
|
700
701
|
z.ZodTypeDef,
|
|
701
702
|
unknown
|
|
702
|
-
> =
|
|
703
|
-
.union([
|
|
704
|
-
z.nativeEnum(Ethnicity),
|
|
705
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
706
|
-
]);
|
|
703
|
+
> = openEnums.inboundSchema(Ethnicity);
|
|
707
704
|
|
|
708
705
|
/** @internal */
|
|
709
706
|
export const MaritalStatus$inboundSchema: z.ZodType<
|
|
710
707
|
MaritalStatus,
|
|
711
708
|
z.ZodTypeDef,
|
|
712
709
|
unknown
|
|
713
|
-
> =
|
|
714
|
-
.union([
|
|
715
|
-
z.nativeEnum(MaritalStatus),
|
|
716
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
717
|
-
]);
|
|
710
|
+
> = openEnums.inboundSchema(MaritalStatus);
|
|
718
711
|
|
|
719
712
|
/** @internal */
|
|
720
713
|
export const EmploymentStatus$inboundSchema: z.ZodType<
|
|
721
714
|
EmploymentStatus,
|
|
722
715
|
z.ZodTypeDef,
|
|
723
716
|
unknown
|
|
724
|
-
> =
|
|
725
|
-
.union([
|
|
726
|
-
z.nativeEnum(EmploymentStatus),
|
|
727
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
728
|
-
]);
|
|
717
|
+
> = openEnums.inboundSchema(EmploymentStatus);
|
|
729
718
|
|
|
730
719
|
/** @internal */
|
|
731
720
|
export const GetHrisEmployeesPositiveResponseEmploymentType$inboundSchema:
|
|
@@ -733,11 +722,7 @@ export const GetHrisEmployeesPositiveResponseEmploymentType$inboundSchema:
|
|
|
733
722
|
GetHrisEmployeesPositiveResponseEmploymentType,
|
|
734
723
|
z.ZodTypeDef,
|
|
735
724
|
unknown
|
|
736
|
-
> =
|
|
737
|
-
.union([
|
|
738
|
-
z.nativeEnum(GetHrisEmployeesPositiveResponseEmploymentType),
|
|
739
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
740
|
-
]);
|
|
725
|
+
> = openEnums.inboundSchema(GetHrisEmployeesPositiveResponseEmploymentType);
|
|
741
726
|
|
|
742
727
|
/** @internal */
|
|
743
728
|
export const HomeAddress$inboundSchema: z.ZodType<
|
|
@@ -820,11 +805,7 @@ export const GetHrisEmployeesPositiveResponsePayPeriod$inboundSchema: z.ZodType<
|
|
|
820
805
|
GetHrisEmployeesPositiveResponsePayPeriod,
|
|
821
806
|
z.ZodTypeDef,
|
|
822
807
|
unknown
|
|
823
|
-
> =
|
|
824
|
-
.union([
|
|
825
|
-
z.nativeEnum(GetHrisEmployeesPositiveResponsePayPeriod),
|
|
826
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
827
|
-
]);
|
|
808
|
+
> = openEnums.inboundSchema(GetHrisEmployeesPositiveResponsePayPeriod);
|
|
828
809
|
|
|
829
810
|
/** @internal */
|
|
830
811
|
export const GetHrisEmployeesPositiveResponsePayFrequency$inboundSchema:
|
|
@@ -832,22 +813,14 @@ export const GetHrisEmployeesPositiveResponsePayFrequency$inboundSchema:
|
|
|
832
813
|
GetHrisEmployeesPositiveResponsePayFrequency,
|
|
833
814
|
z.ZodTypeDef,
|
|
834
815
|
unknown
|
|
835
|
-
> =
|
|
836
|
-
.union([
|
|
837
|
-
z.nativeEnum(GetHrisEmployeesPositiveResponsePayFrequency),
|
|
838
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
839
|
-
]);
|
|
816
|
+
> = openEnums.inboundSchema(GetHrisEmployeesPositiveResponsePayFrequency);
|
|
840
817
|
|
|
841
818
|
/** @internal */
|
|
842
819
|
export const EmploymentEmploymentType$inboundSchema: z.ZodType<
|
|
843
820
|
EmploymentEmploymentType,
|
|
844
821
|
z.ZodTypeDef,
|
|
845
822
|
unknown
|
|
846
|
-
> =
|
|
847
|
-
.union([
|
|
848
|
-
z.nativeEnum(EmploymentEmploymentType),
|
|
849
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
850
|
-
]);
|
|
823
|
+
> = openEnums.inboundSchema(EmploymentEmploymentType);
|
|
851
824
|
|
|
852
825
|
/** @internal */
|
|
853
826
|
export const Employment$inboundSchema: z.ZodType<
|
|
@@ -936,11 +909,7 @@ export const ManagerEmploymentStatus$inboundSchema: z.ZodType<
|
|
|
936
909
|
ManagerEmploymentStatus,
|
|
937
910
|
z.ZodTypeDef,
|
|
938
911
|
unknown
|
|
939
|
-
> =
|
|
940
|
-
.union([
|
|
941
|
-
z.nativeEnum(ManagerEmploymentStatus),
|
|
942
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
943
|
-
]);
|
|
912
|
+
> = openEnums.inboundSchema(ManagerEmploymentStatus);
|
|
944
913
|
|
|
945
914
|
/** @internal */
|
|
946
915
|
export const Manager$inboundSchema: z.ZodType<Manager, z.ZodTypeDef, unknown> =
|
|
@@ -949,6 +918,7 @@ export const Manager$inboundSchema: z.ZodType<Manager, z.ZodTypeDef, unknown> =
|
|
|
949
918
|
last_name: z.nullable(z.string()),
|
|
950
919
|
display_full_name: z.nullable(z.string()),
|
|
951
920
|
id: z.string(),
|
|
921
|
+
employee_number: z.nullable(z.string()),
|
|
952
922
|
work_email: z.nullable(z.string()).optional(),
|
|
953
923
|
remote_id: z.string(),
|
|
954
924
|
employment_status: z.nullable(ManagerEmploymentStatus$inboundSchema)
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
-
import
|
|
7
|
+
import * as openEnums from "../types/enums.js";
|
|
8
|
+
import { OpenEnum } from "../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
10
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
11
|
|
|
@@ -154,11 +155,7 @@ export const GetHrisEmploymentsPositiveResponsePayPeriod$inboundSchema:
|
|
|
154
155
|
GetHrisEmploymentsPositiveResponsePayPeriod,
|
|
155
156
|
z.ZodTypeDef,
|
|
156
157
|
unknown
|
|
157
|
-
> =
|
|
158
|
-
.union([
|
|
159
|
-
z.nativeEnum(GetHrisEmploymentsPositiveResponsePayPeriod),
|
|
160
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
161
|
-
]);
|
|
158
|
+
> = openEnums.inboundSchema(GetHrisEmploymentsPositiveResponsePayPeriod);
|
|
162
159
|
|
|
163
160
|
/** @internal */
|
|
164
161
|
export const GetHrisEmploymentsPositiveResponsePayFrequency$inboundSchema:
|
|
@@ -166,11 +163,7 @@ export const GetHrisEmploymentsPositiveResponsePayFrequency$inboundSchema:
|
|
|
166
163
|
GetHrisEmploymentsPositiveResponsePayFrequency,
|
|
167
164
|
z.ZodTypeDef,
|
|
168
165
|
unknown
|
|
169
|
-
> =
|
|
170
|
-
.union([
|
|
171
|
-
z.nativeEnum(GetHrisEmploymentsPositiveResponsePayFrequency),
|
|
172
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
173
|
-
]);
|
|
166
|
+
> = openEnums.inboundSchema(GetHrisEmploymentsPositiveResponsePayFrequency);
|
|
174
167
|
|
|
175
168
|
/** @internal */
|
|
176
169
|
export const GetHrisEmploymentsPositiveResponseEmploymentType$inboundSchema:
|
|
@@ -178,11 +171,7 @@ export const GetHrisEmploymentsPositiveResponseEmploymentType$inboundSchema:
|
|
|
178
171
|
GetHrisEmploymentsPositiveResponseEmploymentType,
|
|
179
172
|
z.ZodTypeDef,
|
|
180
173
|
unknown
|
|
181
|
-
> =
|
|
182
|
-
.union([
|
|
183
|
-
z.nativeEnum(GetHrisEmploymentsPositiveResponseEmploymentType),
|
|
184
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
185
|
-
]);
|
|
174
|
+
> = openEnums.inboundSchema(GetHrisEmploymentsPositiveResponseEmploymentType);
|
|
186
175
|
|
|
187
176
|
/** @internal */
|
|
188
177
|
export const GetHrisEmploymentsPositiveResponseResult$inboundSchema: z.ZodType<
|
|
@@ -172,6 +172,8 @@ export const IntegrationTool = {
|
|
|
172
172
|
Absenceio: "absenceio",
|
|
173
173
|
Manatal: "manatal",
|
|
174
174
|
Avionte: "avionte",
|
|
175
|
+
A3innuvanomina: "a3innuvanomina",
|
|
176
|
+
Mhmhr: "mhmhr",
|
|
175
177
|
Scim: "scim",
|
|
176
178
|
Softgardenpartner: "softgardenpartner",
|
|
177
179
|
Datevhr: "datevhr",
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
-
import
|
|
7
|
+
import * as openEnums from "../types/enums.js";
|
|
8
|
+
import { ClosedEnum, OpenEnum } from "../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
10
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
11
|
|
|
@@ -124,11 +125,7 @@ export const PostHrisAbsencesPositiveResponseStatus$inboundSchema: z.ZodType<
|
|
|
124
125
|
PostHrisAbsencesPositiveResponseStatus,
|
|
125
126
|
z.ZodTypeDef,
|
|
126
127
|
unknown
|
|
127
|
-
> =
|
|
128
|
-
.union([
|
|
129
|
-
z.nativeEnum(PostHrisAbsencesPositiveResponseStatus),
|
|
130
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
131
|
-
]);
|
|
128
|
+
> = openEnums.inboundSchema(PostHrisAbsencesPositiveResponseStatus);
|
|
132
129
|
|
|
133
130
|
/** @internal */
|
|
134
131
|
export const PostHrisAbsencesPositiveResponseData$inboundSchema: z.ZodType<
|
package/src/sdk/general.ts
CHANGED
|
@@ -198,6 +198,7 @@ export class General extends ClientSDK {
|
|
|
198
198
|
* |Manatal|`manatal/open-api-v3`|[Manatal's Open API v3](https://developers.manatal.com/reference/getting-started). We automatically authenticate all requests and use `https://api.manatal.com/open/v3` as the base URL.|
|
|
199
199
|
* |Manatal|`manatal/career-page`|Manatal's Career Page API. We use `https://api.manatal.com/open/v3/career-page/\{client_slug\}` as the base URL.|
|
|
200
200
|
* |Avionté|`avionte/front-office-v1`|Avionte's API. We automatically authenticate all requests and use `https://api.avionte.com/front-office/v1` as the base URL. Documentation for the BOLD Front Office API: https://developer.avionte.com/reference/get-all-talent-tags|
|
|
201
|
+
* |a3innuva Nómina|`a3innuvanomina/laboral`|a3innuva Nómina API [docs](https://a3developers.wolterskluwer.es/). Requests are automatically authenticated using OAuth access tokens (refreshed when needed). Base URL: `https://a3api.wolterskluwer.es/Laboral/api`.|
|
|
201
202
|
* |DATEV|`datevhr/hr-exports`|DATEV's [hr-exports](https://developer.datev.de/en/product-detail/hr-exports/1.0.0/overview). We automatically authenticate all requests and use `https://hr-exports.api.datev.de/\{platform|platform-sandbox\}/v1/clients/\{client-id\}` as the base URL.|
|
|
202
203
|
* |DATEV|`datevhr/hr:payrollreports`|DATEV's [hr:payrollreports](https://developer.datev.de/en/product-detail/hr-payrollreports/2.0.0/overview) API. We automatically authenticate all requests and use `https://hr-payrollreports.api.datev.de/\{platform|platform-sandbox\}/v1/clients/\{client-id\}/` as the base URL.|
|
|
203
204
|
* |DATEV|`datevhr/eau`|DATEV's [eau](https://developer.datev.de/en/product-detail/eau-api/1.0.0/overview) API. We automatically authenticate all requests and use `https://eau.api.datev.de/\{platform|platform-sandbox\}/v1/clients/\{client-id\}/` as the base URL.|
|
package/src/types/enums.ts
CHANGED
|
@@ -2,15 +2,64 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
|
|
5
7
|
declare const __brand: unique symbol;
|
|
6
8
|
export type Unrecognized<T> = T & { [__brand]: "unrecognized" };
|
|
9
|
+
export type ClosedEnum<T extends Readonly<Record<string, string | number>>> =
|
|
10
|
+
T[keyof T];
|
|
11
|
+
export type OpenEnum<T extends Readonly<Record<string, string | number>>> =
|
|
12
|
+
| T[keyof T]
|
|
13
|
+
| Unrecognized<T[keyof T] extends number ? number : string>;
|
|
7
14
|
|
|
8
|
-
|
|
15
|
+
function unrecognized<T>(value: T): Unrecognized<T> {
|
|
16
|
+
unrecognizedCount++;
|
|
9
17
|
return value as Unrecognized<T>;
|
|
10
18
|
}
|
|
11
19
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
let unrecognizedCount = 0;
|
|
21
|
+
let refCount = 0;
|
|
22
|
+
export function unrecognizedCounter() {
|
|
23
|
+
refCount++;
|
|
24
|
+
const start = unrecognizedCount;
|
|
25
|
+
return {
|
|
26
|
+
count: () => {
|
|
27
|
+
const count = unrecognizedCount - start;
|
|
28
|
+
if (--refCount === 0) unrecognizedCount = 0;
|
|
29
|
+
return count;
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function inboundSchema<T extends Record<string, string>>(
|
|
35
|
+
enumObj: T,
|
|
36
|
+
): z.ZodType<OpenEnum<T>, z.ZodTypeDef, unknown> {
|
|
37
|
+
const options = Object.values(enumObj);
|
|
38
|
+
return z.union([
|
|
39
|
+
...options.map(x => z.literal(x)),
|
|
40
|
+
z.string().transform(x => unrecognized(x)),
|
|
41
|
+
] as any);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function inboundSchemaInt<T extends Record<string, number | string>>(
|
|
45
|
+
enumObj: T,
|
|
46
|
+
): z.ZodType<OpenEnum<T>, z.ZodTypeDef, unknown> {
|
|
47
|
+
// For numeric enums, Object.values returns both numbers and string keys
|
|
48
|
+
const options = Object.values(enumObj).filter(v => typeof v === "number");
|
|
49
|
+
return z.union([
|
|
50
|
+
...options.map(x => z.literal(x)),
|
|
51
|
+
z.number().int().transform(x => unrecognized(x)),
|
|
52
|
+
] as any);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function outboundSchema<T extends Record<string, string>>(
|
|
56
|
+
_: T,
|
|
57
|
+
): z.ZodType<string, z.ZodTypeDef, OpenEnum<T>> {
|
|
58
|
+
return z.string() as any;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function outboundSchemaInt<T extends Record<string, number | string>>(
|
|
62
|
+
_: T,
|
|
63
|
+
): z.ZodType<number, z.ZodTypeDef, OpenEnum<T>> {
|
|
64
|
+
return z.number().int() as any;
|
|
65
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
export { blobLikeSchema, isBlobLike } from "./blobs.js";
|
|
6
|
-
export { catchUnrecognizedEnum } from "./enums.js";
|
|
7
6
|
export type { ClosedEnum, OpenEnum, Unrecognized } from "./enums.js";
|
|
8
7
|
export type { Result } from "./fp.js";
|
|
9
8
|
export type { PageIterator, Paginator } from "./operations.js";
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { it, expect } from "vitest";
|
|
2
|
+
import { TestContext, describeSdkSuite } from "./helpers/test-context";
|
|
3
|
+
|
|
4
|
+
// TODO: test basic error handling behavior
|
|
5
|
+
describeSdkSuite("Basic SDK Behavior", () => {
|
|
6
|
+
it("should include API key in Authorization header", async () => {
|
|
7
|
+
const ctx = new TestContext({ apiKey: "my-custom-api-key" });
|
|
8
|
+
|
|
9
|
+
ctx.mockEndpoint({
|
|
10
|
+
method: "GET",
|
|
11
|
+
path: "/v1/ats/jobs",
|
|
12
|
+
response: {
|
|
13
|
+
body: {
|
|
14
|
+
status: "success",
|
|
15
|
+
data: { results: [], next: null },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const jobs = await ctx.kombo.ats.getJobs({});
|
|
21
|
+
for await (const _page of jobs) {
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const request = ctx.getLastRequest();
|
|
26
|
+
expect(request?.headers.authorization).toBe("Bearer my-custom-api-key");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should include integration ID in X-Integration-Id header when specified", async () => {
|
|
30
|
+
const ctx = new TestContext({
|
|
31
|
+
apiKey: "test-key",
|
|
32
|
+
integrationId: "my-integration-123",
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
ctx.mockEndpoint({
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: "/v1/ats/jobs",
|
|
38
|
+
response: {
|
|
39
|
+
body: {
|
|
40
|
+
status: "success",
|
|
41
|
+
data: { results: [], next: null },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const jobs = await ctx.kombo.ats.getJobs({});
|
|
47
|
+
for await (const _page of jobs) {
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const request = ctx.getLastRequest();
|
|
52
|
+
expect(request?.headers["x-integration-id"]).toBe("my-integration-123");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("should not include X-Integration-Id header when not provided", async () => {
|
|
56
|
+
const ctx = new TestContext({
|
|
57
|
+
apiKey: "test-key",
|
|
58
|
+
integrationId: undefined,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
ctx.mockEndpoint({
|
|
62
|
+
method: "GET",
|
|
63
|
+
path: "/v1/ats/jobs",
|
|
64
|
+
response: {
|
|
65
|
+
body: {
|
|
66
|
+
status: "success",
|
|
67
|
+
data: { results: [], next: null },
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// TODO: shouldn't this throw an error?
|
|
73
|
+
const jobs = await ctx.kombo.ats.getJobs({});
|
|
74
|
+
for await (const _page of jobs) {
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const request = ctx.getLastRequest();
|
|
79
|
+
// When integration ID is undefined, the header is not set
|
|
80
|
+
expect(request?.headers["x-integration-id"]).toBeUndefined();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("should correctly encode comma-separated query parameters", async () => {
|
|
84
|
+
const ctx = new TestContext();
|
|
85
|
+
|
|
86
|
+
ctx.mockEndpoint({
|
|
87
|
+
method: "GET",
|
|
88
|
+
path: "/v1/ats/jobs",
|
|
89
|
+
response: {
|
|
90
|
+
body: {
|
|
91
|
+
status: "success",
|
|
92
|
+
data: {
|
|
93
|
+
results: [],
|
|
94
|
+
next: null,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Make the API call
|
|
101
|
+
const _jobs = await ctx.kombo.ats.getJobs({
|
|
102
|
+
statuses: ["OPEN", "CLOSED"],
|
|
103
|
+
ids: ["CPDifhHr7izJhKHmGPkXqknC", "J7znt8TJRiwPVA7paC2iCh8u"],
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// Verify and snapshot the request details
|
|
107
|
+
const request = ctx.getLastRequest();
|
|
108
|
+
expect(request.path).toMatchInlineSnapshot(
|
|
109
|
+
`"/v1/ats/jobs?ids=CPDifhHr7izJhKHmGPkXqknC%2CJ7znt8TJRiwPVA7paC2iCh8u&statuses=OPEN%2CCLOSED&include_deleted=false&page_size=100"`
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("should correctly encode boolean query parameters", async () => {
|
|
114
|
+
const ctx = new TestContext();
|
|
115
|
+
|
|
116
|
+
ctx.mockEndpoint({
|
|
117
|
+
method: "GET",
|
|
118
|
+
path: "/v1/ats/jobs",
|
|
119
|
+
response: {
|
|
120
|
+
body: {
|
|
121
|
+
status: "success",
|
|
122
|
+
data: { results: [], next: null },
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Test with boolean true
|
|
128
|
+
const jobsWithDeleted = await ctx.kombo.ats.getJobs({
|
|
129
|
+
include_deleted: true,
|
|
130
|
+
});
|
|
131
|
+
for await (const _page of jobsWithDeleted) {
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const requestWithDeleted = ctx.getLastRequest();
|
|
136
|
+
expect(requestWithDeleted.path).toContain("include_deleted=true");
|
|
137
|
+
|
|
138
|
+
ctx.clear();
|
|
139
|
+
|
|
140
|
+
ctx.mockEndpoint({
|
|
141
|
+
method: "GET",
|
|
142
|
+
path: "/v1/ats/jobs",
|
|
143
|
+
response: {
|
|
144
|
+
body: {
|
|
145
|
+
status: "success",
|
|
146
|
+
data: { results: [], next: null },
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// Test with boolean false
|
|
152
|
+
const jobsWithoutDeleted = await ctx.kombo.ats.getJobs({
|
|
153
|
+
include_deleted: false,
|
|
154
|
+
});
|
|
155
|
+
for await (const _page of jobsWithoutDeleted) {
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const requestWithoutDeleted = ctx.getLastRequest();
|
|
160
|
+
expect(requestWithoutDeleted.path).toContain("include_deleted=false");
|
|
161
|
+
});
|
|
162
|
+
});
|