@aui.io/aui-client 3.1.1 → 3.1.2

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.
@@ -39,11 +39,12 @@ export declare class ApolloClient extends _GeneratedClient {
39
39
  keyType: PublishableKeyType;
40
40
  }>;
41
41
  /**
42
- * Open a messaging WebSocket session. The bearer token is resolved and sent as
43
- * Authorization on the upgrade, and the required `aui-websocket` subprotocol is
44
- * negotiated. Built here (rather than via the generated session resource) so the
45
- * generated code stays vanilla Fern emits protocols: [] and forwards only
46
- * per-call headers, neither of which the v2 server accepts.
42
+ * Open a messaging WebSocket session. The bearer token is passed as the first
43
+ * subprotocol (with `aui-websocket` second) the gateway reads auth from
44
+ * Sec-WebSocket-Protocol, the only upgrade header a browser can set. The token is
45
+ * also sent as an Authorization header for Node. Built here (rather than via the
46
+ * generated session resource) so the generated code stays vanilla — Fern emits
47
+ * protocols: [] and forwards only per-call headers, neither of which the server accepts.
47
48
  */
48
49
  connect(args?: ApolloClient.ConnectArgs): Promise<SessionSocket>;
49
50
  }
@@ -176,11 +176,12 @@ class ApolloClient extends Client_js_1.ApolloClient {
176
176
  return this._tokenAuth.getContext();
177
177
  }
178
178
  /**
179
- * Open a messaging WebSocket session. The bearer token is resolved and sent as
180
- * Authorization on the upgrade, and the required `aui-websocket` subprotocol is
181
- * negotiated. Built here (rather than via the generated session resource) so the
182
- * generated code stays vanilla Fern emits protocols: [] and forwards only
183
- * per-call headers, neither of which the v2 server accepts.
179
+ * Open a messaging WebSocket session. The bearer token is passed as the first
180
+ * subprotocol (with `aui-websocket` second) the gateway reads auth from
181
+ * Sec-WebSocket-Protocol, the only upgrade header a browser can set. The token is
182
+ * also sent as an Authorization header for Node. Built here (rather than via the
183
+ * generated session resource) so the generated code stays vanilla — Fern emits
184
+ * protocols: [] and forwards only per-call headers, neither of which the server accepts.
184
185
  */
185
186
  connect() {
186
187
  return __awaiter(this, arguments, void 0, function* (args = {}) {
@@ -189,7 +190,9 @@ class ApolloClient extends Client_js_1.ApolloClient {
189
190
  const headers = Object.assign(Object.assign({}, (token ? { Authorization: `Bearer ${token}` } : {})), args.headers);
190
191
  const socket = new core.ReconnectingWebSocket({
191
192
  url: core.url.join(this._env.production, SESSION_WS_PATH),
192
- protocols: [WS_SUBPROTOCOL],
193
+ // Order matters: the gateway treats the FIRST subprotocol as the token and
194
+ // requires `aui-websocket` to follow. This is what makes browser WS auth work.
195
+ protocols: token ? [token, WS_SUBPROTOCOL] : [WS_SUBPROTOCOL],
193
196
  queryParameters: {},
194
197
  headers,
195
198
  options: {
@@ -61,8 +61,8 @@ class ApolloClient {
61
61
  this._options = Object.assign(Object.assign({}, _options), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: (0, headers_js_1.mergeHeaders)({
62
62
  "X-Fern-Language": "JavaScript",
63
63
  "X-Fern-SDK-Name": "@aui.io/aui-client",
64
- "X-Fern-SDK-Version": "3.1.1",
65
- "User-Agent": "@aui.io/aui-client/3.1.1",
64
+ "X-Fern-SDK-Version": "3.1.2",
65
+ "User-Agent": "@aui.io/aui-client/3.1.2",
66
66
  "X-Fern-Runtime": core.RUNTIME.type,
67
67
  "X-Fern-Runtime-Version": core.RUNTIME.version,
68
68
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "3.1.1";
1
+ export declare const SDK_VERSION = "3.1.2";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "3.1.1";
4
+ exports.SDK_VERSION = "3.1.2";
@@ -39,11 +39,12 @@ export declare class ApolloClient extends _GeneratedClient {
39
39
  keyType: PublishableKeyType;
40
40
  }>;
41
41
  /**
42
- * Open a messaging WebSocket session. The bearer token is resolved and sent as
43
- * Authorization on the upgrade, and the required `aui-websocket` subprotocol is
44
- * negotiated. Built here (rather than via the generated session resource) so the
45
- * generated code stays vanilla Fern emits protocols: [] and forwards only
46
- * per-call headers, neither of which the v2 server accepts.
42
+ * Open a messaging WebSocket session. The bearer token is passed as the first
43
+ * subprotocol (with `aui-websocket` second) the gateway reads auth from
44
+ * Sec-WebSocket-Protocol, the only upgrade header a browser can set. The token is
45
+ * also sent as an Authorization header for Node. Built here (rather than via the
46
+ * generated session resource) so the generated code stays vanilla — Fern emits
47
+ * protocols: [] and forwards only per-call headers, neither of which the server accepts.
47
48
  */
48
49
  connect(args?: ApolloClient.ConnectArgs): Promise<SessionSocket>;
49
50
  }
@@ -140,11 +140,12 @@ export class ApolloClient extends _GeneratedClient {
140
140
  return this._tokenAuth.getContext();
141
141
  }
142
142
  /**
143
- * Open a messaging WebSocket session. The bearer token is resolved and sent as
144
- * Authorization on the upgrade, and the required `aui-websocket` subprotocol is
145
- * negotiated. Built here (rather than via the generated session resource) so the
146
- * generated code stays vanilla Fern emits protocols: [] and forwards only
147
- * per-call headers, neither of which the v2 server accepts.
143
+ * Open a messaging WebSocket session. The bearer token is passed as the first
144
+ * subprotocol (with `aui-websocket` second) the gateway reads auth from
145
+ * Sec-WebSocket-Protocol, the only upgrade header a browser can set. The token is
146
+ * also sent as an Authorization header for Node. Built here (rather than via the
147
+ * generated session resource) so the generated code stays vanilla — Fern emits
148
+ * protocols: [] and forwards only per-call headers, neither of which the server accepts.
148
149
  */
149
150
  connect() {
150
151
  return __awaiter(this, arguments, void 0, function* (args = {}) {
@@ -153,7 +154,9 @@ export class ApolloClient extends _GeneratedClient {
153
154
  const headers = Object.assign(Object.assign({}, (token ? { Authorization: `Bearer ${token}` } : {})), args.headers);
154
155
  const socket = new core.ReconnectingWebSocket({
155
156
  url: core.url.join(this._env.production, SESSION_WS_PATH),
156
- protocols: [WS_SUBPROTOCOL],
157
+ // Order matters: the gateway treats the FIRST subprotocol as the token and
158
+ // requires `aui-websocket` to follow. This is what makes browser WS auth work.
159
+ protocols: token ? [token, WS_SUBPROTOCOL] : [WS_SUBPROTOCOL],
157
160
  queryParameters: {},
158
161
  headers,
159
162
  options: {
@@ -25,8 +25,8 @@ export class ApolloClient {
25
25
  this._options = Object.assign(Object.assign({}, _options), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: mergeHeaders({
26
26
  "X-Fern-Language": "JavaScript",
27
27
  "X-Fern-SDK-Name": "@aui.io/aui-client",
28
- "X-Fern-SDK-Version": "3.1.1",
29
- "User-Agent": "@aui.io/aui-client/3.1.1",
28
+ "X-Fern-SDK-Version": "3.1.2",
29
+ "User-Agent": "@aui.io/aui-client/3.1.2",
30
30
  "X-Fern-Runtime": core.RUNTIME.type,
31
31
  "X-Fern-Runtime-Version": core.RUNTIME.version,
32
32
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "3.1.1";
1
+ export declare const SDK_VERSION = "3.1.2";
@@ -1 +1 @@
1
- export const SDK_VERSION = "3.1.1";
1
+ export const SDK_VERSION = "3.1.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aui.io/aui-client",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "private": false,
5
5
  "repository": "github:aui-io/aui-client-typescript",
6
6
  "type": "commonjs",