@aui.io/aui-client 3.0.0 → 3.1.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/cjs/Client.d.ts +0 -3
- package/dist/cjs/Client.js +4 -9
- package/dist/cjs/api/resources/index.d.ts +0 -1
- package/dist/cjs/api/resources/index.js +1 -2
- package/dist/cjs/api/resources/session/client/Socket.d.ts +6 -4
- package/dist/cjs/api/resources/session/client/Socket.js +10 -2
- package/dist/cjs/api/types/ErrorEnvelope.d.ts +3 -3
- package/dist/cjs/api/types/EventEnvelope.d.ts +2 -2
- package/dist/cjs/api/types/Message.d.ts +1 -1
- package/dist/cjs/api/types/MessageEnvelope.d.ts +1 -1
- package/dist/cjs/api/types/StreamEvent.d.ts +17 -0
- package/dist/cjs/api/types/SubmitMessageRequest.d.ts +1 -5
- package/dist/cjs/api/types/Trace.d.ts +1 -1
- package/dist/cjs/api/types/index.d.ts +1 -3
- package/dist/cjs/api/types/index.js +1 -3
- package/dist/cjs/environments.d.ts +0 -2
- package/dist/cjs/environments.js +0 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +0 -3
- package/dist/esm/Client.mjs +2 -7
- package/dist/esm/api/resources/index.d.mts +0 -1
- package/dist/esm/api/resources/index.mjs +0 -1
- package/dist/esm/api/resources/session/client/Socket.d.mts +6 -4
- package/dist/esm/api/resources/session/client/Socket.mjs +10 -2
- package/dist/esm/api/types/ErrorEnvelope.d.mts +3 -3
- package/dist/esm/api/types/EventEnvelope.d.mts +2 -2
- package/dist/esm/api/types/Message.d.mts +1 -1
- package/dist/esm/api/types/MessageEnvelope.d.mts +1 -1
- package/dist/esm/api/types/StreamEvent.d.mts +17 -0
- package/dist/esm/api/types/SubmitMessageRequest.d.mts +1 -5
- package/dist/esm/api/types/Trace.d.mts +1 -1
- package/dist/esm/api/types/index.d.mts +1 -3
- package/dist/esm/api/types/index.mjs +1 -3
- package/dist/esm/environments.d.mts +0 -2
- package/dist/esm/environments.mjs +0 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/dist/cjs/api/resources/simulatorSession/client/Client.d.ts +0 -19
- package/dist/cjs/api/resources/simulatorSession/client/Client.js +0 -71
- package/dist/cjs/api/resources/simulatorSession/client/Socket.d.ts +0 -49
- package/dist/cjs/api/resources/simulatorSession/client/Socket.js +0 -150
- package/dist/cjs/api/resources/simulatorSession/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/simulatorSession/client/index.js +0 -2
- package/dist/cjs/api/resources/simulatorSession/index.d.ts +0 -1
- package/dist/cjs/api/resources/simulatorSession/index.js +0 -17
- package/dist/cjs/api/types/GatewayHeaders.d.ts +0 -13
- package/dist/cjs/api/types/IaEvent.d.ts +0 -17
- package/dist/cjs/api/types/IaEvent.js +0 -3
- package/dist/cjs/api/types/SimulatorCommand.d.ts +0 -21
- package/dist/cjs/api/types/SimulatorCommand.js +0 -12
- package/dist/esm/api/resources/simulatorSession/client/Client.d.mts +0 -19
- package/dist/esm/api/resources/simulatorSession/client/Client.mjs +0 -34
- package/dist/esm/api/resources/simulatorSession/client/Socket.d.mts +0 -49
- package/dist/esm/api/resources/simulatorSession/client/Socket.mjs +0 -113
- package/dist/esm/api/resources/simulatorSession/client/index.d.mts +0 -1
- package/dist/esm/api/resources/simulatorSession/client/index.mjs +0 -1
- package/dist/esm/api/resources/simulatorSession/index.d.mts +0 -1
- package/dist/esm/api/resources/simulatorSession/index.mjs +0 -1
- package/dist/esm/api/types/GatewayHeaders.d.mts +0 -13
- package/dist/esm/api/types/IaEvent.d.mts +0 -17
- package/dist/esm/api/types/IaEvent.mjs +0 -2
- package/dist/esm/api/types/SimulatorCommand.d.mts +0 -21
- package/dist/esm/api/types/SimulatorCommand.mjs +0 -9
- /package/dist/cjs/api/types/{GatewayHeaders.js → StreamEvent.js} +0 -0
- /package/dist/esm/api/types/{GatewayHeaders.mjs → StreamEvent.mjs} +0 -0
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BaseClientOptions } from "../../../../BaseClient.js";
|
|
2
|
-
import { SimulatorSessionSocket } from "./Socket.js";
|
|
3
|
-
export declare namespace SimulatorSession {
|
|
4
|
-
interface Options extends BaseClientOptions {
|
|
5
|
-
}
|
|
6
|
-
interface ConnectArgs {
|
|
7
|
-
/** Arbitrary headers to send with the websocket connect request. */
|
|
8
|
-
headers?: Record<string, string>;
|
|
9
|
-
/** Enable debug mode on the websocket. Defaults to false. */
|
|
10
|
-
debug?: boolean;
|
|
11
|
-
/** Number of reconnect attempts. Defaults to 30. */
|
|
12
|
-
reconnectAttempts?: number;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export declare class SimulatorSession {
|
|
16
|
-
protected readonly _options: SimulatorSession.Options;
|
|
17
|
-
constructor(_options?: SimulatorSession.Options);
|
|
18
|
-
connect(args?: SimulatorSession.ConnectArgs): Promise<SimulatorSessionSocket>;
|
|
19
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.SimulatorSession = void 0;
|
|
47
|
-
const core = __importStar(require("../../../../core/index.js"));
|
|
48
|
-
const environments = __importStar(require("../../../../environments.js"));
|
|
49
|
-
const Socket_js_1 = require("./Socket.js");
|
|
50
|
-
class SimulatorSession {
|
|
51
|
-
constructor(_options = {}) {
|
|
52
|
-
this._options = _options;
|
|
53
|
-
}
|
|
54
|
-
connect() {
|
|
55
|
-
return __awaiter(this, arguments, void 0, function* (args = {}) {
|
|
56
|
-
var _a, _b;
|
|
57
|
-
const { headers, debug, reconnectAttempts } = args;
|
|
58
|
-
const _headers = Object.assign({}, headers);
|
|
59
|
-
const socket = new core.ReconnectingWebSocket({
|
|
60
|
-
url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ApolloEnvironment.Gcp)
|
|
61
|
-
.production, "/messaging/v1/simulator-session"),
|
|
62
|
-
protocols: [],
|
|
63
|
-
queryParameters: {},
|
|
64
|
-
headers: _headers,
|
|
65
|
-
options: { debug: debug !== null && debug !== void 0 ? debug : false, maxRetries: reconnectAttempts !== null && reconnectAttempts !== void 0 ? reconnectAttempts : 30 },
|
|
66
|
-
});
|
|
67
|
-
return new Socket_js_1.SimulatorSessionSocket({ socket });
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.SimulatorSession = SimulatorSession;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import * as core from "../../../../core/index.js";
|
|
2
|
-
import type * as Apollo from "../../../index.js";
|
|
3
|
-
export declare namespace SimulatorSessionSocket {
|
|
4
|
-
interface Args {
|
|
5
|
-
socket: core.ReconnectingWebSocket;
|
|
6
|
-
}
|
|
7
|
-
type Response = Apollo.ThreadEnvelope | Apollo.MessageEnvelope | Apollo.EventEnvelope | Apollo.ErrorEnvelope;
|
|
8
|
-
type EventHandlers = {
|
|
9
|
-
open?: () => void;
|
|
10
|
-
message?: (message: Response) => void;
|
|
11
|
-
close?: (event: core.CloseEvent) => void;
|
|
12
|
-
error?: (error: Error) => void;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export declare class SimulatorSessionSocket {
|
|
16
|
-
readonly socket: core.ReconnectingWebSocket;
|
|
17
|
-
protected readonly eventHandlers: SimulatorSessionSocket.EventHandlers;
|
|
18
|
-
private handleOpen;
|
|
19
|
-
private handleMessage;
|
|
20
|
-
private handleClose;
|
|
21
|
-
private handleError;
|
|
22
|
-
constructor(args: SimulatorSessionSocket.Args);
|
|
23
|
-
/** The current state of the connection; this is one of the readyState constants. */
|
|
24
|
-
get readyState(): number;
|
|
25
|
-
/**
|
|
26
|
-
* @param event - The event to attach to.
|
|
27
|
-
* @param callback - The callback to run when the event is triggered.
|
|
28
|
-
* Usage:
|
|
29
|
-
* ```typescript
|
|
30
|
-
* this.on('open', () => {
|
|
31
|
-
* console.log('The websocket is open');
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
on<T extends keyof SimulatorSessionSocket.EventHandlers>(event: T, callback: SimulatorSessionSocket.EventHandlers[T]): void;
|
|
36
|
-
sendSimulatorCommand(message: Apollo.SimulatorCommand): void;
|
|
37
|
-
/** Connect to the websocket and register event handlers. */
|
|
38
|
-
connect(): SimulatorSessionSocket;
|
|
39
|
-
/** Close the websocket and unregister event handlers. */
|
|
40
|
-
close(): void;
|
|
41
|
-
/** Returns a promise that resolves when the websocket is open. */
|
|
42
|
-
waitForOpen(): Promise<core.ReconnectingWebSocket>;
|
|
43
|
-
/** Asserts that the websocket is open. */
|
|
44
|
-
private assertSocketIsOpen;
|
|
45
|
-
/** Send a binary payload to the websocket. */
|
|
46
|
-
protected sendBinary(payload: ArrayBufferLike | Blob | ArrayBufferView): void;
|
|
47
|
-
/** Send a JSON payload to the websocket. */
|
|
48
|
-
protected sendJson(payload: Apollo.SimulatorCommand): void;
|
|
49
|
-
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.SimulatorSessionSocket = void 0;
|
|
47
|
-
const core = __importStar(require("../../../../core/index.js"));
|
|
48
|
-
const json_js_1 = require("../../../../core/json.js");
|
|
49
|
-
class SimulatorSessionSocket {
|
|
50
|
-
constructor(args) {
|
|
51
|
-
this.eventHandlers = {};
|
|
52
|
-
this.handleOpen = () => {
|
|
53
|
-
var _a, _b;
|
|
54
|
-
(_b = (_a = this.eventHandlers).open) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
55
|
-
};
|
|
56
|
-
this.handleMessage = (event) => {
|
|
57
|
-
var _a, _b;
|
|
58
|
-
const data = (0, json_js_1.fromJson)(event.data);
|
|
59
|
-
(_b = (_a = this.eventHandlers).message) === null || _b === void 0 ? void 0 : _b.call(_a, data);
|
|
60
|
-
};
|
|
61
|
-
this.handleClose = (event) => {
|
|
62
|
-
var _a, _b;
|
|
63
|
-
(_b = (_a = this.eventHandlers).close) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
64
|
-
};
|
|
65
|
-
this.handleError = (event) => {
|
|
66
|
-
var _a, _b;
|
|
67
|
-
const message = event.message;
|
|
68
|
-
(_b = (_a = this.eventHandlers).error) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(message));
|
|
69
|
-
};
|
|
70
|
-
this.socket = args.socket;
|
|
71
|
-
this.socket.addEventListener("open", this.handleOpen);
|
|
72
|
-
this.socket.addEventListener("message", this.handleMessage);
|
|
73
|
-
this.socket.addEventListener("close", this.handleClose);
|
|
74
|
-
this.socket.addEventListener("error", this.handleError);
|
|
75
|
-
}
|
|
76
|
-
/** The current state of the connection; this is one of the readyState constants. */
|
|
77
|
-
get readyState() {
|
|
78
|
-
return this.socket.readyState;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* @param event - The event to attach to.
|
|
82
|
-
* @param callback - The callback to run when the event is triggered.
|
|
83
|
-
* Usage:
|
|
84
|
-
* ```typescript
|
|
85
|
-
* this.on('open', () => {
|
|
86
|
-
* console.log('The websocket is open');
|
|
87
|
-
* });
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
on(event, callback) {
|
|
91
|
-
this.eventHandlers[event] = callback;
|
|
92
|
-
}
|
|
93
|
-
sendSimulatorCommand(message) {
|
|
94
|
-
this.assertSocketIsOpen();
|
|
95
|
-
this.sendJson(message);
|
|
96
|
-
}
|
|
97
|
-
/** Connect to the websocket and register event handlers. */
|
|
98
|
-
connect() {
|
|
99
|
-
this.socket.reconnect();
|
|
100
|
-
this.socket.addEventListener("open", this.handleOpen);
|
|
101
|
-
this.socket.addEventListener("message", this.handleMessage);
|
|
102
|
-
this.socket.addEventListener("close", this.handleClose);
|
|
103
|
-
this.socket.addEventListener("error", this.handleError);
|
|
104
|
-
return this;
|
|
105
|
-
}
|
|
106
|
-
/** Close the websocket and unregister event handlers. */
|
|
107
|
-
close() {
|
|
108
|
-
this.socket.close();
|
|
109
|
-
this.handleClose({ code: 1000 });
|
|
110
|
-
this.socket.removeEventListener("open", this.handleOpen);
|
|
111
|
-
this.socket.removeEventListener("message", this.handleMessage);
|
|
112
|
-
this.socket.removeEventListener("close", this.handleClose);
|
|
113
|
-
this.socket.removeEventListener("error", this.handleError);
|
|
114
|
-
}
|
|
115
|
-
/** Returns a promise that resolves when the websocket is open. */
|
|
116
|
-
waitForOpen() {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
if (this.socket.readyState === core.ReconnectingWebSocket.OPEN) {
|
|
119
|
-
return this.socket;
|
|
120
|
-
}
|
|
121
|
-
return new Promise((resolve, reject) => {
|
|
122
|
-
this.socket.addEventListener("open", () => {
|
|
123
|
-
resolve(this.socket);
|
|
124
|
-
});
|
|
125
|
-
this.socket.addEventListener("error", (event) => {
|
|
126
|
-
reject(event);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
/** Asserts that the websocket is open. */
|
|
132
|
-
assertSocketIsOpen() {
|
|
133
|
-
if (!this.socket) {
|
|
134
|
-
throw new Error("Socket is not connected.");
|
|
135
|
-
}
|
|
136
|
-
if (this.socket.readyState !== core.ReconnectingWebSocket.OPEN) {
|
|
137
|
-
throw new Error("Socket is not open.");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
/** Send a binary payload to the websocket. */
|
|
141
|
-
sendBinary(payload) {
|
|
142
|
-
this.socket.send(payload);
|
|
143
|
-
}
|
|
144
|
-
/** Send a JSON payload to the websocket. */
|
|
145
|
-
sendJson(payload) {
|
|
146
|
-
const jsonPayload = (0, json_js_1.toJson)(payload);
|
|
147
|
-
this.socket.send(jsonPayload);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
exports.SimulatorSessionSocket = SimulatorSessionSocket;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./client/index.js";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./client/index.js"), exports);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gateway-enriched upgrade-request headers.
|
|
3
|
-
*/
|
|
4
|
-
export interface GatewayHeaders {
|
|
5
|
-
/** Tenant scope. Absence closes the socket with 1008. */
|
|
6
|
-
"x-aui-organization-id": string;
|
|
7
|
-
/** Billing task-origin hint (e.g. playground / production). */
|
|
8
|
-
"x-aui-source"?: string;
|
|
9
|
-
/** Acting (logged-in) user; attributes an auto-created thread. */
|
|
10
|
-
"x-aui-user-id"?: string;
|
|
11
|
-
/** Shared gateway↔apollo service key (infra contract; not set by end clients). */
|
|
12
|
-
"x-api-key"?: string;
|
|
13
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Raw IA event. Forwarded only when channel.event_name is in the active allow-list.
|
|
3
|
-
*/
|
|
4
|
-
export interface IaEvent {
|
|
5
|
-
channel?: IaEvent.Channel;
|
|
6
|
-
scope?: Record<string, unknown>;
|
|
7
|
-
/** Event-specific payload. */
|
|
8
|
-
data?: unknown;
|
|
9
|
-
/** Accepts any additional properties */
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
}
|
|
12
|
-
export declare namespace IaEvent {
|
|
13
|
-
interface Channel {
|
|
14
|
-
/** Default stream: thread-message-text-content-updated (token delta), thread-message-text-content-completed. Simulator adds user-message-text-content-completed and simulation-request-*. ?events=all|verbose adds the full pillar/workflow set. */
|
|
15
|
-
event_name?: string;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface SimulatorCommand {
|
|
2
|
-
type: SimulatorCommand.Type;
|
|
3
|
-
/** IA SimulationRequest payload, relayed verbatim. For `start`, must carry `task_id` (used for the wallet gate, replay buffer, and billing). */
|
|
4
|
-
data?: SimulatorCommand.Data;
|
|
5
|
-
}
|
|
6
|
-
export declare namespace SimulatorCommand {
|
|
7
|
-
const Type: {
|
|
8
|
-
readonly Start: "start";
|
|
9
|
-
readonly Cancel: "cancel";
|
|
10
|
-
readonly ForceCancel: "force-cancel";
|
|
11
|
-
};
|
|
12
|
-
type Type = (typeof Type)[keyof typeof Type];
|
|
13
|
-
/**
|
|
14
|
-
* IA SimulationRequest payload, relayed verbatim. For `start`, must carry `task_id` (used for the wallet gate, replay buffer, and billing).
|
|
15
|
-
*/
|
|
16
|
-
interface Data {
|
|
17
|
-
task_id?: string;
|
|
18
|
-
/** Accepts any additional properties */
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.SimulatorCommand = void 0;
|
|
5
|
-
var SimulatorCommand;
|
|
6
|
-
(function (SimulatorCommand) {
|
|
7
|
-
SimulatorCommand.Type = {
|
|
8
|
-
Start: "start",
|
|
9
|
-
Cancel: "cancel",
|
|
10
|
-
ForceCancel: "force-cancel",
|
|
11
|
-
};
|
|
12
|
-
})(SimulatorCommand || (exports.SimulatorCommand = SimulatorCommand = {}));
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BaseClientOptions } from "../../../../BaseClient.mjs";
|
|
2
|
-
import { SimulatorSessionSocket } from "./Socket.mjs";
|
|
3
|
-
export declare namespace SimulatorSession {
|
|
4
|
-
interface Options extends BaseClientOptions {
|
|
5
|
-
}
|
|
6
|
-
interface ConnectArgs {
|
|
7
|
-
/** Arbitrary headers to send with the websocket connect request. */
|
|
8
|
-
headers?: Record<string, string>;
|
|
9
|
-
/** Enable debug mode on the websocket. Defaults to false. */
|
|
10
|
-
debug?: boolean;
|
|
11
|
-
/** Number of reconnect attempts. Defaults to 30. */
|
|
12
|
-
reconnectAttempts?: number;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export declare class SimulatorSession {
|
|
16
|
-
protected readonly _options: SimulatorSession.Options;
|
|
17
|
-
constructor(_options?: SimulatorSession.Options);
|
|
18
|
-
connect(args?: SimulatorSession.ConnectArgs): Promise<SimulatorSessionSocket>;
|
|
19
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
import * as core from "../../../../core/index.mjs";
|
|
12
|
-
import * as environments from "../../../../environments.mjs";
|
|
13
|
-
import { SimulatorSessionSocket } from "./Socket.mjs";
|
|
14
|
-
export class SimulatorSession {
|
|
15
|
-
constructor(_options = {}) {
|
|
16
|
-
this._options = _options;
|
|
17
|
-
}
|
|
18
|
-
connect() {
|
|
19
|
-
return __awaiter(this, arguments, void 0, function* (args = {}) {
|
|
20
|
-
var _a, _b;
|
|
21
|
-
const { headers, debug, reconnectAttempts } = args;
|
|
22
|
-
const _headers = Object.assign({}, headers);
|
|
23
|
-
const socket = new core.ReconnectingWebSocket({
|
|
24
|
-
url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ApolloEnvironment.Gcp)
|
|
25
|
-
.production, "/messaging/v1/simulator-session"),
|
|
26
|
-
protocols: [],
|
|
27
|
-
queryParameters: {},
|
|
28
|
-
headers: _headers,
|
|
29
|
-
options: { debug: debug !== null && debug !== void 0 ? debug : false, maxRetries: reconnectAttempts !== null && reconnectAttempts !== void 0 ? reconnectAttempts : 30 },
|
|
30
|
-
});
|
|
31
|
-
return new SimulatorSessionSocket({ socket });
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import * as core from "../../../../core/index.mjs";
|
|
2
|
-
import type * as Apollo from "../../../index.mjs";
|
|
3
|
-
export declare namespace SimulatorSessionSocket {
|
|
4
|
-
interface Args {
|
|
5
|
-
socket: core.ReconnectingWebSocket;
|
|
6
|
-
}
|
|
7
|
-
type Response = Apollo.ThreadEnvelope | Apollo.MessageEnvelope | Apollo.EventEnvelope | Apollo.ErrorEnvelope;
|
|
8
|
-
type EventHandlers = {
|
|
9
|
-
open?: () => void;
|
|
10
|
-
message?: (message: Response) => void;
|
|
11
|
-
close?: (event: core.CloseEvent) => void;
|
|
12
|
-
error?: (error: Error) => void;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export declare class SimulatorSessionSocket {
|
|
16
|
-
readonly socket: core.ReconnectingWebSocket;
|
|
17
|
-
protected readonly eventHandlers: SimulatorSessionSocket.EventHandlers;
|
|
18
|
-
private handleOpen;
|
|
19
|
-
private handleMessage;
|
|
20
|
-
private handleClose;
|
|
21
|
-
private handleError;
|
|
22
|
-
constructor(args: SimulatorSessionSocket.Args);
|
|
23
|
-
/** The current state of the connection; this is one of the readyState constants. */
|
|
24
|
-
get readyState(): number;
|
|
25
|
-
/**
|
|
26
|
-
* @param event - The event to attach to.
|
|
27
|
-
* @param callback - The callback to run when the event is triggered.
|
|
28
|
-
* Usage:
|
|
29
|
-
* ```typescript
|
|
30
|
-
* this.on('open', () => {
|
|
31
|
-
* console.log('The websocket is open');
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
on<T extends keyof SimulatorSessionSocket.EventHandlers>(event: T, callback: SimulatorSessionSocket.EventHandlers[T]): void;
|
|
36
|
-
sendSimulatorCommand(message: Apollo.SimulatorCommand): void;
|
|
37
|
-
/** Connect to the websocket and register event handlers. */
|
|
38
|
-
connect(): SimulatorSessionSocket;
|
|
39
|
-
/** Close the websocket and unregister event handlers. */
|
|
40
|
-
close(): void;
|
|
41
|
-
/** Returns a promise that resolves when the websocket is open. */
|
|
42
|
-
waitForOpen(): Promise<core.ReconnectingWebSocket>;
|
|
43
|
-
/** Asserts that the websocket is open. */
|
|
44
|
-
private assertSocketIsOpen;
|
|
45
|
-
/** Send a binary payload to the websocket. */
|
|
46
|
-
protected sendBinary(payload: ArrayBufferLike | Blob | ArrayBufferView): void;
|
|
47
|
-
/** Send a JSON payload to the websocket. */
|
|
48
|
-
protected sendJson(payload: Apollo.SimulatorCommand): void;
|
|
49
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
import * as core from "../../../../core/index.mjs";
|
|
12
|
-
import { fromJson, toJson } from "../../../../core/json.mjs";
|
|
13
|
-
export class SimulatorSessionSocket {
|
|
14
|
-
constructor(args) {
|
|
15
|
-
this.eventHandlers = {};
|
|
16
|
-
this.handleOpen = () => {
|
|
17
|
-
var _a, _b;
|
|
18
|
-
(_b = (_a = this.eventHandlers).open) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
19
|
-
};
|
|
20
|
-
this.handleMessage = (event) => {
|
|
21
|
-
var _a, _b;
|
|
22
|
-
const data = fromJson(event.data);
|
|
23
|
-
(_b = (_a = this.eventHandlers).message) === null || _b === void 0 ? void 0 : _b.call(_a, data);
|
|
24
|
-
};
|
|
25
|
-
this.handleClose = (event) => {
|
|
26
|
-
var _a, _b;
|
|
27
|
-
(_b = (_a = this.eventHandlers).close) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
28
|
-
};
|
|
29
|
-
this.handleError = (event) => {
|
|
30
|
-
var _a, _b;
|
|
31
|
-
const message = event.message;
|
|
32
|
-
(_b = (_a = this.eventHandlers).error) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(message));
|
|
33
|
-
};
|
|
34
|
-
this.socket = args.socket;
|
|
35
|
-
this.socket.addEventListener("open", this.handleOpen);
|
|
36
|
-
this.socket.addEventListener("message", this.handleMessage);
|
|
37
|
-
this.socket.addEventListener("close", this.handleClose);
|
|
38
|
-
this.socket.addEventListener("error", this.handleError);
|
|
39
|
-
}
|
|
40
|
-
/** The current state of the connection; this is one of the readyState constants. */
|
|
41
|
-
get readyState() {
|
|
42
|
-
return this.socket.readyState;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @param event - The event to attach to.
|
|
46
|
-
* @param callback - The callback to run when the event is triggered.
|
|
47
|
-
* Usage:
|
|
48
|
-
* ```typescript
|
|
49
|
-
* this.on('open', () => {
|
|
50
|
-
* console.log('The websocket is open');
|
|
51
|
-
* });
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
on(event, callback) {
|
|
55
|
-
this.eventHandlers[event] = callback;
|
|
56
|
-
}
|
|
57
|
-
sendSimulatorCommand(message) {
|
|
58
|
-
this.assertSocketIsOpen();
|
|
59
|
-
this.sendJson(message);
|
|
60
|
-
}
|
|
61
|
-
/** Connect to the websocket and register event handlers. */
|
|
62
|
-
connect() {
|
|
63
|
-
this.socket.reconnect();
|
|
64
|
-
this.socket.addEventListener("open", this.handleOpen);
|
|
65
|
-
this.socket.addEventListener("message", this.handleMessage);
|
|
66
|
-
this.socket.addEventListener("close", this.handleClose);
|
|
67
|
-
this.socket.addEventListener("error", this.handleError);
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
/** Close the websocket and unregister event handlers. */
|
|
71
|
-
close() {
|
|
72
|
-
this.socket.close();
|
|
73
|
-
this.handleClose({ code: 1000 });
|
|
74
|
-
this.socket.removeEventListener("open", this.handleOpen);
|
|
75
|
-
this.socket.removeEventListener("message", this.handleMessage);
|
|
76
|
-
this.socket.removeEventListener("close", this.handleClose);
|
|
77
|
-
this.socket.removeEventListener("error", this.handleError);
|
|
78
|
-
}
|
|
79
|
-
/** Returns a promise that resolves when the websocket is open. */
|
|
80
|
-
waitForOpen() {
|
|
81
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
if (this.socket.readyState === core.ReconnectingWebSocket.OPEN) {
|
|
83
|
-
return this.socket;
|
|
84
|
-
}
|
|
85
|
-
return new Promise((resolve, reject) => {
|
|
86
|
-
this.socket.addEventListener("open", () => {
|
|
87
|
-
resolve(this.socket);
|
|
88
|
-
});
|
|
89
|
-
this.socket.addEventListener("error", (event) => {
|
|
90
|
-
reject(event);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
/** Asserts that the websocket is open. */
|
|
96
|
-
assertSocketIsOpen() {
|
|
97
|
-
if (!this.socket) {
|
|
98
|
-
throw new Error("Socket is not connected.");
|
|
99
|
-
}
|
|
100
|
-
if (this.socket.readyState !== core.ReconnectingWebSocket.OPEN) {
|
|
101
|
-
throw new Error("Socket is not open.");
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
/** Send a binary payload to the websocket. */
|
|
105
|
-
sendBinary(payload) {
|
|
106
|
-
this.socket.send(payload);
|
|
107
|
-
}
|
|
108
|
-
/** Send a JSON payload to the websocket. */
|
|
109
|
-
sendJson(payload) {
|
|
110
|
-
const jsonPayload = toJson(payload);
|
|
111
|
-
this.socket.send(jsonPayload);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./client/index.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./client/index.mjs";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gateway-enriched upgrade-request headers.
|
|
3
|
-
*/
|
|
4
|
-
export interface GatewayHeaders {
|
|
5
|
-
/** Tenant scope. Absence closes the socket with 1008. */
|
|
6
|
-
"x-aui-organization-id": string;
|
|
7
|
-
/** Billing task-origin hint (e.g. playground / production). */
|
|
8
|
-
"x-aui-source"?: string;
|
|
9
|
-
/** Acting (logged-in) user; attributes an auto-created thread. */
|
|
10
|
-
"x-aui-user-id"?: string;
|
|
11
|
-
/** Shared gateway↔apollo service key (infra contract; not set by end clients). */
|
|
12
|
-
"x-api-key"?: string;
|
|
13
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Raw IA event. Forwarded only when channel.event_name is in the active allow-list.
|
|
3
|
-
*/
|
|
4
|
-
export interface IaEvent {
|
|
5
|
-
channel?: IaEvent.Channel;
|
|
6
|
-
scope?: Record<string, unknown>;
|
|
7
|
-
/** Event-specific payload. */
|
|
8
|
-
data?: unknown;
|
|
9
|
-
/** Accepts any additional properties */
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
}
|
|
12
|
-
export declare namespace IaEvent {
|
|
13
|
-
interface Channel {
|
|
14
|
-
/** Default stream: thread-message-text-content-updated (token delta), thread-message-text-content-completed. Simulator adds user-message-text-content-completed and simulation-request-*. ?events=all|verbose adds the full pillar/workflow set. */
|
|
15
|
-
event_name?: string;
|
|
16
|
-
}
|
|
17
|
-
}
|