@asstio-dev/storefront 0.1.0 → 0.2.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/README.md +42 -3
- package/dist/schema.d.ts +700 -0
- package/package.json +1 -1
- package/src/schema.d.ts +700 -0
package/README.md
CHANGED
|
@@ -9,6 +9,11 @@ deliberate commit, so a change here always shows up in a diff.
|
|
|
9
9
|
npm install @asstio-dev/storefront
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
+
Setting a shop up in the first place — the Asstio-side MCP calls, the API key kinds, CORS, the filter and
|
|
13
|
+
price model — is one document: [`docs/PUBLIC_STOREFRONT_ONBOARDING.md`](../../docs/PUBLIC_STOREFRONT_ONBOARDING.md),
|
|
14
|
+
served publicly at <https://api.storefront.asstio.com/docs/onboarding>. This file is only about using the
|
|
15
|
+
package.
|
|
16
|
+
|
|
12
17
|
```ts
|
|
13
18
|
import { createStorefrontClient, filterQuery } from "@asstio-dev/storefront";
|
|
14
19
|
|
|
@@ -132,12 +137,46 @@ Errors are never stored (`Cache-Control: no-store`) and never carry an ETag.
|
|
|
132
137
|
|
|
133
138
|
## Development
|
|
134
139
|
|
|
140
|
+
From `sdk/typescript`:
|
|
141
|
+
|
|
135
142
|
```bash
|
|
136
|
-
npm
|
|
143
|
+
npm ci
|
|
137
144
|
npm run build # regenerates src/schema.d.ts from the snapshot, compiles, then typechecks the examples
|
|
138
145
|
npm run check # fails if the committed schema.d.ts is stale, modified or untracked, or an example broke
|
|
139
146
|
```
|
|
140
147
|
|
|
141
148
|
`src/schema.d.ts` is generated **and committed**: it is reviewed in pull requests exactly like the
|
|
142
|
-
OpenAPI snapshot it comes from. After changing the API, regenerate the snapshot
|
|
143
|
-
|
|
149
|
+
OpenAPI snapshot it comes from. After changing the public API, regenerate the snapshot from the repo
|
|
150
|
+
root, then build and check the SDK:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
UPDATE_SNAPSHOTS=1 dotnet test --project tests/Storefront.Api.Tests -- --filter-query "/*/*/OpenApiSnapshotTests/*"
|
|
154
|
+
cd sdk/typescript
|
|
155
|
+
npm ci
|
|
156
|
+
npm run build
|
|
157
|
+
npm run check
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Review and commit `tests/Storefront.Api.Tests/Snapshots/openapi-v1.json` and
|
|
161
|
+
`sdk/typescript/src/schema.d.ts` together. An API or worker implementation change that leaves the
|
|
162
|
+
OpenAPI snapshot unchanged does not require a generated SDK change.
|
|
163
|
+
|
|
164
|
+
## Publishing
|
|
165
|
+
|
|
166
|
+
The SDK and backend share a release version. Do not edit the placeholder version in `package.json`
|
|
167
|
+
and do not run `npm publish` locally. Pushing a repository tag such as `v1.2.3` runs
|
|
168
|
+
`publish-npm.yml`, which derives version `1.2.3` from the tag, installs and checks the package, runs a
|
|
169
|
+
publish dry run, and creates a pending staged package through npm trusted publishing. No long-lived
|
|
170
|
+
`NPM_TOKEN` is used.
|
|
171
|
+
|
|
172
|
+
The tag does not make the package public. A maintainer must inspect and approve it with npm 2FA, on
|
|
173
|
+
the npm website under **Staged Packages** or with npm 11.19 or newer:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
npm stage list @asstio-dev/storefront
|
|
177
|
+
npm stage view <stage-id>
|
|
178
|
+
npm stage approve <stage-id>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
After approval, verify the registry version and a clean consumer install. The full API, worker, and
|
|
182
|
+
npm release checklist is in [`docs/ops/deploy.md`](../../docs/ops/deploy.md).
|