b-gsdk 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/fsevents.node +0 -0
- package/bin/index.js +165 -0
- package/bin/worker.js +35 -0
- package/package.json +6 -3
- package/src/index.ts +2 -0
- package/dist/index.js +0 -32
package/bin/worker.js
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
const fetch = require('node-fetch')
|
4
|
+
const shared = require('./shared')
|
5
|
+
const chunks = []
|
6
|
+
|
7
|
+
process.stdin.resume()
|
8
|
+
process.stdin.setEncoding('utf8')
|
9
|
+
|
10
|
+
process.stdin.on('data', function (chunk) {
|
11
|
+
chunks.push(chunk)
|
12
|
+
})
|
13
|
+
|
14
|
+
process.stdin.on('end', function () {
|
15
|
+
const input = JSON.parse(chunks.join(''))
|
16
|
+
const request = shared.deserializeRequest(fetch, ...input)
|
17
|
+
|
18
|
+
fetch(request)
|
19
|
+
.then(response => response.buffer()
|
20
|
+
.then(buffer => respond([
|
21
|
+
buffer.toString('base64'),
|
22
|
+
shared.serializeResponse(response)
|
23
|
+
]))
|
24
|
+
.catch(error => respond([
|
25
|
+
'',
|
26
|
+
shared.serializeResponse(response),
|
27
|
+
shared.serializeError(error)
|
28
|
+
]))
|
29
|
+
)
|
30
|
+
.catch(error => respond(shared.serializeError(error)))
|
31
|
+
})
|
32
|
+
|
33
|
+
function respond (message) {
|
34
|
+
console.log(JSON.stringify(message))
|
35
|
+
}
|
package/package.json
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "b-gsdk",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.2",
|
4
4
|
"description": "A GraphQL Codegen that outputs a TypeScript SDK.",
|
5
5
|
"author": "Julian Benegas",
|
6
6
|
"license": "MIT",
|
7
|
+
"main": "bin/index.js",
|
8
|
+
"bin": {
|
9
|
+
"b-gsdk": "./bin/index.js"
|
10
|
+
},
|
7
11
|
"dependencies": {
|
8
12
|
"@graphql-codegen/cli": "^2.6.2",
|
9
13
|
"@graphql-codegen/core": "^2.5.1",
|
@@ -27,8 +31,7 @@
|
|
27
31
|
"typescript": "^4.6.3"
|
28
32
|
},
|
29
33
|
"scripts": {
|
30
|
-
"build": "
|
31
|
-
"watch": "yarn build --watch",
|
34
|
+
"build": "ncc build ./src/index.ts -o bin --minify",
|
32
35
|
"generate": "ts-node ./src/index.ts"
|
33
36
|
}
|
34
37
|
}
|
package/src/index.ts
CHANGED
package/dist/index.js
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
-
var __export = (target, all) => {
|
6
|
-
for (var name in all)
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
-
};
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
-
for (let key of __getOwnPropNames(from))
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
-
}
|
15
|
-
return to;
|
16
|
-
};
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
-
|
19
|
-
// src/index.ts
|
20
|
-
var src_exports = {};
|
21
|
-
__export(src_exports, {
|
22
|
-
helloWorld: () => helloWorld
|
23
|
-
});
|
24
|
-
module.exports = __toCommonJS(src_exports);
|
25
|
-
var hey = "hola mundo";
|
26
|
-
function helloWorld() {
|
27
|
-
return hey + "ma";
|
28
|
-
}
|
29
|
-
// Annotate the CommonJS export names for ESM import in node:
|
30
|
-
0 && (module.exports = {
|
31
|
-
helloWorld
|
32
|
-
});
|