@strapi/plugin-graphql 5.0.0-beta.2 → 5.0.0-beta.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.
@@ -2021,11 +2021,11 @@ const createCollectionTypeMutationsBuilder = ({ strapi: strapi2 }) => {
2021
2021
  },
2022
2022
  async resolve(parent, args22, context) {
2023
2023
  const { auth } = context.state;
2024
- const { data, documentId, ...restParams } = args22;
2024
+ const { data, ...restParams } = args22;
2025
2025
  const sanitizedInputData = await strapi2.contentAPI.sanitize.input(data, contentType2, {
2026
2026
  auth
2027
2027
  });
2028
- return strapi2.documents(uid).update(documentId, {
2028
+ return strapi2.documents(uid).update({
2029
2029
  ...restParams,
2030
2030
  data: sanitizedInputData
2031
2031
  });
@@ -2048,7 +2048,7 @@ const createCollectionTypeMutationsBuilder = ({ strapi: strapi2 }) => {
2048
2048
  },
2049
2049
  async resolve(parent, args22) {
2050
2050
  const { documentId } = args22;
2051
- await strapi2.documents(uid).delete(documentId);
2051
+ await strapi2.documents(uid).delete({ documentId });
2052
2052
  return { documentId };
2053
2053
  }
2054
2054
  });
@@ -2128,8 +2128,9 @@ const createSingleTypeMutationsBuilder = ({ strapi: strapi2 }) => {
2128
2128
  });
2129
2129
  const document = await strapi2.db?.query(uid).findOne();
2130
2130
  if (document) {
2131
- return strapi2.documents(uid).update(document.documentId, {
2131
+ return strapi2.documents(uid).update({
2132
2132
  ...args22,
2133
+ documentId: document.documentId,
2133
2134
  data: sanitizedInputData
2134
2135
  });
2135
2136
  }
@@ -2157,7 +2158,7 @@ const createSingleTypeMutationsBuilder = ({ strapi: strapi2 }) => {
2157
2158
  if (!document) {
2158
2159
  throw new NotFoundError("Document not found");
2159
2160
  }
2160
- await strapi2.documents(uid).delete(document.documentId, args22);
2161
+ await strapi2.documents(uid).delete({ ...args22, documentId: document.documentId });
2161
2162
  return document;
2162
2163
  }
2163
2164
  });
@@ -2456,15 +2457,17 @@ const queriesResolvers = ({ strapi: strapi2 }) => ({
2456
2457
  return strapi2.documents(uid).findFirst({ status: "published", ...sanitizedQuery });
2457
2458
  },
2458
2459
  async findOne(parent, args2, ctx) {
2460
+ const { documentId } = args2;
2459
2461
  await strapi2.contentAPI.validate.query(args2, contentType2, {
2460
2462
  auth: ctx?.state?.auth
2461
2463
  });
2462
2464
  const sanitizedQuery = await strapi2.contentAPI.sanitize.query(args2, contentType2, {
2463
2465
  auth: ctx?.state?.auth
2464
2466
  });
2465
- return strapi2.documents(uid).findOne(args2.documentId, {
2467
+ return strapi2.documents(uid).findOne({
2466
2468
  status: "published",
2467
- ...omit(["id", "documentId"], sanitizedQuery)
2469
+ ...omit(["id", "documentId"], sanitizedQuery),
2470
+ documentId
2468
2471
  });
2469
2472
  }
2470
2473
  };