@nuanu-ai/agentify-contracts 0.6.0 → 0.7.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/api.d.ts +57 -215
- package/dist/api.js +74 -30
- package/dist/card.d.ts +124 -72
- package/dist/card.js +147 -52
- package/dist/index.d.ts +45 -184
- package/dist/index.js +12 -9
- package/dist/merchant.d.ts +16 -14
- package/dist/merchant.js +55 -27
- package/dist/primitives.d.ts +13 -0
- package/dist/primitives.js +14 -0
- package/dist/results.d.ts +5 -4
- package/dist/results.js +6 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,33 +22,33 @@
|
|
|
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, SellerSiteSchema, 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 {
|
|
30
|
+
import { DashboardKeySchema, DisabledKeySchema, ForgottenDashboardKeySchema, IssuedKeySchema, IssueKeyRequestSchema, MerchantKeyListSchema, MerchantKeySchema, PayoutWalletRequestSchema, PayoutWalletSchema, PendingPayoutWalletSchema, RegisteredMerchantSchema, RegistrationRequestSchema, 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
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";
|
|
39
|
+
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";
|
|
40
|
+
export { bazaarDeclarationOf, CardSchema, deliveryCheckFor, FulfillmentSchema, MerchantCardSchema, PriceCheckSchema, PublicCardSchema, publicCardOf, purchaseCheckFor, SellerSchema, SellerSiteSchema, ServiceNameSchema, TagsSchema, } from "./card.js";
|
|
41
41
|
export { WORKER_ENVELOPE_KINDS, WORKER_ENVELOPE_PAYLOADS, WorkerEnvelopeSchema, } from "./envelope.js";
|
|
42
42
|
export { ORDER_EVENT_TYPES, OrderEventSchema, RefundDueReasonSchema } from "./events.js";
|
|
43
43
|
export { checksummedAddressOf, EvmAddressSchema } from "./evm-address.js";
|
|
44
44
|
export { AcceptanceSchema, DeliverySchema, HandlerAnswerSchema, RECOMMENDED_REFUSAL_CODES, RefusalCodeSchema, RefusalSchema, } from "./handler.js";
|
|
45
|
-
export {
|
|
45
|
+
export { DashboardKeySchema, DisabledKeySchema, ForgottenDashboardKeySchema, IssuedKeySchema, IssueKeyRequestSchema, MerchantKeyListSchema, MerchantKeySchema, PayoutWalletRequestSchema, PayoutWalletSchema, PendingPayoutWalletSchema, RegisteredMerchantSchema, RegistrationRequestSchema, SellerNameRequestSchema, SellerNameSchema, } from "./merchant.js";
|
|
46
46
|
export { OrderSchema } from "./order.js";
|
|
47
47
|
export { ORDER_STATUSES, OrderStatusSchema } from "./order-status.js";
|
|
48
48
|
export { FieldSpecSchema, ParamNameSchema, ParamSpecSchema, ParamTypeSchema, PROTOTYPE_KEY_IS_DROPPED, paramSpecToValidator, } from "./param-spec.js";
|
|
49
49
|
export { notPlainTextIn } from "./plain-text.js";
|
|
50
50
|
export { PAYABLE_CURRENCIES, PAYABLE_DECIMALS, priceProblemsOf } from "./price-rule.js";
|
|
51
|
-
export { AmountSchema, CurrencyCodeSchema, IdentifierSchema, MoneySchema, SalePriceSchema, TimestampSchema, } from "./primitives.js";
|
|
51
|
+
export { AmountSchema, CurrencyCodeSchema, IdentifierSchema, MoneySchema, OpenWordSchema, SalePriceSchema, TimestampSchema, } from "./primitives.js";
|
|
52
52
|
export { QuotePurposeSchema, QuoteRequestSchema, QuoteResponseSchema } from "./quote.js";
|
|
53
53
|
export { ReceiptOutcomeSchema, ReceiptSchema } from "./receipt.js";
|
|
54
54
|
export { CARD_REJECTED, CallErrorSchema, MERCHANT_FINDINGS, ORDER_CALL_ERROR_CODES, ORDER_CALL_RESULTS, OrderCallResultSchema, ProblemSchema, PublishResultSchema, } from "./results.js";
|
|
@@ -76,17 +76,17 @@ export const schemas = Object.freeze({
|
|
|
76
76
|
acceptance: AcceptanceSchema,
|
|
77
77
|
agent_order_status: AgentOrderStatusSchema,
|
|
78
78
|
amount: AmountSchema,
|
|
79
|
-
cabinet_key: CabinetKeySchema,
|
|
80
79
|
call_error: CallErrorSchema,
|
|
81
80
|
card: CardSchema,
|
|
82
81
|
catalog_page: CatalogPageSchema,
|
|
83
82
|
currency_code: CurrencyCodeSchema,
|
|
83
|
+
dashboard_key: DashboardKeySchema,
|
|
84
84
|
delivery: DeliverySchema,
|
|
85
85
|
disabled_key: DisabledKeySchema,
|
|
86
86
|
error_envelope: ErrorEnvelopeSchema,
|
|
87
87
|
evm_address: EvmAddressSchema,
|
|
88
88
|
field_spec: FieldSpecSchema,
|
|
89
|
-
|
|
89
|
+
forgotten_dashboard_key: ForgottenDashboardKeySchema,
|
|
90
90
|
fulfillment: FulfillmentSchema,
|
|
91
91
|
handler_answer: HandlerAnswerSchema,
|
|
92
92
|
identifier: IdentifierSchema,
|
|
@@ -97,6 +97,7 @@ export const schemas = Object.freeze({
|
|
|
97
97
|
merchant_key: MerchantKeySchema,
|
|
98
98
|
merchant_key_list: MerchantKeyListSchema,
|
|
99
99
|
money: MoneySchema,
|
|
100
|
+
open_word: OpenWordSchema,
|
|
100
101
|
order: OrderSchema,
|
|
101
102
|
order_accept_response: OrderAcceptResponseSchema,
|
|
102
103
|
order_call_response: OrderCallResponseSchema,
|
|
@@ -130,9 +131,11 @@ export const schemas = Object.freeze({
|
|
|
130
131
|
refusal: RefusalSchema,
|
|
131
132
|
refusal_code: RefusalCodeSchema,
|
|
132
133
|
sale_price: SalePriceSchema,
|
|
134
|
+
seller: SellerSchema,
|
|
133
135
|
seller_name: SellerNameSchema,
|
|
134
136
|
seller_name_request: SellerNameRequestSchema,
|
|
135
137
|
selling_state: SellingStateSchema,
|
|
138
|
+
seller_site: SellerSiteSchema,
|
|
136
139
|
service_name: ServiceNameSchema,
|
|
137
140
|
tags: TagsSchema,
|
|
138
141
|
timestamp: TimestampSchema,
|
package/dist/merchant.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* wallet their sales are paid into, and the keys they open the door with.
|
|
4
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
|
|
6
|
+
* both: one call makes the merchant and the key its dashboard will call as them
|
|
7
7
|
* with, and what comes back carries that key once. Split across two files, a
|
|
8
8
|
* reader working out what registering leaves a merchant holding would have to
|
|
9
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
|
|
@@ -52,8 +52,8 @@ export declare const MerchantKeySchema: z.ZodObject<{
|
|
|
52
52
|
* broken.
|
|
53
53
|
*
|
|
54
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
|
|
56
|
-
*
|
|
55
|
+
* likeliest to assume and be wrong about. A dashboard calls with a key made for a
|
|
56
|
+
* dashboard, and those are in nobody's list, so a client that looked this
|
|
57
57
|
* identifier up among the rows would find nothing — which is an answer rather
|
|
58
58
|
* than an error, and a screen has to be built for it.
|
|
59
59
|
*
|
|
@@ -109,10 +109,10 @@ export declare const DisabledKeySchema: z.ZodObject<{
|
|
|
109
109
|
}, z.core.$strict>;
|
|
110
110
|
}, z.core.$strict>;
|
|
111
111
|
/**
|
|
112
|
-
* A key made for a
|
|
112
|
+
* A key made for a dashboard, which is the secret and nothing else.
|
|
113
113
|
*
|
|
114
114
|
* Every other answer that makes a key carries the row beside it, and this one
|
|
115
|
-
* cannot. A key made for a
|
|
115
|
+
* cannot. A key made for a dashboard is in no merchant's list — they did not
|
|
116
116
|
* issue it and have no reason to know it exists — so an identifier here would
|
|
117
117
|
* name a row that no screen of theirs draws and no call of theirs reaches: not
|
|
118
118
|
* the list it is absent from, and not the revoking, which takes the keys a
|
|
@@ -120,7 +120,7 @@ export declare const DisabledKeySchema: z.ZodObject<{
|
|
|
120
120
|
* is put it on the row of whoever just signed in, and that is the whole of what
|
|
121
121
|
* it needs.
|
|
122
122
|
*/
|
|
123
|
-
export declare const
|
|
123
|
+
export declare const DashboardKeySchema: z.ZodObject<{
|
|
124
124
|
secret: z.ZodString;
|
|
125
125
|
}, z.core.$strict>;
|
|
126
126
|
/**
|
|
@@ -133,7 +133,7 @@ export declare const CabinetKeySchema: z.ZodObject<{
|
|
|
133
133
|
* is done, and it is said in a field rather than left to a status code so that
|
|
134
134
|
* a client reads one document and not two kinds of evidence.
|
|
135
135
|
*/
|
|
136
|
-
export declare const
|
|
136
|
+
export declare const ForgottenDashboardKeySchema: z.ZodObject<{
|
|
137
137
|
forgotten: z.ZodLiteral<true>;
|
|
138
138
|
}, z.core.$strict>;
|
|
139
139
|
/**
|
|
@@ -155,6 +155,7 @@ export declare const ForgottenCabinetKeySchema: z.ZodObject<{
|
|
|
155
155
|
*/
|
|
156
156
|
export declare const SellerNameSchema: z.ZodObject<{
|
|
157
157
|
seller_name: z.ZodNullable<z.ZodString>;
|
|
158
|
+
seller_site: z.ZodNullable<z.ZodString>;
|
|
158
159
|
}, z.core.$strict>;
|
|
159
160
|
/**
|
|
160
161
|
* What a merchant sends to change what their products are sold under.
|
|
@@ -169,13 +170,14 @@ export declare const SellerNameSchema: z.ZodObject<{
|
|
|
169
170
|
* which is this same call, or an end to selling, which is the pause — and the
|
|
170
171
|
* pause leaves their cards where they can find them again.
|
|
171
172
|
*
|
|
172
|
-
* So it is two documents rather than one, and a
|
|
173
|
+
* So it is two documents rather than one, and a dashboard still reads back the
|
|
173
174
|
* shape it sent. The message on a null is written here rather than left to a
|
|
174
175
|
* type error, because "expected string, received null" describes the shape and
|
|
175
176
|
* says nothing about which act the sender was reaching for.
|
|
176
177
|
*/
|
|
177
178
|
export declare const SellerNameRequestSchema: z.ZodObject<{
|
|
178
|
-
seller_name: z.ZodPipe<z.ZodString, z.ZodString
|
|
179
|
+
seller_name: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
180
|
+
seller_site: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
179
181
|
}, z.core.$strict>;
|
|
180
182
|
/**
|
|
181
183
|
* A change of the wallet that has been asked for, announced, and has not taken
|
|
@@ -183,7 +185,7 @@ export declare const SellerNameRequestSchema: z.ZodObject<{
|
|
|
183
185
|
*
|
|
184
186
|
* It exists because a replacement does not apply at once where the money is
|
|
185
187
|
* 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
|
|
188
|
+
* change redirects money, and any key of theirs reaches it — the dashboard's, or
|
|
187
189
|
* one sitting in their own server's environment — so on the live deployment a
|
|
188
190
|
* replacement is told to every account of the merchant first and takes effect
|
|
189
191
|
* forty-eight hours after that. What this document says is the two facts a
|
|
@@ -285,10 +287,10 @@ export declare const RegistrationRequestSchema: z.ZodObject<{
|
|
|
285
287
|
invitation: z.ZodString;
|
|
286
288
|
}, z.core.$strict>;
|
|
287
289
|
/**
|
|
288
|
-
* What registering answers with: a merchant and the key their
|
|
290
|
+
* What registering answers with: a merchant and the key their dashboard will call
|
|
289
291
|
* as them with.
|
|
290
292
|
*
|
|
291
|
-
* The key is made for a
|
|
293
|
+
* The key is made for a dashboard rather than for the merchant's own code, and
|
|
292
294
|
* that is what the caller of this route is. So it is in no list: a merchant who
|
|
293
295
|
* has just registered has no keys of their own at all, and the first one they
|
|
294
296
|
* do have is one they ask for. No row travels beside the secret for the same
|
|
@@ -313,7 +315,7 @@ export type MerchantKeyList = z.infer<typeof MerchantKeyListSchema>;
|
|
|
313
315
|
export type IssueKeyRequest = z.infer<typeof IssueKeyRequestSchema>;
|
|
314
316
|
export type IssuedKey = z.infer<typeof IssuedKeySchema>;
|
|
315
317
|
export type DisabledKey = z.infer<typeof DisabledKeySchema>;
|
|
316
|
-
export type
|
|
317
|
-
export type
|
|
318
|
+
export type DashboardKey = z.infer<typeof DashboardKeySchema>;
|
|
319
|
+
export type ForgottenDashboardKey = z.infer<typeof ForgottenDashboardKeySchema>;
|
|
318
320
|
export type RegistrationRequest = z.infer<typeof RegistrationRequestSchema>;
|
|
319
321
|
export type RegisteredMerchant = z.infer<typeof RegisteredMerchantSchema>;
|
package/dist/merchant.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* wallet their sales are paid into, and the keys they open the door with.
|
|
4
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
|
|
6
|
+
* both: one call makes the merchant and the key its dashboard will call as them
|
|
7
7
|
* with, and what comes back carries that key once. Split across two files, a
|
|
8
8
|
* reader working out what registering leaves a merchant holding would have to
|
|
9
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
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* nothing, while a flag answers only half.
|
|
26
26
|
*/
|
|
27
27
|
import { z } from "zod";
|
|
28
|
-
import { ServiceNameSchema } from "./card.js";
|
|
28
|
+
import { SellerSchema, SellerSiteSchema, ServiceNameSchema } from "./card.js";
|
|
29
29
|
import { EvmAddressSchema } from "./evm-address.js";
|
|
30
30
|
import { IdentifierSchema, TimestampSchema } from "./primitives.js";
|
|
31
31
|
/**
|
|
@@ -162,8 +162,8 @@ export const MerchantKeySchema = z
|
|
|
162
162
|
* broken.
|
|
163
163
|
*
|
|
164
164
|
* It is not always one of the keys beside it, and that is the thing a reader is
|
|
165
|
-
* likeliest to assume and be wrong about. A
|
|
166
|
-
*
|
|
165
|
+
* likeliest to assume and be wrong about. A dashboard calls with a key made for a
|
|
166
|
+
* dashboard, and those are in nobody's list, so a client that looked this
|
|
167
167
|
* identifier up among the rows would find nothing — which is an answer rather
|
|
168
168
|
* than an error, and a screen has to be built for it.
|
|
169
169
|
*
|
|
@@ -176,7 +176,7 @@ export const MerchantKeyListSchema = z
|
|
|
176
176
|
* The keys this merchant made for their own code, the revoked ones among
|
|
177
177
|
* them.
|
|
178
178
|
*
|
|
179
|
-
* The keys a
|
|
179
|
+
* The keys a dashboard holds are not here and never will be: the merchant did
|
|
180
180
|
* not issue one and has nothing to do with one. A list is what somebody
|
|
181
181
|
* acts on, and a row nobody has any business acting on is a row that only
|
|
182
182
|
* raises the question of why it will not go away.
|
|
@@ -186,7 +186,7 @@ export const MerchantKeyListSchema = z
|
|
|
186
186
|
this_call: IdentifierSchema,
|
|
187
187
|
})
|
|
188
188
|
.meta({
|
|
189
|
-
description: "The keys one merchant made for their own code, working and revoked together, and the identifier of the key this very call was made with. That last field is here because a merchant cannot disable the key they are holding: without it a screen would offer a button the gateway refuses. It is not always among the keys listed — a
|
|
189
|
+
description: "The keys one merchant made for their own code, working and revoked together, and the identifier of the key this very call was made with. That last field is here because a merchant cannot disable the key they are holding: without it a screen would offer a button the gateway refuses. It is not always among the keys listed — a dashboard calls with a key of its own, and those are in no list here — so a client matching it against the rows has to be built for finding none. The keys a dashboard holds are left out entirely: they are not issued by the merchant and cannot be revoked by them. This document does not say whether it is the whole list either — paging is not designed, and the absence of a field about it is not a promise that there is no more.",
|
|
190
190
|
});
|
|
191
191
|
/** What a merchant sends to have a key made. */
|
|
192
192
|
export const IssueKeyRequestSchema = z
|
|
@@ -211,7 +211,7 @@ export const IssuedKeySchema = z
|
|
|
211
211
|
secret: KeySecretSchema,
|
|
212
212
|
})
|
|
213
213
|
.meta({
|
|
214
|
-
description: "A key as it comes back from being issued: the row a merchant will see in their list from now on, and the key itself. It carries the key once. Three answers in this contract carry one — this, what registering gives back, and the key a
|
|
214
|
+
description: "A key as it comes back from being issued: the row a merchant will see in their list from now on, and the key itself. It carries the key once. Three answers in this contract carry one — this, what registering gives back, and the key a dashboard asks for — and nothing else does, because what is written down on our side is a digest. A key that is lost is replaced by a new one rather than read back.",
|
|
215
215
|
});
|
|
216
216
|
/**
|
|
217
217
|
* A key that has been revoked, as it now stands.
|
|
@@ -228,10 +228,10 @@ export const DisabledKeySchema = z
|
|
|
228
228
|
description: "The key that was just revoked, with the instant it stopped working on it, so a merchant reads back what happened rather than taking the call's word for it. Revoking a key that was already revoked answers this same way and keeps the first instant, because that is the true one and a retry after a dropped connection must not rewrite it.",
|
|
229
229
|
});
|
|
230
230
|
/**
|
|
231
|
-
* A key made for a
|
|
231
|
+
* A key made for a dashboard, which is the secret and nothing else.
|
|
232
232
|
*
|
|
233
233
|
* Every other answer that makes a key carries the row beside it, and this one
|
|
234
|
-
* cannot. A key made for a
|
|
234
|
+
* cannot. A key made for a dashboard is in no merchant's list — they did not
|
|
235
235
|
* issue it and have no reason to know it exists — so an identifier here would
|
|
236
236
|
* name a row that no screen of theirs draws and no call of theirs reaches: not
|
|
237
237
|
* the list it is absent from, and not the revoking, which takes the keys a
|
|
@@ -239,13 +239,13 @@ export const DisabledKeySchema = z
|
|
|
239
239
|
* is put it on the row of whoever just signed in, and that is the whole of what
|
|
240
240
|
* it needs.
|
|
241
241
|
*/
|
|
242
|
-
export const
|
|
242
|
+
export const DashboardKeySchema = z
|
|
243
243
|
.strictObject({
|
|
244
244
|
/** The only moment this is readable. Nothing on our side keeps it. */
|
|
245
245
|
secret: KeySecretSchema,
|
|
246
246
|
})
|
|
247
247
|
.meta({
|
|
248
|
-
description: "A key made for a
|
|
248
|
+
description: "A key made for a dashboard to call as one merchant, carried once and readable nowhere afterwards. There is no row beside it and there is nothing to put one: a key made this way is in no merchant's list of keys, and the call that revokes a key refuses this kind by name — so an identifier for it would name something no answer shows and no call acts on. Whoever asked for this holds it until they ask for another.",
|
|
249
249
|
});
|
|
250
250
|
/**
|
|
251
251
|
* That the key a call was made with is gone.
|
|
@@ -257,7 +257,7 @@ export const CabinetKeySchema = z
|
|
|
257
257
|
* is done, and it is said in a field rather than left to a status code so that
|
|
258
258
|
* a client reads one document and not two kinds of evidence.
|
|
259
259
|
*/
|
|
260
|
-
export const
|
|
260
|
+
export const ForgottenDashboardKeySchema = z
|
|
261
261
|
.strictObject({
|
|
262
262
|
/** The key this call was made with no longer exists. */
|
|
263
263
|
forgotten: z.literal(true),
|
|
@@ -284,11 +284,20 @@ export const ForgottenCabinetKeySchema = z
|
|
|
284
284
|
*/
|
|
285
285
|
export const SellerNameSchema = z
|
|
286
286
|
.strictObject({
|
|
287
|
-
/**
|
|
288
|
-
|
|
287
|
+
/**
|
|
288
|
+
* What buyers read beside this merchant's products, or nothing — read back
|
|
289
|
+
* by the rule an agent's `seller` reads it by, which leaves the plain-text
|
|
290
|
+
* rule to the door that writes it.
|
|
291
|
+
*/
|
|
292
|
+
seller_name: SellerSchema.shape.name,
|
|
293
|
+
/**
|
|
294
|
+
* The https address of the merchant's own shop, where an agent takes what
|
|
295
|
+
* an order cannot answer (ADR-0034), or nothing where none was given.
|
|
296
|
+
*/
|
|
297
|
+
seller_site: SellerSiteSchema.nullable(),
|
|
289
298
|
})
|
|
290
299
|
.meta({
|
|
291
|
-
description: "The name a merchant's products are sold under: what a discovery catalog lists them under and what a buyer's agent is shown beside the price. Null means nobody has chosen one, which is where every merchant starts. The field is always present rather than left out when there is no name: an absent field would be indistinguishable from a client that dropped it. What a name may be is the catalog's rule rather than ours — at most 32 characters of printable ASCII — because a name outside it is dropped there in silence, so it is refused here where somebody is told. A merchant with no name cannot publish a card: a card published without one reaches a buyer's agent inside a payment request that names no seller at all.",
|
|
300
|
+
description: "The name a merchant's products are sold under: what a discovery catalog lists them under and what a buyer's agent is shown beside the price. Null means nobody has chosen one, which is where every merchant starts. The field is always present rather than left out when there is no name: an absent field would be indistinguishable from a client that dropped it. What a name may be is the catalog's rule rather than ours — at most 32 characters of printable ASCII — because a name outside it is dropped there in silence, so it is refused here where somebody is told. A merchant with no name cannot publish a card: a card published without one reaches a buyer's agent inside a payment request that names no seller at all. seller_site is the https address of the merchant's own shop, which every agent reads beside the name on their cards and orders as where to take what an order cannot answer; null means none was given.",
|
|
292
301
|
});
|
|
293
302
|
/**
|
|
294
303
|
* What a merchant sends to change what their products are sold under.
|
|
@@ -303,7 +312,7 @@ export const SellerNameSchema = z
|
|
|
303
312
|
* which is this same call, or an end to selling, which is the pause — and the
|
|
304
313
|
* pause leaves their cards where they can find them again.
|
|
305
314
|
*
|
|
306
|
-
* So it is two documents rather than one, and a
|
|
315
|
+
* So it is two documents rather than one, and a dashboard still reads back the
|
|
307
316
|
* shape it sent. The message on a null is written here rather than left to a
|
|
308
317
|
* type error, because "expected string, received null" describes the shape and
|
|
309
318
|
* says nothing about which act the sender was reaching for.
|
|
@@ -311,7 +320,8 @@ export const SellerNameSchema = z
|
|
|
311
320
|
export const SellerNameRequestSchema = z
|
|
312
321
|
.strictObject({
|
|
313
322
|
/**
|
|
314
|
-
* What buyers are to read beside this merchant's products
|
|
323
|
+
* What buyers are to read beside this merchant's products, where it is
|
|
324
|
+
* changing.
|
|
315
325
|
*
|
|
316
326
|
* The rule lives once, in `ServiceNameSchema`, and this reaches it through
|
|
317
327
|
* a string that carries its own words for "this is not a name at all". A
|
|
@@ -320,18 +330,36 @@ export const SellerNameRequestSchema = z
|
|
|
320
330
|
*/
|
|
321
331
|
seller_name: z
|
|
322
332
|
.string({
|
|
323
|
-
// A field
|
|
324
|
-
//
|
|
325
|
-
// sentence; the first falls through to the ordinary words about a
|
|
326
|
-
// field that is not there, which is what its author needs to read.
|
|
333
|
+
// A field holding null is a client with a misunderstanding, and only
|
|
334
|
+
// that gets this sentence.
|
|
327
335
|
error: (issue) => issue.input === undefined
|
|
328
336
|
? undefined
|
|
329
337
|
: "a seller name cannot be taken away, only changed: a merchant who wants to stop being listed pauses their selling, which leaves their cards where they can put them back on sale",
|
|
330
338
|
})
|
|
331
|
-
.pipe(ServiceNameSchema)
|
|
339
|
+
.pipe(ServiceNameSchema)
|
|
340
|
+
.optional(),
|
|
341
|
+
/**
|
|
342
|
+
* The https address of the merchant's own shop, where it is changing
|
|
343
|
+
* (ADR-0034). Like the name it is changed and never taken away: an agent
|
|
344
|
+
* holding an order that named a site has been told where to go, and a
|
|
345
|
+
* site that vanished from the same order would leave it nowhere.
|
|
346
|
+
*/
|
|
347
|
+
seller_site: z
|
|
348
|
+
.string({
|
|
349
|
+
error: (issue) => issue.input === undefined
|
|
350
|
+
? undefined
|
|
351
|
+
: "a seller's site cannot be taken away, only changed: send the address it has moved to",
|
|
352
|
+
})
|
|
353
|
+
.pipe(SellerSiteSchema)
|
|
354
|
+
.optional(),
|
|
355
|
+
})
|
|
356
|
+
.refine((asked) => asked.seller_name !== undefined || asked.seller_site !== undefined, {
|
|
357
|
+
// A client that dropped both fields has a bug, and is told what this call
|
|
358
|
+
// takes rather than anything about taking a name away.
|
|
359
|
+
message: "a request names seller_name, seller_site or both: one that names neither changes nothing",
|
|
332
360
|
})
|
|
333
361
|
.meta({
|
|
334
|
-
description: "What a merchant sends to change the name their products are sold under
|
|
362
|
+
description: "What a merchant sends to change the name their products are sold under, the address of their shop's own site, or both; a field left out stays as it was, and one of the two has to be there. The name is held to the catalog's rule rather than ours — at most 32 characters of printable ASCII — and is plain text. The site is an https origin and nothing after it, such as https://shop.example. Null is refused for either. A merchant goes from no name to a name and from one name to another, never back to none, because a payment request names the seller and there would be nobody to name: every card they have published would come off sale, which is an end to their selling arriving under the name of editing a setting. Somebody reaching for null wants one of two other things: a different name, which is this call with a different value, or an end to selling, which is the pause. A site is changed the same way and never taken away.",
|
|
335
363
|
});
|
|
336
364
|
/**
|
|
337
365
|
* A change of the wallet that has been asked for, announced, and has not taken
|
|
@@ -339,7 +367,7 @@ export const SellerNameRequestSchema = z
|
|
|
339
367
|
*
|
|
340
368
|
* It exists because a replacement does not apply at once where the money is
|
|
341
369
|
* real (ADR-0019). The address a merchant is paid at is the one setting whose
|
|
342
|
-
* change redirects money, and any key of theirs reaches it — the
|
|
370
|
+
* change redirects money, and any key of theirs reaches it — the dashboard's, or
|
|
343
371
|
* one sitting in their own server's environment — so on the live deployment a
|
|
344
372
|
* replacement is told to every account of the merchant first and takes effect
|
|
345
373
|
* forty-eight hours after that. What this document says is the two facts a
|
|
@@ -475,10 +503,10 @@ export const RegistrationRequestSchema = z
|
|
|
475
503
|
description: "What somebody sends to become a merchant: the invitation code they were given, and nothing else. The name their products are sold under is deliberately not here — it is a public answer, and asked for on the way in it is answered by somebody with no products and no idea what the name is for; it is set afterwards, and changed afterwards, through the merchant's own call for it. Nothing about an account is here either: an address and a password belong to whatever signs the person in, and are never sent to the gateway. A document carrying either is refused rather than trimmed, because a field accepted and dropped is somebody believing they said something.",
|
|
476
504
|
});
|
|
477
505
|
/**
|
|
478
|
-
* What registering answers with: a merchant and the key their
|
|
506
|
+
* What registering answers with: a merchant and the key their dashboard will call
|
|
479
507
|
* as them with.
|
|
480
508
|
*
|
|
481
|
-
* The key is made for a
|
|
509
|
+
* The key is made for a dashboard rather than for the merchant's own code, and
|
|
482
510
|
* that is what the caller of this route is. So it is in no list: a merchant who
|
|
483
511
|
* has just registered has no keys of their own at all, and the first one they
|
|
484
512
|
* do have is one they ask for. No row travels beside the secret for the same
|
|
@@ -497,5 +525,5 @@ export const RegisteredMerchantSchema = z
|
|
|
497
525
|
secret: KeySecretSchema,
|
|
498
526
|
})
|
|
499
527
|
.meta({
|
|
500
|
-
description: "What registering produced: the merchant, and the key whoever registered them will call as them with. The key is readable here and nowhere afterwards, so whoever made this call is the only party that can keep it. It is a key made for a
|
|
528
|
+
description: "What registering produced: the merchant, and the key whoever registered them will call as them with. The key is readable here and nowhere afterwards, so whoever made this call is the only party that can keep it. It is a key made for a dashboard rather than one of the merchant's own: it appears in no list of their keys and the call that revokes a key refuses its kind by name, so no row for it comes back here either. A merchant who has just registered has no keys of their own until they ask for one. The merchant is listed under no name yet and this answer carries none — the name their products are sold under is chosen afterwards, and until it is, publishing a card is refused. What this answer does not carry either is any notion of an account or a session: registering makes a merchant and a key, and whatever signs a person in is on the other side of this call.",
|
|
501
529
|
});
|
package/dist/primitives.d.ts
CHANGED
|
@@ -67,6 +67,18 @@ export declare const MoneySchema: z.ZodObject<{
|
|
|
67
67
|
*/
|
|
68
68
|
export declare const TimestampSchema: z.ZodISODateTime;
|
|
69
69
|
export declare const IdentifierSchema: z.ZodString;
|
|
70
|
+
/**
|
|
71
|
+
* A word of a vocabulary that grows without a version (ADR-0006 §5): a mode
|
|
72
|
+
* on the card an agent reads, a status on its order.
|
|
73
|
+
*
|
|
74
|
+
* The storefront has no version, so a word added later reaches agents that
|
|
75
|
+
* still hold this contract, and they read it rather than refuse the document.
|
|
76
|
+
* Open is not anything at all, though: a word is read by a program and shown
|
|
77
|
+
* to a person, so it has the shape every word in those lists already has —
|
|
78
|
+
* lower-case letters, digits and underscores, starting with a letter — and
|
|
79
|
+
* markup, padding or a page of text is not one.
|
|
80
|
+
*/
|
|
81
|
+
export declare const OpenWordSchema: z.ZodString;
|
|
70
82
|
/**
|
|
71
83
|
* The price a purchase actually went through at.
|
|
72
84
|
*
|
|
@@ -100,4 +112,5 @@ export type CurrencyCode = z.infer<typeof CurrencyCodeSchema>;
|
|
|
100
112
|
export type Money = z.infer<typeof MoneySchema>;
|
|
101
113
|
export type Timestamp = z.infer<typeof TimestampSchema>;
|
|
102
114
|
export type Identifier = z.infer<typeof IdentifierSchema>;
|
|
115
|
+
export type OpenWord = z.infer<typeof OpenWordSchema>;
|
|
103
116
|
export type SalePrice = z.infer<typeof SalePriceSchema>;
|
package/dist/primitives.js
CHANGED
|
@@ -100,6 +100,20 @@ export const IdentifierSchema = z.string().regex(
|
|
|
100
100
|
// then anything printable, then a last character under the same rule as the
|
|
101
101
|
// first. One character on its own is allowed; nothing at all is not.
|
|
102
102
|
new RegExp(`^[^\\s${UNPRINTABLE}](?:[^${UNPRINTABLE}]*[^\\s${UNPRINTABLE}])?$`, "u"), "an identifier must not be empty, padded with whitespace, or carry characters that show nothing");
|
|
103
|
+
/**
|
|
104
|
+
* A word of a vocabulary that grows without a version (ADR-0006 §5): a mode
|
|
105
|
+
* on the card an agent reads, a status on its order.
|
|
106
|
+
*
|
|
107
|
+
* The storefront has no version, so a word added later reaches agents that
|
|
108
|
+
* still hold this contract, and they read it rather than refuse the document.
|
|
109
|
+
* Open is not anything at all, though: a word is read by a program and shown
|
|
110
|
+
* to a person, so it has the shape every word in those lists already has —
|
|
111
|
+
* lower-case letters, digits and underscores, starting with a letter — and
|
|
112
|
+
* markup, padding or a page of text is not one.
|
|
113
|
+
*/
|
|
114
|
+
export const OpenWordSchema = z
|
|
115
|
+
.string()
|
|
116
|
+
.regex(/^[a-z][a-z0-9_]{0,63}$/, "a word of this vocabulary is lower-case letters, digits and underscores, starts with a letter and is at most sixty-four characters long");
|
|
103
117
|
/**
|
|
104
118
|
* The price a purchase actually went through at.
|
|
105
119
|
*
|
package/dist/results.d.ts
CHANGED
|
@@ -102,9 +102,10 @@ export declare const OrderCallResultSchema: z.ZodEnum<{
|
|
|
102
102
|
* merchant in its own words rather than be flattened into the nearest of
|
|
103
103
|
* three. `refund_already_settled` — the debt was paid back, so there is
|
|
104
104
|
* nothing left to deliver against. `order_already_closed` — the order reached
|
|
105
|
-
* an ending that no call reopens. `not_applicable_in_mode` — the call
|
|
106
|
-
* exist for this card's mode, as
|
|
107
|
-
*
|
|
105
|
+
* an ending that no call reopens. `not_applicable_in_mode` — the call or the
|
|
106
|
+
* answer does not exist for this card's mode, as delivering or refusing
|
|
107
|
+
* separately and taking the order on do not in the synchronous one, where the
|
|
108
|
+
* handler's own answer is the delivery or the refusal.
|
|
108
109
|
* `delivery_does_not_match_card` — the goods are not the ones the card for
|
|
109
110
|
* this order declares it delivers, so nothing was written down; the message
|
|
110
111
|
* says whether the order still stands or has already ended, and the fields
|
|
@@ -203,7 +204,7 @@ export declare const CARD_REJECTED = "card_rejected";
|
|
|
203
204
|
* merchant has no name set for buyers to read, no wallet set for their sales to
|
|
204
205
|
* be paid into, or no approval from the operator for the live catalog. The
|
|
205
206
|
* name is set with a call of the merchant's own (`POST /v0/seller-name`) or in
|
|
206
|
-
* the
|
|
207
|
+
* the dashboard; the wallet in the dashboard's Settings alone, since no key of the
|
|
207
208
|
* merchant's code may say where the money goes; and the approval is the
|
|
208
209
|
* operator's decision, with no call. The name is asked for everywhere, the
|
|
209
210
|
* wallet wherever a payment settles and the approval on the live deployment
|
package/dist/results.js
CHANGED
|
@@ -103,9 +103,10 @@ export const OrderCallResultSchema = z.enum(ORDER_CALL_RESULTS);
|
|
|
103
103
|
* merchant in its own words rather than be flattened into the nearest of
|
|
104
104
|
* three. `refund_already_settled` — the debt was paid back, so there is
|
|
105
105
|
* nothing left to deliver against. `order_already_closed` — the order reached
|
|
106
|
-
* an ending that no call reopens. `not_applicable_in_mode` — the call
|
|
107
|
-
* exist for this card's mode, as
|
|
108
|
-
*
|
|
106
|
+
* an ending that no call reopens. `not_applicable_in_mode` — the call or the
|
|
107
|
+
* answer does not exist for this card's mode, as delivering or refusing
|
|
108
|
+
* separately and taking the order on do not in the synchronous one, where the
|
|
109
|
+
* handler's own answer is the delivery or the refusal.
|
|
109
110
|
* `delivery_does_not_match_card` — the goods are not the ones the card for
|
|
110
111
|
* this order declares it delivers, so nothing was written down; the message
|
|
111
112
|
* says whether the order still stands or has already ended, and the fields
|
|
@@ -211,7 +212,7 @@ export const CallErrorSchema = z.strictObject({
|
|
|
211
212
|
code: z.string().regex(/\S/, "an error carries a code").meta({
|
|
212
213
|
// Same reason as the refusal code: the dictionary travels with the field
|
|
213
214
|
// or it does not reach the reader the export exists for.
|
|
214
|
-
description: 'Why the call did not go through. The set is open, and five are promised to mean one thing each — but not on the same calls, and which call a code can arrive on is part of what is promised about it. Publishing a card is refused with one word and no other: "card_rejected" (the card was not published, and every finding standing between it and the catalog is named in the error\'s problems — the fields at fault, and the merchant\'s own missing name, payout wallet or live operator approval where those are what is missing; it is never retryable, because the same card gets the same answer and what changes the outcome is fixing what the problems name). The calls that close an order — delivering, refusing, taking one on — are refused with the other four, and never with the first: "refund_already_settled" (the debt was paid back, so there is nothing left to deliver against). "order_already_closed" (the order reached an ending that no call reopens). "not_applicable_in_mode" (the call does not exist for this card\'s mode —
|
|
215
|
+
description: 'Why the call did not go through. The set is open, and five are promised to mean one thing each — but not on the same calls, and which call a code can arrive on is part of what is promised about it. Publishing a card is refused with one word and no other: "card_rejected" (the card was not published, and every finding standing between it and the catalog is named in the error\'s problems — the fields at fault, and the merchant\'s own missing name, payout wallet or live operator approval where those are what is missing; it is never retryable, because the same card gets the same answer and what changes the outcome is fixing what the problems name). The calls that close an order — delivering, refusing, taking one on — are refused with the other four, and never with the first: "refund_already_settled" (the debt was paid back, so there is nothing left to deliver against). "order_already_closed" (the order reached an ending that no call reopens). "not_applicable_in_mode" (the call or the answer does not exist for this card\'s mode — in the synchronous one the handler\'s own answer is the delivery or the refusal, so delivering or refusing separately does not exist there, and neither does taking an order on while it waits for its goods, which promises them later through a call that mode does not have). "delivery_does_not_match_card" (the goods are not the ones the card for this order declares it delivers — nothing was written down, the problems name the fields that did not fit, and the message says whether the order still stands or has already ended). The last of those is retryable in a different sense from a lost connection: the call arrived and was understood, so sending the same goods again gives the same refusal, and what clears it is delivering what the card declares. It is not retryable at all where the order has already ended, because there is nothing left to deliver against.',
|
|
215
216
|
}),
|
|
216
217
|
message: z.string().regex(/\S/, "an error carries an explanation a person can read"),
|
|
217
218
|
retryable: z.boolean(),
|
|
@@ -247,7 +248,7 @@ export const CARD_REJECTED = "card_rejected";
|
|
|
247
248
|
* merchant has no name set for buyers to read, no wallet set for their sales to
|
|
248
249
|
* be paid into, or no approval from the operator for the live catalog. The
|
|
249
250
|
* name is set with a call of the merchant's own (`POST /v0/seller-name`) or in
|
|
250
|
-
* the
|
|
251
|
+
* the dashboard; the wallet in the dashboard's Settings alone, since no key of the
|
|
251
252
|
* merchant's code may say where the money goes; and the approval is the
|
|
252
253
|
* operator's decision, with no call. The name is asked for everywhere, the
|
|
253
254
|
* wallet wherever a payment settles and the approval on the live deployment
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuanu-ai/agentify-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Agentify wire contract as code: the schemas for cards, orders, price checks and receipts that the gateway and the merchant SDK both read.",
|
|
6
6
|
"keywords": [
|