bkper 3.1.0 → 3.2.0

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/README.md CHANGED
@@ -175,9 +175,12 @@ You can add a ```.env``` file at the root of your project with those variables a
175
175
  "menuUrl": "https://app.bkper.com/b/#transactions:bookId=${book.id}"
176
176
  ```
177
177
 
178
+ #### Library
179
+
180
+ The ```getOAuthToken``` returns a Promise that resolves to a valid OAuth token, to be used by the [```bkper-js```](https://github.com/bkper/bkper-js) library
181
+
178
182
 
179
183
  ## Documentation
180
184
 
181
185
  - [Developer Docs](https://bkper.com/docs)
182
- - [API Reference](https://bkper.com/docs/bkper-node/)
183
186
 
@@ -0,0 +1,12 @@
1
+ {
2
+ "installed": {
3
+ "client_id": "360398463400-l3sfmb1tipagc7bfh4tf2eptu1b62g7c.apps.googleusercontent.com",
4
+ "auth_uri": "https://accounts.google.com/o/oauth2/auth",
5
+ "token_uri": "https://oauth2.googleapis.com/token",
6
+ "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
7
+ "client_secret": "iQ87o7Y9xks1T0tKC7qmhnPw",
8
+ "redirect_uris": [
9
+ "http://localhost:3000/oauth2callback"
10
+ ]
11
+ }
12
+ }
@@ -0,0 +1,8 @@
1
+ export declare function login(): Promise<void>;
2
+ export declare function logout(): void;
3
+ export declare function isLoggedIn(): boolean;
4
+ /**
5
+ * @returns A promise that resolves to a valid OAuth token.
6
+ */
7
+ export declare function getOAuthToken(): Promise<string>;
8
+ //# sourceMappingURL=local-auth-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-auth-service.d.ts","sourceRoot":"","sources":["../../src/auth/local-auth-service.ts"],"names":[],"mappings":"AAyBA,wBAAsB,KAAK,kBAK1B;AAED,wBAAgB,MAAM,SAKrB;AAED,wBAAgB,UAAU,YAEzB;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CA8BnD"}
@@ -0,0 +1,78 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { authenticate } from '@google-cloud/local-auth';
11
+ import fs from 'fs';
12
+ import { OAuth2Client } from "google-auth-library";
13
+ import os from 'os';
14
+ import { createRequire } from "module";
15
+ import { fileURLToPath } from 'url';
16
+ import path from 'path';
17
+ const require = createRequire(import.meta.url);
18
+ const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
19
+ const __dirname = path.dirname(__filename); // get the name of the directory
20
+ const keys = require(`${__dirname}/keys.json`);
21
+ let storedCredentials;
22
+ const storedCredentialsPath = `${os.homedir}/.bkper-credentials.json`;
23
+ try {
24
+ let credentialsJson = fs.readFileSync(storedCredentialsPath, 'utf8');
25
+ storedCredentials = JSON.parse(credentialsJson);
26
+ }
27
+ catch (err) {
28
+ console.log('No local credentials found.');
29
+ }
30
+ export function login() {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ if (storedCredentials) {
33
+ console.log('Bkper already logged in.');
34
+ }
35
+ yield getOAuthToken();
36
+ });
37
+ }
38
+ export function logout() {
39
+ if (fs.existsSync(storedCredentialsPath)) {
40
+ fs.rmSync(storedCredentialsPath);
41
+ }
42
+ console.log('Bkper logged out.');
43
+ }
44
+ export function isLoggedIn() {
45
+ return storedCredentials != null;
46
+ }
47
+ /**
48
+ * @returns A promise that resolves to a valid OAuth token.
49
+ */
50
+ export function getOAuthToken() {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ let localAuth;
53
+ if (storedCredentials) {
54
+ localAuth = new OAuth2Client(keys.installed.client_id, keys.installed.client_secret, keys.installed.redirect_uris[0]);
55
+ localAuth.setCredentials(storedCredentials);
56
+ }
57
+ else {
58
+ localAuth = yield authenticate({
59
+ scopes: ['https://www.googleapis.com/auth/userinfo.email'],
60
+ keyfilePath: `${__dirname}/keys.json`,
61
+ });
62
+ storeCredentials(localAuth.credentials);
63
+ }
64
+ localAuth.on('tokens', (tokens) => {
65
+ if (tokens.refresh_token) {
66
+ // store the refresh_token in my database!
67
+ storeCredentials(tokens);
68
+ }
69
+ });
70
+ let token = yield localAuth.getAccessToken();
71
+ return token.token || '';
72
+ });
73
+ }
74
+ function storeCredentials(credentials) {
75
+ storedCredentials = credentials;
76
+ fs.writeFileSync(storedCredentialsPath, JSON.stringify(credentials, null, 4), 'utf8');
77
+ }
78
+ //# sourceMappingURL=local-auth-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-auth-service.js","sourceRoot":"","sources":["../../src/auth/local-auth-service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAQ,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,oCAAoC;AACvF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,gCAAgC;AAE5E,MAAM,IAAI,G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AC;gBAC7B,MAAM,EAAE,CAAC,gDAAgD,CAAC;gBAC1D,WAAW,EAAE,GAAG,SAAS,YAAY;aACtC,CAAC,CAAC;YACH,gBAAgB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC1C,CAAC;QAED,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;YAChC,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;gBACzB,0CAA0C;gBAC1C,gBAAgB,CAAC,MAAM,CAAC,CAAA;YAC1B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,KAAK,GAAG,MAAM,SAAS,CAAC,cAAc,EAAE,CAAC;QAE7C,OAAO,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;IAE3B,CAAC;CAAA;AAED,SAAS,gBAAgB,CAAC,WAAwB;IAChD,iBAAiB,GAAG,WAAW,CAAC;IAChC,EAAE,CAAC,aAAa,CAAC,qBAAqB,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACxF,CAAC"}
package/lib/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/lib/cli.js ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { App, Bkper } from 'bkper-js';
12
+ import program from 'commander';
13
+ import fs from 'fs';
14
+ import { getOAuthToken, login, logout } from './auth/local-auth-service.js';
15
+ import dotenv from 'dotenv';
16
+ dotenv.config();
17
+ program
18
+ .command('login')
19
+ .description('Login Bkper')
20
+ .action(() => __awaiter(void 0, void 0, void 0, function* () {
21
+ yield login();
22
+ }));
23
+ program
24
+ .command('logout')
25
+ .description('Logout Bkper')
26
+ .action((todo) => {
27
+ logout();
28
+ });
29
+ program
30
+ .command('app')
31
+ .description('Create/Update an App')
32
+ .option('-u, --update', 'Update the App')
33
+ .option('-c, --create', 'Create a new App')
34
+ .action((options) => __awaiter(void 0, void 0, void 0, function* () {
35
+ try {
36
+ Bkper.setConfig({
37
+ apiKeyProvider: () => __awaiter(void 0, void 0, void 0, function* () { return process.env.BKPER_API_KEY || ''; }),
38
+ oauthTokenProvider: () => getOAuthToken()
39
+ });
40
+ const json = JSON.parse(fs.readFileSync('./bkperapp.json', 'utf8'));
41
+ let app = new App(json)
42
+ .setReadme(fs.readFileSync('./README.md', 'utf8'))
43
+ .setClientSecret(process.env.BKPER_CLIENT_SECRET)
44
+ .setDeveloperEmail(process.env.BKPER_DEVELOPER_EMAIL)
45
+ .setUserEmails(process.env.BKPER_USER_EMAILS);
46
+ if (options.update) {
47
+ app = yield app.update();
48
+ console.log(`Updated ${app.getId()} sucessfully.`);
49
+ }
50
+ else if (options.create) {
51
+ app = yield app.create();
52
+ console.log(`Created ${app.getId()} sucessfully.`);
53
+ }
54
+ }
55
+ catch (err) {
56
+ console.log(err);
57
+ }
58
+ }));
59
+ program.parse(process.argv);
60
+ //# sourceMappingURL=cli.js.map
package/lib/cli.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,EAAE,GAAG,EAAE,KAAK,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jD,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;aAChD,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;aACpD,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAChD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,GAAG,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,KAAK,EAAE,eAAe,CAAC,CAAA;QACpD,CAAC;aAAM,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YAC1B,GAAG,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,KAAK,EAAE,eAAe,CAAC,CAAA;QAEpD,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAClB,CAAC;AAEH,CAAC,CAAA,CAAC,CAAC;AAGL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { getOAuthToken } from './auth/local-auth-service.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { getOAuthToken } from './auth/local-auth-service.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Node.js command line client for Bkper",
5
5
  "bin": {
6
6
  "bkper": "./lib/cli.js"
@@ -14,6 +14,9 @@
14
14
  "module": "./lib/index.js",
15
15
  "types": "./lib/index.d.ts",
16
16
  "type": "module",
17
+ "files": [
18
+ "lib/**/*"
19
+ ],
17
20
  "scripts": {
18
21
  "clean": "rm -rf ./lib & rm -rf ./node_modules & wait",
19
22
  "prebuild": "bun install",
package/bun.lockb DELETED
Binary file
@@ -1,12 +0,0 @@
1
- {
2
- "installed": {
3
- "client_id": "360398463400-l3sfmb1tipagc7bfh4tf2eptu1b62g7c.apps.googleusercontent.com",
4
- "auth_uri": "https://accounts.google.com/o/oauth2/auth",
5
- "token_uri": "https://oauth2.googleapis.com/token",
6
- "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
7
- "client_secret": "iQ87o7Y9xks1T0tKC7qmhnPw",
8
- "redirect_uris": [
9
- "http://localhost:3000/oauth2callback"
10
- ]
11
- }
12
- }
@@ -1,79 +0,0 @@
1
- import {authenticate} from '@google-cloud/local-auth';
2
- import fs from 'fs';
3
- import { Credentials, OAuth2Client } from "google-auth-library";
4
- import os from 'os';
5
- import { createRequire } from "module";
6
- import { fileURLToPath } from 'url';
7
- import path from 'path';
8
-
9
- const require = createRequire(import.meta.url);
10
- const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
11
- const __dirname = path.dirname(__filename); // get the name of the directory
12
-
13
- const keys = require(`${__dirname}/keys.json`);
14
-
15
- let storedCredentials: Credentials;
16
-
17
- const storedCredentialsPath = `${os.homedir}/.bkper-credentials.json`;
18
-
19
- try {
20
- let credentialsJson = fs.readFileSync(storedCredentialsPath, 'utf8');
21
- storedCredentials = JSON.parse(credentialsJson);
22
- } catch (err) {
23
- console.log('No local credentials found.');
24
- }
25
-
26
- export async function login() {
27
- if (storedCredentials) {
28
- console.log('Bkper already logged in.');
29
- }
30
- await getOAuthToken();
31
- }
32
-
33
- export function logout() {
34
- if (fs.existsSync(storedCredentialsPath)) {
35
- fs.rmSync(storedCredentialsPath);
36
- }
37
- console.log('Bkper logged out.');
38
- }
39
-
40
- export function isLoggedIn() {
41
- return storedCredentials != null;
42
- }
43
-
44
- export async function getOAuthToken(): Promise<string> {
45
-
46
- let localAuth: OAuth2Client
47
-
48
- if (storedCredentials) {
49
- localAuth = new OAuth2Client(
50
- keys.installed.client_id,
51
- keys.installed.client_secret,
52
- keys.installed.redirect_uris[0]
53
- );
54
- localAuth.setCredentials(storedCredentials);
55
- } else {
56
- localAuth = await authenticate({
57
- scopes: ['https://www.googleapis.com/auth/userinfo.email'],
58
- keyfilePath: `${__dirname}/keys.json`,
59
- });
60
- storeCredentials(localAuth.credentials);
61
- }
62
-
63
- localAuth.on('tokens', (tokens) => {
64
- if (tokens.refresh_token) {
65
- // store the refresh_token in my database!
66
- storeCredentials(tokens)
67
- }
68
- });
69
-
70
- let token = await localAuth.getAccessToken();
71
-
72
- return token.token || '';
73
-
74
- }
75
-
76
- function storeCredentials(credentials: Credentials) {
77
- storedCredentials = credentials;
78
- fs.writeFileSync(storedCredentialsPath, JSON.stringify(credentials, null, 4), 'utf8');
79
- }
package/src/cli.ts DELETED
@@ -1,53 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { App, Bkper } from 'bkper-js';
4
- import program from 'commander';
5
- import fs from 'fs';
6
- import { login, logout } from './auth/local-auth-service.js';
7
- import { getBkperLocalConfig } from './index.js';
8
-
9
- program
10
- .command('login')
11
- .description('Login Bkper')
12
- .action(async () => {
13
- await login()
14
- });
15
-
16
- program
17
- .command('logout')
18
- .description('Logout Bkper')
19
- .action((todo) => {
20
- logout()
21
- });
22
-
23
- program
24
- .command('app')
25
- .description('Create/Update an App')
26
- .option('-u, --update', 'Update the App')
27
- .option('-c, --create', 'Create a new App')
28
- .action(async (options) => {
29
-
30
- try {
31
- Bkper.setConfig(getBkperLocalConfig())
32
- const json: bkper.App = JSON.parse(fs.readFileSync('./bkperapp.json', 'utf8'));
33
- let app = new App(json)
34
- .setReadme(fs.readFileSync('./README.md', 'utf8'))
35
- .setClientSecret(process.env.BKPER_CLIENT_SECRET)
36
- .setDeveloperEmail(process.env.BKPER_DEVELOPER_EMAIL)
37
- .setUserEmails(process.env.BKPER_USER_EMAILS);
38
- if (options.update) {
39
- app = await app.update();
40
- console.log(`Updated ${app.getId()} sucessfully.`)
41
- } else if (options.create) {
42
- app = await app.create();
43
- console.log(`Created ${app.getId()} sucessfully.`)
44
-
45
- }
46
- } catch (err) {
47
- console.log(err)
48
- }
49
-
50
- });
51
-
52
-
53
- program.parse(process.argv);
package/src/index.ts DELETED
@@ -1,11 +0,0 @@
1
- import { Config } from 'bkper-js';
2
- import { getOAuthToken } from './auth/local-auth-service.js';
3
- import dotenv from 'dotenv';
4
- dotenv.config()
5
-
6
- export function getBkperLocalConfig(): Config {
7
- return {
8
- apiKeyProvider: async () => process.env.BKPER_API_KEY || '',
9
- oauthTokenProvider: () => getOAuthToken()
10
- }
11
- }
package/tsconfig.json DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "extends": "./node_modules/gts/tsconfig-google.json",
3
- "compilerOptions": {
4
- "rootDir": "src",
5
- "outDir": "lib",
6
- "module": "ESNext",
7
- "moduleResolution": "Node",
8
- "resolveJsonModule": true,
9
- "typeRoots" : ["node_modules/@bkper", "node_modules/@types" ],
10
- "strict": true,
11
- "esModuleInterop": true,
12
- "target": "es2015",
13
- "declaration": true,
14
- "sourceMap": true,
15
- "declarationMap": true
16
- },
17
- "include": [
18
- "src/**/*.json",
19
- "src/**/*.ts",
20
- "test/**/*.ts"
21
- ],
22
- "exclude": [
23
- "./test/",
24
- "./node_modules/",
25
- "./lib/"
26
- ]
27
- }