@xiboplayer/xmds 0.4.8 → 0.5.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/package.json +2 -2
- package/src/rest-client.js +1 -1
- package/src/xmds-client.js +1 -1
- package/src/xmds.rest.integration.test.js +6 -6
- package/src/xmds.rest.test.js +3 -3
- package/src/xmds.test.js +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiboplayer/xmds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "XMDS SOAP client for Xibo CMS communication",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"./xmds": "./src/xmds.js"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@xiboplayer/utils": "0.
|
|
12
|
+
"@xiboplayer/utils": "0.5.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"vitest": "^2.0.0"
|
package/src/rest-client.js
CHANGED
|
@@ -31,7 +31,7 @@ export class RestClient {
|
|
|
31
31
|
* Falls back to /pwa path relative to the CMS address.
|
|
32
32
|
*/
|
|
33
33
|
getRestBaseUrl() {
|
|
34
|
-
const base = this.config.restApiUrl || `${this.config.
|
|
34
|
+
const base = this.config.restApiUrl || `${this.config.cmsUrl}/pwa`;
|
|
35
35
|
return base.replace(/\/+$/, '');
|
|
36
36
|
}
|
|
37
37
|
|
package/src/xmds-client.js
CHANGED
|
@@ -72,7 +72,7 @@ export class XmdsClient {
|
|
|
72
72
|
* Call XMDS SOAP method
|
|
73
73
|
*/
|
|
74
74
|
async call(method, params = {}) {
|
|
75
|
-
const xmdsUrl = this.rewriteXmdsUrl(this.config.
|
|
75
|
+
const xmdsUrl = this.rewriteXmdsUrl(this.config.cmsUrl);
|
|
76
76
|
const url = `${xmdsUrl}${xmdsUrl.includes('?') ? '&' : '?'}v=${this.schemaVersion}&method=${method}`;
|
|
77
77
|
const body = this.buildEnvelope(method, params);
|
|
78
78
|
|
|
@@ -48,7 +48,7 @@ describe.skipIf(SKIP)('XMDS REST API — Live Integration', () => {
|
|
|
48
48
|
|
|
49
49
|
// REST client
|
|
50
50
|
client = new RestClient({
|
|
51
|
-
|
|
51
|
+
cmsUrl: CMS_URL,
|
|
52
52
|
cmsKey: CMS_KEY,
|
|
53
53
|
hardwareKey: HARDWARE_KEY,
|
|
54
54
|
displayName: DISPLAY_NAME,
|
|
@@ -58,7 +58,7 @@ describe.skipIf(SKIP)('XMDS REST API — Live Integration', () => {
|
|
|
58
58
|
|
|
59
59
|
// SOAP client for parity comparison
|
|
60
60
|
soapClient = new XmdsClient({
|
|
61
|
-
|
|
61
|
+
cmsUrl: CMS_URL,
|
|
62
62
|
cmsKey: CMS_KEY,
|
|
63
63
|
hardwareKey: HARDWARE_KEY,
|
|
64
64
|
displayName: DISPLAY_NAME,
|
|
@@ -111,7 +111,7 @@ describe.skipIf(SKIP)('XMDS REST API — Live Integration', () => {
|
|
|
111
111
|
|
|
112
112
|
it('should fail gracefully with wrong server key', async () => {
|
|
113
113
|
const badClient = new RestClient({
|
|
114
|
-
|
|
114
|
+
cmsUrl: CMS_URL,
|
|
115
115
|
cmsKey: 'wrong-key',
|
|
116
116
|
hardwareKey: HARDWARE_KEY,
|
|
117
117
|
displayName: DISPLAY_NAME,
|
|
@@ -440,7 +440,7 @@ describe.skipIf(SKIP)('XMDS REST API — Live Integration', () => {
|
|
|
440
440
|
it('should execute the complete player boot sequence via REST', async () => {
|
|
441
441
|
// Fresh client with no cache
|
|
442
442
|
const bootClient = new RestClient({
|
|
443
|
-
|
|
443
|
+
cmsUrl: CMS_URL,
|
|
444
444
|
cmsKey: CMS_KEY,
|
|
445
445
|
hardwareKey: HARDWARE_KEY,
|
|
446
446
|
displayName: 'Boot Sequence Test',
|
|
@@ -590,7 +590,7 @@ describe.skipIf(SKIP)('XMDS REST API — Live Integration', () => {
|
|
|
590
590
|
describe('Error Handling', () => {
|
|
591
591
|
it('should handle invalid hardware key gracefully', async () => {
|
|
592
592
|
const badClient = new RestClient({
|
|
593
|
-
|
|
593
|
+
cmsUrl: CMS_URL,
|
|
594
594
|
cmsKey: CMS_KEY,
|
|
595
595
|
hardwareKey: 'nonexistent-display',
|
|
596
596
|
displayName: 'Bad Display',
|
|
@@ -610,7 +610,7 @@ describe.skipIf(SKIP)('XMDS REST API — Live Integration', () => {
|
|
|
610
610
|
|
|
611
611
|
it('should handle unreachable CMS', async () => {
|
|
612
612
|
const badClient = new RestClient({
|
|
613
|
-
|
|
613
|
+
cmsUrl: 'https://nonexistent.example.com',
|
|
614
614
|
cmsKey: 'test',
|
|
615
615
|
hardwareKey: 'test',
|
|
616
616
|
displayName: 'Unreachable',
|
package/src/xmds.rest.test.js
CHANGED
|
@@ -13,7 +13,7 @@ import { XmdsClient } from './xmds-client.js';
|
|
|
13
13
|
|
|
14
14
|
function createRestClient(overrides = {}) {
|
|
15
15
|
return new RestClient({
|
|
16
|
-
|
|
16
|
+
cmsUrl: 'https://cms.example.com',
|
|
17
17
|
cmsKey: 'test-server-key',
|
|
18
18
|
hardwareKey: 'test-hw-key',
|
|
19
19
|
displayName: 'Test Display',
|
|
@@ -77,7 +77,7 @@ function errorResponse(status, message) {
|
|
|
77
77
|
// ─── Constructor & Config ─────────────────────────────────────────────
|
|
78
78
|
|
|
79
79
|
describe('RestClient - Config', () => {
|
|
80
|
-
it('should derive REST base URL from
|
|
80
|
+
it('should derive REST base URL from cmsUrl', () => {
|
|
81
81
|
const client = createRestClient();
|
|
82
82
|
expect(client.getRestBaseUrl()).toBe('https://cms.example.com/pwa');
|
|
83
83
|
});
|
|
@@ -723,7 +723,7 @@ describe('RestClient - BlackList', () => {
|
|
|
723
723
|
describe('Transport Parity', () => {
|
|
724
724
|
it('SOAP and REST clients should expose identical public methods', () => {
|
|
725
725
|
const soap = new XmdsClient({
|
|
726
|
-
|
|
726
|
+
cmsUrl: 'https://cms.example.com',
|
|
727
727
|
cmsKey: 'k', hardwareKey: 'h',
|
|
728
728
|
});
|
|
729
729
|
const rest = createRestClient();
|
package/src/xmds.test.js
CHANGED
|
@@ -13,7 +13,7 @@ describe('XmdsClient - RegisterDisplay', () => {
|
|
|
13
13
|
|
|
14
14
|
beforeEach(() => {
|
|
15
15
|
client = new XmdsClient({
|
|
16
|
-
|
|
16
|
+
cmsUrl: 'https://cms.example.com',
|
|
17
17
|
cmsKey: 'test-server-key',
|
|
18
18
|
hardwareKey: 'test-hardware-key',
|
|
19
19
|
displayName: 'Test Display',
|
|
@@ -45,7 +45,7 @@ describe('XmdsClient - RegisterDisplay', () => {
|
|
|
45
45
|
|
|
46
46
|
it('should send empty xmrPubKey when config has no key', () => {
|
|
47
47
|
const clientNoKey = new XmdsClient({
|
|
48
|
-
|
|
48
|
+
cmsUrl: 'https://cms.example.com',
|
|
49
49
|
cmsKey: 'test-server-key',
|
|
50
50
|
hardwareKey: 'test-hardware-key',
|
|
51
51
|
displayName: 'Test Display',
|
|
@@ -76,7 +76,7 @@ describe('XmdsClient - URL construction', () => {
|
|
|
76
76
|
|
|
77
77
|
beforeEach(() => {
|
|
78
78
|
client = new XmdsClient({
|
|
79
|
-
|
|
79
|
+
cmsUrl: 'https://cms.example.com',
|
|
80
80
|
cmsKey: 'test-server-key',
|
|
81
81
|
hardwareKey: 'test-hardware-key',
|
|
82
82
|
retryOptions: { maxRetries: 0 }
|
|
@@ -138,7 +138,7 @@ describe('XmdsClient - SubmitLog', () => {
|
|
|
138
138
|
|
|
139
139
|
beforeEach(() => {
|
|
140
140
|
client = new XmdsClient({
|
|
141
|
-
|
|
141
|
+
cmsUrl: 'https://cms.example.com',
|
|
142
142
|
cmsKey: 'test-server-key',
|
|
143
143
|
hardwareKey: 'test-hardware-key',
|
|
144
144
|
retryOptions: { maxRetries: 0 }
|
|
@@ -279,7 +279,7 @@ describe('XmdsClient - SubmitScreenShot', () => {
|
|
|
279
279
|
|
|
280
280
|
beforeEach(() => {
|
|
281
281
|
client = new XmdsClient({
|
|
282
|
-
|
|
282
|
+
cmsUrl: 'https://cms.example.com',
|
|
283
283
|
cmsKey: 'test-server-key',
|
|
284
284
|
hardwareKey: 'test-hardware-key',
|
|
285
285
|
retryOptions: { maxRetries: 0 }
|
|
@@ -425,7 +425,7 @@ describe('XmdsClient - BlackList', () => {
|
|
|
425
425
|
|
|
426
426
|
beforeEach(() => {
|
|
427
427
|
client = new XmdsClient({
|
|
428
|
-
|
|
428
|
+
cmsUrl: 'https://cms.example.com',
|
|
429
429
|
cmsKey: 'test-server-key',
|
|
430
430
|
hardwareKey: 'test-hardware-key',
|
|
431
431
|
retryOptions: { maxRetries: 0 }
|
|
@@ -585,7 +585,7 @@ describe('XmdsClient - ReportFaults', () => {
|
|
|
585
585
|
|
|
586
586
|
beforeEach(() => {
|
|
587
587
|
client = new XmdsClient({
|
|
588
|
-
|
|
588
|
+
cmsUrl: 'https://cms.example.com',
|
|
589
589
|
cmsKey: 'test-server-key',
|
|
590
590
|
hardwareKey: 'test-hardware-key',
|
|
591
591
|
retryOptions: { maxRetries: 0 }
|
|
@@ -661,7 +661,7 @@ describe('XmdsClient - NotifyStatus', () => {
|
|
|
661
661
|
|
|
662
662
|
beforeEach(() => {
|
|
663
663
|
client = new XmdsClient({
|
|
664
|
-
|
|
664
|
+
cmsUrl: 'https://cms.example.com',
|
|
665
665
|
cmsKey: 'test-server-key',
|
|
666
666
|
hardwareKey: 'test-hardware-key',
|
|
667
667
|
retryOptions: { maxRetries: 0 }
|
|
@@ -889,7 +889,7 @@ describe('XmdsClient - GetWeather', () => {
|
|
|
889
889
|
|
|
890
890
|
beforeEach(() => {
|
|
891
891
|
client = new XmdsClient({
|
|
892
|
-
|
|
892
|
+
cmsUrl: 'https://cms.example.com',
|
|
893
893
|
cmsKey: 'test-server-key',
|
|
894
894
|
hardwareKey: 'test-hardware-key',
|
|
895
895
|
retryOptions: { maxRetries: 0 }
|
|
@@ -988,7 +988,7 @@ describe('XmdsClient - MediaInventory', () => {
|
|
|
988
988
|
|
|
989
989
|
beforeEach(() => {
|
|
990
990
|
client = new XmdsClient({
|
|
991
|
-
|
|
991
|
+
cmsUrl: 'https://cms.example.com',
|
|
992
992
|
cmsKey: 'test-server-key',
|
|
993
993
|
hardwareKey: 'test-hardware-key',
|
|
994
994
|
retryOptions: { maxRetries: 0 }
|