@raclettejs/core 0.1.24 → 0.1.25
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/CHANGELOG.md +12 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
- package/services/backend/.yarn/install-state.gz +0 -0
- package/services/backend/dist/core/eventBus/index.js +7 -0
- package/services/backend/dist/core/pluginSystem/configGenerator/index.js +346 -0
- package/services/backend/dist/core/sockets/index.js +95 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/account/events/index.js +31 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/account/index.js +48 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/account/routes/index.js +15 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/composition/events/index.js +22 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/composition/index.js +51 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/composition/routes/index.js +19 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/interactionLink/events/index.js +22 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/interactionLink/index.js +48 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/interactionLink/routes/index.js +19 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/project/events/index.js +31 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/project/index.js +49 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/project/routes/index.js +16 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/tag/events/index.js +39 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/tag/index.js +50 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/tag/routes/index.js +19 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/user/events/index.js +31 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/user/index.js +51 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/user/routes/index.js +21 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/workSession/events/index.js +31 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/workSession/index.js +48 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/workSession/routes/index.js +15 -0
- package/services/backend/dist/corePlugins/raclette__core/backend/index.js +34 -0
- package/services/backend/dist/domains/index.js +11 -0
- package/services/backend/dist/domains/system/index.js +11 -0
- package/services/backend/dist/domains/system/routes/index.js +17 -0
- package/services/backend/dist/helpers/index.js +14 -0
- package/services/backend/dist/index.js +3 -0
- package/services/backend/dist/modules/authentication/index.js +253 -0
- package/services/backend/dist/shared/types/core/index.js +8 -0
- package/services/backend/dist/shared/types/dataTypes/index.js +6 -0
- package/services/backend/dist/shared/types/index.js +8 -0
- package/services/backend/dist/shared/types/plugins/index.js +8 -0
- package/services/backend/dist/types/index.js +12 -0
- package/services/backend/dist/utils/index.js +2 -0
- package/services/backend/package.json +2 -2
- package/services/backend/src/corePlugins/raclette__core/frontend/generated-config.ts +12 -0
- package/services/backend/src/shared/schemas/core/Account.schema.ts +10 -10
- package/services/backend/src/shared/schemas/core/Composition.schema.ts +25 -22
- package/services/backend/src/shared/schemas/core/CompositionCreate.schema.ts +19 -16
- package/services/backend/src/shared/schemas/core/CompositionUpdate.schema.ts +19 -16
- package/services/backend/src/shared/schemas/core/InteractionLink.schema.ts +15 -15
- package/services/backend/src/shared/schemas/core/InteractionLinkCreate.schema.ts +9 -9
- package/services/backend/src/shared/schemas/core/InteractionLinkUpdate.schema.ts +9 -9
- package/services/backend/src/shared/schemas/core/Project.schema.ts +28 -6
- package/services/backend/src/shared/schemas/core/ProjectCreate.schema.ts +22 -0
- package/services/backend/src/shared/schemas/core/ProjectUpdate.schema.ts +25 -0
- package/services/backend/src/shared/schemas/core/Tag.schema.ts +11 -9
- package/services/backend/src/shared/schemas/core/TagCreate.schema.ts +1 -3
- package/services/backend/src/shared/schemas/core/TagUpdate.schema.ts +1 -0
- package/services/backend/src/shared/schemas/core/Trigger.schema.ts +3 -3
- package/services/backend/src/shared/schemas/core/User.schema.ts +18 -18
- package/services/backend/src/shared/schemas/core/UserCreate.schema.ts +9 -9
- package/services/backend/src/shared/schemas/core/Widget.schema.ts +5 -5
- package/services/backend/src/shared/schemas/core/WidgetLayout.schema.ts +9 -9
- package/services/backend/src/shared/types/core/Composition.types.ts +1 -0
- package/services/backend/src/shared/types/core/CompositionCreate.types.ts +1 -0
- package/services/backend/src/shared/types/core/CompositionUpdate.types.ts +1 -0
- package/services/backend/src/shared/types/core/Project.types.ts +4 -0
- package/services/backend/src/shared/types/core/ProjectCreate.types.ts +4 -0
- package/services/backend/src/shared/types/core/ProjectUpdate.types.ts +4 -1
- package/services/backend/src/shared/types/core/Tag.types.ts +1 -1
- package/services/backend/src/shared/types/core/TagCreate.types.ts +0 -1
- package/services/backend/src/shared/types/core/index.ts +4 -0
- package/services/backend/src/shared/types/plugins/index.ts +1 -1
- package/services/backend/yarn.lock +517 -292
- package/services/frontend/vite.config.ts +2 -1
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import jwt from "@fastify/jwt";
|
|
2
|
+
import fastifyPlugin from "fastify-plugin";
|
|
3
|
+
import configService from "@c/config/configService";
|
|
4
|
+
import { ForbiddenError } from "@/utils/errors";
|
|
5
|
+
const WORK_SESSION_COLLECTION = "raclette__core-worksession";
|
|
6
|
+
const WORK_SESSION_HEADER = "x-work-session-id";
|
|
7
|
+
/**
|
|
8
|
+
* Middleware: allow either authenticated user (JWT) or valid work session (X-Work-Session-Id).
|
|
9
|
+
* When using this, the route states that it handles permission checks itself (e.g. compare req.workSession with query).
|
|
10
|
+
* - If JWT present and valid: sets req.user (normal auth).
|
|
11
|
+
* - If no/invalid JWT but X-Work-Session-Id present: loads work session, validates (active, not expired),
|
|
12
|
+
* optionally checks that workSession.pluginData includes the given pluginKey, then sets req.workSession and req.isWorkSession.
|
|
13
|
+
*/
|
|
14
|
+
export const authenticatedOrWorksession = async (req, res, fastify, pluginKey) => {
|
|
15
|
+
fastify.log.debug(`[Auth] authenticatedOrWorksession: ${pluginKey} ${req.method} ${req.url}`);
|
|
16
|
+
const { requireAuthentication } = configService.getConfig()?.global ?? {
|
|
17
|
+
requireAuthentication: true,
|
|
18
|
+
};
|
|
19
|
+
const isAdminTagRequired = configService.isAdminTagRequired();
|
|
20
|
+
if (!requireAuthentication) {
|
|
21
|
+
const mockUser = { _id: "SYSTEM" };
|
|
22
|
+
req.user = mockUser;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// 1) Try JWT first
|
|
26
|
+
try {
|
|
27
|
+
await req.jwtVerify();
|
|
28
|
+
const payload = req.user;
|
|
29
|
+
fastify.log.debug(`[Auth] JWT verified, payload type: ${payload.type || "user"}, sessionId: ${payload.sessionId || "none"}, _id: ${payload._id || "none"}`);
|
|
30
|
+
if (payload.type === "workSession" && payload.sessionId) {
|
|
31
|
+
fastify.log.info(`[Auth] Work session JWT detected, sessionId: ${payload.sessionId}, pluginKey: ${pluginKey}`);
|
|
32
|
+
// Work session JWT: load session and validate
|
|
33
|
+
const workSession = await loadAndValidateWorkSession(fastify, payload.sessionId, pluginKey);
|
|
34
|
+
if (!workSession) {
|
|
35
|
+
fastify.log.warn(`[Auth] Work session validation failed for sessionId: ${payload.sessionId}`);
|
|
36
|
+
return res
|
|
37
|
+
.status(401)
|
|
38
|
+
.send({ message: "Invalid or expired work session" });
|
|
39
|
+
}
|
|
40
|
+
fastify.log.info(`[Auth] Work session authenticated: sessionId=${payload.sessionId}, pluginKey=${pluginKey}`);
|
|
41
|
+
req.workSession = workSession;
|
|
42
|
+
req.isWorkSession = true;
|
|
43
|
+
// Set projectId from workSession.project if available
|
|
44
|
+
if (workSession.project) {
|
|
45
|
+
req.projectId = workSession.project;
|
|
46
|
+
fastify.log.debug(`[Auth] Work session projectId: ${req.projectId}`);
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
// Normal user JWT: fetch user and set req.user
|
|
51
|
+
fastify.log.debug(`[Auth] Normal user JWT, fetching user: ${req.user?._id}`);
|
|
52
|
+
const { _id } = req.user;
|
|
53
|
+
const adminTag = await fastify.database
|
|
54
|
+
.collection("raclette__core-tag")
|
|
55
|
+
.findOne({ title: "ADMIN", locked: true, type: "system" });
|
|
56
|
+
let isAdmin = false;
|
|
57
|
+
const user = await fastify.database
|
|
58
|
+
.collection("raclette__core-user")
|
|
59
|
+
.findOne({ _id }, { projection: { password: 0, resetKey: 0 } });
|
|
60
|
+
if (user && user.tags && adminTag) {
|
|
61
|
+
user.tags.forEach((tag) => {
|
|
62
|
+
if (adminTag._id === tag)
|
|
63
|
+
isAdmin = true;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (isAdminTagRequired && !isAdmin) {
|
|
67
|
+
fastify.log.error("User not allowed in workbench");
|
|
68
|
+
return res.status(403).send({ message: "User not allowed in workbench" });
|
|
69
|
+
}
|
|
70
|
+
if (isAdmin)
|
|
71
|
+
user.isAdmin = true;
|
|
72
|
+
if (!user) {
|
|
73
|
+
fastify.log.error("User not found");
|
|
74
|
+
return res.status(401).send({ message: "User not found" });
|
|
75
|
+
}
|
|
76
|
+
const account = await fastify.database
|
|
77
|
+
.collection("raclette__core-account")
|
|
78
|
+
.findOne({ _id: user.account });
|
|
79
|
+
user.account = account;
|
|
80
|
+
req.user = user;
|
|
81
|
+
// Set projectId from user's lastProjectId (for requestData.project in payload wrappers)
|
|
82
|
+
if (user.ux?.lastProjectId) {
|
|
83
|
+
req.projectId = user.ux.lastProjectId;
|
|
84
|
+
fastify.log.debug(`[Auth] User projectId: ${req.projectId}`);
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
// JWT missing or invalid: try work session via header
|
|
90
|
+
fastify.log.debug(`[Auth] JWT verification failed: ${error.message}, trying work session header`);
|
|
91
|
+
}
|
|
92
|
+
// 2) Try X-Work-Session-Id header
|
|
93
|
+
const sessionId = req.headers[WORK_SESSION_HEADER];
|
|
94
|
+
if (sessionId) {
|
|
95
|
+
const workSession = await loadAndValidateWorkSession(fastify, sessionId, pluginKey);
|
|
96
|
+
if (workSession) {
|
|
97
|
+
req.workSession = workSession;
|
|
98
|
+
req.isWorkSession = true;
|
|
99
|
+
// Set projectId from workSession.project if available
|
|
100
|
+
// workaround for how projects/spaces are currently handled - tbd
|
|
101
|
+
if (workSession.project) {
|
|
102
|
+
req.projectId = workSession.project;
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
fastify.log.warn(`[Auth] Work session validation failed for header sessionId: ${sessionId}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return res.status(401).send({ message: "Authentication required" });
|
|
111
|
+
};
|
|
112
|
+
async function loadAndValidateWorkSession(fastify, sessionId, pluginKey) {
|
|
113
|
+
fastify.log.debug(`[WorkSession Auth] Loading and validating work session: sessionId=${sessionId}, pluginKey=${pluginKey}`);
|
|
114
|
+
if (!sessionId || typeof sessionId !== "string") {
|
|
115
|
+
fastify.log.warn(`[WorkSession Auth] Invalid sessionId: ${sessionId}`);
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
fastify.log.debug(`[WorkSession Auth] Querying database for work session`);
|
|
119
|
+
const doc = await fastify.database
|
|
120
|
+
.collection(WORK_SESSION_COLLECTION)
|
|
121
|
+
.findOne({ _id: sessionId });
|
|
122
|
+
if (!doc) {
|
|
123
|
+
fastify.log.warn(`[WorkSession Auth] Work session not found: ${sessionId}`);
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
if (!doc.isActive) {
|
|
127
|
+
fastify.log.warn(`[WorkSession Auth] Work session is not active: ${sessionId}`);
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const expiry = doc.expiryDate ? new Date(doc.expiryDate) : null;
|
|
131
|
+
if (expiry && expiry.getTime() < Date.now()) {
|
|
132
|
+
fastify.log.warn(`[WorkSession Auth] Work session expired: ${sessionId}, expiryDate: ${expiry.toISOString()}`);
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
// Check that this plugin is part of the work session (pluginData keys are "pluginKey:widgetName")
|
|
136
|
+
const pluginData = doc.pluginData || {};
|
|
137
|
+
const pluginKeys = Object.keys(pluginData);
|
|
138
|
+
const hasPlugin = pluginKeys.some((k) => k.startsWith(pluginKey + ":")) ||
|
|
139
|
+
Object.prototype.hasOwnProperty.call(pluginData, pluginKey);
|
|
140
|
+
if (!hasPlugin) {
|
|
141
|
+
fastify.log.warn(`[WorkSession Auth] Plugin ${pluginKey} not found in work session pluginData: ${pluginKeys.join(", ")}`);
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
fastify.log.info(`[WorkSession Auth] Work session validated successfully: sessionId=${sessionId}, pluginKey=${pluginKey}`);
|
|
145
|
+
return doc;
|
|
146
|
+
}
|
|
147
|
+
export const authenticate = async (req, res, fastify) => {
|
|
148
|
+
{
|
|
149
|
+
const { requireAuthentication } = configService.getConfig()?.global ?? {
|
|
150
|
+
requireAuthentication: true,
|
|
151
|
+
};
|
|
152
|
+
const isAdminTagRequired = configService.isAdminTagRequired();
|
|
153
|
+
// Skip JWT verification and database queries, if global.requireAuthentication is configured to false
|
|
154
|
+
if (!requireAuthentication) {
|
|
155
|
+
const mockUser = {
|
|
156
|
+
_id: "SYSTEM",
|
|
157
|
+
};
|
|
158
|
+
req.user = mockUser;
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
await req.jwtVerify();
|
|
163
|
+
const payload = req.user;
|
|
164
|
+
if (payload.type === "workSession") {
|
|
165
|
+
return res
|
|
166
|
+
.status(401)
|
|
167
|
+
.send({ message: "Work session token not allowed on this route" });
|
|
168
|
+
}
|
|
169
|
+
// fetch current user data from the db
|
|
170
|
+
const { _id } = req.user;
|
|
171
|
+
const adminTag = await fastify.database
|
|
172
|
+
.collection("raclette__core-tag")
|
|
173
|
+
.findOne({ title: "ADMIN", locked: true, type: "system" });
|
|
174
|
+
// IMPORTANT
|
|
175
|
+
// due to some very weird behaviour, mongoose always returns empty results
|
|
176
|
+
// so we are using mongodb directly until we fix this
|
|
177
|
+
let isAdmin = false;
|
|
178
|
+
const user = await fastify.database
|
|
179
|
+
.collection("raclette__core-user")
|
|
180
|
+
.findOne({ _id }, { projection: { password: 0, resetKey: 0 } });
|
|
181
|
+
if (user && user.tags && adminTag) {
|
|
182
|
+
user.tags.forEach((tag) => {
|
|
183
|
+
if (adminTag._id === tag) {
|
|
184
|
+
isAdmin = true;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
if (isAdminTagRequired && !isAdmin) {
|
|
189
|
+
fastify.log.error("User not allowed in workbench");
|
|
190
|
+
throw new Error("User not allowed in workbench");
|
|
191
|
+
}
|
|
192
|
+
if (isAdmin) {
|
|
193
|
+
user.isAdmin = true;
|
|
194
|
+
}
|
|
195
|
+
if (!user) {
|
|
196
|
+
fastify.log.error("User not found");
|
|
197
|
+
throw new Error("User not found");
|
|
198
|
+
}
|
|
199
|
+
const account = await fastify.database
|
|
200
|
+
.collection("raclette__core-account")
|
|
201
|
+
.findOne({ _id: user.account });
|
|
202
|
+
user.account = account;
|
|
203
|
+
req.user = user;
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
return res.send(error);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
export const checkPermissions = async (req, res, fastify, permissions) => {
|
|
211
|
+
{
|
|
212
|
+
try {
|
|
213
|
+
if (!permissions.length) {
|
|
214
|
+
fastify.log.error("No permissions given for permission check");
|
|
215
|
+
throw new Error("No Permissions");
|
|
216
|
+
}
|
|
217
|
+
// TODO implement proper Permission lookup here
|
|
218
|
+
permissions.forEach((permissionStr) => {
|
|
219
|
+
if (permissionStr === "user.isAdmin") {
|
|
220
|
+
if (!req.user.isAdmin) {
|
|
221
|
+
throw new ForbiddenError("User not permitted to action");
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
fastify.log.error(error.message);
|
|
228
|
+
return res.send(error.message);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
export default fastifyPlugin(async (fastify, opts = {}) => {
|
|
233
|
+
// provide some sensible options
|
|
234
|
+
const defaults = {
|
|
235
|
+
secret: false,
|
|
236
|
+
decode: { complete: true },
|
|
237
|
+
sign: {
|
|
238
|
+
iss: "api.raclettejs.info",
|
|
239
|
+
expiresIn: "30d",
|
|
240
|
+
},
|
|
241
|
+
verify: { allowedIss: "api.raclettejs.info" },
|
|
242
|
+
};
|
|
243
|
+
// merge proved opts with defaults
|
|
244
|
+
const mergedOptions = { ...defaults, ...opts };
|
|
245
|
+
/* register the plugin */
|
|
246
|
+
fastify.register(jwt, mergedOptions);
|
|
247
|
+
// decorate the fastify instance, so we can call it anywhere
|
|
248
|
+
fastify.decorate("authenticate", (req, res) => {
|
|
249
|
+
return authenticate(req, res, fastify);
|
|
250
|
+
});
|
|
251
|
+
fastify.decorate("authenticatedOrWorksession", (pluginKey) => (req, res) => authenticatedOrWorksession(req, res, fastify, pluginKey));
|
|
252
|
+
fastify.decorate("checkPermissions", (permissionsArr) => (req, res) => checkPermissions(req, res, fastify, permissionsArr));
|
|
253
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./tags";
|
|
2
|
+
// TODO make the mongoDataTypes dynamic
|
|
3
|
+
export const systemDataTypes = ["account", "projectConfig", "userConfig"];
|
|
4
|
+
export const userContents = ["tag", "user", "project"];
|
|
5
|
+
export const mongoDataTypes = systemDataTypes.concat(userContents);
|
|
6
|
+
export const syncableDatatypes = ["tag", "user", "searchResult"];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "../core/backgroundTasks/taskManagerTypes";
|
|
2
|
+
export * from "../core/config/configTypes";
|
|
3
|
+
export * from "../core/crud/crudTypes";
|
|
4
|
+
export * from "../core/http/httpTypes";
|
|
5
|
+
export * from "../core/http/httpTypes";
|
|
6
|
+
export * from "../core/payload/payloadTypes";
|
|
7
|
+
export * from "../core/pluginSystem/pluginTypes";
|
|
8
|
+
export * from "../core/sockets/socketTypes";
|
|
9
|
+
export * from "../core/validation/schemaTypes";
|
|
10
|
+
export * from "../modules/cache/cacheTypes";
|
|
11
|
+
export * from "../core/validation/schemaTypes";
|
|
12
|
+
export * from "../core/pluginSystem/configGenerator/generatorTypes";
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"iovalkey": "0.3.3",
|
|
43
43
|
"migrate-mongo": "14.0.7",
|
|
44
44
|
"mongodb": "6.21.0",
|
|
45
|
-
"mongoose": "8.
|
|
45
|
+
"mongoose": "8.18.3",
|
|
46
46
|
"nanoid": "5.1.7",
|
|
47
47
|
"pino": "10.3.1",
|
|
48
48
|
"pino-pretty": "13.1.3",
|
|
@@ -65,4 +65,4 @@
|
|
|
65
65
|
"typescript": "5.9.3",
|
|
66
66
|
"typescript-eslint": "8.57.1"
|
|
67
67
|
}
|
|
68
|
-
}
|
|
68
|
+
}
|
|
@@ -315,6 +315,18 @@ export default {
|
|
|
315
315
|
}
|
|
316
316
|
]
|
|
317
317
|
},
|
|
318
|
+
updateSelf: {
|
|
319
|
+
target: "/raclette__core/user/self",
|
|
320
|
+
method: "patch",
|
|
321
|
+
storeActionType: "dataUpdate",
|
|
322
|
+
channels: [
|
|
323
|
+
{
|
|
324
|
+
channel: "raclette__core--userUpdated",
|
|
325
|
+
channelKey: "userUpdated",
|
|
326
|
+
prefix: "raclette__core"
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
},
|
|
318
330
|
updateRestore: {
|
|
319
331
|
target: (payload) => `/raclette__core/user/${payload._id}/restore`,
|
|
320
332
|
method: "patch",
|
|
@@ -12,6 +12,16 @@ export const AccountSchema = {
|
|
|
12
12
|
$id: "#account/base",
|
|
13
13
|
title: "core/account",
|
|
14
14
|
type: "object",
|
|
15
|
+
required: [
|
|
16
|
+
"_id",
|
|
17
|
+
"name",
|
|
18
|
+
"active",
|
|
19
|
+
"blocked",
|
|
20
|
+
"tags",
|
|
21
|
+
"isDeleted",
|
|
22
|
+
"createdAt",
|
|
23
|
+
"updatedAt",
|
|
24
|
+
],
|
|
15
25
|
properties: {
|
|
16
26
|
_id: {
|
|
17
27
|
type: "string",
|
|
@@ -63,16 +73,6 @@ export const AccountSchema = {
|
|
|
63
73
|
type: "string",
|
|
64
74
|
},
|
|
65
75
|
},
|
|
66
|
-
required: [
|
|
67
|
-
"_id",
|
|
68
|
-
"name",
|
|
69
|
-
"active",
|
|
70
|
-
"blocked",
|
|
71
|
-
"tags",
|
|
72
|
-
"isDeleted",
|
|
73
|
-
"createdAt",
|
|
74
|
-
"updatedAt",
|
|
75
|
-
],
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
|
|
@@ -12,6 +12,19 @@ export const CompositionSchema = {
|
|
|
12
12
|
$id: "#composition/base",
|
|
13
13
|
title: "core/composition",
|
|
14
14
|
type: "object",
|
|
15
|
+
required: [
|
|
16
|
+
"_id",
|
|
17
|
+
"title",
|
|
18
|
+
"tags",
|
|
19
|
+
"pathname",
|
|
20
|
+
"status",
|
|
21
|
+
"widgetsLayout",
|
|
22
|
+
"author",
|
|
23
|
+
"lastEditor",
|
|
24
|
+
"createdAt",
|
|
25
|
+
"updatedAt",
|
|
26
|
+
"isDeleted",
|
|
27
|
+
],
|
|
15
28
|
properties: {
|
|
16
29
|
_id: {
|
|
17
30
|
type: "string",
|
|
@@ -43,6 +56,9 @@ export const CompositionSchema = {
|
|
|
43
56
|
},
|
|
44
57
|
},
|
|
45
58
|
},
|
|
59
|
+
slotLayout: {
|
|
60
|
+
type: "string",
|
|
61
|
+
},
|
|
46
62
|
status: {
|
|
47
63
|
default: "inProgress",
|
|
48
64
|
anyOf: [
|
|
@@ -67,12 +83,21 @@ export const CompositionSchema = {
|
|
|
67
83
|
type: "array",
|
|
68
84
|
items: {
|
|
69
85
|
type: "object",
|
|
86
|
+
required: [
|
|
87
|
+
"column",
|
|
88
|
+
"widget",
|
|
89
|
+
],
|
|
70
90
|
properties: {
|
|
71
91
|
column: {
|
|
72
92
|
type: "number",
|
|
73
93
|
},
|
|
74
94
|
widget: {
|
|
75
95
|
type: "object",
|
|
96
|
+
required: [
|
|
97
|
+
"uuid",
|
|
98
|
+
"name",
|
|
99
|
+
"pluginKey",
|
|
100
|
+
],
|
|
76
101
|
properties: {
|
|
77
102
|
uuid: {
|
|
78
103
|
type: "string",
|
|
@@ -86,17 +111,8 @@ export const CompositionSchema = {
|
|
|
86
111
|
config: {},
|
|
87
112
|
public: {},
|
|
88
113
|
},
|
|
89
|
-
required: [
|
|
90
|
-
"uuid",
|
|
91
|
-
"name",
|
|
92
|
-
"pluginKey",
|
|
93
|
-
],
|
|
94
114
|
},
|
|
95
115
|
},
|
|
96
|
-
required: [
|
|
97
|
-
"column",
|
|
98
|
-
"widget",
|
|
99
|
-
],
|
|
100
116
|
},
|
|
101
117
|
},
|
|
102
118
|
},
|
|
@@ -119,19 +135,6 @@ export const CompositionSchema = {
|
|
|
119
135
|
type: "boolean",
|
|
120
136
|
},
|
|
121
137
|
},
|
|
122
|
-
required: [
|
|
123
|
-
"_id",
|
|
124
|
-
"title",
|
|
125
|
-
"tags",
|
|
126
|
-
"pathname",
|
|
127
|
-
"status",
|
|
128
|
-
"widgetsLayout",
|
|
129
|
-
"author",
|
|
130
|
-
"lastEditor",
|
|
131
|
-
"createdAt",
|
|
132
|
-
"updatedAt",
|
|
133
|
-
"isDeleted",
|
|
134
|
-
],
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
|
|
@@ -12,6 +12,13 @@ export const CompositionCreateSchema = {
|
|
|
12
12
|
$id: "#composition/create",
|
|
13
13
|
title: "core/composition-create",
|
|
14
14
|
type: "object",
|
|
15
|
+
required: [
|
|
16
|
+
"title",
|
|
17
|
+
"tags",
|
|
18
|
+
"pathname",
|
|
19
|
+
"status",
|
|
20
|
+
"widgetsLayout",
|
|
21
|
+
],
|
|
15
22
|
properties: {
|
|
16
23
|
title: {
|
|
17
24
|
minLength: 1,
|
|
@@ -40,6 +47,9 @@ export const CompositionCreateSchema = {
|
|
|
40
47
|
},
|
|
41
48
|
},
|
|
42
49
|
},
|
|
50
|
+
slotLayout: {
|
|
51
|
+
type: "string",
|
|
52
|
+
},
|
|
43
53
|
status: {
|
|
44
54
|
default: "inProgress",
|
|
45
55
|
anyOf: [
|
|
@@ -64,12 +74,21 @@ export const CompositionCreateSchema = {
|
|
|
64
74
|
type: "array",
|
|
65
75
|
items: {
|
|
66
76
|
type: "object",
|
|
77
|
+
required: [
|
|
78
|
+
"column",
|
|
79
|
+
"widget",
|
|
80
|
+
],
|
|
67
81
|
properties: {
|
|
68
82
|
column: {
|
|
69
83
|
type: "number",
|
|
70
84
|
},
|
|
71
85
|
widget: {
|
|
72
86
|
type: "object",
|
|
87
|
+
required: [
|
|
88
|
+
"uuid",
|
|
89
|
+
"name",
|
|
90
|
+
"pluginKey",
|
|
91
|
+
],
|
|
73
92
|
properties: {
|
|
74
93
|
uuid: {
|
|
75
94
|
type: "string",
|
|
@@ -83,28 +102,12 @@ export const CompositionCreateSchema = {
|
|
|
83
102
|
config: {},
|
|
84
103
|
public: {},
|
|
85
104
|
},
|
|
86
|
-
required: [
|
|
87
|
-
"uuid",
|
|
88
|
-
"name",
|
|
89
|
-
"pluginKey",
|
|
90
|
-
],
|
|
91
105
|
},
|
|
92
106
|
},
|
|
93
|
-
required: [
|
|
94
|
-
"column",
|
|
95
|
-
"widget",
|
|
96
|
-
],
|
|
97
107
|
},
|
|
98
108
|
},
|
|
99
109
|
},
|
|
100
110
|
},
|
|
101
|
-
required: [
|
|
102
|
-
"title",
|
|
103
|
-
"tags",
|
|
104
|
-
"pathname",
|
|
105
|
-
"status",
|
|
106
|
-
"widgetsLayout",
|
|
107
|
-
],
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
|
|
@@ -12,6 +12,13 @@ export const CompositionUpdateSchema = {
|
|
|
12
12
|
$id: "#composition/update",
|
|
13
13
|
title: "core/composition-update",
|
|
14
14
|
type: "object",
|
|
15
|
+
required: [
|
|
16
|
+
"title",
|
|
17
|
+
"tags",
|
|
18
|
+
"pathname",
|
|
19
|
+
"status",
|
|
20
|
+
"widgetsLayout",
|
|
21
|
+
],
|
|
15
22
|
properties: {
|
|
16
23
|
title: {
|
|
17
24
|
minLength: 1,
|
|
@@ -40,6 +47,9 @@ export const CompositionUpdateSchema = {
|
|
|
40
47
|
},
|
|
41
48
|
},
|
|
42
49
|
},
|
|
50
|
+
slotLayout: {
|
|
51
|
+
type: "string",
|
|
52
|
+
},
|
|
43
53
|
status: {
|
|
44
54
|
default: "inProgress",
|
|
45
55
|
anyOf: [
|
|
@@ -64,12 +74,21 @@ export const CompositionUpdateSchema = {
|
|
|
64
74
|
type: "array",
|
|
65
75
|
items: {
|
|
66
76
|
type: "object",
|
|
77
|
+
required: [
|
|
78
|
+
"column",
|
|
79
|
+
"widget",
|
|
80
|
+
],
|
|
67
81
|
properties: {
|
|
68
82
|
column: {
|
|
69
83
|
type: "number",
|
|
70
84
|
},
|
|
71
85
|
widget: {
|
|
72
86
|
type: "object",
|
|
87
|
+
required: [
|
|
88
|
+
"uuid",
|
|
89
|
+
"name",
|
|
90
|
+
"pluginKey",
|
|
91
|
+
],
|
|
73
92
|
properties: {
|
|
74
93
|
uuid: {
|
|
75
94
|
type: "string",
|
|
@@ -83,28 +102,12 @@ export const CompositionUpdateSchema = {
|
|
|
83
102
|
config: {},
|
|
84
103
|
public: {},
|
|
85
104
|
},
|
|
86
|
-
required: [
|
|
87
|
-
"uuid",
|
|
88
|
-
"name",
|
|
89
|
-
"pluginKey",
|
|
90
|
-
],
|
|
91
105
|
},
|
|
92
106
|
},
|
|
93
|
-
required: [
|
|
94
|
-
"column",
|
|
95
|
-
"widget",
|
|
96
|
-
],
|
|
97
107
|
},
|
|
98
108
|
},
|
|
99
109
|
},
|
|
100
110
|
},
|
|
101
|
-
required: [
|
|
102
|
-
"title",
|
|
103
|
-
"tags",
|
|
104
|
-
"pathname",
|
|
105
|
-
"status",
|
|
106
|
-
"widgetsLayout",
|
|
107
|
-
],
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
|
|
@@ -12,6 +12,18 @@ export const InteractionLinkSchema = {
|
|
|
12
12
|
$id: "#interactionLink/base",
|
|
13
13
|
title: "core/interactionLink",
|
|
14
14
|
type: "object",
|
|
15
|
+
required: [
|
|
16
|
+
"_id",
|
|
17
|
+
"composition",
|
|
18
|
+
"slotType",
|
|
19
|
+
"triggers",
|
|
20
|
+
"tags",
|
|
21
|
+
"author",
|
|
22
|
+
"lastEditor",
|
|
23
|
+
"createdAt",
|
|
24
|
+
"updatedAt",
|
|
25
|
+
"isDeleted",
|
|
26
|
+
],
|
|
15
27
|
properties: {
|
|
16
28
|
_id: {
|
|
17
29
|
type: "string",
|
|
@@ -29,6 +41,9 @@ export const InteractionLinkSchema = {
|
|
|
29
41
|
$id: "#trigger/base",
|
|
30
42
|
title: "core/trigger",
|
|
31
43
|
type: "object",
|
|
44
|
+
required: [
|
|
45
|
+
"type",
|
|
46
|
+
],
|
|
32
47
|
properties: {
|
|
33
48
|
type: {
|
|
34
49
|
type: "string",
|
|
@@ -40,9 +55,6 @@ export const InteractionLinkSchema = {
|
|
|
40
55
|
},
|
|
41
56
|
},
|
|
42
57
|
},
|
|
43
|
-
required: [
|
|
44
|
-
"type",
|
|
45
|
-
],
|
|
46
58
|
},
|
|
47
59
|
},
|
|
48
60
|
queryParameters: {
|
|
@@ -84,18 +96,6 @@ export const InteractionLinkSchema = {
|
|
|
84
96
|
type: "boolean",
|
|
85
97
|
},
|
|
86
98
|
},
|
|
87
|
-
required: [
|
|
88
|
-
"_id",
|
|
89
|
-
"composition",
|
|
90
|
-
"slotType",
|
|
91
|
-
"triggers",
|
|
92
|
-
"tags",
|
|
93
|
-
"author",
|
|
94
|
-
"lastEditor",
|
|
95
|
-
"createdAt",
|
|
96
|
-
"updatedAt",
|
|
97
|
-
"isDeleted",
|
|
98
|
-
],
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
|