@clientcasa/sdk 0.6.4 → 0.7.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.
Files changed (132) hide show
  1. package/esm/funcs/forms-and-agreements-list.js +1 -0
  2. package/esm/funcs/forms-and-agreements-list.js.map +1 -1
  3. package/esm/funcs/transactions-create.d.ts +3 -0
  4. package/esm/funcs/transactions-create.d.ts.map +1 -1
  5. package/esm/funcs/transactions-create.js +3 -0
  6. package/esm/funcs/transactions-create.js.map +1 -1
  7. package/esm/funcs/transactions-update.d.ts +1 -1
  8. package/esm/funcs/transactions-update.js +1 -1
  9. package/esm/lib/config.d.ts +3 -3
  10. package/esm/lib/config.js +3 -3
  11. package/esm/lib/config.js.map +1 -1
  12. package/esm/lib/encodings.d.ts +10 -9
  13. package/esm/lib/encodings.d.ts.map +1 -1
  14. package/esm/lib/encodings.js +29 -13
  15. package/esm/lib/encodings.js.map +1 -1
  16. package/esm/lib/http.d.ts +1 -1
  17. package/esm/lib/http.d.ts.map +1 -1
  18. package/esm/lib/http.js +1 -1
  19. package/esm/lib/http.js.map +1 -1
  20. package/esm/lib/security.d.ts +5 -4
  21. package/esm/lib/security.d.ts.map +1 -1
  22. package/esm/lib/security.js +4 -6
  23. package/esm/lib/security.js.map +1 -1
  24. package/esm/models/api-error.d.ts +25 -3
  25. package/esm/models/api-error.d.ts.map +1 -1
  26. package/esm/models/api-error.js +25 -1
  27. package/esm/models/api-error.js.map +1 -1
  28. package/esm/models/catalog-item-create.d.ts +5 -0
  29. package/esm/models/catalog-item-create.d.ts.map +1 -1
  30. package/esm/models/catalog-item-create.js +1 -0
  31. package/esm/models/catalog-item-create.js.map +1 -1
  32. package/esm/models/catalog-item-update.d.ts +4 -4
  33. package/esm/models/catalog-item-update.d.ts.map +1 -1
  34. package/esm/models/catalog-item-update.js +4 -4
  35. package/esm/models/catalog-item-update.js.map +1 -1
  36. package/esm/models/catalog-item.d.ts +4 -0
  37. package/esm/models/catalog-item.d.ts.map +1 -1
  38. package/esm/models/catalog-item.js +1 -0
  39. package/esm/models/catalog-item.js.map +1 -1
  40. package/esm/models/client-create.d.ts +5 -0
  41. package/esm/models/client-create.d.ts.map +1 -1
  42. package/esm/models/client-create.js +1 -0
  43. package/esm/models/client-create.js.map +1 -1
  44. package/esm/models/client-document.d.ts +4 -0
  45. package/esm/models/client-document.d.ts.map +1 -1
  46. package/esm/models/client-document.js +1 -0
  47. package/esm/models/client-document.js.map +1 -1
  48. package/esm/models/client-update.d.ts +1 -1
  49. package/esm/models/client-update.d.ts.map +1 -1
  50. package/esm/models/client-update.js +1 -1
  51. package/esm/models/client-update.js.map +1 -1
  52. package/esm/models/client.d.ts +4 -0
  53. package/esm/models/client.d.ts.map +1 -1
  54. package/esm/models/client.js +1 -0
  55. package/esm/models/client.js.map +1 -1
  56. package/esm/models/contact-update.d.ts +2 -2
  57. package/esm/models/contact-update.d.ts.map +1 -1
  58. package/esm/models/contact-update.js +2 -2
  59. package/esm/models/contact-update.js.map +1 -1
  60. package/esm/models/contract.d.ts +4 -0
  61. package/esm/models/contract.d.ts.map +1 -1
  62. package/esm/models/contract.js +1 -0
  63. package/esm/models/contract.js.map +1 -1
  64. package/esm/models/operations/list-client-documents.d.ts +9 -0
  65. package/esm/models/operations/list-client-documents.d.ts.map +1 -1
  66. package/esm/models/operations/list-client-documents.js +7 -0
  67. package/esm/models/operations/list-client-documents.js.map +1 -1
  68. package/esm/models/payment.d.ts +1 -1
  69. package/esm/models/payment.d.ts.map +1 -1
  70. package/esm/models/payment.js +1 -1
  71. package/esm/models/payment.js.map +1 -1
  72. package/esm/models/project-update.d.ts +1 -1
  73. package/esm/models/project-update.d.ts.map +1 -1
  74. package/esm/models/project-update.js +1 -1
  75. package/esm/models/project-update.js.map +1 -1
  76. package/esm/models/project.d.ts +5 -1
  77. package/esm/models/project.d.ts.map +1 -1
  78. package/esm/models/project.js +2 -1
  79. package/esm/models/project.js.map +1 -1
  80. package/esm/models/time-entry-update.d.ts +2 -2
  81. package/esm/models/time-entry-update.d.ts.map +1 -1
  82. package/esm/models/time-entry-update.js +2 -2
  83. package/esm/models/time-entry-update.js.map +1 -1
  84. package/esm/models/time-entry.d.ts +3 -3
  85. package/esm/models/time-entry.d.ts.map +1 -1
  86. package/esm/models/time-entry.js +3 -3
  87. package/esm/models/time-entry.js.map +1 -1
  88. package/esm/models/transaction-create.d.ts +5 -0
  89. package/esm/models/transaction-create.d.ts.map +1 -1
  90. package/esm/models/transaction-create.js +1 -0
  91. package/esm/models/transaction-create.js.map +1 -1
  92. package/esm/models/transaction-update.d.ts +3 -3
  93. package/esm/models/transaction-update.d.ts.map +1 -1
  94. package/esm/models/transaction-update.js +3 -3
  95. package/esm/models/transaction-update.js.map +1 -1
  96. package/esm/models/transaction.d.ts +4 -0
  97. package/esm/models/transaction.d.ts.map +1 -1
  98. package/esm/models/transaction.js +1 -0
  99. package/esm/models/transaction.js.map +1 -1
  100. package/esm/sdk/transactions.d.ts +4 -1
  101. package/esm/sdk/transactions.d.ts.map +1 -1
  102. package/esm/sdk/transactions.js +4 -1
  103. package/esm/sdk/transactions.js.map +1 -1
  104. package/jsr.json +1 -1
  105. package/package.json +2 -2
  106. package/src/funcs/forms-and-agreements-list.ts +1 -0
  107. package/src/funcs/transactions-create.ts +3 -0
  108. package/src/funcs/transactions-update.ts +1 -1
  109. package/src/lib/config.ts +3 -3
  110. package/src/lib/encodings.ts +58 -23
  111. package/src/lib/http.ts +3 -1
  112. package/src/lib/security.ts +10 -5
  113. package/src/models/api-error.ts +46 -2
  114. package/src/models/catalog-item-create.ts +6 -0
  115. package/src/models/catalog-item-update.ts +8 -9
  116. package/src/models/catalog-item.ts +5 -0
  117. package/src/models/client-create.ts +6 -0
  118. package/src/models/client-document.ts +5 -0
  119. package/src/models/client-update.ts +2 -2
  120. package/src/models/client.ts +5 -0
  121. package/src/models/contact-update.ts +4 -4
  122. package/src/models/contract.ts +5 -0
  123. package/src/models/operations/list-client-documents.ts +14 -0
  124. package/src/models/payment.ts +2 -2
  125. package/src/models/project-update.ts +2 -2
  126. package/src/models/project.ts +7 -2
  127. package/src/models/time-entry-update.ts +4 -4
  128. package/src/models/time-entry.ts +6 -6
  129. package/src/models/transaction-create.ts +6 -0
  130. package/src/models/transaction-update.ts +6 -6
  131. package/src/models/transaction.ts +5 -0
  132. package/src/sdk/transactions.ts +4 -1
@@ -32,7 +32,7 @@ import { Result } from "../types/fp.js";
32
32
  * Update a transaction
33
33
  *
34
34
  * @remarks
35
- * Transactions billed to a sent/paid invoice may be frozen — the server will return 409 if so.
35
+ * Transactions billed to a sent/paid invoice may be frozen — the server will return 409 if so. A `global` transaction applies org-wide (all clients for revenue, overhead for cost), so it cannot carry `assignments` — send an empty array, or use mode `each`/`split` to scope it. This constraint is enforced by the server but cannot be expressed in JSON Schema, so generated SDKs will surface it as a 400 rather than a compile error.
36
36
  */
37
37
  export function transactionsUpdate(
38
38
  client: ClientCasaCore,
package/src/lib/config.ts CHANGED
@@ -61,7 +61,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
61
61
  export const SDK_METADATA = {
62
62
  language: "typescript",
63
63
  openapiDocVersion: "1.0.0",
64
- sdkVersion: "0.6.4",
65
- genVersion: "2.915.1",
66
- userAgent: "speakeasy-sdk/typescript 0.6.4 2.915.1 1.0.0 @clientcasa/sdk",
64
+ sdkVersion: "0.7.0",
65
+ genVersion: "2.932.15",
66
+ userAgent: "speakeasy-sdk/typescript 0.7.0 2.932.15 1.0.0 @clientcasa/sdk",
67
67
  } as const;
@@ -12,10 +12,41 @@ export class EncodingError extends Error {
12
12
  }
13
13
  }
14
14
 
15
+ export type CharEncoding = "percent" | "percentExceptReserved" | "none";
16
+
17
+ const reservedEscapes = /%(2[346bcf]|3[abdf]|40|5[bd])/gi;
18
+
19
+ function encodeKeyChars(
20
+ v: string,
21
+ charEncoding: CharEncoding | undefined,
22
+ ): string {
23
+ return encodeChars(
24
+ v,
25
+ charEncoding === "percentExceptReserved" ? "percent" : charEncoding,
26
+ );
27
+ }
28
+
29
+ function encodeChars(
30
+ v: string,
31
+ charEncoding: CharEncoding | undefined,
32
+ ): string {
33
+ switch (charEncoding) {
34
+ case "percent":
35
+ return encodeURIComponent(v);
36
+ case "percentExceptReserved":
37
+ return encodeURIComponent(v).replace(
38
+ reservedEscapes,
39
+ (m) => decodeURIComponent(m),
40
+ );
41
+ default:
42
+ return v;
43
+ }
44
+ }
45
+
15
46
  export function encodeMatrix(
16
47
  key: string,
17
48
  value: unknown,
18
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
49
+ options?: { explode?: boolean; charEncoding?: CharEncoding },
19
50
  ): string | undefined {
20
51
  let out = "";
21
52
  const pairs: [string, unknown][] = options?.explode
@@ -27,7 +58,7 @@ export function encodeMatrix(
27
58
  }
28
59
 
29
60
  const encodeString = (v: string) => {
30
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
61
+ return encodeChars(v, options?.charEncoding);
31
62
  };
32
63
  const encodeValue = (v: unknown) => encodeString(serializeValue(v));
33
64
 
@@ -52,7 +83,7 @@ export function encodeMatrix(
52
83
  return;
53
84
  }
54
85
 
55
- const keyPrefix = encodeString(pk);
86
+ const keyPrefix = encodeKeyChars(pk, options?.charEncoding);
56
87
  tmp = `${keyPrefix}=${encValue}`;
57
88
  // trim trailing '=' if value was empty
58
89
  if (tmp === `${keyPrefix}=`) {
@@ -73,7 +104,7 @@ export function encodeMatrix(
73
104
  export function encodeLabel(
74
105
  key: string,
75
106
  value: unknown,
76
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
107
+ options?: { explode?: boolean; charEncoding?: CharEncoding },
77
108
  ): string | undefined {
78
109
  let out = "";
79
110
  const pairs: [string, unknown][] = options?.explode
@@ -85,7 +116,7 @@ export function encodeLabel(
85
116
  }
86
117
 
87
118
  const encodeString = (v: string) => {
88
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
119
+ return encodeChars(v, options?.charEncoding);
89
120
  };
90
121
  const encodeValue = (v: unknown) => encodeString(serializeValue(v));
91
122
 
@@ -103,7 +134,7 @@ export function encodeLabel(
103
134
  encValue = mapped?.join("").slice(1);
104
135
  } else {
105
136
  const k = options?.explode && isPlainObject(value)
106
- ? `${encodeString(pk)}=`
137
+ ? `${encodeKeyChars(pk, options?.charEncoding)}=`
107
138
  : "";
108
139
  encValue = `${k}${encodeValue(pv)}`;
109
140
  }
@@ -117,14 +148,14 @@ export function encodeLabel(
117
148
  type FormEncoder = (
118
149
  key: string,
119
150
  value: unknown,
120
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
151
+ options?: { explode?: boolean; charEncoding?: CharEncoding },
121
152
  ) => string | undefined;
122
153
 
123
154
  function formEncoder(sep: string): FormEncoder {
124
155
  return (
125
156
  key: string,
126
157
  value: unknown,
127
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
158
+ options?: { explode?: boolean; charEncoding?: CharEncoding },
128
159
  ) => {
129
160
  let out = "";
130
161
  const pairs: [string, unknown][] = options?.explode
@@ -136,7 +167,7 @@ function formEncoder(sep: string): FormEncoder {
136
167
  }
137
168
 
138
169
  const encodeString = (v: string) => {
139
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
170
+ return encodeChars(v, options?.charEncoding);
140
171
  };
141
172
 
142
173
  const encodeValue = (v: unknown) => encodeString(serializeValue(v));
@@ -163,7 +194,7 @@ function formEncoder(sep: string): FormEncoder {
163
194
  return;
164
195
  }
165
196
 
166
- tmp = `${encodeString(pk)}=${encValue}`;
197
+ tmp = `${encodeKeyChars(pk, options?.charEncoding)}=${encValue}`;
167
198
 
168
199
  // If we end up with the nothing then skip forward
169
200
  if (!tmp || tmp === "=") {
@@ -184,7 +215,7 @@ export const encodePipeDelimited = formEncoder("|");
184
215
  export function encodeBodyForm(
185
216
  key: string,
186
217
  value: unknown,
187
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
218
+ options?: { explode?: boolean; charEncoding?: CharEncoding },
188
219
  ): string {
189
220
  let out = "";
190
221
  const pairs: [string, unknown][] = options?.explode
@@ -192,7 +223,7 @@ export function encodeBodyForm(
192
223
  : [[key, value]];
193
224
 
194
225
  const encodeString = (v: string) => {
195
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
226
+ return encodeChars(v, options?.charEncoding);
196
227
  };
197
228
 
198
229
  const encodeValue = (v: unknown) => encodeString(serializeValue(v));
@@ -211,7 +242,7 @@ export function encodeBodyForm(
211
242
  encValue = `${encodeValue(pv)}`;
212
243
  }
213
244
 
214
- tmp = `${encodeString(pk)}=${encValue}`;
245
+ tmp = `${encodeKeyChars(pk, options?.charEncoding)}=${encValue}`;
215
246
 
216
247
  // If we end up with the nothing then skip forward
217
248
  if (!tmp || tmp === "=") {
@@ -227,7 +258,7 @@ export function encodeBodyForm(
227
258
  export function encodeDeepObject(
228
259
  key: string,
229
260
  value: unknown,
230
- options?: { charEncoding?: "percent" | "none" },
261
+ options?: { charEncoding?: CharEncoding },
231
262
  ): string | undefined {
232
263
  if (value == null) {
233
264
  return;
@@ -245,7 +276,7 @@ export function encodeDeepObject(
245
276
  export function encodeDeepObjectObject(
246
277
  key: string,
247
278
  value: unknown,
248
- options?: { charEncoding?: "percent" | "none" },
279
+ options?: { charEncoding?: CharEncoding },
249
280
  ): string | undefined {
250
281
  if (value == null) {
251
282
  return;
@@ -254,7 +285,7 @@ export function encodeDeepObjectObject(
254
285
  let out = "";
255
286
 
256
287
  const encodeString = (v: string) => {
257
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
288
+ return encodeChars(v, options?.charEncoding);
258
289
  };
259
290
 
260
291
  if (!isPlainObject(value)) {
@@ -278,7 +309,9 @@ export function encodeDeepObjectObject(
278
309
 
279
310
  const pairs: unknown[] = Array.isArray(cv) ? cv : [cv];
280
311
  const encoded = mapDefined(pairs, (v) => {
281
- return `${encodeString(pk)}=${encodeString(serializeValue(v))}`;
312
+ return `${encodeKeyChars(pk, options?.charEncoding)}=${
313
+ encodeString(serializeValue(v))
314
+ }`;
282
315
  })?.join("&");
283
316
 
284
317
  out += encoded == null ? "" : `&${encoded}`;
@@ -290,25 +323,27 @@ export function encodeDeepObjectObject(
290
323
  export function encodeJSON(
291
324
  key: string,
292
325
  value: unknown,
293
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
326
+ options?: { explode?: boolean; charEncoding?: CharEncoding },
294
327
  ): string | undefined {
295
328
  if (typeof value === "undefined") {
296
329
  return;
297
330
  }
298
331
 
299
332
  const encodeString = (v: string) => {
300
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
333
+ return encodeChars(v, options?.charEncoding);
301
334
  };
302
335
 
303
336
  const encVal = encodeString(JSON.stringify(value, jsonReplacer));
304
337
 
305
- return options?.explode ? encVal : `${encodeString(key)}=${encVal}`;
338
+ return options?.explode
339
+ ? encVal
340
+ : `${encodeKeyChars(key, options?.charEncoding)}=${encVal}`;
306
341
  }
307
342
 
308
343
  export const encodeSimple = (
309
344
  key: string,
310
345
  value: unknown,
311
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
346
+ options?: { explode?: boolean; charEncoding?: CharEncoding },
312
347
  ): string | undefined => {
313
348
  let out = "";
314
349
  const pairs: [string, unknown][] = options?.explode
@@ -320,7 +355,7 @@ export const encodeSimple = (
320
355
  }
321
356
 
322
357
  const encodeString = (v: string) => {
323
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
358
+ return encodeChars(v, options?.charEncoding);
324
359
  };
325
360
  const encodeValue = (v: unknown) => encodeString(serializeValue(v));
326
361
 
@@ -426,7 +461,7 @@ export function queryJoin(...args: (string | undefined)[]): string {
426
461
 
427
462
  type QueryEncoderOptions = {
428
463
  explode?: boolean;
429
- charEncoding?: "percent" | "none";
464
+ charEncoding?: CharEncoding;
430
465
  allowEmptyValue?: string[];
431
466
  };
432
467
 
package/src/lib/http.ts CHANGED
@@ -45,8 +45,10 @@ export class HTTPClient {
45
45
  private requestHooks: BeforeRequestHook[] = [];
46
46
  private requestErrorHooks: RequestErrorHook[] = [];
47
47
  private responseHooks: ResponseHook[] = [];
48
+ private options: HTTPClientOptions;
48
49
 
49
- constructor(private options: HTTPClientOptions = {}) {
50
+ constructor(options: HTTPClientOptions = {}) {
51
+ this.options = options;
50
52
  this.fetcher = options.fetcher || DEFAULT_FETCHER;
51
53
  }
52
54
 
@@ -13,17 +13,22 @@ type OAuth2PasswordFlow = {
13
13
  tokenURL: string;
14
14
  };
15
15
 
16
- export enum SecurityErrorCode {
17
- Incomplete = "incomplete",
18
- UnrecognisedSecurityType = "unrecognized_security_type",
19
- }
16
+ export const SecurityErrorCode = {
17
+ Incomplete: "incomplete",
18
+ UnrecognisedSecurityType: "unrecognized_security_type",
19
+ } as const;
20
+ export type SecurityErrorCode =
21
+ (typeof SecurityErrorCode)[keyof typeof SecurityErrorCode];
20
22
 
21
23
  export class SecurityError extends Error {
24
+ public code: SecurityErrorCode;
25
+
22
26
  constructor(
23
- public code: SecurityErrorCode,
27
+ code: SecurityErrorCode,
24
28
  message: string,
25
29
  ) {
26
30
  super(message);
31
+ this.code = code;
27
32
  this.name = "SecurityError";
28
33
  }
29
34
 
@@ -18,28 +18,72 @@ export const Code = {
18
18
  RateLimited: "rate_limited",
19
19
  Conflict: "conflict",
20
20
  Gone: "gone",
21
+ PayloadTooLarge: "payload_too_large",
21
22
  ClientError: "client_error",
22
23
  InternalError: "internal_error",
23
24
  } as const;
24
25
  export type Code = OpenEnum<typeof Code>;
25
26
 
27
+ export const DetailsCode = {
28
+ ArchivedRecordReadOnly: "archived_record_read_only",
29
+ RecordHasDependents: "record_has_dependents",
30
+ DuplicateRecord: "duplicate_record",
31
+ RecordImmutable: "record_immutable",
32
+ QuotaExceeded: "quota_exceeded",
33
+ InvalidPayload: "invalid_payload",
34
+ UnsupportedFileType: "unsupported_file_type",
35
+ FileTooLarge: "file_too_large",
36
+ CrossOrganization: "cross_organization",
37
+ RateLimited: "rate_limited",
38
+ RevenueOnInternalProject: "revenue_on_internal_project",
39
+ } as const;
40
+ export type DetailsCode = OpenEnum<typeof DetailsCode>;
41
+
42
+ export type Details = {
43
+ code?: DetailsCode | undefined;
44
+ [additionalProperties: string]: unknown;
45
+ };
46
+
26
47
  export type ErrorT = {
27
48
  code: Code;
28
49
  message: string;
29
50
  requestId: string;
30
- details?: { [k: string]: any } | undefined;
51
+ details?: Details | undefined;
31
52
  };
32
53
 
33
54
  /** @internal */
34
55
  export const Code$inboundSchema: z.ZodMiniType<Code, unknown> = openEnums
35
56
  .inboundSchema(Code);
36
57
 
58
+ /** @internal */
59
+ export const DetailsCode$inboundSchema: z.ZodMiniType<DetailsCode, unknown> =
60
+ openEnums.inboundSchema(DetailsCode);
61
+
62
+ /** @internal */
63
+ export const Details$inboundSchema: z.ZodMiniType<Details, unknown> = z
64
+ .catchall(
65
+ z.object({
66
+ code: types.optional(DetailsCode$inboundSchema),
67
+ }),
68
+ z.any(),
69
+ );
70
+
71
+ export function detailsFromJSON(
72
+ jsonString: string,
73
+ ): SafeParseResult<Details, SDKValidationError> {
74
+ return safeParse(
75
+ jsonString,
76
+ (x) => Details$inboundSchema.parse(JSON.parse(x)),
77
+ `Failed to parse 'Details' from JSON`,
78
+ );
79
+ }
80
+
37
81
  /** @internal */
38
82
  export const ErrorT$inboundSchema: z.ZodMiniType<ErrorT, unknown> = z.object({
39
83
  code: Code$inboundSchema,
40
84
  message: types.string(),
41
85
  requestId: types.string(),
42
- details: types.optional(z.record(z.string(), z.any())),
86
+ details: types.optional(z.lazy(() => Details$inboundSchema)),
43
87
  });
44
88
 
45
89
  export function errorFromJSON(
@@ -48,6 +48,10 @@ export type CatalogItemCreateStatus = ClosedEnum<
48
48
 
49
49
  export type CatalogItemCreate = {
50
50
  name: string;
51
+ /**
52
+ * UUID v4
53
+ */
54
+ businessId?: string | undefined;
51
55
  invoiceLabel?: string | undefined;
52
56
  description?: string | undefined;
53
57
  invoiceDescription?: string | undefined;
@@ -95,6 +99,7 @@ export const CatalogItemCreateStatus$outboundSchema: z.ZodMiniEnum<
95
99
  /** @internal */
96
100
  export type CatalogItemCreate$Outbound = {
97
101
  name: string;
102
+ businessId?: string | undefined;
98
103
  invoiceLabel?: string | undefined;
99
104
  description?: string | undefined;
100
105
  invoiceDescription?: string | undefined;
@@ -114,6 +119,7 @@ export const CatalogItemCreate$outboundSchema: z.ZodMiniType<
114
119
  CatalogItemCreate
115
120
  > = z.object({
116
121
  name: z.string(),
122
+ businessId: z.optional(z.string()),
117
123
  invoiceLabel: z.optional(z.string()),
118
124
  description: z.optional(z.string()),
119
125
  invoiceDescription: z.optional(z.string()),
@@ -99,12 +99,12 @@ export type CatalogItemUpdate$Outbound = {
99
99
  description?: string | undefined;
100
100
  invoiceDescription?: string | undefined;
101
101
  defaultRate?: number | undefined;
102
- unit: string;
103
- defaultFrequency: string;
102
+ unit?: string | undefined;
103
+ defaultFrequency?: string | undefined;
104
104
  type?: string | undefined;
105
- pricingMode: string;
105
+ pricingMode?: string | undefined;
106
106
  taxCategoryId?: string | undefined;
107
- status: string;
107
+ status?: string | undefined;
108
108
  clientId?: string | undefined;
109
109
  };
110
110
 
@@ -118,15 +118,14 @@ export const CatalogItemUpdate$outboundSchema: z.ZodMiniType<
118
118
  description: z.optional(z.string()),
119
119
  invoiceDescription: z.optional(z.string()),
120
120
  defaultRate: z.optional(z.number()),
121
- unit: z._default(CatalogItemUpdateUnit$outboundSchema, "flat"),
122
- defaultFrequency: z._default(
121
+ unit: z.optional(CatalogItemUpdateUnit$outboundSchema),
122
+ defaultFrequency: z.optional(
123
123
  CatalogItemUpdateDefaultFrequency$outboundSchema,
124
- "one-time",
125
124
  ),
126
125
  type: z.optional(CatalogItemUpdateType$outboundSchema),
127
- pricingMode: z._default(CatalogItemUpdatePricingMode$outboundSchema, "fixed"),
126
+ pricingMode: z.optional(CatalogItemUpdatePricingMode$outboundSchema),
128
127
  taxCategoryId: z.optional(z.string()),
129
- status: z._default(CatalogItemUpdateStatus$outboundSchema, "active"),
128
+ status: z.optional(CatalogItemUpdateStatus$outboundSchema),
130
129
  clientId: z.optional(z.string()),
131
130
  });
132
131
 
@@ -65,6 +65,10 @@ export type CatalogItem = {
65
65
  */
66
66
  id: string;
67
67
  name: string;
68
+ /**
69
+ * UUID v4
70
+ */
71
+ businessId: string;
68
72
  invoiceLabel: string | null;
69
73
  description: string | null;
70
74
  invoiceDescription: string | null;
@@ -140,6 +144,7 @@ export const CatalogItem$inboundSchema: z.ZodMiniType<CatalogItem, unknown> = z
140
144
  .object({
141
145
  id: types.string(),
142
146
  name: types.string(),
147
+ businessId: types.string(),
143
148
  invoiceLabel: types.nullable(types.string()),
144
149
  description: types.nullable(types.string()),
145
150
  invoiceDescription: types.nullable(types.string()),
@@ -24,6 +24,10 @@ export type ClientCreateStatus = ClosedEnum<typeof ClientCreateStatus>;
24
24
  export type ClientCreate = {
25
25
  name: string;
26
26
  status?: ClientCreateStatus | undefined;
27
+ /**
28
+ * UUID v4
29
+ */
30
+ businessId?: string | undefined;
27
31
  notes?: string | undefined;
28
32
  taxSettings?: ClientTaxSettings | undefined;
29
33
  invoiceRemindersEnabled?: boolean | undefined;
@@ -40,6 +44,7 @@ export const ClientCreateStatus$outboundSchema: z.ZodMiniEnum<
40
44
  export type ClientCreate$Outbound = {
41
45
  name: string;
42
46
  status: string;
47
+ businessId?: string | undefined;
43
48
  notes?: string | undefined;
44
49
  taxSettings?: ClientTaxSettings$Outbound | undefined;
45
50
  invoiceRemindersEnabled?: boolean | undefined;
@@ -54,6 +59,7 @@ export const ClientCreate$outboundSchema: z.ZodMiniType<
54
59
  > = z.object({
55
60
  name: z.string(),
56
61
  status: z._default(ClientCreateStatus$outboundSchema, "active"),
62
+ businessId: z.optional(z.string()),
57
63
  notes: z.optional(z.string()),
58
64
  taxSettings: z.optional(ClientTaxSettings$outboundSchema),
59
65
  invoiceRemindersEnabled: z.optional(z.boolean()),
@@ -61,6 +61,10 @@ export type ClientDocument = {
61
61
  * ISO 8601 timestamp (UTC)
62
62
  */
63
63
  expiresAt: Date | null;
64
+ /**
65
+ * ISO 8601 timestamp (UTC)
66
+ */
67
+ archivedAt: Date | null;
64
68
  /**
65
69
  * ISO 8601 timestamp (UTC)
66
70
  */
@@ -99,6 +103,7 @@ export const ClientDocument$inboundSchema: z.ZodMiniType<
99
103
  clientUrl: types.nullable(types.string()),
100
104
  quoteConvertedAt: types.nullable(types.date()),
101
105
  expiresAt: types.nullable(types.date()),
106
+ archivedAt: types.nullable(types.date()),
102
107
  createdAt: types.date(),
103
108
  updatedAt: types.date(),
104
109
  });
@@ -39,7 +39,7 @@ export const ClientUpdateStatus$outboundSchema: z.ZodMiniEnum<
39
39
  /** @internal */
40
40
  export type ClientUpdate$Outbound = {
41
41
  name?: string | undefined;
42
- status: string;
42
+ status?: string | undefined;
43
43
  notes?: string | undefined;
44
44
  taxSettings?: ClientTaxSettings$Outbound | undefined;
45
45
  invoiceRemindersEnabled?: boolean | undefined;
@@ -53,7 +53,7 @@ export const ClientUpdate$outboundSchema: z.ZodMiniType<
53
53
  ClientUpdate
54
54
  > = z.object({
55
55
  name: z.optional(z.string()),
56
- status: z._default(ClientUpdateStatus$outboundSchema, "active"),
56
+ status: z.optional(ClientUpdateStatus$outboundSchema),
57
57
  notes: z.optional(z.string()),
58
58
  taxSettings: z.optional(ClientTaxSettings$outboundSchema),
59
59
  invoiceRemindersEnabled: z.optional(z.boolean()),
@@ -46,6 +46,10 @@ export type Client = {
46
46
  id: string;
47
47
  name: string;
48
48
  status: ClientStatus;
49
+ /**
50
+ * UUID v4
51
+ */
52
+ businessId: string;
49
53
  notes: string | null;
50
54
  taxSettings: ClientTaxSettings;
51
55
  invoiceRemindersEnabled: boolean;
@@ -100,6 +104,7 @@ export const Client$inboundSchema: z.ZodMiniType<Client, unknown> = z.object({
100
104
  id: types.string(),
101
105
  name: types.string(),
102
106
  status: ClientStatus$inboundSchema,
107
+ businessId: types.string(),
103
108
  notes: types.nullable(types.string()),
104
109
  taxSettings: ClientTaxSettings$inboundSchema,
105
110
  invoiceRemindersEnabled: types.boolean(),
@@ -36,8 +36,8 @@ export type ContactUpdate$Outbound = {
36
36
  email?: string | undefined;
37
37
  phone?: string | undefined;
38
38
  title?: string | undefined;
39
- role: string;
40
- isPrimary: boolean;
39
+ role?: string | undefined;
40
+ isPrimary?: boolean | undefined;
41
41
  clientId?: string | undefined;
42
42
  };
43
43
 
@@ -50,8 +50,8 @@ export const ContactUpdate$outboundSchema: z.ZodMiniType<
50
50
  email: z.optional(z.string()),
51
51
  phone: z.optional(z.string()),
52
52
  title: z.optional(z.string()),
53
- role: z._default(ContactUpdateRole$outboundSchema, "other"),
54
- isPrimary: z._default(z.boolean(), false),
53
+ role: z.optional(ContactUpdateRole$outboundSchema),
54
+ isPrimary: z.optional(z.boolean()),
55
55
  clientId: z.optional(z.string()),
56
56
  });
57
57
 
@@ -95,6 +95,10 @@ export type Contract = {
95
95
  contractValue: number | null;
96
96
  signers: Array<Signer>;
97
97
  archived: boolean;
98
+ /**
99
+ * ISO 8601 timestamp (UTC)
100
+ */
101
+ archivedAt: Date | null;
98
102
  /**
99
103
  * ISO 8601 timestamp (UTC)
100
104
  */
@@ -182,6 +186,7 @@ export const Contract$inboundSchema: z.ZodMiniType<Contract, unknown> = z
182
186
  contractValue: types.nullable(types.number()),
183
187
  signers: z.array(z.lazy(() => Signer$inboundSchema)),
184
188
  archived: types.boolean(),
189
+ archivedAt: types.nullable(types.date()),
185
190
  createdAt: types.date(),
186
191
  updatedAt: types.date(),
187
192
  });
@@ -29,6 +29,12 @@ export type ListClientDocumentsStatus = ClosedEnum<
29
29
  typeof ListClientDocumentsStatus
30
30
  >;
31
31
 
32
+ export const Archived = {
33
+ True: "true",
34
+ False: "false",
35
+ } as const;
36
+ export type Archived = ClosedEnum<typeof Archived>;
37
+
32
38
  export type ListClientDocumentsRequest = {
33
39
  page?: number | undefined;
34
40
  pageSize?: number | undefined;
@@ -41,6 +47,7 @@ export type ListClientDocumentsRequest = {
41
47
  * UUID v4
42
48
  */
43
49
  contactId?: string | undefined;
50
+ archived?: Archived | undefined;
44
51
  };
45
52
 
46
53
  export type ListClientDocumentsResponse = {
@@ -77,6 +84,11 @@ export const ListClientDocumentsStatus$outboundSchema: z.ZodMiniEnum<
77
84
  typeof ListClientDocumentsStatus
78
85
  > = z.enum(ListClientDocumentsStatus);
79
86
 
87
+ /** @internal */
88
+ export const Archived$outboundSchema: z.ZodMiniEnum<typeof Archived> = z.enum(
89
+ Archived,
90
+ );
91
+
80
92
  /** @internal */
81
93
  export type ListClientDocumentsRequest$Outbound = {
82
94
  page: number;
@@ -84,6 +96,7 @@ export type ListClientDocumentsRequest$Outbound = {
84
96
  status?: string | undefined;
85
97
  clientId?: string | undefined;
86
98
  contactId?: string | undefined;
99
+ archived?: string | undefined;
87
100
  };
88
101
 
89
102
  /** @internal */
@@ -96,6 +109,7 @@ export const ListClientDocumentsRequest$outboundSchema: z.ZodMiniType<
96
109
  status: z.optional(ListClientDocumentsStatus$outboundSchema),
97
110
  clientId: z.optional(z.string()),
98
111
  contactId: z.optional(z.string()),
112
+ archived: z.optional(Archived$outboundSchema),
99
113
  });
100
114
 
101
115
  export function listClientDocumentsRequestToJSON(
@@ -48,7 +48,7 @@ export type Payment = {
48
48
  /**
49
49
  * UUID v4
50
50
  */
51
- clientId: string;
51
+ clientId: string | null;
52
52
  /**
53
53
  * UUID v4
54
54
  */
@@ -99,7 +99,7 @@ export const PaymentKind$inboundSchema: z.ZodMiniType<PaymentKind, unknown> =
99
99
  /** @internal */
100
100
  export const Payment$inboundSchema: z.ZodMiniType<Payment, unknown> = z.object({
101
101
  id: types.string(),
102
- clientId: types.string(),
102
+ clientId: types.nullable(types.string()),
103
103
  invoiceId: types.nullable(types.string()),
104
104
  amount: types.number(),
105
105
  currency: types.string(),
@@ -38,7 +38,7 @@ export const ProjectUpdateStatus$outboundSchema: z.ZodMiniEnum<
38
38
  export type ProjectUpdate$Outbound = {
39
39
  name?: string | undefined;
40
40
  clientId?: string | undefined;
41
- status: string;
41
+ status?: string | undefined;
42
42
  pipelineStageId?: string | undefined;
43
43
  startDate?: string | undefined;
44
44
  endDate?: string | undefined;
@@ -53,7 +53,7 @@ export const ProjectUpdate$outboundSchema: z.ZodMiniType<
53
53
  > = z.object({
54
54
  name: z.optional(z.string()),
55
55
  clientId: z.optional(z.string()),
56
- status: z._default(ProjectUpdateStatus$outboundSchema, "active"),
56
+ status: z.optional(ProjectUpdateStatus$outboundSchema),
57
57
  pipelineStageId: z.optional(z.string()),
58
58
  startDate: z.optional(
59
59
  z.pipe(