@takeshape/cli 8.167.1 → 8.168.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/dist/util/pusher.d.ts +9 -3
- package/dist/util/pusher.d.ts.map +1 -1
- package/dist/util/pusher.js +7 -18
- package/package.json +6 -6
package/dist/util/pusher.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import { LoggedInCliConfig } from '../types';
|
|
2
|
+
export interface ServerAction {
|
|
3
|
+
type: string;
|
|
4
|
+
meta?: Record<string, unknown>;
|
|
5
|
+
payload: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export declare type ServerActionHandler = (action: ServerAction) => void;
|
|
8
|
+
export declare function handleAction(callback: ServerActionHandler): (action: ServerAction) => void;
|
|
9
|
+
export declare function subscribe(params: LoggedInCliConfig, callback: ServerActionHandler): Promise<void>;
|
|
4
10
|
//# sourceMappingURL=pusher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pusher.d.ts","sourceRoot":"","sources":["../../../src/util/pusher.
|
|
1
|
+
{"version":3,"file":"pusher.d.ts","sourceRoot":"","sources":["../../../src/util/pusher.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAE3C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,oBAAY,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;AAEjE,wBAAgB,YAAY,CAAC,QAAQ,EAAE,mBAAmB,YACxC,YAAY,UAS7B;AAED,wBAAsB,SAAS,CAAC,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,mBAAmB,iBAcvF"}
|
package/dist/util/pusher.js
CHANGED
|
@@ -4,25 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.handleAction = handleAction;
|
|
7
|
-
exports.handleWarning = handleWarning;
|
|
8
7
|
exports.subscribe = subscribe;
|
|
9
8
|
|
|
10
9
|
var _api = _interopRequireDefault(require("./api"));
|
|
11
10
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _log = _interopRequireDefault(require("../log"));
|
|
11
|
+
var _pusherJs = _interopRequireDefault(require("pusher-js"));
|
|
15
12
|
|
|
16
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
14
|
|
|
18
|
-
function handleWarning(type, error) {
|
|
19
|
-
if (type === 'Error' && error.type === 'WebSocketError') {
|
|
20
|
-
(0, _log.default)('Disconnected from TakeShape. Restart this process to resume live content updates.');
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
_pusherClient.default.warn = handleWarning;
|
|
25
|
-
|
|
26
15
|
function handleAction(callback) {
|
|
27
16
|
return action => {
|
|
28
17
|
if (action.type === 'content/CONTENT_UPDATED' || action.type === 'content/CONTENT_CREATED' || action.type === 'content/CONTENT_DELETED') {
|
|
@@ -32,13 +21,13 @@ function handleAction(callback) {
|
|
|
32
21
|
}
|
|
33
22
|
|
|
34
23
|
async function subscribe(params, callback) {
|
|
35
|
-
var _params$linkedApiKey;
|
|
36
|
-
|
|
37
24
|
const config = await (0, _api.default)(params, 'GET', `/project/${params.projectId}/pusher-client-config`);
|
|
38
|
-
const pusher = new
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
25
|
+
const pusher = new _pusherJs.default(config.key, {
|
|
26
|
+
channelAuthorization: {
|
|
27
|
+
endpoint: `${params.endpoint}/project/channel-auth?auth=${params.authToken}`,
|
|
28
|
+
transport: 'ajax'
|
|
29
|
+
},
|
|
30
|
+
cluster: config.cluster
|
|
42
31
|
});
|
|
43
32
|
const channel = pusher.subscribe(`presence-project.${params.projectId}`);
|
|
44
33
|
channel.bind('server-action', handleAction(callback));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.168.0",
|
|
4
4
|
"description": "TakeShape CLI",
|
|
5
5
|
"homepage": "https://www.takeshape.io",
|
|
6
6
|
"repository": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"@graphql-codegen/typescript": "^2.4.5",
|
|
26
26
|
"@graphql-tools/graphql-file-loader": "^7.3.3",
|
|
27
27
|
"@graphql-tools/load": "^7.5.1",
|
|
28
|
-
"@takeshape/schema": "8.
|
|
29
|
-
"@takeshape/ssg": "8.
|
|
30
|
-
"@takeshape/streams": "8.
|
|
31
|
-
"@takeshape/util": "8.
|
|
28
|
+
"@takeshape/schema": "8.168.0",
|
|
29
|
+
"@takeshape/ssg": "8.168.0",
|
|
30
|
+
"@takeshape/streams": "8.168.0",
|
|
31
|
+
"@takeshape/util": "8.168.0",
|
|
32
32
|
"archiver": "^1.3.0",
|
|
33
33
|
"async-retry": "^1.2.1",
|
|
34
34
|
"bluebird": "^3.4.6",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"open": "^7.0.3",
|
|
55
55
|
"ora": "^3.4.0",
|
|
56
56
|
"pretty-bytes": "^5.3.0",
|
|
57
|
-
"pusher-
|
|
57
|
+
"pusher-js": "^7.1.1-beta",
|
|
58
58
|
"request": "^2.88.0",
|
|
59
59
|
"semver": "^6.3.0",
|
|
60
60
|
"stream-to-promise": "^2.2.0",
|