@raclettejs/core 0.1.1 → 0.1.3

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 (39) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE.md +661 -1
  3. package/dist/cli.js +5 -5
  4. package/package.json +1 -1
  5. package/services/backend/src/core/crud/crudTypes.ts +5 -5
  6. package/services/backend/src/core/payload/payloadRegistrar.ts +15 -15
  7. package/services/backend/src/core/payload/payloadTypes.ts +4 -4
  8. package/services/backend/src/core/pluginSystem/pluginFastifyInstance.ts +8 -5
  9. package/services/backend/src/core/pluginSystem/pluginTypes.ts +4 -4
  10. package/services/backend/src/core/sockets/createSystemEventHandlers.ts +18 -16
  11. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/account/account.service.ts +16 -16
  12. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/account/events/index.ts +4 -4
  13. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/account/helpers/payload.ts +2 -2
  14. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/composition/composition.service.ts +14 -14
  15. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/composition/events/index.ts +3 -3
  16. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/composition/helpers/payload.ts +2 -2
  17. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/interactionLink/events/index.ts +3 -3
  18. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/interactionLink/helpers/payload.ts +2 -2
  19. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/interactionLink/interactionLink.service.ts +18 -18
  20. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/project/events/index.ts +4 -4
  21. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/project/helpers/payload.ts +2 -2
  22. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/project/project.service.ts +14 -14
  23. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/tag/events/index.ts +5 -5
  24. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/tag/helpers/payload.ts +2 -2
  25. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/tag/tag.service.ts +14 -14
  26. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/events/index.ts +4 -4
  27. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/helpers/payload.ts +2 -2
  28. package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/user.service.ts +14 -14
  29. package/services/backend/src/modules/cache/cacheManager.ts +4 -4
  30. package/services/backend/src/types/custom-fastify.d.ts +2 -2
  31. package/services/backend/src/utils/request.utils.ts +2 -2
  32. package/services/frontend/src/core/lib/data/dataApi.ts +6 -5
  33. package/services/frontend/src/core/lib/data/fetchDataHandler.ts +51 -21
  34. package/services/frontend/src/core/lib/data/queryApi.ts +20 -27
  35. package/services/frontend/src/core/setup/plugin-system/api/plugin-data.ts +17 -13
  36. package/services/frontend/src/core/types/DataApi.ts +13 -1
  37. package/services/frontend/src/orchestrator/composables/useVueQueryObservableHelper.ts +21 -11
  38. package/services/frontend/src/orchestrator/composables/useVueWriteOperationHelper.ts +27 -18
  39. package/services/frontend/src/orchestrator/types/PluginApi.ts +7 -3
package/dist/cli.js CHANGED
@@ -657,7 +657,7 @@ Log process ended with code ${a??0}`))}),s.on("error",a=>{console.error(f.red(`\
657
657
  Workbench log process ended with code ${i??0}`))}),o.on("error",i=>{console.error(f.red(`\u274C Error with workbench log process: ${i.message}`)),console.log(f.yellow("\u{1F4A1} Make sure the workbench package has the 'log' script in its package.json"))}),process.on("SIGINT",()=>{console.log(f.yellow(`
658
658
  \u{1F6D1} Stopping workbench log following...`)),o.kill("SIGTERM"),process.exit(0)}),t.follow?await new Promise(()=>{}):await new Promise(i=>{o.on("close",()=>i())})}catch(n){throw console.error(f.red(`\u274C Error calling workbench logs: ${n.message}`)),n}}import{spawn as zk}from"child_process";import V from"fs-extra";import H from"path";import{execSync as Mk}from"child_process";import B from"fs-extra";import U from"path";var Bs=async(e,t,r)=>{console.log(f.blue("\u{1F4E6} Creating production artifacts...")),await Vk(t,e,r);let n=U.join(t,"docker-compose.yml");return await Gk(e,t,n,r),await Uk(e,t,r),await Wk(t,r,e),console.log(f.green("\u2705 Production artifacts created")),n},Xd=async(e,t,r,n)=>{let{makeExecutable:o=!1,required:i=!1,logPrefix:s=""}=n||{};for(let a of e){let c=U.join(t,a),l=U.basename(a),u=U.join(r,l);if(await B.ensureDir(U.dirname(u)),await B.pathExists(c))await B.copy(c,u),o&&await B.chmod(u,493),console.log(f.gray(`${s} \u2705 Copied ${a}`));else{let p=`${a} not found in ${t}`;if(i)throw new Error(`Required file ${p}`);console.log(f.gray(`${s} \u26A0\uFE0F Skipped ${a} (not found)`))}}},Bk=async(e,t,r)=>Xd(e,process.cwd(),t,{...r,logPrefix:r?.logPrefix||" "}),Hk=async(e,t,r,n)=>Xd(e,t,r,{...n,logPrefix:n?.logPrefix||" "}),Vk=async(e,t,r)=>{let n=t.services.frontend?.port||8081,o=t.services.workbench?.frontendPort||8083,i=`
659
659
  FROM nginx:alpine
660
- COPY services/frontend /usr/share/nginx/html
660
+ COPY service/frontend /usr/share/nginx/html
661
661
  COPY nginx.conf /etc/nginx/conf.d/default.conf
662
662
  COPY entrypoint.sh entrypoint.sh
663
663
 
@@ -681,14 +681,14 @@ WORKDIR /app
681
681
  RUN apk add --no-cache tini curl ${(t.services.backend?.installPackages||[]).join(" ")}
682
682
 
683
683
  # Copy package files first for better caching
684
- COPY services/backend/package*.json ./
685
- COPY services/backend/yarn.lock* ./
684
+ COPY service/backend/package*.json ./
685
+ COPY service/backend/yarn.lock* ./
686
686
 
687
687
  # Install only production dependencies
688
688
  RUN yarn install --production --frozen-lockfile --silent
689
689
 
690
690
  # Copy the built application (includes dist/ folder)
691
- COPY services/backend/ ./
691
+ COPY service/backend/ ./
692
692
 
693
693
  # Create non-root user for security
694
694
  RUN addgroup -g 1001 -S nodejs && \\
@@ -1107,7 +1107,7 @@ ${n?`- Workbench: http://localhost:${i}`:""}
1107
1107
  - Ports ${o}${n?`, ${i}`:""} available
1108
1108
 
1109
1109
  Generated on: ${new Date().toISOString()}
1110
- `;await B.writeFile(U.join(e,"README.md"),s)},Jd=async(e,t,r,n,o)=>{console.log(f.blue("\u{1F4E6} Packaging images for distribution..."));let i=U.join(t,"..","package"),s=`${e.name}-deployment-${n}`,a=U.join(i,`${s}.tar.gz`);await B.ensureDir(i),await B.emptyDir(i);let c=U.join(i,s);await B.ensureDir(c);try{console.log(f.gray(" \u{1F4BE} Exporting Docker images..."));let l=U.join(c,"images");await B.ensureDir(l);for(let p of r){let d=`${p.replace(/[:/]/g,"_")}.tar`,g=U.join(l,d);console.log(f.gray(` \u{1F4E6} Exporting ${p}...`)),ce(["save","-o",g,p],{stdio:"pipe"});let m=await B.stat(g);if(m.size===0)throw new Error(`Failed to export image ${p}`);console.log(f.gray(` \u2705 Exported ${p} (${(m.size/1024/1024).toFixed(1)}MB)`))}console.log(f.gray(" \u{1F4C4} Copying deployment files..."));let u=["docker-compose.yml",".env.example","deploy.sh","nginx.conf"];return o&&u.push("nginx.workbench.conf"),await Hk(u,t,c,{required:!1,logPrefix:" "}),await qk(c,r,o,e),await Yk(c,r),await Kk(c,e,r,o),console.log(f.gray(" \u{1F5DC}\uFE0F Creating deployment package...")),await Xk(c,a),await B.remove(c),console.log(f.green(` \u2705 Deployment package created: ${s}.tar.gz`)),{packagePath:a,imageNames:r}}catch(l){throw await B.remove(c).catch(()=>{}),l}},Xk=async(e,t)=>{let r=U.dirname(e),n=U.basename(e);Mk(`tar -czf "${t}" -C "${r}" "${n}"`,{stdio:"pipe"});let o=await B.stat(t);console.log(f.gray(` \u{1F4E6} Package size: ${(o.size/1024/1024).toFixed(1)}MB`))};var Zd=async(e,t,r={})=>{let n=Date.now(),o=Qk(r);console.log(f.blue(`\u{1F9C0} Starting Raclette ${o} build...`)),Vr();let i=H.join(process.cwd(),".raclette"),s=H.resolve(r.outputDir||H.join(i,".build"));await V.ensureDir(s),await V.emptyDir(s);try{await ix(e,t,i),await sx(e,t,i);let a={mode:o,buildDir:s,artifacts:{}};switch(o){case"artifacts":a=await Jk(e,i,s,r);break;case"images":a=await ef(e,i,s,r);break;case"package":a=await Zk(e,i,s,r);break}let c=(Date.now()-n)/1e3;return h.success(` ${o} build completed in ${c}s`),ox(a,e),a}catch(a){throw h.error(`${o} build failed: ${a.message}`),a}},Qk=e=>e.mode?e.mode:e.packageImages?"package":e.buildImages?"images":(e.buildOnly,"artifacts"),Jk=async(e,t,r,n)=>{if(n.buildOnly){console.log(f.blue("\u{1F4C1} Building application files only...")),await Vs(e,t,r,n);let i=await Gs(e,r,n);return console.log(f.green("\u2705 Build files ready")),{mode:"artifacts",buildDir:r,artifacts:{}}}else{console.log(f.blue("\u{1F4C1} Building local deployment artifacts..."));let i=H.join(r,"app");await Vs(e,t,i,n);let s=await Gs(e,r,n),a=await Bs(e,r,s),c=await nx(e,r,s);return console.log(f.green("\u2705 Local deployment artifacts ready")),{mode:"artifacts",buildDir:r,artifacts:{composeFile:a,deployScript:H.join(r,"deploy.sh"),readmeFile:c,envExampleFile:H.join(r,".env.example")}}}},ef=async(e,t,r,n)=>{console.log(f.blue("\u{1F433} Building Docker images for CI/CD..."));let o=H.join(r,"app");await Vs(e,t,o,n);let i=await Gs(e,r,n);await Bs(e,r,i);let s=await ex(e,r,i,n);return console.log(f.green("\u2705 Docker images ready for registry push")),{mode:"images",buildDir:r,images:s,artifacts:{}}},Zk=async(e,t,r,n)=>{console.log(f.blue("\u{1F4E6} Building offline deployment package..."));let o=await ef(e,t,r,n),i=tf(),s=await Jd(e,r,o.images.names,i,o.images.names.some(a=>a.includes("workbench")));return console.log(f.green("\u2705 Offline deployment package ready")),{...o,mode:"package",deploymentPackage:s.packagePath}},ex=async(e,t,r,n)=>{let o=n.imagePrefix||e.name,i=n.imageTag||tf(),s=n.platforms||"linux/amd64,linux/arm64",a=n.buildx||!1,c=[],l=[i];if(n.generateLatest&&!l.includes("latest")&&l.push("latest"),a)try{await tx(),console.log(f.blue(`\u{1F3D7}\uFE0F Building multi-architecture images for: ${s}`))}catch(u){console.warn(f.yellow("\u26A0\uFE0F Buildx not available, falling back to single-architecture builds")),console.warn(f.yellow(` ${u.message}`)),a=!1}if(a){let u=["frontend","backend"];r&&u.push("workbench-frontend","workbench-backend");for(let p of u){let d=`${o}/${p}`,g=H.join(t,`Dockerfile.${p}`);if(!await V.pathExists(g))throw new Error(`Dockerfile not found: ${g}`);let m=l.map(y=>`${d}:${y}`);c.push(...m),await rx({context:t,dockerfile:g,tags:m,platforms:s,push:!1,noCache:n.noCache,verbose:n.verbose}),console.log(f.gray(` \u2705 Built ${p} for ${s}`)),m.forEach(y=>{console.log(f.gray(` ${y}`))})}}else{console.log(f.gray(" \u{1F528} Building single-architecture images..."));let p=["-f",H.join(t,"docker-compose.yml"),"build"];n.noCache&&p.push("--no-cache"),ye(p,{stdio:n.verbose?"inherit":"pipe",cwd:t});let d=["frontend","backend"];r&&d.push("workbench-frontend","workbench-backend");for(let g of d){let m=`${H.basename(t)}-${g}`.replace(/\./,""),y=`${o}/${g}`;l.forEach(k=>{let R=`${y}:${k}`;ce(["tag",m,R],{stdio:"pipe"}),c.push(R)}),console.log(f.gray(` \u2705 Tagged ${g}`))}}return console.log(f.green(" \u2705 Docker images built and tagged")),{names:c,tags:l}},tx=async()=>{try{ce(["buildx","version"],{stdio:"pipe"}),console.log(f.gray(" \u{1F4E6} Setting up QEMU for cross-platform emulation...")),ce(["run","--rm","--privileged","multiarch/qemu-user-static","--reset","-p","yes"],{stdio:"pipe"}),console.log(f.gray(" \u{1F4E6} Creating buildx builder...")),ce(["buildx","create","--name","multiarch","--use"],{stdio:"pipe"}),ce(["buildx","inspect","--bootstrap"],{stdio:"pipe"}),console.log(f.gray(" \u2705 Buildx builder ready with QEMU emulation"))}catch(e){throw console.warn(f.yellow(" \u26A0\uFE0F Buildx setup failed, falling back to single-architecture builds")),console.warn(f.yellow(` ${e.message}`)),new Error("Buildx not available - use single-architecture builds instead")}},rx=async e=>{let t=["buildx","build","--platform",e.platforms,"--file",e.dockerfile];e.tags.forEach(n=>{t.push("--tag",n)});let r=e.platforms.split(",").length;e.push?t.push("--push"):r===1?t.push("--load"):(console.log(f.yellow(" \u26A0\uFE0F Multi-platform images cannot be loaded locally")),console.log(f.yellow(" \u2139\uFE0F Images built but not loaded to local Docker"))),e.noCache&&t.push("--no-cache"),t.push(e.context);try{ce(t,{stdio:e.verbose?"inherit":"pipe",cwd:e.context})}catch(n){throw new Error(`Failed to build multi-architecture image: ${n}`)}},nx=async(e,t,r)=>{let n=H.join(t,"README.md"),o=e.services.frontend?.port||8081,i=e.services.workbench?.frontendPort||8083,s=`# ${e.name} - Local Deployment
1110
+ `;await B.writeFile(U.join(e,"README.md"),s)},Jd=async(e,t,r,n,o)=>{console.log(f.blue("\u{1F4E6} Packaging images for distribution..."));let i=U.join(t,"..","package"),s=`${e.name}-deployment-${n}`,a=U.join(i,`${s}.tar.gz`);await B.ensureDir(i),await B.emptyDir(i);let c=U.join(i,s);await B.ensureDir(c);try{console.log(f.gray(" \u{1F4BE} Exporting Docker images..."));let l=U.join(c,"images");await B.ensureDir(l);for(let p of r){let d=`${p.replace(/[:/]/g,"_")}.tar`,g=U.join(l,d);console.log(f.gray(` \u{1F4E6} Exporting ${p}...`)),ce(["save","-o",g,p],{stdio:"pipe"});let m=await B.stat(g);if(m.size===0)throw new Error(`Failed to export image ${p}`);console.log(f.gray(` \u2705 Exported ${p} (${(m.size/1024/1024).toFixed(1)}MB)`))}console.log(f.gray(" \u{1F4C4} Copying deployment files..."));let u=["docker-compose.yml",".env.example","deploy.sh","nginx.conf"];return o&&u.push("nginx.workbench.conf"),await Hk(u,t,c,{required:!1,logPrefix:" "}),await qk(c,r,o,e),await Yk(c,r),await Kk(c,e,r,o),console.log(f.gray(" \u{1F5DC}\uFE0F Creating deployment package...")),await Xk(c,a),await B.remove(c),console.log(f.green(` \u2705 Deployment package created: ${s}.tar.gz`)),{packagePath:a,imageNames:r}}catch(l){throw await B.remove(c).catch(()=>{}),l}},Xk=async(e,t)=>{let r=U.dirname(e),n=U.basename(e);Mk(`tar -czf "${t}" -C "${r}" "${n}"`,{stdio:"pipe"});let o=await B.stat(t);console.log(f.gray(` \u{1F4E6} Package size: ${(o.size/1024/1024).toFixed(1)}MB`))};var Zd=async(e,t,r={})=>{let n=Date.now(),o=Qk(r);console.log(f.blue(`\u{1F9C0} Starting Raclette ${o} build...`)),Vr();let i=H.join(process.cwd(),".raclette"),s=H.resolve(r.outputDir||H.join(i,".build"));await V.ensureDir(s),await V.emptyDir(s);try{await ix(e,t,i),await sx(e,t,i);let a={mode:o,buildDir:s,artifacts:{}};switch(o){case"artifacts":a=await Jk(e,i,s,r);break;case"images":a=await ef(e,i,s,r);break;case"package":a=await Zk(e,i,s,r);break}let c=(Date.now()-n)/1e3;return h.success(` ${o} build completed in ${c}s`),ox(a,e),a}catch(a){throw h.error(`${o} build failed: ${a.message}`),a}},Qk=e=>e.mode?e.mode:e.packageImages?"package":e.buildImages?"images":(e.buildOnly,"artifacts"),Jk=async(e,t,r,n)=>{if(n.buildOnly){console.log(f.blue("\u{1F4C1} Building application files only...")),await Vs(e,t,r,n);let i=await Gs(e,r,n);return console.log(f.green("\u2705 Build files ready")),{mode:"artifacts",buildDir:r,artifacts:{}}}else{console.log(f.blue("\u{1F4C1} Building local deployment artifacts..."));let i=H.join(r,"service");await Vs(e,t,i,n);let s=await Gs(e,r,n),a=await Bs(e,r,s),c=await nx(e,r,s);return console.log(f.green("\u2705 Local deployment artifacts ready")),{mode:"artifacts",buildDir:r,artifacts:{composeFile:a,deployScript:H.join(r,"deploy.sh"),readmeFile:c,envExampleFile:H.join(r,".env.example")}}}},ef=async(e,t,r,n)=>{console.log(f.blue("\u{1F433} Building Docker images for CI/CD..."));let o=H.join(r,"service");await Vs(e,t,o,n);let i=await Gs(e,r,n);await Bs(e,r,i);let s=await ex(e,r,i,n);return console.log(f.green("\u2705 Docker images ready for registry push")),{mode:"images",buildDir:r,images:s,artifacts:{}}},Zk=async(e,t,r,n)=>{console.log(f.blue("\u{1F4E6} Building offline deployment package..."));let o=await ef(e,t,r,n),i=tf(),s=await Jd(e,r,o.images.names,i,o.images.names.some(a=>a.includes("workbench")));return console.log(f.green("\u2705 Offline deployment package ready")),{...o,mode:"package",deploymentPackage:s.packagePath}},ex=async(e,t,r,n)=>{let o=n.imagePrefix||e.name,i=n.imageTag||tf(),s=n.platforms||"linux/amd64,linux/arm64",a=n.buildx||!1,c=[],l=[i];if(n.generateLatest&&!l.includes("latest")&&l.push("latest"),a)try{await tx(),console.log(f.blue(`\u{1F3D7}\uFE0F Building multi-architecture images for: ${s}`))}catch(u){console.warn(f.yellow("\u26A0\uFE0F Buildx not available, falling back to single-architecture builds")),console.warn(f.yellow(` ${u.message}`)),a=!1}if(a){let u=["frontend","backend"];r&&u.push("workbench-frontend","workbench-backend");for(let p of u){let d=`${o}/${p}`,g=H.join(t,`Dockerfile.${p}`);if(!await V.pathExists(g))throw new Error(`Dockerfile not found: ${g}`);let m=l.map(y=>`${d}:${y}`);c.push(...m),await rx({context:t,dockerfile:g,tags:m,platforms:s,push:!1,noCache:n.noCache,verbose:n.verbose}),console.log(f.gray(` \u2705 Built ${p} for ${s}`)),m.forEach(y=>{console.log(f.gray(` ${y}`))})}}else{console.log(f.gray(" \u{1F528} Building single-architecture images..."));let p=["-f",H.join(t,"docker-compose.yml"),"build"];n.noCache&&p.push("--no-cache"),ye(p,{stdio:n.verbose?"inherit":"pipe",cwd:t});let d=["frontend","backend"];r&&d.push("workbench-frontend","workbench-backend");for(let g of d){let m=`${H.basename(t)}-${g}`.replace(/\./,""),y=`${o}/${g}`;l.forEach(k=>{let R=`${y}:${k}`;ce(["tag",m,R],{stdio:"pipe"}),c.push(R)}),console.log(f.gray(` \u2705 Tagged ${g}`))}}return console.log(f.green(" \u2705 Docker images built and tagged")),{names:c,tags:l}},tx=async()=>{try{ce(["buildx","version"],{stdio:"pipe"}),console.log(f.gray(" \u{1F4E6} Setting up QEMU for cross-platform emulation...")),ce(["run","--rm","--privileged","multiarch/qemu-user-static","--reset","-p","yes"],{stdio:"pipe"}),console.log(f.gray(" \u{1F4E6} Creating buildx builder...")),ce(["buildx","create","--name","multiarch","--use"],{stdio:"pipe"}),ce(["buildx","inspect","--bootstrap"],{stdio:"pipe"}),console.log(f.gray(" \u2705 Buildx builder ready with QEMU emulation"))}catch(e){throw console.warn(f.yellow(" \u26A0\uFE0F Buildx setup failed, falling back to single-architecture builds")),console.warn(f.yellow(` ${e.message}`)),new Error("Buildx not available - use single-architecture builds instead")}},rx=async e=>{let t=["buildx","build","--platform",e.platforms,"--file",e.dockerfile];e.tags.forEach(n=>{t.push("--tag",n)});let r=e.platforms.split(",").length;e.push?t.push("--push"):r===1?t.push("--load"):(console.log(f.yellow(" \u26A0\uFE0F Multi-platform images cannot be loaded locally")),console.log(f.yellow(" \u2139\uFE0F Images built but not loaded to local Docker"))),e.noCache&&t.push("--no-cache"),t.push(e.context);try{ce(t,{stdio:e.verbose?"inherit":"pipe",cwd:e.context})}catch(n){throw new Error(`Failed to build multi-architecture image: ${n}`)}},nx=async(e,t,r)=>{let n=H.join(t,"README.md"),o=e.services.frontend?.port||8081,i=e.services.workbench?.frontendPort||8083,s=`# ${e.name} - Local Deployment
1111
1111
 
1112
1112
  This build contains everything needed to deploy ${e.name} locally using Docker.
1113
1113
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raclettejs/core",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "racletteJS core package",
5
5
  "repository": "https://gitlab.com/raclettejs/core",
6
6
  "author": "Pacifico Digital Explorations GmbH <info@raclettejs.com>",
@@ -1,22 +1,22 @@
1
- import type { ClientPayloadRequestData } from "../payload/payloadTypes"
1
+ import type { FrontendPayloadRequestData } from "../payload/payloadTypes"
2
2
  import type { FastifyInstance } from "fastify"
3
3
 
4
4
  export interface CrudHandlers<T> {
5
5
  create: (
6
6
  fastify: FastifyInstance,
7
- requestParams: ClientPayloadRequestData,
7
+ requestParams: FrontendPayloadRequestData,
8
8
  data: Partial<T>,
9
9
  userId: string,
10
10
  broadcast?: boolean,
11
11
  ) => Promise<any>
12
12
  read: (
13
13
  fastify: FastifyInstance,
14
- requestParams: ClientPayloadRequestData,
14
+ requestParams: FrontendPayloadRequestData,
15
15
  id: string,
16
16
  ) => Promise<any>
17
17
  update: (
18
18
  fastify: FastifyInstance,
19
- requestParams: ClientPayloadRequestData,
19
+ requestParams: FrontendPayloadRequestData,
20
20
  id: string,
21
21
  data: Partial<T>,
22
22
  userId: string,
@@ -24,7 +24,7 @@ export interface CrudHandlers<T> {
24
24
  ) => Promise<any>
25
25
  delete: (
26
26
  fastify: FastifyInstance,
27
- requestParams: ClientPayloadRequestData,
27
+ requestParams: FrontendPayloadRequestData,
28
28
  id: string,
29
29
  userId: string,
30
30
  broadcast?: boolean,
@@ -1,7 +1,7 @@
1
1
  import type {
2
- ClientPayloadRequestData,
3
- ClientPayload,
4
- ClientPayloadBody,
2
+ FrontendPayloadRequestData,
3
+ FrontendPayload,
4
+ FrontendPayloadBody,
5
5
  } from "@c/payload/payloadTypes"
6
6
 
7
7
  // Required fields that must exist on payload item
@@ -49,7 +49,7 @@ interface PayloadHandlerConfig<T extends object, TMeta = any> {
49
49
  sanitize?: (item: T) => Partial<T>
50
50
  fields?: (
51
51
  item: T,
52
- requestData: ClientPayloadRequestData,
52
+ requestData: FrontendPayloadRequestData,
53
53
  ) => RequiredMappings<T> & OptionalPayloadFields
54
54
  createMeta?: (item: T) => Promise<TMeta> | TMeta
55
55
  beforePayload?: (item: T) => Promise<T> | T
@@ -94,9 +94,9 @@ export const registerPayloadHandler = <T extends object, TMeta = any>(
94
94
  export const createPayloadBody = async <T extends object>(
95
95
  type: string,
96
96
  item: DataItem<T>,
97
- requestData: ClientPayloadRequestData,
97
+ requestData: FrontendPayloadRequestData,
98
98
  scope = "core",
99
- ): Promise<ClientPayloadBody<T>> => {
99
+ ): Promise<FrontendPayloadBody<T>> => {
100
100
  // Check if the scope exists
101
101
  if (!handlers[scope]) {
102
102
  throw new Error(`No scope registered with name "${scope}"`)
@@ -124,7 +124,7 @@ export const createPayloadBody = async <T extends object>(
124
124
  plainItem = await handler.beforePayload(plainItem)
125
125
  }
126
126
 
127
- const basePayload: Partial<ClientPayloadBody<T>> = {
127
+ const basePayload: Partial<FrontendPayloadBody<T>> = {
128
128
  _id: fields._id ?? (plainItem as any)._id ?? "",
129
129
  _type: handler.type,
130
130
  _offline: 0,
@@ -141,16 +141,16 @@ export const createPayloadBody = async <T extends object>(
141
141
  _meta: meta,
142
142
  }
143
143
 
144
- return basePayload as ClientPayloadBody<T>
144
+ return basePayload as FrontendPayloadBody<T>
145
145
  }
146
146
 
147
147
  // New function to process multiple items of the same type
148
148
  export const createPayloadBodies = async <T extends object>(
149
149
  type: string,
150
150
  items: DataItem<T>[],
151
- requestData: ClientPayloadRequestData,
151
+ requestData: FrontendPayloadRequestData,
152
152
  scope = "core",
153
- ): Promise<ClientPayloadBody<T>[]> => {
153
+ ): Promise<FrontendPayloadBody<T>[]> => {
154
154
  return await Promise.all(
155
155
  items.map((item) => createPayloadBody(type, item, requestData, scope)),
156
156
  )
@@ -160,9 +160,9 @@ export const createPayloadBodies = async <T extends object>(
160
160
  export const createPayload = async <T extends object>(
161
161
  type: string,
162
162
  items: DataItem<T> | DataItem<T>[],
163
- requestData: ClientPayloadRequestData,
163
+ requestData: FrontendPayloadRequestData,
164
164
  scope = "core",
165
- ): Promise<ClientPayload<T[]>> => {
165
+ ): Promise<FrontendPayload<T[]>> => {
166
166
  // Convert single item to array if needed
167
167
  const itemsArray = Array.isArray(items) ? items : [items]
168
168
 
@@ -188,9 +188,9 @@ export const createMultiTypePayload = async <T extends object>(
188
188
  items: DataItem<T> | DataItem<T>[]
189
189
  scope?: string
190
190
  }[],
191
- requestData: ClientPayloadRequestData,
192
- ): Promise<ClientPayload<T>> => {
193
- const allItems: ClientPayloadBody<T>[] = []
191
+ requestData: FrontendPayloadRequestData,
192
+ ): Promise<FrontendPayload<T>> => {
193
+ const allItems: FrontendPayloadBody<T>[] = []
194
194
 
195
195
  // Process each type group
196
196
  await Promise.all(
@@ -1,4 +1,4 @@
1
- export type ClientPayloadRequestData = {
1
+ export type FrontendPayloadRequestData = {
2
2
  appSessionId: string
3
3
  requestId: string
4
4
  appRequestCode: string
@@ -10,7 +10,7 @@ export type ClientPayloadRequestData = {
10
10
  userId?: string
11
11
  }
12
12
 
13
- export type ClientPayloadBody<T> = {
13
+ export type FrontendPayloadBody<T> = {
14
14
  _id: string
15
15
  _type: string
16
16
  _offline: number
@@ -29,7 +29,7 @@ export type ClientPayloadBody<T> = {
29
29
  export type FileType = File | { [x: string]: any }
30
30
 
31
31
  export type BodyContent<T> = {
32
- items: ClientPayloadBody<T>[]
32
+ items: FrontendPayloadBody<T>[]
33
33
  hits?: any
34
34
  prevVersion?: any
35
35
  deleted?: string[]
@@ -39,6 +39,6 @@ export type BodyContent<T> = {
39
39
  oldParent?: T
40
40
  }
41
41
 
42
- export type ClientPayload<T> = ClientPayloadRequestData & {
42
+ export type FrontendPayload<T> = FrontendPayloadRequestData & {
43
43
  body: BodyContent<T>
44
44
  }
@@ -1,8 +1,8 @@
1
1
  import type { FastifyInstance } from "fastify"
2
2
  import type { Schema, Model, Document } from "mongoose"
3
3
  import type {
4
- ClientPayload,
5
- ClientPayloadRequestData,
4
+ FrontendPayload,
5
+ FrontendPayloadRequestData,
6
6
  HttpService,
7
7
  PluginSchemaDefinition,
8
8
  IntervalTaskOptions,
@@ -20,6 +20,7 @@ import { registerPluginForFrontendGeneration } from "@c/pluginSystem/configGener
20
20
  import { registerSchemaDefinition } from "@c/validation/schemaGenerator"
21
21
  import type { PluginContract } from "@c/contracting/contractTypes"
22
22
  import { registerPluginContract } from "@c/contracting/contractRegistrar"
23
+ import configService from "@c/config/configService"
23
24
 
24
25
  const EVENT_WHITELIST = [
25
26
  "broadcastDataUpdated",
@@ -42,7 +43,9 @@ export const createPluginFastifyInstance = (
42
43
 
43
44
  const pluginCacheService = createCacheService(fastify.cache, {
44
45
  prefix: pluginOptions.key,
45
- defaultTtl: 3600, // Default 60 minutes TTL for plugins -> TODO: should be a raclette.config option
46
+ // Default 60 minutes TTL for plugins -> TODO: should be a raclette.config option
47
+ // do we want this per-plugin? probably not, global is ok
48
+ defaultTtl: configService.getConfig()?.backend?.cacheTTL ?? -1,
46
49
  })
47
50
 
48
51
  const instance: PluginFastifyInstance = {
@@ -166,9 +169,9 @@ export const createPluginFastifyInstance = (
166
169
  createPayload: <T extends object>(
167
170
  name: string,
168
171
  item: T,
169
- requestData: ClientPayloadRequestData,
172
+ requestData: FrontendPayloadRequestData,
170
173
  scope?: string,
171
- ): Promise<ClientPayload<T[]>> => {
174
+ ): Promise<FrontendPayload<T[]>> => {
172
175
  const prefixedName = `${pluginOptions.key}--${name}`
173
176
 
174
177
  return createPayload<T>(
@@ -7,8 +7,8 @@ import type {
7
7
  HttpService,
8
8
  IntervalTaskOptions,
9
9
  CrudHandlers,
10
- ClientPayloadRequestData,
11
- ClientPayload,
10
+ FrontendPayloadRequestData,
11
+ FrontendPayload,
12
12
  CacheService,
13
13
  } from "@/types"
14
14
  import type { EventEmitter } from "stream"
@@ -65,8 +65,8 @@ export type PluginFastifyInstance = {
65
65
  createPayload: <T extends object>(
66
66
  name: string,
67
67
  item: T,
68
- requestData: ClientPayloadRequestData,
69
- ) => Promise<ClientPayload<T>>
68
+ requestData: FrontendPayloadRequestData,
69
+ ) => Promise<FrontendPayload<T>>
70
70
  /* CONNECTION */
71
71
  registerSocket: (eventName: string, handler: Listener) => void
72
72
  emit: (eventName: string, data: unknown) => void
@@ -1,11 +1,11 @@
1
1
  import type { Project, Tag, Composition, InteractionLink } from "@/shared/types"
2
- import type { ClientPayload } from "@/types"
2
+ import type { FrontendPayload } from "@/types"
3
3
  import type { FastifyInstance } from "fastify"
4
4
 
5
5
  export const createSystemEventHandlers = (fastify: FastifyInstance) => {
6
6
  const { wss } = fastify
7
7
 
8
- const sendToChannel = (payload: ClientPayload<unknown>, key: string) => {
8
+ const sendToChannel = (payload: FrontendPayload<unknown>, key: string) => {
9
9
  // TODO rework this to handle spaces instead of project and in the future document rooms -> y.js?
10
10
  if (payload.project) {
11
11
  wss.in(payload.project).emit(key, payload)
@@ -15,20 +15,20 @@ export const createSystemEventHandlers = (fastify: FastifyInstance) => {
15
15
  }
16
16
 
17
17
  return {
18
- broadcastDataUpdatedHandler: (payload: ClientPayload<unknown>): void => {
18
+ broadcastDataUpdatedHandler: (payload: FrontendPayload<unknown>): void => {
19
19
  fastify.log.info(`[Socket] Push onData: ${payload.appSessionId}`)
20
20
  sendToChannel(payload, "data")
21
21
  },
22
- broadcastDataCreatedHandler: (payload: ClientPayload<unknown>): void => {
22
+ broadcastDataCreatedHandler: (payload: FrontendPayload<unknown>): void => {
23
23
  fastify.log.info(`[Socket] Push onCreate: ${payload.appSessionId}`)
24
24
  sendToChannel(payload, "dataCreated")
25
25
  },
26
- broadcastDataDeletedHandler: (payload: ClientPayload<unknown>): void => {
26
+ broadcastDataDeletedHandler: (payload: FrontendPayload<unknown>): void => {
27
27
  fastify.log.info(`[Socket] Push onDelete: ${payload.appSessionId}`)
28
28
  sendToChannel(payload, "dataDeleted")
29
29
  },
30
30
  broadcastCompositionCreated: (
31
- payload: ClientPayload<Composition>,
31
+ payload: FrontendPayload<Composition>,
32
32
  ): void => {
33
33
  fastify.log.info(
34
34
  `[Socket] Push CompositionCreated: ${payload.appSessionId}`,
@@ -37,7 +37,7 @@ export const createSystemEventHandlers = (fastify: FastifyInstance) => {
37
37
  },
38
38
 
39
39
  broadcastCompositionDeleted: (
40
- payload: ClientPayload<Composition>,
40
+ payload: FrontendPayload<Composition>,
41
41
  ): void => {
42
42
  fastify.log.info(
43
43
  `[Socket] Push CompositionDeleted: ${payload.appSessionId}`,
@@ -45,7 +45,7 @@ export const createSystemEventHandlers = (fastify: FastifyInstance) => {
45
45
  sendToChannel(payload, "compositionDeleted")
46
46
  },
47
47
  broadcastInteractionLinkCreated: (
48
- payload: ClientPayload<InteractionLink>,
48
+ payload: FrontendPayload<InteractionLink>,
49
49
  ): void => {
50
50
  fastify.log.info(
51
51
  `[Socket] Push InteractionLinkCreated: ${payload.appSessionId}`,
@@ -54,44 +54,46 @@ export const createSystemEventHandlers = (fastify: FastifyInstance) => {
54
54
  },
55
55
 
56
56
  broadcastInteractionLinkDeleted: (
57
- payload: ClientPayload<InteractionLink>,
57
+ payload: FrontendPayload<InteractionLink>,
58
58
  ): void => {
59
59
  fastify.log.info(
60
60
  `[Socket] Push InteractionLinkDeleted: ${payload.appSessionId}`,
61
61
  )
62
62
  sendToChannel(payload, "interactionLinkDeleted")
63
63
  },
64
- broadcastTagCreated: (payload: ClientPayload<Tag>): void => {
64
+ broadcastTagCreated: (payload: FrontendPayload<Tag>): void => {
65
65
  fastify.log.info(`[Socket] Push tagCreated: ${payload.appSessionId}`)
66
66
  sendToChannel(payload, "tagCreated")
67
67
  },
68
68
 
69
- broadcastTagDeleted: (payload: ClientPayload<Tag>): void => {
69
+ broadcastTagDeleted: (payload: FrontendPayload<Tag>): void => {
70
70
  fastify.log.info(`[Socket] Push tagDeleted: ${payload.appSessionId}`)
71
71
  sendToChannel(payload, "tagDeleted")
72
72
  },
73
73
 
74
- broadcastUserCreated: (payload: ClientPayload<Tag>): void => {
74
+ broadcastUserCreated: (payload: FrontendPayload<Tag>): void => {
75
75
  fastify.log.info(`[Socket] Push userCreated: ${payload.appSessionId}`)
76
76
  sendToChannel(payload, "userCreated")
77
77
  },
78
78
 
79
- broadcastUserDeleted: (payload: ClientPayload<Tag>): void => {
79
+ broadcastUserDeleted: (payload: FrontendPayload<Tag>): void => {
80
80
  fastify.log.info(`[Socket] Push userDeleted: ${payload.appSessionId}`)
81
81
  sendToChannel(payload, "userDeleted")
82
82
  },
83
83
 
84
- broadcastProjectCreated: (payload: ClientPayload<Project>): void => {
84
+ broadcastProjectCreated: (payload: FrontendPayload<Project>): void => {
85
85
  fastify.log.info(`[Socket] Push projectCreated: ${payload.appSessionId}`)
86
86
  sendToChannel(payload, "projectCreated")
87
87
  },
88
88
 
89
- broadcastProjectUpdated: (payload: ClientPayload<Project>): void => {
89
+ broadcastProjectUpdated: (payload: FrontendPayload<Project>): void => {
90
90
  fastify.log.info(`[Socket] Push projectUpdated: ${payload.appSessionId}`)
91
91
  sendToChannel(payload, "projectUpdated")
92
92
  },
93
93
 
94
- broadcastProjectConfigUpdated: (payload: ClientPayload<Project>): void => {
94
+ broadcastProjectConfigUpdated: (
95
+ payload: FrontendPayload<Project>,
96
+ ): void => {
95
97
  fastify.log.info(`[Socket] Push projectDeleted: ${payload.appSessionId}`)
96
98
  sendToChannel(payload, "projectDeleted")
97
99
  },
@@ -1,7 +1,7 @@
1
1
  import type { Account as AccountType } from "./account.schema"
2
2
  import type {
3
- ClientPayload,
4
- ClientPayloadRequestData,
3
+ FrontendPayload,
4
+ FrontendPayloadRequestData,
5
5
  } from "@c/payload/payloadTypes"
6
6
  import type { PluginFastifyInstance } from "types"
7
7
  import { v4 as uuidv4, validate } from "uuid"
@@ -65,10 +65,10 @@ export class AccountService {
65
65
  */
66
66
  async createAccount(
67
67
  fastify: PluginFastifyInstance,
68
- requestData: ClientPayloadRequestData,
68
+ requestData: FrontendPayloadRequestData,
69
69
  accountBody: AccountBody,
70
70
  userId: string,
71
- ): Promise<ClientPayload<AccountType[]>> {
71
+ ): Promise<FrontendPayload<AccountType[]>> {
72
72
  const account = await this._createAccount(fastify, accountBody, userId)
73
73
 
74
74
  const payload = await createAccountPayload(fastify, [account], requestData)
@@ -97,8 +97,8 @@ export class AccountService {
97
97
  */
98
98
  async readAccounts(
99
99
  fastify: PluginFastifyInstance,
100
- requestData: ClientPayloadRequestData,
101
- ): Promise<ClientPayload<AccountType[]>> {
100
+ requestData: FrontendPayloadRequestData,
101
+ ): Promise<FrontendPayload<AccountType[]>> {
102
102
  const accounts = await this._readAccounts(fastify)
103
103
 
104
104
  return createAccountPayload(fastify, accounts, requestData)
@@ -130,9 +130,9 @@ export class AccountService {
130
130
  */
131
131
  async readAccount(
132
132
  fastify: PluginFastifyInstance,
133
- requestData: ClientPayloadRequestData,
133
+ requestData: FrontendPayloadRequestData,
134
134
  id: string,
135
- ): Promise<ClientPayload<AccountType[]>> {
135
+ ): Promise<FrontendPayload<AccountType[]>> {
136
136
  const account = await this._readAccount(fastify, id)
137
137
 
138
138
  return createAccountPayload(fastify, [account], requestData)
@@ -191,11 +191,11 @@ export class AccountService {
191
191
  */
192
192
  async updateAccount(
193
193
  fastify: PluginFastifyInstance,
194
- requestData: ClientPayloadRequestData,
194
+ requestData: FrontendPayloadRequestData,
195
195
  id: string,
196
196
  accountBody: AccountBody,
197
197
  userId: string,
198
- ): Promise<ClientPayload<AccountType[]>> {
198
+ ): Promise<FrontendPayload<AccountType[]>> {
199
199
  const { updated, original } = await this._updateAccount(
200
200
  fastify,
201
201
  id,
@@ -242,9 +242,9 @@ export class AccountService {
242
242
  */
243
243
  async removeAccount(
244
244
  fastify: PluginFastifyInstance,
245
- requestData: ClientPayloadRequestData,
245
+ requestData: FrontendPayloadRequestData,
246
246
  id: string,
247
- ): Promise<ClientPayload<AccountType[]>> {
247
+ ): Promise<FrontendPayload<AccountType[]>> {
248
248
  const account = await this._removeAccount(fastify, id)
249
249
 
250
250
  const payload = await createAccountPayload(fastify, [account], {
@@ -291,9 +291,9 @@ export class AccountService {
291
291
  */
292
292
  async hardDeleteAccount(
293
293
  fastify: PluginFastifyInstance,
294
- requestData: ClientPayloadRequestData,
294
+ requestData: FrontendPayloadRequestData,
295
295
  id: string,
296
- ): Promise<ClientPayload<AccountType[]>> {
296
+ ): Promise<FrontendPayload<AccountType[]>> {
297
297
  const account = await this._hardDeleteAccount(fastify, id)
298
298
 
299
299
  const payload = await createAccountPayload(fastify, [account], {
@@ -355,11 +355,11 @@ export class AccountService {
355
355
  */
356
356
  async toggleBlockAccount(
357
357
  fastify: PluginFastifyInstance,
358
- requestData: ClientPayloadRequestData,
358
+ requestData: FrontendPayloadRequestData,
359
359
  id: string,
360
360
  blocked: boolean,
361
361
  userId: string,
362
- ): Promise<ClientPayload<AccountType[]>> {
362
+ ): Promise<FrontendPayload<AccountType[]>> {
363
363
  const { updated, original } = await this._toggleBlockAccount(
364
364
  fastify,
365
365
  id,
@@ -1,12 +1,12 @@
1
1
  import { type FastifyInstance } from "fastify"
2
2
  import { type AnyAccount } from "../account.schema"
3
- import { type ClientPayload } from "@c/payload/payloadTypes"
3
+ import { type FrontendPayload } from "@c/payload/payloadTypes"
4
4
 
5
5
  const registerEvents = (fastify: FastifyInstance) => {
6
6
  /**
7
7
  * Account created
8
8
  */
9
- const created = (payload: ClientPayload<AnyAccount>) => {
9
+ const created = (payload: FrontendPayload<AnyAccount>) => {
10
10
  fastify.eventbus.emit("broadcastDataUpdated", payload)
11
11
  fastify.eventbus.emit("broadcastAccountCreated", payload)
12
12
  fastify.log.info(
@@ -17,7 +17,7 @@ const registerEvents = (fastify: FastifyInstance) => {
17
17
  /**
18
18
  * Account updated
19
19
  */
20
- const updated = (payload: ClientPayload<AnyAccount>) => {
20
+ const updated = (payload: FrontendPayload<AnyAccount>) => {
21
21
  fastify.eventbus.emit("broadcastDataUpdated", payload)
22
22
  fastify.log.info(
23
23
  `[eventbus] account broadcast updated ${payload.appSessionId}`,
@@ -27,7 +27,7 @@ const registerEvents = (fastify: FastifyInstance) => {
27
27
  /**
28
28
  * Account deleted
29
29
  */
30
- const deleted = (payload: ClientPayload<AnyAccount>) => {
30
+ const deleted = (payload: FrontendPayload<AnyAccount>) => {
31
31
  fastify.eventbus.emit("broadcastAccountDeleted", payload)
32
32
  fastify.log.info(
33
33
  `[eventbus] account broadcast deleted ${payload.appSessionId}`,
@@ -1,5 +1,5 @@
1
1
  import type { Account } from "../account.schema"
2
- import type { ClientPayloadRequestData, PluginFastifyInstance } from "@/types"
2
+ import type { FrontendPayloadRequestData, PluginFastifyInstance } from "@/types"
3
3
 
4
4
  export const registerPayload = (fastify: PluginFastifyInstance) => {
5
5
  fastify.registerPayloadHandler<Account>("account", {
@@ -17,5 +17,5 @@ export const registerPayload = (fastify: PluginFastifyInstance) => {
17
17
  export const createAccountPayload = async (
18
18
  fastify: PluginFastifyInstance,
19
19
  items: Account[],
20
- requestData: ClientPayloadRequestData,
20
+ requestData: FrontendPayloadRequestData,
21
21
  ) => await fastify.createPayload("account", items, requestData)
@@ -1,7 +1,7 @@
1
1
  import type { Composition as CompositionType } from "./composition.schema"
2
2
  import type {
3
- ClientPayload,
4
- ClientPayloadRequestData,
3
+ FrontendPayload,
4
+ FrontendPayloadRequestData,
5
5
  } from "@c/payload/payloadTypes"
6
6
  import type { PluginFastifyInstance } from "types"
7
7
  import { v4 as uuidv4, validate } from "uuid"
@@ -68,10 +68,10 @@ export class CompositionService {
68
68
  */
69
69
  async createComposition(
70
70
  fastify: PluginFastifyInstance,
71
- requestData: ClientPayloadRequestData,
71
+ requestData: FrontendPayloadRequestData,
72
72
  compositionBody: CompositionBody,
73
73
  userId: string,
74
- ): Promise<ClientPayload<CompositionType[]>> {
74
+ ): Promise<FrontendPayload<CompositionType[]>> {
75
75
  const composition = await this._createComposition(
76
76
  fastify,
77
77
  compositionBody,
@@ -112,8 +112,8 @@ export class CompositionService {
112
112
  */
113
113
  async getAllCompositions(
114
114
  fastify: PluginFastifyInstance,
115
- requestData: ClientPayloadRequestData,
116
- ): Promise<ClientPayload<CompositionType[]>> {
115
+ requestData: FrontendPayloadRequestData,
116
+ ): Promise<FrontendPayload<CompositionType[]>> {
117
117
  const compositions = await this._readAllCompositions(fastify)
118
118
 
119
119
  return createCompositionPayload(fastify, compositions, requestData)
@@ -147,9 +147,9 @@ export class CompositionService {
147
147
  */
148
148
  async readComposition(
149
149
  fastify: PluginFastifyInstance,
150
- requestData: ClientPayloadRequestData,
150
+ requestData: FrontendPayloadRequestData,
151
151
  id: string,
152
- ): Promise<ClientPayload<CompositionType[]>> {
152
+ ): Promise<FrontendPayload<CompositionType[]>> {
153
153
  const composition = await this._readComposition(fastify, id)
154
154
 
155
155
  return createCompositionPayload(fastify, [composition], requestData)
@@ -210,11 +210,11 @@ export class CompositionService {
210
210
  */
211
211
  async updateComposition(
212
212
  fastify: PluginFastifyInstance,
213
- requestData: ClientPayloadRequestData,
213
+ requestData: FrontendPayloadRequestData,
214
214
  id: string,
215
215
  compositionBody: CompositionBody,
216
216
  userId: string,
217
- ): Promise<ClientPayload<CompositionType[]>> {
217
+ ): Promise<FrontendPayload<CompositionType[]>> {
218
218
  const { updated, original } = await this._updateComposition(
219
219
  fastify,
220
220
  id,
@@ -265,9 +265,9 @@ export class CompositionService {
265
265
  */
266
266
  async removeComposition(
267
267
  fastify: PluginFastifyInstance,
268
- requestData: ClientPayloadRequestData,
268
+ requestData: FrontendPayloadRequestData,
269
269
  id: string,
270
- ): Promise<ClientPayload<CompositionType[]>> {
270
+ ): Promise<FrontendPayload<CompositionType[]>> {
271
271
  const composition = await this._removeComposition(fastify, id)
272
272
 
273
273
  const payload = await createCompositionPayload(fastify, [composition], {
@@ -314,9 +314,9 @@ export class CompositionService {
314
314
  */
315
315
  async hardDeleteComposition(
316
316
  fastify: PluginFastifyInstance,
317
- requestData: ClientPayloadRequestData,
317
+ requestData: FrontendPayloadRequestData,
318
318
  id: string,
319
- ): Promise<ClientPayload<CompositionType[]>> {
319
+ ): Promise<FrontendPayload<CompositionType[]>> {
320
320
  const composition = await this._hardDeleteComposition(fastify, id)
321
321
 
322
322
  const payload = await createCompositionPayload(fastify, [composition], {
@@ -1,12 +1,12 @@
1
1
  import type { AnyComposition } from "../composition.schema"
2
- import type { ClientPayload } from "@c/payload/payloadTypes"
2
+ import type { FrontendPayload } from "@c/payload/payloadTypes"
3
3
  import type { PluginFastifyInstance } from "types"
4
4
 
5
5
  export const registerEvents = (fastify: PluginFastifyInstance) => {
6
6
  /*
7
7
  * composition created and created
8
8
  */
9
- const created = async (payload: ClientPayload<AnyComposition>) => {
9
+ const created = async (payload: FrontendPayload<AnyComposition>) => {
10
10
  fastify.eventbus.emit("broadcastCompositionCreated", payload)
11
11
  fastify.log.info(
12
12
  `[eventbus] composition broadcast created ${payload.body.items}`,
@@ -16,7 +16,7 @@ export const registerEvents = (fastify: PluginFastifyInstance) => {
16
16
  /*
17
17
  * composition deleted
18
18
  */
19
- const deleted = async (payload: ClientPayload<AnyComposition>) => {
19
+ const deleted = async (payload: FrontendPayload<AnyComposition>) => {
20
20
  fastify.eventbus.emit("broadcastCompositionDeleted", payload)
21
21
  fastify.log.info(
22
22
  `[eventbus] composition broadcast deleted ${payload.body.items}`,