@nizam-os/dashboard-sdk 6.3.0 → 6.4.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 (31) hide show
  1. package/dist/Client.d.ts +3 -0
  2. package/dist/Client.js +16 -12
  3. package/dist/api/resources/index.d.ts +2 -0
  4. package/dist/api/resources/index.js +3 -1
  5. package/dist/api/resources/jobs/client/Client.d.ts +75 -0
  6. package/dist/api/resources/jobs/client/Client.js +255 -0
  7. package/dist/api/resources/jobs/client/index.d.ts +1 -0
  8. package/dist/api/resources/jobs/client/index.js +17 -0
  9. package/dist/api/resources/jobs/client/requests/CancelJobRequest.d.ts +9 -0
  10. package/dist/api/resources/jobs/client/requests/CancelJobRequest.js +3 -0
  11. package/dist/api/resources/jobs/client/requests/GetJobRequest.d.ts +9 -0
  12. package/dist/api/resources/jobs/client/requests/GetJobRequest.js +3 -0
  13. package/dist/api/resources/jobs/client/requests/ListJobsRequest.d.ts +21 -0
  14. package/dist/api/resources/jobs/client/requests/ListJobsRequest.js +3 -0
  15. package/dist/api/resources/jobs/client/requests/index.d.ts +3 -0
  16. package/dist/api/resources/jobs/client/requests/index.js +2 -0
  17. package/dist/api/resources/jobs/exports.d.ts +2 -0
  18. package/dist/api/resources/jobs/exports.js +21 -0
  19. package/dist/api/resources/jobs/index.d.ts +1 -0
  20. package/dist/api/resources/jobs/index.js +17 -0
  21. package/dist/api/types/BulkJobSubmission.d.ts +15 -0
  22. package/dist/api/types/BulkJobSubmission.js +10 -0
  23. package/dist/api/types/Job.d.ts +66 -0
  24. package/dist/api/types/Job.js +24 -0
  25. package/dist/api/types/JobSubmission.d.ts +14 -0
  26. package/dist/api/types/JobSubmission.js +10 -0
  27. package/dist/api/types/ListResponseJob.d.ts +27 -0
  28. package/dist/api/types/ListResponseJob.js +11 -0
  29. package/dist/api/types/index.d.ts +4 -0
  30. package/dist/api/types/index.js +4 -0
  31. package/package.json +1 -1
package/dist/Client.d.ts CHANGED
@@ -3,6 +3,7 @@ import { ActivityClient } from "./api/resources/activity/client/Client.js";
3
3
  import { AssetsClient } from "./api/resources/assets/client/Client.js";
4
4
  import { AssignmentsClient } from "./api/resources/assignments/client/Client.js";
5
5
  import { InvitesClient } from "./api/resources/invites/client/Client.js";
6
+ import { JobsClient } from "./api/resources/jobs/client/Client.js";
6
7
  import { LookupsClient } from "./api/resources/lookups/client/Client.js";
7
8
  import { MembershipsClient } from "./api/resources/memberships/client/Client.js";
8
9
  import { OperatorsClient } from "./api/resources/operators/client/Client.js";
@@ -23,6 +24,7 @@ export declare class NizamDashboardClient {
23
24
  protected _assets: AssetsClient | undefined;
24
25
  protected _assignments: AssignmentsClient | undefined;
25
26
  protected _invites: InvitesClient | undefined;
27
+ protected _jobs: JobsClient | undefined;
26
28
  protected _lookups: LookupsClient | undefined;
27
29
  protected _users: UsersClient | undefined;
28
30
  protected _activeOrganization: ActiveOrganizationClient | undefined;
@@ -35,6 +37,7 @@ export declare class NizamDashboardClient {
35
37
  get assets(): AssetsClient;
36
38
  get assignments(): AssignmentsClient;
37
39
  get invites(): InvitesClient;
40
+ get jobs(): JobsClient;
38
41
  get lookups(): LookupsClient;
39
42
  get users(): UsersClient;
40
43
  get activeOrganization(): ActiveOrganizationClient;
package/dist/Client.js CHANGED
@@ -40,12 +40,13 @@ const Client_js_2 = require("./api/resources/activity/client/Client.js");
40
40
  const Client_js_3 = require("./api/resources/assets/client/Client.js");
41
41
  const Client_js_4 = require("./api/resources/assignments/client/Client.js");
42
42
  const Client_js_5 = require("./api/resources/invites/client/Client.js");
43
- const Client_js_6 = require("./api/resources/lookups/client/Client.js");
44
- const Client_js_7 = require("./api/resources/memberships/client/Client.js");
45
- const Client_js_8 = require("./api/resources/operators/client/Client.js");
46
- const Client_js_9 = require("./api/resources/organizations/client/Client.js");
47
- const Client_js_10 = require("./api/resources/realtime/client/Client.js");
48
- const Client_js_11 = require("./api/resources/users/client/Client.js");
43
+ const Client_js_6 = require("./api/resources/jobs/client/Client.js");
44
+ const Client_js_7 = require("./api/resources/lookups/client/Client.js");
45
+ const Client_js_8 = require("./api/resources/memberships/client/Client.js");
46
+ const Client_js_9 = require("./api/resources/operators/client/Client.js");
47
+ const Client_js_10 = require("./api/resources/organizations/client/Client.js");
48
+ const Client_js_11 = require("./api/resources/realtime/client/Client.js");
49
+ const Client_js_12 = require("./api/resources/users/client/Client.js");
49
50
  const BaseClient_js_1 = require("./BaseClient.js");
50
51
  const core = __importStar(require("./core/index.js"));
51
52
  class NizamDashboardClient {
@@ -64,26 +65,29 @@ class NizamDashboardClient {
64
65
  get invites() {
65
66
  return (this._invites ?? (this._invites = new Client_js_5.InvitesClient(this._options)));
66
67
  }
68
+ get jobs() {
69
+ return (this._jobs ?? (this._jobs = new Client_js_6.JobsClient(this._options)));
70
+ }
67
71
  get lookups() {
68
- return (this._lookups ?? (this._lookups = new Client_js_6.LookupsClient(this._options)));
72
+ return (this._lookups ?? (this._lookups = new Client_js_7.LookupsClient(this._options)));
69
73
  }
70
74
  get users() {
71
- return (this._users ?? (this._users = new Client_js_11.UsersClient(this._options)));
75
+ return (this._users ?? (this._users = new Client_js_12.UsersClient(this._options)));
72
76
  }
73
77
  get activeOrganization() {
74
78
  return (this._activeOrganization ?? (this._activeOrganization = new Client_js_1.ActiveOrganizationClient(this._options)));
75
79
  }
76
80
  get memberships() {
77
- return (this._memberships ?? (this._memberships = new Client_js_7.MembershipsClient(this._options)));
81
+ return (this._memberships ?? (this._memberships = new Client_js_8.MembershipsClient(this._options)));
78
82
  }
79
83
  get operators() {
80
- return (this._operators ?? (this._operators = new Client_js_8.OperatorsClient(this._options)));
84
+ return (this._operators ?? (this._operators = new Client_js_9.OperatorsClient(this._options)));
81
85
  }
82
86
  get organizations() {
83
- return (this._organizations ?? (this._organizations = new Client_js_9.OrganizationsClient(this._options)));
87
+ return (this._organizations ?? (this._organizations = new Client_js_10.OrganizationsClient(this._options)));
84
88
  }
85
89
  get realtime() {
86
- return (this._realtime ?? (this._realtime = new Client_js_10.RealtimeClient(this._options)));
90
+ return (this._realtime ?? (this._realtime = new Client_js_11.RealtimeClient(this._options)));
87
91
  }
88
92
  /**
89
93
  * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
@@ -8,6 +8,8 @@ export * from "./assignments/client/requests/index.js";
8
8
  export * as assignments from "./assignments/index.js";
9
9
  export * from "./invites/client/requests/index.js";
10
10
  export * as invites from "./invites/index.js";
11
+ export * from "./jobs/client/requests/index.js";
12
+ export * as jobs from "./jobs/index.js";
11
13
  export * as lookups from "./lookups/index.js";
12
14
  export * from "./memberships/client/requests/index.js";
13
15
  export * as memberships from "./memberships/index.js";
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.users = exports.realtime = exports.organizations = exports.operators = exports.memberships = exports.lookups = exports.invites = exports.assignments = exports.assets = exports.activity = exports.activeOrganization = void 0;
39
+ exports.users = exports.realtime = exports.organizations = exports.operators = exports.memberships = exports.lookups = exports.jobs = exports.invites = exports.assignments = exports.assets = exports.activity = exports.activeOrganization = void 0;
40
40
  __exportStar(require("./activeOrganization/client/requests/index.js"), exports);
41
41
  exports.activeOrganization = __importStar(require("./activeOrganization/index.js"));
42
42
  __exportStar(require("./activity/client/requests/index.js"), exports);
@@ -47,6 +47,8 @@ __exportStar(require("./assignments/client/requests/index.js"), exports);
47
47
  exports.assignments = __importStar(require("./assignments/index.js"));
48
48
  __exportStar(require("./invites/client/requests/index.js"), exports);
49
49
  exports.invites = __importStar(require("./invites/index.js"));
50
+ __exportStar(require("./jobs/client/requests/index.js"), exports);
51
+ exports.jobs = __importStar(require("./jobs/index.js"));
50
52
  exports.lookups = __importStar(require("./lookups/index.js"));
51
53
  __exportStar(require("./memberships/client/requests/index.js"), exports);
52
54
  exports.memberships = __importStar(require("./memberships/index.js"));
@@ -0,0 +1,75 @@
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 JobsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ /**
11
+ * Async jobs — persistent handles for long-running, retryable work (imports, exports, backfills, cache rebuilds): status, progress, cooperative cancellation.
12
+ */
13
+ export declare class JobsClient {
14
+ protected readonly _options: NormalizedClientOptionsWithAuth<JobsClient.Options>;
15
+ constructor(options: JobsClient.Options);
16
+ /**
17
+ * The active organization's jobs ordered by `created_at` descending (pass `sort=created_at` for ascending). Org-scoped: every member sees the org's backlog. `kind` / `status` accept comma-separated values. Pagination is bidirectional (`starting_after` / `ending_before`); cursors are bound to the sort direction that minted them.
18
+ *
19
+ * @param {NizamDashboard.ListJobsRequest} request
20
+ * @param {JobsClient.RequestOptions} requestOptions - Request-specific configuration.
21
+ *
22
+ * @throws {@link NizamDashboard.BadRequestError}
23
+ * @throws {@link NizamDashboard.UnauthorizedError}
24
+ * @throws {@link NizamDashboard.ForbiddenError}
25
+ * @throws {@link NizamDashboard.TooManyRequestsError}
26
+ * @throws {@link NizamDashboard.InternalServerError}
27
+ *
28
+ * @example
29
+ * await client.jobs.listJobs({
30
+ * starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
31
+ * ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
32
+ * })
33
+ */
34
+ listJobs(request?: NizamDashboard.ListJobsRequest, requestOptions?: JobsClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.ListResponseJob>;
35
+ private __listJobs;
36
+ /**
37
+ * Single job view: status, progress counters, source/report handles, retry budget. Org-scoped: any member of the owning organization can read it.
38
+ *
39
+ * @param {NizamDashboard.GetJobRequest} request
40
+ * @param {JobsClient.RequestOptions} requestOptions - Request-specific configuration.
41
+ *
42
+ * @throws {@link NizamDashboard.UnauthorizedError}
43
+ * @throws {@link NizamDashboard.ForbiddenError}
44
+ * @throws {@link NizamDashboard.NotFoundError}
45
+ * @throws {@link NizamDashboard.TooManyRequestsError}
46
+ * @throws {@link NizamDashboard.InternalServerError}
47
+ *
48
+ * @example
49
+ * await client.jobs.getJob({
50
+ * id: "00000000-0000-0000-0000-000000000000"
51
+ * })
52
+ */
53
+ getJob(request: NizamDashboard.GetJobRequest, requestOptions?: JobsClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.Job>;
54
+ private __getJob;
55
+ /**
56
+ * Requests cancellation. A `pending` job cancels immediately; a `running` job moves to `cancelling` and the engine winds down cooperatively at its next checkpoint — already-running work may still finish. Idempotent: cancelling an already- cancelling or cancelled job is a no-op returning the current state. A `completed` or `failed` job conflicts (409). Org admins can cancel any job; members only their own.
57
+ *
58
+ * @param {NizamDashboard.CancelJobRequest} request
59
+ * @param {JobsClient.RequestOptions} requestOptions - Request-specific configuration.
60
+ *
61
+ * @throws {@link NizamDashboard.UnauthorizedError}
62
+ * @throws {@link NizamDashboard.ForbiddenError}
63
+ * @throws {@link NizamDashboard.NotFoundError}
64
+ * @throws {@link NizamDashboard.ConflictError}
65
+ * @throws {@link NizamDashboard.TooManyRequestsError}
66
+ * @throws {@link NizamDashboard.InternalServerError}
67
+ *
68
+ * @example
69
+ * await client.jobs.cancelJob({
70
+ * id: "00000000-0000-0000-0000-000000000000"
71
+ * })
72
+ */
73
+ cancelJob(request: NizamDashboard.CancelJobRequest, requestOptions?: JobsClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.Job>;
74
+ private __cancelJob;
75
+ }
@@ -0,0 +1,255 @@
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.JobsClient = 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
+ * Async jobs — persistent handles for long-running, retryable work (imports, exports, backfills, cache rebuilds): status, progress, cooperative cancellation.
47
+ */
48
+ class JobsClient {
49
+ constructor(options) {
50
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
51
+ }
52
+ /**
53
+ * The active organization's jobs ordered by `created_at` descending (pass `sort=created_at` for ascending). Org-scoped: every member sees the org's backlog. `kind` / `status` accept comma-separated values. Pagination is bidirectional (`starting_after` / `ending_before`); cursors are bound to the sort direction that minted them.
54
+ *
55
+ * @param {NizamDashboard.ListJobsRequest} request
56
+ * @param {JobsClient.RequestOptions} requestOptions - Request-specific configuration.
57
+ *
58
+ * @throws {@link NizamDashboard.BadRequestError}
59
+ * @throws {@link NizamDashboard.UnauthorizedError}
60
+ * @throws {@link NizamDashboard.ForbiddenError}
61
+ * @throws {@link NizamDashboard.TooManyRequestsError}
62
+ * @throws {@link NizamDashboard.InternalServerError}
63
+ *
64
+ * @example
65
+ * await client.jobs.listJobs({
66
+ * starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
67
+ * ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
68
+ * })
69
+ */
70
+ listJobs(request = {}, requestOptions) {
71
+ return core.HttpResponsePromise.fromPromise(this.__listJobs(request, requestOptions));
72
+ }
73
+ async __listJobs(request = {}, requestOptions) {
74
+ const { kind, status, sort, limit, starting_after: startingAfter, ending_before: endingBefore } = request;
75
+ const _queryParams = {
76
+ kind,
77
+ status,
78
+ sort,
79
+ limit,
80
+ starting_after: startingAfter,
81
+ ending_before: endingBefore,
82
+ };
83
+ const _authRequest = await this._options.authProvider.getAuthRequest();
84
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
85
+ const _response = await core.fetcher({
86
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
87
+ (await core.Supplier.get(this._options.environment)) ??
88
+ environments.NizamDashboardEnvironment.Production, "v1/jobs"),
89
+ method: "GET",
90
+ headers: _headers,
91
+ queryString: core.url
92
+ .queryBuilder()
93
+ .addMany(_queryParams)
94
+ .mergeAdditional(requestOptions?.queryParams)
95
+ .build(),
96
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
97
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
98
+ abortSignal: requestOptions?.abortSignal,
99
+ fetchFn: this._options?.fetch,
100
+ logging: this._options.logging,
101
+ });
102
+ if (_response.ok) {
103
+ return { data: _response.body, rawResponse: _response.rawResponse };
104
+ }
105
+ if (_response.error.reason === "status-code") {
106
+ switch (_response.error.statusCode) {
107
+ case 400:
108
+ throw new NizamDashboard.BadRequestError(_response.error.body, _response.rawResponse);
109
+ case 401:
110
+ throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
111
+ case 403:
112
+ throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
113
+ case 429:
114
+ throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
115
+ case 500:
116
+ throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
117
+ default:
118
+ throw new errors.NizamDashboardError({
119
+ statusCode: _response.error.statusCode,
120
+ body: _response.error.body,
121
+ rawResponse: _response.rawResponse,
122
+ });
123
+ }
124
+ }
125
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/jobs");
126
+ }
127
+ /**
128
+ * Single job view: status, progress counters, source/report handles, retry budget. Org-scoped: any member of the owning organization can read it.
129
+ *
130
+ * @param {NizamDashboard.GetJobRequest} request
131
+ * @param {JobsClient.RequestOptions} requestOptions - Request-specific configuration.
132
+ *
133
+ * @throws {@link NizamDashboard.UnauthorizedError}
134
+ * @throws {@link NizamDashboard.ForbiddenError}
135
+ * @throws {@link NizamDashboard.NotFoundError}
136
+ * @throws {@link NizamDashboard.TooManyRequestsError}
137
+ * @throws {@link NizamDashboard.InternalServerError}
138
+ *
139
+ * @example
140
+ * await client.jobs.getJob({
141
+ * id: "00000000-0000-0000-0000-000000000000"
142
+ * })
143
+ */
144
+ getJob(request, requestOptions) {
145
+ return core.HttpResponsePromise.fromPromise(this.__getJob(request, requestOptions));
146
+ }
147
+ async __getJob(request, requestOptions) {
148
+ const { id } = request;
149
+ const _authRequest = await this._options.authProvider.getAuthRequest();
150
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
151
+ const _response = await core.fetcher({
152
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
153
+ (await core.Supplier.get(this._options.environment)) ??
154
+ environments.NizamDashboardEnvironment.Production, `v1/jobs/${core.url.encodePathParam(id)}`),
155
+ method: "GET",
156
+ headers: _headers,
157
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
158
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
159
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
160
+ abortSignal: requestOptions?.abortSignal,
161
+ fetchFn: this._options?.fetch,
162
+ logging: this._options.logging,
163
+ });
164
+ if (_response.ok) {
165
+ return { data: _response.body, rawResponse: _response.rawResponse };
166
+ }
167
+ if (_response.error.reason === "status-code") {
168
+ switch (_response.error.statusCode) {
169
+ case 401:
170
+ throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
171
+ case 403:
172
+ throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
173
+ case 404:
174
+ throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
175
+ case 429:
176
+ throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
177
+ case 500:
178
+ throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
179
+ default:
180
+ throw new errors.NizamDashboardError({
181
+ statusCode: _response.error.statusCode,
182
+ body: _response.error.body,
183
+ rawResponse: _response.rawResponse,
184
+ });
185
+ }
186
+ }
187
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/jobs/{id}");
188
+ }
189
+ /**
190
+ * Requests cancellation. A `pending` job cancels immediately; a `running` job moves to `cancelling` and the engine winds down cooperatively at its next checkpoint — already-running work may still finish. Idempotent: cancelling an already- cancelling or cancelled job is a no-op returning the current state. A `completed` or `failed` job conflicts (409). Org admins can cancel any job; members only their own.
191
+ *
192
+ * @param {NizamDashboard.CancelJobRequest} request
193
+ * @param {JobsClient.RequestOptions} requestOptions - Request-specific configuration.
194
+ *
195
+ * @throws {@link NizamDashboard.UnauthorizedError}
196
+ * @throws {@link NizamDashboard.ForbiddenError}
197
+ * @throws {@link NizamDashboard.NotFoundError}
198
+ * @throws {@link NizamDashboard.ConflictError}
199
+ * @throws {@link NizamDashboard.TooManyRequestsError}
200
+ * @throws {@link NizamDashboard.InternalServerError}
201
+ *
202
+ * @example
203
+ * await client.jobs.cancelJob({
204
+ * id: "00000000-0000-0000-0000-000000000000"
205
+ * })
206
+ */
207
+ cancelJob(request, requestOptions) {
208
+ return core.HttpResponsePromise.fromPromise(this.__cancelJob(request, requestOptions));
209
+ }
210
+ async __cancelJob(request, requestOptions) {
211
+ const { id } = request;
212
+ const _authRequest = await this._options.authProvider.getAuthRequest();
213
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
214
+ const _response = await core.fetcher({
215
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
216
+ (await core.Supplier.get(this._options.environment)) ??
217
+ environments.NizamDashboardEnvironment.Production, `v1/jobs/${core.url.encodePathParam(id)}/cancel`),
218
+ method: "POST",
219
+ headers: _headers,
220
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
221
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
222
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
223
+ abortSignal: requestOptions?.abortSignal,
224
+ fetchFn: this._options?.fetch,
225
+ logging: this._options.logging,
226
+ });
227
+ if (_response.ok) {
228
+ return { data: _response.body, rawResponse: _response.rawResponse };
229
+ }
230
+ if (_response.error.reason === "status-code") {
231
+ switch (_response.error.statusCode) {
232
+ case 401:
233
+ throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
234
+ case 403:
235
+ throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
236
+ case 404:
237
+ throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
238
+ case 409:
239
+ throw new NizamDashboard.ConflictError(_response.error.body, _response.rawResponse);
240
+ case 429:
241
+ throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
242
+ case 500:
243
+ throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
244
+ default:
245
+ throw new errors.NizamDashboardError({
246
+ statusCode: _response.error.statusCode,
247
+ body: _response.error.body,
248
+ rawResponse: _response.rawResponse,
249
+ });
250
+ }
251
+ }
252
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/jobs/{id}/cancel");
253
+ }
254
+ }
255
+ exports.JobsClient = JobsClient;
@@ -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,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "00000000-0000-0000-0000-000000000000"
5
+ * }
6
+ */
7
+ export interface CancelJobRequest {
8
+ id: string;
9
+ }
@@ -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,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "00000000-0000-0000-0000-000000000000"
5
+ * }
6
+ */
7
+ export interface GetJobRequest {
8
+ id: string;
9
+ }
@@ -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,21 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
5
+ * ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
6
+ * }
7
+ */
8
+ export interface ListJobsRequest {
9
+ /** Filter by job kind. Comma-separated; values: `membership_cache_rebuild`, `service_account_api_key_regeneration`. */
10
+ kind?: string | string[];
11
+ /** Filter by lifecycle status. Comma-separated; values: `pending`, `running`, `cancelling`, `completed`, `failed`, `cancelled`. */
12
+ status?: string | string[];
13
+ /** Sort order. Allowed fields: `created_at`. Prefix a field with `-` for descending (e.g. `-created_at`); unknown fields are rejected with `400 validation_failed`. */
14
+ sort?: string | string[];
15
+ /** Page size. Default 20, maximum 100. Out-of-range values are silently clamped; the response body's `limit` field reflects what was applied. */
16
+ limit?: number;
17
+ /** Opaque cursor — return the page starting strictly after this entity in the sort order. Mutually exclusive with `ending_before`. */
18
+ starting_after?: string;
19
+ /** Opaque cursor — return the page ending strictly before this entity in the sort order. Mutually exclusive with `starting_after`. */
20
+ ending_before?: string;
21
+ }
@@ -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,3 @@
1
+ export type { CancelJobRequest } from "./CancelJobRequest.js";
2
+ export type { GetJobRequest } from "./GetJobRequest.js";
3
+ export type { ListJobsRequest } from "./ListJobsRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { JobsClient } 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.JobsClient = void 0;
19
+ var Client_js_1 = require("./client/Client.js");
20
+ Object.defineProperty(exports, "JobsClient", { enumerable: true, get: function () { return Client_js_1.JobsClient; } });
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);
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Acknowledgement of a bulk admin action that fanned out one job per work item.
3
+ */
4
+ export interface BulkJobSubmission {
5
+ job_ids?: string[] | undefined;
6
+ /** Number of jobs created (one per matched service account). */
7
+ count?: number | undefined;
8
+ object?: BulkJobSubmission.Object_ | undefined;
9
+ }
10
+ export declare namespace BulkJobSubmission {
11
+ const Object_: {
12
+ readonly BulkJobSubmission: "bulk_job_submission";
13
+ };
14
+ type Object_ = (typeof Object_)[keyof typeof Object_];
15
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.BulkJobSubmission = void 0;
5
+ var BulkJobSubmission;
6
+ (function (BulkJobSubmission) {
7
+ BulkJobSubmission.Object_ = {
8
+ BulkJobSubmission: "bulk_job_submission",
9
+ };
10
+ })(BulkJobSubmission || (exports.BulkJobSubmission = BulkJobSubmission = {}));
@@ -0,0 +1,66 @@
1
+ /**
2
+ * A long-running, retryable, operator-visible unit of work — bulk imports, exports, backfills, cache rebuilds. The job row is the persistent handle; the executing engine (Temporal workflow or lease worker, declared per kind) reports progress into it. Cancellation is cooperative: already-running work continues until the engine's next checkpoint.
3
+ */
4
+ export interface Job {
5
+ /** Stable job id. */
6
+ id?: string | undefined;
7
+ /** Owning organization. */
8
+ organization_id?: string | undefined;
9
+ /** What kind of work this job performs; the kind also fixes the executing engine. */
10
+ kind?: Job.Kind | undefined;
11
+ /** Lifecycle status. Terminal states are `completed`, `failed`, `cancelled`. */
12
+ status?: Job.Status | undefined;
13
+ /** User who submitted the job. Null only if that user was since deleted. */
14
+ requested_by_id?: string | undefined;
15
+ /** Input handle the job consumes (kind-specific), e.g. an uploaded import file. */
16
+ source_uri?: string | undefined;
17
+ /** Artifact produced by a completed job (kind-specific), e.g. a result report. */
18
+ report_uri?: string | undefined;
19
+ /** Total work items, once the engine has sized the work. Null while unknown. */
20
+ rows_total?: number | undefined;
21
+ /** Work items processed so far (monotonic). */
22
+ rows_processed?: number | undefined;
23
+ /** Work items that failed so far (monotonic). */
24
+ rows_failed?: number | undefined;
25
+ /** Operator-facing failure reason. Set only when status is `failed`. */
26
+ error_summary?: string | undefined;
27
+ /** Temporal workflow id (Temporal-engine kinds only) — cross-reference into the Temporal UI. */
28
+ workflow_id?: string | undefined;
29
+ /** Temporal run id of the latest attempt (changes across workflow retries). */
30
+ run_id?: string | undefined;
31
+ /** Engine execution attempts spent so far. */
32
+ attempt_count?: number | undefined;
33
+ /** Retry budget: a failed job with attempt_count >= max_attempts is dead-lettered. */
34
+ max_attempts?: number | undefined;
35
+ /** When the first engine attempt started. Null while pending (and for jobs cancelled before starting). */
36
+ started_at?: string | undefined;
37
+ /** When the job reached a terminal status. */
38
+ finished_at?: string | undefined;
39
+ /** Submission time. */
40
+ created_at?: string | undefined;
41
+ /** Last state/progress change. */
42
+ updated_at?: string | undefined;
43
+ object?: Job.Object_ | undefined;
44
+ }
45
+ export declare namespace Job {
46
+ /** What kind of work this job performs; the kind also fixes the executing engine. */
47
+ const Kind: {
48
+ readonly MembershipCacheRebuild: "membership_cache_rebuild";
49
+ readonly ServiceAccountApiKeyRegeneration: "service_account_api_key_regeneration";
50
+ };
51
+ type Kind = (typeof Kind)[keyof typeof Kind];
52
+ /** Lifecycle status. Terminal states are `completed`, `failed`, `cancelled`. */
53
+ const Status: {
54
+ readonly Pending: "pending";
55
+ readonly Running: "running";
56
+ readonly Cancelling: "cancelling";
57
+ readonly Completed: "completed";
58
+ readonly Failed: "failed";
59
+ readonly Cancelled: "cancelled";
60
+ };
61
+ type Status = (typeof Status)[keyof typeof Status];
62
+ const Object_: {
63
+ readonly Job: "job";
64
+ };
65
+ type Object_ = (typeof Object_)[keyof typeof Object_];
66
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Job = void 0;
5
+ var Job;
6
+ (function (Job) {
7
+ /** What kind of work this job performs; the kind also fixes the executing engine. */
8
+ Job.Kind = {
9
+ MembershipCacheRebuild: "membership_cache_rebuild",
10
+ ServiceAccountApiKeyRegeneration: "service_account_api_key_regeneration",
11
+ };
12
+ /** Lifecycle status. Terminal states are `completed`, `failed`, `cancelled`. */
13
+ Job.Status = {
14
+ Pending: "pending",
15
+ Running: "running",
16
+ Cancelling: "cancelling",
17
+ Completed: "completed",
18
+ Failed: "failed",
19
+ Cancelled: "cancelled",
20
+ };
21
+ Job.Object_ = {
22
+ Job: "job",
23
+ };
24
+ })(Job || (exports.Job = Job = {}));
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Acknowledgement that a job was submitted to its engine.
3
+ */
4
+ export interface JobSubmission {
5
+ /** The created job — poll/cancel it via /v1/jobs/{id}. */
6
+ job_id?: string | undefined;
7
+ object?: JobSubmission.Object_ | undefined;
8
+ }
9
+ export declare namespace JobSubmission {
10
+ const Object_: {
11
+ readonly JobSubmission: "job_submission";
12
+ };
13
+ type Object_ = (typeof Object_)[keyof typeof Object_];
14
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.JobSubmission = void 0;
5
+ var JobSubmission;
6
+ (function (JobSubmission) {
7
+ JobSubmission.Object_ = {
8
+ JobSubmission: "job_submission",
9
+ };
10
+ })(JobSubmission || (exports.JobSubmission = JobSubmission = {}));
@@ -0,0 +1,27 @@
1
+ import type * as NizamDashboard from "../index.js";
2
+ /**
3
+ * Envelope for paginated list responses (Stripe-style cursor pagination).
4
+ */
5
+ export interface ListResponseJob {
6
+ /** Object type discriminator (Stripe pattern). Always `list` for this envelope. */
7
+ object?: ListResponseJob.Object_ | undefined;
8
+ /** Page of resources. Empty array when there are no matches. */
9
+ data?: NizamDashboard.Job[] | undefined;
10
+ /** True when more pages exist; pass `next_cursor` as `?starting_after=` to fetch the next page. */
11
+ has_more?: boolean | undefined;
12
+ /** True when earlier pages exist; pass `prev_cursor` as `?ending_before=` to fetch the previous page. */
13
+ has_previous?: boolean | undefined;
14
+ /** Opaque cursor for the next page. `null` on the last page. */
15
+ next_cursor?: string | undefined;
16
+ /** Opaque cursor for the previous page. `null` on the first page. */
17
+ prev_cursor?: string | undefined;
18
+ /** Page size that produced this response. */
19
+ limit?: number | undefined;
20
+ }
21
+ export declare namespace ListResponseJob {
22
+ /** Object type discriminator (Stripe pattern). Always `list` for this envelope. */
23
+ const Object_: {
24
+ readonly List: "list";
25
+ };
26
+ type Object_ = (typeof Object_)[keyof typeof Object_];
27
+ }
@@ -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.ListResponseJob = void 0;
5
+ var ListResponseJob;
6
+ (function (ListResponseJob) {
7
+ /** Object type discriminator (Stripe pattern). Always `list` for this envelope. */
8
+ ListResponseJob.Object_ = {
9
+ List: "list",
10
+ };
11
+ })(ListResponseJob || (exports.ListResponseJob = ListResponseJob = {}));
@@ -4,6 +4,7 @@ export * from "./ApiFieldError.js";
4
4
  export * from "./Asset.js";
5
5
  export * from "./AssetListItem.js";
6
6
  export * from "./Assignment.js";
7
+ export * from "./BulkJobSubmission.js";
7
8
  export * from "./BusinessCategory.js";
8
9
  export * from "./Country.js";
9
10
  export * from "./CreateAutonomousOperatorRequest.js";
@@ -13,12 +14,15 @@ export * from "./CreateTeleoperatedOperatorRequest.js";
13
14
  export * from "./Currency.js";
14
15
  export * from "./InternalUserUpdateRequest.js";
15
16
  export * from "./Invite.js";
17
+ export * from "./Job.js";
18
+ export * from "./JobSubmission.js";
16
19
  export * from "./Language.js";
17
20
  export * from "./ListResponseActivityResource.js";
18
21
  export * from "./ListResponseAssetListItem.js";
19
22
  export * from "./ListResponseBusinessCategory.js";
20
23
  export * from "./ListResponseCountry.js";
21
24
  export * from "./ListResponseCurrency.js";
25
+ export * from "./ListResponseJob.js";
22
26
  export * from "./ListResponseLanguage.js";
23
27
  export * from "./ListResponseMembership.js";
24
28
  export * from "./ListResponseOrganization.js";
@@ -20,6 +20,7 @@ __exportStar(require("./ApiFieldError.js"), exports);
20
20
  __exportStar(require("./Asset.js"), exports);
21
21
  __exportStar(require("./AssetListItem.js"), exports);
22
22
  __exportStar(require("./Assignment.js"), exports);
23
+ __exportStar(require("./BulkJobSubmission.js"), exports);
23
24
  __exportStar(require("./BusinessCategory.js"), exports);
24
25
  __exportStar(require("./Country.js"), exports);
25
26
  __exportStar(require("./CreateAutonomousOperatorRequest.js"), exports);
@@ -29,12 +30,15 @@ __exportStar(require("./CreateTeleoperatedOperatorRequest.js"), exports);
29
30
  __exportStar(require("./Currency.js"), exports);
30
31
  __exportStar(require("./InternalUserUpdateRequest.js"), exports);
31
32
  __exportStar(require("./Invite.js"), exports);
33
+ __exportStar(require("./Job.js"), exports);
34
+ __exportStar(require("./JobSubmission.js"), exports);
32
35
  __exportStar(require("./Language.js"), exports);
33
36
  __exportStar(require("./ListResponseActivityResource.js"), exports);
34
37
  __exportStar(require("./ListResponseAssetListItem.js"), exports);
35
38
  __exportStar(require("./ListResponseBusinessCategory.js"), exports);
36
39
  __exportStar(require("./ListResponseCountry.js"), exports);
37
40
  __exportStar(require("./ListResponseCurrency.js"), exports);
41
+ __exportStar(require("./ListResponseJob.js"), exports);
38
42
  __exportStar(require("./ListResponseLanguage.js"), exports);
39
43
  __exportStar(require("./ListResponseMembership.js"), exports);
40
44
  __exportStar(require("./ListResponseOrganization.js"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizam-os/dashboard-sdk",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "description": "Nizam Dashboard API SDK for TypeScript / JavaScript.",
5
5
  "license": "MIT",
6
6
  "private": false,