@nizam-os/dashboard-sdk 11.1.0 → 12.0.1
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/requests/ListAssetsRequest.d.ts +1 -1
- package/dist/api/resources/assets/types/ListAssetsRequestSortItem.d.ts +4 -4
- package/dist/api/resources/assets/types/ListAssetsRequestSortItem.js +4 -4
- package/dist/api/resources/index.d.ts +2 -0
- package/dist/api/resources/index.js +3 -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/Task.d.ts +41 -0
- package/dist/api/types/Task.js +23 -0
- package/dist/api/types/User.d.ts +2 -0
- package/dist/api/types/User.js +2 -0
- package/dist/api/types/index.d.ts +3 -0
- package/dist/api/types/index.js +3 -0
- package/package.json +1 -1
package/dist/Client.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { OrganizationsClient } from "./api/resources/organizations/client/Client
|
|
|
16
16
|
import { PositionsClient } from "./api/resources/positions/client/Client.js";
|
|
17
17
|
import { RealtimeClient } from "./api/resources/realtime/client/Client.js";
|
|
18
18
|
import { TaskAttemptsClient } from "./api/resources/taskAttempts/client/Client.js";
|
|
19
|
+
import { TasksClient } from "./api/resources/tasks/client/Client.js";
|
|
19
20
|
import { UsersClient } from "./api/resources/users/client/Client.js";
|
|
20
21
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
21
22
|
import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
|
|
@@ -46,6 +47,7 @@ export declare class NizamDashboardClient {
|
|
|
46
47
|
protected _organizations: OrganizationsClient | undefined;
|
|
47
48
|
protected _realtime: RealtimeClient | undefined;
|
|
48
49
|
protected _taskAttempts: TaskAttemptsClient | undefined;
|
|
50
|
+
protected _tasks: TasksClient | undefined;
|
|
49
51
|
constructor(options: NizamDashboardClient.Options);
|
|
50
52
|
get activity(): ActivityClient;
|
|
51
53
|
get assets(): AssetsClient;
|
|
@@ -66,6 +68,7 @@ export declare class NizamDashboardClient {
|
|
|
66
68
|
get organizations(): OrganizationsClient;
|
|
67
69
|
get realtime(): RealtimeClient;
|
|
68
70
|
get taskAttempts(): TaskAttemptsClient;
|
|
71
|
+
get tasks(): TasksClient;
|
|
69
72
|
/**
|
|
70
73
|
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
71
74
|
* This is useful for making requests to endpoints not yet supported in the SDK.
|
package/dist/Client.js
CHANGED
|
@@ -53,7 +53,8 @@ const Client_js_15 = require("./api/resources/organizations/client/Client.js");
|
|
|
53
53
|
const Client_js_16 = require("./api/resources/positions/client/Client.js");
|
|
54
54
|
const Client_js_17 = require("./api/resources/realtime/client/Client.js");
|
|
55
55
|
const Client_js_18 = require("./api/resources/taskAttempts/client/Client.js");
|
|
56
|
-
const Client_js_19 = require("./api/resources/
|
|
56
|
+
const Client_js_19 = require("./api/resources/tasks/client/Client.js");
|
|
57
|
+
const Client_js_20 = require("./api/resources/users/client/Client.js");
|
|
57
58
|
const BaseClient_js_1 = require("./BaseClient.js");
|
|
58
59
|
const core = __importStar(require("./core/index.js"));
|
|
59
60
|
class NizamDashboardClient {
|
|
@@ -88,7 +89,7 @@ class NizamDashboardClient {
|
|
|
88
89
|
return (this._lookups ?? (this._lookups = new Client_js_10.LookupsClient(this._options)));
|
|
89
90
|
}
|
|
90
91
|
get users() {
|
|
91
|
-
return (this._users ?? (this._users = new
|
|
92
|
+
return (this._users ?? (this._users = new Client_js_20.UsersClient(this._options)));
|
|
92
93
|
}
|
|
93
94
|
get activeOrganization() {
|
|
94
95
|
return (this._activeOrganization ?? (this._activeOrganization = new Client_js_1.ActiveOrganizationClient(this._options)));
|
|
@@ -117,6 +118,9 @@ class NizamDashboardClient {
|
|
|
117
118
|
get taskAttempts() {
|
|
118
119
|
return (this._taskAttempts ?? (this._taskAttempts = new Client_js_18.TaskAttemptsClient(this._options)));
|
|
119
120
|
}
|
|
121
|
+
get tasks() {
|
|
122
|
+
return (this._tasks ?? (this._tasks = new Client_js_19.TasksClient(this._options)));
|
|
123
|
+
}
|
|
120
124
|
/**
|
|
121
125
|
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
122
126
|
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
@@ -22,7 +22,7 @@ export interface ListAssetsRequest {
|
|
|
22
22
|
created_on_or_after?: string;
|
|
23
23
|
/** Only assets created on or before this calendar day (`yyyy-mm-dd`), inclusive — widened server-side to the end of the day in UTC, so the whole day counts. */
|
|
24
24
|
created_on_or_before?: string;
|
|
25
|
-
/** Sort order. Allowed fields: `created_at`, `name`, `
|
|
25
|
+
/** Sort order. Allowed fields: `created_at`, `name`, `plate_number`, `make`, `model`, `vin`, `sub_kind`, `year`, `autonomy_level`, `status`, `kind`. Append `:asc` or `:desc` to each field (direction required, e.g. `created_at:desc`), comma-separated for multi-sort; unknown fields or directions are rejected with `400 validation_failed`. */
|
|
26
26
|
sort?: NizamDashboard.ListAssetsRequestSortItem | NizamDashboard.ListAssetsRequestSortItem[];
|
|
27
27
|
/** Page size. Default 20, maximum 100. Out-of-range values are silently clamped; the response body's `limit` field reflects what was applied. */
|
|
28
28
|
limit?: number;
|
|
@@ -3,18 +3,18 @@ export declare const ListAssetsRequestSortItem: {
|
|
|
3
3
|
readonly CreatedAtDesc: "created_at:desc";
|
|
4
4
|
readonly NameAsc: "name:asc";
|
|
5
5
|
readonly NameDesc: "name:desc";
|
|
6
|
+
readonly PlateNumberAsc: "plate_number:asc";
|
|
7
|
+
readonly PlateNumberDesc: "plate_number:desc";
|
|
6
8
|
readonly MakeAsc: "make:asc";
|
|
7
9
|
readonly MakeDesc: "make:desc";
|
|
8
10
|
readonly ModelAsc: "model:asc";
|
|
9
11
|
readonly ModelDesc: "model:desc";
|
|
10
|
-
readonly YearAsc: "year:asc";
|
|
11
|
-
readonly YearDesc: "year:desc";
|
|
12
|
-
readonly PlateNumberAsc: "plate_number:asc";
|
|
13
|
-
readonly PlateNumberDesc: "plate_number:desc";
|
|
14
12
|
readonly VinAsc: "vin:asc";
|
|
15
13
|
readonly VinDesc: "vin:desc";
|
|
16
14
|
readonly SubKindAsc: "sub_kind:asc";
|
|
17
15
|
readonly SubKindDesc: "sub_kind:desc";
|
|
16
|
+
readonly YearAsc: "year:asc";
|
|
17
|
+
readonly YearDesc: "year:desc";
|
|
18
18
|
readonly AutonomyLevelAsc: "autonomy_level:asc";
|
|
19
19
|
readonly AutonomyLevelDesc: "autonomy_level:desc";
|
|
20
20
|
readonly StatusAsc: "status:asc";
|
|
@@ -7,18 +7,18 @@ exports.ListAssetsRequestSortItem = {
|
|
|
7
7
|
CreatedAtDesc: "created_at:desc",
|
|
8
8
|
NameAsc: "name:asc",
|
|
9
9
|
NameDesc: "name:desc",
|
|
10
|
+
PlateNumberAsc: "plate_number:asc",
|
|
11
|
+
PlateNumberDesc: "plate_number:desc",
|
|
10
12
|
MakeAsc: "make:asc",
|
|
11
13
|
MakeDesc: "make:desc",
|
|
12
14
|
ModelAsc: "model:asc",
|
|
13
15
|
ModelDesc: "model:desc",
|
|
14
|
-
YearAsc: "year:asc",
|
|
15
|
-
YearDesc: "year:desc",
|
|
16
|
-
PlateNumberAsc: "plate_number:asc",
|
|
17
|
-
PlateNumberDesc: "plate_number:desc",
|
|
18
16
|
VinAsc: "vin:asc",
|
|
19
17
|
VinDesc: "vin:desc",
|
|
20
18
|
SubKindAsc: "sub_kind:asc",
|
|
21
19
|
SubKindDesc: "sub_kind:desc",
|
|
20
|
+
YearAsc: "year:asc",
|
|
21
|
+
YearDesc: "year:desc",
|
|
22
22
|
AutonomyLevelAsc: "autonomy_level:asc",
|
|
23
23
|
AutonomyLevelDesc: "autonomy_level:desc",
|
|
24
24
|
StatusAsc: "status:asc",
|
|
@@ -38,6 +38,8 @@ export * as positions from "./positions/index.js";
|
|
|
38
38
|
export * as realtime from "./realtime/index.js";
|
|
39
39
|
export * from "./taskAttempts/client/requests/index.js";
|
|
40
40
|
export * as taskAttempts from "./taskAttempts/index.js";
|
|
41
|
+
export * from "./tasks/client/requests/index.js";
|
|
42
|
+
export * as tasks from "./tasks/index.js";
|
|
41
43
|
export * from "./users/client/requests/index.js";
|
|
42
44
|
export * as users from "./users/index.js";
|
|
43
45
|
export * from "./users/types/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.taskAttempts = exports.realtime = exports.positions = exports.organizations = exports.operators = exports.notifications = exports.notificationPreferences = exports.memberships = exports.lookups = exports.jobs = exports.invites = exports.imports = exports.files = exports.devices = exports.assignments = exports.assets = exports.activity = exports.activeOrganization = void 0;
|
|
39
|
+
exports.users = exports.tasks = exports.taskAttempts = exports.realtime = exports.positions = exports.organizations = exports.operators = exports.notifications = exports.notificationPreferences = exports.memberships = exports.lookups = exports.jobs = exports.invites = exports.imports = exports.files = exports.devices = 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);
|
|
@@ -77,6 +77,8 @@ exports.positions = __importStar(require("./positions/index.js"));
|
|
|
77
77
|
exports.realtime = __importStar(require("./realtime/index.js"));
|
|
78
78
|
__exportStar(require("./taskAttempts/client/requests/index.js"), exports);
|
|
79
79
|
exports.taskAttempts = __importStar(require("./taskAttempts/index.js"));
|
|
80
|
+
__exportStar(require("./tasks/client/requests/index.js"), exports);
|
|
81
|
+
exports.tasks = __importStar(require("./tasks/index.js"));
|
|
80
82
|
__exportStar(require("./users/client/requests/index.js"), exports);
|
|
81
83
|
exports.users = __importStar(require("./users/index.js"));
|
|
82
84
|
__exportStar(require("./users/types/index.js"), exports);
|
|
@@ -0,0 +1,120 @@
|
|
|
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 TasksClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class TasksClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<TasksClient.Options>;
|
|
12
|
+
constructor(options: TasksClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* 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.
|
|
15
|
+
*
|
|
16
|
+
* @param {NizamDashboard.ListTasksRequest} request
|
|
17
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
|
+
*
|
|
19
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
20
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
21
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
22
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* await client.tasks.listTasks({
|
|
26
|
+
* starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
|
|
27
|
+
* ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
|
|
28
|
+
* })
|
|
29
|
+
*/
|
|
30
|
+
listTasks(request?: NizamDashboard.ListTasksRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.ListResponseTask>;
|
|
31
|
+
private __listTasks;
|
|
32
|
+
/**
|
|
33
|
+
* 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.
|
|
34
|
+
*
|
|
35
|
+
* @param {NizamDashboard.CreateTaskRequest} request
|
|
36
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
37
|
+
*
|
|
38
|
+
* @throws {@link NizamDashboard.BadRequestError}
|
|
39
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
40
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
41
|
+
* @throws {@link NizamDashboard.ConflictError}
|
|
42
|
+
* @throws {@link NizamDashboard.UnprocessableEntityError}
|
|
43
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
44
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* await client.tasks.createTask({
|
|
48
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
49
|
+
* type: "pickup",
|
|
50
|
+
* executor_organization_id: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
|
|
51
|
+
* merchant_id: "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
|
|
52
|
+
* notes: "Leave at front desk"
|
|
53
|
+
* })
|
|
54
|
+
*/
|
|
55
|
+
createTask(request: NizamDashboard.CreateTaskRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.Task>;
|
|
56
|
+
private __createTask;
|
|
57
|
+
/**
|
|
58
|
+
* 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).
|
|
59
|
+
*
|
|
60
|
+
* @param {NizamDashboard.GetTaskRequest} request
|
|
61
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
|
+
*
|
|
63
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
64
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
65
|
+
* @throws {@link NizamDashboard.NotFoundError}
|
|
66
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
67
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* await client.tasks.getTask({
|
|
71
|
+
* id: "00000000-0000-0000-0000-000000000000"
|
|
72
|
+
* })
|
|
73
|
+
*/
|
|
74
|
+
getTask(request: NizamDashboard.GetTaskRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.Task>;
|
|
75
|
+
private __getTask;
|
|
76
|
+
/**
|
|
77
|
+
* 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.
|
|
78
|
+
*
|
|
79
|
+
* > **Requires** `delete` on `task` (SpiceDB permission expression).
|
|
80
|
+
*
|
|
81
|
+
* @param {NizamDashboard.DeleteTaskRequest} request
|
|
82
|
+
* @param {TasksClient.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.TooManyRequestsError}
|
|
88
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* await client.tasks.deleteTask({
|
|
92
|
+
* id: "00000000-0000-0000-0000-000000000000"
|
|
93
|
+
* })
|
|
94
|
+
*/
|
|
95
|
+
deleteTask(request: NizamDashboard.DeleteTaskRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
96
|
+
private __deleteTask;
|
|
97
|
+
/**
|
|
98
|
+
* 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.
|
|
99
|
+
*
|
|
100
|
+
* > **Requires** `update` on `task` (SpiceDB permission expression).
|
|
101
|
+
*
|
|
102
|
+
* @param {NizamDashboard.UpdateTaskRequest} request
|
|
103
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
104
|
+
*
|
|
105
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
106
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
107
|
+
* @throws {@link NizamDashboard.NotFoundError}
|
|
108
|
+
* @throws {@link NizamDashboard.UnprocessableEntityError}
|
|
109
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
110
|
+
* @throws {@link NizamDashboard.InternalServerError}
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* await client.tasks.updateTask({
|
|
114
|
+
* id: "00000000-0000-0000-0000-000000000000",
|
|
115
|
+
* notes: "Customer rescheduled to 4pm"
|
|
116
|
+
* })
|
|
117
|
+
*/
|
|
118
|
+
updateTask(request: NizamDashboard.UpdateTaskRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.Task>;
|
|
119
|
+
private __updateTask;
|
|
120
|
+
}
|
|
@@ -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. */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type * as NizamDashboard from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Envelope for paginated list responses (opaque cursor pagination).
|
|
4
|
+
*/
|
|
5
|
+
export interface ListResponseTask {
|
|
6
|
+
/** Object type discriminator. Always `list` for this envelope. */
|
|
7
|
+
object?: ListResponseTask.Object_ | undefined;
|
|
8
|
+
/** Page of resources. Empty array when there are no matches. */
|
|
9
|
+
data?: NizamDashboard.Task[] | 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 ListResponseTask {
|
|
22
|
+
/** Object type discriminator. 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.ListResponseTask = void 0;
|
|
5
|
+
var ListResponseTask;
|
|
6
|
+
(function (ListResponseTask) {
|
|
7
|
+
/** Object type discriminator. Always `list` for this envelope. */
|
|
8
|
+
ListResponseTask.Object_ = {
|
|
9
|
+
List: "list",
|
|
10
|
+
};
|
|
11
|
+
})(ListResponseTask || (exports.ListResponseTask = ListResponseTask = {}));
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A unit of work — the reference resource for per-verb relationship authorization.
|
|
3
|
+
*/
|
|
4
|
+
export interface Task {
|
|
5
|
+
/** Stable UUID. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** The kind of stop. */
|
|
8
|
+
type: Task.Type;
|
|
9
|
+
/** Free-form notes (the editable content). */
|
|
10
|
+
notes?: string | undefined;
|
|
11
|
+
/** Owning organization id. */
|
|
12
|
+
organization_id: string;
|
|
13
|
+
/** Executor organization the task is delegated to (cross-org), if any. */
|
|
14
|
+
executor_organization_id?: string | undefined;
|
|
15
|
+
/** Merchant the task belongs to, if any. */
|
|
16
|
+
merchant_id?: string | undefined;
|
|
17
|
+
/** The user who created (owns) the task — the SpiceDB `task#owner`. */
|
|
18
|
+
owner_id?: string | undefined;
|
|
19
|
+
/** Object type discriminator. */
|
|
20
|
+
object: Task.Object_;
|
|
21
|
+
}
|
|
22
|
+
export declare namespace Task {
|
|
23
|
+
/** The kind of stop. */
|
|
24
|
+
const Type: {
|
|
25
|
+
readonly Pickup: "pickup";
|
|
26
|
+
readonly Dropoff: "dropoff";
|
|
27
|
+
readonly Service: "service";
|
|
28
|
+
readonly Return: "return";
|
|
29
|
+
readonly Exchange: "exchange";
|
|
30
|
+
readonly EndAtHub: "end_at_hub";
|
|
31
|
+
readonly EndAtDriverAddress: "end_at_driver_address";
|
|
32
|
+
readonly RouteLoad: "route_load";
|
|
33
|
+
readonly Break: "break";
|
|
34
|
+
};
|
|
35
|
+
type Type = (typeof Type)[keyof typeof Type];
|
|
36
|
+
/** Object type discriminator. */
|
|
37
|
+
const Object_: {
|
|
38
|
+
readonly Task: "task";
|
|
39
|
+
};
|
|
40
|
+
type Object_ = (typeof Object_)[keyof typeof Object_];
|
|
41
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Task = void 0;
|
|
5
|
+
var Task;
|
|
6
|
+
(function (Task) {
|
|
7
|
+
/** The kind of stop. */
|
|
8
|
+
Task.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
|
+
/** Object type discriminator. */
|
|
20
|
+
Task.Object_ = {
|
|
21
|
+
Task: "task",
|
|
22
|
+
};
|
|
23
|
+
})(Task || (exports.Task = Task = {}));
|
package/dist/api/types/User.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare namespace User {
|
|
|
39
39
|
type Permissions = Permissions.Item[];
|
|
40
40
|
namespace Permissions {
|
|
41
41
|
const Item: {
|
|
42
|
+
readonly ActivityReadAll: "activity:read:all";
|
|
42
43
|
readonly AssetCreate: "asset:create";
|
|
43
44
|
readonly AssetDelete: "asset:delete";
|
|
44
45
|
readonly AssetDispose: "asset:dispose";
|
|
@@ -51,6 +52,7 @@ export declare namespace User {
|
|
|
51
52
|
readonly NotificationDeliveryRead: "notification-delivery:read";
|
|
52
53
|
readonly OrgMaintenanceAdminister: "org-maintenance:administer";
|
|
53
54
|
readonly ServiceAccountAdminister: "service-account:administer";
|
|
55
|
+
readonly TaskCreate: "task:create";
|
|
54
56
|
readonly UserAdminister: "user:administer";
|
|
55
57
|
readonly UserInvite: "user:invite";
|
|
56
58
|
};
|
package/dist/api/types/User.js
CHANGED
|
@@ -17,6 +17,7 @@ var User;
|
|
|
17
17
|
let Permissions;
|
|
18
18
|
(function (Permissions) {
|
|
19
19
|
Permissions.Item = {
|
|
20
|
+
ActivityReadAll: "activity:read:all",
|
|
20
21
|
AssetCreate: "asset:create",
|
|
21
22
|
AssetDelete: "asset:delete",
|
|
22
23
|
AssetDispose: "asset:dispose",
|
|
@@ -29,6 +30,7 @@ var User;
|
|
|
29
30
|
NotificationDeliveryRead: "notification-delivery:read",
|
|
30
31
|
OrgMaintenanceAdminister: "org-maintenance:administer",
|
|
31
32
|
ServiceAccountAdminister: "service-account:administer",
|
|
33
|
+
TaskCreate: "task:create",
|
|
32
34
|
UserAdminister: "user:administer",
|
|
33
35
|
UserInvite: "user:invite",
|
|
34
36
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./ActiveOrganization.js";
|
|
2
|
+
export * from "./ActivityCauser.js";
|
|
2
3
|
export * from "./ActivityResource.js";
|
|
3
4
|
export * from "./AllowedTransitions.js";
|
|
4
5
|
export * from "./ApiFieldError.js";
|
|
@@ -43,6 +44,7 @@ export * from "./ListResponseNotificationDeadLetter.js";
|
|
|
43
44
|
export * from "./ListResponseOperatorPosition.js";
|
|
44
45
|
export * from "./ListResponseOrganization.js";
|
|
45
46
|
export * from "./ListResponsePosition.js";
|
|
47
|
+
export * from "./ListResponseTask.js";
|
|
46
48
|
export * from "./ListResponseTimezone.js";
|
|
47
49
|
export * from "./ListResponseUserResource.js";
|
|
48
50
|
export * from "./Membership.js";
|
|
@@ -68,6 +70,7 @@ export * from "./ProblemDetail.js";
|
|
|
68
70
|
export * from "./QuietHours.js";
|
|
69
71
|
export * from "./RealtimeTicket.js";
|
|
70
72
|
export * from "./ReconcileResponse.js";
|
|
73
|
+
export * from "./Task.js";
|
|
71
74
|
export * from "./TaskAttemptPhoto.js";
|
|
72
75
|
export * from "./TaskAttemptPhotoThumbnail.js";
|
|
73
76
|
export * from "./Timezone.js";
|
package/dist/api/types/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ActiveOrganization.js"), exports);
|
|
18
|
+
__exportStar(require("./ActivityCauser.js"), exports);
|
|
18
19
|
__exportStar(require("./ActivityResource.js"), exports);
|
|
19
20
|
__exportStar(require("./AllowedTransitions.js"), exports);
|
|
20
21
|
__exportStar(require("./ApiFieldError.js"), exports);
|
|
@@ -59,6 +60,7 @@ __exportStar(require("./ListResponseNotificationDeadLetter.js"), exports);
|
|
|
59
60
|
__exportStar(require("./ListResponseOperatorPosition.js"), exports);
|
|
60
61
|
__exportStar(require("./ListResponseOrganization.js"), exports);
|
|
61
62
|
__exportStar(require("./ListResponsePosition.js"), exports);
|
|
63
|
+
__exportStar(require("./ListResponseTask.js"), exports);
|
|
62
64
|
__exportStar(require("./ListResponseTimezone.js"), exports);
|
|
63
65
|
__exportStar(require("./ListResponseUserResource.js"), exports);
|
|
64
66
|
__exportStar(require("./Membership.js"), exports);
|
|
@@ -84,6 +86,7 @@ __exportStar(require("./ProblemDetail.js"), exports);
|
|
|
84
86
|
__exportStar(require("./QuietHours.js"), exports);
|
|
85
87
|
__exportStar(require("./RealtimeTicket.js"), exports);
|
|
86
88
|
__exportStar(require("./ReconcileResponse.js"), exports);
|
|
89
|
+
__exportStar(require("./Task.js"), exports);
|
|
87
90
|
__exportStar(require("./TaskAttemptPhoto.js"), exports);
|
|
88
91
|
__exportStar(require("./TaskAttemptPhotoThumbnail.js"), exports);
|
|
89
92
|
__exportStar(require("./Timezone.js"), exports);
|