@nizam-os/dashboard-sdk 4.0.0 → 4.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/dist/Client.d.ts +3 -0
- package/dist/Client.js +20 -16
- package/dist/api/resources/activeOrganization/client/Client.d.ts +61 -0
- package/dist/api/resources/activeOrganization/client/Client.js +179 -0
- package/dist/api/resources/activeOrganization/client/index.d.ts +1 -0
- package/dist/api/resources/activeOrganization/client/index.js +17 -0
- package/dist/api/resources/activeOrganization/client/requests/SetActiveOrganizationRequest.d.ts +10 -0
- package/dist/api/resources/activeOrganization/client/requests/SetActiveOrganizationRequest.js +3 -0
- package/dist/api/resources/activeOrganization/client/requests/index.d.ts +1 -0
- package/dist/api/resources/activeOrganization/client/requests/index.js +2 -0
- package/dist/api/resources/activeOrganization/exports.d.ts +2 -0
- package/dist/api/resources/activeOrganization/exports.js +21 -0
- package/dist/api/resources/activeOrganization/index.d.ts +1 -0
- package/dist/api/resources/activeOrganization/index.js +17 -0
- package/dist/api/resources/index.d.ts +2 -0
- package/dist/api/resources/index.js +3 -1
- package/dist/api/resources/organizations/client/Client.d.ts +3 -1
- package/dist/api/resources/organizations/client/Client.js +3 -1
- package/dist/api/types/ActiveOrganization.d.ts +21 -0
- package/dist/api/types/ActiveOrganization.js +11 -0
- package/dist/api/types/MembershipChoice.d.ts +25 -0
- package/dist/api/types/MembershipChoice.js +16 -0
- package/dist/api/types/MembershipDriftResponse.d.ts +13 -0
- package/dist/api/types/MembershipDriftResponse.js +3 -0
- package/dist/api/types/Organization.d.ts +3 -1
- package/dist/api/types/ReconcileResponse.d.ts +12 -0
- package/dist/api/types/ReconcileResponse.js +3 -0
- package/dist/api/types/index.d.ts +4 -0
- package/dist/api/types/index.js +4 -0
- package/dist/core/fetcher/getResponseBody.js +11 -0
- package/package.json +1 -1
package/dist/Client.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ActiveOrganizationClient } from "./api/resources/activeOrganization/client/Client.js";
|
|
1
2
|
import { AssetsClient } from "./api/resources/assets/client/Client.js";
|
|
2
3
|
import { AssignmentsClient } from "./api/resources/assignments/client/Client.js";
|
|
3
4
|
import { InvitesClient } from "./api/resources/invites/client/Client.js";
|
|
@@ -21,6 +22,7 @@ export declare class NizamDashboardClient {
|
|
|
21
22
|
protected _invites: InvitesClient | undefined;
|
|
22
23
|
protected _lookups: LookupsClient | undefined;
|
|
23
24
|
protected _users: UsersClient | undefined;
|
|
25
|
+
protected _activeOrganization: ActiveOrganizationClient | undefined;
|
|
24
26
|
protected _memberships: MembershipsClient | undefined;
|
|
25
27
|
protected _operators: OperatorsClient | undefined;
|
|
26
28
|
protected _organizations: OrganizationsClient | undefined;
|
|
@@ -30,6 +32,7 @@ export declare class NizamDashboardClient {
|
|
|
30
32
|
get invites(): InvitesClient;
|
|
31
33
|
get lookups(): LookupsClient;
|
|
32
34
|
get users(): UsersClient;
|
|
35
|
+
get activeOrganization(): ActiveOrganizationClient;
|
|
33
36
|
get memberships(): MembershipsClient;
|
|
34
37
|
get operators(): OperatorsClient;
|
|
35
38
|
get organizations(): OrganizationsClient;
|
package/dist/Client.js
CHANGED
|
@@ -35,14 +35,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.NizamDashboardClient = void 0;
|
|
38
|
-
const Client_js_1 = require("./api/resources/
|
|
39
|
-
const Client_js_2 = require("./api/resources/
|
|
40
|
-
const Client_js_3 = require("./api/resources/
|
|
41
|
-
const Client_js_4 = require("./api/resources/
|
|
42
|
-
const Client_js_5 = require("./api/resources/
|
|
43
|
-
const Client_js_6 = require("./api/resources/
|
|
44
|
-
const Client_js_7 = require("./api/resources/
|
|
45
|
-
const Client_js_8 = require("./api/resources/
|
|
38
|
+
const Client_js_1 = require("./api/resources/activeOrganization/client/Client.js");
|
|
39
|
+
const Client_js_2 = require("./api/resources/assets/client/Client.js");
|
|
40
|
+
const Client_js_3 = require("./api/resources/assignments/client/Client.js");
|
|
41
|
+
const Client_js_4 = require("./api/resources/invites/client/Client.js");
|
|
42
|
+
const Client_js_5 = require("./api/resources/lookups/client/Client.js");
|
|
43
|
+
const Client_js_6 = require("./api/resources/memberships/client/Client.js");
|
|
44
|
+
const Client_js_7 = require("./api/resources/operators/client/Client.js");
|
|
45
|
+
const Client_js_8 = require("./api/resources/organizations/client/Client.js");
|
|
46
|
+
const Client_js_9 = require("./api/resources/users/client/Client.js");
|
|
46
47
|
const BaseClient_js_1 = require("./BaseClient.js");
|
|
47
48
|
const core = __importStar(require("./core/index.js"));
|
|
48
49
|
class NizamDashboardClient {
|
|
@@ -50,28 +51,31 @@ class NizamDashboardClient {
|
|
|
50
51
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
51
52
|
}
|
|
52
53
|
get assets() {
|
|
53
|
-
return (this._assets ?? (this._assets = new
|
|
54
|
+
return (this._assets ?? (this._assets = new Client_js_2.AssetsClient(this._options)));
|
|
54
55
|
}
|
|
55
56
|
get assignments() {
|
|
56
|
-
return (this._assignments ?? (this._assignments = new
|
|
57
|
+
return (this._assignments ?? (this._assignments = new Client_js_3.AssignmentsClient(this._options)));
|
|
57
58
|
}
|
|
58
59
|
get invites() {
|
|
59
|
-
return (this._invites ?? (this._invites = new
|
|
60
|
+
return (this._invites ?? (this._invites = new Client_js_4.InvitesClient(this._options)));
|
|
60
61
|
}
|
|
61
62
|
get lookups() {
|
|
62
|
-
return (this._lookups ?? (this._lookups = new
|
|
63
|
+
return (this._lookups ?? (this._lookups = new Client_js_5.LookupsClient(this._options)));
|
|
63
64
|
}
|
|
64
65
|
get users() {
|
|
65
|
-
return (this._users ?? (this._users = new
|
|
66
|
+
return (this._users ?? (this._users = new Client_js_9.UsersClient(this._options)));
|
|
67
|
+
}
|
|
68
|
+
get activeOrganization() {
|
|
69
|
+
return (this._activeOrganization ?? (this._activeOrganization = new Client_js_1.ActiveOrganizationClient(this._options)));
|
|
66
70
|
}
|
|
67
71
|
get memberships() {
|
|
68
|
-
return (this._memberships ?? (this._memberships = new
|
|
72
|
+
return (this._memberships ?? (this._memberships = new Client_js_6.MembershipsClient(this._options)));
|
|
69
73
|
}
|
|
70
74
|
get operators() {
|
|
71
|
-
return (this._operators ?? (this._operators = new
|
|
75
|
+
return (this._operators ?? (this._operators = new Client_js_7.OperatorsClient(this._options)));
|
|
72
76
|
}
|
|
73
77
|
get organizations() {
|
|
74
|
-
return (this._organizations ?? (this._organizations = new
|
|
78
|
+
return (this._organizations ?? (this._organizations = new Client_js_8.OrganizationsClient(this._options)));
|
|
75
79
|
}
|
|
76
80
|
/**
|
|
77
81
|
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
|
+
import * as core from "../../../../core/index.js";
|
|
4
|
+
import * as NizamDashboard from "../../../index.js";
|
|
5
|
+
export declare namespace ActiveOrganizationClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get and set the caller's preferred active organization — server-side cross-session memory of the picker choice (#65).
|
|
12
|
+
*/
|
|
13
|
+
export declare class ActiveOrganizationClient {
|
|
14
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<ActiveOrganizationClient.Options>;
|
|
15
|
+
constructor(options: ActiveOrganizationClient.Options);
|
|
16
|
+
/**
|
|
17
|
+
* Returns the active organization the request was actually scoped to, the caller's stored
|
|
18
|
+
* preference, and the full memberships list. SPA bootstrap uses this to decide post-login
|
|
19
|
+
* routing without making three separate calls.
|
|
20
|
+
*
|
|
21
|
+
* The returned `active_organization_id` mirrors the principal's already-resolved scope —
|
|
22
|
+
* the value the active-org enricher pinned on this request, after consulting the
|
|
23
|
+
* X-Nizam-Organization header (if any), the stored preference, and the active memberships.
|
|
24
|
+
*
|
|
25
|
+
* @param {ActiveOrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
26
|
+
*
|
|
27
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
28
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
29
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* await client.activeOrganization.getActiveOrganization()
|
|
33
|
+
*/
|
|
34
|
+
getActiveOrganization(requestOptions?: ActiveOrganizationClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.ActiveOrganization>;
|
|
35
|
+
private __getActiveOrganization;
|
|
36
|
+
/**
|
|
37
|
+
* Persists the caller's "remembered active org" preference. The slug must name an
|
|
38
|
+
* organization the caller is currently an active member of — otherwise the call fails
|
|
39
|
+
* with `403 tenant.not_a_member` (same code the X-Nizam-Organization header path uses),
|
|
40
|
+
* never silently writes the preference for an inaccessible org.
|
|
41
|
+
*
|
|
42
|
+
* On success, returns the new bundled state in one round-trip. The cached
|
|
43
|
+
* membership context for the caller is invalidated so the next request sees the new
|
|
44
|
+
* preference immediately.
|
|
45
|
+
*
|
|
46
|
+
* @param {NizamDashboard.SetActiveOrganizationRequest} request
|
|
47
|
+
* @param {ActiveOrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
|
+
*
|
|
49
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
50
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
51
|
+
* @throws {@link NizamDashboard.UnprocessableEntityError}
|
|
52
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* await client.activeOrganization.setActiveOrganization({
|
|
56
|
+
* slug: "acme-logistics"
|
|
57
|
+
* })
|
|
58
|
+
*/
|
|
59
|
+
setActiveOrganization(request: NizamDashboard.SetActiveOrganizationRequest, requestOptions?: ActiveOrganizationClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.ActiveOrganization>;
|
|
60
|
+
private __setActiveOrganization;
|
|
61
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.ActiveOrganizationClient = void 0;
|
|
38
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
39
|
+
const headers_js_1 = require("../../../../core/headers.js");
|
|
40
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
41
|
+
const environments = __importStar(require("../../../../environments.js"));
|
|
42
|
+
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
43
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
44
|
+
const NizamDashboard = __importStar(require("../../../index.js"));
|
|
45
|
+
/**
|
|
46
|
+
* Get and set the caller's preferred active organization — server-side cross-session memory of the picker choice (#65).
|
|
47
|
+
*/
|
|
48
|
+
class ActiveOrganizationClient {
|
|
49
|
+
constructor(options) {
|
|
50
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns the active organization the request was actually scoped to, the caller's stored
|
|
54
|
+
* preference, and the full memberships list. SPA bootstrap uses this to decide post-login
|
|
55
|
+
* routing without making three separate calls.
|
|
56
|
+
*
|
|
57
|
+
* The returned `active_organization_id` mirrors the principal's already-resolved scope —
|
|
58
|
+
* the value the active-org enricher pinned on this request, after consulting the
|
|
59
|
+
* X-Nizam-Organization header (if any), the stored preference, and the active memberships.
|
|
60
|
+
*
|
|
61
|
+
* @param {ActiveOrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
|
+
*
|
|
63
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
64
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
65
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* await client.activeOrganization.getActiveOrganization()
|
|
69
|
+
*/
|
|
70
|
+
getActiveOrganization(requestOptions) {
|
|
71
|
+
return core.HttpResponsePromise.fromPromise(this.__getActiveOrganization(requestOptions));
|
|
72
|
+
}
|
|
73
|
+
async __getActiveOrganization(requestOptions) {
|
|
74
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
75
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
76
|
+
const _response = await core.fetcher({
|
|
77
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
78
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
79
|
+
environments.NizamDashboardEnvironment.Production, "v1/me/active-organization"),
|
|
80
|
+
method: "GET",
|
|
81
|
+
headers: _headers,
|
|
82
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
83
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
84
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
85
|
+
abortSignal: requestOptions?.abortSignal,
|
|
86
|
+
fetchFn: this._options?.fetch,
|
|
87
|
+
logging: this._options.logging,
|
|
88
|
+
});
|
|
89
|
+
if (_response.ok) {
|
|
90
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
91
|
+
}
|
|
92
|
+
if (_response.error.reason === "status-code") {
|
|
93
|
+
switch (_response.error.statusCode) {
|
|
94
|
+
case 401:
|
|
95
|
+
throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
96
|
+
case 403:
|
|
97
|
+
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
98
|
+
case 500:
|
|
99
|
+
throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
|
|
100
|
+
default:
|
|
101
|
+
throw new errors.NizamDashboardError({
|
|
102
|
+
statusCode: _response.error.statusCode,
|
|
103
|
+
body: _response.error.body,
|
|
104
|
+
rawResponse: _response.rawResponse,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/me/active-organization");
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Persists the caller's "remembered active org" preference. The slug must name an
|
|
112
|
+
* organization the caller is currently an active member of — otherwise the call fails
|
|
113
|
+
* with `403 tenant.not_a_member` (same code the X-Nizam-Organization header path uses),
|
|
114
|
+
* never silently writes the preference for an inaccessible org.
|
|
115
|
+
*
|
|
116
|
+
* On success, returns the new bundled state in one round-trip. The cached
|
|
117
|
+
* membership context for the caller is invalidated so the next request sees the new
|
|
118
|
+
* preference immediately.
|
|
119
|
+
*
|
|
120
|
+
* @param {NizamDashboard.SetActiveOrganizationRequest} request
|
|
121
|
+
* @param {ActiveOrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
122
|
+
*
|
|
123
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
124
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
125
|
+
* @throws {@link NizamDashboard.UnprocessableEntityError}
|
|
126
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* await client.activeOrganization.setActiveOrganization({
|
|
130
|
+
* slug: "acme-logistics"
|
|
131
|
+
* })
|
|
132
|
+
*/
|
|
133
|
+
setActiveOrganization(request, requestOptions) {
|
|
134
|
+
return core.HttpResponsePromise.fromPromise(this.__setActiveOrganization(request, requestOptions));
|
|
135
|
+
}
|
|
136
|
+
async __setActiveOrganization(request, requestOptions) {
|
|
137
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
138
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
139
|
+
const _response = await core.fetcher({
|
|
140
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
141
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
142
|
+
environments.NizamDashboardEnvironment.Production, "v1/me/active-organization"),
|
|
143
|
+
method: "PATCH",
|
|
144
|
+
headers: _headers,
|
|
145
|
+
contentType: "application/json",
|
|
146
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
147
|
+
requestType: "json",
|
|
148
|
+
body: request,
|
|
149
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
150
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
151
|
+
abortSignal: requestOptions?.abortSignal,
|
|
152
|
+
fetchFn: this._options?.fetch,
|
|
153
|
+
logging: this._options.logging,
|
|
154
|
+
});
|
|
155
|
+
if (_response.ok) {
|
|
156
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
157
|
+
}
|
|
158
|
+
if (_response.error.reason === "status-code") {
|
|
159
|
+
switch (_response.error.statusCode) {
|
|
160
|
+
case 401:
|
|
161
|
+
throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
162
|
+
case 403:
|
|
163
|
+
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
164
|
+
case 422:
|
|
165
|
+
throw new NizamDashboard.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
166
|
+
case 500:
|
|
167
|
+
throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
|
|
168
|
+
default:
|
|
169
|
+
throw new errors.NizamDashboardError({
|
|
170
|
+
statusCode: _response.error.statusCode,
|
|
171
|
+
body: _response.error.body,
|
|
172
|
+
rawResponse: _response.rawResponse,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v1/me/active-organization");
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.ActiveOrganizationClient = ActiveOrganizationClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests/index.js"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { SetActiveOrganizationRequest } from "./SetActiveOrganizationRequest.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ActiveOrganizationClient = void 0;
|
|
19
|
+
var Client_js_1 = require("./client/Client.js");
|
|
20
|
+
Object.defineProperty(exports, "ActiveOrganizationClient", { enumerable: true, get: function () { return Client_js_1.ActiveOrganizationClient; } });
|
|
21
|
+
__exportStar(require("./client/index.js"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./client/index.js"), exports);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export * from "./activeOrganization/client/requests/index.js";
|
|
2
|
+
export * as activeOrganization from "./activeOrganization/index.js";
|
|
1
3
|
export * from "./assets/client/requests/index.js";
|
|
2
4
|
export * as assets from "./assets/index.js";
|
|
3
5
|
export * from "./assignments/client/requests/index.js";
|
|
@@ -36,7 +36,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.users = exports.organizations = exports.operators = exports.memberships = exports.lookups = exports.invites = exports.assignments = exports.assets = void 0;
|
|
39
|
+
exports.users = exports.organizations = exports.operators = exports.memberships = exports.lookups = exports.invites = exports.assignments = exports.assets = exports.activeOrganization = void 0;
|
|
40
|
+
__exportStar(require("./activeOrganization/client/requests/index.js"), exports);
|
|
41
|
+
exports.activeOrganization = __importStar(require("./activeOrganization/index.js"));
|
|
40
42
|
__exportStar(require("./assets/client/requests/index.js"), exports);
|
|
41
43
|
exports.assets = __importStar(require("./assets/index.js"));
|
|
42
44
|
__exportStar(require("./assignments/client/requests/index.js"), exports);
|
|
@@ -8,7 +8,7 @@ export declare namespace OrganizationsClient {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Tenants — the top-level container for users, merchants, and operations.
|
|
12
12
|
*/
|
|
13
13
|
export declare class OrganizationsClient {
|
|
14
14
|
protected readonly _options: NormalizedClientOptionsWithAuth<OrganizationsClient.Options>;
|
|
@@ -16,6 +16,8 @@ export declare class OrganizationsClient {
|
|
|
16
16
|
/**
|
|
17
17
|
* Creates a brand-new tenant with the calling user as the founding admin. The id is assigned by Keycloak so the same value identifies the organization in both systems. Slug is derived from the name when not supplied.
|
|
18
18
|
*
|
|
19
|
+
* Supports the standard `Idempotency-Key` header — submit a UUID v4 per logical attempt (same value on retry). Cached responses replay for matching request bodies; mismatching fingerprints surface as 409 `idempotency.key_conflict`.
|
|
20
|
+
*
|
|
19
21
|
* @param {NizamDashboard.CreateOrganizationRequest} request
|
|
20
22
|
* @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
21
23
|
*
|
|
@@ -43,7 +43,7 @@ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatu
|
|
|
43
43
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
44
44
|
const NizamDashboard = __importStar(require("../../../index.js"));
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* Tenants — the top-level container for users, merchants, and operations.
|
|
47
47
|
*/
|
|
48
48
|
class OrganizationsClient {
|
|
49
49
|
constructor(options) {
|
|
@@ -52,6 +52,8 @@ class OrganizationsClient {
|
|
|
52
52
|
/**
|
|
53
53
|
* Creates a brand-new tenant with the calling user as the founding admin. The id is assigned by Keycloak so the same value identifies the organization in both systems. Slug is derived from the name when not supplied.
|
|
54
54
|
*
|
|
55
|
+
* Supports the standard `Idempotency-Key` header — submit a UUID v4 per logical attempt (same value on retry). Cached responses replay for matching request bodies; mismatching fingerprints surface as 409 `idempotency.key_conflict`.
|
|
56
|
+
*
|
|
55
57
|
* @param {NizamDashboard.CreateOrganizationRequest} request
|
|
56
58
|
* @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
57
59
|
*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type * as NizamDashboard from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The caller's resolved active organization, stored preference, and full list of memberships.
|
|
4
|
+
*/
|
|
5
|
+
export interface ActiveOrganization {
|
|
6
|
+
/** ID of the organization the request was actually scoped to. Null when the caller has no active memberships. */
|
|
7
|
+
active_organization_id?: string | undefined;
|
|
8
|
+
/** Stored preference (users.last_active_organization_id). Null when the user has never picked. */
|
|
9
|
+
preferred_organization_id?: string | undefined;
|
|
10
|
+
/** All active memberships for the picker UI. */
|
|
11
|
+
memberships?: NizamDashboard.MembershipChoice[] | undefined;
|
|
12
|
+
/** Object type discriminator (Stripe pattern). */
|
|
13
|
+
object?: ActiveOrganization.Object_ | undefined;
|
|
14
|
+
}
|
|
15
|
+
export declare namespace ActiveOrganization {
|
|
16
|
+
/** Object type discriminator (Stripe pattern). */
|
|
17
|
+
const Object_: {
|
|
18
|
+
readonly ActiveOrganization: "active_organization";
|
|
19
|
+
};
|
|
20
|
+
type Object_ = (typeof Object_)[keyof typeof Object_];
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ActiveOrganization = void 0;
|
|
5
|
+
var ActiveOrganization;
|
|
6
|
+
(function (ActiveOrganization) {
|
|
7
|
+
/** Object type discriminator (Stripe pattern). */
|
|
8
|
+
ActiveOrganization.Object_ = {
|
|
9
|
+
ActiveOrganization: "active_organization",
|
|
10
|
+
};
|
|
11
|
+
})(ActiveOrganization || (exports.ActiveOrganization = ActiveOrganization = {}));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One of the caller's active memberships — surfaced in the organization.select_required picker body.
|
|
3
|
+
*/
|
|
4
|
+
export interface MembershipChoice {
|
|
5
|
+
/** Stable id of the organization. */
|
|
6
|
+
organization_id?: string | undefined;
|
|
7
|
+
/** URL-safe handle for the organization. */
|
|
8
|
+
slug?: string | undefined;
|
|
9
|
+
/** Display name. */
|
|
10
|
+
name?: string | undefined;
|
|
11
|
+
/** The caller's role in this organization. Lowercase enum names from MembershipRole. */
|
|
12
|
+
role?: MembershipChoice.Role | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare namespace MembershipChoice {
|
|
15
|
+
/** The caller's role in this organization. Lowercase enum names from MembershipRole. */
|
|
16
|
+
const Role: {
|
|
17
|
+
readonly Admin: "admin";
|
|
18
|
+
readonly Dispatcher: "dispatcher";
|
|
19
|
+
readonly Manager: "manager";
|
|
20
|
+
readonly Staff: "staff";
|
|
21
|
+
readonly Viewer: "viewer";
|
|
22
|
+
readonly BillingAdmin: "billing_admin";
|
|
23
|
+
};
|
|
24
|
+
type Role = (typeof Role)[keyof typeof Role];
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MembershipChoice = void 0;
|
|
5
|
+
var MembershipChoice;
|
|
6
|
+
(function (MembershipChoice) {
|
|
7
|
+
/** The caller's role in this organization. Lowercase enum names from MembershipRole. */
|
|
8
|
+
MembershipChoice.Role = {
|
|
9
|
+
Admin: "admin",
|
|
10
|
+
Dispatcher: "dispatcher",
|
|
11
|
+
Manager: "manager",
|
|
12
|
+
Staff: "staff",
|
|
13
|
+
Viewer: "viewer",
|
|
14
|
+
BillingAdmin: "billing_admin",
|
|
15
|
+
};
|
|
16
|
+
})(MembershipChoice || (exports.MembershipChoice = MembershipChoice = {}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One org with divergent membership sets.
|
|
3
|
+
*/
|
|
4
|
+
export interface MembershipDriftResponse {
|
|
5
|
+
/** Nizam organization id. */
|
|
6
|
+
organization_id?: string | undefined;
|
|
7
|
+
/** Matching Keycloak organization id. */
|
|
8
|
+
keycloak_id?: string | undefined;
|
|
9
|
+
/** User ids present in the Nizam member set but not in KC. */
|
|
10
|
+
in_nizam_only?: string[] | undefined;
|
|
11
|
+
/** User ids present in the KC member set but not in Nizam. */
|
|
12
|
+
in_kc_only?: string[] | undefined;
|
|
13
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* A tenant — a logistics company, 3PL, or LSP.
|
|
3
3
|
*/
|
|
4
4
|
export interface Organization {
|
|
5
|
-
/** Stable UUID.
|
|
5
|
+
/** Stable UUID owned by Nizam. Pin this value in URLs and external integrations. The matching Keycloak Organization is tracked server-side via a separate keycloak_id bridge and is not exposed over the SDK; do not assume the two ids are equal. */
|
|
6
6
|
id?: string | undefined;
|
|
7
7
|
/** Display name. */
|
|
8
8
|
name?: string | undefined;
|
|
@@ -16,6 +16,8 @@ export interface Organization {
|
|
|
16
16
|
owner_user_id?: string | undefined;
|
|
17
17
|
/** When this organization was created. */
|
|
18
18
|
created_at?: string | undefined;
|
|
19
|
+
/** Populated ONLY on the POST /v1/organizations create response — the active organization id Nizam pinned for the founder as part of the same transaction that created the org. Null on every other endpoint (GET, list, membership embeds). Per issue #67 phase 1, the SPA writes its active-org cookie from this field instead of issuing a follow-up PATCH /v1/me/active-organization. */
|
|
20
|
+
active_organization_id?: string | undefined;
|
|
19
21
|
/** Object type discriminator (Stripe pattern). */
|
|
20
22
|
object?: Organization.Object_ | undefined;
|
|
21
23
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type * as NizamDashboard from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Drift report for a single aggregate reconciliation.
|
|
4
|
+
*/
|
|
5
|
+
export interface ReconcileResponse {
|
|
6
|
+
/** Nizam org ids whose stored keycloak_id no longer resolves on the KC side. */
|
|
7
|
+
nizam_has_kc_missing?: string[] | undefined;
|
|
8
|
+
/** KC org ids with no matching Nizam organizations.keycloak_id row. */
|
|
9
|
+
kc_has_nizam_missing?: string[] | undefined;
|
|
10
|
+
/** Per-org membership-set divergences (KC vs Nizam). */
|
|
11
|
+
membership_divergent?: NizamDashboard.MembershipDriftResponse[] | undefined;
|
|
12
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./ActiveOrganization.js";
|
|
1
2
|
export * from "./ApiFieldError.js";
|
|
2
3
|
export * from "./Asset.js";
|
|
3
4
|
export * from "./Assignment.js";
|
|
@@ -19,9 +20,12 @@ export * from "./ListResponseMembership.js";
|
|
|
19
20
|
export * from "./ListResponseTimezone.js";
|
|
20
21
|
export * from "./ListResponseUserResource.js";
|
|
21
22
|
export * from "./Membership.js";
|
|
23
|
+
export * from "./MembershipChoice.js";
|
|
24
|
+
export * from "./MembershipDriftResponse.js";
|
|
22
25
|
export * from "./Operator.js";
|
|
23
26
|
export * from "./Organization.js";
|
|
24
27
|
export * from "./ProblemDetail.js";
|
|
28
|
+
export * from "./ReconcileResponse.js";
|
|
25
29
|
export * from "./Timezone.js";
|
|
26
30
|
export * from "./User.js";
|
|
27
31
|
export * from "./UserResource.js";
|
package/dist/api/types/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ActiveOrganization.js"), exports);
|
|
17
18
|
__exportStar(require("./ApiFieldError.js"), exports);
|
|
18
19
|
__exportStar(require("./Asset.js"), exports);
|
|
19
20
|
__exportStar(require("./Assignment.js"), exports);
|
|
@@ -35,9 +36,12 @@ __exportStar(require("./ListResponseMembership.js"), exports);
|
|
|
35
36
|
__exportStar(require("./ListResponseTimezone.js"), exports);
|
|
36
37
|
__exportStar(require("./ListResponseUserResource.js"), exports);
|
|
37
38
|
__exportStar(require("./Membership.js"), exports);
|
|
39
|
+
__exportStar(require("./MembershipChoice.js"), exports);
|
|
40
|
+
__exportStar(require("./MembershipDriftResponse.js"), exports);
|
|
38
41
|
__exportStar(require("./Operator.js"), exports);
|
|
39
42
|
__exportStar(require("./Organization.js"), exports);
|
|
40
43
|
__exportStar(require("./ProblemDetail.js"), exports);
|
|
44
|
+
__exportStar(require("./ReconcileResponse.js"), exports);
|
|
41
45
|
__exportStar(require("./Timezone.js"), exports);
|
|
42
46
|
__exportStar(require("./User.js"), exports);
|
|
43
47
|
__exportStar(require("./UserResource.js"), exports);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getResponseBody = getResponseBody;
|
|
4
4
|
const json_js_1 = require("../json.js");
|
|
5
5
|
const BinaryResponse_js_1 = require("./BinaryResponse.js");
|
|
6
|
+
// Pins the upstream Response so undici's FinalizationRegistry can't GC it and cancel the body stream.
|
|
7
|
+
function retainResponse(target, response) {
|
|
8
|
+
Object.defineProperty(target, "__fern_response_ref", {
|
|
9
|
+
value: response,
|
|
10
|
+
enumerable: false,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: false,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
6
15
|
async function getResponseBody(response, responseType) {
|
|
7
16
|
switch (responseType) {
|
|
8
17
|
case "binary-response":
|
|
@@ -21,6 +30,7 @@ async function getResponseBody(response, responseType) {
|
|
|
21
30
|
},
|
|
22
31
|
};
|
|
23
32
|
}
|
|
33
|
+
retainResponse(response.body, response);
|
|
24
34
|
return response.body;
|
|
25
35
|
case "streaming":
|
|
26
36
|
if (response.body == null) {
|
|
@@ -32,6 +42,7 @@ async function getResponseBody(response, responseType) {
|
|
|
32
42
|
},
|
|
33
43
|
};
|
|
34
44
|
}
|
|
45
|
+
retainResponse(response.body, response);
|
|
35
46
|
return response.body;
|
|
36
47
|
case "text":
|
|
37
48
|
return await response.text();
|