@nizam-os/dashboard-sdk 4.2.0 → 5.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.
@@ -19,6 +19,7 @@ export declare class AssignmentsClient {
19
19
  * @param {NizamDashboard.OpenAssignmentRequest} request
20
20
  * @param {AssignmentsClient.RequestOptions} requestOptions - Request-specific configuration.
21
21
  *
22
+ * @throws {@link NizamDashboard.BadRequestError}
22
23
  * @throws {@link NizamDashboard.UnauthorizedError}
23
24
  * @throws {@link NizamDashboard.ForbiddenError}
24
25
  * @throws {@link NizamDashboard.ConflictError}
@@ -55,6 +55,7 @@ class AssignmentsClient {
55
55
  * @param {NizamDashboard.OpenAssignmentRequest} request
56
56
  * @param {AssignmentsClient.RequestOptions} requestOptions - Request-specific configuration.
57
57
  *
58
+ * @throws {@link NizamDashboard.BadRequestError}
58
59
  * @throws {@link NizamDashboard.UnauthorizedError}
59
60
  * @throws {@link NizamDashboard.ForbiddenError}
60
61
  * @throws {@link NizamDashboard.ConflictError}
@@ -95,6 +96,8 @@ class AssignmentsClient {
95
96
  }
96
97
  if (_response.error.reason === "status-code") {
97
98
  switch (_response.error.statusCode) {
99
+ case 400:
100
+ throw new NizamDashboard.BadRequestError(_response.error.body, _response.rawResponse);
98
101
  case 401:
99
102
  throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
100
103
  case 403:
@@ -19,6 +19,7 @@ export declare class OperatorsClient {
19
19
  * @param {NizamDashboard.CreateOperatorRequest} request
20
20
  * @param {OperatorsClient.RequestOptions} requestOptions - Request-specific configuration.
21
21
  *
22
+ * @throws {@link NizamDashboard.BadRequestError}
22
23
  * @throws {@link NizamDashboard.UnauthorizedError}
23
24
  * @throws {@link NizamDashboard.ForbiddenError}
24
25
  * @throws {@link NizamDashboard.UnprocessableEntityError}
@@ -55,6 +55,7 @@ class OperatorsClient {
55
55
  * @param {NizamDashboard.CreateOperatorRequest} request
56
56
  * @param {OperatorsClient.RequestOptions} requestOptions - Request-specific configuration.
57
57
  *
58
+ * @throws {@link NizamDashboard.BadRequestError}
58
59
  * @throws {@link NizamDashboard.UnauthorizedError}
59
60
  * @throws {@link NizamDashboard.ForbiddenError}
60
61
  * @throws {@link NizamDashboard.UnprocessableEntityError}
@@ -108,6 +109,8 @@ class OperatorsClient {
108
109
  }
109
110
  if (_response.error.reason === "status-code") {
110
111
  switch (_response.error.statusCode) {
112
+ case 400:
113
+ throw new NizamDashboard.BadRequestError(_response.error.body, _response.rawResponse);
111
114
  case 401:
112
115
  throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
113
116
  case 403:
@@ -37,7 +37,7 @@ export declare class UsersClient {
37
37
  me(requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.User>;
38
38
  private __me;
39
39
  /**
40
- * Dashboard sees co-members of the caller's active organization (tenant-scoped via the organization_users join). Platform staff bypass RLS and see across tenants, and may sort by `deleted_at`. RFC 8288 Link header carries `first`, `prev`, `next` rels alongside the body's bidirectional cursors.
40
+ * Dashboard sees co-members of the caller's active organization (tenant-scoped via the organization_users join). Platform staff bypass RLS and see across tenants. Allowed sort fields: `created_at`, `name` (prefix with `-` for descending). RFC 8288 Link header carries `first`, `prev`, `next` rels alongside the body's bidirectional cursors.
41
41
  *
42
42
  * @param {NizamDashboard.ListUsersRequest} request
43
43
  * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -75,44 +75,4 @@ export declare class UsersClient {
75
75
  */
76
76
  inviteUser(request: NizamDashboard.InviteUserRequest, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.UserResource>;
77
77
  private __inviteUser;
78
- /**
79
- * Tenant-admin operation. Sets `deleted_at = NOW()`. Subsequent dashboard reads filter the row out; platform staff can still surface and act on it.
80
- *
81
- * @param {NizamDashboard.SoftDeleteUserRequest} request
82
- * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
83
- *
84
- * @throws {@link NizamDashboard.UnauthorizedError}
85
- * @throws {@link NizamDashboard.ForbiddenError}
86
- * @throws {@link NizamDashboard.NotFoundError}
87
- * @throws {@link NizamDashboard.InternalServerError}
88
- *
89
- * @example
90
- * await client.users.softDeleteUser({
91
- * id: "00000000-0000-0000-0000-000000000000"
92
- * })
93
- */
94
- softDeleteUser(request: NizamDashboard.SoftDeleteUserRequest, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<void>;
95
- private __softDeleteUser;
96
- /**
97
- * Tenant-admin operation. Body has no `status` — lifecycle changes go through the platform-staff surface.
98
- *
99
- * @param {NizamDashboard.UserUpdateRequest} request
100
- * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
101
- *
102
- * @throws {@link NizamDashboard.UnauthorizedError}
103
- * @throws {@link NizamDashboard.ForbiddenError}
104
- * @throws {@link NizamDashboard.NotFoundError}
105
- * @throws {@link NizamDashboard.ConflictError}
106
- * @throws {@link NizamDashboard.UnprocessableEntityError}
107
- * @throws {@link NizamDashboard.InternalServerError}
108
- *
109
- * @example
110
- * await client.users.updateUser({
111
- * id: "00000000-0000-0000-0000-000000000000",
112
- * email: "renamed@acme.example",
113
- * name: "Ali Issa"
114
- * })
115
- */
116
- updateUser(request: NizamDashboard.UserUpdateRequest, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.UserResource>;
117
- private __updateUser;
118
78
  }
@@ -113,7 +113,7 @@ class UsersClient {
113
113
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/me");
114
114
  }
115
115
  /**
116
- * Dashboard sees co-members of the caller's active organization (tenant-scoped via the organization_users join). Platform staff bypass RLS and see across tenants, and may sort by `deleted_at`. RFC 8288 Link header carries `first`, `prev`, `next` rels alongside the body's bidirectional cursors.
116
+ * Dashboard sees co-members of the caller's active organization (tenant-scoped via the organization_users join). Platform staff bypass RLS and see across tenants. Allowed sort fields: `created_at`, `name` (prefix with `-` for descending). RFC 8288 Link header carries `first`, `prev`, `next` rels alongside the body's bidirectional cursors.
117
117
  *
118
118
  * @param {NizamDashboard.ListUsersRequest} request
119
119
  * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -250,134 +250,5 @@ class UsersClient {
250
250
  }
251
251
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/users");
252
252
  }
253
- /**
254
- * Tenant-admin operation. Sets `deleted_at = NOW()`. Subsequent dashboard reads filter the row out; platform staff can still surface and act on it.
255
- *
256
- * @param {NizamDashboard.SoftDeleteUserRequest} request
257
- * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
258
- *
259
- * @throws {@link NizamDashboard.UnauthorizedError}
260
- * @throws {@link NizamDashboard.ForbiddenError}
261
- * @throws {@link NizamDashboard.NotFoundError}
262
- * @throws {@link NizamDashboard.InternalServerError}
263
- *
264
- * @example
265
- * await client.users.softDeleteUser({
266
- * id: "00000000-0000-0000-0000-000000000000"
267
- * })
268
- */
269
- softDeleteUser(request, requestOptions) {
270
- return core.HttpResponsePromise.fromPromise(this.__softDeleteUser(request, requestOptions));
271
- }
272
- async __softDeleteUser(request, requestOptions) {
273
- const { id } = request;
274
- const _authRequest = await this._options.authProvider.getAuthRequest();
275
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
276
- const _response = await core.fetcher({
277
- url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
278
- (await core.Supplier.get(this._options.environment)) ??
279
- environments.NizamDashboardEnvironment.Production, `v1/users/${core.url.encodePathParam(id)}`),
280
- method: "DELETE",
281
- headers: _headers,
282
- queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
283
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
284
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
285
- abortSignal: requestOptions?.abortSignal,
286
- fetchFn: this._options?.fetch,
287
- logging: this._options.logging,
288
- });
289
- if (_response.ok) {
290
- return { data: undefined, rawResponse: _response.rawResponse };
291
- }
292
- if (_response.error.reason === "status-code") {
293
- switch (_response.error.statusCode) {
294
- case 401:
295
- throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
296
- case 403:
297
- throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
298
- case 404:
299
- throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
300
- case 500:
301
- throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
302
- default:
303
- throw new errors.NizamDashboardError({
304
- statusCode: _response.error.statusCode,
305
- body: _response.error.body,
306
- rawResponse: _response.rawResponse,
307
- });
308
- }
309
- }
310
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v1/users/{id}");
311
- }
312
- /**
313
- * Tenant-admin operation. Body has no `status` — lifecycle changes go through the platform-staff surface.
314
- *
315
- * @param {NizamDashboard.UserUpdateRequest} request
316
- * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
317
- *
318
- * @throws {@link NizamDashboard.UnauthorizedError}
319
- * @throws {@link NizamDashboard.ForbiddenError}
320
- * @throws {@link NizamDashboard.NotFoundError}
321
- * @throws {@link NizamDashboard.ConflictError}
322
- * @throws {@link NizamDashboard.UnprocessableEntityError}
323
- * @throws {@link NizamDashboard.InternalServerError}
324
- *
325
- * @example
326
- * await client.users.updateUser({
327
- * id: "00000000-0000-0000-0000-000000000000",
328
- * email: "renamed@acme.example",
329
- * name: "Ali Issa"
330
- * })
331
- */
332
- updateUser(request, requestOptions) {
333
- return core.HttpResponsePromise.fromPromise(this.__updateUser(request, requestOptions));
334
- }
335
- async __updateUser(request, requestOptions) {
336
- const { id, ..._body } = request;
337
- const _authRequest = await this._options.authProvider.getAuthRequest();
338
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
339
- const _response = await core.fetcher({
340
- url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
341
- (await core.Supplier.get(this._options.environment)) ??
342
- environments.NizamDashboardEnvironment.Production, `v1/users/${core.url.encodePathParam(id)}`),
343
- method: "PATCH",
344
- headers: _headers,
345
- contentType: "application/json",
346
- queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
347
- requestType: "json",
348
- body: _body,
349
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
350
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
351
- abortSignal: requestOptions?.abortSignal,
352
- fetchFn: this._options?.fetch,
353
- logging: this._options.logging,
354
- });
355
- if (_response.ok) {
356
- return { data: _response.body, rawResponse: _response.rawResponse };
357
- }
358
- if (_response.error.reason === "status-code") {
359
- switch (_response.error.statusCode) {
360
- case 401:
361
- throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
362
- case 403:
363
- throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
364
- case 404:
365
- throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
366
- case 409:
367
- throw new NizamDashboard.ConflictError(_response.error.body, _response.rawResponse);
368
- case 422:
369
- throw new NizamDashboard.UnprocessableEntityError(_response.error.body, _response.rawResponse);
370
- case 500:
371
- throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
372
- default:
373
- throw new errors.NizamDashboardError({
374
- statusCode: _response.error.statusCode,
375
- body: _response.error.body,
376
- rawResponse: _response.rawResponse,
377
- });
378
- }
379
- }
380
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v1/users/{id}");
381
- }
382
253
  }
383
254
  exports.UsersClient = UsersClient;
@@ -1,4 +1,2 @@
1
1
  export type { InviteUserRequest } from "./InviteUserRequest.js";
2
2
  export type { ListUsersRequest } from "./ListUsersRequest.js";
3
- export type { SoftDeleteUserRequest } from "./SoftDeleteUserRequest.js";
4
- export type { UserUpdateRequest } from "./UserUpdateRequest.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizam-os/dashboard-sdk",
3
- "version": "4.2.0",
3
+ "version": "5.1.0",
4
4
  "description": "Nizam Dashboard API SDK for TypeScript / JavaScript.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -1,9 +0,0 @@
1
- /**
2
- * @example
3
- * {
4
- * id: "00000000-0000-0000-0000-000000000000"
5
- * }
6
- */
7
- export interface SoftDeleteUserRequest {
8
- id: string;
9
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +0,0 @@
1
- /**
2
- * @example
3
- * {
4
- * id: "00000000-0000-0000-0000-000000000000",
5
- * email: "renamed@acme.example",
6
- * name: "Ali Issa"
7
- * }
8
- */
9
- export interface UserUpdateRequest {
10
- id: string;
11
- /** New email (optional). */
12
- email?: string;
13
- /** New display name (optional). */
14
- name?: string;
15
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });