axiam-sdk 1.0.0 → 1.1.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.
Files changed (42) hide show
  1. package/README.md +91 -12
  2. package/dist/browser/index.d.cts +1 -1
  3. package/dist/browser/index.d.ts +1 -1
  4. package/dist/{client-yD0eMwHQ.d.cts → client-7ZKtfXW-.d.cts} +640 -14
  5. package/dist/{client-0WJkblDE.d.ts → client-Putxo-yi.d.ts} +640 -14
  6. package/dist/{cookieJar-hWRmZkhe.d.ts → cookieJar-Cw6Zdeec.d.ts} +1 -1
  7. package/dist/{cookieJar-CTD5jOmd.d.cts → cookieJar-DkGcIr-i.d.cts} +1 -1
  8. package/dist/{errors-m0Tue_pE.d.cts → errors-CtP_lviy.d.cts} +15 -1
  9. package/dist/{errors-CmBvsxV0.d.ts → errors-VpViVRSx.d.ts} +15 -1
  10. package/dist/grpc/index.d.cts +3 -3
  11. package/dist/grpc/index.d.ts +3 -3
  12. package/dist/grpc/index.js +572 -14
  13. package/dist/grpc/index.js.map +1 -1
  14. package/dist/grpc/index.mjs +572 -14
  15. package/dist/grpc/index.mjs.map +1 -1
  16. package/dist/index.d.cts +3 -3
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.js +594 -15
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +592 -16
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/middleware/index.d.cts +3 -3
  23. package/dist/middleware/index.d.ts +3 -3
  24. package/dist/middleware/index.js +26 -3
  25. package/dist/middleware/index.js.map +1 -1
  26. package/dist/middleware/index.mjs +26 -3
  27. package/dist/middleware/index.mjs.map +1 -1
  28. package/dist/node/index.d.cts +3 -3
  29. package/dist/node/index.d.ts +3 -3
  30. package/dist/node/index.js +598 -17
  31. package/dist/node/index.js.map +1 -1
  32. package/dist/node/index.mjs +598 -17
  33. package/dist/node/index.mjs.map +1 -1
  34. package/dist/{oidcState-mQLVn3-A.d.cts → oidcState-Cz6erz0g.d.cts} +24 -3
  35. package/dist/{oidcState-DOSCgnMG.d.ts → oidcState-zGt6VU6v.d.ts} +24 -3
  36. package/dist/rest/index.d.cts +58 -7
  37. package/dist/rest/index.d.ts +58 -7
  38. package/dist/rest/index.js +594 -15
  39. package/dist/rest/index.js.map +1 -1
  40. package/dist/rest/index.mjs +592 -16
  41. package/dist/rest/index.mjs.map +1 -1
  42. package/package.json +1 -1
package/README.md CHANGED
@@ -20,13 +20,47 @@ Official TypeScript/JavaScript client SDK for [AXIAM](https://github.com/ilpanic
20
20
 
21
21
  ## Contract conformance
22
22
 
23
- This SDK conforms to **contract 1.60**: CONTRACT.md §1–§13 and §12.7, §14, §15, §17, §19,
24
- §20, §21, §22, §23, §24, §25, §26, §27, §28, §28.12, §29, §30, §31, §32 and §33, with §32.7 and
25
- §33.2 signed (including §6.1 mTLS client certificates, the
23
+ This SDK conforms to **contract 1.62**: CONTRACT.md §1–§13 and §12.7, §14, §15, §17, §19,
24
+ §20, §21, §22, §23, §24, §25, §26, §27 (with §27.6.2), §28, §28.12, §29, §30, §31, §32, §33 and §36,
25
+ with §32.7 and §33.2 signed (including §6.1 mTLS client certificates, the
26
26
  §10.1 minimum local-verification set, the §12 OIDC/SSO relying-party helpers, and the §13
27
- `verifyWebhook` signature verifier). §12 is implemented in full at its 1.38 shape: all
27
+ `verifyWebhook` signature verifier). Manifest pruning: not offered in any namespace (§27.10). §12 is implemented in full at its 1.38 shape: all
28
28
  **thirteen** operations, including the four public "Sign in with X" entry points.
29
29
 
30
+ ### Contract 1.62 — the 1.1.0 release (§34.6)
31
+
32
+ Contract 1.62 accompanies the 1.1.0 platform release; this SDK's release of it is **1.1.0**
33
+ (release 1.0.1 was never tagged, so contract 1.61 below ships in the same release). Every item of
34
+ §34.6 that names TypeScript, and what this SDK does:
35
+
36
+ | Item | Rule | What this SDK does |
37
+ |---|---|---|
38
+ | (l) the `network` namespace | §36 | `client.network`: twelve operations (202 in 29 namespaces in all) — `listSegments`/`listSegmentsAll`, `createSegment`, `getSegment`, `replaceSegment`, `deleteSegment(id, version)`, `listProfiles`/`listProfilesAll`, `createProfile`, `getProfile`, `replaceProfile`, `deleteProfile(segmentId, version)`, `getPolicy`, `replacePolicy`. Every write carries the version you read, exactly as given, and is never retried; a `409` is a `ConflictError` whose `reasonCode` is the body's `reason_code`; a `403` is an `AuthzError` carrying `action` and `resourceId`. The decision route `POST /network/decide` is not SDK work and has no method. |
39
+ | (n), (u), (v), (w) `network` in a manifest | §27.6.2 | `ManagementManifest.network` — `policy`, `segments[]` (key: site + kind + name, `kind` the wire spelling `access`/`quarantine`), `profiles[]` (key: its segment). Ordered policy, segments, profiles; drift judged on the read (a clamped timeout, `filterIds` as a set); duplicate natural keys and a repeated Filter-Id refused at `plan` with zero wire calls; `Update`s are version-conditional full replacements; a `409` stops the apply and `failure(report).reasonCode` names it. **No pruning**: like every namespace here, `network` is never deleted from. |
40
+ | (e) the change-taking form | §32.2 | `ssfStreamInputWith(stream, changes)` sends `events_requested` and `expected_updated_at` as read and cuts `events_requested` to a lowered `events_allowed`. `ssfStreamInputFrom` stays, and its documentation names the caller's duty. |
41
+ | (f) an assigned `null` is "none" | §27.11 rule 5, §32.2 | `user_id` on `certificates.generate`/`signCsr` and `expected_updated_at` on `ssf` and `scimTargets` writes: a `null` is dropped from the body, never sent. |
42
+ | (g) `expected_updated_at` is the server's string | §32.2 | Already held: `SsfStream.updated_at` is the response's own string and both converters send it unchanged. |
43
+ | (h) the three meanings at the call site | §32.2 | The TSDoc of `ssf.updateStream` states them. |
44
+ | (i) the request `user_id` is an untyped string | §27.11 rule 5 | Already held: `user_id?: string \| null` on both requests; the response `Certificate.user_id` stays as it was. |
45
+ | (m), (t) the device grant authenticates its client | §14.1 rule 2 | `deviceAuthorize` and each `devicePoll` send a configured `clientSecret` as `client_secret` in the form body (never `Authorization: Basic`) and an mTLS client presents its certificate; a public client sends none and is not refused; the poll sends `client_id`; a `401 invalid_client` is an `OAuthProtocolError`, made once, outside the §9 refresh guard. `private_key_jwt` client authentication and DPoP proof generation are not implemented by this SDK. |
46
+ | (a)–(d), (k), (p)–(s) | | Informative or no SDK work: nothing to do (`CibaPendingList` stays unmodelled). |
47
+
48
+ **SemVer.** A contract record may add a member or widen a type in a **minor** release; a removal
49
+ waits for **2.0.0**. 1.1.0 is a minor release: the one source-level break it records (the manifest
50
+ `Target` union gains three members) is of the additive kind, and it is named in the CHANGELOG.
51
+
52
+ ### Contract 1.61 — the 1.0.1 fields (§34.5), released in 1.1.0
53
+
54
+ Contract 1.61 is additive and clarifying: no route, no operation, one new optional member on
55
+ each of three models, and rules about what a read-modify-write sends. What changed here:
56
+
57
+ | Row | Rule | What this SDK does |
58
+ |---|---|---|
59
+ | `Certificate.user_id` | §27.11 rule 5 | `user_id?: string \| null` on `Certificate` and `GeneratedCertificate`: a UUID, `null` and an absent member all decode, the last two meaning "no account named"; never coalesced to a nil UUID or taken from `metadata`. On `CreateCertificateRequest` and `SignCertificateCsrRequest` it is sent exactly as given when you set it and the key is absent when you do not; the SDK does not judge the value (the server answers `400`). |
60
+ | `SsfStreamInput.expected_updated_at` | §32.2, §32.3 rule 4 | Optional; sent exactly as the stream's `updated_at` was read (not re-formatted) and absent when unset. `ssfStreamInputFrom` fills it with the read's `updated_at`, so a stream written since (the receiver's pause or narrowing included) answers `409` (`ConflictError`, never retried). |
61
+ | `events_requested` on update | §32.2 | Absent resets the stream to every allowed event, `[]` is stored as the receiver's "none", a list is stored as given. `ssfStreamInputFrom` always sends the list it read, `[]` as `[]`; if you lower `events_allowed` yourself, cut `events_requested` to it. |
62
+ | `CibaPendingList.total_pending`, `truncated` | §33.3 rule 16 | Not modelled: the type belongs to the console's `GET /api/v1/ciba/requests` route, which no registry operation returns and no SDK drives. |
63
+
30
64
  ### Contract 1.60 — the answers to #588 and the release wave (§34.4)
31
65
 
32
66
  Contract 1.60 changes no route; it answers the questions the 1.59 ports raised (§34.4
@@ -73,7 +107,7 @@ throws the failure (the first form's outcome).
73
107
  | §28.12 RFC 7592 client configuration (1.53) | `readClientRegistration`, `updateClientRegistration`, `deleteClientRegistration`, `ClientRegistration` | `AxiamClient` (see [below](#rfc-7592-client-configuration-contract-153-2812)) |
74
108
  | §30 directory configuration (1.54) | the `directory` namespace, explicit-`null` sparse update, `setDirectoryConfigFrom` | `client.directory` |
75
109
  | §29 SAML service-provider registration (1.55) | the `saml` namespace, `parseSpMetadataFromUrl` / `FromXml`, `samlServiceProviderInputFrom` | `client.saml` |
76
- | §32 SSF stream registration (1.56) | the `ssf` namespace, `ssfStreamInputFrom` | `client.ssf` |
110
+ | §32 SSF stream registration (1.56) | the `ssf` namespace, `ssfStreamInputFrom`, `ssfStreamInputWith` (1.62) | `client.ssf` |
77
111
  | §32.7 SSF receiver helper (1.56) | `SsfReceiver.verifySet` / `.poll` | `axiam-sdk/node` |
78
112
  | §31 outbound SCIM targets (1.57) | the `scim_targets` namespace, `scimTargetInputFrom` | `client.scimTargets` |
79
113
  | §33 CIBA, and §33.2's signed form (1.58) | `cibaInitiate`, `cibaPoll`, `cibaAwait`, `cibaHandlePing`, `CibaRequestSigner` (PS256, ES256, EdDSA) | `OidcClient` (`axiam-sdk/node`) |
@@ -109,7 +143,7 @@ browser bundle pulls in no Node-only code. §12.2 forbids splitting them across
109
143
  the four operations contract 1.38 adds are on `OidcClient` too, with the nine that preceded
110
144
  them, even though three of them need no Node-only code at all.
111
145
 
112
- §27 is implemented **in full**, both halves: the 190-operation imperative surface *and*
146
+ §27 is implemented **in full**, both halves: the 202-operation imperative surface *and*
113
147
  the §27.6 declarative manifest with its §27.7 `defineManifest` and decorator forms. The
114
148
  contract asks an SDK that ships only one half to say which; this one ships both.
115
149
 
@@ -181,11 +215,13 @@ See [`CONTRACT.md`](./CONTRACT.md) for the full cross-language behavioral contra
181
215
  ## Install
182
216
 
183
217
  ```bash
184
- npm install axiam-sdk@^1.0.0
218
+ npm install axiam-sdk@^1.1.0
185
219
  ```
186
220
 
187
221
  From 1.0.0 the SDK is stable and follows semantic versioning: a breaking change to its
188
- public API waits for the next major version. Releases are published on npm's `latest`
222
+ public API waits for the next major version. A contract record may add a member or widen a
223
+ type in a **minor** release (a new management namespace, an optional request member, a wider
224
+ union); **a removal waits for 2.0.0**. Releases are published on npm's `latest`
189
225
  dist-tag, so a bare `npm install axiam-sdk` resolves the newest one.
190
226
 
191
227
  ## Supported Node versions
@@ -2221,7 +2257,8 @@ contract makes an SDK repeat in their TSDoc. Every write is issued once; reads r
2221
2257
 
2222
2258
  ```ts
2223
2259
  import { Sensitive, setDirectoryConfigFrom, parseSpMetadataFromUrl,
2224
- samlServiceProviderInputFrom, ssfStreamInputFrom, scimTargetInputFrom } from 'axiam-sdk';
2260
+ samlServiceProviderInputFrom, ssfStreamInputFrom, ssfStreamInputWith,
2261
+ scimTargetInputFrom } from 'axiam-sdk';
2225
2262
 
2226
2263
  // §30 directory — a sparse update: undefined keeps, null CLEARS.
2227
2264
  await client.directory.update({ group_filter: null }); // sends {"group_filter":null}
@@ -2242,6 +2279,10 @@ await client.saml.updateServiceProvider(sp.id, { ...body, display_name: 'Payroll
2242
2279
  // §32 SSF and §31 SCIM targets — read-modify-write; the secret is left absent (kept).
2243
2280
  const stream = ssfStreamInputFrom(await client.ssf.getStream(streamId));
2244
2281
  await client.ssf.updateStream(streamId, { ...stream, description: 'rotated' });
2282
+ // Lowering events_allowed? The change-taking form cuts events_requested for you (§32.2, 1.62),
2283
+ // and sends events_requested and expected_updated_at exactly as read.
2284
+ const read = await client.ssf.getStream(streamId);
2285
+ await client.ssf.updateStream(streamId, ssfStreamInputWith(read, { events_allowed: [onlyThisOne] }));
2245
2286
  const target = scimTargetInputFrom(await client.scimTargets.get(targetId));
2246
2287
  await client.scimTargets.update(targetId, { ...target, push_groups: true });
2247
2288
  ```
@@ -2254,6 +2295,13 @@ await client.scimTargets.update(targetId, { ...target, push_groups: true });
2254
2295
  - Enums and the `ScimTargetAuth` / `ScimTargetScope` unions are open: an unknown value
2255
2296
  decodes. An unknown `auth.type` / `scope.type` is refused before it is sent back.
2256
2297
  - `getIdp` is never cached: readiness changes with every credential write.
2298
+ - **`events_requested` has three meanings on an update** (§32.2): absent *resets* the stream
2299
+ to every event of `events_allowed`; `[]` is stored as the receiver's "none"; a list is
2300
+ stored as given and refused (`400`) outside `events_allowed`. `ssfStreamInputFrom` sends the
2301
+ list it read — cutting it to a lowered `events_allowed` is then your duty;
2302
+ `ssfStreamInputWith(stream, changes)` does the cut.
2303
+ - An assigned `null` is "none" for `user_id` (certificate requests) and `expected_updated_at`
2304
+ (`ssf`, `scimTargets`): the key is omitted and `null` is never sent (§27.11 rule 5).
2257
2305
 
2258
2306
  ## SSF receiver (`axiam-sdk/node`, contract 1.56, §32.7)
2259
2307
 
@@ -2492,7 +2540,7 @@ entries are keyed by subject rather than by session.
2492
2540
  Everything above assumes a populated tenant. `login` signs a user in,
2493
2541
  `checkAccess` asks about a resource, `verifyWebhook` checks a delivery signature — and
2494
2542
  none of them can create the user, declare the resource or register the webhook. The
2495
- management surface is the part that can: **190 operations across 28 namespaces**,
2543
+ management surface is the part that can: **202 operations across 29 namespaces**,
2496
2544
  generated from `management-registry.json`, which is the whole server API minus what other
2497
2545
  contract sections own and minus organization creation and deletion (§27.0 keeps those out
2498
2546
  of reach of a client library on purpose).
@@ -2603,7 +2651,7 @@ back.
2603
2651
 
2604
2652
  ### Declarative manifests (§27.6, §27.7)
2605
2653
 
2606
- Calling 190 operations one at a time is rarely what an application wants. What it does at
2654
+ Calling 202 operations one at a time is rarely what an application wants. What it does at
2607
2655
  start-up, in a migration, or in a test fixture is assert a shape:
2608
2656
 
2609
2657
  ```ts
@@ -2641,7 +2689,7 @@ actions that would reconcile the tenant.
2641
2689
  a tenant that also holds hand-made state.
2642
2690
  - **Applying twice converges**: the second plan is all `no-change`. That is what makes
2643
2691
  re-running after a failure safe.
2644
- - **There is no transaction** across 160 independent HTTP endpoints, and `ApplyReport` does
2692
+ - **There is no transaction** across 202 independent HTTP endpoints, and `ApplyReport` does
2645
2693
  not pretend there is. If step 12 of 30 fails, steps 1–11 have happened; the report says
2646
2694
  which, execution stops rather than continuing blindly, and there is no `rollback` —
2647
2695
  because this SDK could not honour one.
@@ -2713,6 +2761,37 @@ under neither: `AxiamResource(spec)(Documents)` is exactly what the `@` syntax d
2713
2761
 
2714
2762
  `@AxiamServiceAccount({ key, name, roles })` (contract 1.51) joins the set the same way.
2715
2763
 
2764
+ #### The `network` namespace in a manifest (§27.6.2, contract 1.62)
2765
+
2766
+ ```ts
2767
+ const desired = defineManifest({
2768
+ network: {
2769
+ policy: { sessionTimeoutMaxSecs: 7200 }, // a singleton: the tenant's cap
2770
+ segments: [
2771
+ { key: 'staff', site: 'hq', kind: 'access', name: 'staff', vlanId: 20, rank: 1,
2772
+ filterIds: ['acl-a', 'acl-b'] },
2773
+ ],
2774
+ profiles: [{ segment: 'staff', sessionTimeoutSecs: 3600, filterId: 'acl-a' }],
2775
+ },
2776
+ });
2777
+ const report = await client.manifest.apply(desired);
2778
+ const failed = failure(report); // failed?.reasonCode: 'stale_version', 'duplicate_vlan', …
2779
+ ```
2780
+
2781
+ - A segment is keyed by **site + kind + name**, `kind` being the wire spelling (`access` or
2782
+ `quarantine`); a profile by **its segment**; the policy is a singleton. The order is policy,
2783
+ segments, profiles. The namespace is human-only: a service-account token meets `401`.
2784
+ - Every stated member is compared with the value **as the read returns it**: a profile's
2785
+ effective (clamped) timeout, and `filterIds` as a *set* (a reorder is `no-change`; a name
2786
+ listed twice is refused by `plan` and `apply` with no request made). A timeout stated above
2787
+ the tenant's cap is an `update` the server refuses with `403`; `apply` reports it and stops.
2788
+ - An `update` is a full, version-conditional replacement built from the read: members you
2789
+ did not state are carried, a stated `null` is left out, and a profile's `segment_version`
2790
+ is the version of this apply's own segment write when there was one. Nothing is retried or
2791
+ re-read: a `409` is that action's failure, and `outcome.reasonCode` names it.
2792
+ - **No pruning.** As for every other namespace here, `apply` never deletes; this SDK has no
2793
+ prune option for `network` either (§27.10).
2794
+
2716
2795
  ### Examples
2717
2796
 
2718
2797
  - [`examples/management-basics.ts`](examples/management-basics.ts) — the imperative surface
@@ -1,4 +1,4 @@
1
- import { A as AxiamClient, W as WebauthnWorkspace, a as WebauthnLoginResult, b as WebauthnCredential } from '../client-yD0eMwHQ.cjs';
1
+ import { A as AxiamClient, W as WebauthnWorkspace, a as WebauthnLoginResult, b as WebauthnCredential } from '../client-7ZKtfXW-.cjs';
2
2
  import { S as Sensitive } from '../sensitive-BC_s7Rrd.cjs';
3
3
  import { L as LoginResult } from '../types-zXSpiQM-.cjs';
4
4
  export { W as WebauthnFailure, c as classifyWebauthnError, w as webauthnErrorMessage } from '../webauthnErrors-fLgfOflO.cjs';
@@ -1,4 +1,4 @@
1
- import { A as AxiamClient, W as WebauthnWorkspace, a as WebauthnLoginResult, b as WebauthnCredential } from '../client-0WJkblDE.js';
1
+ import { A as AxiamClient, W as WebauthnWorkspace, a as WebauthnLoginResult, b as WebauthnCredential } from '../client-Putxo-yi.js';
2
2
  import { S as Sensitive } from '../sensitive-BC_s7Rrd.js';
3
3
  import { L as LoginResult } from '../types-BOX-6Srv.js';
4
4
  export { W as WebauthnFailure, c as classifyWebauthnError, w as webauthnErrorMessage } from '../webauthnErrors-fLgfOflO.js';