dalux-build-api 1.1.5 → 2.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/README.md +192 -153
- package/package.json +3 -2
- package/src/api/CompaniesApi.js +19 -12
- package/src/api/CompanyCatalogApi.js +22 -18
- package/src/api/FileAreasApi.js +14 -12
- package/src/api/FilesApi.js +10 -6
- package/src/api/FoldersApi.js +14 -12
- package/src/api/FormsApi.js +11 -6
- package/src/api/InspectionPlansApi.js +7 -3
- package/src/api/ProjectsApi.js +22 -18
- package/src/api/TasksApi.js +25 -10
- package/src/api/TestPlansApi.js +7 -3
- package/src/api/UsersApi.js +11 -6
- package/src/api/VersionSetsApi.js +20 -12
- package/src/api/WorkPackagesApi.js +7 -3
- package/src/index.js +5 -0
- package/src/models/common.js +22 -0
- package/src/models/companies/index.js +14 -0
- package/src/models/companyCatalog/index.js +19 -0
- package/src/models/convert.js +44 -0
- package/src/models/fileAreas/index.js +20 -0
- package/src/models/fileRevisions/index.js +12 -0
- package/src/models/fileUpload/index.js +12 -0
- package/src/models/files/index.js +97 -0
- package/src/models/folders/index.js +20 -0
- package/src/models/forms/index.js +19 -0
- package/src/models/helpers.js +62 -0
- package/src/models/index.js +148 -0
- package/src/models/inspectionPlans/index.js +18 -0
- package/src/models/projectTemplates/index.js +11 -0
- package/src/models/projects/index.js +57 -0
- package/src/models/tasks/index.js +105 -0
- package/src/models/testPlans/index.js +17 -0
- package/src/models/users/index.js +29 -0
- package/src/models/versionSets/index.js +22 -0
- package/src/models/workPackages/index.js +19 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { z } = require('zod');
|
|
4
|
+
const { listResponseSchema, singleResponseSchema } = require('../helpers');
|
|
5
|
+
|
|
6
|
+
/** Mirrors models/tasks/models.py::Task (extra="allow" -> passthrough; only taskId is typed). */
|
|
7
|
+
const TaskSchema = z.object({
|
|
8
|
+
taskId: z.string().nullish(),
|
|
9
|
+
}).passthrough();
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Mirrors models/tasks/models.py::TaskListParams. Field names are the
|
|
13
|
+
* actual OData query keys (matches what src/api/TasksApi.js's
|
|
14
|
+
* normalizeTaskParams reads/writes) rather than Python's snake_case
|
|
15
|
+
* attribute names, since JS has no alias layer to bridge the two. These are
|
|
16
|
+
* developer-supplied query params (not API responses), so plain `.optional()`
|
|
17
|
+
* is fine.
|
|
18
|
+
*/
|
|
19
|
+
const TaskListParamsSchema = z.object({
|
|
20
|
+
typeId: z.string().optional(),
|
|
21
|
+
$filter: z.string().optional(),
|
|
22
|
+
$select: z.string().optional(),
|
|
23
|
+
$orderby: z.string().optional(),
|
|
24
|
+
$top: z.number().optional(),
|
|
25
|
+
$skip: z.number().optional(),
|
|
26
|
+
bookmark: z.string().optional(),
|
|
27
|
+
}).passthrough();
|
|
28
|
+
|
|
29
|
+
/** Mirrors models/tasks/models.py::TaskChangeActor. */
|
|
30
|
+
const TaskChangeActorSchema = z.object({
|
|
31
|
+
userId: z.string().nullish(),
|
|
32
|
+
roleId: z.string().nullish(),
|
|
33
|
+
roleName: z.string().nullish(),
|
|
34
|
+
userName: z.string().nullish(),
|
|
35
|
+
name: z.string().nullish(),
|
|
36
|
+
}).passthrough();
|
|
37
|
+
|
|
38
|
+
/** Mirrors models/tasks/models.py::TaskChangeLocation (empty passthrough). */
|
|
39
|
+
const TaskChangeLocationSchema = z.object({}).passthrough();
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Preprocesses the deadline field the same way Python's
|
|
43
|
+
* `normalize_deadline` field_validator does: unwraps API payloads where
|
|
44
|
+
* deadline is returned as an object instead of a bare string.
|
|
45
|
+
*/
|
|
46
|
+
const deadlineSchema = z.preprocess((value) => {
|
|
47
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
48
|
+
if (value.empty === true) return undefined;
|
|
49
|
+
if ('value' in value) return value.value;
|
|
50
|
+
if ('date' in value) return value.date;
|
|
51
|
+
if ('datetime' in value) return value.datetime;
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
}, z.string().nullish());
|
|
55
|
+
|
|
56
|
+
/** Mirrors models/tasks/models.py::TaskChangeFields. */
|
|
57
|
+
const TaskChangeFieldsSchema = z.object({
|
|
58
|
+
currentResponsible: TaskChangeActorSchema.nullish(),
|
|
59
|
+
assignedTo: TaskChangeActorSchema.nullish(),
|
|
60
|
+
title: z.string().nullish(),
|
|
61
|
+
deadline: deadlineSchema,
|
|
62
|
+
status: z.string().nullish(),
|
|
63
|
+
modifiedBy: TaskChangeActorSchema.nullish(),
|
|
64
|
+
userDefinedFields: z.record(z.any()).nullish(),
|
|
65
|
+
workpackageId: z.string().nullish(),
|
|
66
|
+
location: TaskChangeLocationSchema.nullish(),
|
|
67
|
+
}).passthrough();
|
|
68
|
+
|
|
69
|
+
/** Mirrors models/tasks/models.py::TaskChange. */
|
|
70
|
+
const TaskChangeSchema = z.object({
|
|
71
|
+
taskId: z.string(),
|
|
72
|
+
description: z.string().nullish(),
|
|
73
|
+
timestamp: z.string(),
|
|
74
|
+
action: z.string(),
|
|
75
|
+
fields: TaskChangeFieldsSchema.nullish(),
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
/** Mirrors models/tasks/models.py::TaskAttachment. */
|
|
79
|
+
const TaskAttachmentSchema = z.object({
|
|
80
|
+
attachmentId: z.string().nullish(),
|
|
81
|
+
taskId: z.string().nullish(),
|
|
82
|
+
fileId: z.string().nullish(),
|
|
83
|
+
}).passthrough();
|
|
84
|
+
|
|
85
|
+
const TasksListResponseSchema = listResponseSchema(TaskSchema);
|
|
86
|
+
const TaskResponseSchema = singleResponseSchema(TaskSchema);
|
|
87
|
+
const TaskChangeResponseSchema = singleResponseSchema(TaskChangeSchema);
|
|
88
|
+
/** Bare-list payloads (`[...]` instead of `{items: [...]}`) are handled by listResponseSchema's preprocessor. */
|
|
89
|
+
const TaskChangesSchema = listResponseSchema(TaskChangeSchema);
|
|
90
|
+
const TaskAttachmentsListResponseSchema = listResponseSchema(TaskAttachmentSchema);
|
|
91
|
+
|
|
92
|
+
module.exports = {
|
|
93
|
+
TaskSchema,
|
|
94
|
+
TaskListParamsSchema,
|
|
95
|
+
TaskChangeActorSchema,
|
|
96
|
+
TaskChangeLocationSchema,
|
|
97
|
+
TaskChangeFieldsSchema,
|
|
98
|
+
TaskChangeSchema,
|
|
99
|
+
TaskAttachmentSchema,
|
|
100
|
+
TasksListResponseSchema,
|
|
101
|
+
TaskResponseSchema,
|
|
102
|
+
TaskChangeResponseSchema,
|
|
103
|
+
TaskChangesSchema,
|
|
104
|
+
TaskAttachmentsListResponseSchema,
|
|
105
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { z } = require('zod');
|
|
4
|
+
const { listResponseSchema } = require('../helpers');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Mirrors models/test_plans/models.py::TestPlan — empty placeholder in
|
|
8
|
+
* Python, so list items stay untyped.
|
|
9
|
+
*/
|
|
10
|
+
const TestPlanSchema = z.any();
|
|
11
|
+
|
|
12
|
+
const TestPlansListResponseSchema = listResponseSchema(TestPlanSchema);
|
|
13
|
+
|
|
14
|
+
module.exports = {
|
|
15
|
+
TestPlanSchema,
|
|
16
|
+
TestPlansListResponseSchema,
|
|
17
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { z } = require('zod');
|
|
4
|
+
const { listResponseSchema, singleResponseSchema } = require('../helpers');
|
|
5
|
+
|
|
6
|
+
/** Mirrors models/users/models.py::User. */
|
|
7
|
+
const UserSchema = z.object({
|
|
8
|
+
userId: z.string(),
|
|
9
|
+
userType: z.string(),
|
|
10
|
+
email: z.string().email(),
|
|
11
|
+
firstName: z.string().nullish(),
|
|
12
|
+
lastName: z.string().nullish(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
/** Mirrors models/users/models.py::ProjectUser (User + companyId). */
|
|
16
|
+
const ProjectUserSchema = UserSchema.extend({
|
|
17
|
+
companyId: z.string().nullish(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const UsersListResponseSchema = listResponseSchema(ProjectUserSchema);
|
|
21
|
+
/** Single-user response wraps User, not ProjectUser — matches Python. */
|
|
22
|
+
const UserResponseSchema = singleResponseSchema(UserSchema);
|
|
23
|
+
|
|
24
|
+
module.exports = {
|
|
25
|
+
UserSchema,
|
|
26
|
+
ProjectUserSchema,
|
|
27
|
+
UsersListResponseSchema,
|
|
28
|
+
UserResponseSchema,
|
|
29
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { z } = require('zod');
|
|
4
|
+
const { listResponseSchema, singleResponseSchema } = require('../helpers');
|
|
5
|
+
|
|
6
|
+
/** Mirrors models/version_sets/models.py::VersionSet. */
|
|
7
|
+
const VersionSetSchema = z.object({
|
|
8
|
+
versionSetId: z.string(),
|
|
9
|
+
name: z.string(),
|
|
10
|
+
description: z.string().nullish(),
|
|
11
|
+
status: z.string().nullish(),
|
|
12
|
+
fileAreaId: z.string(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const VersionSetsListResponseSchema = listResponseSchema(VersionSetSchema);
|
|
16
|
+
const VersionSetResponseSchema = singleResponseSchema(VersionSetSchema);
|
|
17
|
+
|
|
18
|
+
module.exports = {
|
|
19
|
+
VersionSetSchema,
|
|
20
|
+
VersionSetsListResponseSchema,
|
|
21
|
+
VersionSetResponseSchema,
|
|
22
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { z } = require('zod');
|
|
4
|
+
const { listResponseSchema } = require('../helpers');
|
|
5
|
+
|
|
6
|
+
/** Mirrors models/work_packages/models.py::WorkPackage (extra="allow" -> passthrough). */
|
|
7
|
+
const WorkPackageSchema = z.object({
|
|
8
|
+
workpackageId: z.string().nullish(),
|
|
9
|
+
companyId: z.string().nullish(),
|
|
10
|
+
name: z.string().nullish(),
|
|
11
|
+
}).passthrough();
|
|
12
|
+
|
|
13
|
+
/** No single-item response class in Python. */
|
|
14
|
+
const WorkPackagesListResponseSchema = listResponseSchema(WorkPackageSchema);
|
|
15
|
+
|
|
16
|
+
module.exports = {
|
|
17
|
+
WorkPackageSchema,
|
|
18
|
+
WorkPackagesListResponseSchema,
|
|
19
|
+
};
|