Skip to content

Commit

Permalink
Packages internal structure enhancement (#64)
Browse files Browse the repository at this point in the history
* remove redundant tsconfig files

* better internal handle Payper token

* changeset
  • Loading branch information
gilgardosh authored Sep 15, 2022
1 parent ba890e5 commit aa8acb3
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 355 deletions.
9 changes: 9 additions & 0 deletions .changeset/soft-turkeys-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@accounter-toolkit/green-invoice-graphql': patch
'@accounter-toolkit/hashavshevet-mesh': patch
'@accounter-toolkit/israeli-vat-scraper': patch
'@accounter-toolkit/payper-mesh': patch
'@accounter-toolkit/pcn874-generator': patch
---

Internal structure minor enhancement
2 changes: 1 addition & 1 deletion packages/green-invoice-graphql/.meshrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sources:
jsonSchema:
baseUrl: 'https://api.greeninvoice.co.il/api/v1'
operationHeaders:
Authorization: Bearer {env.GREEN_INVOICE_AUTH_TOKEN}
Authorization: Bearer {context.authToken}
Content-Type: application/json
operations:
- type: Mutation
Expand Down
2 changes: 1 addition & 1 deletion packages/green-invoice-graphql/dev-tests/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { config } from 'dotenv';
import fs from 'fs';
import { lookup } from 'mime-types';

import { init } from '..';
import { init } from '../src';

config();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getMeshSDK, Sdk } from './.mesh';
import { getMeshSDK, Sdk } from '../.mesh';

export const init = async (id: string, secret: string): Promise<{ sdk: Sdk }> => {
const authParams = {
Expand All @@ -13,11 +13,9 @@ export const init = async (id: string, secret: string): Promise<{ sdk: Sdk }> =>
.then(res => res.json())
.then((res: { token: string }) => res.token);

process.env.GREEN_INVOICE_AUTH_TOKEN = greenInvoiceToken;

const sdk = await getMeshSDK();
const sdk = await getMeshSDK({ authToken: greenInvoiceToken });

return { sdk };
};

export * from './.mesh';
export * from '../.mesh';
64 changes: 0 additions & 64 deletions packages/green-invoice-graphql/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/hashavshevet-mesh/dev-tests/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { config } from 'dotenv';

import { init } from '../';
import { init } from '../src';

config();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import https from 'https';

import { getBuiltMesh, getMeshSDK, Sdk } from './.mesh';
import { getBuiltMesh, getMeshSDK, Sdk } from '../.mesh';

type Awaited<T> = T extends PromiseLike<infer U> ? U : T;

Expand Down Expand Up @@ -56,4 +56,4 @@ const login = (hashavshevetKey: string, company: string, hashavshevetUrl: string
return p;
};

export * from './.mesh';
export * from '../.mesh';
64 changes: 0 additions & 64 deletions packages/hashavshevet-mesh/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/israeli-vat-scraper/dev-tests/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { config } from 'dotenv';
import { vatScraper } from '..';
import { vatScraper } from '../src';

config();

Expand Down
6 changes: 3 additions & 3 deletions packages/israeli-vat-scraper/src/handlers/login-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const _creds: UserCredentials = {

export const getEnvCredentials = (): UserCredentials => {
return {
vatNumber: process.env.VAT_NUM as string,
userCode: process.env.USER_CODE as string,
userPass: process.env.USER_PASS as string,
vatNumber: process.env['VAT_NUM'] as string,
userCode: process.env['USER_CODE'] as string,
userPass: process.env['USER_PASS'] as string,
};
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { config } from 'dotenv';
import { createRequire } from 'module';

import { getEnvCredentials, updateCredentials } from './src/handlers/login-handler.js';
import { homePageHandler } from './src/handlers/main-page-handler.js';
import { validateSchema } from './src/utils/schema-validator.js';
import type { Config, Report, UserCredentials } from './src/utils/types.js';
import { getEnvCredentials, updateCredentials } from './handlers/login-handler.js';
import { homePageHandler } from './handlers/main-page-handler.js';
import { validateSchema } from './utils/schema-validator.js';
import type { Config, Report, UserCredentials } from './utils/types.js';

config();

Expand Down
Loading

0 comments on commit aa8acb3

Please sign in to comment.