@fabriktor/client 0.0.102 → 0.0.103
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/src/calls/calls.d.ts +7 -1
- package/dist/src/calls/calls.js +19 -1
- package/package.json +2 -2
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { type Event, type PLCallsMintVideoToken } from "@fabriktor/schema";
|
|
1
|
+
import { type PLCallsStartCall, type PLCallsRespondCall, type RPCallsCallSession, type Event, type PLCallsMintVideoToken } from "@fabriktor/schema";
|
|
2
2
|
import type { TokenProvider } from "../core/auth.js";
|
|
3
3
|
import type { FindOneOptionsCRUD, OperationResultOf, QueryOptionsCRUD } from "../core/crud.js";
|
|
4
4
|
import type { HTTPDoer } from "../core/http.js";
|
|
5
5
|
import type { CompletePayload } from "../core/type.js";
|
|
6
6
|
export type MintVideoTokenOptions = CompletePayload<PLCallsMintVideoToken>;
|
|
7
|
+
export type StartCallSessionOptions = CompletePayload<PLCallsStartCall>;
|
|
8
|
+
export type RespondCallSessionOptions = CompletePayload<PLCallsRespondCall>;
|
|
7
9
|
export type CallsClientOptions = {
|
|
8
10
|
http: HTTPDoer;
|
|
9
11
|
base_url: string;
|
|
10
12
|
get_token?: TokenProvider;
|
|
11
13
|
};
|
|
12
14
|
export interface CallsOperator {
|
|
15
|
+
startCallSession(opts: StartCallSessionOptions): Promise<OperationResultOf<RPCallsCallSession>>;
|
|
16
|
+
respondCallSession(opts: RespondCallSessionOptions): Promise<OperationResultOf<RPCallsCallSession>>;
|
|
13
17
|
queryEvents(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Event[]>>;
|
|
14
18
|
findOneEvent(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Event>>;
|
|
15
19
|
mintVideoToken(opts: MintVideoTokenOptions): Promise<OperationResultOf<string>>;
|
|
@@ -20,6 +24,8 @@ export declare class CallsClient implements CallsOperator {
|
|
|
20
24
|
private base_url;
|
|
21
25
|
private get_token?;
|
|
22
26
|
constructor(opts: CallsClientOptions);
|
|
27
|
+
startCallSession(opts: StartCallSessionOptions): Promise<OperationResultOf<RPCallsCallSession>>;
|
|
28
|
+
respondCallSession(opts: RespondCallSessionOptions): Promise<OperationResultOf<RPCallsCallSession>>;
|
|
23
29
|
queryEvents(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Event[]>>;
|
|
24
30
|
findOneEvent(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Event>>;
|
|
25
31
|
mintVideoToken(opts: MintVideoTokenOptions): Promise<OperationResultOf<string>>;
|
package/dist/src/calls/calls.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
4
|
// not use this file except in compliance with the License. You may obtain
|
|
5
5
|
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
import { ColCallsEvents, HTTPMethodPost, PathCallsMint, PathCallsVidTokens, SvcCalls, } from "@fabriktor/schema";
|
|
6
|
+
import { ColCallsEvents, HTTPMethodPost, PathCallsMint, PathCallsStart, PathCallsRespond, PathCallsVidTokens, SvcCalls, } from "@fabriktor/schema";
|
|
7
7
|
import { requiredToken } from "../core/auth.js";
|
|
8
8
|
import { newCRUDClient } from "../core/crud.js";
|
|
9
9
|
import { buildPath } from "../core/path.js";
|
|
@@ -24,6 +24,24 @@ export class CallsClient {
|
|
|
24
24
|
this.base_url = opts.base_url;
|
|
25
25
|
this.get_token = opts.get_token;
|
|
26
26
|
}
|
|
27
|
+
async startCallSession(opts) {
|
|
28
|
+
const token = await requiredToken(this.get_token);
|
|
29
|
+
return this.http.do({
|
|
30
|
+
base_url: this.base_url,
|
|
31
|
+
path: vidTokenPath(PathCallsStart),
|
|
32
|
+
method: HTTPMethodPost,
|
|
33
|
+
token,
|
|
34
|
+
body: opts,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async respondCallSession(opts) {
|
|
38
|
+
return this.http.do({
|
|
39
|
+
base_url: this.base_url,
|
|
40
|
+
path: vidTokenPath(PathCallsRespond),
|
|
41
|
+
method: HTTPMethodPost,
|
|
42
|
+
body: opts,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
27
45
|
async queryEvents(opts) {
|
|
28
46
|
return await this.events.query(opts);
|
|
29
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabriktor/client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.103",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
"typescript": "^6.0.3"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@fabriktor/schema": "0.0.
|
|
20
|
+
"@fabriktor/schema": "0.0.75"
|
|
21
21
|
}
|
|
22
22
|
}
|