@versionone/agility-sdk 0.0.0-stage → 1.0.0-alpha.2

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,104 @@
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. The reverse uses only operations the type has in meta (a created Conversation, which has no `Delete`, is a note), and undoing an `Inactivate` or `QuickClose` reopens the descendants that close cascaded to (`receipt.openDescendants`, `receipt.cascaded`), parent first. A command the server reports as failed lands in `receipt.failed`, not `skipped`. `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.2 --no-git-tag-version # bump, commit, merge
75
+ git tag v1.0.0-alpha.2 && git push origin v1.0.0-alpha.2
76
+ ```
77
+
78
+ The workflow does not publish directly: it runs `npm stage publish`, which
79
+ puts the version in the registry where nobody can install it yet, and prints
80
+ its stage ID in the run's summary. A maintainer then approves it with 2FA,
81
+ which is what publishes it:
82
+
83
+ ```bash
84
+ npm stage view <stage-id> # what was staged
85
+ npm stage approve <stage-id> # publish it (asks for 2FA)
86
+ npm stage reject <stage-id> # discard it
87
+ ```
88
+
89
+ or approves it on the package's page on npmjs. `npm stage` needs npm
90
+ 11.15.0 or later.
91
+
92
+ Authentication is npm trusted publishing: on npmjs, the package's settings
93
+ link this repository, `publish.yml` and the GitHub environment `npm`, with
94
+ the `npm stage publish` permission (leave plain `npm publish` off, as npm
95
+ recommends), and no token is stored. A trusted-publisher link expires; an
96
+ expired one must be deleted and created again, and until then the workflow
97
+ fails with `ENEEDAUTH`. The `npm` environment (repository settings) requires
98
+ an approval, so a pushed tag waits for a maintainer before it stages. A
99
+ package must exist before it can be linked, so the very first version was
100
+ published once by hand by an `@versionone` org member.
101
+
102
+ ## Before PR
103
+
104
+ - Run `npm run verify` to validate typecheck, build, and tests before opening a pull request.