@takeshape/cli 8.166.0 → 8.167.3

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.
@@ -1,4 +1,10 @@
1
- export function handleWarning(type: any, error: any): void;
2
- export function handleAction(callback: any): (action: any) => void;
3
- export function subscribe(params: any, callback: any): Promise<void>;
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.js"],"names":[],"mappings":"AAIA,2DAIC;AAID,mEAUC;AAED,qEAYC"}
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"}
@@ -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 _pusherClient = _interopRequireDefault(require("pusher-client"));
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 _pusherClient.default(config.key, {
39
- authEndpoint: `${params.endpoint}/project/channel-auth?auth=${(_params$linkedApiKey = params.linkedApiKey) === null || _params$linkedApiKey === void 0 ? void 0 : _params$linkedApiKey.apiKey}`,
40
- cluster: config.cluster,
41
- encrypted: true
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.166.0",
3
+ "version": "8.167.3",
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.166.0",
29
- "@takeshape/ssg": "8.166.0",
30
- "@takeshape/streams": "8.166.0",
31
- "@takeshape/util": "8.166.0",
28
+ "@takeshape/schema": "8.167.3",
29
+ "@takeshape/ssg": "8.167.3",
30
+ "@takeshape/streams": "8.167.3",
31
+ "@takeshape/util": "8.167.3",
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-client": "^1.1.0",
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",