@ycadence/sdk 0.0.0-stage → 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/LICENSE +202 -0
- package/README.md +111 -2
- package/dist/client.d.ts +190 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/errors.d.ts +100 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +538 -0
- package/dist/index.js.map +15 -0
- package/dist/operations.d.ts +128 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/pagination.d.ts +13 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/types.d.ts +280 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +53 -4
- package/src/client.ts +550 -0
- package/src/errors.ts +144 -0
- package/src/index.ts +37 -0
- package/src/operations.ts +74 -0
- package/src/pagination.ts +36 -0
- package/src/types.ts +364 -0
- package/src/version.ts +11 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Yarlis, Inc.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,112 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ycadence/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A TypeScript client for the YCadence REST API. The YCadence CLI and MCP server use it too.
|
|
4
|
+
|
|
5
|
+
- No runtime dependencies. It uses the platform `fetch`.
|
|
6
|
+
- It runs in Node 18+, Bun, Deno and browsers. Ships ESM with type declarations.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @ycadence/sdk
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### If npm is unavailable
|
|
15
|
+
|
|
16
|
+
Each release is mirrored to GitHub Packages when the npm publish fails, as
|
|
17
|
+
`@yarlisaisolutions/ycadence-sdk`. It needs a GitHub token with `read:packages`:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
# ~/.npmrc
|
|
21
|
+
@yarlisaisolutions:registry=https://npm.pkg.github.com
|
|
22
|
+
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm install @yarlisaisolutions/ycadence-sdk
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Use
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { YCadenceClient, YCadenceError } from '@ycadence/sdk'
|
|
33
|
+
|
|
34
|
+
const client = new YCadenceClient({
|
|
35
|
+
baseUrl: 'https://ycadence.example.com',
|
|
36
|
+
apiKey: process.env.YCADENCE_API_KEY!, // a project, organization or personal key
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const page = await client.listWorkItems('<projectId>', {
|
|
40
|
+
filter: { field: 'priority', operator: 'is', value: 'urgent' },
|
|
41
|
+
limit: 50,
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
await client.createWorkItem('<projectId>', { name: 'Fix login redirect', priority: 'high' })
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if (error instanceof YCadenceError) {
|
|
48
|
+
console.error(error.status, error.code, error.message, error.issues)
|
|
49
|
+
if (error.retryable) {
|
|
50
|
+
// 429 or 5xx
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Writes, retries and concurrency
|
|
57
|
+
|
|
58
|
+
Every method takes an optional last argument of request options:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
await client.createWorkItem(projectId, { name: 'Fix login' }, { idempotencyKey: 'import-row-17' })
|
|
62
|
+
await client.updateWorkItem(id, { priority: 'urgent' }, { expectedVersion: 7 }) // If-Match: "7"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- `idempotencyKey` is sent as `Idempotency-Key`, and makes the write safe to retry.
|
|
66
|
+
- `expectedVersion` is sent as `If-Match`. A server that versions the resource answers 409
|
|
67
|
+
`version_conflict` (or 412) when it has moved on; one that does not ignores the header.
|
|
68
|
+
- GET requests, and writes that carry an idempotency key, are retried on 429, 5xx, timeouts
|
|
69
|
+
and network errors: twice by default, with exponential backoff and jitter, honouring
|
|
70
|
+
`Retry-After`. Other writes are never retried, since they may already have been applied.
|
|
71
|
+
|
|
72
|
+
### Errors
|
|
73
|
+
|
|
74
|
+
Every failure is a `YCadenceError` with `status`, `code`, `message`, `issues`, `details`,
|
|
75
|
+
`requestId` and `retryable`, and is also an instance of a class for its kind:
|
|
76
|
+
`YCadenceValidationError` (400, 422), `YCadencePermissionError` (401, 403),
|
|
77
|
+
`YCadenceNotFoundError` (404), `YCadenceConflictError` (409), `YCadencePreconditionError`
|
|
78
|
+
(412), `YCadenceRateLimitError` (429, with `retryAfter`) and `YCadenceNetworkError`
|
|
79
|
+
(unreachable or timed out).
|
|
80
|
+
|
|
81
|
+
### Pages
|
|
82
|
+
|
|
83
|
+
Lists return `{ items, nextCursor }`. `iterateWorkItems` follows the cursor lazily, and
|
|
84
|
+
`paginate` / `collect` do the same for any list:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { collect, paginate } from '@ycadence/sdk'
|
|
88
|
+
const all = await collect(paginate((cursor) => client.listWorkItems(projectId, { cursor })))
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Options
|
|
92
|
+
|
|
93
|
+
| Option | Meaning |
|
|
94
|
+
|---|---|
|
|
95
|
+
| `baseUrl` | Your instance, for example `https://ycadence.example.com`. Trailing slashes are fine. |
|
|
96
|
+
| `apiKey` | Sent as `x-api-key`. |
|
|
97
|
+
| `identityToken` | Only for an instance behind Google IAP or authenticated Cloud Run. Pass a string or a function, which is called before each request; it is sent as `Authorization: Bearer`. |
|
|
98
|
+
| `timeoutMs` | Defaults to 30000. |
|
|
99
|
+
| `fetch` | A custom `fetch`, for tests or proxies. |
|
|
100
|
+
| `retry` | `{ retries, baseDelayMs, maxDelayMs }`; `{ retries: 0 }` turns retrying off. |
|
|
101
|
+
| `userAgent` | Prepended to `User-Agent` (`ycadence-sdk/<version>`). |
|
|
102
|
+
| `onResponse` | Called after every response with method, path, status, request id, duration and attempt. Never sees credentials. |
|
|
103
|
+
|
|
104
|
+
## Renamed from DevPulse
|
|
105
|
+
|
|
106
|
+
`DevPulseClient` and `DevPulseError` still work, as deprecated aliases of
|
|
107
|
+
`YCadenceClient` and `YCadenceError`. `error instanceof DevPulseError` still matches.
|
|
108
|
+
Existing API keys that start with `dp_` keep working. New keys start with `yc_`.
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
Apache-2.0
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The YCadence client.
|
|
3
|
+
*
|
|
4
|
+
* Shared by the CLI, the MCP server and anyone integrating from TypeScript, so
|
|
5
|
+
* there is one place that knows how to talk to the API — how errors are shaped,
|
|
6
|
+
* how paging works, how a key is presented, when a request is safe to retry.
|
|
7
|
+
* Three separate implementations of that would disagree, and the disagreement
|
|
8
|
+
* would surface as "the CLI works but the MCP server does not".
|
|
9
|
+
*/
|
|
10
|
+
import { YCadenceError } from './errors';
|
|
11
|
+
import { type OperationId } from './operations';
|
|
12
|
+
import type { CreateViewInput, CreateWorkItemInput, Cycle, CycleProgress, Health, ImportInput, ImportPreview, ImportRun, IntakeItem, Label, ListWorkItemsOptions, Me, Page, Project, State, SubmitIntakeInput, SubmitIntakeResult, TriageInput, TriageResult, UpdateWorkItemInput, View, WorkItem, WorkItemDetail } from './types';
|
|
13
|
+
export interface RetryOptions {
|
|
14
|
+
/** Attempts after the first. Default 2. `0` turns retrying off. */
|
|
15
|
+
retries?: number;
|
|
16
|
+
/** First backoff, doubled each attempt, with jitter. Default 250ms. */
|
|
17
|
+
baseDelayMs?: number;
|
|
18
|
+
/** Ceiling for one wait, including a server's `Retry-After`. Default 8s. */
|
|
19
|
+
maxDelayMs?: number;
|
|
20
|
+
}
|
|
21
|
+
/** What happened to one HTTP exchange; for logging. Never carries credentials. */
|
|
22
|
+
export interface ResponseInfo {
|
|
23
|
+
method: string;
|
|
24
|
+
path: string;
|
|
25
|
+
status: number;
|
|
26
|
+
requestId: string | undefined;
|
|
27
|
+
durationMs: number;
|
|
28
|
+
attempt: number;
|
|
29
|
+
replayed: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ClientOptions {
|
|
32
|
+
/** e.g. https://ycadence.example.com. Trailing slashes are tolerated. */
|
|
33
|
+
baseUrl: string;
|
|
34
|
+
apiKey: string;
|
|
35
|
+
/**
|
|
36
|
+
* A Google identity token for an instance behind IAP or an authenticated
|
|
37
|
+
* Cloud Run service, sent as `Authorization: Bearer`. The transport's
|
|
38
|
+
* credential and the product's are different things and travel in different
|
|
39
|
+
* headers: the key always goes in `x-api-key`.
|
|
40
|
+
*
|
|
41
|
+
* A function is called before every request, because these tokens last
|
|
42
|
+
* about an hour and a long-running caller — the MCP server — outlives one.
|
|
43
|
+
*/
|
|
44
|
+
identityToken?: string | (() => string | undefined | Promise<string | undefined>);
|
|
45
|
+
/** Defaults to 30s. A request that hangs forever is worse than one that fails. */
|
|
46
|
+
timeoutMs?: number;
|
|
47
|
+
fetch?: typeof globalThis.fetch;
|
|
48
|
+
/**
|
|
49
|
+
* Retries for 429, 5xx, timeouts and network errors. Only GET requests, and
|
|
50
|
+
* mutations sent with an idempotency key, are retried: repeating any other
|
|
51
|
+
* write could apply it twice.
|
|
52
|
+
*/
|
|
53
|
+
retry?: RetryOptions;
|
|
54
|
+
/** Prepended to the default `User-Agent`, e.g. `ycadence-cli/0.2.0`. */
|
|
55
|
+
userAgent?: string;
|
|
56
|
+
/** Called after every response, including ones that are retried. */
|
|
57
|
+
onResponse?: (info: ResponseInfo) => void;
|
|
58
|
+
/** Injected for tests; defaults to a timer. */
|
|
59
|
+
sleep?: (ms: number) => Promise<void>;
|
|
60
|
+
}
|
|
61
|
+
/** Per-call options for any request. */
|
|
62
|
+
export interface RequestOptions {
|
|
63
|
+
/**
|
|
64
|
+
* Sent as `Idempotency-Key` on a mutation, which also makes the mutation
|
|
65
|
+
* safe to retry. Servers that do not support the header ignore it.
|
|
66
|
+
*/
|
|
67
|
+
idempotencyKey?: string;
|
|
68
|
+
/**
|
|
69
|
+
* The version the caller last saw, sent as `If-Match: "<version>"`. A server
|
|
70
|
+
* that versions the resource answers 409 `version_conflict` or 412 when it
|
|
71
|
+
* has moved on; one that does not ignores the header.
|
|
72
|
+
*/
|
|
73
|
+
expectedVersion?: number | string;
|
|
74
|
+
signal?: AbortSignal;
|
|
75
|
+
/** Overrides the client's retry count for this call. */
|
|
76
|
+
retries?: number;
|
|
77
|
+
}
|
|
78
|
+
export declare class YCadenceClient {
|
|
79
|
+
private readonly options;
|
|
80
|
+
private readonly baseUrl;
|
|
81
|
+
private readonly apiKey;
|
|
82
|
+
private readonly identityToken;
|
|
83
|
+
private readonly timeoutMs;
|
|
84
|
+
private readonly doFetch;
|
|
85
|
+
private readonly retry;
|
|
86
|
+
private readonly userAgent;
|
|
87
|
+
private readonly onResponse;
|
|
88
|
+
private readonly sleep;
|
|
89
|
+
constructor(options: ClientOptions);
|
|
90
|
+
/** A copy of this client with some options replaced. */
|
|
91
|
+
withOptions(overrides: Partial<ClientOptions>): YCadenceClient;
|
|
92
|
+
/** The fetch this client sends with; for wrapping in `withOptions`. */
|
|
93
|
+
get fetchImplementation(): typeof globalThis.fetch;
|
|
94
|
+
health(): Promise<Health>;
|
|
95
|
+
/** Who the credential is. A 404 means the server predates Slice 2A. */
|
|
96
|
+
me(options?: RequestOptions): Promise<Me>;
|
|
97
|
+
/** Projects the credential can read; `q` matches a name or identifier prefix. */
|
|
98
|
+
listProjects(query?: {
|
|
99
|
+
q?: string;
|
|
100
|
+
archived?: boolean;
|
|
101
|
+
limit?: number;
|
|
102
|
+
cursor?: string;
|
|
103
|
+
}, options?: RequestOptions): Promise<Page<Project>>;
|
|
104
|
+
listWorkItems(projectId: string, query?: ListWorkItemsOptions, options?: RequestOptions): Promise<Page<WorkItem>>;
|
|
105
|
+
/**
|
|
106
|
+
* Every work item matching a filter, following the cursor.
|
|
107
|
+
*
|
|
108
|
+
* An async generator rather than an array: a project can hold tens of
|
|
109
|
+
* thousands of items, and a caller that wanted the first twenty should not
|
|
110
|
+
* pay for all of them — nor should the process hold them all in memory.
|
|
111
|
+
*/
|
|
112
|
+
iterateWorkItems(projectId: string, options?: {
|
|
113
|
+
filter?: unknown;
|
|
114
|
+
pageSize?: number;
|
|
115
|
+
}): AsyncGenerator<WorkItem>;
|
|
116
|
+
createWorkItem(projectId: string, body: CreateWorkItemInput | Record<string, unknown>, options?: RequestOptions): Promise<WorkItem>;
|
|
117
|
+
getWorkItem(workItemId: string, options?: RequestOptions): Promise<WorkItemDetail>;
|
|
118
|
+
updateWorkItem(workItemId: string, body: UpdateWorkItemInput | Record<string, unknown>, options?: RequestOptions): Promise<WorkItem>;
|
|
119
|
+
deleteWorkItem(workItemId: string, options?: RequestOptions): Promise<void>;
|
|
120
|
+
listStates(projectId: string, options?: RequestOptions): Promise<{
|
|
121
|
+
states: State[];
|
|
122
|
+
}>;
|
|
123
|
+
listLabels(projectId: string, options?: RequestOptions): Promise<{
|
|
124
|
+
labels: Label[];
|
|
125
|
+
}>;
|
|
126
|
+
createLabel(projectId: string, body: {
|
|
127
|
+
name: string;
|
|
128
|
+
color: string;
|
|
129
|
+
description?: string;
|
|
130
|
+
}, options?: RequestOptions): Promise<Label>;
|
|
131
|
+
listTypes(projectId: string, options?: RequestOptions): Promise<{
|
|
132
|
+
types: unknown[];
|
|
133
|
+
}>;
|
|
134
|
+
listCycles(projectId: string, options?: RequestOptions): Promise<{
|
|
135
|
+
cycles: Cycle[];
|
|
136
|
+
}>;
|
|
137
|
+
createCycle(projectId: string, body: {
|
|
138
|
+
name: string;
|
|
139
|
+
description?: string;
|
|
140
|
+
startDate?: string;
|
|
141
|
+
endDate?: string;
|
|
142
|
+
}, options?: RequestOptions): Promise<Cycle>;
|
|
143
|
+
getCycleProgress(cycleId: string, options?: RequestOptions): Promise<CycleProgress>;
|
|
144
|
+
addWorkItemsToCycle(cycleId: string, workItemIds: string[], options?: RequestOptions): Promise<{
|
|
145
|
+
added: number;
|
|
146
|
+
}>;
|
|
147
|
+
listViews(projectId: string, options?: RequestOptions): Promise<{
|
|
148
|
+
views: View[];
|
|
149
|
+
}>;
|
|
150
|
+
createView(projectId: string, body: CreateViewInput, options?: RequestOptions): Promise<View>;
|
|
151
|
+
listIntake(projectId: string, query?: {
|
|
152
|
+
includeDecided?: boolean;
|
|
153
|
+
}, options?: RequestOptions): Promise<{
|
|
154
|
+
items: IntakeItem[];
|
|
155
|
+
}>;
|
|
156
|
+
submitIntake(projectId: string, body: SubmitIntakeInput, options?: RequestOptions): Promise<SubmitIntakeResult>;
|
|
157
|
+
triageIntake(intakeItemId: string, body: TriageInput, options?: RequestOptions): Promise<TriageResult>;
|
|
158
|
+
previewImport(projectId: string, body: ImportInput | Record<string, unknown>, options?: RequestOptions): Promise<ImportPreview>;
|
|
159
|
+
startImport(projectId: string, body: ImportInput | Record<string, unknown>, options?: RequestOptions): Promise<{
|
|
160
|
+
runId: string;
|
|
161
|
+
}>;
|
|
162
|
+
getImport(runId: string, options?: RequestOptions): Promise<ImportRun>;
|
|
163
|
+
listImports(projectId: string, options?: RequestOptions): Promise<{
|
|
164
|
+
runs: ImportRun[];
|
|
165
|
+
}>;
|
|
166
|
+
/** Call any operation in the table by id. */
|
|
167
|
+
call<T>(operation: OperationId, params?: Record<string, string>, query?: Record<string, string | number | boolean | undefined>, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
168
|
+
private request;
|
|
169
|
+
private backoff;
|
|
170
|
+
private send;
|
|
171
|
+
}
|
|
172
|
+
/** Seconds, from either form `Retry-After` takes: a number or an HTTP date. */
|
|
173
|
+
export declare function parseRetryAfter(value: string | null, now?: number): number | undefined;
|
|
174
|
+
export type { ImportPreview, ImportRun, Page, WorkItem } from './types';
|
|
175
|
+
/**
|
|
176
|
+
* @deprecated Renamed to {@link YCadenceClient}. This alias stays for one
|
|
177
|
+
* release so existing integrations keep compiling.
|
|
178
|
+
*/
|
|
179
|
+
export declare const DevPulseClient: typeof YCadenceClient;
|
|
180
|
+
/** @deprecated Renamed to {@link YCadenceClient}. */
|
|
181
|
+
export type DevPulseClient = YCadenceClient;
|
|
182
|
+
export { type ApiFailure, YCadenceError } from './errors';
|
|
183
|
+
/**
|
|
184
|
+
* @deprecated Renamed to {@link YCadenceError}. The alias is the same class,
|
|
185
|
+
* so `error instanceof DevPulseError` still matches errors the client throws.
|
|
186
|
+
*/
|
|
187
|
+
export declare const DevPulseError: typeof YCadenceError;
|
|
188
|
+
/** @deprecated Renamed to {@link YCadenceError}. */
|
|
189
|
+
export type DevPulseError = YCadenceError;
|
|
190
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAoD,aAAa,EAAE,MAAM,UAAU,CAAA;AAC1F,OAAO,EAA6C,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1F,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,KAAK,EACL,aAAa,EACb,MAAM,EACN,WAAW,EACX,aAAa,EACb,SAAS,EACT,UAAU,EACV,KAAK,EACL,oBAAoB,EACpB,E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,WAAW,EACtB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EACnC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,EAC7D,IAAI,CAAC,EAAE,OAAO,EACd,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,CAAC,CAAC,CAYZ;YAEa,OAAO;IA0BrB,OAAO,CAAC,OAAO;YAQD,IAAI;CA0GnB;AA4BD,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,SAAa,GAAG,MAAM,GAAG,SAAS,CAO1F;AAED,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvE;;;GAGG;AACH,eAAO,MAAM,cAAc,uBAAiB,CAAA;AAC5C,qDAAqD;AACrD,MAAM,MAAM,cAAc,GAAG,cAAc,CAAA;AAE3C,OAAO,EAAE,KAAK,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAEzD;;;GAGG;AACH,eAAO,MAAM,aAAa,sBAAgB,CAAA;AAC1C,oDAAoD;AACpD,MAAM,MAAM,aAAa,GAAG,aAAa,CAAA"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Errors the client throws.
|
|
3
|
+
*
|
|
4
|
+
* One base class, `YCadenceError`, so `instanceof YCadenceError` catches every
|
|
5
|
+
* failure the client produces, and a subclass per kind of failure, so a caller
|
|
6
|
+
* can branch on the class instead of comparing status codes. The base keeps its
|
|
7
|
+
* original positional constructor `(status, code, message, issues)`, because
|
|
8
|
+
* integrations construct it in their own tests.
|
|
9
|
+
*/
|
|
10
|
+
export interface ApiIssue {
|
|
11
|
+
path: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
/** The error body every v1 route returns (`packages/api/src/types.ts`). */
|
|
15
|
+
export interface ApiFailure {
|
|
16
|
+
error: string;
|
|
17
|
+
code: string;
|
|
18
|
+
issues?: ApiIssue[];
|
|
19
|
+
/** Added by the work management contracts; absent on older servers. */
|
|
20
|
+
details?: Record<string, unknown>;
|
|
21
|
+
requestId?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ErrorExtras {
|
|
24
|
+
/** The server's request id, from the body or the `x-request-id` header. */
|
|
25
|
+
requestId?: string;
|
|
26
|
+
details?: Record<string, unknown>;
|
|
27
|
+
/** Seconds, from `Retry-After`, when the server sent one. */
|
|
28
|
+
retryAfter?: number;
|
|
29
|
+
method?: string;
|
|
30
|
+
path?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare class YCadenceError extends Error {
|
|
33
|
+
readonly status: number;
|
|
34
|
+
readonly code: string;
|
|
35
|
+
readonly issues?: ApiIssue[] | undefined;
|
|
36
|
+
readonly requestId: string | undefined;
|
|
37
|
+
readonly details: Record<string, unknown> | undefined;
|
|
38
|
+
readonly retryAfter: number | undefined;
|
|
39
|
+
readonly method: string | undefined;
|
|
40
|
+
readonly path: string | undefined;
|
|
41
|
+
constructor(status: number, code: string, message: string, issues?: ApiIssue[] | undefined, extras?: ErrorExtras);
|
|
42
|
+
/**
|
|
43
|
+
* Whether retrying unchanged could plausibly succeed: rate limits, server
|
|
44
|
+
* errors, timeouts and an unreachable host. A 4xx means the request itself
|
|
45
|
+
* needs to change.
|
|
46
|
+
*/
|
|
47
|
+
get retryable(): boolean;
|
|
48
|
+
}
|
|
49
|
+
/** 400 or 422: the request was understood and refused as invalid. */
|
|
50
|
+
export declare class YCadenceValidationError extends YCadenceError {
|
|
51
|
+
name: string;
|
|
52
|
+
}
|
|
53
|
+
/** 401 or 403: no credential, a bad one, or not allowed. */
|
|
54
|
+
export declare class YCadencePermissionError extends YCadenceError {
|
|
55
|
+
name: string;
|
|
56
|
+
}
|
|
57
|
+
/** 404: missing, deleted, or in another organization. */
|
|
58
|
+
export declare class YCadenceNotFoundError extends YCadenceError {
|
|
59
|
+
name: string;
|
|
60
|
+
}
|
|
61
|
+
/** 409: a domain rule, a version conflict, or the same idempotency key still running. */
|
|
62
|
+
export declare class YCadenceConflictError extends YCadenceError {
|
|
63
|
+
name: string;
|
|
64
|
+
}
|
|
65
|
+
/** 412: an `If-Match` precondition failed; reload and try again. */
|
|
66
|
+
export declare class YCadencePreconditionError extends YCadenceError {
|
|
67
|
+
name: string;
|
|
68
|
+
}
|
|
69
|
+
/** 429: slow down; `retryAfter` says for how long when the server said. */
|
|
70
|
+
export declare class YCadenceRateLimitError extends YCadenceError {
|
|
71
|
+
name: string;
|
|
72
|
+
}
|
|
73
|
+
/** Status 0 or 408: the host could not be reached, or did not answer in time. */
|
|
74
|
+
export declare class YCadenceNetworkError extends YCadenceError {
|
|
75
|
+
name: string;
|
|
76
|
+
}
|
|
77
|
+
/** The class that matches a status. */
|
|
78
|
+
export declare function errorClassFor(status: number): typeof YCadenceError;
|
|
79
|
+
export declare function createError(status: number, code: string, message: string, issues?: ApiIssue[], extras?: ErrorExtras): YCadenceError;
|
|
80
|
+
/**
|
|
81
|
+
* Thrown, unchanged, through the client by a custom `fetch` that wants to stop
|
|
82
|
+
* a request without it being reported as a network error. The CLI's
|
|
83
|
+
* `--dry-run` uses it to show a mutation instead of sending it.
|
|
84
|
+
*/
|
|
85
|
+
export declare class RequestIntercepted extends Error {
|
|
86
|
+
readonly request: {
|
|
87
|
+
method: string;
|
|
88
|
+
url: string;
|
|
89
|
+
headers: Record<string, string>;
|
|
90
|
+
body: unknown;
|
|
91
|
+
};
|
|
92
|
+
name: string;
|
|
93
|
+
constructor(request: {
|
|
94
|
+
method: string;
|
|
95
|
+
url: string;
|
|
96
|
+
headers: Record<string, string>;
|
|
97
|
+
body: unknown;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.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MAAM,CAAA;QACX,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAC/B,IAAI,EAAE,OAAO,CAAA;KACd,EAGF;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { type ClientOptions, DevPulseClient, DevPulseError, parseRetryAfter, type RequestOptions, type ResponseInfo, type RetryOptions, YCadenceClient, } from './client.js';
|
|
2
|
+
export { type ApiFailure, type ApiIssue, createError, type ErrorExtras, errorClassFor, RequestIntercepted, YCadenceConflictError, YCadenceError, YCadenceNetworkError, YCadenceNotFoundError, YCadencePermissionError, YCadencePreconditionError, YCadenceRateLimitError, YCadenceValidationError, } from './errors.js';
|
|
3
|
+
export { buildPath, type HttpMethod, isIdempotentMethod, OPERATIONS, type Operation, type OperationId, } from './operations.js';
|
|
4
|
+
export { collect, paginate } from './pagination.js';
|
|
5
|
+
export * from './types.js';
|
|
6
|
+
export { SDK_VERSION } from './version.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,cAAc,GACf,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,WAAW,EACX,KAAK,WAAW,EAChB,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,SAAS,EACT,KAAK,UAAU,EACf,kBAAkB,EAClB,UAAU,EACV,KAAK,SAAS,EACd,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACnD,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA"}
|