Skip to content

Commit cd293d0

Browse files
authored
Merge pull request #148 from CleverCloud/update-dependencies
2 parents e253077 + f4b5f35 commit cd293d0

File tree

9 files changed

+18
-159
lines changed

9 files changed

+18
-159
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3939
run: |
4040
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
41-
npm publish --access public --tag ${{ steps.npm_tag.outputs.tag }}
41+
npm publish --access public --tag ${{ steps.npm_tag.outputs.tag }}

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ This stream is exposed the inner WebSocket source with [`component-emitter`](htt
166166
Here's an example of how to use `EventsStream` to retrieve events from the Clever Cloud platform:
167167

168168
```js
169-
// Browser implementation or Node.js implementation
170-
import { EventsStream } from '@clevercloud/client/esm/streams/events.browser.js';
171-
// import { EventsStream } from '@clevercloud/client/esm/streams/events.node.js';
169+
// Browser and Node.js 21+ implementation
170+
import { EventsStream } from '@clevercloud/client/esm/streams/events.js';
172171

173172
// Load and cache config and tokens
174173
const API_HOST = 'https://api.clever-cloud.com';

esm/api/v2/unknown.js

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -76,59 +76,6 @@ export function todo_postAuthorize(params, body) {
7676
});
7777
}
7878

79-
/**
80-
* DELETE /invoice/external/paypal/{bid}
81-
* @param {Object} params
82-
* @param {String} params.bid
83-
* @returns {Promise<RequestParams>}
84-
*/
85-
export function todo_cancelPaypalTransaction(params) {
86-
// no multipath for /self or /organisations/{id}
87-
return Promise.resolve({
88-
method: 'delete',
89-
url: `/v2/invoice/external/paypal/${params.bid}`,
90-
headers: { Accept: 'application/json' },
91-
// no query params
92-
// no body
93-
});
94-
}
95-
96-
/**
97-
* PUT /invoice/external/paypal/{bid}
98-
* @param {Object} params
99-
* @param {String} params.bid
100-
* @param {Object} body
101-
* @returns {Promise<RequestParams>}
102-
*/
103-
export function todo_authorizePaypalTransaction(params, body) {
104-
// no multipath for /self or /organisations/{id}
105-
return Promise.resolve({
106-
method: 'put',
107-
url: `/v2/invoice/external/paypal/${params.bid}`,
108-
headers: { Accept: 'application/json', 'Content-Type': '*/*' },
109-
// no query params
110-
body,
111-
});
112-
}
113-
114-
/**
115-
* POST /invoice/external/{bid}
116-
* @param {Object} params
117-
* @param {String} params.bid
118-
* @param {Object} body
119-
* @returns {Promise<RequestParams>}
120-
*/
121-
export function todo_updateInvoice(params, body) {
122-
// no multipath for /self or /organisations/{id}
123-
return Promise.resolve({
124-
method: 'post',
125-
url: `/v2/invoice/external/${params.bid}`,
126-
headers: { Accept: 'application/json', 'Content-Type': '*/*' },
127-
// no query params
128-
body,
129-
});
130-
}
131-
13279
/**
13380
* GET /newsfeeds/blog
13481
* @returns {Promise<RequestParams>}
@@ -933,24 +880,6 @@ export function todo_getUserGitInformations(params) {
933880
});
934881
}
935882

936-
/**
937-
* GET /validation/vat/{key}
938-
* @param {Object} params
939-
* @param {String} params.key
940-
* @param {String} params.action
941-
* @returns {Promise<RequestParams>}
942-
*/
943-
export function todo_validate(params) {
944-
// no multipath for /self or /organisations/{id}
945-
return Promise.resolve({
946-
method: 'get',
947-
url: `/v2/validation/vat/${params.key}`,
948-
headers: { Accept: 'application/json' },
949-
queryParams: pickNonNull(params, ['action']),
950-
// no body
951-
});
952-
}
953-
954883
/**
955884
* GET /vat_check
956885
* @param {Object} params

esm/streams/events.browser.js

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const PONG_MESSAGE = JSON.stringify({
2020
* @extends {AbstractStream}
2121
* @template {WebSocketLike} T
2222
*/
23-
export class AbstractEventsStream extends AbstractStream {
23+
export class EventsStream extends AbstractStream {
2424
/**
2525
* @param {Object} options
2626
* @param {String} options.apiHost
@@ -51,7 +51,7 @@ export class AbstractEventsStream extends AbstractStream {
5151
// * user events wired to event emitter: "message(event)" => "event"
5252

5353
const { url, authMessage } = await this._prepareEventsWs();
54-
this._ws = this._createWebSocket(url);
54+
this._ws = new globalThis.WebSocket(url);
5555

5656
this._ws.addEventListener('open', () => this._ws.send(authMessage));
5757

@@ -95,32 +95,10 @@ export class AbstractEventsStream extends AbstractStream {
9595
// When _closeSource() is called, we already know this._ws is about to be forced closed
9696
// so we need to remove the listener before calling closeWebSocket()
9797
this._ws.removeEventListener('close', this._wsCloseListener);
98-
this._closeWebSocket(this._ws);
98+
this._ws.close();
9999
}
100100
}
101101

102-
// -- abstract methods ------
103-
104-
/**
105-
* @param {string} _url
106-
* @returns {T}
107-
* @abstract
108-
* @protected
109-
*/
110-
_createWebSocket(_url) {
111-
// It's up to the class extending AbstractEventsStream to implement how to create a WS connection
112-
throw new Error('Not implemented');
113-
}
114-
115-
/**
116-
* @param {T} _webSocket
117-
* @protected
118-
*/
119-
_closeWebSocket(_webSocket) {
120-
// It's up to the class extending AbstractEventsStream to implement how to close a WS connection
121-
throw new Error('Not implemented');
122-
}
123-
124102
// -- private methods ------
125103

126104
/**

esm/streams/events.node.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

esm/streams/logs.node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import EventSource from 'eventsource';
1+
import { EventSource } from 'eventsource';
22
import { AbstractLogsStream } from './logs.abstract.js';
33

44
/**

package-lock.json

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,15 @@
4343
"oauth-1.0a": "^2.2.6"
4444
},
4545
"peerDependencies": {
46-
"eventsource": "^1.0.7",
47-
"ws": "^7.4.3"
46+
"eventsource": "^4.0.0"
4847
},
4948
"devDependencies": {
5049
"@babel/parser": "^7.27.0",
5150
"@babel/traverse": "^7.27.0",
5251
"@babel/types": "^7.27.0",
53-
"@eslint/compat": "^1.2.7",
5452
"@commitlint/cli": "^19.8.0",
5553
"@commitlint/config-conventional": "^19.8.0",
54+
"@eslint/compat": "^1.2.7",
5655
"@esm-bundle/chai": "^4.3.3",
5756
"@types/babel__traverse": "^7.20.7",
5857
"@types/component-emitter": "^1.2.14",

0 commit comments

Comments
 (0)