-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrepl.js
56 lines (51 loc) · 1.06 KB
/
repl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const { ACH } = require('./libs')
let client,
data,
files,
intents,
jobs,
offline,
settings,
auth,
fetchJSON,
token
const doctypes = process.env.DOCTYPES ? process.env.DOCTYPES.split(',') : []
const domain = process.env.COZY_URL || 'http://cozy.localhost:8080'
console.log(doctypes)
const ach = new ACH(
'/tmp/repl-ach.json',
domain,
doctypes.concat(['io.cozy.files', 'io.cozy.settings'])
)
const onConnection = () => {
client = ach.client
data = ach.oldClient.data
files = ach.oldClient.files
intents = ach.oldClient.intents
jobs = ach.oldClient.jobs
offline = ach.oldClient.offline
settings = ach.oldClient.settings
auth = ach.oldClient.auth
fetchJSON = ach.oldClient.fetchJSON
token = client._token.token
console.log('token', token)
console.log('Connected !')
}
const run = function() {
return ach
.connect()
.then(onConnection)
.then(() => ({
client,
data,
files,
intents,
jobs,
offline,
settings,
auth,
fetchJSON,
ach
}))
}
module.exports = run