UNPKG

green-invoice-graphql

Version:
42 lines 1.72 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.init = void 0; const _mesh_1 = require("../.mesh"); const node_fetch_1 = __importDefault(require("node-fetch")); const init = async (id, secret) => { console.log("initiating Green Invoice's sdk..."); const authParams = { id, secret, }; const greenInvoiceToken = await (0, node_fetch_1.default)('https://api.greeninvoice.co.il/api/v1/account/token', { method: 'POST', body: JSON.stringify(authParams), headers: { 'Content-Type': 'application/json' }, }) .then((res) => res.json()) .then((res) => res.token); process.env.GREEN_INVOICE_AUTH_TOKEN = greenInvoiceToken; const sdk = await (0, _mesh_1.getMeshSDK)(); return { sdk }; }; exports.init = init; __exportStar(require("../.mesh"), exports); //# sourceMappingURL=index.js.map