@substrat-run/contracts 0.204.0 → 0.206.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/ci.d.ts +46 -0
- package/dist/ci.d.ts.map +1 -1
- package/dist/ci.js +75 -9
- package/dist/ci.js.map +1 -1
- package/dist/commerce-source.d.ts +11 -8
- package/dist/commerce-source.d.ts.map +1 -1
- package/dist/commerce-source.js +16 -10
- package/dist/commerce-source.js.map +1 -1
- package/dist/control-plane.d.ts +188 -0
- package/dist/control-plane.d.ts.map +1 -1
- package/dist/control-plane.js +125 -1
- package/dist/control-plane.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/markup.d.ts +157 -0
- package/dist/markup.d.ts.map +1 -0
- package/dist/markup.js +192 -0
- package/dist/markup.js.map +1 -0
- package/dist/model-usage.d.ts +161 -3
- package/dist/model-usage.d.ts.map +1 -1
- package/dist/model-usage.js +103 -4
- package/dist/model-usage.js.map +1 -1
- package/dist/social-relay.d.ts +36 -3
- package/dist/social-relay.d.ts.map +1 -1
- package/dist/social-relay.js +41 -3
- package/dist/social-relay.js.map +1 -1
- package/dist/subject-access.d.ts +213 -0
- package/dist/subject-access.d.ts.map +1 -0
- package/dist/subject-access.js +98 -0
- package/dist/subject-access.js.map +1 -0
- package/package.json +1 -1
package/dist/ci.d.ts
CHANGED
|
@@ -42,6 +42,23 @@ export declare const buildPreviewTag: (prNumber: number, runId: string | number)
|
|
|
42
42
|
* two numbering spaces never collide.
|
|
43
43
|
*/
|
|
44
44
|
export declare const buildPreviewTagPrefix: (prNumber: number) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Which PRs get a preview.
|
|
47
|
+
*
|
|
48
|
+
* - `on-request` (the default) — only a PR carrying the {@link PREVIEW_LABEL} label does.
|
|
49
|
+
* Hosted builds are serialized per vertical (#2795), so a preview of every push to every
|
|
50
|
+
* PR queues in front of the merge that deploys prod, and every preview copies prod's data
|
|
51
|
+
* into a fork, which is billed per row written. The platform's PR comment carries a Build
|
|
52
|
+
* preview link that adds the label for you.
|
|
53
|
+
* - `every-pr` — every PR push builds one, opted into explicitly.
|
|
54
|
+
*
|
|
55
|
+
* A workflow committed before the default moved keeps previewing every PR until it is
|
|
56
|
+
* regenerated; regenerating without asking for `every-pr` commits `on-request`.
|
|
57
|
+
*/
|
|
58
|
+
export type PreviewMode = 'every-pr' | 'on-request';
|
|
59
|
+
export declare const PREVIEW_MODES: readonly ["every-pr", "on-request"];
|
|
60
|
+
/** The PR label an `on-request` workflow previews. */
|
|
61
|
+
export declare const PREVIEW_LABEL = "preview";
|
|
45
62
|
/**
|
|
46
63
|
* The sticky-comment marker. Every writer upserts the comment that starts with this
|
|
47
64
|
* string, so whichever of the platform and CI posts first, the other updates in place
|
|
@@ -65,6 +82,17 @@ export declare function previewCommentBody(urls: {
|
|
|
65
82
|
}): string;
|
|
66
83
|
/** The sticky comment after the PR closed and the preview forks were deleted. */
|
|
67
84
|
export declare const previewReapedBody: () => string;
|
|
85
|
+
/**
|
|
86
|
+
* The sticky comment on a PR in an `on-request` repo that has no preview yet. It IS the
|
|
87
|
+
* trigger: `buildUrl` is the dashboard page whose button labels the PR, which is what the
|
|
88
|
+
* generated workflow's preview job waits for. The label is named too, so a reviewer who
|
|
89
|
+
* prefers GitHub's own sidebar (or a repo whose App lacks the label permission) can do the
|
|
90
|
+
* same thing by hand. Overwritten with {@link previewCommentBody} once the preview exists.
|
|
91
|
+
*
|
|
92
|
+
* Apostrophe-free like the others, though the workflow never renders this one: the
|
|
93
|
+
* platform is its only writer, since only the platform knows where its page lives.
|
|
94
|
+
*/
|
|
95
|
+
export declare const previewRequestBody: (buildUrl: string) => string;
|
|
68
96
|
/**
|
|
69
97
|
* How a merge to the deploy branch turns into a prod release.
|
|
70
98
|
*
|
|
@@ -98,6 +126,11 @@ export interface DeployWorkflowOptions {
|
|
|
98
126
|
* the file this generator always produced.
|
|
99
127
|
*/
|
|
100
128
|
path?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Which PRs get a preview ({@link PreviewMode}). Defaults to `on-request`, previewing only a
|
|
131
|
+
* PR labelled {@link PREVIEW_LABEL}; `every-pr` previews every push to every PR.
|
|
132
|
+
*/
|
|
133
|
+
previews?: PreviewMode;
|
|
101
134
|
}
|
|
102
135
|
/**
|
|
103
136
|
* Normalize a package directory to the repo-relative form the workflow embeds: no leading
|
|
@@ -107,6 +140,19 @@ export interface DeployWorkflowOptions {
|
|
|
107
140
|
* rely on every caller validating.
|
|
108
141
|
*/
|
|
109
142
|
export declare function normalizeWorkflowDir(path: string | undefined): string | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* The `paths:` filter a monorepo package's workflow triggers on: the package itself, the
|
|
145
|
+
* workflows, and the root manifest and lockfile. One list, because two readers act on it:
|
|
146
|
+
* the generated file, and the platform deciding whether a PR's "No preview yet" comment can
|
|
147
|
+
* lead anywhere (a PR outside these paths never starts the workflow, label or not).
|
|
148
|
+
*/
|
|
149
|
+
export declare const workflowPathFilters: (path: string) => string[];
|
|
150
|
+
/**
|
|
151
|
+
* Whether a changed file starts a workflow filtered to `path` — GitHub's matching for the
|
|
152
|
+
* patterns {@link workflowPathFilters} writes: `dir/**` is everything under `dir/`, and a
|
|
153
|
+
* pattern with no wildcard is that one file at the repo root.
|
|
154
|
+
*/
|
|
155
|
+
export declare function fileMatchesWorkflowPaths(file: string, path: string): boolean;
|
|
110
156
|
/**
|
|
111
157
|
* The workflow the one-click setup commits and `substrat init --ci github` writes.
|
|
112
158
|
*
|
package/dist/ci.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci.d.ts","sourceRoot":"","sources":["../src/ci.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH;;;;;GAKG;AACH,eAAO,MAAM,UAAU,aAAc,MAAM,KAAG,MAA0B,CAAC;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AAiB,QAAO,MACiF,CAAC;AAEvH;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,aAAc,MAAM,KAAG,MAGkC,CAAC;AAOzF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,YAAY,CAAC;AAEjD,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAQjF;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,SAAU,MAAM,KAAG,MAAM,EAKxD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAI5E;AAKD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,qBAAqB,GAAG,MAAM,CA2YtE"}
|
package/dist/ci.js
CHANGED
|
@@ -45,6 +45,9 @@ export const buildPreviewTag = (prNumber, runId) => `pr-${prNumber}-${runId}`;
|
|
|
45
45
|
* two numbering spaces never collide.
|
|
46
46
|
*/
|
|
47
47
|
export const buildPreviewTagPrefix = (prNumber) => `pr-${prNumber}-`;
|
|
48
|
+
export const PREVIEW_MODES = ['every-pr', 'on-request'];
|
|
49
|
+
/** The PR label an `on-request` workflow previews. */
|
|
50
|
+
export const PREVIEW_LABEL = 'preview';
|
|
48
51
|
// ---------------------------------------------------------------------------
|
|
49
52
|
// The PR sticky comment
|
|
50
53
|
// ---------------------------------------------------------------------------
|
|
@@ -77,6 +80,19 @@ export function previewCommentBody(urls) {
|
|
|
77
80
|
}
|
|
78
81
|
/** The sticky comment after the PR closed and the preview forks were deleted. */
|
|
79
82
|
export const previewReapedBody = () => `${PREVIEW_COMMENT_MARKER}\n🔎 **Substrat preview:** reaped — this PR is closed and the preview forks were deleted.`;
|
|
83
|
+
/**
|
|
84
|
+
* The sticky comment on a PR in an `on-request` repo that has no preview yet. It IS the
|
|
85
|
+
* trigger: `buildUrl` is the dashboard page whose button labels the PR, which is what the
|
|
86
|
+
* generated workflow's preview job waits for. The label is named too, so a reviewer who
|
|
87
|
+
* prefers GitHub's own sidebar (or a repo whose App lacks the label permission) can do the
|
|
88
|
+
* same thing by hand. Overwritten with {@link previewCommentBody} once the preview exists.
|
|
89
|
+
*
|
|
90
|
+
* Apostrophe-free like the others, though the workflow never renders this one: the
|
|
91
|
+
* platform is its only writer, since only the platform knows where its page lives.
|
|
92
|
+
*/
|
|
93
|
+
export const previewRequestBody = (buildUrl) => `${PREVIEW_COMMENT_MARKER}\n🔎 **Substrat preview:** no preview yet — this repo builds previews on request.\n\n` +
|
|
94
|
+
`[**Build preview**](${buildUrl}) · or add the \`${PREVIEW_LABEL}\` label to this PR. ` +
|
|
95
|
+
'_Once built, every push to this PR updates it, and it is reaped when the PR closes._';
|
|
80
96
|
/**
|
|
81
97
|
* Normalize a package directory to the repo-relative form the workflow embeds: no leading
|
|
82
98
|
* `./`, no trailing `/`. Root spellings (``, `.`, `./`) collapse to undefined so callers
|
|
@@ -95,6 +111,26 @@ export function normalizeWorkflowDir(path) {
|
|
|
95
111
|
}
|
|
96
112
|
return trimmed;
|
|
97
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* The `paths:` filter a monorepo package's workflow triggers on: the package itself, the
|
|
116
|
+
* workflows, and the root manifest and lockfile. One list, because two readers act on it:
|
|
117
|
+
* the generated file, and the platform deciding whether a PR's "No preview yet" comment can
|
|
118
|
+
* lead anywhere (a PR outside these paths never starts the workflow, label or not).
|
|
119
|
+
*/
|
|
120
|
+
export const workflowPathFilters = (path) => [
|
|
121
|
+
`${path}/**`,
|
|
122
|
+
'.github/workflows/**',
|
|
123
|
+
'package.json',
|
|
124
|
+
'pnpm-lock.yaml',
|
|
125
|
+
];
|
|
126
|
+
/**
|
|
127
|
+
* Whether a changed file starts a workflow filtered to `path` — GitHub's matching for the
|
|
128
|
+
* patterns {@link workflowPathFilters} writes: `dir/**` is everything under `dir/`, and a
|
|
129
|
+
* pattern with no wildcard is that one file at the repo root.
|
|
130
|
+
*/
|
|
131
|
+
export function fileMatchesWorkflowPaths(file, path) {
|
|
132
|
+
return workflowPathFilters(path).some((pattern) => pattern.endsWith('/**') ? file.startsWith(pattern.slice(0, -2)) : file === pattern);
|
|
133
|
+
}
|
|
98
134
|
/** Render a comment body as a single-quoted `printf` format string (literal `\n`, `%s` holes). */
|
|
99
135
|
const printfFormat = (body) => body.replace(/\n/g, '\\n');
|
|
100
136
|
/**
|
|
@@ -122,6 +158,7 @@ const printfFormat = (body) => body.replace(/\n/g, '\\n');
|
|
|
122
158
|
export function deployWorkflowYaml(opts) {
|
|
123
159
|
const { branch, slug, cpUrl } = opts;
|
|
124
160
|
const release = opts.release ?? 'trunk';
|
|
161
|
+
const onRequest = (opts.previews ?? 'on-request') === 'on-request';
|
|
125
162
|
// The branch reaches the GitHub API inside a URL (the tip guard), and `#` and `&` are
|
|
126
163
|
// legal in a git ref name but would truncate the query or the path there. Encoded per
|
|
127
164
|
// segment, so the `/` a nested branch name needs stays a path separator
|
|
@@ -382,11 +419,39 @@ ${cpEnv}
|
|
|
382
419
|
# directories of the repo (workspace packages, shared config), add their paths here —
|
|
383
420
|
# or remove the filter to build on every merge.
|
|
384
421
|
paths:
|
|
385
|
-
- '${
|
|
386
|
-
- '.github/workflows/**'
|
|
387
|
-
- 'package.json'
|
|
388
|
-
- 'pnpm-lock.yaml'`
|
|
422
|
+
${workflowPathFilters(path).map((p) => ` - '${p}'`).join('\n')}`
|
|
389
423
|
: '';
|
|
424
|
+
// --- which PRs preview ----------------------------------------------------------------
|
|
425
|
+
//
|
|
426
|
+
// `on-request` adds `labeled` to the PR trigger and gates the preview job on the label, so
|
|
427
|
+
// a PR nobody asked to see never takes a slot in the vertical's build queue (#2795). Two
|
|
428
|
+
// conditions, both load-bearing: the label must be ON the PR (so a push to a labelled PR
|
|
429
|
+
// keeps its preview current, and a push to an unlabelled one builds nothing), and a
|
|
430
|
+
// `labeled` event must be THIS label (adding `bug` to a labelled PR is not a reason to
|
|
431
|
+
// rebuild). There is no `unlabeled` trigger: removing the label stops updating the preview,
|
|
432
|
+
// and the preview it already built stays until the PR closes (reaped) or its TTL lapses.
|
|
433
|
+
// Re-adding the label rebuilds it.
|
|
434
|
+
const prTypes = onRequest
|
|
435
|
+
? '[opened, synchronize, reopened, labeled, closed]'
|
|
436
|
+
: '[opened, synchronize, reopened, closed]';
|
|
437
|
+
const prTriggerNote = onRequest
|
|
438
|
+
? ` # Per-PR previews, on request: a PR labelled '${PREVIEW_LABEL}' gets a preview instance running the
|
|
439
|
+
# PR's code against a FORK of prod on its own URL, and every push to it updates it. The
|
|
440
|
+
# platform's PR comment carries a Build preview link that adds the label. Removing the label
|
|
441
|
+
# stops updating the preview; closing the PR reaps it (the TTL is the GC backstop).`
|
|
442
|
+
: ` # Per-PR previews: open/update a PR → a preview instance running the PR's code against a
|
|
443
|
+
# FORK of prod on its own URL; close the PR → it is reaped (the TTL is the GC backstop).`;
|
|
444
|
+
const previewIf = onRequest
|
|
445
|
+
? ` # Only a PR labelled '${PREVIEW_LABEL}' previews, and a \`labeled\` event only when it added that
|
|
446
|
+
# label to an OPEN PR: a closed PR can still be labelled, and its preview would outlive it,
|
|
447
|
+
# since only a \`closed\` event reaps. A job-level \`if:\` skips (grey, not red), so an
|
|
448
|
+
# unlabelled PR reports as skipped.
|
|
449
|
+
if: >-
|
|
450
|
+
github.event_name == 'pull_request' &&
|
|
451
|
+
github.event.action != 'closed' &&
|
|
452
|
+
contains(github.event.pull_request.labels.*.name, '${PREVIEW_LABEL}') &&
|
|
453
|
+
(github.event.action != 'labeled' || (github.event.label.name == '${PREVIEW_LABEL}' && github.event.pull_request.state == 'open'))`
|
|
454
|
+
: ` if: github.event_name == 'pull_request' && github.event.action != 'closed'`;
|
|
390
455
|
const releaseNote = release === 'changesets'
|
|
391
456
|
? ` # Release train: the version lives in package.json and only a version PR moves it, so a
|
|
392
457
|
# merge releases ONLY when that version changed. Every merge still updates the test env.`
|
|
@@ -402,7 +467,9 @@ ${cpEnv}
|
|
|
402
467
|
#
|
|
403
468
|
# Optional repository variables (Settings → Secrets and variables → Actions → Variables):
|
|
404
469
|
# SUBSTRAT_TEST_SCOPE_ID a long-lived scope rebound to every merge (the test env)
|
|
405
|
-
# SUBSTRAT_PER_BUILD_PREVIEW set to 1 to also mint a frozen per-build preview URL per push
|
|
470
|
+
# SUBSTRAT_PER_BUILD_PREVIEW set to 1 to also mint a frozen per-build preview URL per push${onRequest
|
|
471
|
+
? `\n#\n# Previews are on request: only a PR carrying the '${PREVIEW_LABEL}' label builds one. To preview\n# every PR, turn on Preview every PR where this repo is set up in the dashboard, or\n# regenerate with \`substrat init --ci github --previews every-pr --force\` (which replaces\n# this file, local edits included).`
|
|
472
|
+
: ''}
|
|
406
473
|
|
|
407
474
|
# The default GITHUB_TOKEN, narrowed to what these jobs actually use. A repository whose
|
|
408
475
|
# default is read/write would otherwise hand every job below write access to issues, packages
|
|
@@ -414,10 +481,9 @@ permissions:
|
|
|
414
481
|
on:
|
|
415
482
|
push:
|
|
416
483
|
branches: [${branch}]${pathsFilter}
|
|
417
|
-
|
|
418
|
-
# FORK of prod on its own URL; close the PR → it is reaped (the TTL is the GC backstop).
|
|
484
|
+
${prTriggerNote}
|
|
419
485
|
pull_request:
|
|
420
|
-
types:
|
|
486
|
+
types: ${prTypes}${pathsFilter}
|
|
421
487
|
|
|
422
488
|
jobs:
|
|
423
489
|
deploy:
|
|
@@ -450,7 +516,7 @@ ${release_}
|
|
|
450
516
|
${testEnv}
|
|
451
517
|
|
|
452
518
|
preview:
|
|
453
|
-
|
|
519
|
+
${previewIf}
|
|
454
520
|
runs-on: ubuntu-latest
|
|
455
521
|
# Never overlap two runs for the same PR — a rapid re-push waits for the first.
|
|
456
522
|
concurrency: substrat-preview-\${{ github.event.number }}
|
package/dist/ci.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci.js","sourceRoot":"","sources":["../src/ci.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAU,EAAE,CAAC,MAAM,QAAQ,EAAE,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAE,KAAsB,EAAU,EAAE,CAClF,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;AAE5B;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAgB,EAAU,EAAE,CAAC,MAAM,QAAQ,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"ci.js","sourceRoot":"","sources":["../src/ci.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAU,EAAE,CAAC,MAAM,QAAQ,EAAE,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAE,KAAsB,EAAU,EAAE,CAClF,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;AAE5B;;;;GAIG;A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whose far side is a shop: products with their variants, and the
|
|
7
|
-
* orders placed for them.
|
|
8
|
-
*
|
|
7
|
+
* orders placed for them. WooCommerce and Shopify both land it (`connectors/woocommerce`,
|
|
8
|
+
* `connectors/shopify`), and `commerceSourceSuite` in `@substrat-run/contract-tests` is the behaviour
|
|
9
|
+
* the two share. A vertical codes against these names, so swapping one store platform for another keeps
|
|
9
10
|
* its landing operation, its tables and the schemas it parses. The CONNECTION is still the
|
|
10
11
|
* provider's (its credential, its probe, its binding), and so is any event type a later write
|
|
11
12
|
* travels under: the type is what routes a delivery to a provider's connector, so a neutral type
|
|
@@ -24,9 +25,11 @@ import { z } from 'zod';
|
|
|
24
25
|
* upsert again.
|
|
25
26
|
* - **Money is a decimal string with its currency.** Never a float, and never reshaped: a provider
|
|
26
27
|
* amount that is not a decimal is refused by the connector rather than rounded into one.
|
|
27
|
-
* - **Every product has at least one variant.** A
|
|
28
|
-
*
|
|
29
|
-
*
|
|
28
|
+
* - **Every product has at least one variant.** A product sold without variants lands with exactly
|
|
29
|
+
* one, untitled and picked by no option, so a vertical prices, stocks and sells variants and
|
|
30
|
+
* never branches on the platform. Its id is the store's to give: the product's own where the
|
|
31
|
+
* store has no variant row (a WooCommerce simple product), the store's default variant's where
|
|
32
|
+
* it has one (Shopify). A vertical keys on `variantId` and never assumes either.
|
|
30
33
|
* - **Stock is read-only and per variant** (#3223), as the store last reported it with the
|
|
31
34
|
* product: whether the store tracks it, how many, and in stock / out / on backorder. Where a
|
|
32
35
|
* store keeps one count for the whole product (`sharedWithProduct`), every variant reports that
|
|
@@ -38,9 +41,9 @@ import { z } from 'zod';
|
|
|
38
41
|
*
|
|
39
42
|
* * - **Fulfilment, refunds and customers as records of their own.** An order carries the customer it
|
|
40
43
|
* was placed by, as the order states it; a customer register is a later shape.
|
|
41
|
-
* - **Write requests** (set stock, mark an order fulfilled) and
|
|
42
|
-
*
|
|
43
|
-
* than designed
|
|
44
|
+
* - **Write requests** (set stock, mark an order fulfilled) and a shared `CommerceSource` facet. The
|
|
45
|
+
* second store platform now exists, so both are extracted from the two connectors when a vertical
|
|
46
|
+
* first needs them, rather than designed ahead of that.
|
|
44
47
|
*
|
|
45
48
|
* An order carries personal data (a name, an email address, postal addresses). A vertical that
|
|
46
49
|
* lands it declares those columns as such.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commerce-source.d.ts","sourceRoot":"","sources":["../src/commerce-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB
|
|
1
|
+
{"version":3,"file":"commerce-source.d.ts","sourceRoot":"","sources":["../src/commerce-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,gFAAgF;AAChF,eAAO,MAAM,eAAe;;;;;;;;;;iBAY1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB;;;iBAAoD,CAAC;AAEvF,+DAA+D;AAC/D,eAAO,MAAM,mBAAmB;;;;EAAuD,CAAC;AACxF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;iBAUiH,CAAC;AAC5I,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,yCAAyC;AACzC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;iBAsB1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;;;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8 +6,9 @@ import { currencyCode, moneyAmount } from './money.js';
|
|
|
6
6
|
* platform it runs on.
|
|
7
7
|
*
|
|
8
8
|
* A commerce source is a connector whose far side is a shop: products with their variants, and the
|
|
9
|
-
* orders placed for them.
|
|
10
|
-
*
|
|
9
|
+
* orders placed for them. WooCommerce and Shopify both land it (`connectors/woocommerce`,
|
|
10
|
+
* `connectors/shopify`), and `commerceSourceSuite` in `@substrat-run/contract-tests` is the behaviour
|
|
11
|
+
* the two share. A vertical codes against these names, so swapping one store platform for another keeps
|
|
11
12
|
* its landing operation, its tables and the schemas it parses. The CONNECTION is still the
|
|
12
13
|
* provider's (its credential, its probe, its binding), and so is any event type a later write
|
|
13
14
|
* travels under: the type is what routes a delivery to a provider's connector, so a neutral type
|
|
@@ -26,9 +27,11 @@ import { currencyCode, moneyAmount } from './money.js';
|
|
|
26
27
|
* upsert again.
|
|
27
28
|
* - **Money is a decimal string with its currency.** Never a float, and never reshaped: a provider
|
|
28
29
|
* amount that is not a decimal is refused by the connector rather than rounded into one.
|
|
29
|
-
* - **Every product has at least one variant.** A
|
|
30
|
-
*
|
|
31
|
-
*
|
|
30
|
+
* - **Every product has at least one variant.** A product sold without variants lands with exactly
|
|
31
|
+
* one, untitled and picked by no option, so a vertical prices, stocks and sells variants and
|
|
32
|
+
* never branches on the platform. Its id is the store's to give: the product's own where the
|
|
33
|
+
* store has no variant row (a WooCommerce simple product), the store's default variant's where
|
|
34
|
+
* it has one (Shopify). A vertical keys on `variantId` and never assumes either.
|
|
32
35
|
* - **Stock is read-only and per variant** (#3223), as the store last reported it with the
|
|
33
36
|
* product: whether the store tracks it, how many, and in stock / out / on backorder. Where a
|
|
34
37
|
* store keeps one count for the whole product (`sharedWithProduct`), every variant reports that
|
|
@@ -40,9 +43,9 @@ import { currencyCode, moneyAmount } from './money.js';
|
|
|
40
43
|
*
|
|
41
44
|
* * - **Fulfilment, refunds and customers as records of their own.** An order carries the customer it
|
|
42
45
|
* was placed by, as the order states it; a customer register is a later shape.
|
|
43
|
-
* - **Write requests** (set stock, mark an order fulfilled) and
|
|
44
|
-
*
|
|
45
|
-
* than designed
|
|
46
|
+
* - **Write requests** (set stock, mark an order fulfilled) and a shared `CommerceSource` facet. The
|
|
47
|
+
* second store platform now exists, so both are extracted from the two connectors when a vertical
|
|
48
|
+
* first needs them, rather than designed ahead of that.
|
|
46
49
|
*
|
|
47
50
|
* An order carries personal data (a name, an email address, postal addresses). A vertical that
|
|
48
51
|
* lands it declares those columns as such.
|
|
@@ -85,7 +88,10 @@ export const commerceStock = z
|
|
|
85
88
|
.refine((s) => s.manageStock || s.quantity === null, { message: 'a stock the store does not track has no quantity', path: ['quantity'] });
|
|
86
89
|
/** One sellable variant of a product. */
|
|
87
90
|
export const commerceVariant = z.object({
|
|
88
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* The variant's id at the store. For a product without variants, whatever id the store gives its
|
|
93
|
+
* only variant: the product's own on WooCommerce, the default variant's on Shopify.
|
|
94
|
+
*/
|
|
89
95
|
variantId: z.string().min(1),
|
|
90
96
|
sku: z.string().nullable(),
|
|
91
97
|
/** A label for the variant, when the store gives one; `null` for a product's only variant. */
|
|
@@ -100,7 +106,7 @@ export const commerceVariant = z.object({
|
|
|
100
106
|
compareAtPrice: moneyAmount.nullable(),
|
|
101
107
|
/**
|
|
102
108
|
* The variant's stock (#3223). Optional because it was added after the shape shipped: a source
|
|
103
|
-
* that reads no stock leaves it out
|
|
109
|
+
* that reads no stock leaves it out; the WooCommerce and Shopify connectors always send it.
|
|
104
110
|
*/
|
|
105
111
|
stock: commerceStock.optional(),
|
|
106
112
|
});
|
|
@@ -1 +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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