@opsregistry/contracts 0.3.1 → 0.5.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.
- package/README.md +34 -0
- package/dist/documents/exchange-document-common.d.ts +233 -0
- package/dist/documents/exchange-document-common.d.ts.map +1 -0
- package/dist/documents/exchange-document-common.js +133 -0
- package/dist/documents/exchange-document-common.js.map +1 -0
- package/dist/documents/exchange-document-create.d.ts +176 -0
- package/dist/documents/exchange-document-create.d.ts.map +1 -0
- package/dist/documents/exchange-document-create.js +32 -0
- package/dist/documents/exchange-document-create.js.map +1 -0
- package/dist/documents/exchange-document-get.d.ts +125 -0
- package/dist/documents/exchange-document-get.d.ts.map +1 -0
- package/dist/documents/exchange-document-get.js +21 -0
- package/dist/documents/exchange-document-get.js.map +1 -0
- package/dist/documents/exchange-document-list-changes.d.ts +302 -0
- package/dist/documents/exchange-document-list-changes.d.ts.map +1 -0
- package/dist/documents/exchange-document-list-changes.js +39 -0
- package/dist/documents/exchange-document-list-changes.js.map +1 -0
- package/dist/documents/exchange-document-list.d.ts +166 -0
- package/dist/documents/exchange-document-list.d.ts.map +1 -0
- package/dist/documents/exchange-document-list.js +33 -0
- package/dist/documents/exchange-document-list.js.map +1 -0
- package/dist/documents/exchange-document-send.d.ts +143 -0
- package/dist/documents/exchange-document-send.d.ts.map +1 -0
- package/dist/documents/exchange-document-send.js +33 -0
- package/dist/documents/exchange-document-send.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +26 -2
package/README.md
CHANGED
|
@@ -46,6 +46,14 @@
|
|
|
46
46
|
- `inventory.stock.transfer`
|
|
47
47
|
- `inventory.stock.adjust`
|
|
48
48
|
|
|
49
|
+
И первые спецификации электронного обмена документами:
|
|
50
|
+
|
|
51
|
+
- `documents.exchangeDocument.list`
|
|
52
|
+
- `documents.exchangeDocument.get`
|
|
53
|
+
- `documents.exchangeDocument.listChanges`
|
|
54
|
+
- `documents.exchangeDocument.create`
|
|
55
|
+
- `documents.exchangeDocument.send`
|
|
56
|
+
|
|
49
57
|
Каждая операция экспортирует:
|
|
50
58
|
|
|
51
59
|
- `operationCode`
|
|
@@ -102,6 +110,19 @@ const request = stockReserveInputSchema.parse({
|
|
|
102
110
|
- выход возвращает нормализованный статус отправления;
|
|
103
111
|
- история движения передается как массив событий с кодом провайдера, временем, локацией и исходным payload.
|
|
104
112
|
|
|
113
|
+
## Граница электронного документооборота
|
|
114
|
+
|
|
115
|
+
`documents.exchangeDocument.create` создаёт у оператора черновик пакета с участниками и
|
|
116
|
+
вложениями. Операция не подписывает и не отправляет документ. `clientReference` связывает пакет с
|
|
117
|
+
объектом приложения, а `idempotencyKey` позволяет провайдеру или адаптеру защититься от повторного
|
|
118
|
+
создания, если они поддерживают идемпотентность.
|
|
119
|
+
|
|
120
|
+
`documents.exchangeDocument.send` является отдельным юридически значимым действием. Вход всегда
|
|
121
|
+
требует `confirmLegalAction: true` и явный `signingMode`: без подписи, подписью выбранной
|
|
122
|
+
провайдером либо отложенной подписью. Сертификаты, закрытые ключи и подписи не входят в общий
|
|
123
|
+
контракт и должны передаваться через защищённую конфигурацию провайдера или будущую операцию
|
|
124
|
+
`documents.exchangeDocument.sign`.
|
|
125
|
+
|
|
105
126
|
## Граница финансовых операций
|
|
106
127
|
|
|
107
128
|
`finance.merchantPayment.create` описывает входящую платежную попытку в пользу продавца/мерчанта: заказ в магазине, счет за услугу, QR СБП, карточный checkout и похожие acquiring-сценарии.
|
|
@@ -144,3 +165,16 @@ const request = stockReserveInputSchema.parse({
|
|
|
144
165
|
|
|
145
166
|
Поля `metadata` и `externalIds` позволяют приложению сохранить локальный контекст, не добавляя его в
|
|
146
167
|
универсальный код операции.
|
|
168
|
+
|
|
169
|
+
## Граница documents и accounting
|
|
170
|
+
|
|
171
|
+
`documents` описывает передачу, получение, состояние, вложения и события электронного документа у
|
|
172
|
+
оператора обмена. Он не определяет бухгалтерские проводки и не решает, как хозяйственное событие
|
|
173
|
+
отражается в учёте.
|
|
174
|
+
|
|
175
|
+
Например, входящий УПД можно получить через `documents.exchangeDocument.get`, а затем отдельно
|
|
176
|
+
отразить в локальной системе операциями домена `accounting`. Один электронный пакет может породить
|
|
177
|
+
несколько бухгалтерских записей, поэтому эти жизненные циклы не объединяются.
|
|
178
|
+
|
|
179
|
+
`pageToken` и `cursor` намеренно непрозрачны для потребителя. Адаптер может хранить внутри них номер
|
|
180
|
+
страницы, идентификатор события, документа или редакции конкретного провайдера.
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const documentAccessModeSchema: z.ZodLiteral<"authorized">;
|
|
3
|
+
export declare const documentMetadataSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
4
|
+
export declare const documentExternalIdsSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
5
|
+
export declare const exchangeDocumentDirectionSchema: z.ZodEnum<{
|
|
6
|
+
incoming: "incoming";
|
|
7
|
+
internal: "internal";
|
|
8
|
+
outgoing: "outgoing";
|
|
9
|
+
unknown: "unknown";
|
|
10
|
+
}>;
|
|
11
|
+
export declare const exchangeDocumentStatusSchema: z.ZodEnum<{
|
|
12
|
+
accepted: "accepted";
|
|
13
|
+
cancelled: "cancelled";
|
|
14
|
+
deleted: "deleted";
|
|
15
|
+
delivered: "delivered";
|
|
16
|
+
draft: "draft";
|
|
17
|
+
failed: "failed";
|
|
18
|
+
pendingSignature: "pendingSignature";
|
|
19
|
+
readyToSend: "readyToSend";
|
|
20
|
+
received: "received";
|
|
21
|
+
rejected: "rejected";
|
|
22
|
+
sent: "sent";
|
|
23
|
+
unknown: "unknown";
|
|
24
|
+
}>;
|
|
25
|
+
export declare const documentPartyRefSchema: z.ZodObject<{
|
|
26
|
+
partyId: z.ZodOptional<z.ZodString>;
|
|
27
|
+
name: z.ZodOptional<z.ZodString>;
|
|
28
|
+
taxId: z.ZodOptional<z.ZodString>;
|
|
29
|
+
registrationReasonCode: z.ZodOptional<z.ZodString>;
|
|
30
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
31
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export declare const documentMoneySchema: z.ZodObject<{
|
|
34
|
+
amountMinor: z.ZodNumber;
|
|
35
|
+
currency: z.ZodString;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export declare const documentAttachmentSchema: z.ZodObject<{
|
|
38
|
+
attachmentId: z.ZodOptional<z.ZodString>;
|
|
39
|
+
name: z.ZodString;
|
|
40
|
+
documentType: z.ZodOptional<z.ZodString>;
|
|
41
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
42
|
+
incoming: "incoming";
|
|
43
|
+
internal: "internal";
|
|
44
|
+
outgoing: "outgoing";
|
|
45
|
+
unknown: "unknown";
|
|
46
|
+
}>>;
|
|
47
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
48
|
+
sizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
downloadUrl: z.ZodOptional<z.ZodURL>;
|
|
50
|
+
downloadUrlExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
51
|
+
isService: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
53
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export declare const documentAttachmentContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
56
|
+
kind: z.ZodLiteral<"base64">;
|
|
57
|
+
data: z.ZodString;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
59
|
+
kind: z.ZodLiteral<"url">;
|
|
60
|
+
url: z.ZodURL;
|
|
61
|
+
}, z.core.$strip>], "kind">;
|
|
62
|
+
export declare const documentAttachmentDraftSchema: z.ZodObject<{
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
documentType: z.ZodOptional<z.ZodString>;
|
|
65
|
+
documentSubtype: z.ZodOptional<z.ZodString>;
|
|
66
|
+
formatVersion: z.ZodOptional<z.ZodString>;
|
|
67
|
+
formatSubversion: z.ZodOptional<z.ZodString>;
|
|
68
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
69
|
+
isService: z.ZodDefault<z.ZodBoolean>;
|
|
70
|
+
content: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
71
|
+
kind: z.ZodLiteral<"base64">;
|
|
72
|
+
data: z.ZodString;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
kind: z.ZodLiteral<"url">;
|
|
75
|
+
url: z.ZodURL;
|
|
76
|
+
}, z.core.$strip>], "kind">;
|
|
77
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
78
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
export declare const exchangeDocumentWorkflowRefSchema: z.ZodObject<{
|
|
81
|
+
workflowId: z.ZodOptional<z.ZodString>;
|
|
82
|
+
name: z.ZodOptional<z.ZodString>;
|
|
83
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
export declare const exchangeDocumentIdentifierSchema: z.ZodObject<{
|
|
86
|
+
documentId: z.ZodOptional<z.ZodString>;
|
|
87
|
+
revisionId: z.ZodOptional<z.ZodString>;
|
|
88
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
export declare const exchangeDocumentEventSchema: z.ZodObject<{
|
|
91
|
+
eventId: z.ZodString;
|
|
92
|
+
eventType: z.ZodString;
|
|
93
|
+
title: z.ZodOptional<z.ZodString>;
|
|
94
|
+
description: z.ZodOptional<z.ZodString>;
|
|
95
|
+
occurredAt: z.ZodOptional<z.ZodISODateTime>;
|
|
96
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
97
|
+
accepted: "accepted";
|
|
98
|
+
cancelled: "cancelled";
|
|
99
|
+
deleted: "deleted";
|
|
100
|
+
delivered: "delivered";
|
|
101
|
+
draft: "draft";
|
|
102
|
+
failed: "failed";
|
|
103
|
+
pendingSignature: "pendingSignature";
|
|
104
|
+
readyToSend: "readyToSend";
|
|
105
|
+
received: "received";
|
|
106
|
+
rejected: "rejected";
|
|
107
|
+
sent: "sent";
|
|
108
|
+
unknown: "unknown";
|
|
109
|
+
}>>;
|
|
110
|
+
statusCode: z.ZodOptional<z.ZodString>;
|
|
111
|
+
statusText: z.ZodOptional<z.ZodString>;
|
|
112
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
113
|
+
raw: z.ZodOptional<z.ZodUnknown>;
|
|
114
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
export declare const exchangeDocumentSchema: z.ZodObject<{
|
|
117
|
+
documentId: z.ZodString;
|
|
118
|
+
revisionId: z.ZodOptional<z.ZodString>;
|
|
119
|
+
number: z.ZodOptional<z.ZodString>;
|
|
120
|
+
issuedAt: z.ZodOptional<z.ZodISODate>;
|
|
121
|
+
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
122
|
+
updatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
123
|
+
documentType: z.ZodString;
|
|
124
|
+
documentSubtype: z.ZodOptional<z.ZodString>;
|
|
125
|
+
title: z.ZodOptional<z.ZodString>;
|
|
126
|
+
note: z.ZodOptional<z.ZodString>;
|
|
127
|
+
direction: z.ZodDefault<z.ZodEnum<{
|
|
128
|
+
incoming: "incoming";
|
|
129
|
+
internal: "internal";
|
|
130
|
+
outgoing: "outgoing";
|
|
131
|
+
unknown: "unknown";
|
|
132
|
+
}>>;
|
|
133
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
134
|
+
accepted: "accepted";
|
|
135
|
+
cancelled: "cancelled";
|
|
136
|
+
deleted: "deleted";
|
|
137
|
+
delivered: "delivered";
|
|
138
|
+
draft: "draft";
|
|
139
|
+
failed: "failed";
|
|
140
|
+
pendingSignature: "pendingSignature";
|
|
141
|
+
readyToSend: "readyToSend";
|
|
142
|
+
received: "received";
|
|
143
|
+
rejected: "rejected";
|
|
144
|
+
sent: "sent";
|
|
145
|
+
unknown: "unknown";
|
|
146
|
+
}>>;
|
|
147
|
+
statusCode: z.ZodOptional<z.ZodString>;
|
|
148
|
+
statusText: z.ZodOptional<z.ZodString>;
|
|
149
|
+
amount: z.ZodOptional<z.ZodObject<{
|
|
150
|
+
amountMinor: z.ZodNumber;
|
|
151
|
+
currency: z.ZodString;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
ourOrganization: z.ZodOptional<z.ZodObject<{
|
|
154
|
+
partyId: z.ZodOptional<z.ZodString>;
|
|
155
|
+
name: z.ZodOptional<z.ZodString>;
|
|
156
|
+
taxId: z.ZodOptional<z.ZodString>;
|
|
157
|
+
registrationReasonCode: z.ZodOptional<z.ZodString>;
|
|
158
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
159
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
160
|
+
}, z.core.$strip>>;
|
|
161
|
+
counterparty: z.ZodOptional<z.ZodObject<{
|
|
162
|
+
partyId: z.ZodOptional<z.ZodString>;
|
|
163
|
+
name: z.ZodOptional<z.ZodString>;
|
|
164
|
+
taxId: z.ZodOptional<z.ZodString>;
|
|
165
|
+
registrationReasonCode: z.ZodOptional<z.ZodString>;
|
|
166
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
167
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
168
|
+
}, z.core.$strip>>;
|
|
169
|
+
attachments: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
170
|
+
attachmentId: z.ZodOptional<z.ZodString>;
|
|
171
|
+
name: z.ZodString;
|
|
172
|
+
documentType: z.ZodOptional<z.ZodString>;
|
|
173
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
174
|
+
incoming: "incoming";
|
|
175
|
+
internal: "internal";
|
|
176
|
+
outgoing: "outgoing";
|
|
177
|
+
unknown: "unknown";
|
|
178
|
+
}>>;
|
|
179
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
180
|
+
sizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
181
|
+
downloadUrl: z.ZodOptional<z.ZodURL>;
|
|
182
|
+
downloadUrlExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
183
|
+
isService: z.ZodDefault<z.ZodBoolean>;
|
|
184
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
185
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
186
|
+
}, z.core.$strip>>>;
|
|
187
|
+
events: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
188
|
+
eventId: z.ZodString;
|
|
189
|
+
eventType: z.ZodString;
|
|
190
|
+
title: z.ZodOptional<z.ZodString>;
|
|
191
|
+
description: z.ZodOptional<z.ZodString>;
|
|
192
|
+
occurredAt: z.ZodOptional<z.ZodISODateTime>;
|
|
193
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
194
|
+
accepted: "accepted";
|
|
195
|
+
cancelled: "cancelled";
|
|
196
|
+
deleted: "deleted";
|
|
197
|
+
delivered: "delivered";
|
|
198
|
+
draft: "draft";
|
|
199
|
+
failed: "failed";
|
|
200
|
+
pendingSignature: "pendingSignature";
|
|
201
|
+
readyToSend: "readyToSend";
|
|
202
|
+
received: "received";
|
|
203
|
+
rejected: "rejected";
|
|
204
|
+
sent: "sent";
|
|
205
|
+
unknown: "unknown";
|
|
206
|
+
}>>;
|
|
207
|
+
statusCode: z.ZodOptional<z.ZodString>;
|
|
208
|
+
statusText: z.ZodOptional<z.ZodString>;
|
|
209
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
210
|
+
raw: z.ZodOptional<z.ZodUnknown>;
|
|
211
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
212
|
+
}, z.core.$strip>>>;
|
|
213
|
+
deleted: z.ZodDefault<z.ZodBoolean>;
|
|
214
|
+
partialData: z.ZodDefault<z.ZodBoolean>;
|
|
215
|
+
webUrl: z.ZodOptional<z.ZodURL>;
|
|
216
|
+
archiveUrl: z.ZodOptional<z.ZodURL>;
|
|
217
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
218
|
+
raw: z.ZodOptional<z.ZodUnknown>;
|
|
219
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
220
|
+
}, z.core.$strip>;
|
|
221
|
+
export type DocumentAccessMode = z.infer<typeof documentAccessModeSchema>;
|
|
222
|
+
export type ExchangeDocumentDirection = z.infer<typeof exchangeDocumentDirectionSchema>;
|
|
223
|
+
export type ExchangeDocumentStatus = z.infer<typeof exchangeDocumentStatusSchema>;
|
|
224
|
+
export type DocumentPartyRef = z.infer<typeof documentPartyRefSchema>;
|
|
225
|
+
export type DocumentMoney = z.infer<typeof documentMoneySchema>;
|
|
226
|
+
export type DocumentAttachment = z.infer<typeof documentAttachmentSchema>;
|
|
227
|
+
export type DocumentAttachmentContent = z.infer<typeof documentAttachmentContentSchema>;
|
|
228
|
+
export type DocumentAttachmentDraft = z.infer<typeof documentAttachmentDraftSchema>;
|
|
229
|
+
export type ExchangeDocumentWorkflowRef = z.infer<typeof exchangeDocumentWorkflowRefSchema>;
|
|
230
|
+
export type ExchangeDocumentIdentifier = z.infer<typeof exchangeDocumentIdentifierSchema>;
|
|
231
|
+
export type ExchangeDocumentEvent = z.infer<typeof exchangeDocumentEventSchema>;
|
|
232
|
+
export type ExchangeDocument = z.infer<typeof exchangeDocumentSchema>;
|
|
233
|
+
//# sourceMappingURL=exchange-document-common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-document-common.d.ts","sourceRoot":"","sources":["../../src/documents/exchange-document-common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,wBAAwB,4BAA0B,CAAC;AAChE,eAAO,MAAM,sBAAsB,sDAEtB,CAAC;AACd,eAAO,MAAM,yBAAyB,qDAEzB,CAAC;AAEd,eAAO,MAAM,+BAA+B;;;;;EAK1C,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;EAavC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;iBAOjC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;iBAYnC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;2BAS1C,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;iBAWxC,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;iBAY5C,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;iBAc3C,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;iBAYtC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2BjC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,+BAA+B,CACtC,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,4BAA4B,CACnC,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,+BAA+B,CACtC,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,6BAA6B,CACpC,CAAC;AACF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,iCAAiC,CACxC,CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,gCAAgC,CACvC,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const documentAccessModeSchema = z.literal('authorized');
|
|
3
|
+
export const documentMetadataSchema = z
|
|
4
|
+
.record(z.string(), z.unknown())
|
|
5
|
+
.default({});
|
|
6
|
+
export const documentExternalIdsSchema = z
|
|
7
|
+
.record(z.string(), z.string().min(1))
|
|
8
|
+
.default({});
|
|
9
|
+
export const exchangeDocumentDirectionSchema = z.enum([
|
|
10
|
+
'incoming',
|
|
11
|
+
'outgoing',
|
|
12
|
+
'internal',
|
|
13
|
+
'unknown'
|
|
14
|
+
]);
|
|
15
|
+
export const exchangeDocumentStatusSchema = z.enum([
|
|
16
|
+
'draft',
|
|
17
|
+
'pendingSignature',
|
|
18
|
+
'readyToSend',
|
|
19
|
+
'sent',
|
|
20
|
+
'delivered',
|
|
21
|
+
'received',
|
|
22
|
+
'accepted',
|
|
23
|
+
'rejected',
|
|
24
|
+
'cancelled',
|
|
25
|
+
'deleted',
|
|
26
|
+
'failed',
|
|
27
|
+
'unknown'
|
|
28
|
+
]);
|
|
29
|
+
export const documentPartyRefSchema = z.object({
|
|
30
|
+
partyId: z.string().min(1).optional(),
|
|
31
|
+
name: z.string().min(1).optional(),
|
|
32
|
+
taxId: z.string().min(1).optional(),
|
|
33
|
+
registrationReasonCode: z.string().min(1).optional(),
|
|
34
|
+
countryCode: z.string().length(2).optional(),
|
|
35
|
+
externalIds: documentExternalIdsSchema
|
|
36
|
+
});
|
|
37
|
+
export const documentMoneySchema = z.object({
|
|
38
|
+
amountMinor: z.number().int(),
|
|
39
|
+
currency: z.string().length(3)
|
|
40
|
+
});
|
|
41
|
+
export const documentAttachmentSchema = z.object({
|
|
42
|
+
attachmentId: z.string().min(1).optional(),
|
|
43
|
+
name: z.string().min(1),
|
|
44
|
+
documentType: z.string().min(1).optional(),
|
|
45
|
+
direction: exchangeDocumentDirectionSchema.optional(),
|
|
46
|
+
mimeType: z.string().min(1).optional(),
|
|
47
|
+
sizeBytes: z.number().int().nonnegative().optional(),
|
|
48
|
+
downloadUrl: z.url().optional(),
|
|
49
|
+
downloadUrlExpiresAt: z.iso.datetime({ offset: true }).optional(),
|
|
50
|
+
isService: z.boolean().default(false),
|
|
51
|
+
externalIds: documentExternalIdsSchema,
|
|
52
|
+
metadata: documentMetadataSchema
|
|
53
|
+
});
|
|
54
|
+
export const documentAttachmentContentSchema = z.discriminatedUnion('kind', [
|
|
55
|
+
z.object({
|
|
56
|
+
kind: z.literal('base64'),
|
|
57
|
+
data: z.string().min(1)
|
|
58
|
+
}),
|
|
59
|
+
z.object({
|
|
60
|
+
kind: z.literal('url'),
|
|
61
|
+
url: z.url()
|
|
62
|
+
})
|
|
63
|
+
]);
|
|
64
|
+
export const documentAttachmentDraftSchema = z.object({
|
|
65
|
+
name: z.string().min(1),
|
|
66
|
+
documentType: z.string().min(1).optional(),
|
|
67
|
+
documentSubtype: z.string().min(1).optional(),
|
|
68
|
+
formatVersion: z.string().min(1).optional(),
|
|
69
|
+
formatSubversion: z.string().min(1).optional(),
|
|
70
|
+
mimeType: z.string().min(1).optional(),
|
|
71
|
+
isService: z.boolean().default(false),
|
|
72
|
+
content: documentAttachmentContentSchema,
|
|
73
|
+
externalIds: documentExternalIdsSchema,
|
|
74
|
+
metadata: documentMetadataSchema
|
|
75
|
+
});
|
|
76
|
+
export const exchangeDocumentWorkflowRefSchema = z
|
|
77
|
+
.object({
|
|
78
|
+
workflowId: z.string().min(1).optional(),
|
|
79
|
+
name: z.string().min(1).optional(),
|
|
80
|
+
externalIds: documentExternalIdsSchema
|
|
81
|
+
})
|
|
82
|
+
.refine((value) => Boolean(value.workflowId || value.name || Object.keys(value.externalIds).length), { message: 'At least one workflow identifier is required' });
|
|
83
|
+
export const exchangeDocumentIdentifierSchema = z
|
|
84
|
+
.object({
|
|
85
|
+
documentId: z.string().min(1).optional(),
|
|
86
|
+
revisionId: z.string().min(1).optional(),
|
|
87
|
+
externalIds: documentExternalIdsSchema
|
|
88
|
+
})
|
|
89
|
+
.refine((value) => Boolean(value.documentId ||
|
|
90
|
+
value.revisionId ||
|
|
91
|
+
Object.keys(value.externalIds).length), { message: 'At least one document identifier is required' });
|
|
92
|
+
export const exchangeDocumentEventSchema = z.object({
|
|
93
|
+
eventId: z.string().min(1),
|
|
94
|
+
eventType: z.string().min(1),
|
|
95
|
+
title: z.string().min(1).optional(),
|
|
96
|
+
description: z.string().min(1).optional(),
|
|
97
|
+
occurredAt: z.iso.datetime({ offset: true }).optional(),
|
|
98
|
+
status: exchangeDocumentStatusSchema.optional(),
|
|
99
|
+
statusCode: z.string().min(1).optional(),
|
|
100
|
+
statusText: z.string().min(1).optional(),
|
|
101
|
+
externalIds: documentExternalIdsSchema,
|
|
102
|
+
raw: z.unknown().optional(),
|
|
103
|
+
metadata: documentMetadataSchema
|
|
104
|
+
});
|
|
105
|
+
export const exchangeDocumentSchema = z.object({
|
|
106
|
+
documentId: z.string().min(1),
|
|
107
|
+
revisionId: z.string().min(1).optional(),
|
|
108
|
+
number: z.string().min(1).optional(),
|
|
109
|
+
issuedAt: z.iso.date().optional(),
|
|
110
|
+
createdAt: z.iso.datetime({ offset: true }).optional(),
|
|
111
|
+
updatedAt: z.iso.datetime({ offset: true }).optional(),
|
|
112
|
+
documentType: z.string().min(1),
|
|
113
|
+
documentSubtype: z.string().min(1).optional(),
|
|
114
|
+
title: z.string().min(1).optional(),
|
|
115
|
+
note: z.string().min(1).optional(),
|
|
116
|
+
direction: exchangeDocumentDirectionSchema.default('unknown'),
|
|
117
|
+
status: exchangeDocumentStatusSchema.default('unknown'),
|
|
118
|
+
statusCode: z.string().min(1).optional(),
|
|
119
|
+
statusText: z.string().min(1).optional(),
|
|
120
|
+
amount: documentMoneySchema.optional(),
|
|
121
|
+
ourOrganization: documentPartyRefSchema.optional(),
|
|
122
|
+
counterparty: documentPartyRefSchema.optional(),
|
|
123
|
+
attachments: z.array(documentAttachmentSchema).default([]),
|
|
124
|
+
events: z.array(exchangeDocumentEventSchema).default([]),
|
|
125
|
+
deleted: z.boolean().default(false),
|
|
126
|
+
partialData: z.boolean().default(false),
|
|
127
|
+
webUrl: z.url().optional(),
|
|
128
|
+
archiveUrl: z.url().optional(),
|
|
129
|
+
externalIds: documentExternalIdsSchema,
|
|
130
|
+
raw: z.unknown().optional(),
|
|
131
|
+
metadata: documentMetadataSchema
|
|
132
|
+
});
|
|
133
|
+
//# sourceMappingURL=exchange-document-common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-document-common.js","sourceRoot":"","sources":["../../src/documents/exchange-document-common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACrC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;KAC/B,OAAO,CAAC,EAAE,CAAC,CAAC;AACd,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC;KACxC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACrC,OAAO,CAAC,EAAE,CAAC,CAAC;AAEd,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,IAAI,CAAC;IACrD,UAAU;IACV,UAAU;IACV,UAAU;IACV,SAAS;CACT,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,IAAI,CAAC;IAClD,OAAO;IACP,kBAAkB;IAClB,aAAa;IACb,MAAM;IACN,WAAW;IACX,UAAU;IACV,UAAU;IACV,UAAU;IACV,WAAW;IACX,SAAS;IACT,QAAQ;IACR,SAAS;CACT,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACrC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC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AQ,EAAE;IAC1B,UAAU,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC9B,WAAW,EAAE,yBAAyB;IACtC,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC3B,QAAQ,EAAE,sBAAsB;CAChC,CAAC,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const operationCode: 'documents.exchangeDocument.create';
|
|
3
|
+
export declare const exchangeDocumentCreateInputSchema: z.ZodObject<{
|
|
4
|
+
clientReference: z.ZodString;
|
|
5
|
+
documentType: z.ZodString;
|
|
6
|
+
documentSubtype: z.ZodOptional<z.ZodString>;
|
|
7
|
+
number: z.ZodOptional<z.ZodString>;
|
|
8
|
+
issuedAt: z.ZodOptional<z.ZodISODate>;
|
|
9
|
+
dueAt: z.ZodOptional<z.ZodISODate>;
|
|
10
|
+
title: z.ZodOptional<z.ZodString>;
|
|
11
|
+
note: z.ZodOptional<z.ZodString>;
|
|
12
|
+
amount: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
amountMinor: z.ZodNumber;
|
|
14
|
+
currency: z.ZodString;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
ourOrganization: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
partyId: z.ZodOptional<z.ZodString>;
|
|
18
|
+
name: z.ZodOptional<z.ZodString>;
|
|
19
|
+
taxId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
registrationReasonCode: z.ZodOptional<z.ZodString>;
|
|
21
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
22
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
counterparty: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
partyId: z.ZodOptional<z.ZodString>;
|
|
26
|
+
name: z.ZodOptional<z.ZodString>;
|
|
27
|
+
taxId: z.ZodOptional<z.ZodString>;
|
|
28
|
+
registrationReasonCode: z.ZodOptional<z.ZodString>;
|
|
29
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
30
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
workflow: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
workflowId: z.ZodOptional<z.ZodString>;
|
|
34
|
+
name: z.ZodOptional<z.ZodString>;
|
|
35
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
attachments: z.ZodArray<z.ZodObject<{
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
documentType: z.ZodOptional<z.ZodString>;
|
|
40
|
+
documentSubtype: z.ZodOptional<z.ZodString>;
|
|
41
|
+
formatVersion: z.ZodOptional<z.ZodString>;
|
|
42
|
+
formatSubversion: z.ZodOptional<z.ZodString>;
|
|
43
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
44
|
+
isService: z.ZodDefault<z.ZodBoolean>;
|
|
45
|
+
content: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
46
|
+
kind: z.ZodLiteral<"base64">;
|
|
47
|
+
data: z.ZodString;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
kind: z.ZodLiteral<"url">;
|
|
50
|
+
url: z.ZodURL;
|
|
51
|
+
}, z.core.$strip>], "kind">;
|
|
52
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
53
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
56
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
57
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export declare const exchangeDocumentCreateResultSchema: z.ZodObject<{
|
|
60
|
+
operationCode: z.ZodLiteral<"documents.exchangeDocument.create">;
|
|
61
|
+
accessModeUsed: z.ZodLiteral<"authorized">;
|
|
62
|
+
providerCode: z.ZodString;
|
|
63
|
+
document: z.ZodObject<{
|
|
64
|
+
documentId: z.ZodString;
|
|
65
|
+
revisionId: z.ZodOptional<z.ZodString>;
|
|
66
|
+
number: z.ZodOptional<z.ZodString>;
|
|
67
|
+
issuedAt: z.ZodOptional<z.ZodISODate>;
|
|
68
|
+
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
69
|
+
updatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
70
|
+
documentType: z.ZodString;
|
|
71
|
+
documentSubtype: z.ZodOptional<z.ZodString>;
|
|
72
|
+
title: z.ZodOptional<z.ZodString>;
|
|
73
|
+
note: z.ZodOptional<z.ZodString>;
|
|
74
|
+
direction: z.ZodDefault<z.ZodEnum<{
|
|
75
|
+
incoming: "incoming";
|
|
76
|
+
internal: "internal";
|
|
77
|
+
outgoing: "outgoing";
|
|
78
|
+
unknown: "unknown";
|
|
79
|
+
}>>;
|
|
80
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
81
|
+
accepted: "accepted";
|
|
82
|
+
cancelled: "cancelled";
|
|
83
|
+
deleted: "deleted";
|
|
84
|
+
delivered: "delivered";
|
|
85
|
+
draft: "draft";
|
|
86
|
+
failed: "failed";
|
|
87
|
+
pendingSignature: "pendingSignature";
|
|
88
|
+
readyToSend: "readyToSend";
|
|
89
|
+
received: "received";
|
|
90
|
+
rejected: "rejected";
|
|
91
|
+
sent: "sent";
|
|
92
|
+
unknown: "unknown";
|
|
93
|
+
}>>;
|
|
94
|
+
statusCode: z.ZodOptional<z.ZodString>;
|
|
95
|
+
statusText: z.ZodOptional<z.ZodString>;
|
|
96
|
+
amount: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
amountMinor: z.ZodNumber;
|
|
98
|
+
currency: z.ZodString;
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
|
+
ourOrganization: z.ZodOptional<z.ZodObject<{
|
|
101
|
+
partyId: z.ZodOptional<z.ZodString>;
|
|
102
|
+
name: z.ZodOptional<z.ZodString>;
|
|
103
|
+
taxId: z.ZodOptional<z.ZodString>;
|
|
104
|
+
registrationReasonCode: z.ZodOptional<z.ZodString>;
|
|
105
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
106
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
107
|
+
}, z.core.$strip>>;
|
|
108
|
+
counterparty: z.ZodOptional<z.ZodObject<{
|
|
109
|
+
partyId: z.ZodOptional<z.ZodString>;
|
|
110
|
+
name: z.ZodOptional<z.ZodString>;
|
|
111
|
+
taxId: z.ZodOptional<z.ZodString>;
|
|
112
|
+
registrationReasonCode: z.ZodOptional<z.ZodString>;
|
|
113
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
114
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
115
|
+
}, z.core.$strip>>;
|
|
116
|
+
attachments: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
117
|
+
attachmentId: z.ZodOptional<z.ZodString>;
|
|
118
|
+
name: z.ZodString;
|
|
119
|
+
documentType: z.ZodOptional<z.ZodString>;
|
|
120
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
121
|
+
incoming: "incoming";
|
|
122
|
+
internal: "internal";
|
|
123
|
+
outgoing: "outgoing";
|
|
124
|
+
unknown: "unknown";
|
|
125
|
+
}>>;
|
|
126
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
127
|
+
sizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
downloadUrl: z.ZodOptional<z.ZodURL>;
|
|
129
|
+
downloadUrlExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
130
|
+
isService: z.ZodDefault<z.ZodBoolean>;
|
|
131
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
132
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
133
|
+
}, z.core.$strip>>>;
|
|
134
|
+
events: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
135
|
+
eventId: z.ZodString;
|
|
136
|
+
eventType: z.ZodString;
|
|
137
|
+
title: z.ZodOptional<z.ZodString>;
|
|
138
|
+
description: z.ZodOptional<z.ZodString>;
|
|
139
|
+
occurredAt: z.ZodOptional<z.ZodISODateTime>;
|
|
140
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
141
|
+
accepted: "accepted";
|
|
142
|
+
cancelled: "cancelled";
|
|
143
|
+
deleted: "deleted";
|
|
144
|
+
delivered: "delivered";
|
|
145
|
+
draft: "draft";
|
|
146
|
+
failed: "failed";
|
|
147
|
+
pendingSignature: "pendingSignature";
|
|
148
|
+
readyToSend: "readyToSend";
|
|
149
|
+
received: "received";
|
|
150
|
+
rejected: "rejected";
|
|
151
|
+
sent: "sent";
|
|
152
|
+
unknown: "unknown";
|
|
153
|
+
}>>;
|
|
154
|
+
statusCode: z.ZodOptional<z.ZodString>;
|
|
155
|
+
statusText: z.ZodOptional<z.ZodString>;
|
|
156
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
157
|
+
raw: z.ZodOptional<z.ZodUnknown>;
|
|
158
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
159
|
+
}, z.core.$strip>>>;
|
|
160
|
+
deleted: z.ZodDefault<z.ZodBoolean>;
|
|
161
|
+
partialData: z.ZodDefault<z.ZodBoolean>;
|
|
162
|
+
webUrl: z.ZodOptional<z.ZodURL>;
|
|
163
|
+
archiveUrl: z.ZodOptional<z.ZodURL>;
|
|
164
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
165
|
+
raw: z.ZodOptional<z.ZodUnknown>;
|
|
166
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
created: z.ZodBoolean;
|
|
169
|
+
messages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
170
|
+
raw: z.ZodOptional<z.ZodUnknown>;
|
|
171
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
172
|
+
}, z.core.$strip>;
|
|
173
|
+
export type ExchangeDocumentCreateInput = z.input<typeof exchangeDocumentCreateInputSchema>;
|
|
174
|
+
export type NormalizedExchangeDocumentCreateInput = z.output<typeof exchangeDocumentCreateInputSchema>;
|
|
175
|
+
export type ExchangeDocumentCreateResult = z.infer<typeof exchangeDocumentCreateResultSchema>;
|
|
176
|
+
//# sourceMappingURL=exchange-document-create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-document-create.d.ts","sourceRoot":"","sources":["../../src/documents/exchange-document-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,aAAa,EAAG,mCAA4C,CAAC;AAE1E,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiB5C,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAS7C,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,iCAAiC,CACxC,CAAC;AACF,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAC3D,OAAO,iCAAiC,CACxC,CAAC;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,kCAAkC,CACzC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { documentAccessModeSchema, documentAttachmentDraftSchema, documentExternalIdsSchema, documentMetadataSchema, documentMoneySchema, documentPartyRefSchema, exchangeDocumentSchema, exchangeDocumentWorkflowRefSchema } from './exchange-document-common.js';
|
|
3
|
+
export const operationCode = 'documents.exchangeDocument.create';
|
|
4
|
+
export const exchangeDocumentCreateInputSchema = z.object({
|
|
5
|
+
clientReference: z.string().min(1),
|
|
6
|
+
documentType: z.string().min(1),
|
|
7
|
+
documentSubtype: z.string().min(1).optional(),
|
|
8
|
+
number: z.string().min(1).optional(),
|
|
9
|
+
issuedAt: z.iso.date().optional(),
|
|
10
|
+
dueAt: z.iso.date().optional(),
|
|
11
|
+
title: z.string().min(1).optional(),
|
|
12
|
+
note: z.string().min(1).optional(),
|
|
13
|
+
amount: documentMoneySchema.optional(),
|
|
14
|
+
ourOrganization: documentPartyRefSchema.optional(),
|
|
15
|
+
counterparty: documentPartyRefSchema.optional(),
|
|
16
|
+
workflow: exchangeDocumentWorkflowRefSchema.optional(),
|
|
17
|
+
attachments: z.array(documentAttachmentDraftSchema).min(1),
|
|
18
|
+
idempotencyKey: z.string().min(1).optional(),
|
|
19
|
+
externalIds: documentExternalIdsSchema,
|
|
20
|
+
metadata: documentMetadataSchema
|
|
21
|
+
});
|
|
22
|
+
export const exchangeDocumentCreateResultSchema = z.object({
|
|
23
|
+
operationCode: z.literal(operationCode),
|
|
24
|
+
accessModeUsed: documentAccessModeSchema,
|
|
25
|
+
providerCode: z.string().min(1),
|
|
26
|
+
document: exchangeDocumentSchema,
|
|
27
|
+
created: z.boolean(),
|
|
28
|
+
messages: z.array(z.string().min(1)).default([]),
|
|
29
|
+
raw: z.unknown().optional(),
|
|
30
|
+
metadata: documentMetadataSchema
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=exchange-document-create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-document-create.js","sourceRoot":"","sources":["../../src/documents/exchange-document-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACN,wBAAwB,EACxB,6BAA6B,EAC7B,yBAAyB,EACzB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,iCAAiC,EACjC,MAAM,+BAA+B,CAAC;AAEvC,MAAM,CAAC,MAAM,aAAa,GAAG,mCAA4C,CAAC;AAE1E,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAClC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC7C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACpC,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,mBAAmB,CAAC,QAAQ,EAAE;IACtC,eAAe,EAAE,sBAAsB,CAAC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