@maesn/typescript-sdk 0.8.22 → 0.8.24

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 (48) hide show
  1. package/README.md +4 -0
  2. package/esm/funcs/accounting-create-booking-proposal-attachment.d.ts +11 -0
  3. package/esm/funcs/accounting-create-booking-proposal-attachment.d.ts.map +1 -0
  4. package/esm/funcs/accounting-create-booking-proposal-attachment.js +103 -0
  5. package/esm/funcs/accounting-create-booking-proposal-attachment.js.map +1 -0
  6. package/esm/funcs/accounting-create-vendor-credit.js +1 -1
  7. package/esm/funcs/accounting-create-vendor-credit.js.map +1 -1
  8. package/esm/funcs/accounting-delete-journal-entry.d.ts +11 -0
  9. package/esm/funcs/accounting-delete-journal-entry.d.ts.map +1 -0
  10. package/esm/funcs/accounting-delete-journal-entry.js +81 -0
  11. package/esm/funcs/accounting-delete-journal-entry.js.map +1 -0
  12. package/esm/lib/config.d.ts +3 -3
  13. package/esm/lib/config.js +3 -3
  14. package/esm/models/operations/create-booking-proposal-attachment.d.ts +109 -0
  15. package/esm/models/operations/create-booking-proposal-attachment.d.ts.map +1 -0
  16. package/esm/models/operations/create-booking-proposal-attachment.js +90 -0
  17. package/esm/models/operations/create-booking-proposal-attachment.js.map +1 -0
  18. package/esm/models/operations/create-pass-through-request.d.ts +4 -4
  19. package/esm/models/operations/create-pass-through-request.d.ts.map +1 -1
  20. package/esm/models/operations/create-pass-through-request.js +4 -4
  21. package/esm/models/operations/create-pass-through-request.js.map +1 -1
  22. package/esm/models/operations/delete-journal-entry.d.ts +80 -0
  23. package/esm/models/operations/delete-journal-entry.d.ts.map +1 -0
  24. package/esm/models/operations/delete-journal-entry.js +63 -0
  25. package/esm/models/operations/delete-journal-entry.js.map +1 -0
  26. package/esm/models/operations/index.d.ts +2 -0
  27. package/esm/models/operations/index.d.ts.map +1 -1
  28. package/esm/models/operations/index.js +2 -0
  29. package/esm/models/operations/index.js.map +1 -1
  30. package/esm/sdk/accounting.d.ts +2 -0
  31. package/esm/sdk/accounting.d.ts.map +1 -1
  32. package/esm/sdk/accounting.js +8 -0
  33. package/esm/sdk/accounting.js.map +1 -1
  34. package/esm/types/smart-union.d.ts.map +1 -1
  35. package/esm/types/smart-union.js +13 -8
  36. package/esm/types/smart-union.js.map +1 -1
  37. package/jsr.json +1 -1
  38. package/package.json +1 -1
  39. package/src/funcs/accounting-create-booking-proposal-attachment.ts +227 -0
  40. package/src/funcs/accounting-create-vendor-credit.ts +1 -1
  41. package/src/funcs/accounting-delete-journal-entry.ts +175 -0
  42. package/src/lib/config.ts +3 -3
  43. package/src/models/operations/create-booking-proposal-attachment.ts +297 -0
  44. package/src/models/operations/create-pass-through-request.ts +11 -8
  45. package/src/models/operations/delete-journal-entry.ts +210 -0
  46. package/src/models/operations/index.ts +2 -0
  47. package/src/sdk/accounting.ts +24 -0
  48. package/src/types/smart-union.ts +17 -8
@@ -0,0 +1,297 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { blobLikeSchema } from "../../types/blobs.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import * as types from "../../types/primitives.js";
11
+ import { SDKValidationError } from "../errors/sdk-validation-error.js";
12
+ import * as models from "../index.js";
13
+
14
+ export type CreateBookingProposalAttachmentGlobals = {
15
+ apiKey?: string | undefined;
16
+ accountKey?: string | undefined;
17
+ };
18
+
19
+ export type CreateBookingProposalAttachmentFile = {
20
+ fileName: string;
21
+ content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
22
+ };
23
+
24
+ export const DocumentType = {
25
+ Bill: "BILL",
26
+ Invoice: "INVOICE",
27
+ } as const;
28
+ export type DocumentType = ClosedEnum<typeof DocumentType>;
29
+
30
+ export type CreateBookingProposalAttachmentRequestBody = {
31
+ file?: CreateBookingProposalAttachmentFile | Blob | undefined;
32
+ documentType?: DocumentType | undefined;
33
+ };
34
+
35
+ export type CreateBookingProposalAttachmentRequest = {
36
+ bookingProposalId: string;
37
+ /**
38
+ * ID of the company (required for multi-company target systems)
39
+ */
40
+ companyId?: string | undefined;
41
+ /**
42
+ * Environment name (required for multi-environment systems such as Business Central)
43
+ */
44
+ environmentName?: string | undefined;
45
+ /**
46
+ * API key
47
+ */
48
+ apiKey?: string | undefined;
49
+ /**
50
+ * Account key
51
+ */
52
+ accountKey?: string | undefined;
53
+ body: CreateBookingProposalAttachmentRequestBody;
54
+ };
55
+
56
+ export type CreateBookingProposalAttachmentPagination = {
57
+ total: number;
58
+ perPage: number;
59
+ currentPage: number;
60
+ totalPages: number;
61
+ };
62
+
63
+ export type CreateBookingProposalAttachmentMeta = {
64
+ warnings?: Array<string> | null | undefined;
65
+ pagination?: CreateBookingProposalAttachmentPagination | null | undefined;
66
+ };
67
+
68
+ export type CreateBookingProposalAttachmentErrors = {};
69
+
70
+ export type CreateBookingProposalAttachmentRawData = {};
71
+
72
+ /**
73
+ * Booking proposal attachment uploaded successfully
74
+ */
75
+ export type CreateBookingProposalAttachmentResponse = {
76
+ meta?: CreateBookingProposalAttachmentMeta | null | undefined;
77
+ data: models.DocumentResponseDto;
78
+ errors: CreateBookingProposalAttachmentErrors | null;
79
+ rawData: CreateBookingProposalAttachmentRawData | null;
80
+ };
81
+
82
+ /** @internal */
83
+ export type CreateBookingProposalAttachmentFile$Outbound = {
84
+ fileName: string;
85
+ content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
86
+ };
87
+
88
+ /** @internal */
89
+ export const CreateBookingProposalAttachmentFile$outboundSchema: z.ZodMiniType<
90
+ CreateBookingProposalAttachmentFile$Outbound,
91
+ CreateBookingProposalAttachmentFile
92
+ > = z.object({
93
+ fileName: z.string(),
94
+ content: z.union([
95
+ z.custom<ReadableStream<Uint8Array>>(x => x instanceof ReadableStream),
96
+ z.custom<Blob>(x => x instanceof Blob),
97
+ z.custom<ArrayBuffer>(x => x instanceof ArrayBuffer),
98
+ z.custom<Uint8Array>(x => x instanceof Uint8Array),
99
+ ]),
100
+ });
101
+
102
+ export function createBookingProposalAttachmentFileToJSON(
103
+ createBookingProposalAttachmentFile: CreateBookingProposalAttachmentFile,
104
+ ): string {
105
+ return JSON.stringify(
106
+ CreateBookingProposalAttachmentFile$outboundSchema.parse(
107
+ createBookingProposalAttachmentFile,
108
+ ),
109
+ );
110
+ }
111
+
112
+ /** @internal */
113
+ export const DocumentType$outboundSchema: z.ZodMiniEnum<typeof DocumentType> = z
114
+ .enum(DocumentType);
115
+
116
+ /** @internal */
117
+ export type CreateBookingProposalAttachmentRequestBody$Outbound = {
118
+ file?: CreateBookingProposalAttachmentFile$Outbound | Blob | undefined;
119
+ documentType?: string | undefined;
120
+ };
121
+
122
+ /** @internal */
123
+ export const CreateBookingProposalAttachmentRequestBody$outboundSchema:
124
+ z.ZodMiniType<
125
+ CreateBookingProposalAttachmentRequestBody$Outbound,
126
+ CreateBookingProposalAttachmentRequestBody
127
+ > = z.object({
128
+ file: z.optional(
129
+ z.union([
130
+ z.lazy(() => CreateBookingProposalAttachmentFile$outboundSchema),
131
+ blobLikeSchema,
132
+ ]),
133
+ ),
134
+ documentType: z.optional(DocumentType$outboundSchema),
135
+ });
136
+
137
+ export function createBookingProposalAttachmentRequestBodyToJSON(
138
+ createBookingProposalAttachmentRequestBody:
139
+ CreateBookingProposalAttachmentRequestBody,
140
+ ): string {
141
+ return JSON.stringify(
142
+ CreateBookingProposalAttachmentRequestBody$outboundSchema.parse(
143
+ createBookingProposalAttachmentRequestBody,
144
+ ),
145
+ );
146
+ }
147
+
148
+ /** @internal */
149
+ export type CreateBookingProposalAttachmentRequest$Outbound = {
150
+ bookingProposalId: string;
151
+ companyId?: string | undefined;
152
+ environmentName?: string | undefined;
153
+ apiKey?: string | undefined;
154
+ accountKey?: string | undefined;
155
+ body: CreateBookingProposalAttachmentRequestBody$Outbound;
156
+ };
157
+
158
+ /** @internal */
159
+ export const CreateBookingProposalAttachmentRequest$outboundSchema:
160
+ z.ZodMiniType<
161
+ CreateBookingProposalAttachmentRequest$Outbound,
162
+ CreateBookingProposalAttachmentRequest
163
+ > = z.object({
164
+ bookingProposalId: z.string(),
165
+ companyId: z.optional(z.string()),
166
+ environmentName: z.optional(z.string()),
167
+ apiKey: z.optional(z.string()),
168
+ accountKey: z.optional(z.string()),
169
+ body: z.lazy(() =>
170
+ CreateBookingProposalAttachmentRequestBody$outboundSchema
171
+ ),
172
+ });
173
+
174
+ export function createBookingProposalAttachmentRequestToJSON(
175
+ createBookingProposalAttachmentRequest:
176
+ CreateBookingProposalAttachmentRequest,
177
+ ): string {
178
+ return JSON.stringify(
179
+ CreateBookingProposalAttachmentRequest$outboundSchema.parse(
180
+ createBookingProposalAttachmentRequest,
181
+ ),
182
+ );
183
+ }
184
+
185
+ /** @internal */
186
+ export const CreateBookingProposalAttachmentPagination$inboundSchema:
187
+ z.ZodMiniType<CreateBookingProposalAttachmentPagination, unknown> = z.object({
188
+ total: types.number(),
189
+ perPage: types.number(),
190
+ currentPage: types.number(),
191
+ totalPages: types.number(),
192
+ });
193
+
194
+ export function createBookingProposalAttachmentPaginationFromJSON(
195
+ jsonString: string,
196
+ ): SafeParseResult<
197
+ CreateBookingProposalAttachmentPagination,
198
+ SDKValidationError
199
+ > {
200
+ return safeParse(
201
+ jsonString,
202
+ (x) =>
203
+ CreateBookingProposalAttachmentPagination$inboundSchema.parse(
204
+ JSON.parse(x),
205
+ ),
206
+ `Failed to parse 'CreateBookingProposalAttachmentPagination' from JSON`,
207
+ );
208
+ }
209
+
210
+ /** @internal */
211
+ export const CreateBookingProposalAttachmentMeta$inboundSchema: z.ZodMiniType<
212
+ CreateBookingProposalAttachmentMeta,
213
+ unknown
214
+ > = z.object({
215
+ warnings: z.optional(z.nullable(z.array(types.string()))),
216
+ pagination: z.optional(
217
+ z.nullable(z.lazy(() =>
218
+ CreateBookingProposalAttachmentPagination$inboundSchema
219
+ )),
220
+ ),
221
+ });
222
+
223
+ export function createBookingProposalAttachmentMetaFromJSON(
224
+ jsonString: string,
225
+ ): SafeParseResult<CreateBookingProposalAttachmentMeta, SDKValidationError> {
226
+ return safeParse(
227
+ jsonString,
228
+ (x) =>
229
+ CreateBookingProposalAttachmentMeta$inboundSchema.parse(JSON.parse(x)),
230
+ `Failed to parse 'CreateBookingProposalAttachmentMeta' from JSON`,
231
+ );
232
+ }
233
+
234
+ /** @internal */
235
+ export const CreateBookingProposalAttachmentErrors$inboundSchema: z.ZodMiniType<
236
+ CreateBookingProposalAttachmentErrors,
237
+ unknown
238
+ > = z.object({});
239
+
240
+ export function createBookingProposalAttachmentErrorsFromJSON(
241
+ jsonString: string,
242
+ ): SafeParseResult<CreateBookingProposalAttachmentErrors, SDKValidationError> {
243
+ return safeParse(
244
+ jsonString,
245
+ (x) =>
246
+ CreateBookingProposalAttachmentErrors$inboundSchema.parse(JSON.parse(x)),
247
+ `Failed to parse 'CreateBookingProposalAttachmentErrors' from JSON`,
248
+ );
249
+ }
250
+
251
+ /** @internal */
252
+ export const CreateBookingProposalAttachmentRawData$inboundSchema:
253
+ z.ZodMiniType<CreateBookingProposalAttachmentRawData, unknown> = z.object({});
254
+
255
+ export function createBookingProposalAttachmentRawDataFromJSON(
256
+ jsonString: string,
257
+ ): SafeParseResult<CreateBookingProposalAttachmentRawData, SDKValidationError> {
258
+ return safeParse(
259
+ jsonString,
260
+ (x) =>
261
+ CreateBookingProposalAttachmentRawData$inboundSchema.parse(JSON.parse(x)),
262
+ `Failed to parse 'CreateBookingProposalAttachmentRawData' from JSON`,
263
+ );
264
+ }
265
+
266
+ /** @internal */
267
+ export const CreateBookingProposalAttachmentResponse$inboundSchema:
268
+ z.ZodMiniType<CreateBookingProposalAttachmentResponse, unknown> = z.object({
269
+ meta: z.optional(
270
+ z.nullable(
271
+ z.lazy(() => CreateBookingProposalAttachmentMeta$inboundSchema),
272
+ ),
273
+ ),
274
+ data: models.DocumentResponseDto$inboundSchema,
275
+ errors: types.nullable(
276
+ z.lazy(() => CreateBookingProposalAttachmentErrors$inboundSchema),
277
+ ),
278
+ rawData: types.nullable(
279
+ z.lazy(() => CreateBookingProposalAttachmentRawData$inboundSchema),
280
+ ),
281
+ });
282
+
283
+ export function createBookingProposalAttachmentResponseFromJSON(
284
+ jsonString: string,
285
+ ): SafeParseResult<
286
+ CreateBookingProposalAttachmentResponse,
287
+ SDKValidationError
288
+ > {
289
+ return safeParse(
290
+ jsonString,
291
+ (x) =>
292
+ CreateBookingProposalAttachmentResponse$inboundSchema.parse(
293
+ JSON.parse(x),
294
+ ),
295
+ `Failed to parse 'CreateBookingProposalAttachmentResponse' from JSON`,
296
+ );
297
+ }
@@ -46,7 +46,7 @@ export type CreatePassThroughRequestMeta = {
46
46
  pagination?: CreatePassThroughRequestPagination | null | undefined;
47
47
  };
48
48
 
49
- export type Data = {};
49
+ export type CreatePassThroughRequestData = {};
50
50
 
51
51
  export type CreatePassThroughRequestErrors = {};
52
52
 
@@ -57,7 +57,7 @@ export type CreatePassThroughRequestRawData = {};
57
57
  */
58
58
  export type CreatePassThroughRequestResponse = {
59
59
  meta?: CreatePassThroughRequestMeta | null | undefined;
60
- data: Data;
60
+ data: CreatePassThroughRequestData;
61
61
  errors: CreatePassThroughRequestErrors | null;
62
62
  rawData: CreatePassThroughRequestRawData | null;
63
63
  };
@@ -137,15 +137,18 @@ export function createPassThroughRequestMetaFromJSON(
137
137
  }
138
138
 
139
139
  /** @internal */
140
- export const Data$inboundSchema: z.ZodMiniType<Data, unknown> = z.object({});
140
+ export const CreatePassThroughRequestData$inboundSchema: z.ZodMiniType<
141
+ CreatePassThroughRequestData,
142
+ unknown
143
+ > = z.object({});
141
144
 
142
- export function dataFromJSON(
145
+ export function createPassThroughRequestDataFromJSON(
143
146
  jsonString: string,
144
- ): SafeParseResult<Data, SDKValidationError> {
147
+ ): SafeParseResult<CreatePassThroughRequestData, SDKValidationError> {
145
148
  return safeParse(
146
149
  jsonString,
147
- (x) => Data$inboundSchema.parse(JSON.parse(x)),
148
- `Failed to parse 'Data' from JSON`,
150
+ (x) => CreatePassThroughRequestData$inboundSchema.parse(JSON.parse(x)),
151
+ `Failed to parse 'CreatePassThroughRequestData' from JSON`,
149
152
  );
150
153
  }
151
154
 
@@ -189,7 +192,7 @@ export const CreatePassThroughRequestResponse$inboundSchema: z.ZodMiniType<
189
192
  meta: z.optional(
190
193
  z.nullable(z.lazy(() => CreatePassThroughRequestMeta$inboundSchema)),
191
194
  ),
192
- data: z.lazy(() => Data$inboundSchema),
195
+ data: z.lazy(() => CreatePassThroughRequestData$inboundSchema),
193
196
  errors: types.nullable(
194
197
  z.lazy(() => CreatePassThroughRequestErrors$inboundSchema),
195
198
  ),
@@ -0,0 +1,210 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import * as types from "../../types/primitives.js";
9
+ import { SDKValidationError } from "../errors/sdk-validation-error.js";
10
+
11
+ export type DeleteJournalEntryGlobals = {
12
+ apiKey?: string | undefined;
13
+ accountKey?: string | undefined;
14
+ };
15
+
16
+ export type DeleteJournalEntryRequest = {
17
+ journalEntryId: string;
18
+ /**
19
+ * Environment name (required for multi-environment systems such as Business Central)
20
+ */
21
+ environmentName?: string | undefined;
22
+ /**
23
+ * ID of the company (required for multi-company target systems)
24
+ */
25
+ companyId?: string | undefined;
26
+ /**
27
+ * API key
28
+ */
29
+ apiKey?: string | undefined;
30
+ /**
31
+ * Account key
32
+ */
33
+ accountKey?: string | undefined;
34
+ };
35
+
36
+ export type DeleteJournalEntryPagination = {
37
+ total: number;
38
+ perPage: number;
39
+ currentPage: number;
40
+ totalPages: number;
41
+ };
42
+
43
+ export type DeleteJournalEntryMeta = {
44
+ warnings?: Array<string> | null | undefined;
45
+ pagination?: DeleteJournalEntryPagination | null | undefined;
46
+ };
47
+
48
+ export type DeleteJournalEntryData = {
49
+ id?: string | undefined;
50
+ };
51
+
52
+ export type DeleteJournalEntryErrors = {};
53
+
54
+ export type DeleteJournalEntryRawData = {};
55
+
56
+ /**
57
+ * Journal entry deleted successfully
58
+ */
59
+ export type DeleteJournalEntryResponse = {
60
+ meta?: DeleteJournalEntryMeta | null | undefined;
61
+ data: DeleteJournalEntryData;
62
+ errors: DeleteJournalEntryErrors | null;
63
+ rawData: DeleteJournalEntryRawData | null;
64
+ };
65
+
66
+ /** @internal */
67
+ export type DeleteJournalEntryRequest$Outbound = {
68
+ journalEntryId: string;
69
+ environmentName?: string | undefined;
70
+ companyId?: string | undefined;
71
+ apiKey?: string | undefined;
72
+ accountKey?: string | undefined;
73
+ };
74
+
75
+ /** @internal */
76
+ export const DeleteJournalEntryRequest$outboundSchema: z.ZodMiniType<
77
+ DeleteJournalEntryRequest$Outbound,
78
+ DeleteJournalEntryRequest
79
+ > = z.object({
80
+ journalEntryId: z.string(),
81
+ environmentName: z.optional(z.string()),
82
+ companyId: z.optional(z.string()),
83
+ apiKey: z.optional(z.string()),
84
+ accountKey: z.optional(z.string()),
85
+ });
86
+
87
+ export function deleteJournalEntryRequestToJSON(
88
+ deleteJournalEntryRequest: DeleteJournalEntryRequest,
89
+ ): string {
90
+ return JSON.stringify(
91
+ DeleteJournalEntryRequest$outboundSchema.parse(deleteJournalEntryRequest),
92
+ );
93
+ }
94
+
95
+ /** @internal */
96
+ export const DeleteJournalEntryPagination$inboundSchema: z.ZodMiniType<
97
+ DeleteJournalEntryPagination,
98
+ unknown
99
+ > = z.object({
100
+ total: types.number(),
101
+ perPage: types.number(),
102
+ currentPage: types.number(),
103
+ totalPages: types.number(),
104
+ });
105
+
106
+ export function deleteJournalEntryPaginationFromJSON(
107
+ jsonString: string,
108
+ ): SafeParseResult<DeleteJournalEntryPagination, SDKValidationError> {
109
+ return safeParse(
110
+ jsonString,
111
+ (x) => DeleteJournalEntryPagination$inboundSchema.parse(JSON.parse(x)),
112
+ `Failed to parse 'DeleteJournalEntryPagination' from JSON`,
113
+ );
114
+ }
115
+
116
+ /** @internal */
117
+ export const DeleteJournalEntryMeta$inboundSchema: z.ZodMiniType<
118
+ DeleteJournalEntryMeta,
119
+ unknown
120
+ > = z.object({
121
+ warnings: z.optional(z.nullable(z.array(types.string()))),
122
+ pagination: z.optional(
123
+ z.nullable(z.lazy(() => DeleteJournalEntryPagination$inboundSchema)),
124
+ ),
125
+ });
126
+
127
+ export function deleteJournalEntryMetaFromJSON(
128
+ jsonString: string,
129
+ ): SafeParseResult<DeleteJournalEntryMeta, SDKValidationError> {
130
+ return safeParse(
131
+ jsonString,
132
+ (x) => DeleteJournalEntryMeta$inboundSchema.parse(JSON.parse(x)),
133
+ `Failed to parse 'DeleteJournalEntryMeta' from JSON`,
134
+ );
135
+ }
136
+
137
+ /** @internal */
138
+ export const DeleteJournalEntryData$inboundSchema: z.ZodMiniType<
139
+ DeleteJournalEntryData,
140
+ unknown
141
+ > = z.object({
142
+ id: types.optional(types.string()),
143
+ });
144
+
145
+ export function deleteJournalEntryDataFromJSON(
146
+ jsonString: string,
147
+ ): SafeParseResult<DeleteJournalEntryData, SDKValidationError> {
148
+ return safeParse(
149
+ jsonString,
150
+ (x) => DeleteJournalEntryData$inboundSchema.parse(JSON.parse(x)),
151
+ `Failed to parse 'DeleteJournalEntryData' from JSON`,
152
+ );
153
+ }
154
+
155
+ /** @internal */
156
+ export const DeleteJournalEntryErrors$inboundSchema: z.ZodMiniType<
157
+ DeleteJournalEntryErrors,
158
+ unknown
159
+ > = z.object({});
160
+
161
+ export function deleteJournalEntryErrorsFromJSON(
162
+ jsonString: string,
163
+ ): SafeParseResult<DeleteJournalEntryErrors, SDKValidationError> {
164
+ return safeParse(
165
+ jsonString,
166
+ (x) => DeleteJournalEntryErrors$inboundSchema.parse(JSON.parse(x)),
167
+ `Failed to parse 'DeleteJournalEntryErrors' from JSON`,
168
+ );
169
+ }
170
+
171
+ /** @internal */
172
+ export const DeleteJournalEntryRawData$inboundSchema: z.ZodMiniType<
173
+ DeleteJournalEntryRawData,
174
+ unknown
175
+ > = z.object({});
176
+
177
+ export function deleteJournalEntryRawDataFromJSON(
178
+ jsonString: string,
179
+ ): SafeParseResult<DeleteJournalEntryRawData, SDKValidationError> {
180
+ return safeParse(
181
+ jsonString,
182
+ (x) => DeleteJournalEntryRawData$inboundSchema.parse(JSON.parse(x)),
183
+ `Failed to parse 'DeleteJournalEntryRawData' from JSON`,
184
+ );
185
+ }
186
+
187
+ /** @internal */
188
+ export const DeleteJournalEntryResponse$inboundSchema: z.ZodMiniType<
189
+ DeleteJournalEntryResponse,
190
+ unknown
191
+ > = z.object({
192
+ meta: z.optional(
193
+ z.nullable(z.lazy(() => DeleteJournalEntryMeta$inboundSchema)),
194
+ ),
195
+ data: z.lazy(() => DeleteJournalEntryData$inboundSchema),
196
+ errors: types.nullable(z.lazy(() => DeleteJournalEntryErrors$inboundSchema)),
197
+ rawData: types.nullable(
198
+ z.lazy(() => DeleteJournalEntryRawData$inboundSchema),
199
+ ),
200
+ });
201
+
202
+ export function deleteJournalEntryResponseFromJSON(
203
+ jsonString: string,
204
+ ): SafeParseResult<DeleteJournalEntryResponse, SDKValidationError> {
205
+ return safeParse(
206
+ jsonString,
207
+ (x) => DeleteJournalEntryResponse$inboundSchema.parse(JSON.parse(x)),
208
+ `Failed to parse 'DeleteJournalEntryResponse' from JSON`,
209
+ );
210
+ }
@@ -10,6 +10,7 @@ export * from "./create-bank-account.js";
10
10
  export * from "./create-bill-line-item.js";
11
11
  export * from "./create-bill.js";
12
12
  export * from "./create-booking-proposal-async.js";
13
+ export * from "./create-booking-proposal-attachment.js";
13
14
  export * from "./create-booking-proposal-v2.js";
14
15
  export * from "./create-booking-proposal.js";
15
16
  export * from "./create-contact-v2.js";
@@ -43,6 +44,7 @@ export * from "./delete-bill.js";
43
44
  export * from "./delete-end-user.js";
44
45
  export * from "./delete-event-subscriptions.js";
45
46
  export * from "./delete-item.js";
47
+ export * from "./delete-journal-entry.js";
46
48
  export * from "./delete-payment.js";
47
49
  export * from "./delete-registered-system.js";
48
50
  export * from "./delete-vendor-credit.js";
@@ -7,6 +7,7 @@ import { accountingCreateBankAccount } from "../funcs/accounting-create-bank-acc
7
7
  import { accountingCreateBillLineItem } from "../funcs/accounting-create-bill-line-item.js";
8
8
  import { accountingCreateBill } from "../funcs/accounting-create-bill.js";
9
9
  import { accountingCreateBookingProposalAsync } from "../funcs/accounting-create-booking-proposal-async.js";
10
+ import { accountingCreateBookingProposalAttachment } from "../funcs/accounting-create-booking-proposal-attachment.js";
10
11
  import { accountingCreateBookingProposal } from "../funcs/accounting-create-booking-proposal.js";
11
12
  import { accountingCreateContact } from "../funcs/accounting-create-contact.js";
12
13
  import { accountingCreateContactsV1 } from "../funcs/accounting-create-contacts-v1.js";
@@ -34,6 +35,7 @@ import { accountingCreateVendorCredit } from "../funcs/accounting-create-vendor-
34
35
  import { accountingDeleteBill } from "../funcs/accounting-delete-bill.js";
35
36
  import { accountingDeleteEventSubscriptions } from "../funcs/accounting-delete-event-subscriptions.js";
36
37
  import { accountingDeleteItem } from "../funcs/accounting-delete-item.js";
38
+ import { accountingDeleteJournalEntry } from "../funcs/accounting-delete-journal-entry.js";
37
39
  import { accountingDeletePayment } from "../funcs/accounting-delete-payment.js";
38
40
  import { accountingDeleteVendorCredit } from "../funcs/accounting-delete-vendor-credit.js";
39
41
  import { accountingGetAccount } from "../funcs/accounting-get-account.js";
@@ -727,6 +729,17 @@ export class Accounting extends ClientSDK {
727
729
  ));
728
730
  }
729
731
 
732
+ async deleteJournalEntry(
733
+ request: operations.DeleteJournalEntryRequest,
734
+ options?: RequestOptions,
735
+ ): Promise<operations.DeleteJournalEntryResponse> {
736
+ return unwrapAsync(accountingDeleteJournalEntry(
737
+ this,
738
+ request,
739
+ options,
740
+ ));
741
+ }
742
+
730
743
  async createJournalEntries(
731
744
  request: operations.CreateJournalEntriesRequest,
732
745
  options?: RequestOptions,
@@ -1189,6 +1202,17 @@ export class Accounting extends ClientSDK {
1189
1202
  ));
1190
1203
  }
1191
1204
 
1205
+ async createBookingProposalAttachment(
1206
+ request: operations.CreateBookingProposalAttachmentRequest,
1207
+ options?: RequestOptions,
1208
+ ): Promise<operations.CreateBookingProposalAttachmentResponse> {
1209
+ return unwrapAsync(accountingCreateBookingProposalAttachment(
1210
+ this,
1211
+ request,
1212
+ options,
1213
+ ));
1214
+ }
1215
+
1192
1216
  async getBookingProposal(
1193
1217
  request: operations.GetBookingProposalRequest,
1194
1218
  options?: RequestOptions,
@@ -31,28 +31,33 @@ export function smartUnion<
31
31
  z.unknown(),
32
32
  z.transform((input, ctx) => {
33
33
  const candidates: Candidate[] = [];
34
- const errors: z.core.$ZodIssue[][] = options.map(() => []);
34
+ const errors: z.core.$ZodRawIssue[][] = [];
35
35
 
36
36
  const parentUnrecognizedCtr = startCountingUnrecognized();
37
37
  const parentZeroDefaultCtr = startCountingDefaultToZeroValue();
38
38
 
39
39
  // Filter out invalid options
40
- for (const [i, option] of options.entries()) {
40
+ for (const option of options) {
41
41
  const unrecognizedCtr = startCountingUnrecognized();
42
42
  const zeroDefaultCtr = startCountingDefaultToZeroValue();
43
- const result = option.safeParse(input);
43
+ const result = option._zod.run({ value: input, issues: [] }, {
44
+ async: false,
45
+ });
46
+ if (result instanceof Promise) {
47
+ throw new z.core.$ZodAsyncError();
48
+ }
44
49
  const inexactCount = unrecognizedCtr.end();
45
50
  const zeroDefaultCount = zeroDefaultCtr.end();
46
- if (result.success) {
51
+ if (result.issues.length === 0) {
47
52
  candidates.push({
48
- data: result.data,
53
+ data: result.value,
49
54
  inexactCount,
50
55
  zeroDefaultCount,
51
56
  fieldCount: -1, // We'll count this later if needed
52
57
  });
53
58
  continue;
54
59
  }
55
- errors[i]!.push(...result.error.issues);
60
+ errors.push(result.issues);
56
61
  }
57
62
 
58
63
  // No valid options
@@ -62,9 +67,13 @@ export function smartUnion<
62
67
  ctx.issues.push({
63
68
  input: input,
64
69
  code: "invalid_union",
65
- errors: errors,
70
+ errors: errors.map(issues =>
71
+ issues.map(issue =>
72
+ z.core.util.finalizeIssue(issue, {}, z.core.config())
73
+ )
74
+ ),
66
75
  });
67
- return z.NEVER;
76
+ return undefined;
68
77
  }
69
78
 
70
79
  let best = candidates[0]!;