@nuanu-ai/agentify-contracts 0.3.2
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/LICENSE +201 -0
- package/NOTICE +2 -0
- package/README.md +32 -0
- package/dist/api.d.ts +1948 -0
- package/dist/api.js +956 -0
- package/dist/card.d.ts +423 -0
- package/dist/card.js +700 -0
- package/dist/envelope.d.ts +174 -0
- package/dist/envelope.js +101 -0
- package/dist/events.d.ts +56 -0
- package/dist/events.js +54 -0
- package/dist/evm-address.d.ts +77 -0
- package/dist/evm-address.js +265 -0
- package/dist/handler.d.ts +90 -0
- package/dist/handler.js +102 -0
- package/dist/index.d.ts +1008 -0
- package/dist/index.js +167 -0
- package/dist/merchant.d.ts +281 -0
- package/dist/merchant.js +433 -0
- package/dist/order-status.d.ts +47 -0
- package/dist/order-status.js +102 -0
- package/dist/order.d.ts +50 -0
- package/dist/order.js +78 -0
- package/dist/param-spec.d.ts +145 -0
- package/dist/param-spec.js +147 -0
- package/dist/primitives.d.ts +103 -0
- package/dist/primitives.js +130 -0
- package/dist/quote.d.ts +79 -0
- package/dist/quote.js +92 -0
- package/dist/receipt.d.ts +79 -0
- package/dist/receipt.js +83 -0
- package/dist/results.d.ts +230 -0
- package/dist/results.js +269 -0
- package/dist/selling.d.ts +24 -0
- package/dist/selling.js +35 -0
- package/package.json +46 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentify contracts — the single source of truth for the card, the order, the
|
|
3
|
+
* price check, the receipt and everything else that crosses the boundary
|
|
4
|
+
* between us, a merchant and an agent. Everything that goes outside or arrives
|
|
5
|
+
* from outside is described here by a zod schema; consumers get their types by
|
|
6
|
+
* inference from the schema instead of writing them by hand (ADR-0003 §5).
|
|
7
|
+
*
|
|
8
|
+
* This package owns the wire vocabulary: the field names, the values an agent
|
|
9
|
+
* or a merchant can see, the refusal codes, the event names. What the gateway
|
|
10
|
+
* calls things inside itself is its own business, and the two are tied
|
|
11
|
+
* together where they meet rather than by one importing the other.
|
|
12
|
+
*
|
|
13
|
+
* Two shapes here are read by nobody outside our own two parts, and they are
|
|
14
|
+
* described anyway. The worker envelope carries orders, price questions and
|
|
15
|
+
* events on one stream (ADR-0004 §2), and the merchant never sees it, because
|
|
16
|
+
* the SDK hands a handler an order rather than the wrapper it arrived in. The
|
|
17
|
+
* route table says which calls exist, at which addresses, with which document
|
|
18
|
+
* going each way. Both are formats between the gateway and the SDK, read by
|
|
19
|
+
* both and owned by neither — which is the same reason a card lives here, and
|
|
20
|
+
* the reason a shape agreed in two places is a shape that has already
|
|
21
|
+
* disagreed once.
|
|
22
|
+
*/
|
|
23
|
+
import { z } from "zod";
|
|
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";
|
|
26
|
+
import { WorkerEnvelopeSchema } from "./envelope.js";
|
|
27
|
+
import { OrderEventSchema, RefundDueReasonSchema } from "./events.js";
|
|
28
|
+
import { EvmAddressSchema } from "./evm-address.js";
|
|
29
|
+
import { AcceptanceSchema, DeliverySchema, HandlerAnswerSchema, RefusalCodeSchema, RefusalSchema, } from "./handler.js";
|
|
30
|
+
import { CabinetKeySchema, DisabledKeySchema, ForgottenCabinetKeySchema, IssuedKeySchema, IssueKeyRequestSchema, MerchantKeyListSchema, MerchantKeySchema, PayoutWalletRequestSchema, PayoutWalletSchema, RegisteredMerchantSchema, RegistrationRequestSchema, SellerNameRequestSchema, SellerNameSchema, } from "./merchant.js";
|
|
31
|
+
import { OrderSchema } from "./order.js";
|
|
32
|
+
import { OrderStatusSchema } from "./order-status.js";
|
|
33
|
+
import { FieldSpecSchema, ParamNameSchema, ParamSpecSchema, ParamTypeSchema, } from "./param-spec.js";
|
|
34
|
+
import { AmountSchema, CurrencyCodeSchema, IdentifierSchema, MoneySchema, SalePriceSchema, TimestampSchema, } from "./primitives.js";
|
|
35
|
+
import { QuotePurposeSchema, QuoteRequestSchema, QuoteResponseSchema } from "./quote.js";
|
|
36
|
+
import { ReceiptOutcomeSchema, ReceiptSchema } from "./receipt.js";
|
|
37
|
+
import { CallErrorSchema, OrderCallResultSchema, ProblemSchema, PublishResultSchema, } from "./results.js";
|
|
38
|
+
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";
|
|
41
|
+
export { WORKER_ENVELOPE_KINDS, WORKER_ENVELOPE_PAYLOADS, WorkerEnvelopeSchema, } from "./envelope.js";
|
|
42
|
+
export { ORDER_EVENT_TYPES, OrderEventSchema, RefundDueReasonSchema } from "./events.js";
|
|
43
|
+
export { checksummedAddressOf, EvmAddressSchema } from "./evm-address.js";
|
|
44
|
+
export { AcceptanceSchema, DeliverySchema, HandlerAnswerSchema, RECOMMENDED_REFUSAL_CODES, RefusalCodeSchema, RefusalSchema, } from "./handler.js";
|
|
45
|
+
export { CabinetKeySchema, DisabledKeySchema, ForgottenCabinetKeySchema, IssuedKeySchema, IssueKeyRequestSchema, MerchantKeyListSchema, MerchantKeySchema, PayoutWalletRequestSchema, PayoutWalletSchema, RegisteredMerchantSchema, RegistrationRequestSchema, SellerNameRequestSchema, SellerNameSchema, } from "./merchant.js";
|
|
46
|
+
export { OrderSchema } from "./order.js";
|
|
47
|
+
export { ORDER_STATUSES, OrderStatusSchema } from "./order-status.js";
|
|
48
|
+
export { FieldSpecSchema, ParamNameSchema, ParamSpecSchema, ParamTypeSchema, PROTOTYPE_KEY_IS_DROPPED, paramSpecToValidator, } from "./param-spec.js";
|
|
49
|
+
export { AmountSchema, CurrencyCodeSchema, IdentifierSchema, MoneySchema, SalePriceSchema, TimestampSchema, } from "./primitives.js";
|
|
50
|
+
export { QuotePurposeSchema, QuoteRequestSchema, QuoteResponseSchema } from "./quote.js";
|
|
51
|
+
export { ReceiptOutcomeSchema, ReceiptSchema } from "./receipt.js";
|
|
52
|
+
export { CARD_REJECTED, CallErrorSchema, ORDER_CALL_ERROR_CODES, ORDER_CALL_RESULTS, OrderCallResultSchema, ProblemSchema, PublishResultSchema, } from "./results.js";
|
|
53
|
+
export { SELLING_STATES, SellingStateSchema } from "./selling.js";
|
|
54
|
+
/**
|
|
55
|
+
* The version of the public contract. It grows when the meaning of the fields
|
|
56
|
+
* changes, not when a schema is added: a consumer uses it to decide whether it
|
|
57
|
+
* understands the other side.
|
|
58
|
+
*/
|
|
59
|
+
export const CONTRACT_VERSION = "2";
|
|
60
|
+
/**
|
|
61
|
+
* Every schema of the public contract, under the name it is known by outside
|
|
62
|
+
* TypeScript.
|
|
63
|
+
*
|
|
64
|
+
* The registry is what makes the contract readable by something that is not
|
|
65
|
+
* this package: the JSON Schema export below walks it, and a merchant's
|
|
66
|
+
* engineer working in another language reads that. It carries the building
|
|
67
|
+
* blocks as well as the whole documents, because a merchant validating one
|
|
68
|
+
* amount should not have to lift it out of a card.
|
|
69
|
+
*
|
|
70
|
+
* A schema that exists and is not here is a schema nobody outside TypeScript
|
|
71
|
+
* can see, so a test holds the two in step.
|
|
72
|
+
*/
|
|
73
|
+
export const schemas = Object.freeze({
|
|
74
|
+
acceptance: AcceptanceSchema,
|
|
75
|
+
agent_order_status: AgentOrderStatusSchema,
|
|
76
|
+
amount: AmountSchema,
|
|
77
|
+
cabinet_key: CabinetKeySchema,
|
|
78
|
+
call_error: CallErrorSchema,
|
|
79
|
+
card: CardSchema,
|
|
80
|
+
catalog_page: CatalogPageSchema,
|
|
81
|
+
currency_code: CurrencyCodeSchema,
|
|
82
|
+
delivery: DeliverySchema,
|
|
83
|
+
disabled_key: DisabledKeySchema,
|
|
84
|
+
error_envelope: ErrorEnvelopeSchema,
|
|
85
|
+
evm_address: EvmAddressSchema,
|
|
86
|
+
field_spec: FieldSpecSchema,
|
|
87
|
+
forgotten_cabinet_key: ForgottenCabinetKeySchema,
|
|
88
|
+
fulfillment: FulfillmentSchema,
|
|
89
|
+
handler_answer: HandlerAnswerSchema,
|
|
90
|
+
identifier: IdentifierSchema,
|
|
91
|
+
issue_key_request: IssueKeyRequestSchema,
|
|
92
|
+
issued_key: IssuedKeySchema,
|
|
93
|
+
merchant_card: MerchantCardSchema,
|
|
94
|
+
merchant_card_list: MerchantCardListSchema,
|
|
95
|
+
merchant_key: MerchantKeySchema,
|
|
96
|
+
merchant_key_list: MerchantKeyListSchema,
|
|
97
|
+
money: MoneySchema,
|
|
98
|
+
order: OrderSchema,
|
|
99
|
+
order_accept_response: OrderAcceptResponseSchema,
|
|
100
|
+
order_call_response: OrderCallResponseSchema,
|
|
101
|
+
order_call_result: OrderCallResultSchema,
|
|
102
|
+
order_event: OrderEventSchema,
|
|
103
|
+
order_list: OrderListSchema,
|
|
104
|
+
order_list_query: OrderListQuerySchema,
|
|
105
|
+
order_status: OrderStatusSchema,
|
|
106
|
+
order_with_status: OrderWithStatusSchema,
|
|
107
|
+
param_name: ParamNameSchema,
|
|
108
|
+
param_spec: ParamSpecSchema,
|
|
109
|
+
param_type: ParamTypeSchema,
|
|
110
|
+
payout_wallet: PayoutWalletSchema,
|
|
111
|
+
payout_wallet_request: PayoutWalletRequestSchema,
|
|
112
|
+
price_check: PriceCheckSchema,
|
|
113
|
+
problem: ProblemSchema,
|
|
114
|
+
public_card: PublicCardSchema,
|
|
115
|
+
publish_result: PublishResultSchema,
|
|
116
|
+
purchase_request: PurchaseRequestSchema,
|
|
117
|
+
quote_answer_ack: QuoteAnswerAckSchema,
|
|
118
|
+
quote_purpose: QuotePurposeSchema,
|
|
119
|
+
quote_request: QuoteRequestSchema,
|
|
120
|
+
quote_response: QuoteResponseSchema,
|
|
121
|
+
receipt: ReceiptSchema,
|
|
122
|
+
receipt_list: ReceiptListSchema,
|
|
123
|
+
receipt_outcome: ReceiptOutcomeSchema,
|
|
124
|
+
registered_merchant: RegisteredMerchantSchema,
|
|
125
|
+
registration_request: RegistrationRequestSchema,
|
|
126
|
+
refund_due_reason: RefundDueReasonSchema,
|
|
127
|
+
refusal: RefusalSchema,
|
|
128
|
+
refusal_code: RefusalCodeSchema,
|
|
129
|
+
sale_price: SalePriceSchema,
|
|
130
|
+
seller_name: SellerNameSchema,
|
|
131
|
+
seller_name_request: SellerNameRequestSchema,
|
|
132
|
+
selling_state: SellingStateSchema,
|
|
133
|
+
service_name: ServiceNameSchema,
|
|
134
|
+
tags: TagsSchema,
|
|
135
|
+
timestamp: TimestampSchema,
|
|
136
|
+
worker_envelope: WorkerEnvelopeSchema,
|
|
137
|
+
worker_poll_request: WorkerPollRequestSchema,
|
|
138
|
+
worker_poll_response: WorkerPollResponseSchema,
|
|
139
|
+
});
|
|
140
|
+
/** The identifier a rendered document carries, so a reader knows what it holds. */
|
|
141
|
+
export const jsonSchemaIdOf = (name) => `urn:agentify:contract:${CONTRACT_VERSION}:${name}`;
|
|
142
|
+
/**
|
|
143
|
+
* The whole contract as JSON Schema, one document per registry entry.
|
|
144
|
+
*
|
|
145
|
+
* A function rather than a constant: the conversion costs something, and a
|
|
146
|
+
* consumer who only needs to validate a card in TypeScript should not pay for
|
|
147
|
+
* a description of everything else at import time.
|
|
148
|
+
*
|
|
149
|
+
* What the documents carry and what they do not is worth saying plainly,
|
|
150
|
+
* because the difference is invisible from the outside. Structure crosses
|
|
151
|
+
* intact — fields, types, which are required, whether unknown keys are
|
|
152
|
+
* allowed, enumerations, patterns, the branches of a union. Rules that look at
|
|
153
|
+
* more than one field at a time do not: JSON Schema cannot say "this field
|
|
154
|
+
* only when that one has this value", and zod drops such a rule without a
|
|
155
|
+
* word. Every schema that has one says so in its own `description`, which does
|
|
156
|
+
* cross, so a reader of the document is told what it is not checking rather
|
|
157
|
+
* than left to assume it checks everything.
|
|
158
|
+
*
|
|
159
|
+
* Each document is stamped with the contract version it came from.
|
|
160
|
+
*/
|
|
161
|
+
export const toJsonSchemas = () => {
|
|
162
|
+
const documents = {};
|
|
163
|
+
for (const [name, schema] of Object.entries(schemas)) {
|
|
164
|
+
documents[name] = { $id: jsonSchemaIdOf(name), ...z.toJSONSchema(schema) };
|
|
165
|
+
}
|
|
166
|
+
return documents;
|
|
167
|
+
};
|
|
@@ -0,0 +1,281 @@
|
|
|
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.
|
|
4
|
+
*
|
|
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.
|
|
12
|
+
*
|
|
13
|
+
* Two rules run through the file and are worth saying once.
|
|
14
|
+
*
|
|
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 —
|
|
17
|
+
* the list a merchant reads, the row that comes back from disabling one — can
|
|
18
|
+
* carry it, and the shapes below refuse it rather than merely omit it. What is
|
|
19
|
+
* kept on our side is a digest, so there is nothing to put in those documents
|
|
20
|
+
* even if somebody wanted to.
|
|
21
|
+
*
|
|
22
|
+
* And a key that has been revoked stays in the list. `disabled_at` is a moment
|
|
23
|
+
* rather than a flag, and it is always present: after an incident the question
|
|
24
|
+
* is when a key stopped working, and a list that dropped the key answers
|
|
25
|
+
* nothing, while a flag answers only half.
|
|
26
|
+
*/
|
|
27
|
+
import { z } from "zod";
|
|
28
|
+
/**
|
|
29
|
+
* One key a merchant holds, as they read it.
|
|
30
|
+
*
|
|
31
|
+
* The secret is not here and cannot be put here. This is the document a screen
|
|
32
|
+
* lists, drawn again on every visit, and the secret is shown once by the call
|
|
33
|
+
* that made the key and never again — so a shape that could carry one is a
|
|
34
|
+
* shape that eventually does.
|
|
35
|
+
*/
|
|
36
|
+
export declare const MerchantKeySchema: z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
label: z.ZodString;
|
|
39
|
+
created_at: z.ZodISODateTime;
|
|
40
|
+
last_used_at: z.ZodNullable<z.ZodISODateTime>;
|
|
41
|
+
disabled_at: z.ZodNullable<z.ZodISODateTime>;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
/**
|
|
44
|
+
* The keys one merchant made for their own code, and the one this call was made
|
|
45
|
+
* with.
|
|
46
|
+
*
|
|
47
|
+
* `this_call` is the field the list cannot be assembled without, and the reason
|
|
48
|
+
* is a rule in the route rather than anything about the shape: a merchant
|
|
49
|
+
* cannot disable the key their own call was made with (ADR-0014 §5). A screen
|
|
50
|
+
* that did not know which of these that was would offer a button the route
|
|
51
|
+
* refuses, on the one page where being refused looks like the product being
|
|
52
|
+
* broken.
|
|
53
|
+
*
|
|
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.
|
|
59
|
+
*
|
|
60
|
+
* An object rather than a bare array, for that reason before any other — an
|
|
61
|
+
* array has nowhere to put it.
|
|
62
|
+
*/
|
|
63
|
+
export declare const MerchantKeyListSchema: z.ZodObject<{
|
|
64
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
65
|
+
id: z.ZodString;
|
|
66
|
+
label: z.ZodString;
|
|
67
|
+
created_at: z.ZodISODateTime;
|
|
68
|
+
last_used_at: z.ZodNullable<z.ZodISODateTime>;
|
|
69
|
+
disabled_at: z.ZodNullable<z.ZodISODateTime>;
|
|
70
|
+
}, z.core.$strict>>;
|
|
71
|
+
this_call: z.ZodString;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
/** What a merchant sends to have a key made. */
|
|
74
|
+
export declare const IssueKeyRequestSchema: z.ZodObject<{
|
|
75
|
+
label: z.ZodString;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
/**
|
|
78
|
+
* A key that has just been made: the row, and the secret, once.
|
|
79
|
+
*
|
|
80
|
+
* Both halves are needed by the caller. Without the secret there is no key to
|
|
81
|
+
* hand to a worker; without the row there is a string and nothing to say which
|
|
82
|
+
* of the merchant's keys it is, which is the thing they need to disable it
|
|
83
|
+
* later.
|
|
84
|
+
*/
|
|
85
|
+
export declare const IssuedKeySchema: z.ZodObject<{
|
|
86
|
+
key: z.ZodObject<{
|
|
87
|
+
id: z.ZodString;
|
|
88
|
+
label: z.ZodString;
|
|
89
|
+
created_at: z.ZodISODateTime;
|
|
90
|
+
last_used_at: z.ZodNullable<z.ZodISODateTime>;
|
|
91
|
+
disabled_at: z.ZodNullable<z.ZodISODateTime>;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
secret: z.ZodString;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
/**
|
|
96
|
+
* A key that has been revoked, as it now stands.
|
|
97
|
+
*
|
|
98
|
+
* An object rather than the key itself, so the day this answer has to say
|
|
99
|
+
* anything beside the key — how many of the merchant's keys still work, say — it
|
|
100
|
+
* grows a field instead of changing shape under every reader.
|
|
101
|
+
*/
|
|
102
|
+
export declare const DisabledKeySchema: z.ZodObject<{
|
|
103
|
+
key: z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
label: z.ZodString;
|
|
106
|
+
created_at: z.ZodISODateTime;
|
|
107
|
+
last_used_at: z.ZodNullable<z.ZodISODateTime>;
|
|
108
|
+
disabled_at: z.ZodNullable<z.ZodISODateTime>;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
}, 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
|
+
/**
|
|
140
|
+
* What a merchant's products are sold under, as the merchant reads it back.
|
|
141
|
+
*
|
|
142
|
+
* Null is the fact "nobody has chosen one", which is every merchant on the day
|
|
143
|
+
* they register and is the state they stay in until they do. It is a value
|
|
144
|
+
* rather than an absent field, because an absent field would be
|
|
145
|
+
* indistinguishable from a client that dropped it, and a settings screen
|
|
146
|
+
* reading the second as the first would tell a merchant they are listed under
|
|
147
|
+
* nothing while they are listed under something.
|
|
148
|
+
*
|
|
149
|
+
* The name is held to the rule of the catalog that carries it, which is where
|
|
150
|
+
* this name is going: at most thirty-two characters of printable ASCII. That
|
|
151
|
+
* bound is not ours and is not about our own storage — the catalog drops what
|
|
152
|
+
* it cannot render and tells nobody, so a name refused here is a name the
|
|
153
|
+
* merchant is told about, and a name accepted here and dropped there is a
|
|
154
|
+
* seller trading under something they did not choose.
|
|
155
|
+
*/
|
|
156
|
+
export declare const SellerNameSchema: z.ZodObject<{
|
|
157
|
+
seller_name: z.ZodNullable<z.ZodString>;
|
|
158
|
+
}, z.core.$strict>;
|
|
159
|
+
/**
|
|
160
|
+
* What a merchant sends to change what their products are sold under.
|
|
161
|
+
*
|
|
162
|
+
* The same field held to the same rule, and one difference: there is no null.
|
|
163
|
+
* A merchant can go from having no name to having one and from one name to
|
|
164
|
+
* another, and not back. Having none is a starting state rather than a setting,
|
|
165
|
+
* because a payment request names the seller and there would be nobody to name:
|
|
166
|
+
* every card they had already published would come off sale, which is an end to
|
|
167
|
+
* their selling arriving under the name of editing a setting. What somebody
|
|
168
|
+
* reaching for that actually wants is one of two other acts: a different name,
|
|
169
|
+
* which is this same call, or an end to selling, which is the pause — and the
|
|
170
|
+
* pause leaves their cards where they can find them again.
|
|
171
|
+
*
|
|
172
|
+
* So it is two documents rather than one, and a cabinet still reads back the
|
|
173
|
+
* shape it sent. The message on a null is written here rather than left to a
|
|
174
|
+
* type error, because "expected string, received null" describes the shape and
|
|
175
|
+
* says nothing about which act the sender was reaching for.
|
|
176
|
+
*/
|
|
177
|
+
export declare const SellerNameRequestSchema: z.ZodObject<{
|
|
178
|
+
seller_name: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
179
|
+
}, z.core.$strict>;
|
|
180
|
+
/**
|
|
181
|
+
* The wallet a merchant's sales are paid into, as the merchant reads it back.
|
|
182
|
+
*
|
|
183
|
+
* Payments here are not held by anybody on the way: a buyer's agent pays the
|
|
184
|
+
* merchant's own address directly, and this is that address. There is no
|
|
185
|
+
* account of theirs on our side with a balance in it and no moment at which
|
|
186
|
+
* their money is ours, which is why this field exists at all — without it there
|
|
187
|
+
* would have to be.
|
|
188
|
+
*
|
|
189
|
+
* Null is the fact "nobody has said where the money goes", which is every
|
|
190
|
+
* merchant on the day they register. It is a value rather than an absent field
|
|
191
|
+
* for the reason the seller name is: a settings screen cannot tell a silence
|
|
192
|
+
* from a client that dropped the field, and reading the second as the first
|
|
193
|
+
* tells a merchant they are set up to be paid when nothing of theirs can be.
|
|
194
|
+
*
|
|
195
|
+
* What comes back is always the spelling a wallet shows, whichever of the two
|
|
196
|
+
* accepted spellings was sent. The door takes both and everything behind it
|
|
197
|
+
* holds one (ADR-0017), and this is the one for a reason that is about the
|
|
198
|
+
* person rather than about the storage: a merchant pastes forty characters out
|
|
199
|
+
* of their wallet and reads them back on a settings screen, and handed the same
|
|
200
|
+
* address in lower case they cannot tell it from a different address without
|
|
201
|
+
* comparing character by character. On the one field money is sent to, that
|
|
202
|
+
* glance is the whole of the checking anybody does.
|
|
203
|
+
*/
|
|
204
|
+
export declare const PayoutWalletSchema: z.ZodObject<{
|
|
205
|
+
payout_wallet: z.ZodNullable<z.ZodString>;
|
|
206
|
+
}, z.core.$strict>;
|
|
207
|
+
/**
|
|
208
|
+
* What a merchant sends to change where their sales are paid.
|
|
209
|
+
*
|
|
210
|
+
* The same field held to the same rule, and one difference, which is the same
|
|
211
|
+
* difference the seller name has and rests on something harder. There is no
|
|
212
|
+
* null. A merchant goes from having no wallet to having one and from one wallet
|
|
213
|
+
* to another, and not back: a merchant who took their address away would keep
|
|
214
|
+
* every card they had already published on sale, and the payment request an
|
|
215
|
+
* agent is answered with cannot be built at all without an address — so the
|
|
216
|
+
* products would stop being buyable and nothing anywhere would say why. What
|
|
217
|
+
* somebody reaching for null actually wants is one of two other acts: a
|
|
218
|
+
* different address, which is this same call, or an end to selling, which is
|
|
219
|
+
* the pause, and the pause leaves their cards where they can put them back.
|
|
220
|
+
*
|
|
221
|
+
* There is nowhere here to put a key, and a document carrying one is refused
|
|
222
|
+
* rather than trimmed. This contract knows where a merchant is paid and has no
|
|
223
|
+
* business knowing anything that could spend it.
|
|
224
|
+
*/
|
|
225
|
+
export declare const PayoutWalletRequestSchema: z.ZodObject<{
|
|
226
|
+
payout_wallet: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
227
|
+
}, z.core.$strict>;
|
|
228
|
+
/**
|
|
229
|
+
* What somebody sends to become a merchant.
|
|
230
|
+
*
|
|
231
|
+
* One field, and what is not here is most of what is worth reading. The address
|
|
232
|
+
* and the password belong to the account rather than to the merchant, and they
|
|
233
|
+
* stay on the other side of the boundary (ADR-0014 §1) — a gateway that took
|
|
234
|
+
* either would be holding a person's credentials on the money path, which is
|
|
235
|
+
* what this route's whole shape is arranged to avoid.
|
|
236
|
+
*
|
|
237
|
+
* The name the seller's products are sold under is not here either, and that
|
|
238
|
+
* omission is a decision rather than a simplification. It is a public answer,
|
|
239
|
+
* and asking for it here asks for it at the one moment a merchant knows least:
|
|
240
|
+
* no products, no catalogue seen, no idea what the name is for. It is asked for
|
|
241
|
+
* on the screen after this one instead, where there is room to say why it
|
|
242
|
+
* matters, and it can be changed afterwards from the merchant's own settings.
|
|
243
|
+
*
|
|
244
|
+
* The shape refuses a name rather than ignoring one, because a field quietly
|
|
245
|
+
* dropped is a person believing they have chosen what buyers will read.
|
|
246
|
+
*/
|
|
247
|
+
export declare const RegistrationRequestSchema: z.ZodObject<{
|
|
248
|
+
invitation: z.ZodString;
|
|
249
|
+
}, z.core.$strict>;
|
|
250
|
+
/**
|
|
251
|
+
* What registering answers with: a merchant and the key their cabinet will call
|
|
252
|
+
* as them with.
|
|
253
|
+
*
|
|
254
|
+
* The key is made for a cabinet rather than for the merchant's own code, and
|
|
255
|
+
* that is what the caller of this route is. So it is in no list: a merchant who
|
|
256
|
+
* has just registered has no keys of their own at all, and the first one they
|
|
257
|
+
* do have is one they ask for. No row travels beside the secret for the same
|
|
258
|
+
* reason no row appears in the list — the merchant did not issue it and cannot
|
|
259
|
+
* disable it, so an identifier for it would be a value with nothing to do.
|
|
260
|
+
*
|
|
261
|
+
* No name comes back either, because none was chosen. A merchant who has just
|
|
262
|
+
* registered is listed under nothing at all, and a field here would either be a
|
|
263
|
+
* name this call invented or a null that says the same thing at more length.
|
|
264
|
+
*/
|
|
265
|
+
export declare const RegisteredMerchantSchema: z.ZodObject<{
|
|
266
|
+
merchant_id: z.ZodString;
|
|
267
|
+
secret: z.ZodString;
|
|
268
|
+
}, z.core.$strict>;
|
|
269
|
+
export type SellerName = z.infer<typeof SellerNameSchema>;
|
|
270
|
+
export type SellerNameRequest = z.infer<typeof SellerNameRequestSchema>;
|
|
271
|
+
export type PayoutWallet = z.infer<typeof PayoutWalletSchema>;
|
|
272
|
+
export type PayoutWalletRequest = z.infer<typeof PayoutWalletRequestSchema>;
|
|
273
|
+
export type MerchantKey = z.infer<typeof MerchantKeySchema>;
|
|
274
|
+
export type MerchantKeyList = z.infer<typeof MerchantKeyListSchema>;
|
|
275
|
+
export type IssueKeyRequest = z.infer<typeof IssueKeyRequestSchema>;
|
|
276
|
+
export type IssuedKey = z.infer<typeof IssuedKeySchema>;
|
|
277
|
+
export type DisabledKey = z.infer<typeof DisabledKeySchema>;
|
|
278
|
+
export type CabinetKey = z.infer<typeof CabinetKeySchema>;
|
|
279
|
+
export type ForgottenCabinetKey = z.infer<typeof ForgottenCabinetKeySchema>;
|
|
280
|
+
export type RegistrationRequest = z.infer<typeof RegistrationRequestSchema>;
|
|
281
|
+
export type RegisteredMerchant = z.infer<typeof RegisteredMerchantSchema>;
|