@raclettejs/core 0.1.31 → 0.1.32-nightly

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/CHANGELOG.md +31 -4
  2. package/dist/cli.js +94 -94
  3. package/dist/cli.js.map +3 -3
  4. package/dist/index.js +3 -3
  5. package/dist/index.js.map +1 -1
  6. package/package.json +4 -4
  7. package/services/backend/.yarn/install-state.gz +0 -0
  8. package/services/backend/dist/core/eventBus/index.js +7 -0
  9. package/services/backend/dist/core/pluginSystem/configGenerator/index.js +346 -0
  10. package/services/backend/dist/core/sockets/index.js +95 -0
  11. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/account/events/index.js +31 -0
  12. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/account/index.js +48 -0
  13. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/account/routes/index.js +15 -0
  14. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/composition/events/index.js +22 -0
  15. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/composition/index.js +51 -0
  16. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/composition/routes/index.js +19 -0
  17. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/interactionLink/events/index.js +22 -0
  18. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/interactionLink/index.js +48 -0
  19. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/interactionLink/routes/index.js +19 -0
  20. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/project/events/index.js +31 -0
  21. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/project/index.js +49 -0
  22. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/project/routes/index.js +16 -0
  23. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/tag/events/index.js +39 -0
  24. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/tag/index.js +50 -0
  25. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/tag/routes/index.js +19 -0
  26. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/user/events/index.js +31 -0
  27. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/user/index.js +51 -0
  28. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/user/routes/index.js +21 -0
  29. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/workSession/events/index.js +31 -0
  30. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/workSession/index.js +48 -0
  31. package/services/backend/dist/corePlugins/raclette__core/backend/datatypes/workSession/routes/index.js +15 -0
  32. package/services/backend/dist/corePlugins/raclette__core/backend/index.js +34 -0
  33. package/services/backend/dist/domains/index.js +11 -0
  34. package/services/backend/dist/domains/system/index.js +11 -0
  35. package/services/backend/dist/domains/system/routes/index.js +17 -0
  36. package/services/backend/dist/helpers/index.js +14 -0
  37. package/services/backend/dist/index.js +3 -0
  38. package/services/backend/dist/modules/authentication/index.js +253 -0
  39. package/services/backend/dist/shared/types/core/index.js +8 -0
  40. package/services/backend/dist/shared/types/dataTypes/index.js +6 -0
  41. package/services/backend/dist/shared/types/index.js +8 -0
  42. package/services/backend/dist/shared/types/plugins/index.js +8 -0
  43. package/services/backend/dist/types/index.js +12 -0
  44. package/services/backend/dist/utils/index.js +2 -0
  45. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/routes/route.user.patchOwn.ts +1 -1
  46. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/user.service.ts +22 -1
  47. package/services/backend/yarn.lock +1 -1
  48. package/services/frontend/.yarn/install-state.gz +0 -0
  49. package/services/frontend/package.json +2 -2
  50. package/services/frontend/src/core/lib/data/dataApi.ts +1 -2
  51. package/services/frontend/src/orchestrator/ProductOrchestrator.vue +8 -1
  52. package/services/frontend/src/orchestrator/assets/styles/layers.css +1 -4
  53. package/services/frontend/src/orchestrator/assets/styles/tailwindStyles.css +3 -3
  54. package/services/frontend/src/orchestrator/assets/styles/vuetifyStyles.scss +4 -1
  55. package/services/frontend/src/orchestrator/components/dataExport/DataExporter.vue +303 -0
  56. package/services/frontend/src/orchestrator/components/dataTable/BaseDataTable.vue +473 -0
  57. package/services/frontend/src/orchestrator/components/dataTable/FileUpload.vue +83 -0
  58. package/services/frontend/src/orchestrator/components/dataTable/SelectionDialog.vue +169 -0
  59. package/services/frontend/src/orchestrator/components/dataTable/SummaryDialog.vue +211 -0
  60. package/services/frontend/src/orchestrator/components/index.ts +2 -0
  61. package/services/frontend/src/orchestrator/composables/index.ts +1 -0
  62. package/services/frontend/src/orchestrator/composables/useExport/formats/builtins.ts +124 -0
  63. package/services/frontend/src/orchestrator/composables/useExport/index.ts +176 -0
  64. package/services/frontend/src/orchestrator/composables/useExport/types.ts +141 -0
  65. package/services/frontend/src/orchestrator/i18n/de-DE.json +26 -1
  66. package/services/frontend/src/orchestrator/i18n/en-EU.json +26 -1
  67. package/services/frontend/src/orchestrator/i18n/sk.json +26 -1
  68. package/services/frontend/src/orchestrator/i18n/tl-TL.json +14 -0
  69. package/services/frontend/src/orchestrator/setup/vuetify.ts +0 -1
  70. package/services/frontend/yarn.lock +4854 -0
  71. package/types/index.ts +1 -1
  72. package/package/LICENSE.md +0 -699
  73. package/package/README.md +0 -49
  74. package/package/dev/README.md +0 -4
  75. package/package/index.js +0 -11
  76. package/package/raclette.default.config.yaml +0 -60
  77. package/package/services/backend/README.md +0 -172
  78. package/package/services/backend/yarn.lock +0 -5320
  79. package/package/services/frontend/README.md +0 -511
  80. package/package/services/frontend/src/core/lib/eggs/readme.md +0 -75
  81. package/package/services/frontend/yarn.lock +0 -0
  82. package/package/src/README.md +0 -404
  83. package/package/templates/README.md +0 -0
@@ -0,0 +1,48 @@
1
+ import registerRoutes from "./routes";
2
+ import { createModels } from "./interactionLink.model";
3
+ import { createInteractionLinkService } from "./interactionLink.service";
4
+ import { registerCrud } from "./helpers/crud";
5
+ import { registerPayload } from "./helpers/payload";
6
+ import { registerSchemas } from "./interactionLink.schema";
7
+ const registerInteractionLink = async (fastify) => {
8
+ /*
9
+ * ---------------------------------------------------------------------
10
+ * CREATE AND REGISTER ALL YOUR MODELS
11
+ * ---------------------------------------------------------------------
12
+ */
13
+ const interactionLinkModel = createModels(fastify);
14
+ // create and pass in the model to your service
15
+ const interactionLinkService = createInteractionLinkService(interactionLinkModel);
16
+ // decorate the service to the instance, so we can easily call it everywhere
17
+ fastify.custom.interactionLinkService = interactionLinkService;
18
+ /*
19
+ * ---------------------------------------------------------------------
20
+ * REGISTER ALL YOUR ROUTES
21
+ * ---------------------------------------------------------------------
22
+ */
23
+ try {
24
+ await fastify.register((instance) => registerRoutes(instance));
25
+ }
26
+ catch (error) {
27
+ fastify.log.error(`Failed to register routes.`, error);
28
+ throw error; // Let the application handle the error
29
+ }
30
+ registerPayload(fastify);
31
+ registerCrud(fastify);
32
+ registerSchemas(fastify);
33
+ return {
34
+ interactionLink: {
35
+ operations: {
36
+ readAll: interactionLinkService._readAllInteractionLinks.bind(interactionLinkService),
37
+ read: interactionLinkService._readInteractionLink.bind(interactionLinkService),
38
+ create: interactionLinkService._createInteractionLink.bind(interactionLinkService),
39
+ delete: interactionLinkService._removeInteractionLink.bind(interactionLinkService),
40
+ },
41
+ keywords: ["interaction", "link", "connection", "relation"],
42
+ metadata: {
43
+ description: "Links between interactive elements",
44
+ },
45
+ },
46
+ };
47
+ };
48
+ export default registerInteractionLink;
@@ -0,0 +1,19 @@
1
+ import get from "./route.interactionLink.get";
2
+ import getAll from "./route.interactionLink.getAll";
3
+ import hardDelete from "./route.interactionLink.hardDelete";
4
+ import patch from "./route.interactionLink.patch";
5
+ import post from "./route.interactionLink.post";
6
+ import postBulk from "./route.interactionLink.post.bulk";
7
+ import remove from "./route.interactionLink.remove";
8
+ import restore from "./route.interactionLink.restore";
9
+ const registerRoutes = async (fastify) => {
10
+ await fastify.get("/interactionLink/all", getAll(fastify));
11
+ await fastify.get("/interactionLink/:_id", get(fastify));
12
+ await fastify.patch("/interactionLink/:_id", patch(fastify));
13
+ await fastify.patch("/interactionLink/:_id/restore", restore(fastify));
14
+ await fastify.post("/interactionLink", post(fastify));
15
+ await fastify.post("/interactionLink/bulk", postBulk(fastify));
16
+ await fastify.delete("/interactionLink/:_id", remove(fastify));
17
+ await fastify.delete("/interactionLink/:_id/hard", hardDelete(fastify));
18
+ };
19
+ export default registerRoutes;
@@ -0,0 +1,31 @@
1
+ const registerEvents = (fastify) => {
2
+ /**
3
+ * Project created
4
+ */
5
+ const created = async (payload) => {
6
+ fastify.eventbus.emit("broadcastDataUpdated", payload);
7
+ fastify.eventbus.emit("broadcastProjectCreated", payload);
8
+ fastify.log.info(`[eventbus] project broadcast created ${payload.body.item._id}`);
9
+ };
10
+ /**
11
+ * Project updated
12
+ */
13
+ const updated = async (payload) => {
14
+ fastify.eventbus.emit("broadcastDataUpdated", payload);
15
+ fastify.log.info(`[eventbus] project broadcast updated ${payload.body.item._id}`);
16
+ };
17
+ /**
18
+ * Project deleted
19
+ */
20
+ const deleted = async (payload) => {
21
+ fastify.eventbus.emit("broadcastProjectDeleted", payload);
22
+ fastify.log.info(`[eventbus] project broadcast deleted ${payload.body.item._id}`);
23
+ };
24
+ /**
25
+ * Register event handlers
26
+ */
27
+ fastify.eventbus.on("coreProjectCreated", created);
28
+ fastify.eventbus.on("coreProjectUpdated", updated);
29
+ fastify.eventbus.on("coreProjectDeleted", deleted);
30
+ };
31
+ export default registerEvents;
@@ -0,0 +1,49 @@
1
+ import registerRoutes from "./routes";
2
+ import { createModels } from "./project.model";
3
+ import { createProjectService } from "./project.service";
4
+ import { registerPayload } from "./helpers/payload";
5
+ import { registerCrud } from "./helpers/crud";
6
+ import { registerSchemas } from "./project.schema";
7
+ const registerProject = async (fastify) => {
8
+ /*
9
+ * ---------------------------------------------------------------------
10
+ * CREATE AND REGISTER ALL YOUR MODELS
11
+ * ---------------------------------------------------------------------
12
+ */
13
+ const projectModel = createModels(fastify);
14
+ // create and pass in the model to your service
15
+ const projectService = createProjectService(projectModel);
16
+ // decorate the service to the instance, so we can easily call it everywhere
17
+ fastify.custom.projectService = projectService;
18
+ /*
19
+ * ---------------------------------------------------------------------
20
+ * REGISTER ALL YOUR ROUTES
21
+ * ---------------------------------------------------------------------
22
+ */
23
+ try {
24
+ await fastify.register((instance) => registerRoutes(instance));
25
+ }
26
+ catch (error) {
27
+ fastify.log.error(`Failed to register routes.`, error);
28
+ throw error; // Let the application handle the error
29
+ }
30
+ registerPayload(fastify);
31
+ registerCrud(fastify);
32
+ registerSchemas(fastify);
33
+ return {
34
+ project: {
35
+ operations: {
36
+ read: projectService._readProject.bind(projectService),
37
+ readMain: projectService._readMainProject.bind(projectService),
38
+ readAll: projectService._readProjects.bind(projectService),
39
+ create: projectService._createProject.bind(projectService),
40
+ update: projectService._updateProject.bind(projectService),
41
+ },
42
+ keywords: ["project", "space"],
43
+ metadata: {
44
+ description: "The space the user is using the app in.",
45
+ },
46
+ },
47
+ };
48
+ };
49
+ export default registerProject;
@@ -0,0 +1,16 @@
1
+ import get from "./route.project.get";
2
+ import getAll from "./route.project.getAll";
3
+ import patch from "./route.project.patch";
4
+ import post from "./route.project.post";
5
+ //import hardDelete from "./route.project.hardDelete"
6
+ //import remove from "./route.project.remove"
7
+ const registerRoutes = async (fastify) => {
8
+ await fastify.get("/project/all", getAll(fastify));
9
+ await fastify.get("/project/:_id", get(fastify));
10
+ await fastify.post("/project", post(fastify));
11
+ await fastify.patch("/project/:_id", patch(fastify));
12
+ // TODO reenable once we have deletion concept and space datatype implemented
13
+ //await fastify.delete("/project/:_id", remove(fastify))
14
+ //await fastify.delete("/project/:_id/hard", hardDelete(fastify))
15
+ };
16
+ export default registerRoutes;
@@ -0,0 +1,39 @@
1
+ export const registerEvents = (fastify) => {
2
+ /*
3
+ * tag created and created
4
+ */
5
+ const created = async (payload) => {
6
+ fastify.eventbus.emit("broadcastDataUpdated", payload);
7
+ fastify.eventbus.emit("broadcastTagCreated", payload);
8
+ fastify.log.info(`[eventbus] tag broadcast created ${payload.body.items}`);
9
+ };
10
+ /*
11
+ * tag updated and created
12
+ */
13
+ const updated = async (payload) => {
14
+ fastify.eventbus.emit("broadcastDataUpdated", payload);
15
+ fastify.log.info(`[eventbus] tag broadcast updated ${payload.body.items}`);
16
+ };
17
+ /*
18
+ * makes sure child counts between tickets and tags gets updated
19
+ */
20
+ const tagArrayUpdated = async (payload) => {
21
+ fastify.eventbus.emit("broadcastDataUpdated", payload);
22
+ fastify.log.info(`[eventbus] tag broadcast created ${payload.body.items}`);
23
+ };
24
+ /*
25
+ * tag deleted
26
+ */
27
+ const deleted = async (payload) => {
28
+ fastify.eventbus.emit("broadcastTagDeleted", payload);
29
+ fastify.log.info(`[eventbus] tag broadcast deleted ${payload.body.items}`);
30
+ };
31
+ /**
32
+ * Register those functions for eventbus events
33
+ */
34
+ fastify.eventbus.on("coreTagCreated", created);
35
+ fastify.eventbus.on("coreTagUpdated", updated);
36
+ fastify.eventbus.on("coreTagDeleted", deleted);
37
+ fastify.eventbus.on("coreTagArrayUpdated", tagArrayUpdated);
38
+ };
39
+ export default registerEvents;
@@ -0,0 +1,50 @@
1
+ import registerRoutes from "./routes";
2
+ import { createModels } from "./tag.model";
3
+ import { createTagService } from "./tag.service";
4
+ import { registerPayload } from "./helpers/payload";
5
+ import { registerCrud } from "./helpers/crud";
6
+ import { registerSchemas } from "./tag.schema";
7
+ const registerTag = async (fastify) => {
8
+ /*
9
+ * ---------------------------------------------------------------------
10
+ * CREATE AND REGISTER ALL YOUR MODELS
11
+ * ---------------------------------------------------------------------
12
+ */
13
+ const tagModel = createModels(fastify);
14
+ // create and pass in the model to your service
15
+ const tagService = createTagService(tagModel);
16
+ // decorate the service to the instance, so we can easily call it everywhere
17
+ fastify.custom.tagService = tagService;
18
+ /*
19
+ * ---------------------------------------------------------------------
20
+ * REGISTER ALL YOUR ROUTES
21
+ * ---------------------------------------------------------------------
22
+ */
23
+ try {
24
+ await fastify.register((instance) => registerRoutes(instance));
25
+ }
26
+ catch (error) {
27
+ fastify.log.error(`Failed to register routes.`, error);
28
+ throw error; // Let the application handle the error
29
+ }
30
+ registerPayload(fastify);
31
+ registerCrud(fastify);
32
+ registerSchemas(fastify);
33
+ return {
34
+ tag: {
35
+ operations: {
36
+ readAll: tagService._readTags.bind(tagService),
37
+ read: tagService._readTag.bind(tagService),
38
+ readByTitle: tagService._readTagByTitle.bind(tagService),
39
+ create: tagService._createTag.bind(tagService),
40
+ update: tagService._updateTag.bind(tagService),
41
+ delete: tagService._removeTag.bind(tagService),
42
+ },
43
+ keywords: ["tag", "keyword", "buzzword", "label"],
44
+ metadata: {
45
+ description: "Allows labels for every possible data type",
46
+ },
47
+ },
48
+ };
49
+ };
50
+ export default registerTag;
@@ -0,0 +1,19 @@
1
+ import get from "./route.tag.get";
2
+ import getAll from "./route.tag.getAll";
3
+ import hardDelete from "./route.tag.hardDelete";
4
+ import patch from "./route.tag.patch";
5
+ import post from "./route.tag.post";
6
+ import postBulk from "./route.tag.post.bulk";
7
+ import remove from "./route.tag.remove";
8
+ import restore from "./route.tag.restore";
9
+ const registerRoutes = async (fastify) => {
10
+ await fastify.get("/tag/all", getAll(fastify));
11
+ await fastify.get("/tag/:_id", get(fastify));
12
+ await fastify.patch("/tag/:_id", patch(fastify));
13
+ await fastify.patch("/tag/:_id/restore", restore(fastify));
14
+ await fastify.post("/tag/:project/:_id", post(fastify));
15
+ await fastify.post("/tag/bulk", postBulk(fastify));
16
+ await fastify.delete("/tag/:_id", remove(fastify));
17
+ await fastify.delete("/tag/:_id/hard", hardDelete(fastify));
18
+ };
19
+ export default registerRoutes;
@@ -0,0 +1,31 @@
1
+ export const registerEvents = (fastify) => {
2
+ /*
3
+ * user created
4
+ */
5
+ const created = async (payload) => {
6
+ fastify.eventbus.emit("broadcastDataUpdated", payload);
7
+ fastify.eventbus.emit("broadcastUserCreated", payload);
8
+ fastify.log.info(`[eventbus] user broadcast created ${payload.body.items}`);
9
+ };
10
+ /*
11
+ * user updated
12
+ */
13
+ const updated = async (payload) => {
14
+ fastify.eventbus.emit("broadcastDataUpdated", payload);
15
+ fastify.log.info(`[eventbus] user broadcast updated ${payload.body.items}`);
16
+ };
17
+ /*
18
+ * user deleted
19
+ */
20
+ const deleted = async (payload) => {
21
+ fastify.eventbus.emit("broadcastUserDeleted", payload);
22
+ fastify.log.info(`[eventbus] user broadcast deleted ${payload.body.items}`);
23
+ };
24
+ /**
25
+ * Register those functions for eventbus events
26
+ */
27
+ fastify.eventbus.on("coreUserCreated", created);
28
+ fastify.eventbus.on("coreUserUpdated", updated);
29
+ fastify.eventbus.on("coreUserDeleted", deleted);
30
+ };
31
+ export default registerEvents;
@@ -0,0 +1,51 @@
1
+ import registerRoutes from "./routes";
2
+ import { createUserService } from "./user.service";
3
+ import { registerPayload } from "./helpers/payload";
4
+ import { registerCrud } from "./helpers/crud";
5
+ import { createModels } from "./user.model";
6
+ import { registerSchemas } from "./user.schema";
7
+ const registerUser = async (fastify) => {
8
+ /*
9
+ * ---------------------------------------------------------------------
10
+ * CREATE AND REGISTER ALL YOUR MODELS
11
+ * ---------------------------------------------------------------------
12
+ */
13
+ const userModel = createModels(fastify);
14
+ // create and pass in the model to your service
15
+ const userService = createUserService(userModel);
16
+ // decorate the service to the instance, so we can easily call it everywhere
17
+ fastify.custom.userService = userService;
18
+ // because the user has more than the standard routes, we need to decorate the model to the instance
19
+ fastify.custom.userModel = userModel;
20
+ /*
21
+ * ---------------------------------------------------------------------
22
+ * REGISTER ALL YOUR ROUTES
23
+ * ---------------------------------------------------------------------
24
+ */
25
+ try {
26
+ await fastify.register((instance) => registerRoutes(instance));
27
+ }
28
+ catch (error) {
29
+ fastify.log.error(`Failed to register routes.`, error);
30
+ throw error; // Let the application handle the error
31
+ }
32
+ registerPayload(fastify);
33
+ registerCrud(fastify);
34
+ registerSchemas(fastify);
35
+ return {
36
+ user: {
37
+ operations: {
38
+ read: userService._readUser.bind(userService),
39
+ readByMail: userService._readUserByEmail.bind(userService),
40
+ readAll: userService._readUsers.bind(userService),
41
+ readCount: userService._readCount.bind(userService),
42
+ create: userService._createUser.bind(userService),
43
+ },
44
+ keywords: ["user", "auth", "identity", "account"],
45
+ metadata: {
46
+ description: "User management and authentication",
47
+ },
48
+ },
49
+ };
50
+ };
51
+ export default registerUser;
@@ -0,0 +1,21 @@
1
+ import get from "./route.user.get";
2
+ import getAll from "./route.user.getAll";
3
+ import patch from "./route.user.patch";
4
+ import patchOwn from "./route.user.patchOwn";
5
+ import patchLastProject from "./route.user.patchLastProject";
6
+ import post from "./route.user.post";
7
+ import remove from "./route.user.remove";
8
+ import hardDelete from "./route.user.hardDelete";
9
+ import restore from "./route.user.restore";
10
+ const registerRoutes = async (fastify) => {
11
+ await fastify.get("/user/all", getAll(fastify));
12
+ await fastify.get("/user/:_id", get(fastify));
13
+ await fastify.patch("/user/:_id", patch(fastify));
14
+ await fastify.patch("/user/self", patchOwn(fastify));
15
+ await fastify.patch("/user/:_id/restore", restore(fastify));
16
+ await fastify.post("/user", post(fastify));
17
+ await fastify.delete("/user/:_id", remove(fastify));
18
+ await fastify.delete("/user/:_id/hard", hardDelete(fastify));
19
+ await fastify.patch("/user/last-project/:projectId", patchLastProject(fastify));
20
+ };
21
+ export default registerRoutes;
@@ -0,0 +1,31 @@
1
+ const registerEvents = (fastify) => {
2
+ /**
3
+ * WorkSession created
4
+ */
5
+ const created = async (payload) => {
6
+ fastify.eventbus.emit("broadcastDataUpdated", payload);
7
+ fastify.eventbus.emit("broadcastWorkSessionCreated", payload);
8
+ fastify.log.info(`[eventbus] workSession broadcast created ${payload.body.item._id}`);
9
+ };
10
+ /**
11
+ * WorkSession updated
12
+ */
13
+ const updated = async (payload) => {
14
+ fastify.eventbus.emit("broadcastDataUpdated", payload);
15
+ fastify.log.info(`[eventbus] workSession broadcast updated ${payload.body.item._id}`);
16
+ };
17
+ /**
18
+ * WorkSession deleted
19
+ */
20
+ const deleted = async (payload) => {
21
+ fastify.eventbus.emit("broadcastWorkSessionDeleted", payload);
22
+ fastify.log.info(`[eventbus] workSession broadcast deleted ${payload.body.item._id}`);
23
+ };
24
+ /**
25
+ * Register event handlers
26
+ */
27
+ fastify.eventbus.on("coreWorkSessionCreated", created);
28
+ fastify.eventbus.on("coreWorkSessionUpdated", updated);
29
+ fastify.eventbus.on("coreWorkSessionDeleted", deleted);
30
+ };
31
+ export default registerEvents;
@@ -0,0 +1,48 @@
1
+ import registerRoutes from "./routes";
2
+ import { createModels } from "./workSession.model";
3
+ import { createWorkSessionService } from "./workSession.service";
4
+ import { registerPayload } from "./helpers/payload";
5
+ import { registerCrud } from "./helpers/crud";
6
+ import { registerSchemas } from "./workSession.schema";
7
+ const registerWorkSession = async (fastify) => {
8
+ /*
9
+ * ---------------------------------------------------------------------
10
+ * CREATE AND REGISTER ALL YOUR MODELS
11
+ * ---------------------------------------------------------------------
12
+ */
13
+ const workSessionModel = createModels(fastify);
14
+ // create and pass in the model to your service
15
+ const workSessionService = createWorkSessionService(workSessionModel);
16
+ // decorate the service to the instance, so we can easily call it everywhere
17
+ fastify.custom.workSessionService = workSessionService;
18
+ /*
19
+ * ---------------------------------------------------------------------
20
+ * REGISTER ALL YOUR ROUTES
21
+ * ---------------------------------------------------------------------
22
+ */
23
+ try {
24
+ await fastify.register((instance) => registerRoutes(instance));
25
+ }
26
+ catch (error) {
27
+ fastify.log.error(`Failed to register routes.`, error);
28
+ throw error; // Let the application handle the error
29
+ }
30
+ registerPayload(fastify);
31
+ registerCrud(fastify);
32
+ registerSchemas(fastify);
33
+ return {
34
+ workSession: {
35
+ operations: {
36
+ read: workSessionService._readWorkSession.bind(workSessionService),
37
+ readAll: workSessionService._readWorkSessions.bind(workSessionService),
38
+ create: workSessionService._createWorkSession.bind(workSessionService),
39
+ update: workSessionService._updateWorkSession.bind(workSessionService),
40
+ },
41
+ keywords: ["workSession", "session"],
42
+ metadata: {
43
+ description: "A work session for user interactions.",
44
+ },
45
+ },
46
+ };
47
+ };
48
+ export default registerWorkSession;
@@ -0,0 +1,15 @@
1
+ import get from "./route.workSession.get";
2
+ import getAll from "./route.workSession.getAll";
3
+ import patch from "./route.workSession.patch";
4
+ import post from "./route.workSession.post";
5
+ import hardDelete from "./route.workSession.hardDelete";
6
+ import remove from "./route.workSession.remove";
7
+ const registerRoutes = async (fastify) => {
8
+ await fastify.get("/workSession/all", getAll(fastify));
9
+ await fastify.get("/workSession/:_id", get(fastify));
10
+ await fastify.post("/workSession", post(fastify));
11
+ await fastify.patch("/workSession/:_id", patch(fastify));
12
+ await fastify.delete("/workSession/:_id", remove(fastify));
13
+ await fastify.delete("/workSession/:_id/hard", hardDelete(fastify));
14
+ };
15
+ export default registerRoutes;
@@ -0,0 +1,34 @@
1
+ import registerAccount from "./datatypes/account";
2
+ import registerComposition from "./datatypes/composition";
3
+ import registerInteractionLink from "./datatypes/interactionLink";
4
+ import registerTag from "./datatypes/tag";
5
+ import registerUser from "./datatypes/user";
6
+ import registerProject from "./datatypes/project";
7
+ import registerWorkSession from "./datatypes/workSession";
8
+ const racletteCorePlugin = async (fastify, opts) => {
9
+ fastify.log.info("raclette Core Plugin");
10
+ // Register all datatypes in parallel and collect their contracts
11
+ const contractRegistrations = await Promise.all([
12
+ registerAccount(fastify),
13
+ registerComposition(fastify),
14
+ registerInteractionLink(fastify),
15
+ registerProject(fastify),
16
+ registerTag(fastify),
17
+ registerUser(fastify),
18
+ registerWorkSession(fastify),
19
+ ]);
20
+ // Combine all contract snippets into one plugin contract
21
+ const pluginContract = contractRegistrations.reduce((acc, contract) => {
22
+ if (contract && typeof contract === "object") {
23
+ return {
24
+ ...acc,
25
+ ...contract,
26
+ };
27
+ }
28
+ return acc;
29
+ }, {});
30
+ // Register the complete contract
31
+ fastify.registerPluginContract(pluginContract);
32
+ fastify.registerForFrontendGeneration({});
33
+ };
34
+ export default racletteCorePlugin;
@@ -0,0 +1,11 @@
1
+ import registerSystem from "./system";
2
+ /*
3
+ * Core service export all routes
4
+ */
5
+ const registerCore = async (fastify) => {
6
+ if (!fastify.core) {
7
+ fastify.core = {};
8
+ }
9
+ registerSystem(fastify);
10
+ };
11
+ export default registerCore;
@@ -0,0 +1,11 @@
1
+ import mongoose from "mongoose";
2
+ import registerRoutes from "./routes";
3
+ import { createCollectionService } from "./collections.service";
4
+ const registerSystem = (fastify) => {
5
+ registerRoutes(fastify);
6
+ // create and pass in the model to your service
7
+ const collectionService = createCollectionService(mongoose.connection);
8
+ // decorate the service to the instance, so we can easily call it everywhere
9
+ fastify.core.collectionService = collectionService;
10
+ };
11
+ export default registerSystem;
@@ -0,0 +1,17 @@
1
+ import { getBlockedLogins, resetLoginBlock, resetAllLoginBlocks, } from "./route.admin.cache";
2
+ import deploy from "./route.deploy";
3
+ import login from "./route.user.login";
4
+ import checkToken from "./route.user.checkToken";
5
+ import getAllCollections from "./route.collection.getAll";
6
+ import deleteCollections from "./route.collection.remove";
7
+ const registerRoutes = async (fastify) => {
8
+ await fastify.get("/system/deploy", deploy(fastify));
9
+ await fastify.post("/user/login", login(fastify));
10
+ await fastify.get("/user/check-token", checkToken(fastify));
11
+ await fastify.get("/admin/cache/blocks", getBlockedLogins(fastify));
12
+ await fastify.delete("/admin/cache/blocks/:key", resetLoginBlock(fastify));
13
+ await fastify.delete("/admin/cache/blocks", resetAllLoginBlocks(fastify));
14
+ await fastify.get("/admin/collections/all", getAllCollections(fastify));
15
+ await fastify.delete("/admin/collections", deleteCollections(fastify));
16
+ };
17
+ export default registerRoutes;
@@ -0,0 +1,14 @@
1
+ import { customAlphabet } from "nanoid";
2
+ export * from "./cors";
3
+ const customCyperAlphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
4
+ /**
5
+ * Random ID generator
6
+ *
7
+ * @param length - Required length for the output
8
+ * @returns Function that generates random IDs
9
+ * @example
10
+ * const generateId = randomIdGenerator(12);
11
+ * const id = generateId(); // => 'gdh6326GDJh0'
12
+ */
13
+ const randomIdGenerator = (length = 16) => customAlphabet(customCyperAlphabet, length);
14
+ export { randomIdGenerator };
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./utils";
3
+ export * from "./core/contracting/contractRegistrar";