@nizam-os/dashboard-sdk 11.0.0 → 12.0.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 +6 -2
- package/dist/api/resources/assets/client/Client.d.ts +20 -0
- package/dist/api/resources/assets/client/Client.js +20 -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 +1 -1
- package/dist/api/resources/organizations/client/Client.js +1 -1
- package/dist/api/resources/tasks/client/Client.d.ts +120 -0
- package/dist/api/resources/tasks/client/Client.js +391 -0
- package/dist/api/resources/tasks/client/index.d.ts +1 -0
- package/dist/api/resources/tasks/client/index.js +17 -0
- package/dist/api/resources/tasks/client/requests/CreateTaskRequest.d.ts +37 -0
- package/dist/api/resources/tasks/client/requests/CreateTaskRequest.js +19 -0
- package/dist/api/resources/tasks/client/requests/DeleteTaskRequest.d.ts +9 -0
- package/dist/api/resources/tasks/client/requests/DeleteTaskRequest.js +3 -0
- package/dist/api/resources/tasks/client/requests/GetTaskRequest.d.ts +9 -0
- package/dist/api/resources/tasks/client/requests/GetTaskRequest.js +3 -0
- package/dist/api/resources/tasks/client/requests/ListTasksRequest.d.ts +15 -0
- package/dist/api/resources/tasks/client/requests/ListTasksRequest.js +3 -0
- package/dist/api/resources/tasks/client/requests/UpdateTaskRequest.d.ts +12 -0
- package/dist/api/resources/tasks/client/requests/UpdateTaskRequest.js +3 -0
- package/dist/api/resources/tasks/client/requests/index.d.ts +5 -0
- package/dist/api/resources/tasks/client/requests/index.js +5 -0
- package/dist/api/resources/tasks/exports.d.ts +2 -0
- package/dist/api/resources/tasks/exports.js +21 -0
- package/dist/api/resources/tasks/index.d.ts +1 -0
- package/dist/api/resources/tasks/index.js +17 -0
- package/dist/api/types/ActivityCauser.d.ts +13 -0
- package/dist/api/types/ActivityCauser.js +3 -0
- package/dist/api/types/ActivityResource.d.ts +2 -0
- package/dist/api/types/ListResponseTask.d.ts +27 -0
- package/dist/api/types/ListResponseTask.js +11 -0
- package/dist/api/types/OperatorAsset.d.ts +64 -0
- package/dist/api/types/OperatorAsset.js +33 -0
- package/dist/api/types/Task.d.ts +41 -0
- package/dist/api/types/Task.js +23 -0
- package/dist/api/types/User.d.ts +24 -0
- package/dist/api/types/User.js +21 -0
- package/dist/api/types/index.d.ts +4 -0
- package/dist/api/types/index.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,391 @@
|
|
|
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.TasksClient = 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
|
+
class TasksClient {
|
|
46
|
+
constructor(options) {
|
|
47
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Lists the tasks the caller may read — their organization's tasks plus any they own or whose executor org they belong to (cross-tenant). The filtering is enforced entirely by RLS + the read bridge, never an app-layer predicate.
|
|
51
|
+
*
|
|
52
|
+
* @param {NizamDashboard.ListTasksRequest} request
|
|
53
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
54
|
+
*
|
|
55
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
56
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
57
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
58
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* await client.tasks.listTasks({
|
|
62
|
+
* starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
|
|
63
|
+
* ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
|
|
64
|
+
* })
|
|
65
|
+
*/
|
|
66
|
+
listTasks(request = {}, requestOptions) {
|
|
67
|
+
return core.HttpResponsePromise.fromPromise(this.__listTasks(request, requestOptions));
|
|
68
|
+
}
|
|
69
|
+
async __listTasks(request = {}, requestOptions) {
|
|
70
|
+
const { limit, starting_after: startingAfter, ending_before: endingBefore } = request;
|
|
71
|
+
const _queryParams = {
|
|
72
|
+
limit,
|
|
73
|
+
starting_after: startingAfter,
|
|
74
|
+
ending_before: endingBefore,
|
|
75
|
+
};
|
|
76
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
77
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
78
|
+
const _response = await core.fetcher({
|
|
79
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
80
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
81
|
+
environments.NizamDashboardEnvironment.Production, "v1/tasks"),
|
|
82
|
+
method: "GET",
|
|
83
|
+
headers: _headers,
|
|
84
|
+
queryString: core.url
|
|
85
|
+
.queryBuilder()
|
|
86
|
+
.addMany(_queryParams)
|
|
87
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
88
|
+
.build(),
|
|
89
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
90
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
91
|
+
abortSignal: requestOptions?.abortSignal,
|
|
92
|
+
fetchFn: this._options?.fetch,
|
|
93
|
+
logging: this._options.logging,
|
|
94
|
+
});
|
|
95
|
+
if (_response.ok) {
|
|
96
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
97
|
+
}
|
|
98
|
+
if (_response.error.reason === "status-code") {
|
|
99
|
+
switch (_response.error.statusCode) {
|
|
100
|
+
case 401:
|
|
101
|
+
throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
102
|
+
case 403:
|
|
103
|
+
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
104
|
+
case 429:
|
|
105
|
+
throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
106
|
+
case 500:
|
|
107
|
+
throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
|
|
108
|
+
default:
|
|
109
|
+
throw new errors.NizamDashboardError({
|
|
110
|
+
statusCode: _response.error.statusCode,
|
|
111
|
+
body: _response.error.body,
|
|
112
|
+
rawResponse: _response.rawResponse,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/tasks");
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Creates a task owned by the active organization. The creator becomes the task's `owner` (per-instance), able to read/update/delete it regardless of role. An optional `executor_organization_id` delegates it cross-org.
|
|
120
|
+
*
|
|
121
|
+
* @param {NizamDashboard.CreateTaskRequest} request
|
|
122
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
123
|
+
*
|
|
124
|
+
* @throws {@link NizamDashboard.BadRequestError}
|
|
125
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
126
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
127
|
+
* @throws {@link NizamDashboard.ConflictError}
|
|
128
|
+
* @throws {@link NizamDashboard.UnprocessableEntityError}
|
|
129
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
130
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* await client.tasks.createTask({
|
|
134
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
135
|
+
* type: "pickup",
|
|
136
|
+
* executor_organization_id: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
|
|
137
|
+
* merchant_id: "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
|
|
138
|
+
* notes: "Leave at front desk"
|
|
139
|
+
* })
|
|
140
|
+
*/
|
|
141
|
+
createTask(request, requestOptions) {
|
|
142
|
+
return core.HttpResponsePromise.fromPromise(this.__createTask(request, requestOptions));
|
|
143
|
+
}
|
|
144
|
+
async __createTask(request, requestOptions) {
|
|
145
|
+
const { "Idempotency-Key": idempotencyKey, ..._body } = request;
|
|
146
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
147
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions?.headers);
|
|
148
|
+
const _response = await core.fetcher({
|
|
149
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
150
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
151
|
+
environments.NizamDashboardEnvironment.Production, "v1/tasks"),
|
|
152
|
+
method: "POST",
|
|
153
|
+
headers: _headers,
|
|
154
|
+
contentType: "application/json",
|
|
155
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
156
|
+
requestType: "json",
|
|
157
|
+
body: _body,
|
|
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 400:
|
|
170
|
+
throw new NizamDashboard.BadRequestError(_response.error.body, _response.rawResponse);
|
|
171
|
+
case 401:
|
|
172
|
+
throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
173
|
+
case 403:
|
|
174
|
+
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
175
|
+
case 409:
|
|
176
|
+
throw new NizamDashboard.ConflictError(_response.error.body, _response.rawResponse);
|
|
177
|
+
case 422:
|
|
178
|
+
throw new NizamDashboard.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
179
|
+
case 429:
|
|
180
|
+
throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
181
|
+
case 500:
|
|
182
|
+
throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
|
|
183
|
+
default:
|
|
184
|
+
throw new errors.NizamDashboardError({
|
|
185
|
+
statusCode: _response.error.statusCode,
|
|
186
|
+
body: _response.error.body,
|
|
187
|
+
rawResponse: _response.rawResponse,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/tasks");
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Returns one task. Visible to the task's owner, members of its owning org, and members of a delegated executor org (cross-tenant); anyone else gets 404 — indistinguishable from a non-existent id (prevents probing).
|
|
195
|
+
*
|
|
196
|
+
* @param {NizamDashboard.GetTaskRequest} request
|
|
197
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
198
|
+
*
|
|
199
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
200
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
201
|
+
* @throws {@link NizamDashboard.NotFoundError}
|
|
202
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
203
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* await client.tasks.getTask({
|
|
207
|
+
* id: "00000000-0000-0000-0000-000000000000"
|
|
208
|
+
* })
|
|
209
|
+
*/
|
|
210
|
+
getTask(request, requestOptions) {
|
|
211
|
+
return core.HttpResponsePromise.fromPromise(this.__getTask(request, requestOptions));
|
|
212
|
+
}
|
|
213
|
+
async __getTask(request, requestOptions) {
|
|
214
|
+
const { id } = request;
|
|
215
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
216
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
217
|
+
const _response = await core.fetcher({
|
|
218
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
219
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
220
|
+
environments.NizamDashboardEnvironment.Production, `v1/tasks/${core.url.encodePathParam(id)}`),
|
|
221
|
+
method: "GET",
|
|
222
|
+
headers: _headers,
|
|
223
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
224
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
225
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
226
|
+
abortSignal: requestOptions?.abortSignal,
|
|
227
|
+
fetchFn: this._options?.fetch,
|
|
228
|
+
logging: this._options.logging,
|
|
229
|
+
});
|
|
230
|
+
if (_response.ok) {
|
|
231
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
232
|
+
}
|
|
233
|
+
if (_response.error.reason === "status-code") {
|
|
234
|
+
switch (_response.error.statusCode) {
|
|
235
|
+
case 401:
|
|
236
|
+
throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
237
|
+
case 403:
|
|
238
|
+
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
239
|
+
case 404:
|
|
240
|
+
throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
|
|
241
|
+
case 429:
|
|
242
|
+
throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
243
|
+
case 500:
|
|
244
|
+
throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
|
|
245
|
+
default:
|
|
246
|
+
throw new errors.NizamDashboardError({
|
|
247
|
+
statusCode: _response.error.statusCode,
|
|
248
|
+
body: _response.error.body,
|
|
249
|
+
rawResponse: _response.rawResponse,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/tasks/{id}");
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Soft-deletes the task. Authorized for the task's owner or an admin/staff of its owning org only (a delegated executor cannot delete) — the `task:delete` relation.
|
|
257
|
+
*
|
|
258
|
+
* > **Requires** `delete` on `task` (SpiceDB permission expression).
|
|
259
|
+
*
|
|
260
|
+
* @param {NizamDashboard.DeleteTaskRequest} request
|
|
261
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
262
|
+
*
|
|
263
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
264
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
265
|
+
* @throws {@link NizamDashboard.NotFoundError}
|
|
266
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
267
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* await client.tasks.deleteTask({
|
|
271
|
+
* id: "00000000-0000-0000-0000-000000000000"
|
|
272
|
+
* })
|
|
273
|
+
*/
|
|
274
|
+
deleteTask(request, requestOptions) {
|
|
275
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteTask(request, requestOptions));
|
|
276
|
+
}
|
|
277
|
+
async __deleteTask(request, requestOptions) {
|
|
278
|
+
const { id } = request;
|
|
279
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
280
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
281
|
+
const _response = await core.fetcher({
|
|
282
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
283
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
284
|
+
environments.NizamDashboardEnvironment.Production, `v1/tasks/${core.url.encodePathParam(id)}`),
|
|
285
|
+
method: "DELETE",
|
|
286
|
+
headers: _headers,
|
|
287
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
288
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
289
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
290
|
+
abortSignal: requestOptions?.abortSignal,
|
|
291
|
+
fetchFn: this._options?.fetch,
|
|
292
|
+
logging: this._options.logging,
|
|
293
|
+
});
|
|
294
|
+
if (_response.ok) {
|
|
295
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
296
|
+
}
|
|
297
|
+
if (_response.error.reason === "status-code") {
|
|
298
|
+
switch (_response.error.statusCode) {
|
|
299
|
+
case 401:
|
|
300
|
+
throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
301
|
+
case 403:
|
|
302
|
+
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
303
|
+
case 404:
|
|
304
|
+
throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
|
|
305
|
+
case 429:
|
|
306
|
+
throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
307
|
+
case 500:
|
|
308
|
+
throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
|
|
309
|
+
default:
|
|
310
|
+
throw new errors.NizamDashboardError({
|
|
311
|
+
statusCode: _response.error.statusCode,
|
|
312
|
+
body: _response.error.body,
|
|
313
|
+
rawResponse: _response.rawResponse,
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v1/tasks/{id}");
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Set-only partial update. Authorized for the task's owner or an admin/staff of its owning or executor org (a plain member cannot edit) — the `task:update` relation.
|
|
321
|
+
*
|
|
322
|
+
* > **Requires** `update` on `task` (SpiceDB permission expression).
|
|
323
|
+
*
|
|
324
|
+
* @param {NizamDashboard.UpdateTaskRequest} request
|
|
325
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
326
|
+
*
|
|
327
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
328
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
329
|
+
* @throws {@link NizamDashboard.NotFoundError}
|
|
330
|
+
* @throws {@link NizamDashboard.UnprocessableEntityError}
|
|
331
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
332
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* await client.tasks.updateTask({
|
|
336
|
+
* id: "00000000-0000-0000-0000-000000000000",
|
|
337
|
+
* notes: "Customer rescheduled to 4pm"
|
|
338
|
+
* })
|
|
339
|
+
*/
|
|
340
|
+
updateTask(request, requestOptions) {
|
|
341
|
+
return core.HttpResponsePromise.fromPromise(this.__updateTask(request, requestOptions));
|
|
342
|
+
}
|
|
343
|
+
async __updateTask(request, requestOptions) {
|
|
344
|
+
const { id, ..._body } = request;
|
|
345
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
346
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
347
|
+
const _response = await core.fetcher({
|
|
348
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
349
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
350
|
+
environments.NizamDashboardEnvironment.Production, `v1/tasks/${core.url.encodePathParam(id)}`),
|
|
351
|
+
method: "PATCH",
|
|
352
|
+
headers: _headers,
|
|
353
|
+
contentType: "application/json",
|
|
354
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
355
|
+
requestType: "json",
|
|
356
|
+
body: _body,
|
|
357
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
358
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
359
|
+
abortSignal: requestOptions?.abortSignal,
|
|
360
|
+
fetchFn: this._options?.fetch,
|
|
361
|
+
logging: this._options.logging,
|
|
362
|
+
});
|
|
363
|
+
if (_response.ok) {
|
|
364
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
365
|
+
}
|
|
366
|
+
if (_response.error.reason === "status-code") {
|
|
367
|
+
switch (_response.error.statusCode) {
|
|
368
|
+
case 401:
|
|
369
|
+
throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
370
|
+
case 403:
|
|
371
|
+
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
372
|
+
case 404:
|
|
373
|
+
throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
|
|
374
|
+
case 422:
|
|
375
|
+
throw new NizamDashboard.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
376
|
+
case 429:
|
|
377
|
+
throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
378
|
+
case 500:
|
|
379
|
+
throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
|
|
380
|
+
default:
|
|
381
|
+
throw new errors.NizamDashboardError({
|
|
382
|
+
statusCode: _response.error.statusCode,
|
|
383
|
+
body: _response.error.body,
|
|
384
|
+
rawResponse: _response.rawResponse,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v1/tasks/{id}");
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
exports.TasksClient = TasksClient;
|
|
@@ -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,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
5
|
+
* type: "pickup",
|
|
6
|
+
* executor_organization_id: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
|
|
7
|
+
* merchant_id: "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
|
|
8
|
+
* notes: "Leave at front desk"
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface CreateTaskRequest {
|
|
12
|
+
/** Optional. Supply a UUID (canonical 8-4-4-4-12 form; lowercase v4 recommended) to make this operation idempotent: the same key on a retry replays the original outcome instead of creating a second resource. 2xx successes and deliberate 4xx domain rejections are cached and replayed for 24h when the request body matches; transient 5xx responses are never cached, so a retry with the same key re-executes. A malformed key is rejected with 400 `idempotency.invalid_key`; reusing a key with a different request body is 409 `idempotency.key_conflict`; a key still in flight is 409 `idempotency.in_progress`. Omit the header and the operation behaves like any other write. */
|
|
13
|
+
"Idempotency-Key"?: string;
|
|
14
|
+
/** The kind of stop. */
|
|
15
|
+
type: CreateTaskRequest.Type;
|
|
16
|
+
/** Executor organization to delegate the task to (cross-org). Optional. */
|
|
17
|
+
executor_organization_id?: string;
|
|
18
|
+
/** Merchant the task belongs to. Optional. */
|
|
19
|
+
merchant_id?: string;
|
|
20
|
+
/** Free-form notes. */
|
|
21
|
+
notes?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare namespace CreateTaskRequest {
|
|
24
|
+
/** The kind of stop. */
|
|
25
|
+
const Type: {
|
|
26
|
+
readonly Pickup: "pickup";
|
|
27
|
+
readonly Dropoff: "dropoff";
|
|
28
|
+
readonly Service: "service";
|
|
29
|
+
readonly Return: "return";
|
|
30
|
+
readonly Exchange: "exchange";
|
|
31
|
+
readonly EndAtHub: "end_at_hub";
|
|
32
|
+
readonly EndAtDriverAddress: "end_at_driver_address";
|
|
33
|
+
readonly RouteLoad: "route_load";
|
|
34
|
+
readonly Break: "break";
|
|
35
|
+
};
|
|
36
|
+
type Type = (typeof Type)[keyof typeof Type];
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CreateTaskRequest = void 0;
|
|
5
|
+
var CreateTaskRequest;
|
|
6
|
+
(function (CreateTaskRequest) {
|
|
7
|
+
/** The kind of stop. */
|
|
8
|
+
CreateTaskRequest.Type = {
|
|
9
|
+
Pickup: "pickup",
|
|
10
|
+
Dropoff: "dropoff",
|
|
11
|
+
Service: "service",
|
|
12
|
+
Return: "return",
|
|
13
|
+
Exchange: "exchange",
|
|
14
|
+
EndAtHub: "end_at_hub",
|
|
15
|
+
EndAtDriverAddress: "end_at_driver_address",
|
|
16
|
+
RouteLoad: "route_load",
|
|
17
|
+
Break: "break",
|
|
18
|
+
};
|
|
19
|
+
})(CreateTaskRequest || (exports.CreateTaskRequest = CreateTaskRequest = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
|
|
5
|
+
* ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface ListTasksRequest {
|
|
9
|
+
/** Page size. Default 20, maximum 100. Out-of-range values are silently clamped; the response body's `limit` field reflects what was applied. */
|
|
10
|
+
limit?: number;
|
|
11
|
+
/** Opaque cursor — return the page starting strictly after this entity in the sort order. Mutually exclusive with `ending_before`. */
|
|
12
|
+
starting_after?: string;
|
|
13
|
+
/** Opaque cursor — return the page ending strictly before this entity in the sort order. Mutually exclusive with `starting_after`. */
|
|
14
|
+
ending_before?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CreateTaskRequest } from "./CreateTaskRequest.js";
|
|
2
|
+
export type { DeleteTaskRequest } from "./DeleteTaskRequest.js";
|
|
3
|
+
export type { GetTaskRequest } from "./GetTaskRequest.js";
|
|
4
|
+
export type { ListTasksRequest } from "./ListTasksRequest.js";
|
|
5
|
+
export type { UpdateTaskRequest } from "./UpdateTaskRequest.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateTaskRequest = void 0;
|
|
4
|
+
var CreateTaskRequest_js_1 = require("./CreateTaskRequest.js");
|
|
5
|
+
Object.defineProperty(exports, "CreateTaskRequest", { enumerable: true, get: function () { return CreateTaskRequest_js_1.CreateTaskRequest; } });
|
|
@@ -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.TasksClient = void 0;
|
|
19
|
+
var Client_js_1 = require("./client/Client.js");
|
|
20
|
+
Object.defineProperty(exports, "TasksClient", { enumerable: true, get: function () { return Client_js_1.TasksClient; } });
|
|
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,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolved human identity of an activity actor.
|
|
3
|
+
*/
|
|
4
|
+
export interface ActivityCauser {
|
|
5
|
+
/** Actor id — mirrors `causer_id`; null for system/scheduled rows. */
|
|
6
|
+
id?: string | undefined;
|
|
7
|
+
/** Actor type — mirrors `causer_type`; null for system/scheduled rows. */
|
|
8
|
+
type?: string | undefined;
|
|
9
|
+
/** Renderable actor label — the resolved name, or a stable "System" / "Unknown" fallback. Never null. */
|
|
10
|
+
display_name?: string | undefined;
|
|
11
|
+
/** Secondary line — a user's email; null for operators and system. */
|
|
12
|
+
subtitle?: string | undefined;
|
|
13
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as NizamDashboard from "../index.js";
|
|
1
2
|
/**
|
|
2
3
|
* One entry in an organization's activity feed (append-only audit timeline).
|
|
3
4
|
*/
|
|
@@ -18,6 +19,7 @@ export interface ActivityResource {
|
|
|
18
19
|
causer_type?: string | undefined;
|
|
19
20
|
/** Id of the actor that performed the action. Null for system/scheduled actions. */
|
|
20
21
|
causer_id?: string | undefined;
|
|
22
|
+
causer: NizamDashboard.ActivityCauser;
|
|
21
23
|
/** Optional UI filtering bucket. */
|
|
22
24
|
log_name?: string | undefined;
|
|
23
25
|
/** When the activity was recorded — the authoritative timestamp. */
|