@nuanu-ai/agentify-contracts 0.6.0 → 0.8.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/dist/index.js CHANGED
@@ -22,37 +22,43 @@
22
22
  */
23
23
  import { z } from "zod";
24
24
  import { AgentOrderStatusSchema, CatalogPageSchema, ErrorEnvelopeSchema, MerchantCardListSchema, OrderAcceptResponseSchema, OrderCallResponseSchema, OrderListQuerySchema, OrderListSchema, OrderWithStatusSchema, PurchaseRequestSchema, QuoteAnswerAckSchema, ReceiptListSchema, WorkerPollRequestSchema, WorkerPollResponseSchema, } from "./api.js";
25
- import { CardSchema, FulfillmentSchema, MerchantCardSchema, PriceCheckSchema, PublicCardSchema, ServiceNameSchema, TagsSchema, } from "./card.js";
25
+ import { CardSchema, FulfillmentSchema, MerchantCardSchema, PriceCheckSchema, PublicCardSchema, SellerSchema, ServiceNameSchema, TagsSchema, } from "./card.js";
26
26
  import { WorkerEnvelopeSchema } from "./envelope.js";
27
27
  import { OrderEventSchema, RefundDueReasonSchema } from "./events.js";
28
28
  import { EvmAddressSchema } from "./evm-address.js";
29
29
  import { AcceptanceSchema, DeliverySchema, HandlerAnswerSchema, RefusalCodeSchema, RefusalSchema, } from "./handler.js";
30
- import { CabinetKeySchema, DisabledKeySchema, ForgottenCabinetKeySchema, IssuedKeySchema, IssueKeyRequestSchema, MerchantKeyListSchema, MerchantKeySchema, PayoutWalletRequestSchema, PayoutWalletSchema, PendingPayoutWalletSchema, RegisteredMerchantSchema, RegistrationRequestSchema, SellerNameRequestSchema, SellerNameSchema, } from "./merchant.js";
30
+ import { DisabledKeySchema, IssuedKeySchema, IssueKeyRequestSchema, MerchantKeyListSchema, MerchantKeySchema, PayoutWalletSchema, PendingPayoutWalletSchema, SellerNameRequestSchema, SellerNameSchema, } from "./merchant.js";
31
31
  import { OrderSchema } from "./order.js";
32
32
  import { OrderStatusSchema } from "./order-status.js";
33
33
  import { FieldSpecSchema, ParamNameSchema, ParamSpecSchema, ParamTypeSchema, } from "./param-spec.js";
34
- import { AmountSchema, CurrencyCodeSchema, IdentifierSchema, MoneySchema, SalePriceSchema, TimestampSchema, } from "./primitives.js";
34
+ import { AmountSchema, CurrencyCodeSchema, IdentifierSchema, MoneySchema, OpenWordSchema, SalePriceSchema, TimestampSchema, } from "./primitives.js";
35
35
  import { QuotePurposeSchema, QuoteRequestSchema, QuoteResponseSchema } from "./quote.js";
36
36
  import { ReceiptOutcomeSchema, ReceiptSchema } from "./receipt.js";
37
37
  import { CallErrorSchema, OrderCallResultSchema, ProblemSchema, PublishResultSchema, } from "./results.js";
38
+ import { SellerSiteSchema } from "./seller-site.js";
38
39
  import { SellingStateSchema } from "./selling.js";
39
- export { AgentOrderStatusSchema, API_ROUTES, AUTH_MODES, CatalogPageSchema, ERROR_CODES, ErrorEnvelopeSchema, expandPath, HTTP_METHODS, MERCHANT_KEY_HEADER, MerchantCardListSchema, merchantKeyFrom, merchantKeyHeaderValue, mountableRoutes, OrderAcceptResponseSchema, OrderCallResponseSchema, OrderListQuerySchema, OrderListSchema, OrderWithStatusSchema, PurchaseRequestSchema, pathParamsOf, QuoteAnswerAckSchema, ReceiptListSchema, WorkerPollRequestSchema, WorkerPollResponseSchema, } from "./api.js";
40
- export { bazaarDeclarationOf, CardSchema, deliveryCheckFor, FulfillmentSchema, MerchantCardSchema, PriceCheckSchema, PublicCardSchema, publicCardOf, purchaseCheckFor, ServiceNameSchema, TagsSchema, } from "./card.js";
40
+ import { ErasedShipToSchema, ShipToLocalitySchema, ShipToSchema } from "./ship-to.js";
41
+ import { RecordedShipmentSchema, ShipmentSchema } from "./shipment.js";
42
+ export { AgentOrderStatusSchema, API_ROUTES, AUTH_MODES, CatalogPageSchema, cardsOf, ERROR_CODES, ErrorEnvelopeSchema, expandPath, HTTP_METHODS, MERCHANT_KEY_HEADER, MerchantCardListSchema, merchantKeyFrom, merchantKeyHeaderValue, mountableRoutes, OrderAcceptResponseSchema, OrderCallResponseSchema, OrderListQuerySchema, OrderListSchema, OrderWithStatusSchema, PurchaseRequestSchema, pathParamsOf, QuoteAnswerAckSchema, ReceiptListSchema, WorkerPollRequestSchema, WorkerPollResponseSchema, } from "./api.js";
43
+ export { bazaarDeclarationOf, CardSchema, deliveryCheckFor, FulfillmentSchema, MerchantCardSchema, PriceCheckSchema, PublicCardSchema, publicCardOf, purchaseCheckFor, SellerSchema, ServiceNameSchema, TagsSchema, } from "./card.js";
41
44
  export { WORKER_ENVELOPE_KINDS, WORKER_ENVELOPE_PAYLOADS, WorkerEnvelopeSchema, } from "./envelope.js";
42
45
  export { ORDER_EVENT_TYPES, OrderEventSchema, RefundDueReasonSchema } from "./events.js";
43
46
  export { checksummedAddressOf, EvmAddressSchema } from "./evm-address.js";
44
47
  export { AcceptanceSchema, DeliverySchema, HandlerAnswerSchema, RECOMMENDED_REFUSAL_CODES, RefusalCodeSchema, RefusalSchema, } from "./handler.js";
45
- export { CabinetKeySchema, DisabledKeySchema, ForgottenCabinetKeySchema, IssuedKeySchema, IssueKeyRequestSchema, MerchantKeyListSchema, MerchantKeySchema, PayoutWalletRequestSchema, PayoutWalletSchema, PendingPayoutWalletSchema, RegisteredMerchantSchema, RegistrationRequestSchema, SellerNameRequestSchema, SellerNameSchema, } from "./merchant.js";
48
+ export { DisabledKeySchema, IssuedKeySchema, IssueKeyRequestSchema, MerchantKeyListSchema, MerchantKeySchema, PayoutWalletSchema, PendingPayoutWalletSchema, SellerNameRequestSchema, SellerNameSchema, } from "./merchant.js";
46
49
  export { OrderSchema } from "./order.js";
47
50
  export { ORDER_STATUSES, OrderStatusSchema } from "./order-status.js";
48
51
  export { FieldSpecSchema, ParamNameSchema, ParamSpecSchema, ParamTypeSchema, PROTOTYPE_KEY_IS_DROPPED, paramSpecToValidator, } from "./param-spec.js";
49
52
  export { notPlainTextIn } from "./plain-text.js";
50
53
  export { PAYABLE_CURRENCIES, PAYABLE_DECIMALS, priceProblemsOf } from "./price-rule.js";
51
- export { AmountSchema, CurrencyCodeSchema, IdentifierSchema, MoneySchema, SalePriceSchema, TimestampSchema, } from "./primitives.js";
54
+ export { AmountSchema, CurrencyCodeSchema, IdentifierSchema, MoneySchema, OpenWordSchema, SalePriceSchema, TimestampSchema, } from "./primitives.js";
52
55
  export { QuotePurposeSchema, QuoteRequestSchema, QuoteResponseSchema } from "./quote.js";
53
56
  export { ReceiptOutcomeSchema, ReceiptSchema } from "./receipt.js";
54
57
  export { CARD_REJECTED, CallErrorSchema, MERCHANT_FINDINGS, ORDER_CALL_ERROR_CODES, ORDER_CALL_RESULTS, OrderCallResultSchema, ProblemSchema, PublishResultSchema, } from "./results.js";
58
+ export { SellerSiteSchema } from "./seller-site.js";
55
59
  export { SELLING_STATES, SellingStateSchema } from "./selling.js";
60
+ export { ErasedShipToSchema, localityOf, ShipToLocalitySchema, ShipToSchema, } from "./ship-to.js";
61
+ export { RecordedShipmentSchema, ShipmentSchema } from "./shipment.js";
56
62
  /**
57
63
  * The version of the public contract. It grows when the meaning of the fields
58
64
  * changes, not when a schema is added: a consumer uses it to decide whether it
@@ -76,17 +82,16 @@ export const schemas = Object.freeze({
76
82
  acceptance: AcceptanceSchema,
77
83
  agent_order_status: AgentOrderStatusSchema,
78
84
  amount: AmountSchema,
79
- cabinet_key: CabinetKeySchema,
80
85
  call_error: CallErrorSchema,
81
86
  card: CardSchema,
82
87
  catalog_page: CatalogPageSchema,
83
88
  currency_code: CurrencyCodeSchema,
84
89
  delivery: DeliverySchema,
85
90
  disabled_key: DisabledKeySchema,
91
+ erased_ship_to: ErasedShipToSchema,
86
92
  error_envelope: ErrorEnvelopeSchema,
87
93
  evm_address: EvmAddressSchema,
88
94
  field_spec: FieldSpecSchema,
89
- forgotten_cabinet_key: ForgottenCabinetKeySchema,
90
95
  fulfillment: FulfillmentSchema,
91
96
  handler_answer: HandlerAnswerSchema,
92
97
  identifier: IdentifierSchema,
@@ -97,6 +102,7 @@ export const schemas = Object.freeze({
97
102
  merchant_key: MerchantKeySchema,
98
103
  merchant_key_list: MerchantKeyListSchema,
99
104
  money: MoneySchema,
105
+ open_word: OpenWordSchema,
100
106
  order: OrderSchema,
101
107
  order_accept_response: OrderAcceptResponseSchema,
102
108
  order_call_response: OrderCallResponseSchema,
@@ -110,7 +116,6 @@ export const schemas = Object.freeze({
110
116
  param_spec: ParamSpecSchema,
111
117
  param_type: ParamTypeSchema,
112
118
  payout_wallet: PayoutWalletSchema,
113
- payout_wallet_request: PayoutWalletRequestSchema,
114
119
  pending_payout_wallet: PendingPayoutWalletSchema,
115
120
  price_check: PriceCheckSchema,
116
121
  problem: ProblemSchema,
@@ -124,16 +129,20 @@ export const schemas = Object.freeze({
124
129
  receipt: ReceiptSchema,
125
130
  receipt_list: ReceiptListSchema,
126
131
  receipt_outcome: ReceiptOutcomeSchema,
127
- registered_merchant: RegisteredMerchantSchema,
128
- registration_request: RegistrationRequestSchema,
129
132
  refund_due_reason: RefundDueReasonSchema,
130
133
  refusal: RefusalSchema,
131
134
  refusal_code: RefusalCodeSchema,
132
135
  sale_price: SalePriceSchema,
136
+ seller: SellerSchema,
133
137
  seller_name: SellerNameSchema,
134
138
  seller_name_request: SellerNameRequestSchema,
135
139
  selling_state: SellingStateSchema,
140
+ seller_site: SellerSiteSchema,
136
141
  service_name: ServiceNameSchema,
142
+ ship_to: ShipToSchema,
143
+ ship_to_locality: ShipToLocalitySchema,
144
+ shipment: ShipmentSchema,
145
+ recorded_shipment: RecordedShipmentSchema,
137
146
  tags: TagsSchema,
138
147
  timestamp: TimestampSchema,
139
148
  worker_envelope: WorkerEnvelopeSchema,
@@ -1,19 +1,16 @@
1
1
  /**
2
- * How a merchant comes to exist, the name their products are sold under, the
3
- * wallet their sales are paid into, and the keys they open the door with.
2
+ * What a merchant says about themselves: the name their products are sold
3
+ * under, the wallet their sales are paid into, and the keys they open the door
4
+ * with.
4
5
  *
5
- * The first two belong together because registering is the act that produces
6
- * both: one call makes the merchant and the key its cabinet will call as them
7
- * with, and what comes back carries that key once. Split across two files, a
8
- * reader working out what registering leaves a merchant holding would have to
9
- * read both to find that it is a key of a kind no list here carries. The name is here for the same reason read the other way round — it is a
10
- * fact about the merchant and about none of their cards, and the one question a
11
- * reader arrives with is which of the two names a merchant has is which.
6
+ * The name is here rather than beside the card because it is a fact about the
7
+ * merchant and about none of their cards, and the one question a reader
8
+ * arrives with is which of the two names a merchant has is which.
12
9
  *
13
10
  * Two rules run through the file and are worth saying once.
14
11
  *
15
- * The secret appears in exactly three documents, and every one of them is the
16
- * answer to a call that has just made a key. Nothing that is ever drawn again —
12
+ * The secret appears in one document, the answer to the call that has just
13
+ * made a key. Nothing that is ever drawn again —
17
14
  * the list a merchant reads, the row that comes back from disabling one — can
18
15
  * carry it, and the shapes below refuse it rather than merely omit it. What is
19
16
  * kept on our side is a digest, so there is nothing to put in those documents
@@ -51,11 +48,8 @@ export declare const MerchantKeySchema: z.ZodObject<{
51
48
  * refuses, on the one page where being refused looks like the product being
52
49
  * broken.
53
50
  *
54
- * It is not always one of the keys beside it, and that is the thing a reader is
55
- * likeliest to assume and be wrong about. A cabinet calls with a key made for a
56
- * cabinet, and those are in nobody's list, so a client that looked this
57
- * identifier up among the rows would find nothing — which is an answer rather
58
- * than an error, and a screen has to be built for it.
51
+ * It is always one of the keys beside it: every key is one a merchant issued
52
+ * for their own code, and the dashboard calls with none (ADR-0030).
59
53
  *
60
54
  * An object rather than a bare array, for that reason before any other — an
61
55
  * array has nowhere to put it.
@@ -108,34 +102,6 @@ export declare const DisabledKeySchema: z.ZodObject<{
108
102
  disabled_at: z.ZodNullable<z.ZodISODateTime>;
109
103
  }, z.core.$strict>;
110
104
  }, z.core.$strict>;
111
- /**
112
- * A key made for a cabinet, which is the secret and nothing else.
113
- *
114
- * Every other answer that makes a key carries the row beside it, and this one
115
- * cannot. A key made for a cabinet is in no merchant's list — they did not
116
- * issue it and have no reason to know it exists — so an identifier here would
117
- * name a row that no screen of theirs draws and no call of theirs reaches: not
118
- * the list it is absent from, and not the revoking, which takes the keys a
119
- * merchant issued and refuses this kind by name. What the caller does with this
120
- * is put it on the row of whoever just signed in, and that is the whole of what
121
- * it needs.
122
- */
123
- export declare const CabinetKeySchema: z.ZodObject<{
124
- secret: z.ZodString;
125
- }, z.core.$strict>;
126
- /**
127
- * That the key a call was made with is gone.
128
- *
129
- * A constant, and deliberately: the call has one outcome. It removes the key it
130
- * was made with and no other, so there is nothing to count — a number here
131
- * could only be about rows this call cannot reach — and nothing to name, since
132
- * the caller is holding the only key it names. What is left to say is that it
133
- * is done, and it is said in a field rather than left to a status code so that
134
- * a client reads one document and not two kinds of evidence.
135
- */
136
- export declare const ForgottenCabinetKeySchema: z.ZodObject<{
137
- forgotten: z.ZodLiteral<true>;
138
- }, z.core.$strict>;
139
105
  /**
140
106
  * What a merchant's products are sold under, as the merchant reads it back.
141
107
  *
@@ -155,6 +121,7 @@ export declare const ForgottenCabinetKeySchema: z.ZodObject<{
155
121
  */
156
122
  export declare const SellerNameSchema: z.ZodObject<{
157
123
  seller_name: z.ZodNullable<z.ZodString>;
124
+ seller_site: z.ZodNullable<z.ZodString>;
158
125
  }, z.core.$strict>;
159
126
  /**
160
127
  * What a merchant sends to change what their products are sold under.
@@ -169,13 +136,14 @@ export declare const SellerNameSchema: z.ZodObject<{
169
136
  * which is this same call, or an end to selling, which is the pause — and the
170
137
  * pause leaves their cards where they can find them again.
171
138
  *
172
- * So it is two documents rather than one, and a cabinet still reads back the
139
+ * So it is two documents rather than one, and a dashboard still reads back the
173
140
  * shape it sent. The message on a null is written here rather than left to a
174
141
  * type error, because "expected string, received null" describes the shape and
175
142
  * says nothing about which act the sender was reaching for.
176
143
  */
177
144
  export declare const SellerNameRequestSchema: z.ZodObject<{
178
- seller_name: z.ZodPipe<z.ZodString, z.ZodString>;
145
+ seller_name: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
146
+ seller_site: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
179
147
  }, z.core.$strict>;
180
148
  /**
181
149
  * A change of the wallet that has been asked for, announced, and has not taken
@@ -183,10 +151,9 @@ export declare const SellerNameRequestSchema: z.ZodObject<{
183
151
  *
184
152
  * It exists because a replacement does not apply at once where the money is
185
153
  * real (ADR-0019). The address a merchant is paid at is the one setting whose
186
- * change redirects money, and any key of theirs reaches it — the cabinet's, or
187
- * one sitting in their own server's environment — so on the live deployment a
188
- * replacement is told to every account of the merchant first and takes effect
189
- * forty-eight hours after that. What this document says is the two facts a
154
+ * change redirects money, and a dashboard session that is not the owner's could
155
+ * ask for one, so on the live deployment a replacement is told to every account
156
+ * of the merchant first and takes effect forty-eight hours after that. What this document says is the two facts a
190
157
  * merchant needs in that window: what replaces the address, and from when.
191
158
  *
192
159
  * Both are required. An address with no moment says nothing about when the
@@ -228,9 +195,10 @@ export declare const PendingPayoutWalletSchema: z.ZodObject<{
228
195
  * without this they would ask again, or conclude the change was lost.
229
196
  *
230
197
  * It is carried without moving `CONTRACT_VERSION`, which is the one known
231
- * exception to the rule that a new required field moves it (ADR-0006 §2): no
232
- * worker of the SDK reads this route, so the version would stop every
233
- * installed worker for a field none of them sees. What that costs is that a
198
+ * exception to the rule that a new required field moves it once a merchant we
199
+ * do not control runs the SDK (ADR-0006 §2): no worker of the SDK reads this
200
+ * route, so the version would stop every installed worker for a field none of
201
+ * them sees. What that costs is that a
234
202
  * merchant's own code holding this schema from an older release of this
235
203
  * package refuses the answer until the package is upgraded.
236
204
  */
@@ -241,79 +209,12 @@ export declare const PayoutWalletSchema: z.ZodObject<{
241
209
  takes_effect_at: z.ZodISODateTime;
242
210
  }, z.core.$strict>>;
243
211
  }, z.core.$strict>;
244
- /**
245
- * What a merchant sends to change where their sales are paid.
246
- *
247
- * The same field held to the same rule, and one difference, which is the same
248
- * difference the seller name has and rests on something harder. There is no
249
- * null. A merchant goes from having no wallet to having one and from one wallet
250
- * to another, and not back: a merchant who took their address away would keep
251
- * every card they had already published on sale, and the payment request an
252
- * agent is answered with cannot be built at all without an address — so the
253
- * products would stop being buyable and nothing anywhere would say why. What
254
- * somebody reaching for null actually wants is one of two other acts: a
255
- * different address, which is this same call, or an end to selling, which is
256
- * the pause, and the pause leaves their cards where they can put them back.
257
- *
258
- * There is nowhere here to put a key, and a document carrying one is refused
259
- * rather than trimmed. This contract knows where a merchant is paid and has no
260
- * business knowing anything that could spend it.
261
- */
262
- export declare const PayoutWalletRequestSchema: z.ZodObject<{
263
- payout_wallet: z.ZodPipe<z.ZodString, z.ZodString>;
264
- }, z.core.$strict>;
265
- /**
266
- * What somebody sends to become a merchant.
267
- *
268
- * One field, and what is not here is most of what is worth reading. The address
269
- * and the password belong to the account rather than to the merchant, and they
270
- * stay on the other side of the boundary (ADR-0014 §1) — a gateway that took
271
- * either would be holding a person's credentials on the money path, which is
272
- * what this route's whole shape is arranged to avoid.
273
- *
274
- * The name the seller's products are sold under is not here either, and that
275
- * omission is a decision rather than a simplification. It is a public answer,
276
- * and asking for it here asks for it at the one moment a merchant knows least:
277
- * no products, no catalogue seen, no idea what the name is for. It is asked for
278
- * on the screen after this one instead, where there is room to say why it
279
- * matters, and it can be changed afterwards from the merchant's own settings.
280
- *
281
- * The shape refuses a name rather than ignoring one, because a field quietly
282
- * dropped is a person believing they have chosen what buyers will read.
283
- */
284
- export declare const RegistrationRequestSchema: z.ZodObject<{
285
- invitation: z.ZodString;
286
- }, z.core.$strict>;
287
- /**
288
- * What registering answers with: a merchant and the key their cabinet will call
289
- * as them with.
290
- *
291
- * The key is made for a cabinet rather than for the merchant's own code, and
292
- * that is what the caller of this route is. So it is in no list: a merchant who
293
- * has just registered has no keys of their own at all, and the first one they
294
- * do have is one they ask for. No row travels beside the secret for the same
295
- * reason no row appears in the list — the merchant did not issue it and cannot
296
- * disable it, so an identifier for it would be a value with nothing to do.
297
- *
298
- * No name comes back either, because none was chosen. A merchant who has just
299
- * registered is listed under nothing at all, and a field here would either be a
300
- * name this call invented or a null that says the same thing at more length.
301
- */
302
- export declare const RegisteredMerchantSchema: z.ZodObject<{
303
- merchant_id: z.ZodString;
304
- secret: z.ZodString;
305
- }, z.core.$strict>;
306
212
  export type SellerName = z.infer<typeof SellerNameSchema>;
307
213
  export type SellerNameRequest = z.infer<typeof SellerNameRequestSchema>;
308
214
  export type PayoutWallet = z.infer<typeof PayoutWalletSchema>;
309
- export type PayoutWalletRequest = z.infer<typeof PayoutWalletRequestSchema>;
310
215
  export type PendingPayoutWallet = z.infer<typeof PendingPayoutWalletSchema>;
311
216
  export type MerchantKey = z.infer<typeof MerchantKeySchema>;
312
217
  export type MerchantKeyList = z.infer<typeof MerchantKeyListSchema>;
313
218
  export type IssueKeyRequest = z.infer<typeof IssueKeyRequestSchema>;
314
219
  export type IssuedKey = z.infer<typeof IssuedKeySchema>;
315
220
  export type DisabledKey = z.infer<typeof DisabledKeySchema>;
316
- export type CabinetKey = z.infer<typeof CabinetKeySchema>;
317
- export type ForgottenCabinetKey = z.infer<typeof ForgottenCabinetKeySchema>;
318
- export type RegistrationRequest = z.infer<typeof RegistrationRequestSchema>;
319
- export type RegisteredMerchant = z.infer<typeof RegisteredMerchantSchema>;