@as-integrations/h3 1.0.0 → 1.1.1

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 - UnJS
3
+ Copyright (c) 2022 - Tobias Diez
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -14,10 +14,10 @@ This package allows you to easily integrate [Apollo Server](https://www.apollogr
14
14
  npm install @apollo/server graphql @as-integrations/h3
15
15
 
16
16
  # yarn
17
- yarn install @apollo/server graphql @as-integrations/h3
17
+ yarn add @apollo/server graphql @as-integrations/h3
18
18
 
19
19
  # pnpm
20
- pnpm install @apollo/server graphql @as-integrations/h3
20
+ pnpm add @apollo/server graphql @as-integrations/h3
21
21
  ```
22
22
 
23
23
  ## Usage with Nuxt v3
@@ -43,7 +43,7 @@ export default startServerAndCreateH3Handler(apollo, {
43
43
  Create and configure an instance of Apollo Server as described in the [documentation](https://www.apollographql.com/docs/apollo-server/getting-started#step-6-create-an-instance-of-apolloserver) and then register it as a route handler in your `h3` application.
44
44
 
45
45
  ```js
46
- import { createApp } from 'h3'
46
+ import { createApp, toNodeListener } from 'h3'
47
47
  import { ApolloServer } from '@apollo/server'
48
48
  import { startServerAndCreateH3Handler } from '@as-integrations/h3'
49
49
 
package/dist/index.cjs CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  const h3 = require('h3');
6
4
 
7
5
  function startServerAndCreateH3Handler(server, options) {
@@ -63,9 +61,9 @@ async function normalizeBody(event) {
63
61
  const PayloadMethods = ["PATCH", "POST", "PUT", "DELETE"];
64
62
  if (h3.isMethod(event, PayloadMethods)) {
65
63
  const body = await h3.readRawBody(event);
66
- const content = typeof body === "string" ? body : body.toString();
64
+ const content = typeof body === "string" ? body : body?.toString();
67
65
  if (h3.getRequestHeader(event, "content-type") === "application/json") {
68
- return JSON.parse(content);
66
+ return content ? JSON.parse(content) : {};
69
67
  } else {
70
68
  return content;
71
69
  }
package/dist/index.mjs CHANGED
@@ -59,9 +59,9 @@ async function normalizeBody(event) {
59
59
  const PayloadMethods = ["PATCH", "POST", "PUT", "DELETE"];
60
60
  if (isMethod(event, PayloadMethods)) {
61
61
  const body = await readRawBody(event);
62
- const content = typeof body === "string" ? body : body.toString();
62
+ const content = typeof body === "string" ? body : body?.toString();
63
63
  if (getRequestHeader(event, "content-type") === "application/json") {
64
- return JSON.parse(content);
64
+ return content ? JSON.parse(content) : {};
65
65
  } else {
66
66
  return content;
67
67
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@as-integrations/h3",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "An Apollo Server integration for use with h3 or Nuxt",
5
- "repository": "apollo-server-integrations/apollo-server-integration-h3",
5
+ "repository": "github:apollo-server-integrations/apollo-server-integration-h3",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,
8
8
  "type": "module",
@@ -20,39 +20,39 @@
20
20
  "dist"
21
21
  ],
22
22
  "peerDependencies": {
23
- "@apollo/server": "^4.0.0",
24
- "h3": "^0.7.21"
23
+ "@apollo/server": "^4.1.1",
24
+ "h3": "^0.8.6"
25
25
  },
26
26
  "devDependencies": {
27
- "@apollo/server": "^4.0.0",
28
- "@apollo/server-integration-testsuite": "^4.0.0",
29
- "@apollo/utils.withrequired": "^1.0.0",
30
- "@jest/globals": "^29.2.0",
27
+ "@apollo/server": "^4.1.1",
28
+ "@apollo/server-integration-testsuite": "^4.1.1",
29
+ "@apollo/utils.withrequired": "^1.0.1",
30
+ "@jest/globals": "^29.2.2",
31
31
  "@nuxtjs/eslint-config-typescript": "^11.0.0",
32
- "@typescript-eslint/eslint-plugin": "^5.40.0",
33
- "@typescript-eslint/parser": "^5.40.0",
34
- "@vitest/coverage-c8": "^0.24.1",
35
- "eslint": "^8.25.0",
32
+ "@typescript-eslint/eslint-plugin": "^5.42.0",
33
+ "@typescript-eslint/parser": "^5.42.0",
34
+ "@vitest/coverage-c8": "^0.24.5",
35
+ "eslint": "^8.27.0",
36
36
  "eslint-config-prettier": "^8.5.0",
37
37
  "eslint-plugin-unused-imports": "^2.0.0",
38
38
  "graphql": "^16.6.0",
39
- "h3": "^0.7.21",
40
- "jest": "^29.2.0",
39
+ "h3": "^0.8.6",
40
+ "jest": "^29.2.2",
41
41
  "prettier": "^2.7.1",
42
42
  "standard-version": "^9.5.0",
43
43
  "ts-jest": "^29.0.3",
44
44
  "typescript": "^4.8.4",
45
- "unbuild": "^0.8.11",
46
- "vitest": "^0.24.1"
45
+ "unbuild": "^0.9.4",
46
+ "vitest": "^0.24.5"
47
47
  },
48
- "packageManager": "pnpm@7.13.4",
48
+ "packageManager": "pnpm@7.14.2",
49
49
  "scripts": {
50
50
  "build": "unbuild",
51
51
  "test": "vitest dev",
52
52
  "test:integration": "jest",
53
53
  "lint": "pnpm lint:eslint && pnpm lint:prettier",
54
54
  "lint:eslint": "eslint --ext .ts,.js,.vue,.graphql --ignore-path .gitignore --report-unused-disable-directives .",
55
- "lint:prettier": "prettier --check --ignore-path .gitignore .",
55
+ "lint:prettier": "prettier --check --ignore-path .gitignore . '!pnpm-lock.yaml'",
56
56
  "release": "pnpm test && standard-version && git push --follow-tags && pnpm publish"
57
57
  }
58
58
  }