@versionone/agility-sdk 0.0.0-stage → 1.0.0-alpha.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2012-2026 Digital.ai Software, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,86 @@
1
- # Temporary Holding Version
1
+ # @versionone/agility-sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ TypeScript SDK for the Digital.ai Agility (formerly VersionOne) API. It works in Node (ESM or CommonJS) and the browser, ships its own types, and has no runtime dependencies.
4
+
5
+ Not to be confused with `v1sdk`, the 2.x JavaScript SDK: this is a new API, not a compatible successor.
6
+
7
+ ## Install
8
+
9
+ Alpha releases are for feedback; the API may change between them.
10
+
11
+ ```bash
12
+ npm install @versionone/agility-sdk@alpha
13
+ ```
14
+
15
+ ```ts
16
+ import { AgilityApiClient } from "@versionone/agility-sdk";
17
+
18
+ const client = new AgilityApiClient({ baseUrl: "https://www14.v1host.com/v1sdktesting", accessToken: process.env.V1_ACCESS_TOKEN });
19
+ const stories = await client.queryV1.query({ from: "Story", select: ["Name", "Estimate"], page: { size: 10, start: 0 } });
20
+ ```
21
+
22
+ ## Working on the SDK
23
+
24
+ ```bash
25
+ npm install
26
+ npm run build
27
+ npm test
28
+ ```
29
+
30
+ ## Development scripts
31
+
32
+ - `npm run dev` - watch build
33
+ - `npm run build` - build ESM + CJS + declarations
34
+ - `npm run typecheck` - run TypeScript type checks
35
+ - `npm run verify` - run typecheck + build + tests
36
+ - `npm run test` - run unit tests
37
+ - `npm run download:metamodel -- <baseAgilityUrl>` - download meta model for a given Agility instance
38
+
39
+ ## Public API
40
+
41
+ - `AgilityApiClient` - top-level SDK client (`meta`, `data` for rest-1, `assets` for api/asset, `localize` for loc-2, `schema`), and the services on it:
42
+ - `queryV1.query` / `queryV1.queries` - reads through query.v1: the same query bodies as `assets.query`, rows translated the same way, but the endpoint is read-only and answers with rows alone, so it is the safe place to explore a query
43
+ - `resolve.numbers` / `resolve.ref` - asset numbers and OID tokens to assets, in one request
44
+ - `assets.sendGuarded` - a batch as a compare-and-set on each asset's ChangeDate; changed assets come back `skipped`
45
+ - `attachments.list` / `page` / `info` / `get` / `add` / `put` / `remove` / `url` - files attached to an asset: metadata on the Attachment asset, bytes through attachment.img; `page` adds the total and whether more pages follow; `get`'s `contentType` is the type the server sent the bytes with; `add` sends a small file inline (Base64, one request) and a large one in two steps (create, then upload), and a failed upload throws `AttachmentUploadError` naming the empty attachment it left
46
+ - `embeddedImages.upload` / `url` / `normalize` - images in rich text: upload returns the `<img src>` URL; `normalize` rewrites `embedded.img` references to this instance's URL. They cannot be deleted
47
+ - `batch.run` / `batch.reversible` - preview, snapshot, (confirm,) send guarded, and a receipt with a reverse batch. Undo (`batch.reversible`) reactivates a closed asset before deleting it, and a second command on one asset is sent as a second guarded pass. `confirm` sees the touched assets' names; aliased updates/executes are sent as written with `guard: false`; a failure after the send throws `BatchRecordError` carrying the receipt
48
+ - `TypeCache` - one instance's loaded type definitions, shared by many clients (`new AgilityApiClient(config, { types })`): a server that builds a client per user fetches each type once
49
+ - `createFetchTransport` - configurable HTTP transport: `credentials` for same-origin cookie auth, `onUnauthorized` to re-authenticate on a 401 (resends idempotent requests once), and a per-request `signal`; `client.withSignal(signal)` ties a whole client to one
50
+ - `ApiError` - typed API error; `CommandFailureError` - an api/asset batch in which commands failed (`failures` by index, plus the `response`)
51
+
52
+ API reference: https://docs.digital.ai/agility-api/
53
+
54
+ ## Extend with new APIs
55
+
56
+ 1. Add a new folder under `src/apis/`.
57
+ 2. Add request/response types under `src/types/`.
58
+ 3. Implement methods using `Transport.request`.
59
+ 4. Export from `src/index.ts`.
60
+ 5. Add tests under `test/`.
61
+
62
+ ## Installing before a release
63
+
64
+ No registry package yet. Pin a commit: `npm install github:versionone/VersionOne.SDK.JavaScript#<sha>` builds `dist` on install (the `prepare` script). CI also uploads an `npm pack` tarball on every run.
65
+
66
+ ## Releasing
67
+
68
+ Versions are published to npmjs by `.github/workflows/publish.yml` when a
69
+ tag `v<version>` is pushed; the tag must equal `package.json`'s version. A
70
+ prerelease (`1.0.0-alpha.0`, `-beta.N`, `-rc.N`) goes out on its own
71
+ dist-tag (`alpha`, `beta`, `rc`), so `latest` is never a prerelease.
72
+
73
+ ```bash
74
+ npm version 1.0.0-alpha.1 --no-git-tag-version # bump, commit, merge
75
+ git tag v1.0.0-alpha.1 && git push origin v1.0.0-alpha.1
76
+ ```
77
+
78
+ Authentication is npm trusted publishing: on npmjs, the package's settings
79
+ link this repository and `publish.yml`, and no token is stored. A package
80
+ must exist before it can be linked, so the very first version is published
81
+ once by hand by an `@versionone` org member (`npm publish --access public
82
+ --tag alpha` from a clean checkout of the tagged commit), then linked.
83
+
84
+ ## Before PR
85
+
86
+ - Run `npm run verify` to validate typecheck, build, and tests before opening a pull request.