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.
- package/README.md +91 -12
- package/dist/browser/index.d.cts +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/{client-yD0eMwHQ.d.cts → client-7ZKtfXW-.d.cts} +640 -14
- package/dist/{client-0WJkblDE.d.ts → client-Putxo-yi.d.ts} +640 -14
- package/dist/{cookieJar-hWRmZkhe.d.ts → cookieJar-Cw6Zdeec.d.ts} +1 -1
- package/dist/{cookieJar-CTD5jOmd.d.cts → cookieJar-DkGcIr-i.d.cts} +1 -1
- package/dist/{errors-m0Tue_pE.d.cts → errors-CtP_lviy.d.cts} +15 -1
- package/dist/{errors-CmBvsxV0.d.ts → errors-VpViVRSx.d.ts} +15 -1
- package/dist/grpc/index.d.cts +3 -3
- package/dist/grpc/index.d.ts +3 -3
- package/dist/grpc/index.js +572 -14
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +572 -14
- package/dist/grpc/index.mjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +594 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +592 -16
- package/dist/index.mjs.map +1 -1
- package/dist/middleware/index.d.cts +3 -3
- package/dist/middleware/index.d.ts +3 -3
- package/dist/middleware/index.js +26 -3
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +26 -3
- package/dist/middleware/index.mjs.map +1 -1
- package/dist/node/index.d.cts +3 -3
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.js +598 -17
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +598 -17
- package/dist/node/index.mjs.map +1 -1
- package/dist/{oidcState-mQLVn3-A.d.cts → oidcState-Cz6erz0g.d.cts} +24 -3
- package/dist/{oidcState-DOSCgnMG.d.ts → oidcState-zGt6VU6v.d.ts} +24 -3
- package/dist/rest/index.d.cts +58 -7
- package/dist/rest/index.d.ts +58 -7
- package/dist/rest/index.js +594 -15
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/index.mjs +592 -16
- package/dist/rest/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -782,6 +782,12 @@ var SKIP_REFRESH = [
|
|
|
782
782
|
// regardless of what session state came before it.
|
|
783
783
|
"/api/v1/auth/device",
|
|
784
784
|
"/oauth2/token",
|
|
785
|
+
// CONTRACT.md §14.2 rule 5 (contract 1.62): a client that fails to
|
|
786
|
+
// authenticate at the device endpoints is `401 invalid_client`, which is not
|
|
787
|
+
// an expired session and which refreshing cannot fix. `/oauth2/token` (the
|
|
788
|
+
// poll) was already here; the authorization endpoint now authenticates the
|
|
789
|
+
// client too, so its 401 must not enter the §9 guard either.
|
|
790
|
+
"/oauth2/device_authorization",
|
|
785
791
|
"/oauth2/introspect",
|
|
786
792
|
"/oauth2/revoke"
|
|
787
793
|
];
|
|
@@ -843,6 +849,13 @@ function installRefreshInterceptor(axiosInstance, session) {
|
|
|
843
849
|
}
|
|
844
850
|
);
|
|
845
851
|
}
|
|
852
|
+
function isOAuth2Endpoint(url) {
|
|
853
|
+
if (!url) {
|
|
854
|
+
return false;
|
|
855
|
+
}
|
|
856
|
+
const path = url.split(/[?#]/, 1)[0] ?? "";
|
|
857
|
+
return path.includes("/oauth2/");
|
|
858
|
+
}
|
|
846
859
|
function installDeviceTokenInterceptor(axiosInstance, session) {
|
|
847
860
|
axiosInstance.interceptors.request.use((config) => {
|
|
848
861
|
const deviceToken = session.deviceAccessToken;
|
|
@@ -852,6 +865,9 @@ function installDeviceTokenInterceptor(axiosInstance, session) {
|
|
|
852
865
|
const noCred = session.noCredentialsConfig();
|
|
853
866
|
Object.assign(config, noCred);
|
|
854
867
|
config.headers = config.headers ?? {};
|
|
868
|
+
if (isOAuth2Endpoint(config.url)) {
|
|
869
|
+
return config;
|
|
870
|
+
}
|
|
855
871
|
config.headers["Authorization"] = `Bearer ${deviceToken.expose()}`;
|
|
856
872
|
config.headers["Cookie"] = "";
|
|
857
873
|
return config;
|
|
@@ -1810,10 +1826,25 @@ var NotFoundError = class _NotFoundError extends AuthzError {
|
|
|
1810
1826
|
var ConflictError = class _ConflictError extends AuthzError {
|
|
1811
1827
|
/** The registry operation that conflicted. */
|
|
1812
1828
|
operation;
|
|
1813
|
-
|
|
1829
|
+
/**
|
|
1830
|
+
* The body's `reason_code`, as the server spelled it (contract 1.62, §36.4),
|
|
1831
|
+
* or `undefined` when the body carries none (a server that predates it, or a
|
|
1832
|
+
* `409` of an operation that does not name one).
|
|
1833
|
+
*
|
|
1834
|
+
* The `409` of every `network` operation says which conflict it is:
|
|
1835
|
+
* `stale_version`, `strands_profile`, `has_children`, `site_gone`,
|
|
1836
|
+
* `duplicate_name`, `duplicate_vlan`, `duplicate_rank`, `profile_exists` or
|
|
1837
|
+
* `other` (§36.3 rule 2). The vocabulary is **open**: a value this SDK does
|
|
1838
|
+
* not know is surfaced verbatim, and a caller branches on this member —
|
|
1839
|
+
* never on `message`, which an SDK must not parse. It is not the `reason` of
|
|
1840
|
+
* an authorization decision (§3), which is a human string.
|
|
1841
|
+
*/
|
|
1842
|
+
reasonCode;
|
|
1843
|
+
constructor(operation, message, reasonCode) {
|
|
1814
1844
|
super(message);
|
|
1815
1845
|
this.name = "ConflictError";
|
|
1816
1846
|
this.operation = operation;
|
|
1847
|
+
this.reasonCode = reasonCode;
|
|
1817
1848
|
Object.setPrototypeOf(this, _ConflictError.prototype);
|
|
1818
1849
|
}
|
|
1819
1850
|
};
|
|
@@ -2102,6 +2133,14 @@ function omitEmptyTenantScope(body) {
|
|
|
2102
2133
|
}
|
|
2103
2134
|
return body;
|
|
2104
2135
|
}
|
|
2136
|
+
function omitNullMembers(body, members) {
|
|
2137
|
+
if (!body || typeof body !== "object") return body;
|
|
2138
|
+
const record = body;
|
|
2139
|
+
if (!members.some((m) => m in record && record[m] === null)) return body;
|
|
2140
|
+
const copy = { ...record };
|
|
2141
|
+
for (const m of members) if (copy[m] === null) delete copy[m];
|
|
2142
|
+
return copy;
|
|
2143
|
+
}
|
|
2105
2144
|
function roleAssignmentInherits(assignment) {
|
|
2106
2145
|
return assignment.inherit ?? true;
|
|
2107
2146
|
}
|
|
@@ -2574,6 +2613,7 @@ function validate(manifest) {
|
|
|
2574
2613
|
const groups = manifest.groups ?? [];
|
|
2575
2614
|
const users = manifest.users ?? [];
|
|
2576
2615
|
const serviceAccounts = manifest.serviceAccounts ?? [];
|
|
2616
|
+
const network = manifest.network;
|
|
2577
2617
|
const resourceKeys = new Set(resources.map((r) => r.key));
|
|
2578
2618
|
const scopeKeys = new Set(resources.flatMap((r) => (r.scopes ?? []).map((s) => s.key)));
|
|
2579
2619
|
const permissionKeys = new Set(permissions.map((p) => p.key));
|
|
@@ -2587,6 +2627,7 @@ function validate(manifest) {
|
|
|
2587
2627
|
duplicates("group", groups.map((g) => g.key), problems);
|
|
2588
2628
|
duplicates("user", users.map((u) => u.key), problems);
|
|
2589
2629
|
duplicates("service account", serviceAccounts.map((s) => s.key), problems);
|
|
2630
|
+
if (network !== void 0) validateNetwork(network, problems);
|
|
2590
2631
|
for (const resource of resources) {
|
|
2591
2632
|
if (resource.parent && !resourceKeys.has(resource.parent)) {
|
|
2592
2633
|
problems.push(
|
|
@@ -2666,6 +2707,46 @@ function validate(manifest) {
|
|
|
2666
2707
|
}
|
|
2667
2708
|
}
|
|
2668
2709
|
var q = (s) => JSON.stringify(s);
|
|
2710
|
+
function validateNetwork(network, problems) {
|
|
2711
|
+
if (Array.isArray(network.policy)) {
|
|
2712
|
+
problems.push("network declares more than one policy; the tenant has exactly one");
|
|
2713
|
+
}
|
|
2714
|
+
const segments = network.segments ?? [];
|
|
2715
|
+
const profiles = network.profiles ?? [];
|
|
2716
|
+
duplicates("network segment", segments.map((s) => s.key), problems);
|
|
2717
|
+
const naturalKeys = /* @__PURE__ */ new Set();
|
|
2718
|
+
for (const segment of segments) {
|
|
2719
|
+
const natural = `${segment.site}/${segment.kind}/${segment.name}`;
|
|
2720
|
+
if (naturalKeys.has(natural)) {
|
|
2721
|
+
problems.push(
|
|
2722
|
+
`network segment ${q(natural)} (site, kind, name) is declared more than once`
|
|
2723
|
+
);
|
|
2724
|
+
}
|
|
2725
|
+
naturalKeys.add(natural);
|
|
2726
|
+
const seenFilters = /* @__PURE__ */ new Set();
|
|
2727
|
+
for (const filter of segment.filterIds ?? []) {
|
|
2728
|
+
if (seenFilters.has(filter)) {
|
|
2729
|
+
problems.push(
|
|
2730
|
+
`network segment ${q(segment.key)} lists Filter-Id ${q(filter)} more than once in filterIds`
|
|
2731
|
+
);
|
|
2732
|
+
}
|
|
2733
|
+
seenFilters.add(filter);
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
const segmentKeys = new Set(segments.map((s) => s.key));
|
|
2737
|
+
const profiled = /* @__PURE__ */ new Set();
|
|
2738
|
+
for (const profile of profiles) {
|
|
2739
|
+
if (!segmentKeys.has(profile.segment)) {
|
|
2740
|
+
problems.push(
|
|
2741
|
+
`network profile names segment ${q(profile.segment)}, which no network segment declares`
|
|
2742
|
+
);
|
|
2743
|
+
}
|
|
2744
|
+
if (profiled.has(profile.segment)) {
|
|
2745
|
+
problems.push(`network segment ${q(profile.segment)} has more than one profile in the manifest`);
|
|
2746
|
+
}
|
|
2747
|
+
profiled.add(profile.segment);
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2669
2750
|
function duplicates(kind, keys, problems) {
|
|
2670
2751
|
const seen = /* @__PURE__ */ new Set();
|
|
2671
2752
|
for (const key of keys) {
|
|
@@ -2711,7 +2792,9 @@ var emptyResolved = () => ({
|
|
|
2711
2792
|
roles: /* @__PURE__ */ new Map(),
|
|
2712
2793
|
groups: /* @__PURE__ */ new Map(),
|
|
2713
2794
|
users: /* @__PURE__ */ new Map(),
|
|
2714
|
-
serviceAccounts: /* @__PURE__ */ new Map()
|
|
2795
|
+
serviceAccounts: /* @__PURE__ */ new Map(),
|
|
2796
|
+
segments: /* @__PURE__ */ new Map(),
|
|
2797
|
+
segmentVersions: /* @__PURE__ */ new Map()
|
|
2715
2798
|
});
|
|
2716
2799
|
var ManifestApi = class {
|
|
2717
2800
|
#client;
|
|
@@ -2744,6 +2827,23 @@ var ManifestApi = class {
|
|
|
2744
2827
|
async #read(manifest) {
|
|
2745
2828
|
const c = this.#client;
|
|
2746
2829
|
const start = { limit: PLAN_PAGE };
|
|
2830
|
+
if (manifest.network !== void 0 && !hasShapeSections(manifest)) {
|
|
2831
|
+
return {
|
|
2832
|
+
resources: [],
|
|
2833
|
+
scopes: /* @__PURE__ */ new Map(),
|
|
2834
|
+
permissions: [],
|
|
2835
|
+
roles: [],
|
|
2836
|
+
groups: [],
|
|
2837
|
+
users: [],
|
|
2838
|
+
serviceAccounts: [],
|
|
2839
|
+
roleGrants: /* @__PURE__ */ new Map(),
|
|
2840
|
+
roleUserBindings: /* @__PURE__ */ new Map(),
|
|
2841
|
+
roleGroupBindings: /* @__PURE__ */ new Map(),
|
|
2842
|
+
roleServiceAccountBindings: /* @__PURE__ */ new Map(),
|
|
2843
|
+
groupMembers: /* @__PURE__ */ new Map(),
|
|
2844
|
+
network: await this.#readNetwork(manifest.network, start)
|
|
2845
|
+
};
|
|
2846
|
+
}
|
|
2747
2847
|
const resources = await c.resources.listAll(start);
|
|
2748
2848
|
const permissions = await c.permissions.listAll(start);
|
|
2749
2849
|
const roles = await c.roles.listAll(start);
|
|
@@ -2799,9 +2899,29 @@ var ManifestApi = class {
|
|
|
2799
2899
|
roleUserBindings,
|
|
2800
2900
|
roleGroupBindings,
|
|
2801
2901
|
roleServiceAccountBindings,
|
|
2802
|
-
groupMembers
|
|
2902
|
+
groupMembers,
|
|
2903
|
+
network: manifest.network ? await this.#readNetwork(manifest.network, start) : void 0
|
|
2803
2904
|
};
|
|
2804
2905
|
}
|
|
2906
|
+
/**
|
|
2907
|
+
* §27.6.2 item 3: `get_policy`, `list_segments` and `list_profiles`, each
|
|
2908
|
+
* list walked to exhaustion, and nothing else — `plan` issues `GET`s only.
|
|
2909
|
+
* A section that states no policy does not read it; one that states no
|
|
2910
|
+
* profile does not list them.
|
|
2911
|
+
*/
|
|
2912
|
+
async #readNetwork(spec, start) {
|
|
2913
|
+
const c = this.#client;
|
|
2914
|
+
const policy = spec.policy ? await c.network.getPolicy() : void 0;
|
|
2915
|
+
const wantSegments = (spec.segments ?? []).length > 0 || (spec.profiles ?? []).length > 0;
|
|
2916
|
+
const segments = wantSegments ? await c.network.listSegmentsAll(void 0, start) : [];
|
|
2917
|
+
const profiles = /* @__PURE__ */ new Map();
|
|
2918
|
+
if ((spec.profiles ?? []).length) {
|
|
2919
|
+
for (const profile of await c.network.listProfilesAll(start)) {
|
|
2920
|
+
profiles.set(profile.segment_id, profile);
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
return { policy, segments, profiles };
|
|
2924
|
+
}
|
|
2805
2925
|
// -------------------------------------------------------------------
|
|
2806
2926
|
// Plan
|
|
2807
2927
|
// -------------------------------------------------------------------
|
|
@@ -3072,8 +3192,97 @@ var ManifestApi = class {
|
|
|
3072
3192
|
push
|
|
3073
3193
|
);
|
|
3074
3194
|
}
|
|
3195
|
+
if (manifest.network && snapshot.network) {
|
|
3196
|
+
this.#networkSteps(manifest.network, snapshot.network, resolved, push);
|
|
3197
|
+
}
|
|
3075
3198
|
return out;
|
|
3076
3199
|
}
|
|
3200
|
+
/**
|
|
3201
|
+
* §27.6.2 — the `network` section: the policy, then the segments, then the
|
|
3202
|
+
* profiles, a profile after its segment (item 2). Every comparison is with
|
|
3203
|
+
* the value **as the read returns it** (item 3): a profile's effective
|
|
3204
|
+
* (clamped) `session_timeout_secs`, a segment's `filter_ids` as a set.
|
|
3205
|
+
* Silence is not an assertion (rule 3): a member left off never drifts, and
|
|
3206
|
+
* the `Update` body carries the read's value for it (item 4).
|
|
3207
|
+
*/
|
|
3208
|
+
#networkSteps(spec, read, resolved, push) {
|
|
3209
|
+
if (spec.policy) {
|
|
3210
|
+
const current = read.policy;
|
|
3211
|
+
const drifted = current.session_timeout_max_secs !== spec.policy.sessionTimeoutMaxSecs;
|
|
3212
|
+
push(
|
|
3213
|
+
drifted ? "update" : "no-change",
|
|
3214
|
+
"network-policy",
|
|
3215
|
+
"network.policy",
|
|
3216
|
+
"network policy (Session-Timeout cap)",
|
|
3217
|
+
drifted ? {
|
|
3218
|
+
kind: "update-network-policy",
|
|
3219
|
+
body: {
|
|
3220
|
+
session_timeout_max_secs: spec.policy.sessionTimeoutMaxSecs,
|
|
3221
|
+
version: current.version
|
|
3222
|
+
}
|
|
3223
|
+
} : { kind: "noop" }
|
|
3224
|
+
);
|
|
3225
|
+
}
|
|
3226
|
+
const segments = spec.segments ?? [];
|
|
3227
|
+
for (const segment of segments) {
|
|
3228
|
+
const found = read.segments.find(
|
|
3229
|
+
(r) => r.site_key === segment.site && r.kind === segment.kind && r.name === segment.name
|
|
3230
|
+
);
|
|
3231
|
+
const summary = `network segment ${JSON.stringify(`${segment.site}/${segment.kind}/${segment.name}`)}`;
|
|
3232
|
+
if (!found) {
|
|
3233
|
+
push("create", "network-segment", segment.key, summary, {
|
|
3234
|
+
kind: "create-network-segment",
|
|
3235
|
+
key: segment.key,
|
|
3236
|
+
body: segmentCreateBody(segment)
|
|
3237
|
+
});
|
|
3238
|
+
continue;
|
|
3239
|
+
}
|
|
3240
|
+
resolved.segments.set(segment.key, found.id);
|
|
3241
|
+
resolved.segmentVersions.set(segment.key, found.version);
|
|
3242
|
+
const drifted = segmentDrifted(segment, found);
|
|
3243
|
+
push(
|
|
3244
|
+
drifted ? "update" : "no-change",
|
|
3245
|
+
"network-segment",
|
|
3246
|
+
segment.key,
|
|
3247
|
+
summary,
|
|
3248
|
+
drifted ? {
|
|
3249
|
+
kind: "update-network-segment",
|
|
3250
|
+
key: segment.key,
|
|
3251
|
+
id: found.id,
|
|
3252
|
+
body: segmentReplaceBody(segment, found)
|
|
3253
|
+
} : { kind: "noop" }
|
|
3254
|
+
);
|
|
3255
|
+
}
|
|
3256
|
+
const bySegment = new Map((spec.profiles ?? []).map((p) => [p.segment, p]));
|
|
3257
|
+
for (const segment of segments) {
|
|
3258
|
+
const profile = bySegment.get(segment.key);
|
|
3259
|
+
if (!profile) continue;
|
|
3260
|
+
const segmentId = resolved.segments.get(segment.key);
|
|
3261
|
+
const found = segmentId ? read.profiles.get(segmentId) : void 0;
|
|
3262
|
+
const summary = `network profile of ${JSON.stringify(`${segment.site}/${segment.kind}/${segment.name}`)}`;
|
|
3263
|
+
if (!found) {
|
|
3264
|
+
push("create", "network-profile", segment.key, summary, {
|
|
3265
|
+
kind: "create-network-profile",
|
|
3266
|
+
segment: segment.key,
|
|
3267
|
+
profile: profileCreateInput(profile)
|
|
3268
|
+
});
|
|
3269
|
+
continue;
|
|
3270
|
+
}
|
|
3271
|
+
const drifted = profileDrifted(profile, found);
|
|
3272
|
+
push(
|
|
3273
|
+
drifted ? "update" : "no-change",
|
|
3274
|
+
"network-profile",
|
|
3275
|
+
segment.key,
|
|
3276
|
+
summary,
|
|
3277
|
+
drifted ? {
|
|
3278
|
+
kind: "update-network-profile",
|
|
3279
|
+
segment: segment.key,
|
|
3280
|
+
version: found.version,
|
|
3281
|
+
profile: profileReplaceInput(profile, found)
|
|
3282
|
+
} : { kind: "noop" }
|
|
3283
|
+
);
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3077
3286
|
/**
|
|
3078
3287
|
* §27.6.1 item 2 — one subject's `roles[]` against the server's existing
|
|
3079
3288
|
* bindings for it. Shared by groups, users and service accounts: the
|
|
@@ -3141,9 +3350,14 @@ var ManifestApi = class {
|
|
|
3141
3350
|
}
|
|
3142
3351
|
} catch (err) {
|
|
3143
3352
|
stopped = true;
|
|
3353
|
+
const reasonCode = err instanceof ConflictError ? err.reasonCode : void 0;
|
|
3144
3354
|
out.push({
|
|
3145
3355
|
action,
|
|
3146
|
-
outcome: {
|
|
3356
|
+
outcome: {
|
|
3357
|
+
status: "failed",
|
|
3358
|
+
message: err instanceof Error ? err.message : String(err),
|
|
3359
|
+
...reasonCode === void 0 ? {} : { reasonCode }
|
|
3360
|
+
}
|
|
3147
3361
|
});
|
|
3148
3362
|
}
|
|
3149
3363
|
}
|
|
@@ -3250,6 +3464,34 @@ var ManifestApi = class {
|
|
|
3250
3464
|
description: step.description
|
|
3251
3465
|
});
|
|
3252
3466
|
return void 0;
|
|
3467
|
+
case "update-network-policy":
|
|
3468
|
+
await c.network.replacePolicy(step.body);
|
|
3469
|
+
return void 0;
|
|
3470
|
+
case "create-network-segment": {
|
|
3471
|
+
const created = await c.network.createSegment(step.body);
|
|
3472
|
+
resolved.segments.set(step.key, created.id);
|
|
3473
|
+
resolved.segmentVersions.set(step.key, created.version);
|
|
3474
|
+
return void 0;
|
|
3475
|
+
}
|
|
3476
|
+
case "update-network-segment": {
|
|
3477
|
+
const replaced = await c.network.replaceSegment(step.id, step.body);
|
|
3478
|
+
resolved.segmentVersions.set(step.key, replaced.version);
|
|
3479
|
+
return void 0;
|
|
3480
|
+
}
|
|
3481
|
+
case "create-network-profile":
|
|
3482
|
+
await c.network.createProfile({
|
|
3483
|
+
segment_id: lookup(resolved.segments, step.segment, "network segment"),
|
|
3484
|
+
segment_version: lookupVersion(resolved.segmentVersions, step.segment),
|
|
3485
|
+
profile: step.profile
|
|
3486
|
+
});
|
|
3487
|
+
return void 0;
|
|
3488
|
+
case "update-network-profile":
|
|
3489
|
+
await c.network.replaceProfile(lookup(resolved.segments, step.segment, "network segment"), {
|
|
3490
|
+
version: step.version,
|
|
3491
|
+
segment_version: lookupVersion(resolved.segmentVersions, step.segment),
|
|
3492
|
+
profile: step.profile
|
|
3493
|
+
});
|
|
3494
|
+
return void 0;
|
|
3253
3495
|
case "assign-role":
|
|
3254
3496
|
await this.#assign(step, resolved);
|
|
3255
3497
|
return void 0;
|
|
@@ -3387,6 +3629,94 @@ function lookup(map, key, kind) {
|
|
|
3387
3629
|
}
|
|
3388
3630
|
return id;
|
|
3389
3631
|
}
|
|
3632
|
+
function hasShapeSections(manifest) {
|
|
3633
|
+
return [
|
|
3634
|
+
manifest.resources,
|
|
3635
|
+
manifest.permissions,
|
|
3636
|
+
manifest.roles,
|
|
3637
|
+
manifest.groups,
|
|
3638
|
+
manifest.users,
|
|
3639
|
+
manifest.serviceAccounts
|
|
3640
|
+
].some((section) => (section ?? []).length > 0);
|
|
3641
|
+
}
|
|
3642
|
+
function lookupVersion(map, key) {
|
|
3643
|
+
const version = map.get(key);
|
|
3644
|
+
if (version === void 0) {
|
|
3645
|
+
throw new NetworkError(
|
|
3646
|
+
`internal: network segment key ${JSON.stringify(key)} has no version; its segment write did not run`
|
|
3647
|
+
);
|
|
3648
|
+
}
|
|
3649
|
+
return version;
|
|
3650
|
+
}
|
|
3651
|
+
function sameSet(a, b) {
|
|
3652
|
+
if (a.length !== b.length) return false;
|
|
3653
|
+
const left = new Set(a);
|
|
3654
|
+
return left.size === new Set(b).size && b.every((name) => left.has(name));
|
|
3655
|
+
}
|
|
3656
|
+
function sameOptional(stated, read) {
|
|
3657
|
+
return (stated ?? null) === (read ?? null);
|
|
3658
|
+
}
|
|
3659
|
+
function segmentCreateBody(spec) {
|
|
3660
|
+
const body = {
|
|
3661
|
+
kind: spec.kind,
|
|
3662
|
+
site_key: spec.site,
|
|
3663
|
+
name: spec.name,
|
|
3664
|
+
vlan_id: spec.vlanId
|
|
3665
|
+
};
|
|
3666
|
+
if (spec.filterIds !== void 0) body.filter_ids = [...spec.filterIds];
|
|
3667
|
+
if (spec.rank !== void 0 && spec.rank !== null) body.rank = spec.rank;
|
|
3668
|
+
if (spec.enabled !== void 0) body.enabled = spec.enabled;
|
|
3669
|
+
return body;
|
|
3670
|
+
}
|
|
3671
|
+
function segmentDrifted(spec, read) {
|
|
3672
|
+
if (spec.vlanId !== read.vlan_id) return true;
|
|
3673
|
+
if (spec.rank !== void 0 && !sameOptional(spec.rank, read.rank)) return true;
|
|
3674
|
+
if (spec.enabled !== void 0 && spec.enabled !== read.enabled) return true;
|
|
3675
|
+
if (spec.filterIds !== void 0 && !sameSet(spec.filterIds, read.filter_ids)) return true;
|
|
3676
|
+
return false;
|
|
3677
|
+
}
|
|
3678
|
+
function segmentReplaceBody(spec, read) {
|
|
3679
|
+
const body = {
|
|
3680
|
+
version: read.version,
|
|
3681
|
+
vlan_id: spec.vlanId,
|
|
3682
|
+
filter_ids: [...spec.filterIds ?? read.filter_ids],
|
|
3683
|
+
enabled: spec.enabled ?? read.enabled
|
|
3684
|
+
};
|
|
3685
|
+
const rank = spec.rank === void 0 ? read.rank : spec.rank;
|
|
3686
|
+
if (rank !== void 0 && rank !== null) body.rank = rank;
|
|
3687
|
+
return body;
|
|
3688
|
+
}
|
|
3689
|
+
function profileCreateInput(spec) {
|
|
3690
|
+
const profile = { session_timeout_secs: spec.sessionTimeoutSecs };
|
|
3691
|
+
if (spec.terminationAction != null) profile.termination_action = spec.terminationAction;
|
|
3692
|
+
if (spec.idleTimeoutSecs != null) profile.idle_timeout_secs = spec.idleTimeoutSecs;
|
|
3693
|
+
if (spec.filterId != null) profile.filter_id = spec.filterId;
|
|
3694
|
+
if (spec.serviceType != null) profile.service_type = spec.serviceType;
|
|
3695
|
+
return profile;
|
|
3696
|
+
}
|
|
3697
|
+
function profileDrifted(spec, read) {
|
|
3698
|
+
if (spec.sessionTimeoutSecs !== read.session_timeout_secs) return true;
|
|
3699
|
+
if (spec.terminationAction !== void 0 && spec.terminationAction !== null && spec.terminationAction !== read.termination_action) return true;
|
|
3700
|
+
if (spec.idleTimeoutSecs !== void 0 && !sameOptional(spec.idleTimeoutSecs, read.idle_timeout_secs)) return true;
|
|
3701
|
+
if (spec.filterId !== void 0 && !sameOptional(spec.filterId, read.filter_id)) return true;
|
|
3702
|
+
if (spec.serviceType !== void 0 && !sameOptional(spec.serviceType, read.service_type)) return true;
|
|
3703
|
+
return false;
|
|
3704
|
+
}
|
|
3705
|
+
function profileReplaceInput(spec, read) {
|
|
3706
|
+
const profile = {
|
|
3707
|
+
dictionary: read.dictionary,
|
|
3708
|
+
session_timeout_secs: spec.sessionTimeoutSecs
|
|
3709
|
+
};
|
|
3710
|
+
const termination = spec.terminationAction === void 0 ? read.termination_action : spec.terminationAction;
|
|
3711
|
+
if (termination != null) profile.termination_action = termination;
|
|
3712
|
+
const idle = spec.idleTimeoutSecs === void 0 ? read.idle_timeout_secs : spec.idleTimeoutSecs;
|
|
3713
|
+
if (idle != null) profile.idle_timeout_secs = idle;
|
|
3714
|
+
const filter = spec.filterId === void 0 ? read.filter_id : spec.filterId;
|
|
3715
|
+
if (filter != null) profile.filter_id = filter;
|
|
3716
|
+
const serviceType = spec.serviceType === void 0 ? read.service_type : spec.serviceType;
|
|
3717
|
+
if (serviceType != null) profile.service_type = serviceType;
|
|
3718
|
+
return profile;
|
|
3719
|
+
}
|
|
3390
3720
|
function bindingOf(assignment) {
|
|
3391
3721
|
return {
|
|
3392
3722
|
resourceId: assignment.resource_id ?? void 0,
|
|
@@ -3504,7 +3834,12 @@ function mapManagementError(operation, err) {
|
|
|
3504
3834
|
);
|
|
3505
3835
|
}
|
|
3506
3836
|
if (status === 409) {
|
|
3507
|
-
|
|
3837
|
+
const code = body?.reason_code;
|
|
3838
|
+
return new ConflictError(
|
|
3839
|
+
operation,
|
|
3840
|
+
`${operation}: conflict${detail}`,
|
|
3841
|
+
typeof code === "string" ? code : void 0
|
|
3842
|
+
);
|
|
3508
3843
|
}
|
|
3509
3844
|
if (status === 400 || status === 422) {
|
|
3510
3845
|
return new ValidationError(
|
|
@@ -3514,7 +3849,7 @@ function mapManagementError(operation, err) {
|
|
|
3514
3849
|
parseFieldErrors(body)
|
|
3515
3850
|
);
|
|
3516
3851
|
}
|
|
3517
|
-
return mapHttpStatusToError(status, `${operation}${detail}`, { cause: err });
|
|
3852
|
+
return mapHttpStatusToError(status, `${operation}${detail}`, { cause: err, body });
|
|
3518
3853
|
}
|
|
3519
3854
|
function describe(body) {
|
|
3520
3855
|
if (typeof body === "string" && body) return `: ${body}`;
|
|
@@ -4808,7 +5143,7 @@ var CertificatesApi = class {
|
|
|
4808
5143
|
method: "POST",
|
|
4809
5144
|
pathTemplate: "/api/v1/certificates",
|
|
4810
5145
|
path: "/api/v1/certificates",
|
|
4811
|
-
body
|
|
5146
|
+
body: omitNullMembers(body, ["user_id"])
|
|
4812
5147
|
});
|
|
4813
5148
|
return generatedCertificateFromWire(wire);
|
|
4814
5149
|
}
|
|
@@ -4825,7 +5160,7 @@ var CertificatesApi = class {
|
|
|
4825
5160
|
method: "POST",
|
|
4826
5161
|
pathTemplate: "/api/v1/certificates/sign-csr",
|
|
4827
5162
|
path: "/api/v1/certificates/sign-csr",
|
|
4828
|
-
body
|
|
5163
|
+
body: omitNullMembers(body, ["user_id"])
|
|
4829
5164
|
});
|
|
4830
5165
|
return wire;
|
|
4831
5166
|
}
|
|
@@ -6219,7 +6554,7 @@ var SsfApi = class _SsfApi {
|
|
|
6219
6554
|
method: "POST",
|
|
6220
6555
|
pathTemplate: "/api/v1/tenants/{tenant_id}/ssf/streams",
|
|
6221
6556
|
path: `/api/v1/tenants/${tenantId}/ssf/streams`,
|
|
6222
|
-
body: ssfStreamInputToWire(body)
|
|
6557
|
+
body: omitNullMembers(ssfStreamInputToWire(body), ["expected_updated_at"])
|
|
6223
6558
|
});
|
|
6224
6559
|
return scrubSsfStream(wire);
|
|
6225
6560
|
}
|
|
@@ -6242,8 +6577,19 @@ var SsfApi = class _SsfApi {
|
|
|
6242
6577
|
* update moves `endpoint_url` to another scheme, host or port while a header
|
|
6243
6578
|
* is stored: then it must carry `authorization_header` again or
|
|
6244
6579
|
* `clear_authorization_header: true`, else `400` (§32.3 rule 5). Start from
|
|
6245
|
-
* `
|
|
6246
|
-
*
|
|
6580
|
+
* `ssfStreamInputWith(await ssf.getStream(id), changes)`, which sends the
|
|
6581
|
+
* `events_requested` and `expected_updated_at` it read and cuts
|
|
6582
|
+
* `events_requested` to a lowered `events_allowed` (or from the plain
|
|
6583
|
+
* converter `ssfStreamInputFrom`, where the cut is yours). An update
|
|
6584
|
+
* overtaken by the receiver's own write is `409`: read the stream again.
|
|
6585
|
+
* **`events_requested` has three meanings on an update** (§32.2, contract
|
|
6586
|
+
* 1.62): **absent resets** the stream to every event of `events_allowed` —
|
|
6587
|
+
* widening what the receiver narrowed; **`[]` is stored as the receiver's
|
|
6588
|
+
* "none"** and the stream carries nothing; **a list is stored as given** and
|
|
6589
|
+
* refused (`400`) if any entry is outside `events_allowed`. A raw API client
|
|
6590
|
+
* is bound by the same meaning: an `events_requested` left out of the `PUT`
|
|
6591
|
+
* resets the stream. `expected_updated_at` is the `updated_at` you read, as
|
|
6592
|
+
* the server's own string; an assigned `null` is "none" and is not sent.
|
|
6247
6593
|
*
|
|
6248
6594
|
* **This is a replacement, not a patch** (§27.4 rule 5). Only the required
|
|
6249
6595
|
* members must be set, but what you do not carry over from a prior read is
|
|
@@ -6261,7 +6607,7 @@ var SsfApi = class _SsfApi {
|
|
|
6261
6607
|
method: "PUT",
|
|
6262
6608
|
pathTemplate: "/api/v1/tenants/{tenant_id}/ssf/streams/{stream_id}",
|
|
6263
6609
|
path: `/api/v1/tenants/${tenantId}/ssf/streams/${encodeURIComponent(streamId)}`,
|
|
6264
|
-
body: ssfStreamInputToWire(body)
|
|
6610
|
+
body: omitNullMembers(ssfStreamInputToWire(body), ["expected_updated_at"])
|
|
6265
6611
|
});
|
|
6266
6612
|
return scrubSsfStream(wire);
|
|
6267
6613
|
}
|
|
@@ -6329,7 +6675,7 @@ var ScimTargetsApi = class {
|
|
|
6329
6675
|
method: "POST",
|
|
6330
6676
|
pathTemplate: "/api/v1/scim-targets",
|
|
6331
6677
|
path: "/api/v1/scim-targets",
|
|
6332
|
-
body: scimTargetInputToWire(body)
|
|
6678
|
+
body: omitNullMembers(scimTargetInputToWire(body), ["expected_updated_at"])
|
|
6333
6679
|
});
|
|
6334
6680
|
return scrubScimTargetResponse(wire);
|
|
6335
6681
|
}
|
|
@@ -6376,7 +6722,7 @@ var ScimTargetsApi = class {
|
|
|
6376
6722
|
method: "PUT",
|
|
6377
6723
|
pathTemplate: "/api/v1/scim-targets/{id}",
|
|
6378
6724
|
path: `/api/v1/scim-targets/${encodeURIComponent(id)}`,
|
|
6379
|
-
body: scimTargetInputToWire(body)
|
|
6725
|
+
body: omitNullMembers(scimTargetInputToWire(body), ["expected_updated_at"])
|
|
6380
6726
|
});
|
|
6381
6727
|
return scrubScimTargetResponse(wire);
|
|
6382
6728
|
}
|
|
@@ -6420,6 +6766,215 @@ var ScimTargetsApi = class {
|
|
|
6420
6766
|
}
|
|
6421
6767
|
};
|
|
6422
6768
|
|
|
6769
|
+
// src/management/ops/network.ts
|
|
6770
|
+
var NetworkApi = class {
|
|
6771
|
+
#client;
|
|
6772
|
+
#scope;
|
|
6773
|
+
/** @internal — reached through `client.<namespace>`, never constructed directly. */
|
|
6774
|
+
constructor(client, scope = {}) {
|
|
6775
|
+
this.#client = client;
|
|
6776
|
+
this.#scope = scope;
|
|
6777
|
+
}
|
|
6778
|
+
/** `GET /api/v1/network/segments` */
|
|
6779
|
+
async listSegments(site, page = {}) {
|
|
6780
|
+
const wire = await sendManagement(this.#client, {
|
|
6781
|
+
operation: "network.list_segments",
|
|
6782
|
+
method: "GET",
|
|
6783
|
+
pathTemplate: "/api/v1/network/segments",
|
|
6784
|
+
path: "/api/v1/network/segments",
|
|
6785
|
+
query: { ...pageQuery(page), "site": site }
|
|
6786
|
+
});
|
|
6787
|
+
return wire;
|
|
6788
|
+
}
|
|
6789
|
+
/**
|
|
6790
|
+
* Walk `network.list_segments` to exhaustion, concatenating every page.
|
|
6791
|
+
*
|
|
6792
|
+
* The auto-paging form §27.4 rule 4 requires. It stops on an empty page even
|
|
6793
|
+
* if `total` disagrees, so a misreporting server costs one wasted request
|
|
6794
|
+
* rather than an unbounded loop.
|
|
6795
|
+
*/
|
|
6796
|
+
listSegmentsAll(site, start = {}) {
|
|
6797
|
+
return collectPages(start, (p) => this.listSegments(site, p));
|
|
6798
|
+
}
|
|
6799
|
+
/**
|
|
6800
|
+
* `POST /api/v1/network/segments`
|
|
6801
|
+
*
|
|
6802
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
6803
|
+
* issued exactly once, including the ones that look idempotent.
|
|
6804
|
+
*/
|
|
6805
|
+
async createSegment(body) {
|
|
6806
|
+
const wire = await sendManagement(this.#client, {
|
|
6807
|
+
operation: "network.create_segment",
|
|
6808
|
+
method: "POST",
|
|
6809
|
+
pathTemplate: "/api/v1/network/segments",
|
|
6810
|
+
path: "/api/v1/network/segments",
|
|
6811
|
+
body
|
|
6812
|
+
});
|
|
6813
|
+
return wire;
|
|
6814
|
+
}
|
|
6815
|
+
/** `GET /api/v1/network/segments/{id}` */
|
|
6816
|
+
async getSegment(id) {
|
|
6817
|
+
const wire = await sendManagement(this.#client, {
|
|
6818
|
+
operation: "network.get_segment",
|
|
6819
|
+
method: "GET",
|
|
6820
|
+
pathTemplate: "/api/v1/network/segments/{id}",
|
|
6821
|
+
path: `/api/v1/network/segments/${encodeURIComponent(id)}`
|
|
6822
|
+
});
|
|
6823
|
+
return wire;
|
|
6824
|
+
}
|
|
6825
|
+
/**
|
|
6826
|
+
* `PUT /api/v1/network/segments/{id}`
|
|
6827
|
+
*
|
|
6828
|
+
* **This is a replacement, not a patch** (§27.4 rule 5). Only the required
|
|
6829
|
+
* members must be set, but what you do not carry over from a prior read is
|
|
6830
|
+
* not preserved: an optional member left out is overwritten with its
|
|
6831
|
+
* default, not kept (except where noted above). Read first, change the field
|
|
6832
|
+
* you mean, send the whole thing back.
|
|
6833
|
+
*
|
|
6834
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
6835
|
+
* issued exactly once, including the ones that look idempotent.
|
|
6836
|
+
*/
|
|
6837
|
+
async replaceSegment(id, body) {
|
|
6838
|
+
const wire = await sendManagement(this.#client, {
|
|
6839
|
+
operation: "network.replace_segment",
|
|
6840
|
+
method: "PUT",
|
|
6841
|
+
pathTemplate: "/api/v1/network/segments/{id}",
|
|
6842
|
+
path: `/api/v1/network/segments/${encodeURIComponent(id)}`,
|
|
6843
|
+
body
|
|
6844
|
+
});
|
|
6845
|
+
return wire;
|
|
6846
|
+
}
|
|
6847
|
+
/**
|
|
6848
|
+
* `DELETE /api/v1/network/segments/{id}`
|
|
6849
|
+
*
|
|
6850
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
6851
|
+
* issued exactly once, including the ones that look idempotent.
|
|
6852
|
+
*/
|
|
6853
|
+
async deleteSegment(id, version) {
|
|
6854
|
+
await sendManagement(this.#client, {
|
|
6855
|
+
operation: "network.delete_segment",
|
|
6856
|
+
method: "DELETE",
|
|
6857
|
+
pathTemplate: "/api/v1/network/segments/{id}",
|
|
6858
|
+
path: `/api/v1/network/segments/${encodeURIComponent(id)}`,
|
|
6859
|
+
query: { "version": String(version) }
|
|
6860
|
+
});
|
|
6861
|
+
}
|
|
6862
|
+
/** `GET /api/v1/network/profiles` */
|
|
6863
|
+
async listProfiles(page = {}) {
|
|
6864
|
+
const wire = await sendManagement(this.#client, {
|
|
6865
|
+
operation: "network.list_profiles",
|
|
6866
|
+
method: "GET",
|
|
6867
|
+
pathTemplate: "/api/v1/network/profiles",
|
|
6868
|
+
path: "/api/v1/network/profiles",
|
|
6869
|
+
query: { ...pageQuery(page) }
|
|
6870
|
+
});
|
|
6871
|
+
return wire;
|
|
6872
|
+
}
|
|
6873
|
+
/**
|
|
6874
|
+
* Walk `network.list_profiles` to exhaustion, concatenating every page.
|
|
6875
|
+
*
|
|
6876
|
+
* The auto-paging form §27.4 rule 4 requires. It stops on an empty page even
|
|
6877
|
+
* if `total` disagrees, so a misreporting server costs one wasted request
|
|
6878
|
+
* rather than an unbounded loop.
|
|
6879
|
+
*/
|
|
6880
|
+
listProfilesAll(start = {}) {
|
|
6881
|
+
return collectPages(start, (p) => this.listProfiles(p));
|
|
6882
|
+
}
|
|
6883
|
+
/**
|
|
6884
|
+
* `POST /api/v1/network/profiles`
|
|
6885
|
+
*
|
|
6886
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
6887
|
+
* issued exactly once, including the ones that look idempotent.
|
|
6888
|
+
*/
|
|
6889
|
+
async createProfile(body) {
|
|
6890
|
+
const wire = await sendManagement(this.#client, {
|
|
6891
|
+
operation: "network.create_profile",
|
|
6892
|
+
method: "POST",
|
|
6893
|
+
pathTemplate: "/api/v1/network/profiles",
|
|
6894
|
+
path: "/api/v1/network/profiles",
|
|
6895
|
+
body
|
|
6896
|
+
});
|
|
6897
|
+
return wire;
|
|
6898
|
+
}
|
|
6899
|
+
/** `GET /api/v1/network/profiles/{segment_id}` */
|
|
6900
|
+
async getProfile(segmentId) {
|
|
6901
|
+
const wire = await sendManagement(this.#client, {
|
|
6902
|
+
operation: "network.get_profile",
|
|
6903
|
+
method: "GET",
|
|
6904
|
+
pathTemplate: "/api/v1/network/profiles/{segment_id}",
|
|
6905
|
+
path: `/api/v1/network/profiles/${encodeURIComponent(segmentId)}`
|
|
6906
|
+
});
|
|
6907
|
+
return wire;
|
|
6908
|
+
}
|
|
6909
|
+
/**
|
|
6910
|
+
* `PUT /api/v1/network/profiles/{segment_id}`
|
|
6911
|
+
*
|
|
6912
|
+
* **This is a replacement, not a patch** (§27.4 rule 5). Every field of the
|
|
6913
|
+
* body is required, and what you do not carry over from a prior read is not
|
|
6914
|
+
* preserved — it is overwritten. Read first, change the field you mean, send
|
|
6915
|
+
* the whole thing back.
|
|
6916
|
+
*
|
|
6917
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
6918
|
+
* issued exactly once, including the ones that look idempotent.
|
|
6919
|
+
*/
|
|
6920
|
+
async replaceProfile(segmentId, body) {
|
|
6921
|
+
const wire = await sendManagement(this.#client, {
|
|
6922
|
+
operation: "network.replace_profile",
|
|
6923
|
+
method: "PUT",
|
|
6924
|
+
pathTemplate: "/api/v1/network/profiles/{segment_id}",
|
|
6925
|
+
path: `/api/v1/network/profiles/${encodeURIComponent(segmentId)}`,
|
|
6926
|
+
body
|
|
6927
|
+
});
|
|
6928
|
+
return wire;
|
|
6929
|
+
}
|
|
6930
|
+
/**
|
|
6931
|
+
* `DELETE /api/v1/network/profiles/{segment_id}`
|
|
6932
|
+
*
|
|
6933
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
6934
|
+
* issued exactly once, including the ones that look idempotent.
|
|
6935
|
+
*/
|
|
6936
|
+
async deleteProfile(segmentId, version) {
|
|
6937
|
+
await sendManagement(this.#client, {
|
|
6938
|
+
operation: "network.delete_profile",
|
|
6939
|
+
method: "DELETE",
|
|
6940
|
+
pathTemplate: "/api/v1/network/profiles/{segment_id}",
|
|
6941
|
+
path: `/api/v1/network/profiles/${encodeURIComponent(segmentId)}`,
|
|
6942
|
+
query: { "version": String(version) }
|
|
6943
|
+
});
|
|
6944
|
+
}
|
|
6945
|
+
/** `GET /api/v1/network/policy` */
|
|
6946
|
+
async getPolicy() {
|
|
6947
|
+
const wire = await sendManagement(this.#client, {
|
|
6948
|
+
operation: "network.get_policy",
|
|
6949
|
+
method: "GET",
|
|
6950
|
+
pathTemplate: "/api/v1/network/policy",
|
|
6951
|
+
path: "/api/v1/network/policy"
|
|
6952
|
+
});
|
|
6953
|
+
return wire;
|
|
6954
|
+
}
|
|
6955
|
+
/**
|
|
6956
|
+
* `PUT /api/v1/network/policy`
|
|
6957
|
+
*
|
|
6958
|
+
* **This is a replacement, not a patch** (§27.4 rule 5). Every field of the
|
|
6959
|
+
* body is required, and what you do not carry over from a prior read is not
|
|
6960
|
+
* preserved — it is overwritten. Read first, change the field you mean, send
|
|
6961
|
+
* the whole thing back.
|
|
6962
|
+
*
|
|
6963
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
6964
|
+
* issued exactly once, including the ones that look idempotent.
|
|
6965
|
+
*/
|
|
6966
|
+
async replacePolicy(body) {
|
|
6967
|
+
const wire = await sendManagement(this.#client, {
|
|
6968
|
+
operation: "network.replace_policy",
|
|
6969
|
+
method: "PUT",
|
|
6970
|
+
pathTemplate: "/api/v1/network/policy",
|
|
6971
|
+
path: "/api/v1/network/policy",
|
|
6972
|
+
body
|
|
6973
|
+
});
|
|
6974
|
+
return wire;
|
|
6975
|
+
}
|
|
6976
|
+
};
|
|
6977
|
+
|
|
6423
6978
|
// src/management/ops/settings.ts
|
|
6424
6979
|
var SettingsApi = class _SettingsApi {
|
|
6425
6980
|
#client;
|
|
@@ -7044,6 +7599,9 @@ function managementNamespaces(client) {
|
|
|
7044
7599
|
get scimTargets() {
|
|
7045
7600
|
return new ScimTargetsApi(client);
|
|
7046
7601
|
},
|
|
7602
|
+
get network() {
|
|
7603
|
+
return new NetworkApi(client);
|
|
7604
|
+
},
|
|
7047
7605
|
get settings() {
|
|
7048
7606
|
return new SettingsApi(client);
|
|
7049
7607
|
},
|
|
@@ -9169,9 +9727,21 @@ var OidcClient = class {
|
|
|
9169
9727
|
* and obtain the code pair.
|
|
9170
9728
|
*
|
|
9171
9729
|
* @remarks
|
|
9172
|
-
* **
|
|
9173
|
-
*
|
|
9174
|
-
*
|
|
9730
|
+
* **The client authenticates as it does at every other token request
|
|
9731
|
+
* (contract 1.62, §14.1 rule 2).** A client built with a `clientSecret` sends
|
|
9732
|
+
* it as `client_secret` in the **form body** — never as `Authorization:
|
|
9733
|
+
* Basic`, whatever the client is registered for (§12.1 rule 3 stands for
|
|
9734
|
+
* this route, and the maintainer's 2026-10-16 "same rules" reading fixes the
|
|
9735
|
+
* form body) — and a client with a §6.1 client certificate presents it on the
|
|
9736
|
+
* connection, through the `mtls_endpoint_aliases` entry when discovery
|
|
9737
|
+
* publishes one (§21.3). **A public client sends no credential at all** and
|
|
9738
|
+
* is never refused client-side, so a device that cannot hold a secret still
|
|
9739
|
+
* works. The SDK sends a credential only when its caller configured one: it
|
|
9740
|
+
* never borrows one from another configuration. `private_key_jwt` client
|
|
9741
|
+
* authentication is not implemented by this SDK.
|
|
9742
|
+
*
|
|
9743
|
+
* A `401` with `{"error":"invalid_client"}` is an {@link OAuthProtocolError}
|
|
9744
|
+
* (§14.2 rule 5), is made once, and does not enter the §9 refresh guard.
|
|
9175
9745
|
*/
|
|
9176
9746
|
async deviceAuthorize(params = {}) {
|
|
9177
9747
|
const configuration = params.configuration ?? await this.oidcDiscover();
|
|
@@ -9183,6 +9753,7 @@ var OidcClient = class {
|
|
|
9183
9753
|
}
|
|
9184
9754
|
const form = new URLSearchParams();
|
|
9185
9755
|
form.set("client_id", this.#options.clientId);
|
|
9756
|
+
this.#appendClientSecret(form);
|
|
9186
9757
|
if (params.scope !== void 0) {
|
|
9187
9758
|
form.set("scope", Array.isArray(params.scope) ? params.scope.join(" ") : params.scope);
|
|
9188
9759
|
}
|
|
@@ -9293,6 +9864,15 @@ var OidcClient = class {
|
|
|
9293
9864
|
* {@link OAuthProtocolError} — `authorization_pending` and `slow_down`
|
|
9294
9865
|
* included — so a hand-rolled loop sees exactly what {@link deviceLogin}
|
|
9295
9866
|
* sees. Most callers want {@link deviceLogin}.
|
|
9867
|
+
*
|
|
9868
|
+
* Client authentication is the one {@link deviceAuthorize} describes
|
|
9869
|
+
* (contract 1.62, §14.1 rule 2): a configured `clientSecret` is sent as
|
|
9870
|
+
* `client_secret` in the form body, never as `Authorization: Basic`; a public
|
|
9871
|
+
* client sends none; `client_id` is sent on **every** poll (§14.1 rule 3). A
|
|
9872
|
+
* `401 invalid_client` surfaces as {@link OAuthProtocolError}, is not retried
|
|
9873
|
+
* and does not enter the §9 refresh guard (§14.2 rule 5). This SDK ships no
|
|
9874
|
+
* DPoP proof generator, so it cannot drive a client registered for DPoP; it
|
|
9875
|
+
* surfaces that client's refusal as the same `invalid_client`.
|
|
9296
9876
|
*/
|
|
9297
9877
|
async devicePoll(params) {
|
|
9298
9878
|
const configuration = params.configuration ?? await this.oidcDiscover();
|
|
@@ -9300,6 +9880,7 @@ var OidcClient = class {
|
|
|
9300
9880
|
form.set("grant_type", DEVICE_CODE_GRANT_TYPE);
|
|
9301
9881
|
form.set("device_code", exposeSecret(params.deviceCode));
|
|
9302
9882
|
form.set("client_id", this.#options.clientId);
|
|
9883
|
+
this.#appendClientSecret(form);
|
|
9303
9884
|
const wire = await this.#postToken(configuration, form, params.tenantId);
|
|
9304
9885
|
return this.#toTokenSet(wire, configuration, void 0);
|
|
9305
9886
|
}
|