@apideck/unify 0.43.11 → 0.44.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 (211) hide show
  1. package/README.md +8 -1
  2. package/funcs/accountingAttachmentsList.d.ts.map +1 -1
  3. package/funcs/accountingAttachmentsList.js +4 -2
  4. package/funcs/accountingAttachmentsList.js.map +1 -1
  5. package/funcs/accountingCategoriesList.js +1 -0
  6. package/funcs/accountingCategoriesList.js.map +1 -1
  7. package/funcs/accountingCompaniesList.d.ts.map +1 -1
  8. package/funcs/accountingCompaniesList.js +4 -2
  9. package/funcs/accountingCompaniesList.js.map +1 -1
  10. package/funcs/accountingDepartmentsList.js +1 -0
  11. package/funcs/accountingDepartmentsList.js.map +1 -1
  12. package/funcs/accountingEmployeesList.js +1 -0
  13. package/funcs/accountingEmployeesList.js.map +1 -1
  14. package/funcs/accountingExpenseCategoriesList.js +1 -0
  15. package/funcs/accountingExpenseCategoriesList.js.map +1 -1
  16. package/funcs/accountingExpenseReportsList.js +1 -0
  17. package/funcs/accountingExpenseReportsList.js.map +1 -1
  18. package/funcs/accountingExpensesList.js +1 -0
  19. package/funcs/accountingExpensesList.js.map +1 -1
  20. package/funcs/accountingLocationsList.js +1 -0
  21. package/funcs/accountingLocationsList.js.map +1 -1
  22. package/funcs/accountingQuotesList.js +1 -0
  23. package/funcs/accountingQuotesList.js.map +1 -1
  24. package/funcs/accountingSubsidiariesList.d.ts.map +1 -1
  25. package/funcs/accountingSubsidiariesList.js +4 -2
  26. package/funcs/accountingSubsidiariesList.js.map +1 -1
  27. package/funcs/crmListsGet.d.ts +18 -0
  28. package/funcs/crmListsGet.d.ts.map +1 -0
  29. package/funcs/crmListsGet.js +146 -0
  30. package/funcs/crmListsGet.js.map +1 -0
  31. package/funcs/crmListsList.d.ts +21 -0
  32. package/funcs/crmListsList.d.ts.map +1 -0
  33. package/funcs/crmListsList.js +168 -0
  34. package/funcs/crmListsList.js.map +1 -0
  35. package/jsr.json +1 -1
  36. package/lib/config.d.ts +4 -4
  37. package/lib/config.js +4 -4
  38. package/lib/config.js.map +1 -1
  39. package/lib/http.d.ts +1 -1
  40. package/lib/http.d.ts.map +1 -1
  41. package/lib/http.js +1 -1
  42. package/lib/http.js.map +1 -1
  43. package/lib/security.d.ts +5 -4
  44. package/lib/security.d.ts.map +1 -1
  45. package/lib/security.js +6 -7
  46. package/lib/security.js.map +1 -1
  47. package/models/components/billsfilter.d.ts +10 -0
  48. package/models/components/billsfilter.d.ts.map +1 -1
  49. package/models/components/billsfilter.js +4 -0
  50. package/models/components/billsfilter.js.map +1 -1
  51. package/models/components/connection.d.ts +33 -9
  52. package/models/components/connection.d.ts.map +1 -1
  53. package/models/components/connection.js +32 -3
  54. package/models/components/connection.js.map +1 -1
  55. package/models/components/connector.d.ts +5 -0
  56. package/models/components/connector.d.ts.map +1 -1
  57. package/models/components/connector.js +2 -0
  58. package/models/components/connector.js.map +1 -1
  59. package/models/components/connectoroverview.d.ts +188 -0
  60. package/models/components/connectoroverview.d.ts.map +1 -0
  61. package/models/components/connectoroverview.js +148 -0
  62. package/models/components/connectoroverview.js.map +1 -0
  63. package/models/components/consumerconnection.d.ts +16 -3
  64. package/models/components/consumerconnection.d.ts.map +1 -1
  65. package/models/components/consumerconnection.js +14 -2
  66. package/models/components/consumerconnection.js.map +1 -1
  67. package/models/components/expensereport.d.ts +9 -0
  68. package/models/components/expensereport.d.ts.map +1 -1
  69. package/models/components/expensereport.js +2 -0
  70. package/models/components/expensereport.js.map +1 -1
  71. package/models/components/getlistresponse.d.ts +45 -0
  72. package/models/components/getlistresponse.d.ts.map +1 -0
  73. package/models/components/getlistresponse.js +66 -0
  74. package/models/components/getlistresponse.js.map +1 -0
  75. package/models/components/getlistsresponse.d.ts +50 -0
  76. package/models/components/getlistsresponse.d.ts.map +1 -0
  77. package/models/components/getlistsresponse.js +68 -0
  78. package/models/components/getlistsresponse.js.map +1 -0
  79. package/models/components/index.d.ts +4 -0
  80. package/models/components/index.d.ts.map +1 -1
  81. package/models/components/index.js +4 -0
  82. package/models/components/index.js.map +1 -1
  83. package/models/components/list.d.ts +114 -0
  84. package/models/components/list.d.ts.map +1 -0
  85. package/models/components/list.js +110 -0
  86. package/models/components/list.js.map +1 -0
  87. package/models/components/webhookeventlogsfilter.d.ts +35 -0
  88. package/models/components/webhookeventlogsfilter.d.ts.map +1 -1
  89. package/models/components/webhookeventlogsfilter.js +13 -0
  90. package/models/components/webhookeventlogsfilter.js.map +1 -1
  91. package/models/components/webhookeventtype.d.ts +3 -0
  92. package/models/components/webhookeventtype.d.ts.map +1 -1
  93. package/models/components/webhookeventtype.js +3 -0
  94. package/models/components/webhookeventtype.js.map +1 -1
  95. package/models/operations/accountingattachmentsall.d.ts +9 -0
  96. package/models/operations/accountingattachmentsall.d.ts.map +1 -1
  97. package/models/operations/accountingattachmentsall.js +2 -0
  98. package/models/operations/accountingattachmentsall.js.map +1 -1
  99. package/models/operations/accountingcategoriesall.d.ts +9 -0
  100. package/models/operations/accountingcategoriesall.d.ts.map +1 -1
  101. package/models/operations/accountingcategoriesall.js +5 -0
  102. package/models/operations/accountingcategoriesall.js.map +1 -1
  103. package/models/operations/accountingcompaniesall.d.ts +9 -0
  104. package/models/operations/accountingcompaniesall.d.ts.map +1 -1
  105. package/models/operations/accountingcompaniesall.js +5 -0
  106. package/models/operations/accountingcompaniesall.js.map +1 -1
  107. package/models/operations/accountingdepartmentsall.d.ts +9 -0
  108. package/models/operations/accountingdepartmentsall.d.ts.map +1 -1
  109. package/models/operations/accountingdepartmentsall.js +5 -0
  110. package/models/operations/accountingdepartmentsall.js.map +1 -1
  111. package/models/operations/accountingemployeesall.d.ts +9 -0
  112. package/models/operations/accountingemployeesall.d.ts.map +1 -1
  113. package/models/operations/accountingemployeesall.js +5 -0
  114. package/models/operations/accountingemployeesall.js.map +1 -1
  115. package/models/operations/accountingexpensecategoriesall.d.ts +9 -0
  116. package/models/operations/accountingexpensecategoriesall.d.ts.map +1 -1
  117. package/models/operations/accountingexpensecategoriesall.js +5 -0
  118. package/models/operations/accountingexpensecategoriesall.js.map +1 -1
  119. package/models/operations/accountingexpensereportsall.d.ts +9 -0
  120. package/models/operations/accountingexpensereportsall.d.ts.map +1 -1
  121. package/models/operations/accountingexpensereportsall.js +5 -0
  122. package/models/operations/accountingexpensereportsall.js.map +1 -1
  123. package/models/operations/accountingexpensesall.d.ts +9 -0
  124. package/models/operations/accountingexpensesall.d.ts.map +1 -1
  125. package/models/operations/accountingexpensesall.js +5 -0
  126. package/models/operations/accountingexpensesall.js.map +1 -1
  127. package/models/operations/accountinglocationsall.d.ts +9 -0
  128. package/models/operations/accountinglocationsall.d.ts.map +1 -1
  129. package/models/operations/accountinglocationsall.js +5 -0
  130. package/models/operations/accountinglocationsall.js.map +1 -1
  131. package/models/operations/accountingquotesall.d.ts +9 -0
  132. package/models/operations/accountingquotesall.d.ts.map +1 -1
  133. package/models/operations/accountingquotesall.js +5 -0
  134. package/models/operations/accountingquotesall.js.map +1 -1
  135. package/models/operations/accountingsubsidiariesall.d.ts +9 -0
  136. package/models/operations/accountingsubsidiariesall.d.ts.map +1 -1
  137. package/models/operations/accountingsubsidiariesall.js +5 -0
  138. package/models/operations/accountingsubsidiariesall.js.map +1 -1
  139. package/models/operations/crmlistsall.d.ts +81 -0
  140. package/models/operations/crmlistsall.d.ts.map +1 -0
  141. package/models/operations/crmlistsall.js +80 -0
  142. package/models/operations/crmlistsall.js.map +1 -0
  143. package/models/operations/crmlistsone.d.ts +67 -0
  144. package/models/operations/crmlistsone.d.ts.map +1 -0
  145. package/models/operations/crmlistsone.js +74 -0
  146. package/models/operations/crmlistsone.js.map +1 -0
  147. package/models/operations/index.d.ts +2 -0
  148. package/models/operations/index.d.ts.map +1 -1
  149. package/models/operations/index.js +2 -0
  150. package/models/operations/index.js.map +1 -1
  151. package/package.json +1 -1
  152. package/sdk/crm.d.ts +3 -0
  153. package/sdk/crm.d.ts.map +1 -1
  154. package/sdk/crm.js +4 -0
  155. package/sdk/crm.js.map +1 -1
  156. package/sdk/lists.d.ts +22 -0
  157. package/sdk/lists.d.ts.map +1 -0
  158. package/sdk/lists.js +33 -0
  159. package/sdk/lists.js.map +1 -0
  160. package/src/__tests__/companies.test.ts +3 -0
  161. package/src/__tests__/connections.test.ts +48 -32
  162. package/src/__tests__/connectionsettings.test.ts +18 -12
  163. package/src/__tests__/consumers.test.ts +48 -32
  164. package/src/__tests__/employees.test.ts +3 -0
  165. package/src/__tests__/expensecategories.test.ts +3 -0
  166. package/src/__tests__/expensereports.test.ts +6 -0
  167. package/src/__tests__/quotes.test.ts +3 -0
  168. package/src/funcs/accountingAttachmentsList.ts +17 -7
  169. package/src/funcs/accountingCategoriesList.ts +1 -0
  170. package/src/funcs/accountingCompaniesList.ts +17 -7
  171. package/src/funcs/accountingDepartmentsList.ts +1 -0
  172. package/src/funcs/accountingEmployeesList.ts +1 -0
  173. package/src/funcs/accountingExpenseCategoriesList.ts +1 -0
  174. package/src/funcs/accountingExpenseReportsList.ts +1 -0
  175. package/src/funcs/accountingExpensesList.ts +1 -0
  176. package/src/funcs/accountingLocationsList.ts +1 -0
  177. package/src/funcs/accountingQuotesList.ts +1 -0
  178. package/src/funcs/accountingSubsidiariesList.ts +17 -7
  179. package/src/funcs/crmListsGet.ts +228 -0
  180. package/src/funcs/crmListsList.ts +303 -0
  181. package/src/lib/config.ts +4 -4
  182. package/src/lib/http.ts +3 -1
  183. package/src/lib/security.ts +10 -5
  184. package/src/models/components/billsfilter.ts +18 -0
  185. package/src/models/components/connection.ts +85 -6
  186. package/src/models/components/connector.ts +9 -0
  187. package/src/models/components/connectoroverview.ts +346 -0
  188. package/src/models/components/consumerconnection.ts +44 -3
  189. package/src/models/components/expensereport.ts +11 -0
  190. package/src/models/components/getlistresponse.ts +78 -0
  191. package/src/models/components/getlistsresponse.ts +84 -0
  192. package/src/models/components/index.ts +4 -0
  193. package/src/models/components/list.ts +181 -0
  194. package/src/models/components/webhookeventlogsfilter.ts +48 -0
  195. package/src/models/components/webhookeventtype.ts +3 -0
  196. package/src/models/operations/accountingattachmentsall.ts +7 -0
  197. package/src/models/operations/accountingcategoriesall.ts +10 -0
  198. package/src/models/operations/accountingcompaniesall.ts +10 -0
  199. package/src/models/operations/accountingdepartmentsall.ts +10 -0
  200. package/src/models/operations/accountingemployeesall.ts +10 -0
  201. package/src/models/operations/accountingexpensecategoriesall.ts +10 -0
  202. package/src/models/operations/accountingexpensereportsall.ts +10 -0
  203. package/src/models/operations/accountingexpensesall.ts +10 -0
  204. package/src/models/operations/accountinglocationsall.ts +10 -0
  205. package/src/models/operations/accountingquotesall.ts +10 -0
  206. package/src/models/operations/accountingsubsidiariesall.ts +10 -0
  207. package/src/models/operations/crmlistsall.ts +138 -0
  208. package/src/models/operations/crmlistsone.ts +122 -0
  209. package/src/models/operations/index.ts +2 -0
  210. package/src/sdk/crm.ts +6 -0
  211. package/src/sdk/lists.ts +46 -0
@@ -4,7 +4,10 @@
4
4
 
5
5
  import * as z from "zod/v3";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
- import { safeParse } from "../../lib/schemas.js";
7
+ import {
8
+ collectExtraKeys as collectExtraKeys$,
9
+ safeParse,
10
+ } from "../../lib/schemas.js";
8
11
  import * as openEnums from "../../types/enums.js";
9
12
  import { OpenEnum } from "../../types/enums.js";
10
13
  import { Result as SafeParseResult } from "../../types/fp.js";
@@ -72,6 +75,17 @@ export const ConnectionStatus = {
72
75
  */
73
76
  export type ConnectionStatus = OpenEnum<typeof ConnectionStatus>;
74
77
 
78
+ /**
79
+ * Attach your own consumer specific metadata
80
+ */
81
+ export type ConnectionMetadata = {
82
+ /**
83
+ * Normalized identifier of the authorized organization, copied from the connector-specific setting (e.g. Xero tenant_id, QuickBooks realm_id, NetSuite account_id).
84
+ */
85
+ companyId?: string | undefined;
86
+ additionalProperties?: { [k: string]: any } | undefined;
87
+ };
88
+
75
89
  export const Target = {
76
90
  CustomFields: "custom_fields",
77
91
  Resource: "resource",
@@ -192,7 +206,7 @@ export type Connection = {
192
206
  /**
193
207
  * Attach your own consumer specific metadata
194
208
  */
195
- metadata?: { [k: string]: any } | null | undefined;
209
+ metadata?: ConnectionMetadata | null | undefined;
196
210
  /**
197
211
  * The settings that are wanted to create a connection.
198
212
  */
@@ -246,6 +260,13 @@ export type Connection = {
246
260
  updatedAt?: number | null | undefined;
247
261
  };
248
262
 
263
+ /**
264
+ * Attach your own consumer specific metadata
265
+ */
266
+ export type ConnectionMetadataInput = {
267
+ additionalProperties?: { [k: string]: any } | undefined;
268
+ };
269
+
249
270
  export type ConnectionDefaults = {
250
271
  id?: string | undefined;
251
272
  options?: Array<FormFieldOption> | undefined;
@@ -275,7 +296,7 @@ export type ConnectionInput = {
275
296
  /**
276
297
  * Attach your own consumer specific metadata
277
298
  */
278
- metadata?: { [k: string]: any } | null | undefined;
299
+ metadata?: ConnectionMetadataInput | null | undefined;
279
300
  configuration?: Array<ConnectionConfiguration> | undefined;
280
301
  /**
281
302
  * List of custom mappings configured for this connection
@@ -296,6 +317,33 @@ export const ConnectionStatus$inboundSchema: z.ZodType<
296
317
  unknown
297
318
  > = openEnums.inboundSchema(ConnectionStatus);
298
319
 
320
+ /** @internal */
321
+ export const ConnectionMetadata$inboundSchema: z.ZodType<
322
+ ConnectionMetadata,
323
+ z.ZodTypeDef,
324
+ unknown
325
+ > = collectExtraKeys$(
326
+ z.object({
327
+ company_id: types.optional(types.string()),
328
+ }).catchall(z.any()),
329
+ "additionalProperties",
330
+ true,
331
+ ).transform((v) => {
332
+ return remap$(v, {
333
+ "company_id": "companyId",
334
+ });
335
+ });
336
+
337
+ export function connectionMetadataFromJSON(
338
+ jsonString: string,
339
+ ): SafeParseResult<ConnectionMetadata, SDKValidationError> {
340
+ return safeParse(
341
+ jsonString,
342
+ (x) => ConnectionMetadata$inboundSchema.parse(JSON.parse(x)),
343
+ `Failed to parse 'ConnectionMetadata' from JSON`,
344
+ );
345
+ }
346
+
299
347
  /** @internal */
300
348
  export const Target$inboundSchema: z.ZodType<Target, z.ZodTypeDef, unknown> =
301
349
  openEnums.inboundSchema(Target);
@@ -451,7 +499,8 @@ export const Connection$inboundSchema: z.ZodType<
451
499
  authorize_url: z.nullable(types.string()).optional(),
452
500
  revoke_url: z.nullable(types.string()).optional(),
453
501
  settings: z.nullable(z.record(z.any())).optional(),
454
- metadata: z.nullable(z.record(z.any())).optional(),
502
+ metadata: z.nullable(z.lazy(() => ConnectionMetadata$inboundSchema))
503
+ .optional(),
455
504
  form_fields: types.optional(z.array(FormField$inboundSchema)),
456
505
  configuration: types.optional(
457
506
  z.array(z.lazy(() => Configuration$inboundSchema)),
@@ -515,6 +564,35 @@ export function connectionFromJSON(
515
564
  );
516
565
  }
517
566
 
567
+ /** @internal */
568
+ export type ConnectionMetadataInput$Outbound = {
569
+ [additionalProperties: string]: unknown;
570
+ };
571
+
572
+ /** @internal */
573
+ export const ConnectionMetadataInput$outboundSchema: z.ZodType<
574
+ ConnectionMetadataInput$Outbound,
575
+ z.ZodTypeDef,
576
+ ConnectionMetadataInput
577
+ > = z.object({
578
+ additionalProperties: z.record(z.any()).optional(),
579
+ }).transform((v) => {
580
+ return {
581
+ ...v.additionalProperties,
582
+ ...remap$(v, {
583
+ additionalProperties: null,
584
+ }),
585
+ };
586
+ });
587
+
588
+ export function connectionMetadataInputToJSON(
589
+ connectionMetadataInput: ConnectionMetadataInput,
590
+ ): string {
591
+ return JSON.stringify(
592
+ ConnectionMetadataInput$outboundSchema.parse(connectionMetadataInput),
593
+ );
594
+ }
595
+
518
596
  /** @internal */
519
597
  export type ConnectionDefaults$Outbound = {
520
598
  id?: string | undefined;
@@ -581,7 +659,7 @@ export function connectionConfigurationToJSON(
581
659
  export type ConnectionInput$Outbound = {
582
660
  enabled?: boolean | undefined;
583
661
  settings?: { [k: string]: any } | null | undefined;
584
- metadata?: { [k: string]: any } | null | undefined;
662
+ metadata?: ConnectionMetadataInput$Outbound | null | undefined;
585
663
  configuration?: Array<ConnectionConfiguration$Outbound> | undefined;
586
664
  custom_mappings?: Array<CustomMappingInput$Outbound> | undefined;
587
665
  consent_state?: string | undefined;
@@ -597,7 +675,8 @@ export const ConnectionInput$outboundSchema: z.ZodType<
597
675
  > = z.object({
598
676
  enabled: z.boolean().optional(),
599
677
  settings: z.nullable(z.record(z.any())).optional(),
600
- metadata: z.nullable(z.record(z.any())).optional(),
678
+ metadata: z.nullable(z.lazy(() => ConnectionMetadataInput$outboundSchema))
679
+ .optional(),
601
680
  configuration: z.array(z.lazy(() => ConnectionConfiguration$outboundSchema))
602
681
  .optional(),
603
682
  customMappings: z.array(CustomMappingInput$outboundSchema).optional(),
@@ -15,6 +15,10 @@ import {
15
15
  ConnectorEvent,
16
16
  ConnectorEvent$inboundSchema,
17
17
  } from "./connectorevent.js";
18
+ import {
19
+ ConnectorOverview,
20
+ ConnectorOverview$inboundSchema,
21
+ } from "./connectoroverview.js";
18
22
  import {
19
23
  ConnectorSetting,
20
24
  ConnectorSetting$inboundSchema,
@@ -242,6 +246,10 @@ export type Connector = {
242
246
  */
243
247
  schemaSupport?: SchemaSupport | undefined;
244
248
  docs?: Array<ConnectorDoc> | undefined;
249
+ /**
250
+ * Editorial overview metadata for the connector, used to render the connector's Overview documentation (implementation difficulty, partnership requirements, sandbox availability, and other at-a-glance facts).
251
+ */
252
+ overview?: ConnectorOverview | undefined;
245
253
  tlsSupport?: TlsSupport | undefined;
246
254
  };
247
255
 
@@ -409,6 +417,7 @@ export const Connector$inboundSchema: z.ZodType<
409
417
  webhook_support: types.optional(WebhookSupport$inboundSchema),
410
418
  schema_support: types.optional(SchemaSupport$inboundSchema),
411
419
  docs: types.optional(z.array(ConnectorDoc$inboundSchema)),
420
+ overview: types.optional(ConnectorOverview$inboundSchema),
412
421
  tls_support: types.optional(z.lazy(() => TlsSupport$inboundSchema)),
413
422
  }).transform((v) => {
414
423
  return remap$(v, {
@@ -0,0 +1,346 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import * as openEnums from "../../types/enums.js";
9
+ import { OpenEnum } from "../../types/enums.js";
10
+ import { Result as SafeParseResult } from "../../types/fp.js";
11
+ import * as types from "../../types/primitives.js";
12
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
13
+
14
+ /**
15
+ * At-a-glance implementation difficulty rating.
16
+ */
17
+ export const Difficulty = {
18
+ Straightforward: "straightforward",
19
+ Moderate: "moderate",
20
+ Involved: "involved",
21
+ HighlyComplex: "highly_complex",
22
+ } as const;
23
+ /**
24
+ * At-a-glance implementation difficulty rating.
25
+ */
26
+ export type Difficulty = OpenEnum<typeof Difficulty>;
27
+
28
+ export type SupportedResourceCategories = {
29
+ /**
30
+ * Category name.
31
+ */
32
+ name: string;
33
+ /**
34
+ * Resource ids belonging to this category.
35
+ */
36
+ resources: Array<string>;
37
+ };
38
+
39
+ export type ExternalGuides = {
40
+ /**
41
+ * Guide title.
42
+ */
43
+ title: string;
44
+ /**
45
+ * Guide URL.
46
+ */
47
+ url: string;
48
+ /**
49
+ * Publisher of the guide.
50
+ */
51
+ source: string;
52
+ };
53
+
54
+ export type ResponsibilityMatrix = {
55
+ /**
56
+ * The responsibility area.
57
+ */
58
+ area: string;
59
+ /**
60
+ * Apideck's responsibility for this area.
61
+ */
62
+ apideck?: string | undefined;
63
+ /**
64
+ * The consumer's responsibility for this area.
65
+ */
66
+ consumer?: string | undefined;
67
+ /**
68
+ * The end customer's responsibility for this area.
69
+ */
70
+ customer?: string | undefined;
71
+ };
72
+
73
+ export type EnvironmentNotes = {
74
+ /**
75
+ * Environment name.
76
+ */
77
+ environment: string;
78
+ /**
79
+ * Description of the environment.
80
+ */
81
+ description: string;
82
+ };
83
+
84
+ /**
85
+ * Editorial overview metadata for the connector, used to render the connector's Overview documentation (implementation difficulty, partnership requirements, sandbox availability, and other at-a-glance facts).
86
+ */
87
+ export type ConnectorOverview = {
88
+ /**
89
+ * Whether this connector's overview content is still in beta.
90
+ */
91
+ beta?: boolean | undefined;
92
+ /**
93
+ * Whether this connector is demo-only.
94
+ */
95
+ demo?: boolean | undefined;
96
+ /**
97
+ * At-a-glance implementation difficulty rating.
98
+ */
99
+ difficulty: Difficulty;
100
+ /**
101
+ * Short explanation of why the connector has the given difficulty rating.
102
+ */
103
+ difficultyReason: string;
104
+ /**
105
+ * Notes on the connector's authentication flow.
106
+ */
107
+ authenticationNote?: string | undefined;
108
+ /**
109
+ * Description of webhook support for this connector.
110
+ */
111
+ webhooks?: string | undefined;
112
+ /**
113
+ * Whether a partnership with the downstream provider is required.
114
+ */
115
+ partnershipRequired: boolean;
116
+ /**
117
+ * URL to the downstream provider's partnership/developer portal.
118
+ */
119
+ partnershipUrl?: string | undefined;
120
+ /**
121
+ * Additional notes about the partnership requirement.
122
+ */
123
+ partnershipNote?: string | undefined;
124
+ /**
125
+ * Name of the downstream provider's developer portal.
126
+ */
127
+ partnershipPortalName?: string | undefined;
128
+ /**
129
+ * Whether Apideck-managed credentials are available for this connector.
130
+ */
131
+ apideckCredentialsAvailable: boolean;
132
+ /**
133
+ * Additional notes about Apideck-managed credentials.
134
+ */
135
+ apideckCredentialsNote?: string | undefined;
136
+ /**
137
+ * Notes on costs associated with using this connector.
138
+ */
139
+ costs?: string | undefined;
140
+ /**
141
+ * Notes on rate limits enforced by the downstream provider.
142
+ */
143
+ rateLimits?: string | undefined;
144
+ /**
145
+ * The type of downstream account required to use this connector.
146
+ */
147
+ accountTypeRequired: string;
148
+ /**
149
+ * Whether a sandbox environment is available for this connector.
150
+ */
151
+ sandboxAvailable: boolean;
152
+ /**
153
+ * URL to the downstream provider's sandbox environment.
154
+ */
155
+ sandboxUrl?: string | undefined;
156
+ /**
157
+ * Additional notes about the sandbox environment.
158
+ */
159
+ sandboxNote?: string | undefined;
160
+ /**
161
+ * The access level a consumer's end user needs to authorize the connection.
162
+ */
163
+ consumerAccessLevel: string;
164
+ /**
165
+ * Flat list of important facts about this connector.
166
+ */
167
+ importantToKnow?: Array<string> | undefined;
168
+ /**
169
+ * Grouping of the connector's supported resources by category.
170
+ */
171
+ supportedResourceCategories?: Array<SupportedResourceCategories> | undefined;
172
+ /**
173
+ * Links to external guides relevant to this connector.
174
+ */
175
+ externalGuides?: Array<ExternalGuides> | undefined;
176
+ /**
177
+ * Who is responsible for each area of the integration. Cell values are display strings (e.g. "✓", "Docs provided"), not booleans.
178
+ */
179
+ responsibilityMatrix?: Array<ResponsibilityMatrix> | undefined;
180
+ /**
181
+ * Notes about the different environments (sandbox, production, etc.) available for this connector.
182
+ */
183
+ environmentNotes?: Array<EnvironmentNotes> | undefined;
184
+ };
185
+
186
+ /** @internal */
187
+ export const Difficulty$inboundSchema: z.ZodType<
188
+ Difficulty,
189
+ z.ZodTypeDef,
190
+ unknown
191
+ > = openEnums.inboundSchema(Difficulty);
192
+
193
+ /** @internal */
194
+ export const SupportedResourceCategories$inboundSchema: z.ZodType<
195
+ SupportedResourceCategories,
196
+ z.ZodTypeDef,
197
+ unknown
198
+ > = z.object({
199
+ name: types.string(),
200
+ resources: z.array(types.string()),
201
+ });
202
+
203
+ export function supportedResourceCategoriesFromJSON(
204
+ jsonString: string,
205
+ ): SafeParseResult<SupportedResourceCategories, SDKValidationError> {
206
+ return safeParse(
207
+ jsonString,
208
+ (x) => SupportedResourceCategories$inboundSchema.parse(JSON.parse(x)),
209
+ `Failed to parse 'SupportedResourceCategories' from JSON`,
210
+ );
211
+ }
212
+
213
+ /** @internal */
214
+ export const ExternalGuides$inboundSchema: z.ZodType<
215
+ ExternalGuides,
216
+ z.ZodTypeDef,
217
+ unknown
218
+ > = z.object({
219
+ title: types.string(),
220
+ url: types.string(),
221
+ source: types.string(),
222
+ });
223
+
224
+ export function externalGuidesFromJSON(
225
+ jsonString: string,
226
+ ): SafeParseResult<ExternalGuides, SDKValidationError> {
227
+ return safeParse(
228
+ jsonString,
229
+ (x) => ExternalGuides$inboundSchema.parse(JSON.parse(x)),
230
+ `Failed to parse 'ExternalGuides' from JSON`,
231
+ );
232
+ }
233
+
234
+ /** @internal */
235
+ export const ResponsibilityMatrix$inboundSchema: z.ZodType<
236
+ ResponsibilityMatrix,
237
+ z.ZodTypeDef,
238
+ unknown
239
+ > = z.object({
240
+ area: types.string(),
241
+ apideck: types.optional(types.string()),
242
+ consumer: types.optional(types.string()),
243
+ customer: types.optional(types.string()),
244
+ });
245
+
246
+ export function responsibilityMatrixFromJSON(
247
+ jsonString: string,
248
+ ): SafeParseResult<ResponsibilityMatrix, SDKValidationError> {
249
+ return safeParse(
250
+ jsonString,
251
+ (x) => ResponsibilityMatrix$inboundSchema.parse(JSON.parse(x)),
252
+ `Failed to parse 'ResponsibilityMatrix' from JSON`,
253
+ );
254
+ }
255
+
256
+ /** @internal */
257
+ export const EnvironmentNotes$inboundSchema: z.ZodType<
258
+ EnvironmentNotes,
259
+ z.ZodTypeDef,
260
+ unknown
261
+ > = z.object({
262
+ environment: types.string(),
263
+ description: types.string(),
264
+ });
265
+
266
+ export function environmentNotesFromJSON(
267
+ jsonString: string,
268
+ ): SafeParseResult<EnvironmentNotes, SDKValidationError> {
269
+ return safeParse(
270
+ jsonString,
271
+ (x) => EnvironmentNotes$inboundSchema.parse(JSON.parse(x)),
272
+ `Failed to parse 'EnvironmentNotes' from JSON`,
273
+ );
274
+ }
275
+
276
+ /** @internal */
277
+ export const ConnectorOverview$inboundSchema: z.ZodType<
278
+ ConnectorOverview,
279
+ z.ZodTypeDef,
280
+ unknown
281
+ > = z.object({
282
+ beta: types.optional(types.boolean()),
283
+ demo: types.optional(types.boolean()),
284
+ difficulty: Difficulty$inboundSchema,
285
+ difficulty_reason: types.string(),
286
+ authentication_note: types.optional(types.string()),
287
+ webhooks: types.optional(types.string()),
288
+ partnership_required: types.boolean(),
289
+ partnership_url: types.optional(types.string()),
290
+ partnership_note: types.optional(types.string()),
291
+ partnership_portal_name: types.optional(types.string()),
292
+ apideck_credentials_available: types.boolean(),
293
+ apideck_credentials_note: types.optional(types.string()),
294
+ costs: types.optional(types.string()),
295
+ rate_limits: types.optional(types.string()),
296
+ account_type_required: types.string(),
297
+ sandbox_available: types.boolean(),
298
+ sandbox_url: types.optional(types.string()),
299
+ sandbox_note: types.optional(types.string()),
300
+ consumer_access_level: types.string(),
301
+ important_to_know: types.optional(z.array(types.string())),
302
+ supported_resource_categories: types.optional(
303
+ z.array(z.lazy(() => SupportedResourceCategories$inboundSchema)),
304
+ ),
305
+ external_guides: types.optional(
306
+ z.array(z.lazy(() => ExternalGuides$inboundSchema)),
307
+ ),
308
+ responsibility_matrix: types.optional(
309
+ z.array(z.lazy(() => ResponsibilityMatrix$inboundSchema)),
310
+ ),
311
+ environment_notes: types.optional(
312
+ z.array(z.lazy(() => EnvironmentNotes$inboundSchema)),
313
+ ),
314
+ }).transform((v) => {
315
+ return remap$(v, {
316
+ "difficulty_reason": "difficultyReason",
317
+ "authentication_note": "authenticationNote",
318
+ "partnership_required": "partnershipRequired",
319
+ "partnership_url": "partnershipUrl",
320
+ "partnership_note": "partnershipNote",
321
+ "partnership_portal_name": "partnershipPortalName",
322
+ "apideck_credentials_available": "apideckCredentialsAvailable",
323
+ "apideck_credentials_note": "apideckCredentialsNote",
324
+ "rate_limits": "rateLimits",
325
+ "account_type_required": "accountTypeRequired",
326
+ "sandbox_available": "sandboxAvailable",
327
+ "sandbox_url": "sandboxUrl",
328
+ "sandbox_note": "sandboxNote",
329
+ "consumer_access_level": "consumerAccessLevel",
330
+ "important_to_know": "importantToKnow",
331
+ "supported_resource_categories": "supportedResourceCategories",
332
+ "external_guides": "externalGuides",
333
+ "responsibility_matrix": "responsibilityMatrix",
334
+ "environment_notes": "environmentNotes",
335
+ });
336
+ });
337
+
338
+ export function connectorOverviewFromJSON(
339
+ jsonString: string,
340
+ ): SafeParseResult<ConnectorOverview, SDKValidationError> {
341
+ return safeParse(
342
+ jsonString,
343
+ (x) => ConnectorOverview$inboundSchema.parse(JSON.parse(x)),
344
+ `Failed to parse 'ConnectorOverview' from JSON`,
345
+ );
346
+ }
@@ -4,7 +4,10 @@
4
4
 
5
5
  import * as z from "zod/v3";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
- import { safeParse } from "../../lib/schemas.js";
7
+ import {
8
+ collectExtraKeys as collectExtraKeys$,
9
+ safeParse,
10
+ } from "../../lib/schemas.js";
8
11
  import { Result as SafeParseResult } from "../../types/fp.js";
9
12
  import * as types from "../../types/primitives.js";
10
13
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
@@ -18,6 +21,17 @@ import {
18
21
  ConnectionState$inboundSchema,
19
22
  } from "./connectionstate.js";
20
23
 
24
+ /**
25
+ * Attach your own consumer specific metadata
26
+ */
27
+ export type Metadata = {
28
+ /**
29
+ * Normalized identifier of the authorized organization, copied from the connector-specific setting (e.g. Xero tenant_id, QuickBooks realm_id, NetSuite account_id).
30
+ */
31
+ companyId?: string | undefined;
32
+ additionalProperties?: { [k: string]: any } | undefined;
33
+ };
34
+
21
35
  export type ConsumerConnection = {
22
36
  id?: string | undefined;
23
37
  name?: string | undefined;
@@ -40,7 +54,7 @@ export type ConsumerConnection = {
40
54
  /**
41
55
  * Attach your own consumer specific metadata
42
56
  */
43
- metadata?: { [k: string]: any } | null | undefined;
57
+ metadata?: Metadata | null | undefined;
44
58
  createdAt?: string | undefined;
45
59
  updatedAt?: string | null | undefined;
46
60
  /**
@@ -61,6 +75,33 @@ export type ConsumerConnection = {
61
75
  lastRefreshFailedAt?: string | null | undefined;
62
76
  };
63
77
 
78
+ /** @internal */
79
+ export const Metadata$inboundSchema: z.ZodType<
80
+ Metadata,
81
+ z.ZodTypeDef,
82
+ unknown
83
+ > = collectExtraKeys$(
84
+ z.object({
85
+ company_id: types.optional(types.string()),
86
+ }).catchall(z.any()),
87
+ "additionalProperties",
88
+ true,
89
+ ).transform((v) => {
90
+ return remap$(v, {
91
+ "company_id": "companyId",
92
+ });
93
+ });
94
+
95
+ export function metadataFromJSON(
96
+ jsonString: string,
97
+ ): SafeParseResult<Metadata, SDKValidationError> {
98
+ return safeParse(
99
+ jsonString,
100
+ (x) => Metadata$inboundSchema.parse(JSON.parse(x)),
101
+ `Failed to parse 'Metadata' from JSON`,
102
+ );
103
+ }
104
+
64
105
  /** @internal */
65
106
  export const ConsumerConnection$inboundSchema: z.ZodType<
66
107
  ConsumerConnection,
@@ -79,7 +120,7 @@ export const ConsumerConnection$inboundSchema: z.ZodType<
79
120
  auth_type: types.optional(AuthType$inboundSchema),
80
121
  enabled: types.optional(types.boolean()),
81
122
  settings: z.nullable(z.record(z.any())).optional(),
82
- metadata: z.nullable(z.record(z.any())).optional(),
123
+ metadata: z.nullable(z.lazy(() => Metadata$inboundSchema)).optional(),
83
124
  created_at: types.optional(types.string()),
84
125
  updated_at: z.nullable(types.string()).optional(),
85
126
  state: types.optional(ConnectionState$inboundSchema),
@@ -211,6 +211,10 @@ export type ExpenseReport = {
211
211
  * Expense line items linked to this expense report.
212
212
  */
213
213
  lineItems: Array<ExpenseReportLineItem>;
214
+ /**
215
+ * Optional reference identifier for the transaction.
216
+ */
217
+ reference?: string | null | undefined;
214
218
  subsidiary?: LinkedSubsidiary | null | undefined;
215
219
  /**
216
220
  * A list of linked tracking categories.
@@ -327,6 +331,10 @@ export type ExpenseReportInput = {
327
331
  * Expense line items linked to this expense report.
328
332
  */
329
333
  lineItems: Array<ExpenseReportLineItemInput>;
334
+ /**
335
+ * Optional reference identifier for the transaction.
336
+ */
337
+ reference?: string | null | undefined;
330
338
  subsidiary?: LinkedSubsidiaryInput | null | undefined;
331
339
  /**
332
340
  * A list of linked tracking categories.
@@ -530,6 +538,7 @@ export const ExpenseReport$inboundSchema: z.ZodType<
530
538
  accounting_period: z.nullable(z.lazy(() => AccountingPeriod$inboundSchema))
531
539
  .optional(),
532
540
  line_items: z.array(ExpenseReportLineItem$inboundSchema),
541
+ reference: z.nullable(types.string()).optional(),
533
542
  subsidiary: z.nullable(LinkedSubsidiary$inboundSchema).optional(),
534
543
  tracking_categories: z.nullable(
535
544
  z.array(types.nullable(LinkedTrackingCategory$inboundSchema)),
@@ -603,6 +612,7 @@ export type ExpenseReportInput$Outbound = {
603
612
  account?: LinkedLedgerAccount$Outbound | null | undefined;
604
613
  accounting_period?: AccountingPeriod$Outbound | null | undefined;
605
614
  line_items: Array<ExpenseReportLineItemInput$Outbound>;
615
+ reference?: string | null | undefined;
606
616
  subsidiary?: LinkedSubsidiaryInput$Outbound | null | undefined;
607
617
  tracking_categories?:
608
618
  | Array<LinkedTrackingCategory$Outbound | null>
@@ -646,6 +656,7 @@ export const ExpenseReportInput$outboundSchema: z.ZodType<
646
656
  accountingPeriod: z.nullable(z.lazy(() => AccountingPeriod$outboundSchema))
647
657
  .optional(),
648
658
  lineItems: z.array(ExpenseReportLineItemInput$outboundSchema),
659
+ reference: z.nullable(z.string()).optional(),
649
660
  subsidiary: z.nullable(LinkedSubsidiaryInput$outboundSchema).optional(),
650
661
  trackingCategories: z.nullable(
651
662
  z.array(z.nullable(LinkedTrackingCategory$outboundSchema)),