sofa-api 0.11.0 → 0.11.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.
Files changed (3) hide show
  1. package/index.js +9 -2
  2. package/index.mjs +9 -2
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -10,7 +10,7 @@ const Trouter = _interopDefault(require('trouter'));
10
10
  const utils = require('@graphql-tools/utils');
11
11
  const paramCase = require('param-case');
12
12
  const uuid = require('uuid');
13
- const axios = _interopDefault(require('axios'));
13
+ const crossUndiciFetch = require('cross-undici-fetch');
14
14
  const colors = require('ansi-colors');
15
15
  const jsYaml = require('js-yaml');
16
16
  const fs = require('fs');
@@ -236,7 +236,14 @@ class SubscriptionManager {
236
236
  }
237
237
  const { url } = this.clients.get(id);
238
238
  logger.info(`[Subscription] Trigger ${id}`);
239
- yield axios.post(url, result);
239
+ const response = yield crossUndiciFetch.fetch(url, {
240
+ method: 'POST',
241
+ body: JSON.stringify(result),
242
+ headers: {
243
+ 'Content-Type': 'application/json',
244
+ }
245
+ });
246
+ yield response.text();
240
247
  });
241
248
  }
242
249
  buildOperations() {
package/index.mjs CHANGED
@@ -4,7 +4,7 @@ import Trouter from 'trouter';
4
4
  import { buildOperationNodeForField } from '@graphql-tools/utils';
5
5
  import { paramCase } from 'param-case';
6
6
  import { v4 } from 'uuid';
7
- import axios from 'axios';
7
+ import { fetch } from 'cross-undici-fetch';
8
8
  import { red, yellow, green, blue } from 'ansi-colors';
9
9
  import { dump } from 'js-yaml';
10
10
  import { writeFileSync } from 'fs';
@@ -230,7 +230,14 @@ class SubscriptionManager {
230
230
  }
231
231
  const { url } = this.clients.get(id);
232
232
  logger.info(`[Subscription] Trigger ${id}`);
233
- yield axios.post(url, result);
233
+ const response = yield fetch(url, {
234
+ method: 'POST',
235
+ body: JSON.stringify(result),
236
+ headers: {
237
+ 'Content-Type': 'application/json',
238
+ }
239
+ });
240
+ yield response.text();
234
241
  });
235
242
  }
236
243
  buildOperations() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sofa-api",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Create REST APIs with GraphQL",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -10,7 +10,7 @@
10
10
  "@graphql-tools/utils": "8.1.1",
11
11
  "@types/js-yaml": "4.0.2",
12
12
  "ansi-colors": "4.1.1",
13
- "axios": "0.21.1",
13
+ "cross-undici-fetch": "0.1.28",
14
14
  "js-yaml": "4.1.0",
15
15
  "param-case": "3.0.4",
16
16
  "title-case": "3.0.3",