@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,227 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { MaesnCore } from "../core.js";
7
+ import {
8
+ appendForm,
9
+ encodeFormQuery,
10
+ encodeSimple,
11
+ normalizeBlob,
12
+ } from "../lib/encodings.js";
13
+ import {
14
+ bytesToBlob,
15
+ getContentTypeFromFileName,
16
+ readableStreamToArrayBuffer,
17
+ } from "../lib/files.js";
18
+ import { matchStatusCode } from "../lib/http.js";
19
+ import * as M from "../lib/matchers.js";
20
+ import { compactMap } from "../lib/primitives.js";
21
+ import { safeParse } from "../lib/schemas.js";
22
+ import { RequestOptions } from "../lib/sdks.js";
23
+ import { pathToFunc } from "../lib/url.js";
24
+ import {
25
+ ConnectionError,
26
+ InvalidRequestError,
27
+ RequestAbortedError,
28
+ RequestTimeoutError,
29
+ UnexpectedClientError,
30
+ } from "../models/errors/http-client-errors.js";
31
+ import { MaesnError } from "../models/errors/maesn-error.js";
32
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
33
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
34
+ import * as operations from "../models/operations/index.js";
35
+ import { APICall, APIPromise } from "../types/async.js";
36
+ import { isBlobLike } from "../types/blobs.js";
37
+ import { Result } from "../types/fp.js";
38
+ import { isReadableStream } from "../types/streams.js";
39
+
40
+ export function accountingCreateBookingProposalAttachment(
41
+ client: MaesnCore,
42
+ request: operations.CreateBookingProposalAttachmentRequest,
43
+ options?: RequestOptions,
44
+ ): APIPromise<
45
+ Result<
46
+ operations.CreateBookingProposalAttachmentResponse,
47
+ | MaesnError
48
+ | ResponseValidationError
49
+ | ConnectionError
50
+ | RequestAbortedError
51
+ | RequestTimeoutError
52
+ | InvalidRequestError
53
+ | UnexpectedClientError
54
+ | SDKValidationError
55
+ >
56
+ > {
57
+ return new APIPromise($do(
58
+ client,
59
+ request,
60
+ options,
61
+ ));
62
+ }
63
+
64
+ async function $do(
65
+ client: MaesnCore,
66
+ request: operations.CreateBookingProposalAttachmentRequest,
67
+ options?: RequestOptions,
68
+ ): Promise<
69
+ [
70
+ Result<
71
+ operations.CreateBookingProposalAttachmentResponse,
72
+ | MaesnError
73
+ | ResponseValidationError
74
+ | ConnectionError
75
+ | RequestAbortedError
76
+ | RequestTimeoutError
77
+ | InvalidRequestError
78
+ | UnexpectedClientError
79
+ | SDKValidationError
80
+ >,
81
+ APICall,
82
+ ]
83
+ > {
84
+ const parsed = safeParse(
85
+ request,
86
+ (value) =>
87
+ z.parse(
88
+ operations.CreateBookingProposalAttachmentRequest$outboundSchema,
89
+ value,
90
+ ),
91
+ "Input validation failed",
92
+ );
93
+ if (!parsed.ok) {
94
+ return [parsed, { status: "invalid" }];
95
+ }
96
+ const payload = parsed.value;
97
+ const body = new FormData();
98
+
99
+ if (payload.body.documentType !== undefined) {
100
+ appendForm(body, "documentType", payload.body.documentType);
101
+ }
102
+ if (payload.body.file !== undefined) {
103
+ if (isBlobLike(payload.body.file)) {
104
+ const file = payload.body.file;
105
+ const blob = await normalizeBlob(file);
106
+ const name = "name" in file ? (file.name as string) : undefined;
107
+ appendForm(body, "file", blob, name);
108
+ } else if (isReadableStream(payload.body.file.content)) {
109
+ const buffer = await readableStreamToArrayBuffer(
110
+ payload.body.file.content,
111
+ );
112
+ const contentType = getContentTypeFromFileName(payload.body.file.fileName)
113
+ || "application/octet-stream";
114
+ appendForm(
115
+ body,
116
+ "file",
117
+ bytesToBlob(buffer, contentType),
118
+ payload.body.file.fileName,
119
+ );
120
+ } else {
121
+ const contentType = getContentTypeFromFileName(payload.body.file.fileName)
122
+ || "application/octet-stream";
123
+ appendForm(
124
+ body,
125
+ "file",
126
+ bytesToBlob(payload.body.file.content, contentType),
127
+ payload.body.file.fileName,
128
+ );
129
+ }
130
+ }
131
+
132
+ const pathParams = {
133
+ bookingProposalId: encodeSimple(
134
+ "bookingProposalId",
135
+ payload.bookingProposalId,
136
+ { explode: false, charEncoding: "percent" },
137
+ ),
138
+ };
139
+ const path = pathToFunc(
140
+ "/accounting/bookingProposals/{bookingProposalId}/attachments",
141
+ )(pathParams);
142
+
143
+ const query = encodeFormQuery({
144
+ "companyId": payload.companyId,
145
+ "environmentName": payload.environmentName,
146
+ });
147
+
148
+ const headers = new Headers(compactMap({
149
+ Accept: "application/json",
150
+ "X-ACCOUNT-KEY": encodeSimple(
151
+ "X-ACCOUNT-KEY",
152
+ payload.accountKey ?? client._options.accountKey,
153
+ { explode: false, charEncoding: "none" },
154
+ ),
155
+ "X-API-KEY": encodeSimple(
156
+ "X-API-KEY",
157
+ payload.apiKey ?? client._options.apiKey,
158
+ { explode: false, charEncoding: "none" },
159
+ ),
160
+ }));
161
+
162
+ const context = {
163
+ options: client._options,
164
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
165
+ operationID: "createBookingProposalAttachment",
166
+ oAuth2Scopes: null,
167
+
168
+ resolvedSecurity: null,
169
+
170
+ securitySource: null,
171
+ retryConfig: options?.retries
172
+ || client._options.retryConfig
173
+ || { strategy: "none" },
174
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
175
+ };
176
+
177
+ const requestRes = client._createRequest(context, {
178
+ method: "POST",
179
+ baseURL: options?.serverURL,
180
+ path: path,
181
+ headers: headers,
182
+ query: query,
183
+ body: body,
184
+ userAgent: client._options.userAgent,
185
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
186
+ }, options);
187
+ if (!requestRes.ok) {
188
+ return [requestRes, { status: "invalid" }];
189
+ }
190
+ const req = requestRes.value;
191
+
192
+ const doResult = await client._do(req, {
193
+ context,
194
+ isErrorStatusCode: (statusCode: number) =>
195
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
196
+ retryConfig: context.retryConfig,
197
+ retryCodes: context.retryCodes,
198
+ });
199
+ if (!doResult.ok) {
200
+ return [doResult, { status: "request-error", request: req }];
201
+ }
202
+ const response = doResult.value;
203
+
204
+ const [result] = await M.match<
205
+ operations.CreateBookingProposalAttachmentResponse,
206
+ | MaesnError
207
+ | ResponseValidationError
208
+ | ConnectionError
209
+ | RequestAbortedError
210
+ | RequestTimeoutError
211
+ | InvalidRequestError
212
+ | UnexpectedClientError
213
+ | SDKValidationError
214
+ >(
215
+ M.json(
216
+ 201,
217
+ operations.CreateBookingProposalAttachmentResponse$inboundSchema,
218
+ ),
219
+ M.fail("4XX"),
220
+ M.fail("5XX"),
221
+ )(response, req);
222
+ if (!result.ok) {
223
+ return [result, { status: "complete", request: req, response }];
224
+ }
225
+
226
+ return [result, { status: "complete", request: req, response }];
227
+ }
@@ -81,7 +81,7 @@ async function $do(
81
81
  const payload = parsed.value;
82
82
  const body = encodeJSON("body", payload.body, { explode: true });
83
83
 
84
- const path = pathToFunc("/accounting/vendorCredit")();
84
+ const path = pathToFunc("/accounting/vendorCredits")();
85
85
 
86
86
  const query = encodeFormQuery({
87
87
  "companyId": payload.companyId,
@@ -0,0 +1,175 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { MaesnCore } from "../core.js";
7
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
9
+ import * as M from "../lib/matchers.js";
10
+ import { compactMap } from "../lib/primitives.js";
11
+ import { safeParse } from "../lib/schemas.js";
12
+ import { RequestOptions } from "../lib/sdks.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/http-client-errors.js";
21
+ import { MaesnError } from "../models/errors/maesn-error.js";
22
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
23
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ export function accountingDeleteJournalEntry(
29
+ client: MaesnCore,
30
+ request: operations.DeleteJournalEntryRequest,
31
+ options?: RequestOptions,
32
+ ): APIPromise<
33
+ Result<
34
+ operations.DeleteJournalEntryResponse,
35
+ | MaesnError
36
+ | ResponseValidationError
37
+ | ConnectionError
38
+ | RequestAbortedError
39
+ | RequestTimeoutError
40
+ | InvalidRequestError
41
+ | UnexpectedClientError
42
+ | SDKValidationError
43
+ >
44
+ > {
45
+ return new APIPromise($do(
46
+ client,
47
+ request,
48
+ options,
49
+ ));
50
+ }
51
+
52
+ async function $do(
53
+ client: MaesnCore,
54
+ request: operations.DeleteJournalEntryRequest,
55
+ options?: RequestOptions,
56
+ ): Promise<
57
+ [
58
+ Result<
59
+ operations.DeleteJournalEntryResponse,
60
+ | MaesnError
61
+ | ResponseValidationError
62
+ | ConnectionError
63
+ | RequestAbortedError
64
+ | RequestTimeoutError
65
+ | InvalidRequestError
66
+ | UnexpectedClientError
67
+ | SDKValidationError
68
+ >,
69
+ APICall,
70
+ ]
71
+ > {
72
+ const parsed = safeParse(
73
+ request,
74
+ (value) =>
75
+ z.parse(operations.DeleteJournalEntryRequest$outboundSchema, value),
76
+ "Input validation failed",
77
+ );
78
+ if (!parsed.ok) {
79
+ return [parsed, { status: "invalid" }];
80
+ }
81
+ const payload = parsed.value;
82
+ const body = null;
83
+
84
+ const pathParams = {
85
+ journalEntryId: encodeSimple("journalEntryId", payload.journalEntryId, {
86
+ explode: false,
87
+ charEncoding: "percent",
88
+ }),
89
+ };
90
+ const path = pathToFunc("/accounting/journalEntries/{journalEntryId}")(
91
+ pathParams,
92
+ );
93
+
94
+ const query = encodeFormQuery({
95
+ "companyId": payload.companyId,
96
+ "environmentName": payload.environmentName,
97
+ });
98
+
99
+ const headers = new Headers(compactMap({
100
+ Accept: "application/json",
101
+ "X-ACCOUNT-KEY": encodeSimple(
102
+ "X-ACCOUNT-KEY",
103
+ payload.accountKey ?? client._options.accountKey,
104
+ { explode: false, charEncoding: "none" },
105
+ ),
106
+ "X-API-KEY": encodeSimple(
107
+ "X-API-KEY",
108
+ payload.apiKey ?? client._options.apiKey,
109
+ { explode: false, charEncoding: "none" },
110
+ ),
111
+ }));
112
+
113
+ const context = {
114
+ options: client._options,
115
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
116
+ operationID: "deleteJournalEntry",
117
+ oAuth2Scopes: null,
118
+
119
+ resolvedSecurity: null,
120
+
121
+ securitySource: null,
122
+ retryConfig: options?.retries
123
+ || client._options.retryConfig
124
+ || { strategy: "none" },
125
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
126
+ };
127
+
128
+ const requestRes = client._createRequest(context, {
129
+ method: "DELETE",
130
+ baseURL: options?.serverURL,
131
+ path: path,
132
+ headers: headers,
133
+ query: query,
134
+ body: body,
135
+ userAgent: client._options.userAgent,
136
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
137
+ }, options);
138
+ if (!requestRes.ok) {
139
+ return [requestRes, { status: "invalid" }];
140
+ }
141
+ const req = requestRes.value;
142
+
143
+ const doResult = await client._do(req, {
144
+ context,
145
+ isErrorStatusCode: (statusCode: number) =>
146
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
147
+ retryConfig: context.retryConfig,
148
+ retryCodes: context.retryCodes,
149
+ });
150
+ if (!doResult.ok) {
151
+ return [doResult, { status: "request-error", request: req }];
152
+ }
153
+ const response = doResult.value;
154
+
155
+ const [result] = await M.match<
156
+ operations.DeleteJournalEntryResponse,
157
+ | MaesnError
158
+ | ResponseValidationError
159
+ | ConnectionError
160
+ | RequestAbortedError
161
+ | RequestTimeoutError
162
+ | InvalidRequestError
163
+ | UnexpectedClientError
164
+ | SDKValidationError
165
+ >(
166
+ M.json(200, operations.DeleteJournalEntryResponse$inboundSchema),
167
+ M.fail("4XX"),
168
+ M.fail("5XX"),
169
+ )(response, req);
170
+ if (!result.ok) {
171
+ return [result, { status: "complete", request: req, response }];
172
+ }
173
+
174
+ return [result, { status: "complete", request: req, response }];
175
+ }
package/src/lib/config.ts CHANGED
@@ -51,8 +51,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
51
51
  export const SDK_METADATA = {
52
52
  language: "typescript",
53
53
  openapiDocVersion: "1.0",
54
- sdkVersion: "0.8.22",
55
- genVersion: "2.941.0",
54
+ sdkVersion: "0.8.24",
55
+ genVersion: "2.946.0",
56
56
  userAgent:
57
- "speakeasy-sdk/typescript 0.8.22 2.941.0 1.0 @maesn/typescript-sdk",
57
+ "speakeasy-sdk/typescript 0.8.24 2.946.0 1.0 @maesn/typescript-sdk",
58
58
  } as const;