@strapi/plugin-graphql 5.0.0-beta.1 → 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.
@@ -136,9 +136,6 @@ async function bootstrap({ strapi: strapi2 }) {
136
136
  type: "content-api"
137
137
  }
138
138
  };
139
- if (ctx.request.method === "GET") {
140
- return next();
141
- }
142
139
  return strapi2.auth.authenticate(ctx, next);
143
140
  });
144
141
  handler.push(
@@ -2024,11 +2021,11 @@ const createCollectionTypeMutationsBuilder = ({ strapi: strapi2 }) => {
2024
2021
  },
2025
2022
  async resolve(parent, args22, context) {
2026
2023
  const { auth } = context.state;
2027
- const { data, documentId, ...restParams } = args22;
2024
+ const { data, ...restParams } = args22;
2028
2025
  const sanitizedInputData = await strapi2.contentAPI.sanitize.input(data, contentType2, {
2029
2026
  auth
2030
2027
  });
2031
- return strapi2.documents(uid).update(documentId, {
2028
+ return strapi2.documents(uid).update({
2032
2029
  ...restParams,
2033
2030
  data: sanitizedInputData
2034
2031
  });
@@ -2051,7 +2048,7 @@ const createCollectionTypeMutationsBuilder = ({ strapi: strapi2 }) => {
2051
2048
  },
2052
2049
  async resolve(parent, args22) {
2053
2050
  const { documentId } = args22;
2054
- await strapi2.documents(uid).delete(documentId);
2051
+ await strapi2.documents(uid).delete({ documentId });
2055
2052
  return { documentId };
2056
2053
  }
2057
2054
  });
@@ -2131,8 +2128,9 @@ const createSingleTypeMutationsBuilder = ({ strapi: strapi2 }) => {
2131
2128
  });
2132
2129
  const document = await strapi2.db?.query(uid).findOne();
2133
2130
  if (document) {
2134
- return strapi2.documents(uid).update(document.documentId, {
2131
+ return strapi2.documents(uid).update({
2135
2132
  ...args22,
2133
+ documentId: document.documentId,
2136
2134
  data: sanitizedInputData
2137
2135
  });
2138
2136
  }
@@ -2160,7 +2158,7 @@ const createSingleTypeMutationsBuilder = ({ strapi: strapi2 }) => {
2160
2158
  if (!document) {
2161
2159
  throw new NotFoundError("Document not found");
2162
2160
  }
2163
- await strapi2.documents(uid).delete(document.documentId, args22);
2161
+ await strapi2.documents(uid).delete({ ...args22, documentId: document.documentId });
2164
2162
  return document;
2165
2163
  }
2166
2164
  });
@@ -2459,15 +2457,17 @@ const queriesResolvers = ({ strapi: strapi2 }) => ({
2459
2457
  return strapi2.documents(uid).findFirst({ status: "published", ...sanitizedQuery });
2460
2458
  },
2461
2459
  async findOne(parent, args2, ctx) {
2460
+ const { documentId } = args2;
2462
2461
  await strapi2.contentAPI.validate.query(args2, contentType2, {
2463
2462
  auth: ctx?.state?.auth
2464
2463
  });
2465
2464
  const sanitizedQuery = await strapi2.contentAPI.sanitize.query(args2, contentType2, {
2466
2465
  auth: ctx?.state?.auth
2467
2466
  });
2468
- return strapi2.documents(uid).findOne(args2.documentId, {
2467
+ return strapi2.documents(uid).findOne({
2469
2468
  status: "published",
2470
- ...omit(["id", "documentId"], sanitizedQuery)
2469
+ ...omit(["id", "documentId"], sanitizedQuery),
2470
+ documentId
2471
2471
  });
2472
2472
  }
2473
2473
  };