@nizam-os/dashboard-sdk 3.0.0 → 4.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 (34) hide show
  1. package/dist/Client.d.ts +3 -0
  2. package/dist/Client.js +20 -16
  3. package/dist/api/resources/activeOrganization/client/Client.d.ts +61 -0
  4. package/dist/api/resources/activeOrganization/client/Client.js +179 -0
  5. package/dist/api/resources/activeOrganization/client/index.d.ts +1 -0
  6. package/dist/api/resources/activeOrganization/client/index.js +17 -0
  7. package/dist/api/resources/activeOrganization/client/requests/SetActiveOrganizationRequest.d.ts +10 -0
  8. package/dist/api/resources/activeOrganization/client/requests/SetActiveOrganizationRequest.js +3 -0
  9. package/dist/api/resources/activeOrganization/client/requests/index.d.ts +1 -0
  10. package/dist/api/resources/activeOrganization/client/requests/index.js +2 -0
  11. package/dist/api/resources/activeOrganization/exports.d.ts +2 -0
  12. package/dist/api/resources/activeOrganization/exports.js +21 -0
  13. package/dist/api/resources/activeOrganization/index.d.ts +1 -0
  14. package/dist/api/resources/activeOrganization/index.js +17 -0
  15. package/dist/api/resources/index.d.ts +2 -0
  16. package/dist/api/resources/index.js +3 -1
  17. package/dist/api/resources/invites/client/Client.d.ts +1 -1
  18. package/dist/api/resources/invites/client/Client.js +1 -1
  19. package/dist/api/resources/invites/client/requests/CreateInviteRequest.d.ts +3 -4
  20. package/dist/api/resources/invites/client/requests/CreateInviteRequest.js +1 -2
  21. package/dist/api/resources/organizations/client/Client.d.ts +1 -1
  22. package/dist/api/resources/organizations/client/Client.js +1 -1
  23. package/dist/api/types/ActiveOrganization.d.ts +21 -0
  24. package/dist/api/types/ActiveOrganization.js +11 -0
  25. package/dist/api/types/Invite.d.ts +0 -1
  26. package/dist/api/types/Invite.js +0 -1
  27. package/dist/api/types/Membership.d.ts +0 -1
  28. package/dist/api/types/Membership.js +0 -1
  29. package/dist/api/types/MembershipChoice.d.ts +25 -0
  30. package/dist/api/types/MembershipChoice.js +16 -0
  31. package/dist/api/types/Organization.d.ts +1 -1
  32. package/dist/api/types/index.d.ts +2 -0
  33. package/dist/api/types/index.js +2 -0
  34. 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/assets/client/Client.js");
39
- const Client_js_2 = require("./api/resources/assignments/client/Client.js");
40
- const Client_js_3 = require("./api/resources/invites/client/Client.js");
41
- const Client_js_4 = require("./api/resources/lookups/client/Client.js");
42
- const Client_js_5 = require("./api/resources/memberships/client/Client.js");
43
- const Client_js_6 = require("./api/resources/operators/client/Client.js");
44
- const Client_js_7 = require("./api/resources/organizations/client/Client.js");
45
- const Client_js_8 = require("./api/resources/users/client/Client.js");
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 Client_js_1.AssetsClient(this._options)));
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 Client_js_2.AssignmentsClient(this._options)));
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 Client_js_3.InvitesClient(this._options)));
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 Client_js_4.LookupsClient(this._options)));
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 Client_js_8.UsersClient(this._options)));
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 Client_js_5.MembershipsClient(this._options)));
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 Client_js_6.OperatorsClient(this._options)));
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 Client_js_7.OrganizationsClient(this._options)));
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,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * slug: "acme-logistics"
5
+ * }
6
+ */
7
+ export interface SetActiveOrganizationRequest {
8
+ /** Slug of the organization to make active. Must match an active membership. */
9
+ slug: string;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type { SetActiveOrganizationRequest } from "./SetActiveOrganizationRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { ActiveOrganizationClient } from "./client/Client.js";
2
+ export * from "./client/index.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);
@@ -28,7 +28,7 @@ export declare class InvitesClient {
28
28
  * await client.invites.createInvite({
29
29
  * organization_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
30
30
  * email: "ali@nizam.ai",
31
- * role: "super_admin",
31
+ * role: "dispatcher",
32
32
  * ttl_days: 7
33
33
  * })
34
34
  */
@@ -64,7 +64,7 @@ class InvitesClient {
64
64
  * await client.invites.createInvite({
65
65
  * organization_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
66
66
  * email: "ali@nizam.ai",
67
- * role: "super_admin",
67
+ * role: "dispatcher",
68
68
  * ttl_days: 7
69
69
  * })
70
70
  */
@@ -3,7 +3,7 @@
3
3
  * {
4
4
  * organization_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
5
5
  * email: "ali@nizam.ai",
6
- * role: "super_admin",
6
+ * role: "dispatcher",
7
7
  * ttl_days: 7
8
8
  * }
9
9
  */
@@ -12,15 +12,14 @@ export interface CreateInviteRequest {
12
12
  organization_id: string;
13
13
  /** Recipient email. */
14
14
  email: string;
15
- /** Role the recipient will hold after acceptance. Lowercase enum names from MembershipRole. */
15
+ /** Role the recipient will hold after acceptance. */
16
16
  role: CreateInviteRequest.Role;
17
17
  /** TTL in days. Defaults to 7. */
18
18
  ttl_days?: number;
19
19
  }
20
20
  export declare namespace CreateInviteRequest {
21
- /** Role the recipient will hold after acceptance. Lowercase enum names from MembershipRole. */
21
+ /** Role the recipient will hold after acceptance. */
22
22
  const Role: {
23
- readonly SuperAdmin: "super_admin";
24
23
  readonly Admin: "admin";
25
24
  readonly Dispatcher: "dispatcher";
26
25
  readonly Manager: "manager";
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.CreateInviteRequest = void 0;
5
5
  var CreateInviteRequest;
6
6
  (function (CreateInviteRequest) {
7
- /** Role the recipient will hold after acceptance. Lowercase enum names from MembershipRole. */
7
+ /** Role the recipient will hold after acceptance. */
8
8
  CreateInviteRequest.Role = {
9
- SuperAdmin: "super_admin",
10
9
  Admin: "admin",
11
10
  Dispatcher: "dispatcher",
12
11
  Manager: "manager",
@@ -8,7 +8,7 @@ export declare namespace OrganizationsClient {
8
8
  }
9
9
  }
10
10
  /**
11
- * Organization aggregate tenant CRUD.
11
+ * Tenantsthe top-level container for users, merchants, and operations.
12
12
  */
13
13
  export declare class OrganizationsClient {
14
14
  protected readonly _options: NormalizedClientOptionsWithAuth<OrganizationsClient.Options>;
@@ -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
- * Organization aggregate tenant CRUD.
46
+ * Tenantsthe top-level container for users, merchants, and operations.
47
47
  */
48
48
  class OrganizationsClient {
49
49
  constructor(options) {
@@ -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 = {}));
@@ -22,7 +22,6 @@ export interface Invite {
22
22
  export declare namespace Invite {
23
23
  /** Role the recipient will hold after acceptance. */
24
24
  const Role: {
25
- readonly SuperAdmin: "super_admin";
26
25
  readonly Admin: "admin";
27
26
  readonly Dispatcher: "dispatcher";
28
27
  readonly Manager: "manager";
@@ -6,7 +6,6 @@ var Invite;
6
6
  (function (Invite) {
7
7
  /** Role the recipient will hold after acceptance. */
8
8
  Invite.Role = {
9
- SuperAdmin: "super_admin",
10
9
  Admin: "admin",
11
10
  Dispatcher: "dispatcher",
12
11
  Manager: "manager",
@@ -12,7 +12,6 @@ export interface Membership {
12
12
  export declare namespace Membership {
13
13
  /** The user's role in this organization. */
14
14
  const Role: {
15
- readonly SuperAdmin: "super_admin";
16
15
  readonly Admin: "admin";
17
16
  readonly Dispatcher: "dispatcher";
18
17
  readonly Manager: "manager";
@@ -6,7 +6,6 @@ var Membership;
6
6
  (function (Membership) {
7
7
  /** The user's role in this organization. */
8
8
  Membership.Role = {
9
- SuperAdmin: "super_admin",
10
9
  Admin: "admin",
11
10
  Dispatcher: "dispatcher",
12
11
  Manager: "manager",
@@ -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 = {}));
@@ -2,7 +2,7 @@
2
2
  * A tenant — a logistics company, 3PL, or LSP.
3
3
  */
4
4
  export interface Organization {
5
- /** Stable UUID. Equal to the Keycloak Organization id. */
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;
@@ -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,6 +20,7 @@ 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";
22
24
  export * from "./Operator.js";
23
25
  export * from "./Organization.js";
24
26
  export * from "./ProblemDetail.js";
@@ -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,6 +36,7 @@ __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);
38
40
  __exportStar(require("./Operator.js"), exports);
39
41
  __exportStar(require("./Organization.js"), exports);
40
42
  __exportStar(require("./ProblemDetail.js"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizam-os/dashboard-sdk",
3
- "version": "3.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Nizam Dashboard API SDK for TypeScript / JavaScript.",
5
5
  "license": "MIT",
6
6
  "private": false,