bkper 3.2.1 → 3.3.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.
- package/README.md +97 -105
- package/lib/cli.js +11 -1
- package/lib/cli.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -32,8 +32,8 @@ yarn global add bkper
|
|
|
32
32
|
|
|
33
33
|
- ```login``` - Logs the user in. Saves the client credentials to a ```~/.bkper-credentials.json``` file.
|
|
34
34
|
- ```logout``` - Logs out the user by deleting client credentials.
|
|
35
|
-
- ```app -c``` - Create a new App based on ```./bkperapp.
|
|
36
|
-
- ```app -u``` - Update an existing App based on ```./bkperapp.
|
|
35
|
+
- ```app -c``` - Create a new App based on ```./bkperapp.yaml``` file.
|
|
36
|
+
- ```app -u``` - Update an existing App based on ```./bkperapp.yaml``` file.
|
|
37
37
|
|
|
38
38
|
### Examples
|
|
39
39
|
```
|
|
@@ -64,113 +64,93 @@ Follow [these](https://bkper.com/docs/#rest-api-enabling) steps in order to conf
|
|
|
64
64
|
> WARNING: Never upload variables to the source code repository.
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
### ```./bkperapp.
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
"
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
"keys": [
|
|
150
|
-
"key1",
|
|
151
|
-
"key2"
|
|
152
|
-
],
|
|
153
|
-
"values": [
|
|
154
|
-
"value2",
|
|
155
|
-
"value2"
|
|
156
|
-
]
|
|
157
|
-
},
|
|
158
|
-
"transaction": {
|
|
159
|
-
"keys": [
|
|
160
|
-
"key1",
|
|
161
|
-
"key2"
|
|
162
|
-
],
|
|
163
|
-
"values": [
|
|
164
|
-
"value2",
|
|
165
|
-
"value2"
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
67
|
+
### ```./bkperapp.yaml``` Reference
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
id: "The App agent id. It can NOT be changed after the App created."
|
|
71
|
+
name: "The name of the App or Bot."
|
|
72
|
+
logoUrl: "Set your logo url from public host. Best fit 200x200 px. Use https://"
|
|
73
|
+
|
|
74
|
+
# Context menu configuration
|
|
75
|
+
menuUrl: "The menu url to open in the popup window. See reference bellow."
|
|
76
|
+
menuUrlDev: "The menu url to open in the popup window, when opened by the developer user."
|
|
77
|
+
menuText: "The context menu call to action."
|
|
78
|
+
menuPopupWidth: 500 # width in pixels. Default to 80% of screen width.
|
|
79
|
+
menuPopupHeight: 300 # height in pixels. Default to 90% of screen height.
|
|
80
|
+
|
|
81
|
+
# Bot events configuration
|
|
82
|
+
events:
|
|
83
|
+
- "TRANSACTION_POSTED"
|
|
84
|
+
- "TRANSACTION_CHECKED"
|
|
85
|
+
- "TRANSACTION_UNCHECKED"
|
|
86
|
+
- "TRANSACTION_UPDATED"
|
|
87
|
+
- "TRANSACTION_DELETED"
|
|
88
|
+
- "TRANSACTION_RESTORED"
|
|
89
|
+
- "ACCOUNT_CREATED"
|
|
90
|
+
- "ACCOUNT_UPDATED"
|
|
91
|
+
- "ACCOUNT_DELETED"
|
|
92
|
+
- "GROUP_CREATED"
|
|
93
|
+
- "GROUP_UPDATED"
|
|
94
|
+
- "GROUP_DELETED"
|
|
95
|
+
- "FILE_CREATED"
|
|
96
|
+
- "BOOK_UPDATED"
|
|
97
|
+
|
|
98
|
+
filePatterns:
|
|
99
|
+
- "The file patterns the Bot is capable of process. It accepts wildcard. E.g."
|
|
100
|
+
- "radiusbank*.ofx"
|
|
101
|
+
- "-*.qif"
|
|
102
|
+
|
|
103
|
+
# Bot configuration only when additional scopes, other than email, is needed
|
|
104
|
+
# If not specified, a default valid token with the email scope is sent in the http header
|
|
105
|
+
clientId: "The Client ID from GCP project Web Application OAuth Credential"
|
|
106
|
+
scopes:
|
|
107
|
+
- "The Google OAuth scopes used. E.g."
|
|
108
|
+
- "https://www.googleapis.com/auth/userinfo.email"
|
|
109
|
+
- "https://www.googleapis.com/auth/script.external_request"
|
|
110
|
+
|
|
111
|
+
# Google Apps Script bot configuration
|
|
112
|
+
scriptId: "The Google Apps Script ID"
|
|
113
|
+
deploymentId: "The Google Apps Script API Deployment ID"
|
|
114
|
+
|
|
115
|
+
# Webhook bot configuration
|
|
116
|
+
webhookUrl: "The production webhook url"
|
|
117
|
+
webhookUrlDev: "The development webhook url"
|
|
118
|
+
|
|
119
|
+
# Schema to provide autocompletion
|
|
120
|
+
propertiesSchema:
|
|
121
|
+
book:
|
|
122
|
+
keys:
|
|
123
|
+
- "key1"
|
|
124
|
+
- "key2"
|
|
125
|
+
values:
|
|
126
|
+
- "value2"
|
|
127
|
+
- "value2"
|
|
128
|
+
group:
|
|
129
|
+
keys:
|
|
130
|
+
- "key1"
|
|
131
|
+
- "key2"
|
|
132
|
+
values:
|
|
133
|
+
- "value2"
|
|
134
|
+
- "value2"
|
|
135
|
+
account:
|
|
136
|
+
keys:
|
|
137
|
+
- "key1"
|
|
138
|
+
- "key2"
|
|
139
|
+
values:
|
|
140
|
+
- "value2"
|
|
141
|
+
- "value2"
|
|
142
|
+
transaction:
|
|
143
|
+
keys:
|
|
144
|
+
- "key1"
|
|
145
|
+
- "key2"
|
|
146
|
+
values:
|
|
147
|
+
- "value2"
|
|
148
|
+
- "value2"
|
|
170
149
|
|
|
171
150
|
```
|
|
172
151
|
|
|
173
152
|
#### Accepted expressions in menuUrl property:
|
|
153
|
+
|
|
174
154
|
- ```${book.id}``` - the current book id
|
|
175
155
|
- ```${book.properties.xxxxx}``` - any property value from the current book
|
|
176
156
|
- ```${transactions.query}``` - the current query being executed on transactions list
|
|
@@ -190,6 +170,18 @@ Follow [these](https://bkper.com/docs/#rest-api-enabling) steps in order to conf
|
|
|
190
170
|
|
|
191
171
|
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
|
|
192
172
|
|
|
173
|
+
Example:
|
|
174
|
+
|
|
175
|
+
```javascript
|
|
176
|
+
import { Bkper } from 'bkper-js';
|
|
177
|
+
import { getOAuthToken } from 'bkper';
|
|
178
|
+
|
|
179
|
+
Bkper.setConfig({
|
|
180
|
+
oauthTokenProvider: async () => getOAuthToken(),
|
|
181
|
+
})
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
|
|
193
185
|
|
|
194
186
|
## Documentation
|
|
195
187
|
|
package/lib/cli.js
CHANGED
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
import { App, Bkper } from 'bkper-js';
|
|
12
12
|
import program from 'commander';
|
|
13
13
|
import fs from 'fs';
|
|
14
|
+
import * as YAML from 'yaml';
|
|
14
15
|
import { getOAuthToken, login, logout } from './auth/local-auth-service.js';
|
|
15
16
|
import dotenv from 'dotenv';
|
|
16
17
|
dotenv.config();
|
|
@@ -37,7 +38,16 @@ program
|
|
|
37
38
|
apiKeyProvider: () => __awaiter(void 0, void 0, void 0, function* () { return process.env.BKPER_API_KEY || ''; }),
|
|
38
39
|
oauthTokenProvider: () => getOAuthToken()
|
|
39
40
|
});
|
|
40
|
-
|
|
41
|
+
let json;
|
|
42
|
+
if (fs.existsSync('./bkperapp.json')) {
|
|
43
|
+
json = JSON.parse(fs.readFileSync('./bkperapp.json', 'utf8'));
|
|
44
|
+
}
|
|
45
|
+
else if (fs.existsSync('./bkperapp.yaml')) {
|
|
46
|
+
json = YAML.parse(fs.readFileSync('./bkperapp.yaml', 'utf8'));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
throw new Error('bkperapp.json or bkperapp.yaml not found');
|
|
50
|
+
}
|
|
41
51
|
let app = new App(json)
|
|
42
52
|
.setReadme(fs.readFileSync('./README.md', 'utf8'))
|
|
43
53
|
.setClientSecret(process.env.BKPER_CLIENT_SECRET)
|
package/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAE5E,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,O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aAAa,EAAE,MAAM,CAAC,CAAC;aACjD,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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Node.js command line client for Bkper",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bkper": "./lib/cli.js"
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"bkper-js": "^1.1.0",
|
|
37
37
|
"commander": "^6.2.1",
|
|
38
38
|
"dotenv": "^8.2.0",
|
|
39
|
-
"google-auth-library": "^9.14.0"
|
|
39
|
+
"google-auth-library": "^9.14.0",
|
|
40
|
+
"yaml": "^2.5.1"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@bkper/bkper-api-types": "^5.9.0",
|