@marcohefti/request-network-api-contracts 0.5.0 → 0.5.1
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 +10 -4
- package/docs/OVERVIEW.md +22 -13
- package/docs/PUBLISHING.md +69 -0
- package/docs/UPDATE-WORKFLOW.md +13 -7
- package/docs/UPDATES.md +1 -1
- package/package.json +1 -1
- package/specs/README.md +4 -1
- package/specs/openapi/request-network-openapi.meta.json +1 -1
package/README.md
CHANGED
|
@@ -38,14 +38,20 @@ pnpm add -D @marcohefti/request-network-api-contracts
|
|
|
38
38
|
|
|
39
39
|
## Updating the spec
|
|
40
40
|
|
|
41
|
-
Use the TypeScript client's tooling to refresh the contracts in-place:
|
|
41
|
+
Use the TypeScript client's tooling to refresh the contracts in-place. From the TypeScript client repository, run:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
pnpm
|
|
45
|
-
pnpm --filter "./packages/request-client-contracts" verify
|
|
44
|
+
pnpm prepare:spec
|
|
46
45
|
```
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
This downloads the latest OpenAPI document into the contracts package's `specs/openapi/`, refreshes metadata, and regenerates the TypeScript/Zod outputs. Then verify the contracts package:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
cd ../request-network-api-contracts
|
|
51
|
+
npm run verify
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The `verify` script sanity-checks file sizes and presence before committing updates across both packages.
|
|
49
55
|
|
|
50
56
|
## Future work
|
|
51
57
|
|
package/docs/OVERVIEW.md
CHANGED
|
@@ -19,9 +19,9 @@ Git dependency.
|
|
|
19
19
|
## Directory Structure
|
|
20
20
|
|
|
21
21
|
```
|
|
22
|
-
|
|
22
|
+
.
|
|
23
23
|
├── README.md
|
|
24
|
-
├── package.json #
|
|
24
|
+
├── package.json # package metadata
|
|
25
25
|
├── specs/
|
|
26
26
|
│ ├── README.md # explains generated vs manual assets
|
|
27
27
|
│ ├── openapi/
|
|
@@ -41,20 +41,29 @@ packages/request-client-contracts/
|
|
|
41
41
|
|
|
42
42
|
## Consumption Strategy
|
|
43
43
|
|
|
44
|
-
- **
|
|
45
|
-
(`@marcohefti/request-network-api-contracts/specs/...`)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
- **Node / TypeScript SDKs:** Reference files via the published package name
|
|
45
|
+
(`@marcohefti/request-network-api-contracts/specs/...`) in your build and validation scripts.
|
|
46
|
+
- **Multi-package workspaces:** When this repo is part of a larger workspace,
|
|
47
|
+
scripts running from the workspace root can still read from the package path above without any special wiring.
|
|
48
|
+
- **Other SDKs:** Non-Node clients can vendor the `specs/**` and `fixtures/**`
|
|
49
|
+
directories or use this repository as a Git submodule / subtree so the same
|
|
50
|
+
files are available without copying them by hand.
|
|
50
51
|
|
|
51
52
|
## Update Workflow
|
|
52
53
|
|
|
53
|
-
1.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
1. Refresh the OpenAPI spec (see `docs/UPDATE-WORKFLOW.md` for details). When
|
|
55
|
+
you maintain the TypeScript client alongside this package, that typically
|
|
56
|
+
means running its `pnpm run prepare:spec` task so the latest OpenAPI
|
|
57
|
+
document and metadata land in `specs/openapi/`.
|
|
58
|
+
2. Update webhook fixtures in `fixtures/webhooks/` when Request publishes new
|
|
59
|
+
payloads. Pair every new fixture with test coverage in each SDK.
|
|
60
|
+
3. Run `npm run verify` from this repository to confirm the expected files are
|
|
61
|
+
present and within size bounds.
|
|
62
|
+
4. Commit the contract changes (`specs/**`, `fixtures/**`, docs) together with
|
|
63
|
+
any regenerated client artefacts so consumers can diff the update in one
|
|
64
|
+
review.
|
|
65
|
+
5. Append an entry to `docs/UPDATES.md` capturing the date, upstream
|
|
66
|
+
reference, and required SDK follow-up.
|
|
58
67
|
|
|
59
68
|
## Related Backlog Tasks
|
|
60
69
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Publishing `@marcohefti/request-network-api-contracts`
|
|
2
|
+
|
|
3
|
+
This package publishes the shared Request Network REST API contracts to npm so
|
|
4
|
+
SDKs can consume the OpenAPI spec, metadata, and webhook fixtures without
|
|
5
|
+
vendoring files.
|
|
6
|
+
|
|
7
|
+
Use this checklist when preparing a release.
|
|
8
|
+
|
|
9
|
+
## Preflight
|
|
10
|
+
|
|
11
|
+
- [x] `package.json` metadata is correct:
|
|
12
|
+
- `name: "@marcohefti/request-network-api-contracts"`
|
|
13
|
+
- `version` bumped according to the changes (0.5.x for the initial public line).
|
|
14
|
+
- `"private": false` and `"license": "MIT"`.
|
|
15
|
+
- `"files"` includes `specs`, `fixtures`, `docs`, and `README.md`.
|
|
16
|
+
- [x] `README.md` and `docs/OVERVIEW.md` describe the current contents (OpenAPI,
|
|
17
|
+
webhooks, fixtures) and how SDKs should consume them.
|
|
18
|
+
- [x] OpenAPI spec and metadata are refreshed via the TypeScript client’s tooling
|
|
19
|
+
(see `docs/UPDATE-WORKFLOW.md` step 1).
|
|
20
|
+
- [x] Webhook schema (`specs/webhooks/request-network-webhooks.json`) and
|
|
21
|
+
fixtures under `fixtures/webhooks/**` reflect the latest published webhook
|
|
22
|
+
events.
|
|
23
|
+
- [x] `node scripts/verify.js` passes to confirm the expected assets exist and
|
|
24
|
+
are non-empty.
|
|
25
|
+
|
|
26
|
+
## Release Metadata
|
|
27
|
+
|
|
28
|
+
- [x] `docs/UPDATES.md` records the latest contract update (date, summary,
|
|
29
|
+
upstream source, required SDK follow-up).
|
|
30
|
+
- [ ] Tag strategy documented (e.g., `v0.x.y` for contract updates, semantic
|
|
31
|
+
version bumps when contracts introduce breaking changes for SDKs).
|
|
32
|
+
|
|
33
|
+
## Publishing Steps
|
|
34
|
+
|
|
35
|
+
1. Ensure you are logged into npm as `marcohefti` with publish access and 2FA enabled:
|
|
36
|
+
```bash
|
|
37
|
+
npm login
|
|
38
|
+
```
|
|
39
|
+
2. From the contracts package root, run the verifier:
|
|
40
|
+
```bash
|
|
41
|
+
npm run verify
|
|
42
|
+
```
|
|
43
|
+
3. Bump the version in `package.json` (following SemVer for the contracts line,
|
|
44
|
+
e.g., `0.5.1` for additive changes) and commit:
|
|
45
|
+
```bash
|
|
46
|
+
git add package.json docs/UPDATES.md specs fixtures
|
|
47
|
+
git commit -m "chore(contracts): prepare @marcohefti/request-network-api-contracts@<version>"
|
|
48
|
+
```
|
|
49
|
+
4. Tag the commit and push branch + tag:
|
|
50
|
+
```bash
|
|
51
|
+
git tag v<version>
|
|
52
|
+
git push
|
|
53
|
+
git push --tags
|
|
54
|
+
```
|
|
55
|
+
5. Publish the package to npm:
|
|
56
|
+
```bash
|
|
57
|
+
npm publish --access public --otp=<your_2fa_code>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Post-Release
|
|
61
|
+
|
|
62
|
+
- [ ] Update TypeScript and PHP clients (and any other SDKs) to depend on the
|
|
63
|
+
new version.
|
|
64
|
+
- [ ] Run their spec/fixture sync scripts and parity guards:
|
|
65
|
+
- TS: `pnpm run prepare:spec` + tests.
|
|
66
|
+
- PHP: `composer update:spec`, `composer parity:openapi`, `composer parity:webhooks`.
|
|
67
|
+
- [ ] Record any required client follow-up work in the relevant SDK
|
|
68
|
+
repositories or your own release notes so consumers know which client
|
|
69
|
+
versions pick up the new contracts.
|
package/docs/UPDATE-WORKFLOW.md
CHANGED
|
@@ -4,11 +4,14 @@ Use this checklist whenever the Request Network API publishes contract changes.
|
|
|
4
4
|
|
|
5
5
|
## 1. Refresh the OpenAPI spec
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
pnpm
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
- If you maintain the official TypeScript client alongside this package, run its
|
|
8
|
+
`pnpm run prepare:spec` task to download the latest OpenAPI document and
|
|
9
|
+
regenerate the generated types. That tooling is responsible for writing
|
|
10
|
+
`specs/openapi/request-network-openapi.json` and the corresponding
|
|
11
|
+
`.meta.json` file into this package.
|
|
12
|
+
- If you are only using this repository, fetch the OpenAPI document directly
|
|
13
|
+
from the upstream Request API (`https://api.request.network/open-api/openapi.json`)
|
|
14
|
+
and update both the JSON and `.meta.json` files under `specs/openapi/`.
|
|
12
15
|
|
|
13
16
|
## 2. Update webhook schema (if needed)
|
|
14
17
|
|
|
@@ -22,11 +25,14 @@ pnpm --filter "./packages/request-api-client" prepare:spec
|
|
|
22
25
|
|
|
23
26
|
## 4. Verify assets
|
|
24
27
|
|
|
28
|
+
From this repository, run:
|
|
29
|
+
|
|
25
30
|
```bash
|
|
26
|
-
|
|
31
|
+
npm run verify
|
|
27
32
|
```
|
|
28
33
|
|
|
29
|
-
The verification script asserts that the expected files exist and logs their
|
|
34
|
+
The verification script asserts that the expected files exist and logs their
|
|
35
|
+
sizes for a quick sanity check.
|
|
30
36
|
|
|
31
37
|
## 5. Document and commit
|
|
32
38
|
|
package/docs/UPDATES.md
CHANGED
|
@@ -12,4 +12,4 @@ change so SDK maintainers know when to regenerate code.
|
|
|
12
12
|
- **Notes:** Regeneration impact, required SDK updates, new fixtures
|
|
13
13
|
|
|
14
14
|
## History
|
|
15
|
-
- *No entries yet* - initial import seeded via `pnpm
|
|
15
|
+
- *No entries yet* - initial import seeded via the TypeScript client’s `pnpm run prepare:spec` tooling on 2025-11-06.
|
package/package.json
CHANGED
package/specs/README.md
CHANGED
|
@@ -13,7 +13,10 @@ webhooks/ # manually curated webhook schema
|
|
|
13
13
|
- `request-network-openapi.meta.json` – metadata captured during fetch (e.g.
|
|
14
14
|
etag, timestamp, source URL).
|
|
15
15
|
|
|
16
|
-
These files should only change through the regeneration
|
|
16
|
+
These files should only change through the regeneration tooling in your SDKs
|
|
17
|
+
(for example, the TypeScript client’s `pnpm run fetch:openapi` or broader
|
|
18
|
+
`pnpm run prepare:spec` commands). Avoid manual edits. Rerun the fetch command
|
|
19
|
+
when upstream changes land and commit the updated JSON + metadata.
|
|
17
20
|
|
|
18
21
|
## `webhooks/`
|
|
19
22
|
- `request-network-webhooks.json` – maintained manually. Update it when webhook
|