@substrat-run/contracts 0.195.0 → 0.197.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/attachments.d.ts +53 -0
- package/dist/attachments.d.ts.map +1 -1
- package/dist/attachments.js +50 -0
- package/dist/attachments.js.map +1 -1
- package/dist/commerce-source.d.ts +277 -0
- package/dist/commerce-source.d.ts.map +1 -0
- package/dist/commerce-source.js +167 -0
- package/dist/commerce-source.js.map +1 -0
- package/dist/deploy.d.ts +2 -0
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +10 -0
- package/dist/deploy.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/kernel-events.d.ts.map +1 -1
- package/dist/kernel-events.js +3 -1
- package/dist/kernel-events.js.map +1 -1
- package/dist/machine-client.d.ts +108 -0
- package/dist/machine-client.d.ts.map +1 -0
- package/dist/machine-client.js +128 -0
- package/dist/machine-client.js.map +1 -0
- package/dist/people.d.ts +60 -0
- package/dist/people.d.ts.map +1 -0
- package/dist/people.js +51 -0
- package/dist/people.js.map +1 -0
- package/package.json +1 -1
package/dist/attachments.d.ts
CHANGED
|
@@ -280,6 +280,59 @@ export declare const attachmentUploadLinkRevokedPayload: z.ZodObject<{
|
|
|
280
280
|
revokedBy: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
281
281
|
}, z.core.$strip>;
|
|
282
282
|
export type AttachmentUploadLinkRevokedPayload = z.infer<typeof attachmentUploadLinkRevokedPayload>;
|
|
283
|
+
/** What every download-link secret starts with — so a secret scanner can recognise a leaked one. */
|
|
284
|
+
export declare const DOWNLOAD_LINK_SECRET_PREFIX = "sbdl_";
|
|
285
|
+
/** The prefix, then 32 random bytes as unpadded base64url. Anything else is the 404 an unknown secret gets. */
|
|
286
|
+
export declare const DOWNLOAD_LINK_SECRET_SHAPE: RegExp;
|
|
287
|
+
/** Could `secret` be one the kernel minted? Says nothing about whether it names a link. */
|
|
288
|
+
export declare const isDownloadLinkSecretShape: (secret: unknown) => secret is string;
|
|
289
|
+
/** A download link lives fifteen minutes unless the mint says otherwise. */
|
|
290
|
+
export declare const DOWNLOAD_LINK_DEFAULT_TTL_SECONDS = 900;
|
|
291
|
+
/** ... and never more than a day: a bearer URL is copied, and a short life is what bounds that. */
|
|
292
|
+
export declare const DOWNLOAD_LINK_MAX_TTL_SECONDS = 86400;
|
|
293
|
+
/** Where a vertical mounts the redemption (`mountDownloadLinkRedeem` in `@substrat-run/vertical-host`). */
|
|
294
|
+
export declare const DOWNLOAD_LINK_PATH_PREFIX = "/api/attachment-downloads";
|
|
295
|
+
/** `ctx.attachments.mintDownloadUrl`'s input. */
|
|
296
|
+
export declare const downloadLinkMintInput: z.ZodObject<{
|
|
297
|
+
attachmentId: z.ZodString;
|
|
298
|
+
ttlSeconds: z.ZodOptional<z.ZodNumber>;
|
|
299
|
+
}, z.core.$strict>;
|
|
300
|
+
export type DownloadLinkMintInput = z.input<typeof downloadLinkMintInput>;
|
|
301
|
+
/** The path a link is read at — the secret last, the attachment in the path so a mismatch is the 404 an unknown secret gets. */
|
|
302
|
+
export declare function downloadLinkPath(attachmentId: string, secret: string): string;
|
|
303
|
+
/** What a mint returns. The `secret` (and the `path` that carries it) exists only here. */
|
|
304
|
+
export interface MintedDownloadLink {
|
|
305
|
+
id: string;
|
|
306
|
+
secret: string;
|
|
307
|
+
/** Join to the vertical's own public origin: `GET ${origin}${path}`. */
|
|
308
|
+
path: string;
|
|
309
|
+
expiresAt: string;
|
|
310
|
+
}
|
|
311
|
+
/** A download link was minted. Entity: the file's owner; actor: the minter. */
|
|
312
|
+
export declare const ATTACHMENT_DOWNLOAD_LINK_MINTED = "attachment.download-link-minted";
|
|
313
|
+
/** A download link was revoked before it expired. */
|
|
314
|
+
export declare const ATTACHMENT_DOWNLOAD_LINK_REVOKED = "attachment.download-link-revoked";
|
|
315
|
+
export declare const attachmentDownloadLinkMintedPayload: z.ZodObject<{
|
|
316
|
+
linkId: z.ZodString;
|
|
317
|
+
attachmentId: z.ZodString;
|
|
318
|
+
entity: z.ZodObject<{
|
|
319
|
+
entityType: z.ZodString;
|
|
320
|
+
entityId: z.ZodString;
|
|
321
|
+
}, z.core.$strip>;
|
|
322
|
+
expiresAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
323
|
+
mintedBy: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
324
|
+
}, z.core.$strip>;
|
|
325
|
+
export type AttachmentDownloadLinkMintedPayload = z.infer<typeof attachmentDownloadLinkMintedPayload>;
|
|
326
|
+
export declare const attachmentDownloadLinkRevokedPayload: z.ZodObject<{
|
|
327
|
+
linkId: z.ZodString;
|
|
328
|
+
attachmentId: z.ZodString;
|
|
329
|
+
entity: z.ZodObject<{
|
|
330
|
+
entityType: z.ZodString;
|
|
331
|
+
entityId: z.ZodString;
|
|
332
|
+
}, z.core.$strip>;
|
|
333
|
+
revokedBy: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
334
|
+
}, z.core.$strip>;
|
|
335
|
+
export type AttachmentDownloadLinkRevokedPayload = z.infer<typeof attachmentDownloadLinkRevokedPayload>;
|
|
283
336
|
/**
|
|
284
337
|
* How many bytes a connector upload's metadata takes on the wire: its JSON, URI-encoded, which is
|
|
285
338
|
* what the stream route's header carries. The multipart route carries the same JSON in a field and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../src/attachments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,UAAU;;;EAAmC,CAAC;AAC3D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;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223,56 @@ export const attachmentUploadLinkRevokedPayload = z.object({
|
|
|
223
223
|
entity: entityRef,
|
|
224
224
|
revokedBy: principalId,
|
|
225
225
|
});
|
|
226
|
+
// -- download links (#3139) -------------------------------------------------------
|
|
227
|
+
//
|
|
228
|
+
// The read-side counterpart of an upload link: a URL that lets whoever holds it read ONE
|
|
229
|
+
// attachment, for a short while, with no session — an `<audio>` element on another origin, a
|
|
230
|
+
// file an MCP tool hands back, a link in a mail. Like an upload link it never acts as anyone:
|
|
231
|
+
// redemption opens the file through the ordinary read surface AS THE MINTER, so the target's
|
|
232
|
+
// `readPermission` is checked again on every request, and a minter who loses it takes every link
|
|
233
|
+
// they minted with them. Unlike an upload link it is not spent by a read: a media element reads a
|
|
234
|
+
// file in many ranged requests, so a link is good until it expires or is revoked.
|
|
235
|
+
// ---------------------------------------------------------------------------
|
|
236
|
+
/** What every download-link secret starts with — so a secret scanner can recognise a leaked one. */
|
|
237
|
+
export const DOWNLOAD_LINK_SECRET_PREFIX = 'sbdl_';
|
|
238
|
+
/** The prefix, then 32 random bytes as unpadded base64url. Anything else is the 404 an unknown secret gets. */
|
|
239
|
+
export const DOWNLOAD_LINK_SECRET_SHAPE = /^sbdl_[A-Za-z0-9_-]{43}$/;
|
|
240
|
+
/** Could `secret` be one the kernel minted? Says nothing about whether it names a link. */
|
|
241
|
+
export const isDownloadLinkSecretShape = (secret) => typeof secret === 'string' && DOWNLOAD_LINK_SECRET_SHAPE.test(secret);
|
|
242
|
+
/** A download link lives fifteen minutes unless the mint says otherwise. */
|
|
243
|
+
export const DOWNLOAD_LINK_DEFAULT_TTL_SECONDS = 900;
|
|
244
|
+
/** ... and never more than a day: a bearer URL is copied, and a short life is what bounds that. */
|
|
245
|
+
export const DOWNLOAD_LINK_MAX_TTL_SECONDS = 86_400;
|
|
246
|
+
/** Where a vertical mounts the redemption (`mountDownloadLinkRedeem` in `@substrat-run/vertical-host`). */
|
|
247
|
+
export const DOWNLOAD_LINK_PATH_PREFIX = '/api/attachment-downloads';
|
|
248
|
+
/** `ctx.attachments.mintDownloadUrl`'s input. */
|
|
249
|
+
export const downloadLinkMintInput = z
|
|
250
|
+
.object({
|
|
251
|
+
attachmentId: z.string().min(1).max(255),
|
|
252
|
+
ttlSeconds: z.number().int().positive().max(DOWNLOAD_LINK_MAX_TTL_SECONDS).optional(),
|
|
253
|
+
})
|
|
254
|
+
.strict();
|
|
255
|
+
/** The path a link is read at — the secret last, the attachment in the path so a mismatch is the 404 an unknown secret gets. */
|
|
256
|
+
export function downloadLinkPath(attachmentId, secret) {
|
|
257
|
+
return `${DOWNLOAD_LINK_PATH_PREFIX}/${encodeURIComponent(attachmentId)}/${secret}`;
|
|
258
|
+
}
|
|
259
|
+
/** A download link was minted. Entity: the file's owner; actor: the minter. */
|
|
260
|
+
export const ATTACHMENT_DOWNLOAD_LINK_MINTED = 'attachment.download-link-minted';
|
|
261
|
+
/** A download link was revoked before it expired. */
|
|
262
|
+
export const ATTACHMENT_DOWNLOAD_LINK_REVOKED = 'attachment.download-link-revoked';
|
|
263
|
+
export const attachmentDownloadLinkMintedPayload = z.object({
|
|
264
|
+
linkId: z.string().min(1),
|
|
265
|
+
attachmentId: z.string().min(1),
|
|
266
|
+
entity: entityRef,
|
|
267
|
+
expiresAt: instant,
|
|
268
|
+
mintedBy: principalId,
|
|
269
|
+
});
|
|
270
|
+
export const attachmentDownloadLinkRevokedPayload = z.object({
|
|
271
|
+
linkId: z.string().min(1),
|
|
272
|
+
attachmentId: z.string().min(1),
|
|
273
|
+
entity: entityRef,
|
|
274
|
+
revokedBy: principalId,
|
|
275
|
+
});
|
|
226
276
|
// -- connector upload bounds (#2516) --------------------------------------------
|
|
227
277
|
/**
|
|
228
278
|
* How many bytes a connector upload's metadata takes on the wire: its JSON, URI-encoded, which is
|
package/dist/attachments.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachments.js","sourceRoot":"","sources":["../src/attachments.ts"],"names":[],"mappings":"AAAA,O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AgC,KAAK,gCAAgC;QACrE,GAAG,mCAAmC,qEAAqE,CAC5G,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAExE;;;;GAIG;AACH,MAAM,CAAC,MAAM,6CAA6C,GAAG,EAAE,GAAG,IAAI,CAAC;AAEvE,oHAAoH;AACpH,MAAM,UAAU,8BAA8B,CAAC,QAAgB;IAC7D,OAAO,CACL,2BAA2B,QAAQ,oBAAoB,qCAAqC,QAAQ;QACpG,sCAAsC,CACvC,CAAC;AACJ,CAAC;AAED,wHAAwH;AACxH,MAAM,UAAU,kCAAkC,CAAC,KAAa;IAC9D,OAAO,CACL,qBAAqB,KAAK,oBAAoB,uCAAuC,cAAc;QACnG,mEAAmE,uCAAuC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CACjI,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAC,KAAc;IAC3D,MAAM,KAAK,GAAG,uCAAuC,GAAG,6CAA6C,CAAC;IACtG,OAAO,CACL,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,iCAAiC,KAAK,aAAa,CAAC,CAAC,CAAC,uBAAuB,KAAK,oBAAoB,KAAK,aAAa,CAAC;QAChJ,2GAA2G,uCAAuC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CACzK,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Commerce-source vocabulary (#3136): what a vertical sees of an online store, whichever store
|
|
4
|
+
* platform it runs on.
|
|
5
|
+
*
|
|
6
|
+
* A commerce source is a connector whose far side is a shop: products with their variants, and the
|
|
7
|
+
* orders placed for them. The first is WooCommerce; Shopify is the second this vocabulary is checked
|
|
8
|
+
* against. A vertical codes against these names, so swapping one store platform for another keeps
|
|
9
|
+
* its landing operation, its tables and the schemas it parses. The CONNECTION is still the
|
|
10
|
+
* provider's (its credential, its probe, its binding), and so is any event type a later write
|
|
11
|
+
* travels under: the type is what routes a delivery to a provider's connector, so a neutral type
|
|
12
|
+
* could not say which one to run.
|
|
13
|
+
*
|
|
14
|
+
* One shape crosses today, {@link commerceChange}, landed through the vertical's own operation, one
|
|
15
|
+
* product or one order per invoke. The invariants a provider's sync loop holds, which no schema
|
|
16
|
+
* here can:
|
|
17
|
+
*
|
|
18
|
+
* - **Delivery is at least once, keyed by the provider's id.** A landing operation upserts by
|
|
19
|
+
* `productId` or `orderId` and may see the same change twice, or an older change after a newer
|
|
20
|
+
* one was retried. `modifiedAt` is what tells them apart.
|
|
21
|
+
* - **Money is a decimal string with its currency.** Never a float, and never reshaped: a provider
|
|
22
|
+
* amount that is not a decimal is refused by the connector rather than rounded into one.
|
|
23
|
+
* - **Every product has at least one variant.** A store platform that sells a product without
|
|
24
|
+
* variants (a WooCommerce simple product) lands it with one variant whose id is the product's,
|
|
25
|
+
* so a vertical prices, stocks and sells variants and never branches on the platform.
|
|
26
|
+
* - **An order line names the variant it sold**, by the same id a product change carries, or
|
|
27
|
+
* `null` when the line sold nothing the catalogue holds (a custom line, a deleted product).
|
|
28
|
+
*
|
|
29
|
+
* What is NOT here, by decision:
|
|
30
|
+
*
|
|
31
|
+
* - **Deletes.** A store's "changed since" listing does not list what was deleted, so a delete
|
|
32
|
+
* needs its own signal; `change` is a discriminator so it can be added without a bump.
|
|
33
|
+
* - **Stock levels.** Stock moves on every sale, is shared between variants on some platforms and
|
|
34
|
+
* fractional on others, and wants its own shape and its own freshness rule.
|
|
35
|
+
* - **Fulfilment, refunds and customers as records of their own.** An order carries the customer it
|
|
36
|
+
* was placed by, as the order states it; a customer register is a later shape.
|
|
37
|
+
* - **Write requests** (set stock, mark an order fulfilled) and the shared `CommerceSource` facet:
|
|
38
|
+
* both wait for a second store platform, so they are extracted from two implementations rather
|
|
39
|
+
* than designed from one.
|
|
40
|
+
*
|
|
41
|
+
* An order carries personal data (a name, an email address, postal addresses). A vertical that
|
|
42
|
+
* lands it declares those columns as such.
|
|
43
|
+
*/
|
|
44
|
+
/** A postal address as an order states it. Blank parts are `''`, not absent. */
|
|
45
|
+
export declare const commerceAddress: z.ZodObject<{
|
|
46
|
+
firstName: z.ZodString;
|
|
47
|
+
lastName: z.ZodString;
|
|
48
|
+
company: z.ZodString;
|
|
49
|
+
line1: z.ZodString;
|
|
50
|
+
line2: z.ZodString;
|
|
51
|
+
city: z.ZodString;
|
|
52
|
+
region: z.ZodString;
|
|
53
|
+
postalCode: z.ZodString;
|
|
54
|
+
country: z.ZodString;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export type CommerceAddress = z.infer<typeof commerceAddress>;
|
|
57
|
+
/** One option a variant is picked by, e.g. `{ name: 'Size', value: 'M' }`. */
|
|
58
|
+
export declare const commerceVariantOption: z.ZodObject<{
|
|
59
|
+
name: z.ZodString;
|
|
60
|
+
value: z.ZodString;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
/** One sellable variant of a product. */
|
|
63
|
+
export declare const commerceVariant: z.ZodObject<{
|
|
64
|
+
variantId: z.ZodString;
|
|
65
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
66
|
+
title: z.ZodNullable<z.ZodString>;
|
|
67
|
+
options: z.ZodArray<z.ZodObject<{
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
value: z.ZodString;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
price: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">>;
|
|
72
|
+
compareAtPrice: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export type CommerceVariant = z.infer<typeof commerceVariant>;
|
|
75
|
+
/**
|
|
76
|
+
* A product as it now stands at the store, with every variant it sells.
|
|
77
|
+
*
|
|
78
|
+
* `listed` is the one fact a vertical branches on for visibility: the product is published for sale
|
|
79
|
+
* (WooCommerce `publish`, Shopify `active`). `providerStatus` is the store's own word for display;
|
|
80
|
+
* branching on it binds a vertical to one platform.
|
|
81
|
+
*/
|
|
82
|
+
export declare const commerceProductUpsert: z.ZodObject<{
|
|
83
|
+
record: z.ZodLiteral<"product">;
|
|
84
|
+
change: z.ZodLiteral<"upsert">;
|
|
85
|
+
connectionId: z.ZodString;
|
|
86
|
+
productId: z.ZodString;
|
|
87
|
+
name: z.ZodString;
|
|
88
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
89
|
+
url: z.ZodNullable<z.ZodString>;
|
|
90
|
+
listed: z.ZodBoolean;
|
|
91
|
+
providerStatus: z.ZodString;
|
|
92
|
+
currency: z.core.$ZodBranded<z.ZodString, "CurrencyCode", "out">;
|
|
93
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
94
|
+
variantId: z.ZodString;
|
|
95
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
96
|
+
title: z.ZodNullable<z.ZodString>;
|
|
97
|
+
options: z.ZodArray<z.ZodObject<{
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
value: z.ZodString;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
price: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">>;
|
|
102
|
+
compareAtPrice: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">>;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
createdAt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
105
|
+
modifiedAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export type CommerceProductUpsert = z.infer<typeof commerceProductUpsert>;
|
|
108
|
+
/** One line of an order. */
|
|
109
|
+
export declare const commerceOrderLine: z.ZodObject<{
|
|
110
|
+
lineId: z.ZodString;
|
|
111
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
112
|
+
variantId: z.ZodNullable<z.ZodString>;
|
|
113
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
114
|
+
name: z.ZodString;
|
|
115
|
+
quantity: z.ZodNumber;
|
|
116
|
+
subtotal: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
117
|
+
total: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
118
|
+
tax: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
export type CommerceOrderLine = z.infer<typeof commerceOrderLine>;
|
|
121
|
+
/**
|
|
122
|
+
* An order as it now stands at the store.
|
|
123
|
+
*
|
|
124
|
+
* `paidAt` and `cancelled` are the two facts a vertical branches on; `providerStatus` is the
|
|
125
|
+
* store's own word for display. `total` is what was charged, tax and shipping included. The
|
|
126
|
+
* breakdown (`taxTotal`, `shippingTotal`, `discountTotal`) is the store's, and is not promised to
|
|
127
|
+
* sum to `total` under one rule across platforms: a vertical that needs it to reconciles it itself.
|
|
128
|
+
*/
|
|
129
|
+
export declare const commerceOrderUpsert: z.ZodObject<{
|
|
130
|
+
record: z.ZodLiteral<"order">;
|
|
131
|
+
change: z.ZodLiteral<"upsert">;
|
|
132
|
+
connectionId: z.ZodString;
|
|
133
|
+
orderId: z.ZodString;
|
|
134
|
+
number: z.ZodString;
|
|
135
|
+
providerStatus: z.ZodString;
|
|
136
|
+
paidAt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
137
|
+
cancelled: z.ZodBoolean;
|
|
138
|
+
currency: z.core.$ZodBranded<z.ZodString, "CurrencyCode", "out">;
|
|
139
|
+
total: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
140
|
+
taxTotal: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
141
|
+
shippingTotal: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
142
|
+
discountTotal: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
143
|
+
customer: z.ZodObject<{
|
|
144
|
+
customerId: z.ZodNullable<z.ZodString>;
|
|
145
|
+
email: z.ZodNullable<z.ZodString>;
|
|
146
|
+
firstName: z.ZodString;
|
|
147
|
+
lastName: z.ZodString;
|
|
148
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
billingAddress: z.ZodNullable<z.ZodObject<{
|
|
151
|
+
firstName: z.ZodString;
|
|
152
|
+
lastName: z.ZodString;
|
|
153
|
+
company: z.ZodString;
|
|
154
|
+
line1: z.ZodString;
|
|
155
|
+
line2: z.ZodString;
|
|
156
|
+
city: z.ZodString;
|
|
157
|
+
region: z.ZodString;
|
|
158
|
+
postalCode: z.ZodString;
|
|
159
|
+
country: z.ZodString;
|
|
160
|
+
}, z.core.$strip>>;
|
|
161
|
+
shippingAddress: z.ZodNullable<z.ZodObject<{
|
|
162
|
+
firstName: z.ZodString;
|
|
163
|
+
lastName: z.ZodString;
|
|
164
|
+
company: z.ZodString;
|
|
165
|
+
line1: z.ZodString;
|
|
166
|
+
line2: z.ZodString;
|
|
167
|
+
city: z.ZodString;
|
|
168
|
+
region: z.ZodString;
|
|
169
|
+
postalCode: z.ZodString;
|
|
170
|
+
country: z.ZodString;
|
|
171
|
+
}, z.core.$strip>>;
|
|
172
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
173
|
+
lineId: z.ZodString;
|
|
174
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
175
|
+
variantId: z.ZodNullable<z.ZodString>;
|
|
176
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
177
|
+
name: z.ZodString;
|
|
178
|
+
quantity: z.ZodNumber;
|
|
179
|
+
subtotal: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
180
|
+
total: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
181
|
+
tax: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
182
|
+
}, z.core.$strip>>;
|
|
183
|
+
customerNote: z.ZodNullable<z.ZodString>;
|
|
184
|
+
createdAt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
185
|
+
modifiedAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
186
|
+
}, z.core.$strip>;
|
|
187
|
+
export type CommerceOrderUpsert = z.infer<typeof commerceOrderUpsert>;
|
|
188
|
+
/**
|
|
189
|
+
* What a sync lands through the binding's operation, one record per invoke — parsed with this
|
|
190
|
+
* schema on the way out, so a vertical compiled against one version of a connector gets a throw
|
|
191
|
+
* rather than a reshaped record from another. `record` says which; `change` is `upsert` for both
|
|
192
|
+
* today (see "What is NOT here").
|
|
193
|
+
*/
|
|
194
|
+
export declare const commerceChange: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
195
|
+
record: z.ZodLiteral<"product">;
|
|
196
|
+
change: z.ZodLiteral<"upsert">;
|
|
197
|
+
connectionId: z.ZodString;
|
|
198
|
+
productId: z.ZodString;
|
|
199
|
+
name: z.ZodString;
|
|
200
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
201
|
+
url: z.ZodNullable<z.ZodString>;
|
|
202
|
+
listed: z.ZodBoolean;
|
|
203
|
+
providerStatus: z.ZodString;
|
|
204
|
+
currency: z.core.$ZodBranded<z.ZodString, "CurrencyCode", "out">;
|
|
205
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
206
|
+
variantId: z.ZodString;
|
|
207
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
208
|
+
title: z.ZodNullable<z.ZodString>;
|
|
209
|
+
options: z.ZodArray<z.ZodObject<{
|
|
210
|
+
name: z.ZodString;
|
|
211
|
+
value: z.ZodString;
|
|
212
|
+
}, z.core.$strip>>;
|
|
213
|
+
price: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">>;
|
|
214
|
+
compareAtPrice: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">>;
|
|
215
|
+
}, z.core.$strip>>;
|
|
216
|
+
createdAt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
217
|
+
modifiedAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
218
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
219
|
+
record: z.ZodLiteral<"order">;
|
|
220
|
+
change: z.ZodLiteral<"upsert">;
|
|
221
|
+
connectionId: z.ZodString;
|
|
222
|
+
orderId: z.ZodString;
|
|
223
|
+
number: z.ZodString;
|
|
224
|
+
providerStatus: z.ZodString;
|
|
225
|
+
paidAt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
226
|
+
cancelled: z.ZodBoolean;
|
|
227
|
+
currency: z.core.$ZodBranded<z.ZodString, "CurrencyCode", "out">;
|
|
228
|
+
total: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
229
|
+
taxTotal: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
230
|
+
shippingTotal: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
231
|
+
discountTotal: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
232
|
+
customer: z.ZodObject<{
|
|
233
|
+
customerId: z.ZodNullable<z.ZodString>;
|
|
234
|
+
email: z.ZodNullable<z.ZodString>;
|
|
235
|
+
firstName: z.ZodString;
|
|
236
|
+
lastName: z.ZodString;
|
|
237
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
238
|
+
}, z.core.$strip>;
|
|
239
|
+
billingAddress: z.ZodNullable<z.ZodObject<{
|
|
240
|
+
firstName: z.ZodString;
|
|
241
|
+
lastName: z.ZodString;
|
|
242
|
+
company: z.ZodString;
|
|
243
|
+
line1: z.ZodString;
|
|
244
|
+
line2: z.ZodString;
|
|
245
|
+
city: z.ZodString;
|
|
246
|
+
region: z.ZodString;
|
|
247
|
+
postalCode: z.ZodString;
|
|
248
|
+
country: z.ZodString;
|
|
249
|
+
}, z.core.$strip>>;
|
|
250
|
+
shippingAddress: z.ZodNullable<z.ZodObject<{
|
|
251
|
+
firstName: z.ZodString;
|
|
252
|
+
lastName: z.ZodString;
|
|
253
|
+
company: z.ZodString;
|
|
254
|
+
line1: z.ZodString;
|
|
255
|
+
line2: z.ZodString;
|
|
256
|
+
city: z.ZodString;
|
|
257
|
+
region: z.ZodString;
|
|
258
|
+
postalCode: z.ZodString;
|
|
259
|
+
country: z.ZodString;
|
|
260
|
+
}, z.core.$strip>>;
|
|
261
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
262
|
+
lineId: z.ZodString;
|
|
263
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
264
|
+
variantId: z.ZodNullable<z.ZodString>;
|
|
265
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
266
|
+
name: z.ZodString;
|
|
267
|
+
quantity: z.ZodNumber;
|
|
268
|
+
subtotal: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
269
|
+
total: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
270
|
+
tax: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
271
|
+
}, z.core.$strip>>;
|
|
272
|
+
customerNote: z.ZodNullable<z.ZodString>;
|
|
273
|
+
createdAt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
274
|
+
modifiedAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
275
|
+
}, z.core.$strip>], "record">;
|
|
276
|
+
export type CommerceChange = z.infer<typeof commerceChange>;
|
|
277
|
+
//# sourceMappingURL=commerce-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commerce-source.d.ts","sourceRo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AO,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { instant } from './ids.js';
|
|
3
|
+
import { currencyCode, moneyAmount } from './money.js';
|
|
4
|
+
/**
|
|
5
|
+
* Commerce-source vocabulary (#3136): what a vertical sees of an online store, whichever store
|
|
6
|
+
* platform it runs on.
|
|
7
|
+
*
|
|
8
|
+
* A commerce source is a connector whose far side is a shop: products with their variants, and the
|
|
9
|
+
* orders placed for them. The first is WooCommerce; Shopify is the second this vocabulary is checked
|
|
10
|
+
* against. A vertical codes against these names, so swapping one store platform for another keeps
|
|
11
|
+
* its landing operation, its tables and the schemas it parses. The CONNECTION is still the
|
|
12
|
+
* provider's (its credential, its probe, its binding), and so is any event type a later write
|
|
13
|
+
* travels under: the type is what routes a delivery to a provider's connector, so a neutral type
|
|
14
|
+
* could not say which one to run.
|
|
15
|
+
*
|
|
16
|
+
* One shape crosses today, {@link commerceChange}, landed through the vertical's own operation, one
|
|
17
|
+
* product or one order per invoke. The invariants a provider's sync loop holds, which no schema
|
|
18
|
+
* here can:
|
|
19
|
+
*
|
|
20
|
+
* - **Delivery is at least once, keyed by the provider's id.** A landing operation upserts by
|
|
21
|
+
* `productId` or `orderId` and may see the same change twice, or an older change after a newer
|
|
22
|
+
* one was retried. `modifiedAt` is what tells them apart.
|
|
23
|
+
* - **Money is a decimal string with its currency.** Never a float, and never reshaped: a provider
|
|
24
|
+
* amount that is not a decimal is refused by the connector rather than rounded into one.
|
|
25
|
+
* - **Every product has at least one variant.** A store platform that sells a product without
|
|
26
|
+
* variants (a WooCommerce simple product) lands it with one variant whose id is the product's,
|
|
27
|
+
* so a vertical prices, stocks and sells variants and never branches on the platform.
|
|
28
|
+
* - **An order line names the variant it sold**, by the same id a product change carries, or
|
|
29
|
+
* `null` when the line sold nothing the catalogue holds (a custom line, a deleted product).
|
|
30
|
+
*
|
|
31
|
+
* What is NOT here, by decision:
|
|
32
|
+
*
|
|
33
|
+
* - **Deletes.** A store's "changed since" listing does not list what was deleted, so a delete
|
|
34
|
+
* needs its own signal; `change` is a discriminator so it can be added without a bump.
|
|
35
|
+
* - **Stock levels.** Stock moves on every sale, is shared between variants on some platforms and
|
|
36
|
+
* fractional on others, and wants its own shape and its own freshness rule.
|
|
37
|
+
* - **Fulfilment, refunds and customers as records of their own.** An order carries the customer it
|
|
38
|
+
* was placed by, as the order states it; a customer register is a later shape.
|
|
39
|
+
* - **Write requests** (set stock, mark an order fulfilled) and the shared `CommerceSource` facet:
|
|
40
|
+
* both wait for a second store platform, so they are extracted from two implementations rather
|
|
41
|
+
* than designed from one.
|
|
42
|
+
*
|
|
43
|
+
* An order carries personal data (a name, an email address, postal addresses). A vertical that
|
|
44
|
+
* lands it declares those columns as such.
|
|
45
|
+
*/
|
|
46
|
+
/** A postal address as an order states it. Blank parts are `''`, not absent. */
|
|
47
|
+
export const commerceAddress = z.object({
|
|
48
|
+
firstName: z.string(),
|
|
49
|
+
lastName: z.string(),
|
|
50
|
+
company: z.string(),
|
|
51
|
+
line1: z.string(),
|
|
52
|
+
line2: z.string(),
|
|
53
|
+
city: z.string(),
|
|
54
|
+
/** State, county or province — a code or a name, as the store recorded it. */
|
|
55
|
+
region: z.string(),
|
|
56
|
+
postalCode: z.string(),
|
|
57
|
+
/** ISO 3166-1 alpha-2 where the store records one; `''` when it does not. */
|
|
58
|
+
country: z.string(),
|
|
59
|
+
});
|
|
60
|
+
/** One option a variant is picked by, e.g. `{ name: 'Size', value: 'M' }`. */
|
|
61
|
+
export const commerceVariantOption = z.object({ name: z.string(), value: z.string() });
|
|
62
|
+
/** One sellable variant of a product. */
|
|
63
|
+
export const commerceVariant = z.object({
|
|
64
|
+
/** The variant's id at the store. For a product without variants, the product's own id. */
|
|
65
|
+
variantId: z.string().min(1),
|
|
66
|
+
sku: z.string().nullable(),
|
|
67
|
+
/** A label for the variant, when the store gives one; `null` for a product's only variant. */
|
|
68
|
+
title: z.string().nullable(),
|
|
69
|
+
options: z.array(commerceVariantOption),
|
|
70
|
+
/** What the variant sells for now, in the product's currency. `null` when the store has no price set. */
|
|
71
|
+
price: moneyAmount.nullable(),
|
|
72
|
+
/**
|
|
73
|
+
* The higher price `price` is shown against when the variant is on sale, or `null`. Only set when
|
|
74
|
+
* it is greater than `price`, so a vertical can show it struck through without comparing.
|
|
75
|
+
*/
|
|
76
|
+
compareAtPrice: moneyAmount.nullable(),
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* A product as it now stands at the store, with every variant it sells.
|
|
80
|
+
*
|
|
81
|
+
* `listed` is the one fact a vertical branches on for visibility: the product is published for sale
|
|
82
|
+
* (WooCommerce `publish`, Shopify `active`). `providerStatus` is the store's own word for display;
|
|
83
|
+
* branching on it binds a vertical to one platform.
|
|
84
|
+
*/
|
|
85
|
+
export const commerceProductUpsert = z.object({
|
|
86
|
+
record: z.literal('product'),
|
|
87
|
+
change: z.literal('upsert'),
|
|
88
|
+
connectionId: z.string().min(1),
|
|
89
|
+
/** The product's id at the store — the stable key. */
|
|
90
|
+
productId: z.string().min(1),
|
|
91
|
+
name: z.string(),
|
|
92
|
+
slug: z.string().nullable(),
|
|
93
|
+
/** The product's public page, when it has one. */
|
|
94
|
+
url: z.string().nullable(),
|
|
95
|
+
listed: z.boolean(),
|
|
96
|
+
providerStatus: z.string(),
|
|
97
|
+
/** The currency every price on this product is in: the store's, since a product states none. */
|
|
98
|
+
currency: currencyCode,
|
|
99
|
+
variants: z.array(commerceVariant).min(1),
|
|
100
|
+
createdAt: instant.nullable(),
|
|
101
|
+
modifiedAt: instant,
|
|
102
|
+
});
|
|
103
|
+
/** One line of an order. */
|
|
104
|
+
export const commerceOrderLine = z.object({
|
|
105
|
+
lineId: z.string().min(1),
|
|
106
|
+
/** The product sold, or `null` for a line the catalogue does not hold. */
|
|
107
|
+
productId: z.string().nullable(),
|
|
108
|
+
/** The variant sold, by the id its product change carries, or `null` as for `productId`. */
|
|
109
|
+
variantId: z.string().nullable(),
|
|
110
|
+
sku: z.string().nullable(),
|
|
111
|
+
/** The line's name as it was sold — kept, since the product may since have been renamed. */
|
|
112
|
+
name: z.string(),
|
|
113
|
+
quantity: z.number().int(),
|
|
114
|
+
/** Before discounts, excluding tax. */
|
|
115
|
+
subtotal: moneyAmount,
|
|
116
|
+
/** After discounts, excluding tax. */
|
|
117
|
+
total: moneyAmount,
|
|
118
|
+
/** The tax on `total`. */
|
|
119
|
+
tax: moneyAmount,
|
|
120
|
+
});
|
|
121
|
+
/**
|
|
122
|
+
* An order as it now stands at the store.
|
|
123
|
+
*
|
|
124
|
+
* `paidAt` and `cancelled` are the two facts a vertical branches on; `providerStatus` is the
|
|
125
|
+
* store's own word for display. `total` is what was charged, tax and shipping included. The
|
|
126
|
+
* breakdown (`taxTotal`, `shippingTotal`, `discountTotal`) is the store's, and is not promised to
|
|
127
|
+
* sum to `total` under one rule across platforms: a vertical that needs it to reconciles it itself.
|
|
128
|
+
*/
|
|
129
|
+
export const commerceOrderUpsert = z.object({
|
|
130
|
+
record: z.literal('order'),
|
|
131
|
+
change: z.literal('upsert'),
|
|
132
|
+
connectionId: z.string().min(1),
|
|
133
|
+
/** The order's id at the store — the stable key. */
|
|
134
|
+
orderId: z.string().min(1),
|
|
135
|
+
/** The order number a customer sees, which need not be the id. */
|
|
136
|
+
number: z.string(),
|
|
137
|
+
providerStatus: z.string(),
|
|
138
|
+
paidAt: instant.nullable(),
|
|
139
|
+
cancelled: z.boolean(),
|
|
140
|
+
currency: currencyCode,
|
|
141
|
+
total: moneyAmount,
|
|
142
|
+
taxTotal: moneyAmount,
|
|
143
|
+
shippingTotal: moneyAmount,
|
|
144
|
+
discountTotal: moneyAmount,
|
|
145
|
+
customer: z.object({
|
|
146
|
+
/** The customer's account at the store, or `null` for a guest checkout. */
|
|
147
|
+
customerId: z.string().nullable(),
|
|
148
|
+
email: z.string().nullable(),
|
|
149
|
+
firstName: z.string(),
|
|
150
|
+
lastName: z.string(),
|
|
151
|
+
phone: z.string().nullable(),
|
|
152
|
+
}),
|
|
153
|
+
billingAddress: commerceAddress.nullable(),
|
|
154
|
+
shippingAddress: commerceAddress.nullable(),
|
|
155
|
+
lines: z.array(commerceOrderLine),
|
|
156
|
+
customerNote: z.string().nullable(),
|
|
157
|
+
createdAt: instant.nullable(),
|
|
158
|
+
modifiedAt: instant,
|
|
159
|
+
});
|
|
160
|
+
/**
|
|
161
|
+
* What a sync lands through the binding's operation, one record per invoke — parsed with this
|
|
162
|
+
* schema on the way out, so a vertical compiled against one version of a connector gets a throw
|
|
163
|
+
* rather than a reshaped record from another. `record` says which; `change` is `upsert` for both
|
|
164
|
+
* today (see "What is NOT here").
|
|
165
|
+
*/
|
|
166
|
+
export const commerceChange = z.discriminatedUnion('record', [commerceProductUpsert, commerceOrderUpsert]);
|
|
167
|
+
//# sourceMappingURL=commerce-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commerce-source.js","sourceRoot":"","sources":["../src/commerce-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,8EAA8E;IAC9E,MAAM,EAAE,CAAC,CAAC,MAAM,E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
|
package/dist/deploy.d.ts
CHANGED
|
@@ -1711,6 +1711,7 @@ export declare const deployManifest: z.ZodObject<{
|
|
|
1711
1711
|
binds: z.ZodBoolean;
|
|
1712
1712
|
dispatches: z.ZodBoolean;
|
|
1713
1713
|
}, z.core.$strict>>>;
|
|
1714
|
+
issuerScopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1714
1715
|
sendsEmail: z.ZodOptional<z.ZodBoolean>;
|
|
1715
1716
|
lifecycle: z.ZodOptional<z.ZodEnum<{
|
|
1716
1717
|
router: "router";
|
|
@@ -1987,6 +1988,7 @@ export declare const storedDeployManifest: z.ZodObject<{
|
|
|
1987
1988
|
binds: z.ZodBoolean;
|
|
1988
1989
|
dispatches: z.ZodBoolean;
|
|
1989
1990
|
}, z.core.$strict>>>;
|
|
1991
|
+
issuerScopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1990
1992
|
sendsEmail: z.ZodOptional<z.ZodBoolean>;
|
|
1991
1993
|
lifecycle: z.ZodOptional<z.ZodEnum<{
|
|
1992
1994
|
router: "router";
|