@maesn/typescript-sdk 0.7.0 → 0.7.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.
Files changed (89) hide show
  1. package/esm/funcs/accounting-create-journal-entry-attachments.d.ts.map +1 -1
  2. package/esm/funcs/accounting-create-journal-entry-attachments.js +5 -1
  3. package/esm/funcs/accounting-create-journal-entry-attachments.js.map +1 -1
  4. package/esm/lib/config.d.ts +3 -3
  5. package/esm/lib/config.js +3 -3
  6. package/esm/models/advance-payment-input.d.ts +27 -0
  7. package/esm/models/advance-payment-input.d.ts.map +1 -0
  8. package/esm/models/advance-payment-input.js +24 -0
  9. package/esm/models/advance-payment-input.js.map +1 -0
  10. package/esm/models/contact-response-dto.d.ts +1 -1
  11. package/esm/models/contact-response-dto.d.ts.map +1 -1
  12. package/esm/models/contact-response-dto.js +1 -1
  13. package/esm/models/contact-response-dto.js.map +1 -1
  14. package/esm/models/create-journal-entry-request-dto.d.ts +3 -0
  15. package/esm/models/create-journal-entry-request-dto.d.ts.map +1 -1
  16. package/esm/models/create-journal-entry-request-dto.js +2 -0
  17. package/esm/models/create-journal-entry-request-dto.js.map +1 -1
  18. package/esm/models/dimension.d.ts +1 -1
  19. package/esm/models/dimension.d.ts.map +1 -1
  20. package/esm/models/dimension.js +1 -1
  21. package/esm/models/dimension.js.map +1 -1
  22. package/esm/models/email-address.d.ts +2 -2
  23. package/esm/models/email-address.d.ts.map +1 -1
  24. package/esm/models/email-address.js +2 -2
  25. package/esm/models/email-address.js.map +1 -1
  26. package/esm/models/index.d.ts +1 -0
  27. package/esm/models/index.d.ts.map +1 -1
  28. package/esm/models/index.js +1 -0
  29. package/esm/models/index.js.map +1 -1
  30. package/esm/models/invoice-response-dto.d.ts +1 -1
  31. package/esm/models/invoice-response-dto.d.ts.map +1 -1
  32. package/esm/models/invoice-response-dto.js +1 -1
  33. package/esm/models/invoice-response-dto.js.map +1 -1
  34. package/esm/models/journal-entry-response-dto.d.ts +23 -3
  35. package/esm/models/journal-entry-response-dto.d.ts.map +1 -1
  36. package/esm/models/journal-entry-response-dto.js +23 -3
  37. package/esm/models/journal-entry-response-dto.js.map +1 -1
  38. package/esm/models/journal-line-item.d.ts +1 -1
  39. package/esm/models/journal-line-item.d.ts.map +1 -1
  40. package/esm/models/journal-line-item.js +1 -1
  41. package/esm/models/journal-line-item.js.map +1 -1
  42. package/esm/models/line-item-response-dto.d.ts +1 -1
  43. package/esm/models/line-item-response-dto.d.ts.map +1 -1
  44. package/esm/models/line-item-response-dto.js +1 -1
  45. package/esm/models/line-item-response-dto.js.map +1 -1
  46. package/esm/models/line-item-response.d.ts +1 -1
  47. package/esm/models/line-item-response.d.ts.map +1 -1
  48. package/esm/models/line-item-response.js +1 -1
  49. package/esm/models/line-item-response.js.map +1 -1
  50. package/esm/models/offer-response-dto.d.ts +1 -1
  51. package/esm/models/offer-response-dto.d.ts.map +1 -1
  52. package/esm/models/offer-response-dto.js +1 -1
  53. package/esm/models/offer-response-dto.js.map +1 -1
  54. package/esm/models/operations/create-journal-entry-attachments.d.ts +5 -0
  55. package/esm/models/operations/create-journal-entry-attachments.d.ts.map +1 -1
  56. package/esm/models/operations/create-journal-entry-attachments.js +1 -0
  57. package/esm/models/operations/create-journal-entry-attachments.js.map +1 -1
  58. package/esm/models/payment-line.d.ts +2 -2
  59. package/esm/models/payment-line.d.ts.map +1 -1
  60. package/esm/models/payment-line.js +2 -2
  61. package/esm/models/payment-line.js.map +1 -1
  62. package/esm/models/phone-number.d.ts +2 -2
  63. package/esm/models/phone-number.d.ts.map +1 -1
  64. package/esm/models/phone-number.js +2 -2
  65. package/esm/models/phone-number.js.map +1 -1
  66. package/esm/models/sales-order-response-dto.d.ts +1 -1
  67. package/esm/models/sales-order-response-dto.d.ts.map +1 -1
  68. package/esm/models/sales-order-response-dto.js +1 -1
  69. package/esm/models/sales-order-response-dto.js.map +1 -1
  70. package/jsr.json +1 -1
  71. package/package.json +1 -1
  72. package/src/funcs/accounting-create-journal-entry-attachments.ts +11 -1
  73. package/src/lib/config.ts +3 -3
  74. package/src/models/advance-payment-input.ts +52 -0
  75. package/src/models/contact-response-dto.ts +2 -2
  76. package/src/models/create-journal-entry-request-dto.ts +8 -0
  77. package/src/models/dimension.ts +2 -2
  78. package/src/models/email-address.ts +4 -4
  79. package/src/models/index.ts +1 -0
  80. package/src/models/invoice-response-dto.ts +2 -2
  81. package/src/models/journal-entry-response-dto.ts +52 -6
  82. package/src/models/journal-line-item.ts +2 -2
  83. package/src/models/line-item-response-dto.ts +2 -2
  84. package/src/models/line-item-response.ts +2 -2
  85. package/src/models/offer-response-dto.ts +2 -2
  86. package/src/models/operations/create-journal-entry-attachments.ts +6 -0
  87. package/src/models/payment-line.ts +4 -4
  88. package/src/models/phone-number.ts +4 -4
  89. package/src/models/sales-order-response-dto.ts +2 -2
@@ -11,7 +11,7 @@ import { SDKValidationError } from "./errors/sdk-validation-error.js";
11
11
  export type Dimension = {
12
12
  id: string | null;
13
13
  categoryName: string | null;
14
- code?: string | null | undefined;
14
+ code: string | null;
15
15
  name: string | null;
16
16
  };
17
17
 
@@ -20,7 +20,7 @@ export const Dimension$inboundSchema: z.ZodMiniType<Dimension, unknown> = z
20
20
  .object({
21
21
  id: types.nullable(types.string()),
22
22
  categoryName: types.nullable(types.string()),
23
- code: z.optional(z.nullable(types.string())),
23
+ code: types.nullable(types.string()),
24
24
  name: types.nullable(types.string()),
25
25
  });
26
26
 
@@ -20,8 +20,8 @@ export const EmailAddressType = {
20
20
  export type EmailAddressType = ClosedEnum<typeof EmailAddressType>;
21
21
 
22
22
  export type EmailAddress = {
23
- email: string | null;
24
- type: EmailAddressType | null;
23
+ email?: string | null | undefined;
24
+ type?: EmailAddressType | null | undefined;
25
25
  };
26
26
 
27
27
  /** @internal */
@@ -32,8 +32,8 @@ export const EmailAddressType$inboundSchema: z.ZodMiniEnum<
32
32
  /** @internal */
33
33
  export const EmailAddress$inboundSchema: z.ZodMiniType<EmailAddress, unknown> =
34
34
  z.object({
35
- email: types.nullable(types.string()),
36
- type: types.nullable(EmailAddressType$inboundSchema),
35
+ email: z.optional(z.nullable(types.string())),
36
+ type: z.optional(z.nullable(EmailAddressType$inboundSchema)),
37
37
  });
38
38
 
39
39
  export function emailAddressFromJSON(
@@ -6,6 +6,7 @@ export * from "./account-request-common-dto-v2.js";
6
6
  export * from "./account-response-dto.js";
7
7
  export * from "./address-offer.js";
8
8
  export * from "./address.js";
9
+ export * from "./advance-payment-input.js";
9
10
  export * from "./async-task-response-dto.js";
10
11
  export * from "./bank-account-request-common-dto-v2.js";
11
12
  export * from "./bank-account-response-dto.js";
@@ -94,7 +94,7 @@ export type InvoiceResponseDto = {
94
94
  currency: string | null;
95
95
  discountAmount: number | null;
96
96
  dueDate: string | null;
97
- fileId?: string | null | undefined;
97
+ fileId: string | null;
98
98
  invoiceDate: string | null;
99
99
  invoiceNumber: string | null;
100
100
  invoiceType: InvoiceResponseDtoInvoiceType | null;
@@ -155,7 +155,7 @@ export const InvoiceResponseDto$inboundSchema: z.ZodMiniType<
155
155
  currency: types.nullable(types.string()),
156
156
  discountAmount: types.nullable(types.number()),
157
157
  dueDate: types.nullable(types.string()),
158
- fileId: z.optional(z.nullable(types.string())),
158
+ fileId: types.nullable(types.string()),
159
159
  invoiceDate: types.nullable(types.string()),
160
160
  invoiceNumber: types.nullable(types.string()),
161
161
  invoiceType: types.nullable(InvoiceResponseDtoInvoiceType$inboundSchema),
@@ -13,6 +13,24 @@ import {
13
13
  JournalLineItem$inboundSchema,
14
14
  } from "./journal-line-item.js";
15
15
 
16
+ export const JournalEntryResponseDtoType = {
17
+ AdvanceInvoiceRequested: "ADVANCE_INVOICE_REQUESTED",
18
+ AdvancePaymentReceived: "ADVANCE_PAYMENT_RECEIVED",
19
+ AdvanceLiabilityTransfer: "ADVANCE_LIABILITY_TRANSFER",
20
+ FinalInvoice: "FINAL_INVOICE",
21
+ FinalInvoiceClearing: "FINAL_INVOICE_CLEARING",
22
+ FinalPaymentReceived: "FINAL_PAYMENT_RECEIVED",
23
+ Other: "OTHER",
24
+ } as const;
25
+ export type JournalEntryResponseDtoType = ClosedEnum<
26
+ typeof JournalEntryResponseDtoType
27
+ >;
28
+
29
+ export type AdvancePayment = {
30
+ orderNumber: string | null;
31
+ type: JournalEntryResponseDtoType | null;
32
+ };
33
+
16
34
  export const JournalEntryResponseDtoCurrency = {
17
35
  Aed: "AED",
18
36
  Afn: "AFN",
@@ -187,6 +205,7 @@ export type JournalEntryResponseDto = {
187
205
  id: string | null;
188
206
  accountId: string | null;
189
207
  accountingPeriodId: string | null;
208
+ advancePayment?: AdvancePayment | null | undefined;
190
209
  createdDate: string | null;
191
210
  currency: JournalEntryResponseDtoCurrency | null;
192
211
  debitCreditIndicator?:
@@ -199,16 +218,40 @@ export type JournalEntryResponseDto = {
199
218
  dueDate?: string | null | undefined;
200
219
  exchangeRate?: string | null | undefined;
201
220
  files: Array<string> | null;
202
- isProvisional?: boolean | null | undefined;
203
- journalCode?: string | null | undefined;
221
+ isProvisional: boolean | null;
222
+ journalCode: string | null;
204
223
  journalLineItems: Array<JournalLineItem> | null;
205
- journalType?: string | null | undefined;
224
+ journalType: string | null;
206
225
  number: string | null;
207
226
  taxAssignmentDate?: string | null | undefined;
208
227
  transactionDate: string | null;
209
228
  updatedDate: string | null;
210
229
  };
211
230
 
231
+ /** @internal */
232
+ export const JournalEntryResponseDtoType$inboundSchema: z.ZodMiniEnum<
233
+ typeof JournalEntryResponseDtoType
234
+ > = z.enum(JournalEntryResponseDtoType);
235
+
236
+ /** @internal */
237
+ export const AdvancePayment$inboundSchema: z.ZodMiniType<
238
+ AdvancePayment,
239
+ unknown
240
+ > = z.object({
241
+ orderNumber: types.nullable(types.string()),
242
+ type: types.nullable(JournalEntryResponseDtoType$inboundSchema),
243
+ });
244
+
245
+ export function advancePaymentFromJSON(
246
+ jsonString: string,
247
+ ): SafeParseResult<AdvancePayment, SDKValidationError> {
248
+ return safeParse(
249
+ jsonString,
250
+ (x) => AdvancePayment$inboundSchema.parse(JSON.parse(x)),
251
+ `Failed to parse 'AdvancePayment' from JSON`,
252
+ );
253
+ }
254
+
212
255
  /** @internal */
213
256
  export const JournalEntryResponseDtoCurrency$inboundSchema: z.ZodMiniEnum<
214
257
  typeof JournalEntryResponseDtoCurrency
@@ -228,6 +271,9 @@ export const JournalEntryResponseDto$inboundSchema: z.ZodMiniType<
228
271
  id: types.nullable(types.string()),
229
272
  accountId: types.nullable(types.string()),
230
273
  accountingPeriodId: types.nullable(types.string()),
274
+ advancePayment: z.optional(
275
+ z.nullable(z.lazy(() => AdvancePayment$inboundSchema)),
276
+ ),
231
277
  createdDate: types.nullable(types.string()),
232
278
  currency: types.nullable(JournalEntryResponseDtoCurrency$inboundSchema),
233
279
  debitCreditIndicator: z.optional(
@@ -239,10 +285,10 @@ export const JournalEntryResponseDto$inboundSchema: z.ZodMiniType<
239
285
  dueDate: z.optional(z.nullable(types.string())),
240
286
  exchangeRate: z.optional(z.nullable(types.string())),
241
287
  files: types.nullable(z.array(types.string())),
242
- isProvisional: z.optional(z.nullable(types.boolean())),
243
- journalCode: z.optional(z.nullable(types.string())),
288
+ isProvisional: types.nullable(types.boolean()),
289
+ journalCode: types.nullable(types.string()),
244
290
  journalLineItems: types.nullable(z.array(JournalLineItem$inboundSchema)),
245
- journalType: z.optional(z.nullable(types.string())),
291
+ journalType: types.nullable(types.string()),
246
292
  number: types.nullable(types.string()),
247
293
  taxAssignmentDate: z.optional(z.nullable(types.string())),
248
294
  transactionDate: types.nullable(types.string()),
@@ -191,7 +191,7 @@ export type JournalLineItem = {
191
191
  id: string | null;
192
192
  accountCode: string | null;
193
193
  accountId: string | null;
194
- accountNumber?: number | null | undefined;
194
+ accountNumber: number | null;
195
195
  createdDate: string | null;
196
196
  currency: JournalLineItemCurrency | null;
197
197
  customerId: string | null;
@@ -249,7 +249,7 @@ export const JournalLineItem$inboundSchema: z.ZodMiniType<
249
249
  id: types.nullable(types.string()),
250
250
  accountCode: types.nullable(types.string()),
251
251
  accountId: types.nullable(types.string()),
252
- accountNumber: z.optional(z.nullable(types.number())),
252
+ accountNumber: types.nullable(types.number()),
253
253
  createdDate: types.nullable(types.string()),
254
254
  currency: types.nullable(JournalLineItemCurrency$inboundSchema),
255
255
  customerId: types.nullable(types.string()),
@@ -25,7 +25,7 @@ export type LineItemResponseDto = {
25
25
  itemId: string | null;
26
26
  name: string | null;
27
27
  quantity: number | null;
28
- taxCode?: string | null | undefined;
28
+ taxCode: string | null;
29
29
  taxRatePercentage: number | null;
30
30
  unitAmount: number | null;
31
31
  updatedDate: string | null;
@@ -50,7 +50,7 @@ export const LineItemResponseDto$inboundSchema: z.ZodMiniType<
50
50
  itemId: types.nullable(types.string()),
51
51
  name: types.nullable(types.string()),
52
52
  quantity: types.nullable(types.number()),
53
- taxCode: z.optional(z.nullable(types.string())),
53
+ taxCode: types.nullable(types.string()),
54
54
  taxRatePercentage: types.nullable(types.number()),
55
55
  unitAmount: types.nullable(types.number()),
56
56
  updatedDate: types.nullable(types.string()),
@@ -39,7 +39,7 @@ export type LineItemResponse = {
39
39
  taxRatePercentage: number | null;
40
40
  totalGrossAmount: number | null;
41
41
  totalNetAmount: number | null;
42
- type?: LineItemResponseType | null | undefined;
42
+ type: LineItemResponseType | null;
43
43
  updatedDate: string | null;
44
44
  };
45
45
 
@@ -74,7 +74,7 @@ export const LineItemResponse$inboundSchema: z.ZodMiniType<
74
74
  taxRatePercentage: types.nullable(types.number()),
75
75
  totalGrossAmount: types.nullable(types.number()),
76
76
  totalNetAmount: types.nullable(types.number()),
77
- type: z.optional(z.nullable(LineItemResponseType$inboundSchema)),
77
+ type: types.nullable(LineItemResponseType$inboundSchema),
78
78
  updatedDate: types.nullable(types.string()),
79
79
  });
80
80
 
@@ -27,7 +27,7 @@ export type OfferResponseDtoStatus = ClosedEnum<typeof OfferResponseDtoStatus>;
27
27
  export type OfferResponseDto = {
28
28
  id: string | null;
29
29
  addresses: Array<AddressOffer> | null;
30
- contactId?: string | null | undefined;
30
+ contactId: string | null;
31
31
  createdDate: string | null;
32
32
  currency: string | null;
33
33
  lineItems: Array<OfferLineItemResponseDto> | null;
@@ -58,7 +58,7 @@ export const OfferResponseDto$inboundSchema: z.ZodMiniType<
58
58
  > = z.object({
59
59
  id: types.nullable(types.string()),
60
60
  addresses: types.nullable(z.array(AddressOffer$inboundSchema)),
61
- contactId: z.optional(z.nullable(types.string())),
61
+ contactId: types.nullable(types.string()),
62
62
  createdDate: types.nullable(types.string()),
63
63
  currency: types.nullable(types.string()),
64
64
  lineItems: types.nullable(z.array(OfferLineItemResponseDto$inboundSchema)),
@@ -26,6 +26,10 @@ export type CreateJournalEntryAttachmentsRequestBody = {
26
26
 
27
27
  export type CreateJournalEntryAttachmentsRequest = {
28
28
  journalEntryId: string;
29
+ /**
30
+ * ID of the company (required for multi-company target systems)
31
+ */
32
+ companyId?: string | undefined;
29
33
  /**
30
34
  * API key
31
35
  */
@@ -126,6 +130,7 @@ export function createJournalEntryAttachmentsRequestBodyToJSON(
126
130
  /** @internal */
127
131
  export type CreateJournalEntryAttachmentsRequest$Outbound = {
128
132
  journalEntryId: string;
133
+ companyId?: string | undefined;
129
134
  apiKey?: string | undefined;
130
135
  accountKey?: string | undefined;
131
136
  body: CreateJournalEntryAttachmentsRequestBody$Outbound;
@@ -137,6 +142,7 @@ export const CreateJournalEntryAttachmentsRequest$outboundSchema: z.ZodMiniType<
137
142
  CreateJournalEntryAttachmentsRequest
138
143
  > = z.object({
139
144
  journalEntryId: z.string(),
145
+ companyId: z.optional(z.string()),
140
146
  apiKey: z.optional(z.string()),
141
147
  accountKey: z.optional(z.string()),
142
148
  body: z.lazy(() => CreateJournalEntryAttachmentsRequestBody$outboundSchema),
@@ -12,8 +12,8 @@ export type PaymentLine = {
12
12
  accountId: string | null;
13
13
  amount: number | null;
14
14
  contactName: string | null;
15
- contactId?: string | null | undefined;
16
- customerId?: string | null | undefined;
15
+ contactId: string | null;
16
+ customerId: string | null;
17
17
  description: string | null;
18
18
  invoiceId: string | null;
19
19
  supplierId: string | null;
@@ -26,8 +26,8 @@ export const PaymentLine$inboundSchema: z.ZodMiniType<PaymentLine, unknown> = z
26
26
  accountId: types.nullable(types.string()),
27
27
  amount: types.nullable(types.number()),
28
28
  contactName: types.nullable(types.string()),
29
- contactId: z.optional(z.nullable(types.string())),
30
- customerId: z.optional(z.nullable(types.string())),
29
+ contactId: types.nullable(types.string()),
30
+ customerId: types.nullable(types.string()),
31
31
  description: types.nullable(types.string()),
32
32
  invoiceId: types.nullable(types.string()),
33
33
  supplierId: types.nullable(types.string()),
@@ -23,8 +23,8 @@ export const PhoneNumberType = {
23
23
  export type PhoneNumberType = ClosedEnum<typeof PhoneNumberType>;
24
24
 
25
25
  export type PhoneNumber = {
26
- number: string | null;
27
- type: PhoneNumberType | null;
26
+ number?: string | null | undefined;
27
+ type?: PhoneNumberType | null | undefined;
28
28
  };
29
29
 
30
30
  /** @internal */
@@ -35,8 +35,8 @@ export const PhoneNumberType$inboundSchema: z.ZodMiniEnum<
35
35
  /** @internal */
36
36
  export const PhoneNumber$inboundSchema: z.ZodMiniType<PhoneNumber, unknown> = z
37
37
  .object({
38
- number: types.nullable(types.string()),
39
- type: types.nullable(PhoneNumberType$inboundSchema),
38
+ number: z.optional(z.nullable(types.string())),
39
+ type: z.optional(z.nullable(PhoneNumberType$inboundSchema)),
40
40
  });
41
41
 
42
42
  export function phoneNumberFromJSON(
@@ -35,7 +35,7 @@ export type SalesOrderResponseDto = {
35
35
  currency: string | null;
36
36
  deliveryDate: string | null;
37
37
  lineItems: Array<SalesOrderLineItemResponseDto> | null;
38
- oneLineAddress?: string | null | undefined;
38
+ oneLineAddress: string | null;
39
39
  orderDate: string | null;
40
40
  projectId: string | null;
41
41
  shippingContactId: string | null;
@@ -70,7 +70,7 @@ export const SalesOrderResponseDto$inboundSchema: z.ZodMiniType<
70
70
  lineItems: types.nullable(
71
71
  z.array(SalesOrderLineItemResponseDto$inboundSchema),
72
72
  ),
73
- oneLineAddress: z.optional(z.nullable(types.string())),
73
+ oneLineAddress: types.nullable(types.string()),
74
74
  orderDate: types.nullable(types.string()),
75
75
  projectId: types.nullable(types.string()),
76
76
  shippingContactId: types.nullable(types.string()),