@fabriktor/client 0.0.101 → 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.
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { type
|
|
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
|
-
import type {
|
|
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
|
-
insertOneEvent(opts: InsertOneOptionsCRUD<InEvent>): Promise<OperationResult>;
|
|
15
18
|
findOneEvent(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Event>>;
|
|
16
|
-
replaceOneEvent(opts: ReplaceOneOptionsCRUD<InEvent>): Promise<OperationResult>;
|
|
17
|
-
deleteOneEvent(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
18
19
|
mintVideoToken(opts: MintVideoTokenOptions): Promise<OperationResultOf<string>>;
|
|
19
20
|
}
|
|
20
21
|
export declare class CallsClient implements CallsOperator {
|
|
@@ -23,11 +24,10 @@ export declare class CallsClient implements CallsOperator {
|
|
|
23
24
|
private base_url;
|
|
24
25
|
private get_token?;
|
|
25
26
|
constructor(opts: CallsClientOptions);
|
|
27
|
+
startCallSession(opts: StartCallSessionOptions): Promise<OperationResultOf<RPCallsCallSession>>;
|
|
28
|
+
respondCallSession(opts: RespondCallSessionOptions): Promise<OperationResultOf<RPCallsCallSession>>;
|
|
26
29
|
queryEvents(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Event[]>>;
|
|
27
|
-
insertOneEvent(opts: InsertOneOptionsCRUD<InEvent>): Promise<OperationResult>;
|
|
28
30
|
findOneEvent(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Event>>;
|
|
29
|
-
replaceOneEvent(opts: ReplaceOneOptionsCRUD<InEvent>): Promise<OperationResult>;
|
|
30
|
-
deleteOneEvent(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
31
31
|
mintVideoToken(opts: MintVideoTokenOptions): Promise<OperationResultOf<string>>;
|
|
32
32
|
}
|
|
33
33
|
export declare function newCallsClient(opts: CallsClientOptions): CallsClient;
|
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,21 +24,30 @@ 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
|
}
|
|
30
|
-
async insertOneEvent(opts) {
|
|
31
|
-
return await this.events.insertOne(opts);
|
|
32
|
-
}
|
|
33
48
|
async findOneEvent(opts) {
|
|
34
49
|
return await this.events.findOne(opts);
|
|
35
50
|
}
|
|
36
|
-
async replaceOneEvent(opts) {
|
|
37
|
-
return await this.events.replaceOne(opts);
|
|
38
|
-
}
|
|
39
|
-
async deleteOneEvent(opts) {
|
|
40
|
-
return await this.events.deleteOne(opts);
|
|
41
|
-
}
|
|
42
51
|
async mintVideoToken(opts) {
|
|
43
52
|
const token = await requiredToken(this.get_token);
|
|
44
53
|
return await this.http.do({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type InDTok, type PLNotificationsRelay, type UpsertResult } from "@fabriktor/schema";
|
|
1
|
+
import { type InDTok, type OperationResult, type PLNotificationsRelay, type UpsertResult } from "@fabriktor/schema";
|
|
2
2
|
import type { TokenProvider } from "../core/auth.js";
|
|
3
|
-
import type { OperationResultOf, UpsertOneOptionsCRUD } from "../core/crud.js";
|
|
3
|
+
import type { DeleteOneOptionsCRUD, OperationResultOf, UpsertOneOptionsCRUD } 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 RelayNotificationOptions = CompletePayload<PLNotificationsRelay>;
|
|
@@ -11,6 +11,7 @@ export type NotificationsClientOptions = {
|
|
|
11
11
|
};
|
|
12
12
|
export interface NotificationsOperator {
|
|
13
13
|
upsertOneDTok(opts: UpsertOneOptionsCRUD<InDTok>): Promise<OperationResultOf<UpsertResult>>;
|
|
14
|
+
deleteOneDTok(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
14
15
|
relayNotification(opts: RelayNotificationOptions): Promise<void>;
|
|
15
16
|
}
|
|
16
17
|
export declare class NotificationsClient implements NotificationsOperator {
|
|
@@ -20,6 +21,7 @@ export declare class NotificationsClient implements NotificationsOperator {
|
|
|
20
21
|
private get_token?;
|
|
21
22
|
constructor(opts: NotificationsClientOptions);
|
|
22
23
|
upsertOneDTok(opts: UpsertOneOptionsCRUD<InDTok>): Promise<OperationResultOf<UpsertResult>>;
|
|
24
|
+
deleteOneDTok(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
23
25
|
relayNotification(opts: RelayNotificationOptions): Promise<void>;
|
|
24
26
|
}
|
|
25
27
|
export declare function newNotificationsClient(opts: NotificationsClientOptions): NotificationsClient;
|
|
@@ -27,6 +27,9 @@ export class NotificationsClient {
|
|
|
27
27
|
async upsertOneDTok(opts) {
|
|
28
28
|
return await this.dtoks.upsertOne(opts);
|
|
29
29
|
}
|
|
30
|
+
async deleteOneDTok(opts) {
|
|
31
|
+
return await this.dtoks.deleteOne(opts);
|
|
32
|
+
}
|
|
30
33
|
async relayNotification(opts) {
|
|
31
34
|
const token = await requiredToken(this.get_token);
|
|
32
35
|
return await this.http.do({
|
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
|
}
|