@wirecat/cli-core 0.606.0 → 0.607.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 (209) hide show
  1. package/CHANGELOG.md +186 -1
  2. package/dist/calendar/index.d.ts +1 -0
  3. package/dist/calendar/index.js +1 -0
  4. package/dist/calendar/reads.js +5 -0
  5. package/dist/cli/app-mcp-command.d.ts +6 -2
  6. package/dist/cli/app-mcp-command.js +11 -2
  7. package/dist/cli/csv.d.ts +10 -0
  8. package/dist/cli/csv.js +22 -0
  9. package/dist/cli/early-refusal.d.ts +10 -0
  10. package/dist/cli/early-refusal.js +19 -0
  11. package/dist/cli/index.d.ts +3 -0
  12. package/dist/cli/index.js +3 -0
  13. package/dist/cli/profile-token.d.ts +29 -0
  14. package/dist/cli/profile-token.js +65 -0
  15. package/dist/cli/program.js +4 -2
  16. package/dist/crm/cli/csv.d.ts +23 -0
  17. package/dist/crm/cli/csv.js +135 -0
  18. package/dist/crm/cli/index.d.ts +1 -1
  19. package/dist/crm/cli/index.js +33 -21
  20. package/dist/crm/cli/pipeline-view.d.ts +3 -0
  21. package/dist/crm/cli/pipeline-view.js +36 -0
  22. package/dist/crm/writes.d.ts +6 -4
  23. package/dist/crm/writes.js +17 -13
  24. package/dist/documents.d.ts +2 -0
  25. package/dist/documents.js +2 -0
  26. package/dist/domain/business.d.ts +79 -0
  27. package/dist/domain/business.js +42 -0
  28. package/dist/domain/finance.d.ts +2 -0
  29. package/dist/domain/finance.js +2 -2
  30. package/dist/domain/google-documents.d.ts +2 -0
  31. package/dist/domain/google-documents.js +3 -1
  32. package/dist/domain/money.d.ts +2 -0
  33. package/dist/domain/money.js +11 -3
  34. package/dist/domain/providers.d.ts +36 -1
  35. package/dist/domain/providers.js +69 -7
  36. package/dist/domain/record-fields.d.ts +42 -0
  37. package/dist/domain/record-fields.js +122 -0
  38. package/dist/domain/record-types.d.ts +489 -16
  39. package/dist/domain/record-types.js +374 -7
  40. package/dist/domain/records.d.ts +96 -5
  41. package/dist/domain/records.js +178 -32
  42. package/dist/domain/ref-summaries.js +5 -0
  43. package/dist/domain/references.d.ts +1 -1
  44. package/dist/domain/references.js +5 -0
  45. package/dist/domain/vcard.d.ts +25 -0
  46. package/dist/domain/vcard.js +267 -0
  47. package/dist/entities/deal.d.ts +14 -0
  48. package/dist/entities/deal.js +3 -0
  49. package/dist/entities/index.d.ts +12 -0
  50. package/dist/errors/reasons.js +61 -2
  51. package/dist/fetch/addresses.d.ts +5 -0
  52. package/dist/fetch/addresses.js +76 -0
  53. package/dist/fetch/page.d.ts +64 -0
  54. package/dist/fetch/page.js +256 -0
  55. package/dist/index.d.ts +5 -3
  56. package/dist/index.js +5 -3
  57. package/dist/meetings/calendar-text.d.ts +1 -1
  58. package/dist/meetings/calendar-text.js +4 -0
  59. package/dist/meetings/event-store.d.ts +2 -2
  60. package/dist/search/account-list.d.ts +4 -0
  61. package/dist/search/account-list.js +19 -8
  62. package/dist/search/query.js +2 -2
  63. package/dist/services/events-search.js +2 -2
  64. package/dist/services/index.d.ts +1 -1
  65. package/dist/services/index.js +1 -1
  66. package/dist/services/ingest.d.ts +56 -8
  67. package/dist/services/ingest.js +95 -61
  68. package/dist/services/messages-search.js +3 -2
  69. package/dist/services/metadata.d.ts +1 -1
  70. package/dist/services/notes-search.js +1 -0
  71. package/dist/services/proposals/kinds/contracts.d.ts +4 -0
  72. package/dist/services/proposals/kinds/contracts.js +9 -0
  73. package/dist/services/proposals/kinds/finance.d.ts +4 -0
  74. package/dist/services/proposals/kinds/finance.js +14 -35
  75. package/dist/services/proposals/kinds/orders.js +7 -30
  76. package/dist/services/proposals/kinds/shared.d.ts +27 -1
  77. package/dist/services/proposals/kinds/shared.js +34 -0
  78. package/dist/services/proposals/kinds/source-review.d.ts +4 -0
  79. package/dist/services/proposals/kinds/source-review.js +45 -0
  80. package/dist/services/proposals/kinds/subscriptions.d.ts +9 -0
  81. package/dist/services/proposals/kinds/subscriptions.js +24 -0
  82. package/dist/services/proposals/kinds/transactions.d.ts +4 -0
  83. package/dist/services/proposals/kinds/transactions.js +10 -0
  84. package/dist/services/proposals/registry.js +9 -0
  85. package/dist/services/search-all-meetings.js +2 -2
  86. package/dist/services/search-all.js +4 -3
  87. package/dist/services/search-kind.js +3 -3
  88. package/dist/store/decisions.js +5 -1
  89. package/dist/store/index.d.ts +14 -3
  90. package/dist/store/index.js +3 -0
  91. package/dist/store/people.js +1 -1
  92. package/dist/store/source-review.d.ts +64 -0
  93. package/dist/store/source-review.js +7 -0
  94. package/dist/store/sqlite/accounts.d.ts +1 -1
  95. package/dist/store/sqlite/accounts.js +24 -1
  96. package/dist/store/sqlite/added-sources.d.ts +82 -0
  97. package/dist/store/sqlite/added-sources.js +237 -0
  98. package/dist/store/sqlite/business-contracts.d.ts +90 -0
  99. package/dist/store/sqlite/business-contracts.js +182 -0
  100. package/dist/store/sqlite/calendar-events.js +7 -3
  101. package/dist/store/sqlite/calendar-forget.js +3 -0
  102. package/dist/store/sqlite/calendar.d.ts +21 -1
  103. package/dist/store/sqlite/calendar.js +27 -7
  104. package/dist/store/sqlite/chat-rekey.js +7 -0
  105. package/dist/store/sqlite/chats.d.ts +3 -1
  106. package/dist/store/sqlite/chats.js +15 -1
  107. package/dist/store/sqlite/crm-rows.d.ts +44 -0
  108. package/dist/store/sqlite/crm-rows.js +195 -0
  109. package/dist/store/sqlite/crm.d.ts +2 -11
  110. package/dist/store/sqlite/crm.js +11 -166
  111. package/dist/store/sqlite/deals.d.ts +4 -8
  112. package/dist/store/sqlite/deals.js +5 -3
  113. package/dist/store/sqlite/document-transfer/snapshot.js +2 -2
  114. package/dist/store/sqlite/emails.js +2 -0
  115. package/dist/store/sqlite/entity-types.d.ts +14 -9
  116. package/dist/store/sqlite/entity-types.js +4 -10
  117. package/dist/store/sqlite/evidence-signature.d.ts +114 -0
  118. package/dist/store/sqlite/evidence-signature.js +349 -0
  119. package/dist/store/sqlite/evidence-sources.d.ts +2 -1
  120. package/dist/store/sqlite/evidence-sources.js +7 -3
  121. package/dist/store/sqlite/facts.d.ts +7 -2
  122. package/dist/store/sqlite/facts.js +21 -5
  123. package/dist/store/sqlite/finance.d.ts +18 -105
  124. package/dist/store/sqlite/finance.js +100 -219
  125. package/dist/store/sqlite/knowledge.d.ts +8 -2
  126. package/dist/store/sqlite/knowledge.js +65 -71
  127. package/dist/store/sqlite/labelled.d.ts +3 -0
  128. package/dist/store/sqlite/labelled.js +11 -0
  129. package/dist/store/sqlite/link-kinds.d.ts +2 -0
  130. package/dist/store/sqlite/link-kinds.js +2 -0
  131. package/dist/store/sqlite/manifest.js +2 -0
  132. package/dist/store/sqlite/memories.d.ts +23 -9
  133. package/dist/store/sqlite/memories.js +41 -13
  134. package/dist/store/sqlite/messages.js +2 -0
  135. package/dist/store/sqlite/migrations.generated.js +103 -0
  136. package/dist/store/sqlite/money-lines.d.ts +48 -0
  137. package/dist/store/sqlite/money-lines.js +76 -0
  138. package/dist/store/sqlite/money-transactions.d.ts +132 -0
  139. package/dist/store/sqlite/money-transactions.js +295 -0
  140. package/dist/store/sqlite/notes.d.ts +11 -2
  141. package/dist/store/sqlite/notes.js +20 -25
  142. package/dist/store/sqlite/orders.d.ts +36 -6
  143. package/dist/store/sqlite/orders.js +126 -46
  144. package/dist/store/sqlite/payment-facts.js +1 -1
  145. package/dist/store/sqlite/private-people.js +2 -0
  146. package/dist/store/sqlite/products.d.ts +78 -0
  147. package/dist/store/sqlite/products.js +131 -0
  148. package/dist/store/sqlite/project-transfer/records.js +26 -1
  149. package/dist/store/sqlite/project-transfer/snapshot.js +5 -3
  150. package/dist/store/sqlite/proposed-actions.d.ts +1 -1
  151. package/dist/store/sqlite/proposed-actions.js +24 -7
  152. package/dist/store/sqlite/providers.d.ts +0 -4
  153. package/dist/store/sqlite/providers.js +20 -2
  154. package/dist/store/sqlite/record-matching.d.ts +80 -0
  155. package/dist/store/sqlite/record-matching.js +264 -0
  156. package/dist/store/sqlite/record-projection.d.ts +89 -0
  157. package/dist/store/sqlite/record-projection.js +50 -0
  158. package/dist/store/sqlite/record-projectors-direct.d.ts +17 -0
  159. package/dist/store/sqlite/record-projectors-direct.js +125 -0
  160. package/dist/store/sqlite/record-projectors-money.d.ts +26 -0
  161. package/dist/store/sqlite/record-projectors-money.js +214 -0
  162. package/dist/store/sqlite/record-projectors-phone.d.ts +28 -0
  163. package/dist/store/sqlite/record-projectors-phone.js +212 -0
  164. package/dist/store/sqlite/record-projectors.d.ts +3 -44
  165. package/dist/store/sqlite/record-projectors.js +7 -67
  166. package/dist/store/sqlite/record-relations.d.ts +24 -0
  167. package/dist/store/sqlite/record-relations.js +92 -0
  168. package/dist/store/sqlite/record-remap.d.ts +12 -0
  169. package/dist/store/sqlite/record-remap.js +92 -0
  170. package/dist/store/sqlite/record-run.d.ts +71 -0
  171. package/dist/store/sqlite/record-run.js +179 -0
  172. package/dist/store/sqlite/record-settling.d.ts +9 -0
  173. package/dist/store/sqlite/record-settling.js +74 -0
  174. package/dist/store/sqlite/record-stamps.d.ts +13 -0
  175. package/dist/store/sqlite/record-stamps.js +30 -0
  176. package/dist/store/sqlite/record-writes.d.ts +43 -0
  177. package/dist/store/sqlite/record-writes.js +307 -0
  178. package/dist/store/sqlite/records.d.ts +52 -42
  179. package/dist/store/sqlite/records.js +123 -353
  180. package/dist/store/sqlite/ref-summaries.d.ts +6 -5
  181. package/dist/store/sqlite/ref-summaries.js +60 -8
  182. package/dist/store/sqlite/refunds.d.ts +31 -0
  183. package/dist/store/sqlite/refunds.js +112 -0
  184. package/dist/store/sqlite/reviewed.d.ts +109 -0
  185. package/dist/store/sqlite/reviewed.js +173 -0
  186. package/dist/store/sqlite/schema.d.ts +2840 -83
  187. package/dist/store/sqlite/schema.js +256 -1
  188. package/dist/store/sqlite/source-review-marks.d.ts +54 -0
  189. package/dist/store/sqlite/source-review-marks.js +143 -0
  190. package/dist/store/sqlite/source-review.d.ts +54 -0
  191. package/dist/store/sqlite/source-review.js +221 -0
  192. package/dist/store/sqlite/stage-amounts.d.ts +14 -0
  193. package/dist/store/sqlite/stage-amounts.js +23 -0
  194. package/dist/store/sqlite/subscriptions.d.ts +135 -0
  195. package/dist/store/sqlite/subscriptions.js +294 -0
  196. package/dist/store/sqlite/text-input.d.ts +3 -0
  197. package/dist/store/sqlite/text-input.js +13 -0
  198. package/dist/store/sqlite/things.js +2 -9
  199. package/dist/store/sqlite/transaction.d.ts +15 -0
  200. package/dist/store/sqlite/transaction.js +57 -0
  201. package/dist/store/sqlite/wallets.d.ts +88 -0
  202. package/dist/store/sqlite/wallets.js +143 -0
  203. package/dist/store/store-errors.d.ts +1 -0
  204. package/dist/store/store-errors.js +45 -0
  205. package/dist/store/store.d.ts +16 -1
  206. package/dist/store/store.js +30 -6
  207. package/package.json +5 -2
  208. package/schemas/examples/records-business.jsonl +11 -0
  209. package/schemas/records-envelope.v1.schema.json +1160 -5
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "title": "WireCat records envelope, version 1",
4
- "description": "Records one source sends to the store. JSONL is the same model: the first line holds schema_version and source, each further line one record.",
4
+ "description": "Records one source sends to the store. JSONL is the same model: the first line holds schema_version, source and options, each further line one record.",
5
5
  "type": "object",
6
6
  "required": ["schema_version", "source", "records"],
7
7
  "additionalProperties": false,
@@ -12,6 +12,9 @@
12
12
  "source": {
13
13
  "$ref": "#/$defs/source"
14
14
  },
15
+ "options": {
16
+ "$ref": "#/$defs/options"
17
+ },
15
18
  "records": {
16
19
  "type": "array",
17
20
  "items": {
@@ -44,6 +47,21 @@
44
47
  }
45
48
  }
46
49
  },
50
+ "options": {
51
+ "type": "object",
52
+ "additionalProperties": false,
53
+ "properties": {
54
+ "lines": {
55
+ "enum": ["text", "products"],
56
+ "description": "products: an invoice line's product (an external id) names its product; text, the default, keeps it as data. Order lines always read it, and product_ref (a product: ref) is read on every line."
57
+ },
58
+ "phone_region": {
59
+ "type": "string",
60
+ "pattern": "^[A-Za-z]{2}$",
61
+ "description": "The country a person's phone without + is read in. Without it such a number is an identifier only when exactly one country of the store's phone_countries setting reads it as valid"
62
+ }
63
+ }
64
+ },
47
65
  "record": {
48
66
  "type": "object",
49
67
  "required": ["key", "type", "external_id", "operation"],
@@ -56,7 +74,7 @@
56
74
  },
57
75
  "type": {
58
76
  "type": "string",
59
- "pattern": "^(invoice|payment|person|organization|project|custom:[a-z0-9][a-z0-9_-]{0,62})$"
77
+ "pattern": "^(invoice|payment|person|organization|project|order|product|contract|subscription|wallet|transaction|deal|lead|message|event|pipeline|custom:[a-z0-9][a-z0-9_-]{0,62})$"
60
78
  },
61
79
  "external_id": {
62
80
  "type": "string",
@@ -82,12 +100,294 @@
82
100
  "$ref": "#/$defs/relation"
83
101
  }
84
102
  }
85
- }
103
+ },
104
+ "allOf": [
105
+ {
106
+ "if": {
107
+ "properties": {
108
+ "type": {
109
+ "const": "invoice"
110
+ }
111
+ },
112
+ "required": ["type"]
113
+ },
114
+ "then": {
115
+ "properties": {
116
+ "fields": {
117
+ "$ref": "#/$defs/fields-invoice"
118
+ }
119
+ }
120
+ }
121
+ },
122
+ {
123
+ "if": {
124
+ "properties": {
125
+ "type": {
126
+ "const": "payment"
127
+ }
128
+ },
129
+ "required": ["type"]
130
+ },
131
+ "then": {
132
+ "properties": {
133
+ "fields": {
134
+ "$ref": "#/$defs/fields-payment"
135
+ }
136
+ }
137
+ }
138
+ },
139
+ {
140
+ "if": {
141
+ "properties": {
142
+ "type": {
143
+ "const": "person"
144
+ }
145
+ },
146
+ "required": ["type"]
147
+ },
148
+ "then": {
149
+ "properties": {
150
+ "fields": {
151
+ "$ref": "#/$defs/fields-person"
152
+ }
153
+ }
154
+ }
155
+ },
156
+ {
157
+ "if": {
158
+ "properties": {
159
+ "type": {
160
+ "const": "organization"
161
+ }
162
+ },
163
+ "required": ["type"]
164
+ },
165
+ "then": {
166
+ "properties": {
167
+ "fields": {
168
+ "$ref": "#/$defs/fields-organization"
169
+ }
170
+ }
171
+ }
172
+ },
173
+ {
174
+ "if": {
175
+ "properties": {
176
+ "type": {
177
+ "const": "project"
178
+ }
179
+ },
180
+ "required": ["type"]
181
+ },
182
+ "then": {
183
+ "properties": {
184
+ "fields": {
185
+ "$ref": "#/$defs/fields-project"
186
+ }
187
+ }
188
+ }
189
+ },
190
+ {
191
+ "if": {
192
+ "properties": {
193
+ "type": {
194
+ "const": "order"
195
+ }
196
+ },
197
+ "required": ["type"]
198
+ },
199
+ "then": {
200
+ "properties": {
201
+ "fields": {
202
+ "$ref": "#/$defs/fields-order"
203
+ }
204
+ }
205
+ }
206
+ },
207
+ {
208
+ "if": {
209
+ "properties": {
210
+ "type": {
211
+ "const": "product"
212
+ }
213
+ },
214
+ "required": ["type"]
215
+ },
216
+ "then": {
217
+ "properties": {
218
+ "fields": {
219
+ "$ref": "#/$defs/fields-product"
220
+ }
221
+ }
222
+ }
223
+ },
224
+ {
225
+ "if": {
226
+ "properties": {
227
+ "type": {
228
+ "const": "contract"
229
+ }
230
+ },
231
+ "required": ["type"]
232
+ },
233
+ "then": {
234
+ "properties": {
235
+ "fields": {
236
+ "$ref": "#/$defs/fields-contract"
237
+ }
238
+ }
239
+ }
240
+ },
241
+ {
242
+ "if": {
243
+ "properties": {
244
+ "type": {
245
+ "const": "subscription"
246
+ }
247
+ },
248
+ "required": ["type"]
249
+ },
250
+ "then": {
251
+ "properties": {
252
+ "fields": {
253
+ "$ref": "#/$defs/fields-subscription"
254
+ }
255
+ }
256
+ }
257
+ },
258
+ {
259
+ "if": {
260
+ "properties": {
261
+ "type": {
262
+ "const": "wallet"
263
+ }
264
+ },
265
+ "required": ["type"]
266
+ },
267
+ "then": {
268
+ "properties": {
269
+ "fields": {
270
+ "$ref": "#/$defs/fields-wallet"
271
+ }
272
+ }
273
+ }
274
+ },
275
+ {
276
+ "if": {
277
+ "properties": {
278
+ "type": {
279
+ "const": "transaction"
280
+ }
281
+ },
282
+ "required": ["type"]
283
+ },
284
+ "then": {
285
+ "properties": {
286
+ "fields": {
287
+ "$ref": "#/$defs/fields-transaction"
288
+ }
289
+ }
290
+ }
291
+ },
292
+ {
293
+ "if": {
294
+ "properties": {
295
+ "type": {
296
+ "const": "deal"
297
+ }
298
+ },
299
+ "required": ["type"]
300
+ },
301
+ "then": {
302
+ "properties": {
303
+ "fields": {
304
+ "$ref": "#/$defs/fields-deal"
305
+ }
306
+ }
307
+ }
308
+ },
309
+ {
310
+ "if": {
311
+ "properties": {
312
+ "type": {
313
+ "const": "lead"
314
+ }
315
+ },
316
+ "required": ["type"]
317
+ },
318
+ "then": {
319
+ "properties": {
320
+ "fields": {
321
+ "$ref": "#/$defs/fields-lead"
322
+ }
323
+ }
324
+ }
325
+ },
326
+ {
327
+ "if": {
328
+ "properties": {
329
+ "type": {
330
+ "const": "message"
331
+ }
332
+ },
333
+ "required": ["type"]
334
+ },
335
+ "then": {
336
+ "properties": {
337
+ "fields": {
338
+ "$ref": "#/$defs/fields-message"
339
+ }
340
+ }
341
+ }
342
+ },
343
+ {
344
+ "if": {
345
+ "properties": {
346
+ "type": {
347
+ "const": "event"
348
+ }
349
+ },
350
+ "required": ["type"]
351
+ },
352
+ "then": {
353
+ "properties": {
354
+ "fields": {
355
+ "$ref": "#/$defs/fields-event"
356
+ }
357
+ }
358
+ }
359
+ },
360
+ {
361
+ "if": {
362
+ "properties": {
363
+ "type": {
364
+ "const": "pipeline"
365
+ }
366
+ },
367
+ "required": ["type"]
368
+ },
369
+ "then": {
370
+ "properties": {
371
+ "fields": {
372
+ "$ref": "#/$defs/fields-pipeline"
373
+ }
374
+ }
375
+ }
376
+ }
377
+ ]
86
378
  },
87
379
  "relation": {
88
380
  "type": "object",
89
- "required": ["role", "type", "external_id"],
381
+ "required": ["role"],
90
382
  "additionalProperties": false,
383
+ "oneOf": [
384
+ {
385
+ "required": ["type", "external_id"]
386
+ },
387
+ {
388
+ "required": ["ref"]
389
+ }
390
+ ],
91
391
  "properties": {
92
392
  "role": {
93
393
  "type": "string",
@@ -95,19 +395,874 @@
95
395
  },
96
396
  "type": {
97
397
  "type": "string",
98
- "pattern": "^(invoice|payment|person|organization|project|custom:[a-z0-9][a-z0-9_-]{0,62})$"
398
+ "pattern": "^(invoice|payment|person|organization|project|order|product|contract|subscription|wallet|transaction|deal|lead|message|event|pipeline|custom:[a-z0-9][a-z0-9_-]{0,62})$"
99
399
  },
100
400
  "external_id": {
101
401
  "type": "string",
102
402
  "minLength": 1,
103
403
  "maxLength": 512
104
404
  },
405
+ "ref": {
406
+ "type": "string",
407
+ "pattern": "^[a-z]+:[^\\s]{1,500}$",
408
+ "description": "A store entity, such as organization:12"
409
+ },
410
+ "as": {
411
+ "type": "string",
412
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,62}$",
413
+ "description": "On a relationship role: the part the target plays, such as decision-maker"
414
+ },
105
415
  "amount": {
106
416
  "type": "string",
107
417
  "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
108
418
  "description": "A settles relation's share of the payment, a decimal in its currency"
109
419
  }
110
420
  }
421
+ },
422
+ "fields-invoice": {
423
+ "type": "object",
424
+ "properties": {
425
+ "direction": {
426
+ "type": ["string", "null"],
427
+ "enum": ["receivable", "payable", null]
428
+ },
429
+ "number": {
430
+ "type": ["string", "null"],
431
+ "minLength": 1,
432
+ "maxLength": 80,
433
+ "description": "The invoice's number"
434
+ },
435
+ "currency": {
436
+ "type": ["string", "null"],
437
+ "pattern": "^[A-Za-z]{3}$",
438
+ "description": "ISO 4217 code"
439
+ },
440
+ "issue_date": {
441
+ "type": ["string", "null"],
442
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
443
+ "description": "The day it was issued"
444
+ },
445
+ "due_date": {
446
+ "type": ["string", "null"],
447
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
448
+ "description": "The day it is due"
449
+ },
450
+ "total": {
451
+ "type": ["string", "null"],
452
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
453
+ "description": "The printed total: refused when it is not the sum of the lines"
454
+ },
455
+ "lines": {
456
+ "type": ["array", "null"],
457
+ "items": {
458
+ "type": "object",
459
+ "properties": {
460
+ "description": {
461
+ "type": ["string", "null"],
462
+ "minLength": 1,
463
+ "maxLength": 2000,
464
+ "description": "What the line is for; the product's name when left out"
465
+ },
466
+ "quantity": {
467
+ "type": ["string", "null"],
468
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
469
+ "description": "A decimal, 1 when left out"
470
+ },
471
+ "unit_price": {
472
+ "type": ["string", "null"],
473
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
474
+ "description": "A decimal in the parent's currency"
475
+ },
476
+ "amount": {
477
+ "type": ["string", "null"],
478
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
479
+ "description": "A decimal in the parent's currency: quantity × unit price"
480
+ },
481
+ "product": {
482
+ "description": "The product record's external id in this account, read with options.lines products"
483
+ },
484
+ "product_ref": {
485
+ "type": ["string", "null"],
486
+ "pattern": "^product:[1-9][0-9]*$",
487
+ "description": "A product: ref of the store"
488
+ }
489
+ },
490
+ "additionalProperties": true
491
+ },
492
+ "maxItems": 500,
493
+ "description": "The invoice's lines"
494
+ }
495
+ },
496
+ "additionalProperties": true
497
+ },
498
+ "fields-payment": {
499
+ "type": "object",
500
+ "properties": {
501
+ "direction": {
502
+ "type": ["string", "null"],
503
+ "enum": ["in", "out", null]
504
+ },
505
+ "amount": {
506
+ "type": ["string", "null"],
507
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
508
+ "description": "A decimal in currency"
509
+ },
510
+ "currency": {
511
+ "type": ["string", "null"],
512
+ "pattern": "^[A-Za-z]{3}$",
513
+ "description": "ISO 4217 code"
514
+ },
515
+ "date": {
516
+ "type": ["string", "null"],
517
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
518
+ "description": "The day it was paid"
519
+ },
520
+ "reference": {
521
+ "type": ["string", "null"],
522
+ "minLength": 1,
523
+ "maxLength": 2000,
524
+ "description": "The payment's reference"
525
+ }
526
+ },
527
+ "additionalProperties": true
528
+ },
529
+ "fields-person": {
530
+ "type": "object",
531
+ "properties": {
532
+ "name": {
533
+ "description": "The person's name"
534
+ },
535
+ "email": {
536
+ "description": "E-mail addresses, one or a list: an exact one links the record to the one person who has it"
537
+ },
538
+ "phone": {
539
+ "description": "Phone numbers, one or a list: an exact one, read to E.164, links like an e-mail"
540
+ }
541
+ },
542
+ "additionalProperties": true
543
+ },
544
+ "fields-organization": {
545
+ "type": "object",
546
+ "properties": {
547
+ "name": {
548
+ "description": "The organization's name"
549
+ },
550
+ "identifiers": {
551
+ "description": "Strong identifiers, a list of {scheme, value}: scheme email, domain, tax-id:<cc> or registration:<cc>. One that another organization has links the record to it; any other item is kept as data"
552
+ }
553
+ },
554
+ "additionalProperties": true
555
+ },
556
+ "fields-project": {
557
+ "type": "object",
558
+ "properties": {
559
+ "name": {
560
+ "description": "The project's name"
561
+ },
562
+ "key": {
563
+ "description": "The project's key: an existing project with it is this one"
564
+ },
565
+ "description": {
566
+ "description": "What the project is"
567
+ }
568
+ },
569
+ "additionalProperties": true
570
+ },
571
+ "fields-order": {
572
+ "type": "object",
573
+ "properties": {
574
+ "number": {
575
+ "type": ["string", "null"],
576
+ "minLength": 1,
577
+ "maxLength": 80,
578
+ "description": "The order's number at the supplier"
579
+ },
580
+ "direction": {
581
+ "type": ["string", "null"],
582
+ "enum": ["purchase", "sale", null],
583
+ "description": "purchase when left out; in a sale the owner is the supplier"
584
+ },
585
+ "purpose": {
586
+ "type": ["string", "null"],
587
+ "enum": ["personal", "business", "client", "other", null],
588
+ "description": "business when left out"
589
+ },
590
+ "status": {
591
+ "type": ["string", "null"],
592
+ "enum": ["placed", "shipped", "delivered", "cancelled", "returned", null],
593
+ "description": "placed when left out"
594
+ },
595
+ "supplier_name": {
596
+ "type": ["string", "null"],
597
+ "minLength": 1,
598
+ "maxLength": 200,
599
+ "description": "The shop or supplier as the source names it"
600
+ },
601
+ "order_date": {
602
+ "type": ["string", "null"],
603
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
604
+ "description": "The day it was ordered"
605
+ },
606
+ "fulfilled_date": {
607
+ "type": ["string", "null"],
608
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
609
+ "description": "The day it was delivered"
610
+ },
611
+ "currency": {
612
+ "type": ["string", "null"],
613
+ "pattern": "^[A-Za-z]{3}$",
614
+ "description": "ISO 4217 code"
615
+ },
616
+ "total": {
617
+ "type": ["string", "null"],
618
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
619
+ "description": "With lines, their sum"
620
+ },
621
+ "source_url": {
622
+ "type": ["string", "null"],
623
+ "minLength": 1,
624
+ "maxLength": 2000,
625
+ "description": "The order's page at the shop"
626
+ },
627
+ "lines": {
628
+ "type": ["array", "null"],
629
+ "items": {
630
+ "type": "object",
631
+ "properties": {
632
+ "description": {
633
+ "type": ["string", "null"],
634
+ "minLength": 1,
635
+ "maxLength": 2000,
636
+ "description": "What the line is for; the product's name when left out"
637
+ },
638
+ "quantity": {
639
+ "type": ["string", "null"],
640
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
641
+ "description": "A decimal, 1 when left out"
642
+ },
643
+ "unit_price": {
644
+ "type": ["string", "null"],
645
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
646
+ "description": "A decimal in the parent's currency"
647
+ },
648
+ "amount": {
649
+ "type": ["string", "null"],
650
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
651
+ "description": "A decimal in the parent's currency: quantity × unit price"
652
+ },
653
+ "product": {
654
+ "description": "The product record's external id in this account, read with options.lines products"
655
+ },
656
+ "product_ref": {
657
+ "type": ["string", "null"],
658
+ "pattern": "^product:[1-9][0-9]*$",
659
+ "description": "A product: ref of the store"
660
+ }
661
+ },
662
+ "additionalProperties": true
663
+ },
664
+ "maxItems": 500,
665
+ "description": "The order's lines"
666
+ }
667
+ },
668
+ "additionalProperties": true
669
+ },
670
+ "fields-product": {
671
+ "type": "object",
672
+ "properties": {
673
+ "kind": {
674
+ "type": ["string", "null"],
675
+ "enum": ["product", "service", null],
676
+ "description": "product when left out"
677
+ },
678
+ "name": {
679
+ "type": "string",
680
+ "minLength": 1,
681
+ "maxLength": 200,
682
+ "description": "The product's name"
683
+ },
684
+ "sku": {
685
+ "type": ["string", "null"],
686
+ "minLength": 1,
687
+ "maxLength": 80,
688
+ "description": "The supplier's code for it"
689
+ },
690
+ "unit": {
691
+ "type": ["string", "null"],
692
+ "minLength": 1,
693
+ "maxLength": 40,
694
+ "description": "hour, pcs, month: free text"
695
+ },
696
+ "unit_price": {
697
+ "type": ["string", "null"],
698
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
699
+ "description": "A decimal in currency"
700
+ },
701
+ "currency": {
702
+ "type": ["string", "null"],
703
+ "pattern": "^[A-Za-z]{3}$",
704
+ "description": "ISO 4217 code"
705
+ },
706
+ "description": {
707
+ "type": ["string", "null"],
708
+ "minLength": 1,
709
+ "maxLength": 2000,
710
+ "description": "What it is"
711
+ },
712
+ "archived_date": {
713
+ "type": ["string", "null"],
714
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
715
+ "description": "No longer sold from this day"
716
+ }
717
+ },
718
+ "required": ["name"],
719
+ "additionalProperties": true
720
+ },
721
+ "fields-contract": {
722
+ "type": "object",
723
+ "properties": {
724
+ "name": {
725
+ "type": "string",
726
+ "minLength": 1,
727
+ "maxLength": 200,
728
+ "description": "The contract's name"
729
+ },
730
+ "number": {
731
+ "type": ["string", "null"],
732
+ "minLength": 1,
733
+ "maxLength": 80,
734
+ "description": "The contract's number"
735
+ },
736
+ "kind": {
737
+ "type": "string",
738
+ "enum": ["sale", "purchase", "service", "lease", "employment", "nda", "license", "other"]
739
+ },
740
+ "status": {
741
+ "type": ["string", "null"],
742
+ "enum": ["draft", "active", "ended", "terminated", null],
743
+ "description": "active when left out"
744
+ },
745
+ "signed_date": {
746
+ "type": ["string", "null"],
747
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
748
+ "description": "The day it was signed"
749
+ },
750
+ "effective_date": {
751
+ "type": ["string", "null"],
752
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
753
+ "description": "The day it starts"
754
+ },
755
+ "expiration_date": {
756
+ "type": ["string", "null"],
757
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
758
+ "description": "The day it ends; open-ended when left out"
759
+ },
760
+ "auto_renew": {
761
+ "type": ["boolean", "null"],
762
+ "description": "Whether it renews itself"
763
+ },
764
+ "renewal": {
765
+ "type": ["string", "null"],
766
+ "pattern": "^[1-9][0-9]{0,2}-(day|week|month|year)$",
767
+ "description": "1-year"
768
+ },
769
+ "notice_days": {
770
+ "type": ["integer", "null"],
771
+ "minimum": 0,
772
+ "maximum": 3650,
773
+ "description": "Days of notice before it ends"
774
+ },
775
+ "terms": {
776
+ "type": ["string", "null"],
777
+ "minLength": 1,
778
+ "maxLength": 20000,
779
+ "description": "Renewal, cancellation and other terms, as text"
780
+ },
781
+ "value": {
782
+ "type": ["string", "null"],
783
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
784
+ "description": "A decimal in currency: the contract is then a proposal"
785
+ },
786
+ "currency": {
787
+ "type": ["string", "null"],
788
+ "pattern": "^[A-Za-z]{3}$",
789
+ "description": "ISO 4217 code"
790
+ }
791
+ },
792
+ "required": ["name", "kind"],
793
+ "additionalProperties": true
794
+ },
795
+ "fields-subscription": {
796
+ "type": "object",
797
+ "properties": {
798
+ "name": {
799
+ "type": ["string", "null"],
800
+ "minLength": 1,
801
+ "maxLength": 200,
802
+ "description": "Its name; the product's when left out"
803
+ },
804
+ "direction": {
805
+ "type": "string",
806
+ "enum": ["receivable", "payable"],
807
+ "description": "receivable: the owner bills it; payable: the owner pays it"
808
+ },
809
+ "status": {
810
+ "type": ["string", "null"],
811
+ "enum": ["trial", "active", "paused", "cancelled", "ended", null]
812
+ },
813
+ "interval": {
814
+ "type": "string",
815
+ "pattern": "^[1-9][0-9]{0,2}-(day|week|month|year)$",
816
+ "description": "1-month"
817
+ },
818
+ "start_date": {
819
+ "type": "string",
820
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
821
+ "description": "The first day"
822
+ },
823
+ "trial_end_date": {
824
+ "type": ["string", "null"],
825
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
826
+ "description": "The trial's last day"
827
+ },
828
+ "next_renewal_date": {
829
+ "type": ["string", "null"],
830
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
831
+ "description": "The next renewal"
832
+ },
833
+ "cancelled_date": {
834
+ "type": ["string", "null"],
835
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
836
+ "description": "The day it was cancelled"
837
+ },
838
+ "end_date": {
839
+ "type": ["string", "null"],
840
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
841
+ "description": "The last day"
842
+ },
843
+ "prices": {
844
+ "type": ["array", "null"],
845
+ "items": {
846
+ "type": "object",
847
+ "properties": {
848
+ "amount": {
849
+ "type": "string",
850
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
851
+ "description": "A decimal in currency"
852
+ },
853
+ "currency": {
854
+ "type": "string",
855
+ "pattern": "^[A-Za-z]{3}$",
856
+ "description": "ISO 4217 code"
857
+ },
858
+ "effective_from": {
859
+ "type": ["string", "null"],
860
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
861
+ "description": "The day the price starts; the subscription's start when left out"
862
+ }
863
+ },
864
+ "required": ["amount", "currency"],
865
+ "additionalProperties": true
866
+ },
867
+ "maxItems": 100,
868
+ "description": "Its prices, each from a day; a price is never overwritten"
869
+ }
870
+ },
871
+ "required": ["direction", "interval", "start_date"],
872
+ "additionalProperties": true
873
+ },
874
+ "fields-wallet": {
875
+ "type": "object",
876
+ "properties": {
877
+ "name": {
878
+ "type": "string",
879
+ "minLength": 1,
880
+ "maxLength": 200,
881
+ "description": "The account's name"
882
+ },
883
+ "kind": {
884
+ "type": ["string", "null"],
885
+ "enum": ["bank", "card", "cash", "wallet", "other", null],
886
+ "description": "bank when left out"
887
+ },
888
+ "currency": {
889
+ "type": "string",
890
+ "pattern": "^[A-Za-z]{3}$",
891
+ "description": "ISO 4217 code"
892
+ },
893
+ "institution": {
894
+ "type": ["string", "null"],
895
+ "minLength": 1,
896
+ "maxLength": 200,
897
+ "description": "The bank, as text"
898
+ },
899
+ "number_hint": {
900
+ "type": ["string", "null"],
901
+ "minLength": 1,
902
+ "maxLength": 4,
903
+ "description": "The last 4 characters of its number; a whole IBAN or card number is refused"
904
+ },
905
+ "opening_balance": {
906
+ "type": ["string", "null"],
907
+ "pattern": "^-?[0-9]{1,16}(\\.[0-9]{1,6})?$",
908
+ "description": "Kept in the record only: the owner sets the wallet's opening balance"
909
+ },
910
+ "opening_date": {
911
+ "type": ["string", "null"],
912
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
913
+ "description": "The day of that balance"
914
+ }
915
+ },
916
+ "required": ["name", "currency"],
917
+ "additionalProperties": true
918
+ },
919
+ "fields-transaction": {
920
+ "type": "object",
921
+ "properties": {
922
+ "direction": {
923
+ "type": "string",
924
+ "enum": ["in", "out"]
925
+ },
926
+ "amount": {
927
+ "type": "string",
928
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
929
+ "description": "A decimal above 0 in the wallet's currency"
930
+ },
931
+ "currency": {
932
+ "type": ["string", "null"],
933
+ "pattern": "^[A-Za-z]{3}$",
934
+ "description": "ISO 4217 code"
935
+ },
936
+ "status": {
937
+ "type": ["string", "null"],
938
+ "enum": ["pending", "booked", null],
939
+ "description": "booked when left out"
940
+ },
941
+ "date": {
942
+ "type": "string",
943
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
944
+ "description": "The day the statement shows"
945
+ },
946
+ "booked_date": {
947
+ "type": ["string", "null"],
948
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
949
+ "description": "The day it was booked; the statement day when left out"
950
+ },
951
+ "description": {
952
+ "type": ["string", "null"],
953
+ "minLength": 1,
954
+ "maxLength": 2000,
955
+ "description": "As the statement says it"
956
+ },
957
+ "counterparty_name": {
958
+ "type": ["string", "null"],
959
+ "minLength": 1,
960
+ "maxLength": 200,
961
+ "description": "As the statement names the other side"
962
+ },
963
+ "reference": {
964
+ "type": ["string", "null"],
965
+ "minLength": 1,
966
+ "maxLength": 200,
967
+ "description": "The statement's reference"
968
+ },
969
+ "splits": {
970
+ "type": ["array", "null"],
971
+ "items": {
972
+ "type": "object",
973
+ "properties": {
974
+ "amount": {
975
+ "type": "string",
976
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
977
+ "description": "A decimal above 0"
978
+ },
979
+ "category": {
980
+ "type": "string",
981
+ "minLength": 1,
982
+ "maxLength": 200,
983
+ "description": "Free text, such as rent"
984
+ },
985
+ "note": {
986
+ "type": ["string", "null"],
987
+ "minLength": 1,
988
+ "maxLength": 2000,
989
+ "description": "A note"
990
+ }
991
+ },
992
+ "required": ["amount", "category"],
993
+ "additionalProperties": true
994
+ },
995
+ "maxItems": 100,
996
+ "description": "Categories of its amount; what they leave is uncategorized"
997
+ }
998
+ },
999
+ "required": ["direction", "amount", "date"],
1000
+ "additionalProperties": true
1001
+ },
1002
+ "fields-deal": {
1003
+ "type": "object",
1004
+ "properties": {
1005
+ "title": {
1006
+ "type": "string",
1007
+ "minLength": 1,
1008
+ "maxLength": 200,
1009
+ "description": "The deal's title"
1010
+ },
1011
+ "pipeline": {
1012
+ "type": "string",
1013
+ "minLength": 1,
1014
+ "maxLength": 512,
1015
+ "description": "The pipeline record's external id in this account"
1016
+ },
1017
+ "stage": {
1018
+ "type": "string",
1019
+ "minLength": 1,
1020
+ "maxLength": 512,
1021
+ "description": "The stage's external id in that pipeline"
1022
+ },
1023
+ "status": {
1024
+ "type": ["string", "null"],
1025
+ "enum": ["open", "won", "lost", null],
1026
+ "description": "Left out, the stage's outcome says it"
1027
+ },
1028
+ "amount": {
1029
+ "type": ["string", "null"],
1030
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
1031
+ "description": "A decimal in currency"
1032
+ },
1033
+ "currency": {
1034
+ "type": ["string", "null"],
1035
+ "pattern": "^[A-Za-z]{3}$",
1036
+ "description": "ISO 4217 code"
1037
+ },
1038
+ "close_date": {
1039
+ "type": ["string", "null"],
1040
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
1041
+ "description": "When it is expected to close"
1042
+ },
1043
+ "closed_date": {
1044
+ "type": ["string", "null"],
1045
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
1046
+ "description": "When it was won or lost"
1047
+ },
1048
+ "closed_reason": {
1049
+ "type": ["string", "null"],
1050
+ "minLength": 1,
1051
+ "maxLength": 2000,
1052
+ "description": "Why it was won or lost"
1053
+ },
1054
+ "url": {
1055
+ "type": ["string", "null"],
1056
+ "minLength": 1,
1057
+ "maxLength": 2000,
1058
+ "description": "The source's page for it"
1059
+ }
1060
+ },
1061
+ "required": ["title", "pipeline", "stage"],
1062
+ "additionalProperties": true
1063
+ },
1064
+ "fields-lead": {
1065
+ "type": "object",
1066
+ "properties": {
1067
+ "title": {
1068
+ "type": "string",
1069
+ "minLength": 1,
1070
+ "maxLength": 200,
1071
+ "description": "The lead's title"
1072
+ },
1073
+ "pipeline": {
1074
+ "type": "string",
1075
+ "minLength": 1,
1076
+ "maxLength": 512,
1077
+ "description": "The pipeline record's external id in this account"
1078
+ },
1079
+ "stage": {
1080
+ "type": "string",
1081
+ "minLength": 1,
1082
+ "maxLength": 512,
1083
+ "description": "The stage's external id in that pipeline"
1084
+ },
1085
+ "status": {
1086
+ "type": ["string", "null"],
1087
+ "enum": ["open", "won", "lost", null],
1088
+ "description": "Left out, the stage's outcome says it"
1089
+ },
1090
+ "amount": {
1091
+ "type": ["string", "null"],
1092
+ "pattern": "^[0-9]{1,16}(\\.[0-9]{1,6})?$",
1093
+ "description": "A decimal in currency"
1094
+ },
1095
+ "currency": {
1096
+ "type": ["string", "null"],
1097
+ "pattern": "^[A-Za-z]{3}$",
1098
+ "description": "ISO 4217 code"
1099
+ },
1100
+ "close_date": {
1101
+ "type": ["string", "null"],
1102
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
1103
+ "description": "When it is expected to close"
1104
+ },
1105
+ "closed_date": {
1106
+ "type": ["string", "null"],
1107
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
1108
+ "description": "When it was won or lost"
1109
+ },
1110
+ "closed_reason": {
1111
+ "type": ["string", "null"],
1112
+ "minLength": 1,
1113
+ "maxLength": 2000,
1114
+ "description": "Why it was won or lost"
1115
+ },
1116
+ "url": {
1117
+ "type": ["string", "null"],
1118
+ "minLength": 1,
1119
+ "maxLength": 2000,
1120
+ "description": "The source's page for it"
1121
+ }
1122
+ },
1123
+ "required": ["title", "pipeline", "stage"],
1124
+ "additionalProperties": true
1125
+ },
1126
+ "fields-message": {
1127
+ "type": "object",
1128
+ "properties": {
1129
+ "kind": {
1130
+ "type": "string",
1131
+ "enum": ["sms"],
1132
+ "description": "sms: a text message of the phone"
1133
+ },
1134
+ "direction": {
1135
+ "type": "string",
1136
+ "enum": ["in", "out"],
1137
+ "description": "in: the other side wrote it; out: the owner did"
1138
+ },
1139
+ "phone": {
1140
+ "type": "string",
1141
+ "minLength": 1,
1142
+ "maxLength": 64,
1143
+ "description": "The other side's number as the phone shows it: read to E.164 with the store's phone_countries"
1144
+ },
1145
+ "name": {
1146
+ "type": ["string", "null"],
1147
+ "minLength": 1,
1148
+ "maxLength": 200,
1149
+ "description": "The other side's name as the phone shows it"
1150
+ },
1151
+ "thread": {
1152
+ "type": ["string", "null"],
1153
+ "minLength": 1,
1154
+ "maxLength": 512,
1155
+ "description": "The phone's thread id; the number when left out"
1156
+ },
1157
+ "body": {
1158
+ "type": "string",
1159
+ "maxLength": 20000,
1160
+ "description": "The text"
1161
+ },
1162
+ "sent_at": {
1163
+ "type": "string",
1164
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(:[0-9]{2}(\\.[0-9]{1,9})?)?(Z|[+-][0-9]{2}:[0-9]{2})$",
1165
+ "description": "When it was sent"
1166
+ },
1167
+ "read": {
1168
+ "type": ["boolean", "null"],
1169
+ "description": "An incoming message the owner opened"
1170
+ }
1171
+ },
1172
+ "required": ["kind", "direction", "phone", "body", "sent_at"],
1173
+ "additionalProperties": true
1174
+ },
1175
+ "fields-event": {
1176
+ "type": "object",
1177
+ "properties": {
1178
+ "kind": {
1179
+ "type": "string",
1180
+ "enum": ["call"],
1181
+ "description": "call: a phone call"
1182
+ },
1183
+ "direction": {
1184
+ "type": "string",
1185
+ "enum": ["in", "out", "missed"],
1186
+ "description": "in, out, or missed: a call the owner did not take"
1187
+ },
1188
+ "phone": {
1189
+ "type": "string",
1190
+ "minLength": 1,
1191
+ "maxLength": 64,
1192
+ "description": "The other side's number as the phone shows it: read to E.164 with the store's phone_countries"
1193
+ },
1194
+ "name": {
1195
+ "type": ["string", "null"],
1196
+ "minLength": 1,
1197
+ "maxLength": 200,
1198
+ "description": "The other side's name as the phone shows it"
1199
+ },
1200
+ "started_at": {
1201
+ "type": "string",
1202
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(:[0-9]{2}(\\.[0-9]{1,9})?)?(Z|[+-][0-9]{2}:[0-9]{2})$",
1203
+ "description": "When it rang"
1204
+ },
1205
+ "duration": {
1206
+ "type": ["integer", "null"],
1207
+ "minimum": 0,
1208
+ "maximum": 604800,
1209
+ "description": "Seconds talked; 0 when missed"
1210
+ }
1211
+ },
1212
+ "required": ["kind", "direction", "phone", "started_at"],
1213
+ "additionalProperties": true
1214
+ },
1215
+ "fields-pipeline": {
1216
+ "type": "object",
1217
+ "properties": {
1218
+ "kind": {
1219
+ "type": ["string", "null"],
1220
+ "enum": ["deal", "lead", null],
1221
+ "description": "deal when left out"
1222
+ },
1223
+ "name": {
1224
+ "type": "string",
1225
+ "minLength": 1,
1226
+ "maxLength": 80,
1227
+ "description": "The pipeline's name"
1228
+ },
1229
+ "stages": {
1230
+ "type": "array",
1231
+ "items": {
1232
+ "type": "object",
1233
+ "properties": {
1234
+ "external_id": {
1235
+ "type": "string",
1236
+ "minLength": 1,
1237
+ "maxLength": 512,
1238
+ "description": "The stage's id at the source"
1239
+ },
1240
+ "name": {
1241
+ "type": "string",
1242
+ "minLength": 1,
1243
+ "maxLength": 80,
1244
+ "description": "The stage's name"
1245
+ },
1246
+ "position": {
1247
+ "type": ["integer", "null"],
1248
+ "minimum": 0,
1249
+ "maximum": 1000
1250
+ },
1251
+ "outcome": {
1252
+ "type": ["string", "null"],
1253
+ "enum": ["open", "won", "lost", null],
1254
+ "description": "open when left out"
1255
+ }
1256
+ },
1257
+ "required": ["external_id", "name"],
1258
+ "additionalProperties": true
1259
+ },
1260
+ "maxItems": 30,
1261
+ "description": "The stages in order"
1262
+ }
1263
+ },
1264
+ "required": ["name", "stages"],
1265
+ "additionalProperties": true
111
1266
  }
112
1267
  }
113
1268
  }