@connectedxm/admin 6.31.1 → 6.32.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/.claude/skills/applying-backend-diff/SKILL.md +128 -0
- package/.claude/skills/ship-to-prod/SKILL.md +48 -25
- package/dist/index.cjs +40 -0
- package/dist/index.d.cts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.js +36 -0
- package/openapi.json +56 -0
- package/package.json +1 -1
- package/.claude/skills/ship-to-staging/SKILL.md +0 -220
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: applying-backend-diff
|
|
3
|
+
description: Use when the user shares a backend PR, patch URL, or diff and asks to mirror, port, or add those API endpoint changes into the @connectedxm/admin-sdk TypeScript SDK (queries/mutations files under src/queries and src/mutations). Triggered by phrases like "update admin sdk with this diff", "mirror this endpoint", "add this to admin-sdk", "port these endpoints", or sharing a backend PR while in the admin-sdk repo or one of its worktrees.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Applying a Backend Diff to admin-sdk
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Backend adds or changes an admin API endpoint → admin-sdk needs a matching query or mutation file. The repo enforces a **strict file shape** because `scripts/generate.ts` walks the AST to emit `openapi.json`, and deviations are silently dropped from the generated OpenAPI spec — and therefore from the downstream `@connectedxm/admin-sdk` typescript-axios package.
|
|
11
|
+
|
|
12
|
+
The repo's [CLAUDE.md](CLAUDE.md) is the source of truth for conventions; this skill is the procedural recipe for going from a backend diff to a working, lint-clean SDK change.
|
|
13
|
+
|
|
14
|
+
## When to use
|
|
15
|
+
|
|
16
|
+
- User shares a backend PR URL (github.com, patch-diff.githubusercontent.com) and asks to update the SDK.
|
|
17
|
+
- User pastes a diff and asks to mirror endpoints in admin-sdk.
|
|
18
|
+
- User asks to "add this endpoint" to admin-sdk and provides backend code.
|
|
19
|
+
|
|
20
|
+
**Don't use** for:
|
|
21
|
+
- Hand-editing the generated `sdks/typescript/` package — it's regenerated from `openapi.json`.
|
|
22
|
+
- Changes that don't involve adding/modifying API endpoints (e.g., dependency bumps, internal refactors).
|
|
23
|
+
|
|
24
|
+
## Workflow
|
|
25
|
+
|
|
26
|
+
### 1. Get the diff
|
|
27
|
+
|
|
28
|
+
If the user gave a GitHub PR URL or a `patch-diff.githubusercontent.com` URL, fetch via `gh` CLI rather than WebFetch — patch-diff URLs redirect through auth and frequently 401:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
gh pr view <num> --repo <owner>/<repo> --json title,body,files,additions,deletions
|
|
32
|
+
gh api repos/<owner>/<repo>/pulls/<num>/files --jq '.[] | {path: .filename, patch: .patch}'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The PR description often names the pattern to mirror ("mirrors the existing X(...)") — read it before scanning code.
|
|
36
|
+
|
|
37
|
+
### 2. Extract, per endpoint
|
|
38
|
+
|
|
39
|
+
- HTTP method + URL path (e.g. `GET /payments/:paymentId/tax-metadata`)
|
|
40
|
+
- Path / query params and their types
|
|
41
|
+
- Request body shape (mutations only)
|
|
42
|
+
- Response `data` shape — including all branches (soft-skip messages, error messages, success payload)
|
|
43
|
+
|
|
44
|
+
### 3. Find the canonical example to mirror
|
|
45
|
+
|
|
46
|
+
Locate the parent resource directory by grepping for an existing endpoint on the same resource:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
grep -rln "/payments/" src/queries/ src/mutations/
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then mirror the closest-matching file:
|
|
53
|
+
|
|
54
|
+
| Endpoint type | Canonical example | Wrapper helper |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| Single GET | `src/queries/<resource>/useGetX.ts` | `useConnectedSingleQuery` |
|
|
57
|
+
| Paginated list | `src/queries/<resource>/useGetXs.ts` | `useConnectedInfiniteQuery` |
|
|
58
|
+
| Cursor list | (find an existing one in the repo) | `useConnectedCursorQuery` |
|
|
59
|
+
| Mutation | `src/mutations/<resource>/useUpdateX.ts` / `useCreateX.ts` / `useDeleteX.ts` | `useConnectedMutation` |
|
|
60
|
+
|
|
61
|
+
### 4. Reuse existing types
|
|
62
|
+
|
|
63
|
+
Before adding to `src/interfaces.ts` or `src/params.ts`, grep both files:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
grep -n "^export.*<TypeName>\b" src/interfaces.ts src/params.ts
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
For **genuinely dynamic** response blobs (e.g., raw third-party transaction data, free-form metadata), `Record<string, any>` is supported by the generator — see `scripts/generate.ts:570`, which maps it to an OpenAPI `object` with `additionalProperties`. Don't invent a misleading concrete interface just to "stay consistent."
|
|
70
|
+
|
|
71
|
+
### 5. Create the file with exact shape
|
|
72
|
+
|
|
73
|
+
The AST parser at `scripts/generate.ts` looks for one exported arrow function whose first parameter type extends `SingleQueryParams` / `InfiniteQueryParams` / `CursorQueryParams` / `MutationParams` and whose return type is `Promise<ConnectedXMResponse<T>>`. Get this wrong and the endpoint silently drops from `openapi.json`.
|
|
74
|
+
|
|
75
|
+
**Query file exports, in order:**
|
|
76
|
+
1. `*_QUERY_KEY` — array key, nested under parent resource's key (e.g. `[...PAYMENT_QUERY_KEY(id), "TAX_METADATA"]`)
|
|
77
|
+
2. `SET_*_QUERY_DATA` — cache setter
|
|
78
|
+
3. Params interface extending `SingleQueryParams` / `InfiniteQueryParams` / `CursorQueryParams`
|
|
79
|
+
4. `async` API function returning `Promise<ConnectedXMResponse<T>>`
|
|
80
|
+
5. `use*` hook calling the appropriate `useConnected*Query`
|
|
81
|
+
|
|
82
|
+
**Mutation file exports, in order:**
|
|
83
|
+
1. Params interface extending `MutationParams`
|
|
84
|
+
2. `async` API function (call `queryClient.invalidateQueries(...)` / setters after the request succeeds so consumers see fresh data)
|
|
85
|
+
3. `use*` hook calling `useConnectedMutation`
|
|
86
|
+
|
|
87
|
+
Path aliases `@src/*` and `@interfaces` are configured — use them.
|
|
88
|
+
|
|
89
|
+
### 6. Regenerate barrels
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm run exports
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Never hand-edit `index.ts` files — `.cursor/rules/index-exports.mdc` forbids it, and the script will overwrite manual edits.
|
|
96
|
+
|
|
97
|
+
### 7. Verify
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npx tsc # typecheck (build uses tsup; tsc is noEmit)
|
|
101
|
+
npm run lint
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Both must pass clean before reporting completion.
|
|
105
|
+
|
|
106
|
+
### 8. Do NOT run `npm run generate`
|
|
107
|
+
|
|
108
|
+
CI regenerates `openapi.json` on the `staging` → `main` release PR per [.github/workflows/](.github/workflows/). Running it locally produces noisy unrelated diffs from other in-flight endpoints. Mention to the user that CI handles it.
|
|
109
|
+
|
|
110
|
+
## Common mistakes
|
|
111
|
+
|
|
112
|
+
| Mistake | Fix |
|
|
113
|
+
|---|---|
|
|
114
|
+
| File deviates from canonical shape → generator silently drops it | Diff your new file line-by-line against the closest existing file in the same directory |
|
|
115
|
+
| Adding a new type that already exists in `interfaces.ts` / `params.ts` | Grep both files first; reuse types verbatim |
|
|
116
|
+
| Hand-editing `index.ts` barrels | Run `npm run exports` |
|
|
117
|
+
| Inventing a misleading concrete interface for a dynamic provider blob | Use `Record<string, any>` — the generator handles it |
|
|
118
|
+
| Running `npm run generate` locally | Don't; CI does it on the release PR |
|
|
119
|
+
| Using WebFetch on `github.com/.../pull/N.diff` | Use `gh pr view` and `gh api repos/.../pulls/N/files` instead |
|
|
120
|
+
| `cd`-ing out of the current worktree | Stay in the worktree directory; use absolute paths |
|
|
121
|
+
|
|
122
|
+
## Red flags — stop and reconsider
|
|
123
|
+
|
|
124
|
+
- About to write a new interface without grepping for it first
|
|
125
|
+
- About to edit `src/<dir>/index.ts` by hand
|
|
126
|
+
- File shape doesn't match the canonical example (different export order, missing `SET_*_QUERY_DATA`, return type not `Promise<ConnectedXMResponse<T>>`)
|
|
127
|
+
- Skipping `npx tsc` or `npm run lint` because "the change is small"
|
|
128
|
+
- Running `npm run generate` to "make sure it works" — don't
|
|
@@ -1,35 +1,50 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ship-to-prod
|
|
3
|
-
description: Open a release PR
|
|
3
|
+
description: Open a release PR into `main` in this repo. Handles the full flow — resolves the source branch from the user's prompt or the current checkout (never assumes `staging`), gathers commits, pulls Linear ticket references from commit messages and the PRs that merged in, drafts a title and body that match the repo's PR template, picks reviewers, and (after the user confirms) creates the PR with `gh pr create`. Use this whenever the user says anything along the lines of "open a release PR", "ship to prod", "cut a release", "PR into main", "promote this branch", "ship this branch", "release this", or any variant of opening/preparing a PR that targets `main`. Prefer this skill over running `gh pr create` directly — the manual flow misses Linear references, the version-bump check, and reviewer conventions.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Release PR into main
|
|
7
7
|
|
|
8
|
-
Use this when the user wants to open a release PR
|
|
8
|
+
Use this when the user wants to open a release PR into `main` in the `connectedxm/admin-sdk` repo (npm package `@connectedxm/admin`). The head branch is whatever the user names in their prompt; if they don't name one, fall back to the currently checked-out branch — never assume `staging`. (Production is `main` here — the backend repo uses `prod`, but this SDK ships from `main`.)
|
|
9
|
+
|
|
10
|
+
Pushing to `main` triggers `publish.yml`, which publishes **two** packages to npm: `@connectedxm/admin` (the source SDK) and the generated `@connectedxm/admin-sdk` (typescript-axios output of `sdks/typescript/`, regenerated from `openapi.json`). There is no manual gate — merging this PR auto-publishes both packages.
|
|
9
11
|
|
|
10
12
|
## What you're producing
|
|
11
13
|
|
|
12
14
|
A draft PR (or, on confirmation, an actual PR via `gh pr create`) with:
|
|
13
15
|
|
|
14
|
-
1. **Base/head**: base `main`, head
|
|
16
|
+
1. **Base/head**: base `main`, head = the source branch resolved in step 1 — never invent a branch that the user didn't name and isn't the current checkout
|
|
15
17
|
2. **Title** that reflects what's in the diff (see "Writing the title")
|
|
16
18
|
3. **Body** matching `.github/pull_request_template.md`, with Linear refs harvested from commits AND from any sub-PRs they reference, plus the Semantic Versioning section ticked
|
|
17
19
|
4. **Reviewers** drawn from the repo's collaborators (excluding the PR author)
|
|
18
20
|
|
|
19
|
-
The user has asked to **always confirm before creating** the PR. Show the draft, wait for the go-ahead, then call `gh pr create`.
|
|
21
|
+
The user has asked to **always confirm before creating** the PR. Show the draft, wait for the go-ahead, then push (if needed) and call `gh pr create`.
|
|
20
22
|
|
|
21
23
|
## Workflow
|
|
22
24
|
|
|
23
|
-
### 1.
|
|
25
|
+
### 1. Resolve the branch and sync
|
|
26
|
+
|
|
27
|
+
Pick the head branch for the release PR:
|
|
28
|
+
|
|
29
|
+
- If the user named a branch in their prompt, use that.
|
|
30
|
+
- Otherwise, use the currently checked-out branch (`git rev-parse --abbrev-ref HEAD`).
|
|
31
|
+
|
|
32
|
+
If the resolved branch is `main`, stop and ask the user which branch to ship — you can't PR `main` into `main`. Treat the resolved name as `<source>` everywhere below.
|
|
33
|
+
|
|
34
|
+
Then sync and check there's something to ship:
|
|
24
35
|
|
|
25
36
|
```bash
|
|
26
|
-
git fetch origin main
|
|
27
|
-
git log --oneline origin/main..origin
|
|
37
|
+
git fetch origin main <source>
|
|
38
|
+
git log --oneline origin/main..origin/<source>
|
|
28
39
|
```
|
|
29
40
|
|
|
30
|
-
If the log is empty, tell the user
|
|
41
|
+
If the log is empty, tell the user `<source>` has nothing ahead of `main` — there's no PR to open. Stop.
|
|
42
|
+
|
|
43
|
+
If `<source>` is behind `origin/<source>` locally, that's fine — the PR is opened against the remote refs, not your working copy. But mention it so the user knows.
|
|
31
44
|
|
|
32
|
-
If
|
|
45
|
+
If `<source>` exists only locally (not on `origin`), you'll need to push it before `gh pr create` will work. Note that for step 10; don't push yet.
|
|
46
|
+
|
|
47
|
+
If the branch already has an open PR against `main`, mention it (`gh pr list --head <source> --base main --state open`) and ask whether to add commits to that one or close it first. Don't open a duplicate.
|
|
33
48
|
|
|
34
49
|
### 2. Check the version bump (hard gate)
|
|
35
50
|
|
|
@@ -37,22 +52,22 @@ If `staging` is behind `origin/staging` locally, that's fine — the PR is opene
|
|
|
37
52
|
|
|
38
53
|
```bash
|
|
39
54
|
git show origin/main:package.json | node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).version"
|
|
40
|
-
git show origin
|
|
55
|
+
git show origin/<source>:package.json | node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).version"
|
|
41
56
|
```
|
|
42
57
|
|
|
43
|
-
Compare the two. If
|
|
58
|
+
Compare the two. If `<source>`'s version is **not** strictly greater than main's, stop and tell the user — they need to land a version bump on `<source>` first (recent precedent: `chore: bump version to X.Y.Z` commits) before this release PR can pass CI. Don't open the PR; don't bump for them.
|
|
44
59
|
|
|
45
60
|
If the bump looks right, note which kind it is (major/minor/patch) — you'll tick the matching box in the body's Semantic Versioning section.
|
|
46
61
|
|
|
47
62
|
### 3. Gather the commits
|
|
48
63
|
|
|
49
64
|
```bash
|
|
50
|
-
git log origin/main..origin
|
|
65
|
+
git log origin/main..origin/<source> --pretty=format:'%H%x09%s%x09%b%x1e'
|
|
51
66
|
```
|
|
52
67
|
|
|
53
68
|
The `%x1e` (ASCII record separator) lets you split multi-line commit bodies cleanly. You want the subject AND the body — Linear references like `closes ENG-1901` usually live in the body, not the subject.
|
|
54
69
|
|
|
55
|
-
Skip merge commits whose subject starts with `Merge branch 'staging'` — they're noise from local merges, not a unit of work.
|
|
70
|
+
Skip merge commits whose subject starts with `Merge branch` (e.g. `Merge branch 'staging'`, `Merge branch 'main'`) — they're noise from local merges, not a unit of work.
|
|
56
71
|
|
|
57
72
|
### 4. Resolve sub-PRs referenced in commit subjects
|
|
58
73
|
|
|
@@ -81,7 +96,7 @@ Collect refs from:
|
|
|
81
96
|
- the body of every commit in step 3
|
|
82
97
|
- the title and body of every sub-PR resolved in step 4
|
|
83
98
|
|
|
84
|
-
**Only include refs you actually saw in those sources for this PR.** Don't carry refs over from prior
|
|
99
|
+
**Only include refs you actually saw in those sources for this PR.** Don't carry refs over from prior release PRs, recent conversation context, or memory of past releases — even if a ticket "feels relevant," it doesn't go in the list unless it's literally present in the commits/PRs you just gathered. Re-listing a ticket that was already shipped in a previous release is a real failure mode and confuses Linear's auto-close on merge.
|
|
85
100
|
|
|
86
101
|
Dedupe. Preserve the verb the user wrote when possible — if a sub-PR said `closes ENG-1901`, your output should say `closes ENG-1901`, not `ref`. Only fall back to `ref` if the original said `ref` or no verb at all.
|
|
87
102
|
|
|
@@ -107,7 +122,7 @@ Look at what's actually in the diff before reaching for a template. The right ti
|
|
|
107
122
|
|
|
108
123
|
**One dominant change:** copy the conventional-commit subject from the main commit/PR. Example: `feat(accounts): expose tier and tags on account responses`.
|
|
109
124
|
|
|
110
|
-
**Several unrelated changes:** use a short generic title like `
|
|
125
|
+
**Several unrelated changes:** use a short generic title like `Release fixes` or a noun phrase that captures the theme. Look at recent release PRs (`gh pr list --base main --state merged --limit 10`) to match the house style — they oscillate between conventional-commit and short noun phrases, both are fine.
|
|
111
126
|
|
|
112
127
|
**Version-bump-only releases.** When the only thing in the diff is `chore: bump version to X.Y.Z`, a short title like `Release X.Y.Z` is fine.
|
|
113
128
|
|
|
@@ -145,7 +160,7 @@ Indicate the appropriate version bump for this PR:
|
|
|
145
160
|
|
|
146
161
|
**Writing the testing plan.** Replace the template's default Testing checkboxes with a per-PR plan derived from what actually changed. The reviewer should be able to read the plan and know exactly what to verify before merging triggers the npm publish. Aim for 3–7 concrete checkbox items.
|
|
147
162
|
|
|
148
|
-
Walk the file diff (`git diff --name-only origin/main..origin
|
|
163
|
+
Walk the file diff (`git diff --name-only origin/main..origin/<source>`) and turn it into specific verification steps. This is a TypeScript SDK consumed by other apps (notably `admin-web`), so most verification happens via type-check + a smoke pass from a consumer. Note: this repo also generates a second SDK in `sdks/typescript/` from `openapi.json` via `npm run generate` / `npm run generate:sdks` — interface and param changes can affect what shows up there too.
|
|
149
164
|
|
|
150
165
|
- **Query files** (`src/queries/<resource>/use*.ts`) → "Confirm `useGet*` returns the new field/shape; spot-check the query key and that 401/403/404/460/461 routes through `onNotAuthorized` / `onNotFound` / `onModuleForbidden`."
|
|
151
166
|
- **Mutation files** (`src/mutations/<resource>/use*.ts`) → "Run the mutation from a consumer app and confirm the listed query keys invalidate / `SET_*_QUERY_DATA` updates as expected; on failure confirm `onMutationError` fires."
|
|
@@ -153,8 +168,8 @@ Walk the file diff (`git diff --name-only origin/main..origin/staging`) and turn
|
|
|
153
168
|
- **Param/input shape changes** (`src/params.ts`) → "Confirm callers in `admin-web` still type-check against the new params; if a field became required, the consumer-side update needs to land before publish."
|
|
154
169
|
- **`ConnectedXMProvider` / context changes** (`src/ConnectedXMProvider.tsx`, `src/hooks/useConnectedXM.ts`) → "Mount a consumer with the updated provider and confirm `adminApiParams`, `organizationId`, `getToken`, `getExecuteAs`, and the `onNotAuthorized` / `onModuleForbidden` / `onNotFound` / `onMutationError` callbacks still wire through."
|
|
155
170
|
- **`AdminAPI` / axios changes** (`src/AdminAPI.ts`) → "Confirm `GetAdminAPI(params)` returns an axios instance with the expected `baseURL`, `organization`, `authorization`, `api-key`, and `executeAs` headers (when set)."
|
|
156
|
-
- **OpenAPI generator changes** (`scripts/generate.ts`, `scripts/generate-sdks.ts`) → "Run `npm run generate` and inspect `openapi.json` for the expected diff; if the SDK output is in scope, run `npm run generate:sdks` and confirm `sdks/typescript/` regenerates cleanly. Note: the
|
|
157
|
-
- **Index/barrel changes** (`src/index.ts`, per-folder `index.ts`) → "If files were added/moved, confirm `npm run exports` was run
|
|
171
|
+
- **OpenAPI generator changes** (`scripts/generate.ts`, `scripts/generate-sdks.ts`) → "Run `npm run generate` and inspect `openapi.json` for the expected diff; if the SDK output is in scope, run `npm run generate:sdks` and confirm `sdks/typescript/` regenerates cleanly. Note: the PR triggers `generate-openapi.yml`, which re-runs the generator on the PR branch."
|
|
172
|
+
- **Index/barrel changes** (`src/index.ts`, per-folder `index.ts`) → "If files were added/moved, confirm `npm run exports` was run (per `.cursor/rules/index-exports.mdc` — don't hand-edit). Then `npm run build` and inspect `dist/index.d.ts` to confirm the new symbols are exported."
|
|
158
173
|
- **CI workflow changes** (`.github/workflows/`) → "Confirm `tests.yml`, `linear-check.yml`, `version-check.yml`, `publish.yml`, `approve.yml`, or `generate-openapi.yml` pass on this branch."
|
|
159
174
|
- **Publish gate** → "After merge, confirm `publish.yml` runs cleanly on `main` and both `@connectedxm/admin@X.Y.Z` and the generated `@connectedxm/admin-sdk@X.Y.Z` are live on npm."
|
|
160
175
|
|
|
@@ -176,18 +191,24 @@ If there are zero Linear references, omit the bullet list and write `- (none)` u
|
|
|
176
191
|
|
|
177
192
|
### 9. Show the draft and wait
|
|
178
193
|
|
|
179
|
-
Print the title, body, reviewer list,
|
|
194
|
+
Print the title, body, reviewer list, the version delta from step 2, AND the push state from step 1 back to the user, clearly labelled. If a push is needed (`<source>` not on origin or local commits ahead of `origin/<source>`), state explicitly that creating the PR will push first. Ask whether to proceed, modify, or cancel. Don't run `git push` or `gh pr create` until they've said yes.
|
|
180
195
|
|
|
181
196
|
The reason for confirming: the title and body are interpretive — you're summarizing several commits' worth of work. The user knows things you don't (which change is the headline feature, which is incidental cleanup, whether the Semantic Versioning box is right, whether something is already covered by another ticket). Five seconds of their attention up front beats editing the PR after the fact — especially since merging this PR triggers an npm publish.
|
|
182
197
|
|
|
183
|
-
### 10.
|
|
198
|
+
### 10. Push the branch (if needed) and create the PR
|
|
184
199
|
|
|
185
|
-
After confirmation
|
|
200
|
+
After confirmation:
|
|
186
201
|
|
|
187
202
|
```bash
|
|
203
|
+
# Only if step 1 said the branch needed pushing:
|
|
204
|
+
git push -u origin <source> # first push
|
|
205
|
+
# OR
|
|
206
|
+
git push # subsequent push
|
|
207
|
+
|
|
208
|
+
# Then:
|
|
188
209
|
gh pr create \
|
|
189
210
|
--base main \
|
|
190
|
-
--head
|
|
211
|
+
--head <source> \
|
|
191
212
|
--title "<title>" \
|
|
192
213
|
--reviewer "<comma,separated,logins>" \
|
|
193
214
|
--body "$(cat <<'EOF'
|
|
@@ -201,16 +222,18 @@ Return the PR URL from the command output so the user can click straight to it.
|
|
|
201
222
|
## Things to watch out for
|
|
202
223
|
|
|
203
224
|
- **`main`, not `prod`.** This repo's production branch is `main` (the backend repo uses `prod`). Don't paste backend instincts here — `gh pr create --base prod` will fail.
|
|
225
|
+
- **Don't assume `staging`.** Most feature work now branches off `main` and PRs directly back into `main`. Resolve the head branch from the user's prompt or the current checkout — never default to `staging`.
|
|
204
226
|
- **Merging this PR publishes two packages to npm.** `publish.yml` runs on push to `main` and publishes both `@connectedxm/admin` (the source SDK) and `@connectedxm/admin-sdk` (the typescript-axios output regenerated from `openapi.json`). There is no manual gate. Take the testing plan seriously.
|
|
205
|
-
- **The version bump is a hard gate.** If
|
|
227
|
+
- **The version bump is a hard gate.** If `<source>`'s `package.json` version isn't strictly greater than main's in plain `x.y.z` semver, `version-check.yml` will fail. Don't open the PR until the bump is on the source branch.
|
|
206
228
|
- **`linear-check.yml` requires `ENG-####` in the body.** A `CXM-####`-only body will fail CI. If you only found `CXM` refs, surface that to the user before opening.
|
|
207
|
-
- **`generate-openapi.yml` runs on
|
|
229
|
+
- **`generate-openapi.yml` runs on PRs to `main`.** It regenerates `openapi.json` from the source. If the PR branch's `openapi.json` is stale relative to the source, expect this workflow to push a regen commit or fail. Don't be surprised by the extra activity on the PR.
|
|
208
230
|
- **Don't paste `<!-- CURSOR_SUMMARY -->` blocks** from sub-PR bodies into the new PR body. Those are auto-generated by the Cursor Bugbot reviewer and re-including them looks weird.
|
|
209
231
|
- **Don't include the HTML comment placeholders** from the PR template (`<!-- A brief description -->`) in your output — replace them with real content.
|
|
210
232
|
- **Keep the Semantic Versioning section.** Don't drop it from the body — the template explicitly includes it. Tick the box that matches the actual version bump.
|
|
211
233
|
- **`closes` vs `ref`**: `closes` auto-closes the Linear ticket on merge to `main`. `ref` just links it. Preserve whichever the source commit/PR used. When in doubt, `ref` is the safer default — it doesn't change ticket state.
|
|
212
234
|
- **Bot reviews are not human reviews.** Don't infer reviewer preferences from `github-actions` or `cursor` reviews on past PRs — those are automated. Look at human reviewers (`authorAssociation: MEMBER`) only.
|
|
213
235
|
- **The author isn't a reviewer.** GitHub will reject `--reviewer <self>`. Always exclude `gh api user --jq '.login'` from the list.
|
|
236
|
+
- **Don't push without confirmation.** Pushing exposes work to the team and triggers CI. Bundle it with PR creation behind the user's go-ahead.
|
|
214
237
|
|
|
215
238
|
## Why this exists
|
|
216
239
|
|
package/dist/index.cjs
CHANGED
|
@@ -1212,6 +1212,7 @@ __export(index_exports, {
|
|
|
1212
1212
|
GetOrganizationWebhook: () => GetOrganizationWebhook,
|
|
1213
1213
|
GetOrganizationWebhooks: () => GetOrganizationWebhooks,
|
|
1214
1214
|
GetPayment: () => GetPayment,
|
|
1215
|
+
GetPaymentTaxMetadata: () => GetPaymentTaxMetadata,
|
|
1215
1216
|
GetPayments: () => GetPayments,
|
|
1216
1217
|
GetPreferences: () => GetPreferences,
|
|
1217
1218
|
GetPreset: () => GetPreset,
|
|
@@ -1426,6 +1427,7 @@ __export(index_exports, {
|
|
|
1426
1427
|
OrganizationTriggerType: () => OrganizationTriggerType,
|
|
1427
1428
|
PAYMENTS_QUERY_KEY: () => PAYMENTS_QUERY_KEY,
|
|
1428
1429
|
PAYMENT_QUERY_KEY: () => PAYMENT_QUERY_KEY,
|
|
1430
|
+
PAYMENT_TAX_METADATA_QUERY_KEY: () => PAYMENT_TAX_METADATA_QUERY_KEY,
|
|
1429
1431
|
PREFERENCES_QUERY_KEY: () => PREFERENCES_QUERY_KEY,
|
|
1430
1432
|
PRESETS_QUERY_KEY: () => PRESETS_QUERY_KEY,
|
|
1431
1433
|
PRESET_QUERY_KEY: () => PRESET_QUERY_KEY,
|
|
@@ -1981,6 +1983,7 @@ __export(index_exports, {
|
|
|
1981
1983
|
SET_PASS_TYPE_COUPONS_QUERY_DATA: () => SET_PASS_TYPE_COUPONS_QUERY_DATA,
|
|
1982
1984
|
SET_PAYMENTS_QUERY_DATA: () => SET_PAYMENTS_QUERY_DATA,
|
|
1983
1985
|
SET_PAYMENT_QUERY_DATA: () => SET_PAYMENT_QUERY_DATA,
|
|
1986
|
+
SET_PAYMENT_TAX_METADATA_QUERY_DATA: () => SET_PAYMENT_TAX_METADATA_QUERY_DATA,
|
|
1984
1987
|
SET_PREFERENCES_QUERY_DATA: () => SET_PREFERENCES_QUERY_DATA,
|
|
1985
1988
|
SET_PRESETS_QUERY_DATA: () => SET_PRESETS_QUERY_DATA,
|
|
1986
1989
|
SET_PRESET_QUERY_DATA: () => SET_PRESET_QUERY_DATA,
|
|
@@ -3180,6 +3183,7 @@ __export(index_exports, {
|
|
|
3180
3183
|
useGetOrganizationWebhook: () => useGetOrganizationWebhook,
|
|
3181
3184
|
useGetOrganizationWebhooks: () => useGetOrganizationWebhooks,
|
|
3182
3185
|
useGetPayment: () => useGetPayment,
|
|
3186
|
+
useGetPaymentTaxMetadata: () => useGetPaymentTaxMetadata,
|
|
3183
3187
|
useGetPayments: () => useGetPayments,
|
|
3184
3188
|
useGetPreferences: () => useGetPreferences,
|
|
3185
3189
|
useGetPreset: () => useGetPreset,
|
|
@@ -20859,6 +20863,38 @@ var useGetPayment = (paymentId = "", options = {}) => {
|
|
|
20859
20863
|
);
|
|
20860
20864
|
};
|
|
20861
20865
|
|
|
20866
|
+
// src/queries/organization/payment/useGetPaymentTaxMetadata.ts
|
|
20867
|
+
var PAYMENT_TAX_METADATA_QUERY_KEY = (paymentId) => [
|
|
20868
|
+
...PAYMENT_QUERY_KEY(paymentId),
|
|
20869
|
+
"TAX_METADATA"
|
|
20870
|
+
];
|
|
20871
|
+
var SET_PAYMENT_TAX_METADATA_QUERY_DATA = (client, keyParams, response) => {
|
|
20872
|
+
client.setQueryData(PAYMENT_TAX_METADATA_QUERY_KEY(...keyParams), response);
|
|
20873
|
+
};
|
|
20874
|
+
var GetPaymentTaxMetadata = async ({
|
|
20875
|
+
paymentId,
|
|
20876
|
+
adminApiParams
|
|
20877
|
+
}) => {
|
|
20878
|
+
const adminApi = await GetAdminAPI(adminApiParams);
|
|
20879
|
+
const { data } = await adminApi.get(
|
|
20880
|
+
`/payments/${paymentId}/tax-metadata`
|
|
20881
|
+
);
|
|
20882
|
+
return data;
|
|
20883
|
+
};
|
|
20884
|
+
var useGetPaymentTaxMetadata = (paymentId = "", options = {}) => {
|
|
20885
|
+
return useConnectedSingleQuery(
|
|
20886
|
+
PAYMENT_TAX_METADATA_QUERY_KEY(paymentId),
|
|
20887
|
+
(params) => GetPaymentTaxMetadata({
|
|
20888
|
+
paymentId,
|
|
20889
|
+
...params
|
|
20890
|
+
}),
|
|
20891
|
+
{
|
|
20892
|
+
...options,
|
|
20893
|
+
enabled: !!paymentId && (options.enabled ?? true)
|
|
20894
|
+
}
|
|
20895
|
+
);
|
|
20896
|
+
};
|
|
20897
|
+
|
|
20862
20898
|
// src/queries/organization/sideEffects/useGetOrganizationSideEffects.ts
|
|
20863
20899
|
var ORGANIZATION_SIDE_EFFECTS_QUERY_KEY = (triggerType, triggerId) => {
|
|
20864
20900
|
const keys = [...ORGANIZATION_QUERY_KEY(), "SIDE_EFFECTS"];
|
|
@@ -44695,6 +44731,7 @@ var useUpdateTier = (options = {}) => {
|
|
|
44695
44731
|
GetOrganizationWebhook,
|
|
44696
44732
|
GetOrganizationWebhooks,
|
|
44697
44733
|
GetPayment,
|
|
44734
|
+
GetPaymentTaxMetadata,
|
|
44698
44735
|
GetPayments,
|
|
44699
44736
|
GetPreferences,
|
|
44700
44737
|
GetPreset,
|
|
@@ -44909,6 +44946,7 @@ var useUpdateTier = (options = {}) => {
|
|
|
44909
44946
|
OrganizationTriggerType,
|
|
44910
44947
|
PAYMENTS_QUERY_KEY,
|
|
44911
44948
|
PAYMENT_QUERY_KEY,
|
|
44949
|
+
PAYMENT_TAX_METADATA_QUERY_KEY,
|
|
44912
44950
|
PREFERENCES_QUERY_KEY,
|
|
44913
44951
|
PRESETS_QUERY_KEY,
|
|
44914
44952
|
PRESET_QUERY_KEY,
|
|
@@ -45464,6 +45502,7 @@ var useUpdateTier = (options = {}) => {
|
|
|
45464
45502
|
SET_PASS_TYPE_COUPONS_QUERY_DATA,
|
|
45465
45503
|
SET_PAYMENTS_QUERY_DATA,
|
|
45466
45504
|
SET_PAYMENT_QUERY_DATA,
|
|
45505
|
+
SET_PAYMENT_TAX_METADATA_QUERY_DATA,
|
|
45467
45506
|
SET_PREFERENCES_QUERY_DATA,
|
|
45468
45507
|
SET_PRESETS_QUERY_DATA,
|
|
45469
45508
|
SET_PRESET_QUERY_DATA,
|
|
@@ -46663,6 +46702,7 @@ var useUpdateTier = (options = {}) => {
|
|
|
46663
46702
|
useGetOrganizationWebhook,
|
|
46664
46703
|
useGetOrganizationWebhooks,
|
|
46665
46704
|
useGetPayment,
|
|
46705
|
+
useGetPaymentTaxMetadata,
|
|
46666
46706
|
useGetPayments,
|
|
46667
46707
|
useGetPreferences,
|
|
46668
46708
|
useGetPreset,
|