@open-xchange/soap-client 0.0.3 → 0.0.5
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/bin/provision.js +10 -4
- package/package.json +3 -3
- package/soap.js +1 -1
package/bin/provision.js
CHANGED
|
@@ -12,13 +12,12 @@ dotenv.config({ path: '.env.defaults' })
|
|
|
12
12
|
const contextAdmin = {
|
|
13
13
|
admin: {
|
|
14
14
|
name: 'oxadmin',
|
|
15
|
-
password: 'secret',
|
|
15
|
+
password: process.env.CONTEXT_ADMIN_PW || 'secret',
|
|
16
16
|
display_name: 'context admin',
|
|
17
17
|
sur_name: 'admin',
|
|
18
18
|
given_name: 'context',
|
|
19
19
|
email1: `oxadmin@${process.env.MX_DOMAIN}`,
|
|
20
20
|
primaryEmail: `oxadmin@${process.env.MX_DOMAIN}`,
|
|
21
|
-
login: 'oxadmin'
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
|
|
@@ -46,11 +45,11 @@ async function getOrCreateContext (data) {
|
|
|
46
45
|
context = existingContext[0]
|
|
47
46
|
} else {
|
|
48
47
|
console.log('Creating new context')
|
|
49
|
-
context = await contextService.create(contextData)
|
|
48
|
+
context = await contextService.create(contextData, contextAdmin.admin)
|
|
50
49
|
}
|
|
51
50
|
return {
|
|
52
51
|
...context,
|
|
53
|
-
admin: data.admin || contextAdmin.admin
|
|
52
|
+
admin: data.admin || { ...contextAdmin.admin, login: contextAdmin.admin.name }
|
|
54
53
|
}
|
|
55
54
|
} catch (error) {
|
|
56
55
|
console.error('Error in context operation:', error)
|
|
@@ -66,6 +65,13 @@ async function getOrCreateUser (context, userData) {
|
|
|
66
65
|
return existingUser[0]
|
|
67
66
|
}
|
|
68
67
|
console.log('Creating new user')
|
|
68
|
+
userData = {
|
|
69
|
+
imapServer: process.env.IMAP_SERVER || 'main-dovecot',
|
|
70
|
+
smtpServer: process.env.SMTP_SERVER || 'main-postfix',
|
|
71
|
+
imapLogin: userData.name,
|
|
72
|
+
email1: userData.primaryEmail,
|
|
73
|
+
...userData,
|
|
74
|
+
}
|
|
69
75
|
return await userService.create(context, userData)
|
|
70
76
|
} catch (error) {
|
|
71
77
|
console.error('Error in user operation:', error)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-xchange/soap-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "SOAP client for OX App Suite",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"license": "AGPL-3.0-or-later",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"commander": "^14.0.0",
|
|
24
|
-
"dotenv": "^17.2.
|
|
24
|
+
"dotenv": "^17.2.1",
|
|
25
25
|
"p-retry": "^6.2.1",
|
|
26
|
-
"soap": "^1.
|
|
26
|
+
"soap": "^1.3.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@open-xchange/lint": "0.2.0"
|
package/soap.js
CHANGED
|
@@ -144,7 +144,7 @@ async function createClientAsync (type) {
|
|
|
144
144
|
soapOptions.auth = { login: soapOptions.auth.login, password: soapOptions.auth.password }
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
const result = await pRetry(() => origMethod.apply(this, [soapOptions, { timeout:
|
|
147
|
+
const result = await pRetry(() => origMethod.apply(this, [soapOptions, { timeout: 30000, ...clientOptions }, ...args]), {
|
|
148
148
|
retries: 3,
|
|
149
149
|
onFailedAttempt: async error => {
|
|
150
150
|
if (shouldAbortRetry(error)) throw new AbortError(error)
|