@open-xchange/soap-client 0.0.12 → 0.1.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/CHANGELOG.md +84 -0
- package/bin/provision.js +3 -2
- package/package.json +5 -6
- package/services/sharedAccount.js +18 -17
- package/soap.js +3 -2
- package/.env.default +0 -18
- package/example-provisioning.json +0 -55
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-03-15
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Replace chalk and dotenv with Node.js built-ins
|
|
12
|
+
- Clean up dependencies, packaging, and config files
|
|
13
|
+
|
|
14
|
+
## [0.0.12] - 2026-02-25
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Lazy-init SOAP clients to avoid WSDL fetches at import time
|
|
19
|
+
|
|
20
|
+
## [0.0.11] - 2026-02-24
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Support for shared accounts in e2e tests
|
|
25
|
+
|
|
26
|
+
## [0.0.10] - 2026-01-22
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Exponential backoff with jitter to SOAP client retries
|
|
31
|
+
|
|
32
|
+
## [0.0.9] - 2025-12-12
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- Update dependencies
|
|
37
|
+
|
|
38
|
+
## [0.0.8] - 2025-09-30
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- Unhandled rejection timeout errors in soap-client
|
|
43
|
+
|
|
44
|
+
## [0.0.7] - 2025-09-12
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- Set access combination when provisioning
|
|
49
|
+
|
|
50
|
+
## [0.0.6] - 2025-09-02
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- Correctly identify already existing users when provisioning
|
|
55
|
+
|
|
56
|
+
## [0.0.5] - 2025-08-18
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
60
|
+
- Update provisioning script
|
|
61
|
+
|
|
62
|
+
## [0.0.4] - 2025-07-28
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
- Increase SOAP client timeout
|
|
67
|
+
|
|
68
|
+
## [0.0.3] - 2025-07-18
|
|
69
|
+
|
|
70
|
+
### Removed
|
|
71
|
+
|
|
72
|
+
- Secondary account service from reseller
|
|
73
|
+
|
|
74
|
+
## [0.0.2] - 2025-07-18
|
|
75
|
+
|
|
76
|
+
### Changed
|
|
77
|
+
|
|
78
|
+
- Update dependencies
|
|
79
|
+
|
|
80
|
+
## [0.0.1] - 2025-02-28
|
|
81
|
+
|
|
82
|
+
### Added
|
|
83
|
+
|
|
84
|
+
- Initial release: extract SOAP client into its own library
|
package/bin/provision.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import fs from 'node:fs'
|
|
3
3
|
import { program } from 'commander'
|
|
4
|
-
import dotenv from 'dotenv'
|
|
5
4
|
import * as secondaryAccountService from '../services/secondaryAccount.js'
|
|
6
5
|
import * as userService from '../services/common/user.js'
|
|
7
6
|
import * as contextService from '../services/common/context.js'
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
for (const envFile of ['.env', '.env.defaults']) {
|
|
9
|
+
try { process.loadEnvFile(envFile) } catch {}
|
|
10
|
+
}
|
|
10
11
|
|
|
11
12
|
const contextAdmin = {
|
|
12
13
|
admin: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-xchange/soap-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "SOAP client for OX App Suite",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,13 +20,12 @@
|
|
|
20
20
|
"author": "",
|
|
21
21
|
"license": "AGPL-3.0-or-later",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"commander": "^14.0.
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"soap": "^1.6.1"
|
|
23
|
+
"commander": "^14.0.3",
|
|
24
|
+
"p-retry": "^8.0.0",
|
|
25
|
+
"soap": "^1.8.0"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
|
-
"@open-xchange/lint": "0.
|
|
28
|
+
"@open-xchange/lint": "0.3.0"
|
|
30
29
|
},
|
|
31
30
|
"scripts": {
|
|
32
31
|
"lint": "eslint .",
|
|
@@ -47,23 +47,24 @@ export async function create (context, sharedAccountData) {
|
|
|
47
47
|
*
|
|
48
48
|
* @param {Object} context - The context of the users and groups
|
|
49
49
|
* @param {Object} sharedAccountContext - The context of the shared account
|
|
50
|
-
* @param {
|
|
51
|
-
* @param {Object}
|
|
52
|
-
* @param {Object} calendarConfig - The calendar configuration (permissionLevel, grantedCapability, deniedCapability)
|
|
53
|
-
* @param {Object[]} users - The users to be added to the shared account
|
|
54
|
-
* @param {Object[]} groups - The groups to be added to the shared account
|
|
50
|
+
* @param {number} sharedAccountId - ID of the shared account
|
|
51
|
+
* @param {Object} permissions - The users, groups, capabilities, and module-specific permissions.
|
|
55
52
|
* @returns {Promise<Object>} The shared account object
|
|
56
53
|
* @throws {Error} If the creation of the shared account permissions fails
|
|
57
54
|
*/
|
|
58
|
-
export async function createSharedAccountPermissions (context, sharedAccountContext,
|
|
55
|
+
export async function createSharedAccountPermissions (context, sharedAccountContext, sharedAccountId, permissions) {
|
|
59
56
|
return (await getClient()).createSharedAccountPermissionsAsync({
|
|
60
57
|
ctx: { id: context.id },
|
|
61
|
-
groups,
|
|
62
|
-
users: users.map(user => { return { id: user.userdata.id } }),
|
|
63
|
-
mailConfig,
|
|
64
|
-
calendarConfig,
|
|
65
58
|
sharedAccountCtx: { id: sharedAccountContext.id },
|
|
66
|
-
sharedAccount: { id:
|
|
59
|
+
sharedAccount: { id: sharedAccountId },
|
|
60
|
+
groups: permissions.groups ?? [],
|
|
61
|
+
users: permissions.users?.map(user => ({ id: user.userdata.id })) ?? [],
|
|
62
|
+
capabilities: {
|
|
63
|
+
grantedCapability: permissions.capabilities?.grantedCapability ?? [],
|
|
64
|
+
deniedCapability: permissions.capabilities?.deniedCapability ?? [],
|
|
65
|
+
},
|
|
66
|
+
mailConfig: permissions.mailConfig,
|
|
67
|
+
calendarConfig: permissions.calendarConfig,
|
|
67
68
|
auth: context.admin
|
|
68
69
|
})
|
|
69
70
|
}
|
|
@@ -87,13 +88,13 @@ export async function list (context, pattern = '*') {
|
|
|
87
88
|
* Get all data of a specified shared account in the specified context
|
|
88
89
|
*
|
|
89
90
|
* @param {*} context - The context where the shared account exists
|
|
90
|
-
* @param {
|
|
91
|
+
* @param {number} sharedAccountId - ID of the requested shared account
|
|
91
92
|
* @returns {Promise<Object>} The shared account object
|
|
92
93
|
*/
|
|
93
|
-
export async function getData (context,
|
|
94
|
+
export async function getData (context, sharedAccountId) {
|
|
94
95
|
return (await getClient()).getDataAsync({
|
|
95
96
|
ctx: { id: context.id },
|
|
96
|
-
sharedAccount: { id:
|
|
97
|
+
sharedAccount: { id: sharedAccountId },
|
|
97
98
|
auth: context.admin
|
|
98
99
|
})
|
|
99
100
|
}
|
|
@@ -102,13 +103,13 @@ export async function getData (context, sharedAccountData) {
|
|
|
102
103
|
* Remove a specified shared account in the specified context
|
|
103
104
|
*
|
|
104
105
|
* @param {*} context - The context object where the account will be removed
|
|
105
|
-
* @param {
|
|
106
|
+
* @param {number} sharedAccountId - ID of the shared account to be removed
|
|
106
107
|
* @returns {Promise<void>}
|
|
107
108
|
*/
|
|
108
|
-
export async function remove (context,
|
|
109
|
+
export async function remove (context, sharedAccountId) {
|
|
109
110
|
return (await getClient()).deleteAsync({
|
|
110
111
|
ctx: { id: context.id },
|
|
111
|
-
sharedAccount: { id:
|
|
112
|
+
sharedAccount: { id: sharedAccountId },
|
|
112
113
|
auth: context.admin
|
|
113
114
|
})
|
|
114
115
|
}
|
package/soap.js
CHANGED
|
@@ -20,13 +20,14 @@
|
|
|
20
20
|
|
|
21
21
|
import { performance, PerformanceObserver } from 'node:perf_hooks'
|
|
22
22
|
import * as SOAP from 'soap'
|
|
23
|
-
import dotenv from 'dotenv'
|
|
24
23
|
import pRetry, { AbortError as RetryAbortError } from 'p-retry'
|
|
25
24
|
|
|
26
25
|
// Set AbortError correctly
|
|
27
26
|
const AbortError = RetryAbortError
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
for (const envFile of ['.env', '.env.defaults']) {
|
|
29
|
+
try { process.loadEnvFile(envFile) } catch {}
|
|
30
|
+
}
|
|
30
31
|
|
|
31
32
|
// This flag enables debug output including timing information.
|
|
32
33
|
const debug = process.env.DEBUG_SOAP === 'true'
|
package/.env.default
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# URL to the App Suite Middleware for e2e-provisioning via SOAP
|
|
2
|
-
PROVISIONING_URL=https://appsuite-main.dev.oxui.de/
|
|
3
|
-
|
|
4
|
-
# URL to the App Suite UI for e2e-tests
|
|
5
|
-
LAUNCH_URL=https://core-ui-main.dev.oxui.de
|
|
6
|
-
|
|
7
|
-
# admin credentials for e2e middleware
|
|
8
|
-
E2E_ADMIN_USER=
|
|
9
|
-
E2E_ADMIN_PW=
|
|
10
|
-
|
|
11
|
-
# Flag to enable/disable debug output for SOAP requests
|
|
12
|
-
DEBUG_SOAP=false
|
|
13
|
-
|
|
14
|
-
MX_DOMAIN=box.ox.io
|
|
15
|
-
|
|
16
|
-
PROVSIONING_API=common
|
|
17
|
-
|
|
18
|
-
DOTENV_CONFIG_QUIET=true
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"contexts": [
|
|
3
|
-
{
|
|
4
|
-
"data": {
|
|
5
|
-
"name": "test",
|
|
6
|
-
"capabilities": "switchboard,ai-service,spreadsheet,text,document_preview,presentation,presenter,remote_presenter",
|
|
7
|
-
"config": {
|
|
8
|
-
"entries": [{
|
|
9
|
-
"key": "config",
|
|
10
|
-
"value": {
|
|
11
|
-
"entries": [
|
|
12
|
-
{ "key": "io.ox/core//ai/openai/useAzure", "value": "false" }
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
}]
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"users": [
|
|
19
|
-
{
|
|
20
|
-
"name": "testuser",
|
|
21
|
-
"primaryEmail": "testuser-123@box.ox.io",
|
|
22
|
-
"display_name": "Test User",
|
|
23
|
-
"imapLogin": "testuser-123",
|
|
24
|
-
"imapServer": "main-dovecot",
|
|
25
|
-
"smtpServer": "main-postfix",
|
|
26
|
-
"email1": "testuser-123@box.ox.io",
|
|
27
|
-
"password": "secret",
|
|
28
|
-
"sur_name": "User",
|
|
29
|
-
"given_name": "Test"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"name": "testuser124",
|
|
33
|
-
"primaryEmail": "testuser-124@box.ox.io",
|
|
34
|
-
"display_name": "Test User",
|
|
35
|
-
"imapLogin": "testuser-124",
|
|
36
|
-
"imapServer": "main-dovecot",
|
|
37
|
-
"smtpServer": "main-postfix",
|
|
38
|
-
"email1": "testuser-124@box.ox.io",
|
|
39
|
-
"password": "secret",
|
|
40
|
-
"sur_name": "User",
|
|
41
|
-
"given_name": "Test124"
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
"secondaryAccount":
|
|
45
|
-
{
|
|
46
|
-
"name": "info123",
|
|
47
|
-
"login": "info123@box.ox.io",
|
|
48
|
-
"primaryAddress": "info123@box.ox.io",
|
|
49
|
-
"mailEndpointSource": "primary",
|
|
50
|
-
"transportEndpointSource": "primary",
|
|
51
|
-
"personal": "Info 123"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
}
|