@fonoster/types 0.5.4 → 0.6.2-alpha.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Fonoster Inc
3
+ Copyright (c) 2024 Fonoster Inc
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ <a href="https://gitpod.io/#https://github.com/fonoster/fonoster"> <img src="https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod" alt="Contribute with Gitpod" />
2
+
3
+ This module is part of the [Fonoster](https://fonoster.com) project. By itself, it does not do much. It is intended to be used as a dependency for other modules. For more information about the project, please visit [https://github.com/fonoster/fonoster](https://github.com/fonoster/fonoster)(../apiserver/README.md)
@@ -0,0 +1,37 @@
1
+ import { BaseApiObject } from "./common";
2
+ type AclExtended = {
3
+ ref: string;
4
+ name: string;
5
+ allow: string[];
6
+ deny: string[];
7
+ extended?: Record<string, unknown>;
8
+ createdAt?: number;
9
+ updatedAt?: number;
10
+ };
11
+ type CreateAclRequestExtended = {
12
+ name: string;
13
+ allow: string[];
14
+ deny: string[];
15
+ extended: {
16
+ accessKeyId: string;
17
+ };
18
+ };
19
+ type UpdateAclRequest = BaseApiObject & Omit<Partial<CreateAclRequestExtended>, "extended">;
20
+ type ListAclsRequest = {
21
+ pageSize: number;
22
+ pageToken: string;
23
+ };
24
+ type ListAclsResponse = {
25
+ items: Acl[];
26
+ nextPageToken: string;
27
+ };
28
+ type Acl = Omit<AclExtended, "extended">;
29
+ type CreateAclRequest = Omit<CreateAclRequestExtended, "extended">;
30
+ type AclsApi = {
31
+ createACL(request: CreateAclRequestExtended): Promise<BaseApiObject>;
32
+ updateACL(request: UpdateAclRequest): Promise<BaseApiObject>;
33
+ getACL(ref: string): Promise<AclExtended>;
34
+ deleteACL(ref: string): Promise<void>;
35
+ listACLs(request: ListAclsRequest): Promise<ListAclsResponse>;
36
+ };
37
+ export { Acl, AclExtended, CreateAclRequest, CreateAclRequestExtended, UpdateAclRequest, ListAclsRequest, ListAclsResponse, AclsApi };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,50 @@
1
+ import { BaseApiObject } from "./common";
2
+ import { Domain } from "./domains.types";
3
+ declare enum Privacy {
4
+ PRIVATE = "ID",
5
+ NONE = "NONE"
6
+ }
7
+ type AgentExtended = {
8
+ ref: string;
9
+ name: string;
10
+ username: string;
11
+ privacy: Privacy;
12
+ enabled: boolean;
13
+ maxContacts?: number;
14
+ expires?: number;
15
+ domain?: Domain;
16
+ extended?: Record<string, unknown>;
17
+ createdAt?: number;
18
+ updatedAt?: number;
19
+ };
20
+ type CreateAgentRequestExtended = {
21
+ name: string;
22
+ username: string;
23
+ privacy: Privacy;
24
+ enabled: boolean;
25
+ maxContacts: number;
26
+ expires?: number;
27
+ domainRef: string;
28
+ extended: {
29
+ accessKeyId: string;
30
+ };
31
+ };
32
+ type UpdateAgentRequest = BaseApiObject & Omit<Partial<CreateAgentRequestExtended>, "username" | "extended">;
33
+ type ListAgentsRequest = {
34
+ pageSize: number;
35
+ pageToken: string;
36
+ };
37
+ type ListAgentsResponse = {
38
+ items: Agent[];
39
+ nextPageToken: string;
40
+ };
41
+ type AgentsApi = {
42
+ createAgent(request: CreateAgentRequestExtended): Promise<BaseApiObject>;
43
+ updateAgent(request: UpdateAgentRequest): Promise<BaseApiObject>;
44
+ getAgent(ref: string): Promise<AgentExtended>;
45
+ deleteAgent(ref: string): Promise<void>;
46
+ listAgents(request: ListAgentsRequest): Promise<ListAgentsResponse>;
47
+ };
48
+ type Agent = Omit<AgentExtended, "extended">;
49
+ type CreateAgentRequest = Omit<CreateAgentRequestExtended, "extended">;
50
+ export { AgentExtended, Agent, CreateAgentRequestExtended, CreateAgentRequest, UpdateAgentRequest, ListAgentsRequest, ListAgentsResponse, AgentsApi, Privacy };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Privacy = void 0;
4
+ var Privacy;
5
+ (function (Privacy) {
6
+ Privacy["PRIVATE"] = "ID";
7
+ Privacy["NONE"] = "NONE";
8
+ })(Privacy || (exports.Privacy = Privacy = {}));
@@ -0,0 +1,57 @@
1
+ import { BaseApiObject } from "./common";
2
+ declare enum ApplicationType {
3
+ PROGRAMMABLE_VOICE = "PROGRAMMABLE_VOICE"
4
+ }
5
+ type Application = {
6
+ ref: string;
7
+ name: string;
8
+ type: ApplicationType;
9
+ appEndpoint: string;
10
+ textToSpeech: {
11
+ productRef: string;
12
+ config: Record<string, unknown>;
13
+ };
14
+ speechToText: {
15
+ productRef: string;
16
+ config: Record<string, unknown>;
17
+ };
18
+ intelligence: {
19
+ productRef: string;
20
+ config: Record<string, unknown>;
21
+ };
22
+ createdAt: Date;
23
+ updatedAt: Date;
24
+ };
25
+ type CreateApplicationRequest = {
26
+ name: string;
27
+ type: ApplicationType;
28
+ appEndpoint?: string;
29
+ textToSpeech?: {
30
+ productRef: string;
31
+ config: Record<string, unknown>;
32
+ };
33
+ speechToText?: {
34
+ productRef: string;
35
+ config: Record<string, unknown>;
36
+ };
37
+ intelligence?: {
38
+ productRef: string;
39
+ credentials: Record<string, unknown>;
40
+ config: Record<string, unknown>;
41
+ };
42
+ };
43
+ type CreateApplicationResponse = BaseApiObject;
44
+ type UpdateApplicationRequest = BaseApiObject & Partial<CreateApplicationRequest>;
45
+ type GetApplicationRequest = BaseApiObject;
46
+ type UpdateApplicationResponse = BaseApiObject;
47
+ type DeleteApplicationRequest = BaseApiObject;
48
+ type DeleteApplicationResponse = BaseApiObject;
49
+ type ListApplicationsRequest = {
50
+ pageSize: number;
51
+ pageToken: string;
52
+ };
53
+ type ListApplicationsResponse = {
54
+ nextPageToken?: string;
55
+ items: Application[];
56
+ };
57
+ export { Application, CreateApplicationRequest, CreateApplicationResponse, UpdateApplicationRequest, UpdateApplicationResponse, DeleteApplicationRequest, DeleteApplicationResponse, ListApplicationsRequest, ListApplicationsResponse, GetApplicationRequest, ApplicationType };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplicationType = void 0;
4
+ var ApplicationType;
5
+ (function (ApplicationType) {
6
+ ApplicationType["PROGRAMMABLE_VOICE"] = "PROGRAMMABLE_VOICE";
7
+ })(ApplicationType || (exports.ApplicationType = ApplicationType = {}));
@@ -0,0 +1,87 @@
1
+ declare const CALL_DETAIL_RECORD_MEASUREMENT = "cdr";
2
+ declare enum CallType {
3
+ PROGRAMMABLE = "PROGRAMMABLE",
4
+ SIP_TRUNKING = "SIP_TRUNKING"
5
+ }
6
+ declare enum HangupCause {
7
+ NORMAL_CLEARING = "NORMAL_CLEARING",
8
+ CALL_REJECTED = "CALL_REJECTED",
9
+ UNALLOCATED = "UNALLOCATED",
10
+ NO_USER_RESPONSE = "NO_USER_RESPONSE",
11
+ NO_ROUTE_DESTINATION = "NO_ROUTE_DESTINATION",
12
+ NO_ANSWER = "NO_ANSWER",
13
+ USER_BUSY = "USER_BUSY",
14
+ NOT_ACCEPTABLE_HERE = "NOT_ACCEPTABLE_HERE",
15
+ SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
16
+ INVALID_NUMBER_FORMAT = "INVALID_NUMBER_FORMAT"
17
+ }
18
+ declare enum CallStatus {
19
+ QUEUED = "QUEUED",
20
+ RINGING = "RINGING",
21
+ IN_PROGRESS = "IN_PROGRESS",
22
+ COMPLETED = "COMPLETED",
23
+ FAILED = "FAILED",
24
+ BUSY = "BUSY",
25
+ NO_ANSWER = "NO_ANSWER",
26
+ CANCELED = "CANCELED",
27
+ REJECTED = "REJECTED",
28
+ TIMEOUT = "TIMEOUT",
29
+ UNKNOWN = "UNKNOWN"
30
+ }
31
+ declare enum CallDirection {
32
+ INBOUND = "INBOUND",
33
+ OUTBOUND = "OUTBOUND"
34
+ }
35
+ type CallDetailRecord = {
36
+ ref: string;
37
+ type: CallType;
38
+ status: CallStatus;
39
+ hangupCause: HangupCause;
40
+ from: string;
41
+ to: string;
42
+ duration: number;
43
+ direction: CallDirection;
44
+ startedAt: number;
45
+ endedAt: number;
46
+ };
47
+ type ListCallsRequest = {
48
+ after?: string;
49
+ before?: string;
50
+ type?: CallType;
51
+ status?: CallStatus;
52
+ hangupCause?: HangupCause;
53
+ from?: string;
54
+ to?: string;
55
+ pageSize?: number;
56
+ pageToken?: string;
57
+ };
58
+ type ListCallsResponse = {
59
+ nextPageToken?: string;
60
+ items: CallDetailRecord[];
61
+ };
62
+ type GetCallRequest = {
63
+ ref: string;
64
+ };
65
+ type CreateCallRequest = {
66
+ from: string;
67
+ to: string;
68
+ appRef?: string;
69
+ };
70
+ type CreateCallResponse = {
71
+ ref: string;
72
+ };
73
+ type CallPublisher = {
74
+ publishCall: (event: CreateCallRequest & {
75
+ ref: string;
76
+ }) => void;
77
+ };
78
+ type TrackCallResponse = {
79
+ ref: string;
80
+ status: CallStatus;
81
+ };
82
+ type TrackCallSubscriber = {
83
+ events: {
84
+ on: (event: string, cb: (data: TrackCallResponse | Error) => void) => void;
85
+ };
86
+ };
87
+ export { CALL_DETAIL_RECORD_MEASUREMENT, CallDetailRecord, ListCallsRequest, ListCallsResponse, GetCallRequest, CallType, CallStatus, CallDirection, CreateCallRequest, CreateCallResponse, CallPublisher, TrackCallResponse, TrackCallSubscriber, HangupCause };
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HangupCause = exports.CallDirection = exports.CallStatus = exports.CallType = exports.CALL_DETAIL_RECORD_MEASUREMENT = void 0;
4
+ /*
5
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/fonoster
7
+ *
8
+ * This file is part of Fonoster
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const CALL_DETAIL_RECORD_MEASUREMENT = "cdr";
23
+ exports.CALL_DETAIL_RECORD_MEASUREMENT = CALL_DETAIL_RECORD_MEASUREMENT;
24
+ var CallType;
25
+ (function (CallType) {
26
+ CallType["PROGRAMMABLE"] = "PROGRAMMABLE";
27
+ CallType["SIP_TRUNKING"] = "SIP_TRUNKING";
28
+ })(CallType || (exports.CallType = CallType = {}));
29
+ var HangupCause;
30
+ (function (HangupCause) {
31
+ HangupCause["NORMAL_CLEARING"] = "NORMAL_CLEARING";
32
+ HangupCause["CALL_REJECTED"] = "CALL_REJECTED";
33
+ HangupCause["UNALLOCATED"] = "UNALLOCATED";
34
+ HangupCause["NO_USER_RESPONSE"] = "NO_USER_RESPONSE";
35
+ HangupCause["NO_ROUTE_DESTINATION"] = "NO_ROUTE_DESTINATION";
36
+ HangupCause["NO_ANSWER"] = "NO_ANSWER";
37
+ HangupCause["USER_BUSY"] = "USER_BUSY";
38
+ HangupCause["NOT_ACCEPTABLE_HERE"] = "NOT_ACCEPTABLE_HERE";
39
+ HangupCause["SERVICE_UNAVAILABLE"] = "SERVICE_UNAVAILABLE";
40
+ HangupCause["INVALID_NUMBER_FORMAT"] = "INVALID_NUMBER_FORMAT";
41
+ })(HangupCause || (exports.HangupCause = HangupCause = {}));
42
+ var CallStatus;
43
+ (function (CallStatus) {
44
+ CallStatus["QUEUED"] = "QUEUED";
45
+ CallStatus["RINGING"] = "RINGING";
46
+ CallStatus["IN_PROGRESS"] = "IN_PROGRESS";
47
+ CallStatus["COMPLETED"] = "COMPLETED";
48
+ CallStatus["FAILED"] = "FAILED";
49
+ CallStatus["BUSY"] = "BUSY";
50
+ CallStatus["NO_ANSWER"] = "NO_ANSWER";
51
+ CallStatus["CANCELED"] = "CANCELED";
52
+ CallStatus["REJECTED"] = "REJECTED";
53
+ CallStatus["TIMEOUT"] = "TIMEOUT";
54
+ CallStatus["UNKNOWN"] = "UNKNOWN";
55
+ })(CallStatus || (exports.CallStatus = CallStatus = {}));
56
+ var CallDirection;
57
+ (function (CallDirection) {
58
+ CallDirection["INBOUND"] = "INBOUND";
59
+ CallDirection["OUTBOUND"] = "OUTBOUND";
60
+ })(CallDirection || (exports.CallDirection = CallDirection = {}));
@@ -0,0 +1,8 @@
1
+ type BaseApiObject = {
2
+ ref: string;
3
+ };
4
+ type NumberPreconditionsCheck = (request: {
5
+ appRef?: string;
6
+ agentAor?: string;
7
+ }) => Promise<void>;
8
+ export { NumberPreconditionsCheck, BaseApiObject };
package/dist/common.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,37 @@
1
+ import { BaseApiObject } from "./common";
2
+ type CredentialsExtended = {
3
+ ref: string;
4
+ name: string;
5
+ username: string;
6
+ password: string;
7
+ extended?: Record<string, unknown>;
8
+ createdAt?: number;
9
+ updatedAt?: number;
10
+ };
11
+ type CreateCredentialsRequestExtended = {
12
+ name: string;
13
+ username: string;
14
+ password: string;
15
+ extended: {
16
+ accessKeyId: string;
17
+ };
18
+ };
19
+ type UpdateCredentialsRequest = BaseApiObject & Omit<Partial<CreateCredentialsRequest>, "username" | "extended">;
20
+ type ListCredentialsRequest = {
21
+ pageSize: number;
22
+ pageToken: string;
23
+ };
24
+ type ListCredentialsResponse = {
25
+ items: Credentials[];
26
+ nextPageToken: string;
27
+ };
28
+ type CredentialsApi = {
29
+ createCredentials(request: CreateCredentialsRequestExtended): Promise<BaseApiObject>;
30
+ updateCredentials(request: UpdateCredentialsRequest): Promise<BaseApiObject>;
31
+ getCredentials(ref: string): Promise<CredentialsExtended>;
32
+ deleteCredentials(ref: string): Promise<void>;
33
+ listCredentials(request: ListCredentialsRequest): Promise<ListCredentialsResponse>;
34
+ };
35
+ type Credentials = Omit<CredentialsExtended, "extended">;
36
+ type CreateCredentialsRequest = Omit<CreateCredentialsRequestExtended, "extended">;
37
+ export { Credentials, CredentialsExtended, CreateCredentialsRequest, CreateCredentialsRequestExtended, UpdateCredentialsRequest, ListCredentialsRequest, ListCredentialsResponse, CredentialsApi };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,45 @@
1
+ import { BaseApiObject } from "./common";
2
+ type DomainExtended = {
3
+ ref: string;
4
+ name: string;
5
+ domainUri: string;
6
+ accessControlListRef?: string;
7
+ egressPolicies?: {
8
+ rule: string;
9
+ numberRef: string;
10
+ }[];
11
+ extended?: Record<string, unknown>;
12
+ createdAt?: number;
13
+ updatedAt?: number;
14
+ };
15
+ type CreateDomainRequestExtended = {
16
+ name: string;
17
+ domainUri: string;
18
+ accessControlListRef?: string;
19
+ egressPolicies?: {
20
+ rule: string;
21
+ numberRef: string;
22
+ }[];
23
+ extended: {
24
+ accessKeyId: string;
25
+ };
26
+ };
27
+ type UpdateDomainRequest = BaseApiObject & Omit<Partial<CreateDomainRequest>, "domainUri" | "extended">;
28
+ type ListDomainsRequest = {
29
+ pageSize: number;
30
+ pageToken: string;
31
+ };
32
+ type ListDomainsResponse = {
33
+ items: Domain[];
34
+ nextPageToken: string;
35
+ };
36
+ type DomainsApi = {
37
+ createDomain: (request: CreateDomainRequest) => Promise<BaseApiObject>;
38
+ updateDomain: (request: UpdateDomainRequest) => Promise<BaseApiObject>;
39
+ getDomain: (ref: string) => Promise<Domain>;
40
+ listDomains: (request: ListDomainsRequest) => Promise<ListDomainsResponse>;
41
+ deleteDomain: (ref: string) => Promise<void>;
42
+ };
43
+ type Domain = Omit<DomainExtended, "extended">;
44
+ type CreateDomainRequest = Omit<CreateDomainRequestExtended, "extended">;
45
+ export { Domain, DomainExtended, DomainsApi, CreateDomainRequestExtended, CreateDomainRequest, UpdateDomainRequest, ListDomainsRequest, ListDomainsResponse };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,54 @@
1
+ declare enum ApiRoleEnum {
2
+ WORKSPACE_ADMIN = "WORKSPACE_ADMIN"
3
+ }
4
+ type User = {
5
+ ref: string;
6
+ email: string;
7
+ name: string;
8
+ avatar: string;
9
+ createdAt: Date;
10
+ updatedAt: Date;
11
+ };
12
+ type CreateUserRequest = {
13
+ name: string;
14
+ email: string;
15
+ password: string;
16
+ avatar: string;
17
+ };
18
+ type CreateApiKeyResponse = {
19
+ ref: string;
20
+ accessKeyId: string;
21
+ accessKeySecret: string;
22
+ };
23
+ type UpdateUserRequest = {
24
+ ref: string;
25
+ name?: string;
26
+ password?: string;
27
+ avatar?: string;
28
+ };
29
+ type CreateApiKeyRequest = {
30
+ role: ApiRoleEnum;
31
+ expiresAt?: number;
32
+ };
33
+ type RegenerateApiKeyResponse = {
34
+ ref: string;
35
+ accessKeyId: string;
36
+ accessKeySecret: string;
37
+ };
38
+ type ListApiKeysRequest = {
39
+ pageSize: number;
40
+ pageToken: string;
41
+ };
42
+ type ApiKey = {
43
+ ref: string;
44
+ accessKeyId: string;
45
+ role: ApiRoleEnum;
46
+ expiresAt: Date;
47
+ createdAt: Date;
48
+ updatedAt: Date;
49
+ };
50
+ type ListApiKeysResponse = {
51
+ items: ApiKey[];
52
+ nextPageToken?: string;
53
+ };
54
+ export { ApiRoleEnum, User, CreateUserRequest, UpdateUserRequest, CreateApiKeyRequest, CreateApiKeyResponse, RegenerateApiKeyResponse, ListApiKeysRequest, ListApiKeysResponse };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiRoleEnum = void 0;
4
+ /*
5
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/fonoster
7
+ *
8
+ * This file is part of Fonoster
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ var ApiRoleEnum;
23
+ (function (ApiRoleEnum) {
24
+ ApiRoleEnum["WORKSPACE_ADMIN"] = "WORKSPACE_ADMIN";
25
+ })(ApiRoleEnum || (exports.ApiRoleEnum = ApiRoleEnum = {}));
package/dist/index.d.ts CHANGED
@@ -0,0 +1,12 @@
1
+ export * from "./agents.types";
2
+ export * from "./acls.types";
3
+ export * from "./credentials.types";
4
+ export * from "./domains.types";
5
+ export * from "./trunks.types";
6
+ export * from "./numbers.types";
7
+ export * from "./applications.types";
8
+ export * from "./common";
9
+ export * from "./calls.types";
10
+ export * from "./identity.types";
11
+ export * from "./secrets.types";
12
+ export * from "./workspaces.types";
package/dist/index.js CHANGED
@@ -1 +1,46 @@
1
- // Deprecated
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
+ /*
18
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
19
+ * http://github.com/fonoster/fonoster
20
+ *
21
+ * This file is part of Fonoster
22
+ *
23
+ * Licensed under the MIT License (the "License");
24
+ * you may not use this file except in compliance with
25
+ * the License. You may obtain a copy of the License at
26
+ *
27
+ * https://opensource.org/licenses/MIT
28
+ *
29
+ * Unless required by applicable law or agreed to in writing, software
30
+ * distributed under the License is distributed on an "AS IS" BASIS,
31
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
+ * See the License for the specific language governing permissions and
33
+ * limitations under the License.
34
+ */
35
+ __exportStar(require("./agents.types"), exports);
36
+ __exportStar(require("./acls.types"), exports);
37
+ __exportStar(require("./credentials.types"), exports);
38
+ __exportStar(require("./domains.types"), exports);
39
+ __exportStar(require("./trunks.types"), exports);
40
+ __exportStar(require("./numbers.types"), exports);
41
+ __exportStar(require("./applications.types"), exports);
42
+ __exportStar(require("./common"), exports);
43
+ __exportStar(require("./calls.types"), exports);
44
+ __exportStar(require("./identity.types"), exports);
45
+ __exportStar(require("./secrets.types"), exports);
46
+ __exportStar(require("./workspaces.types"), exports);
@@ -0,0 +1,72 @@
1
+ import { BaseApiObject } from "./common";
2
+ import { TrunkExtended } from "./trunks.types";
3
+ type INumberExtended = {
4
+ ref: string;
5
+ name: string;
6
+ telUrl: string;
7
+ aorLink: string;
8
+ city: string;
9
+ country: string;
10
+ countryIsoCode: string;
11
+ sessionAffinityHeader: string;
12
+ extraHeaders: {
13
+ name: string;
14
+ value: string;
15
+ }[];
16
+ trunk?: TrunkExtended;
17
+ extended?: Record<string, unknown>;
18
+ createdAt?: number;
19
+ updatedAt?: number;
20
+ };
21
+ type CreateNumberRequestExtended = {
22
+ name: string;
23
+ telUrl: string;
24
+ aorLink: string;
25
+ city: string;
26
+ country: string;
27
+ countryIsoCode: string;
28
+ sessionAffinityHeader: string;
29
+ extraHeaders: {
30
+ name: string;
31
+ value: string;
32
+ }[];
33
+ extended: {
34
+ accessKeyId: string;
35
+ };
36
+ };
37
+ type UpdateNumberRequest = {
38
+ ref: string;
39
+ } & Omit<Partial<CreateNumberRequest>, "telUrl" | "city" | "country" | "countryIsoCode" | "extended">;
40
+ type ListNumbersRequest = {
41
+ pageSize: number;
42
+ pageToken: string;
43
+ };
44
+ type ListNumbersResponse = {
45
+ items: INumber[];
46
+ nextPageToken: string;
47
+ };
48
+ type INumber = Omit<INumberExtended, "extended">;
49
+ type CreateNumberRequest = Omit<CreateNumberRequestExtended, "extended" | "sessionAffinityHeader">;
50
+ type FCreateNumberRequest = {
51
+ name: string;
52
+ telUrl: string;
53
+ city: string;
54
+ country: string;
55
+ countryIsoCode: string;
56
+ appRef?: string;
57
+ agentAor?: string;
58
+ };
59
+ type FUpdateNumberRequest = {
60
+ ref: string;
61
+ name?: string;
62
+ appRef?: string;
63
+ agentAor?: string;
64
+ };
65
+ type NumbersApi = {
66
+ createNumber(request: CreateNumberRequestExtended): Promise<BaseApiObject>;
67
+ updateNumber(request: UpdateNumberRequest): Promise<BaseApiObject>;
68
+ getNumber(ref: string): Promise<INumberExtended>;
69
+ deleteNumber(ref: string): Promise<void>;
70
+ listNumbers(request: ListNumbersRequest): Promise<ListNumbersResponse>;
71
+ };
72
+ export { INumber, INumberExtended, NumbersApi, CreateNumberRequest, CreateNumberRequestExtended, UpdateNumberRequest, ListNumbersRequest, ListNumbersResponse, FCreateNumberRequest, FUpdateNumberRequest };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ import { BaseApiObject } from "./common";
2
+ type Secret = {
3
+ ref: string;
4
+ name: string;
5
+ secret: string;
6
+ createdAt: number;
7
+ updatedAt: number;
8
+ };
9
+ type CreateSecretRequest = {
10
+ name: string;
11
+ secret: string;
12
+ };
13
+ type UpdateSecretRequest = BaseApiObject & Partial<CreateSecretRequest>;
14
+ type ListSecretsRequest = {
15
+ pageSize: number;
16
+ pageToken: string;
17
+ };
18
+ type ListSecretsResponse = {
19
+ nextPageToken?: string;
20
+ items: Secret[];
21
+ };
22
+ export { Secret, CreateSecretRequest, UpdateSecretRequest, ListSecretsRequest, ListSecretsResponse };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,77 @@
1
+ import { Acl } from "./acls.types";
2
+ import { CredentialsExtended } from "./credentials.types";
3
+ declare enum Transport {
4
+ UDP = "UDP",
5
+ TCP = "TCP",
6
+ TLS = "TLS",
7
+ SCTP = "SCTP",
8
+ WS = "WS",
9
+ WSS = "WSS"
10
+ }
11
+ type TrunkURI = {
12
+ host: string;
13
+ port: number;
14
+ transport: Transport;
15
+ user: string;
16
+ weight: number;
17
+ priority: number;
18
+ enabled: boolean;
19
+ };
20
+ type TrunkExtended = {
21
+ ref: string;
22
+ name: string;
23
+ sendRegister: boolean;
24
+ inboundUri?: string;
25
+ accessControlList?: Acl;
26
+ inboundCredentials?: CredentialsExtended;
27
+ outboundCredentials?: CredentialsExtended;
28
+ uris?: TrunkURI[];
29
+ extended?: unknown;
30
+ createdAt?: number;
31
+ updatedAt?: number;
32
+ };
33
+ type CreateTrunkRequestExtended = {
34
+ name: string;
35
+ sendRegister: boolean;
36
+ inboundUri: string;
37
+ accessControlList?: Acl;
38
+ inboundCredentials?: CredentialsExtended;
39
+ outboundCredentials?: CredentialsExtended;
40
+ uris?: TrunkURI[];
41
+ extended?: {
42
+ accessKeyId: string;
43
+ };
44
+ };
45
+ type UpdateTrunkRequest = {
46
+ ref: string;
47
+ } & Omit<Partial<CreateTrunkRequest>, "extended">;
48
+ type CreateTrunkResponse = {
49
+ ref: string;
50
+ };
51
+ type UpdateTrunkResponse = {
52
+ ref: string;
53
+ };
54
+ type GetTrunkRequest = {
55
+ ref: string;
56
+ };
57
+ type DeleteTrunkRequest = {
58
+ ref: string;
59
+ };
60
+ type ListTrunksRequest = {
61
+ pageSize: number;
62
+ pageToken: string;
63
+ };
64
+ type ListTrunksResponse = {
65
+ items: Trunk[];
66
+ nextPageToken: string;
67
+ };
68
+ type Trunk = Omit<TrunkExtended, "extended">;
69
+ type CreateTrunkRequest = Omit<CreateTrunkRequestExtended, "extended">;
70
+ type TrunkApi = {
71
+ createTrunk(request: CreateTrunkRequest): Promise<CreateTrunkResponse>;
72
+ updateTrunk(request: UpdateTrunkRequest): Promise<UpdateTrunkResponse>;
73
+ getTrunk(ref: string): Promise<Trunk>;
74
+ deleteTrunk(ref: string): Promise<void>;
75
+ listTrunks(request: ListTrunksRequest): Promise<ListTrunksResponse>;
76
+ };
77
+ export { Trunk, TrunkExtended, CreateTrunkRequest, CreateTrunkRequestExtended, UpdateTrunkRequest, CreateTrunkResponse, UpdateTrunkResponse, GetTrunkRequest, DeleteTrunkRequest, ListTrunksRequest, ListTrunksResponse, TrunkApi };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var Transport;
4
+ (function (Transport) {
5
+ Transport["UDP"] = "UDP";
6
+ Transport["TCP"] = "TCP";
7
+ Transport["TLS"] = "TLS";
8
+ Transport["SCTP"] = "SCTP";
9
+ Transport["WS"] = "WS";
10
+ Transport["WSS"] = "WSS";
11
+ })(Transport || (Transport = {}));
@@ -0,0 +1,49 @@
1
+ declare enum WorkspaceRoleEnum {
2
+ OWNER = "OWNER",
3
+ ADMIN = "ADMIN",
4
+ USER = "USER"
5
+ }
6
+ declare enum WorkspaceMemberStatus {
7
+ PENDING = "PENDING",
8
+ ACTIVE = "ACTIVE"
9
+ }
10
+ type Workspace = {
11
+ ref: string;
12
+ name: string;
13
+ ownerRef: string;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ };
17
+ type CreateWorkspaceRequest = {
18
+ name: string;
19
+ };
20
+ type UpdateWorkspaceRequest = {
21
+ ref: string;
22
+ name: string;
23
+ };
24
+ type ListWorkspacesResponse = {
25
+ workspaces: Workspace[];
26
+ };
27
+ type InviteUserToWorkspaceResponse = {
28
+ workspaceRef: string;
29
+ userRef: string;
30
+ };
31
+ type InviteUserToWorkspaceRequest = {
32
+ email: string;
33
+ name: string;
34
+ role: WorkspaceRoleEnum;
35
+ password: string;
36
+ };
37
+ type RemoveUserFromWorkspaceRequest = {
38
+ userRef: string;
39
+ };
40
+ type RemoveUserFromWorkspaceResponse = {
41
+ userRef: string;
42
+ };
43
+ type ResendWorkspaceMembershipInvitationRequest = {
44
+ userRef: string;
45
+ };
46
+ type ResendWorkspaceMembershipInvitationResponse = {
47
+ userRef: string;
48
+ };
49
+ export { InviteUserToWorkspaceResponse, CreateWorkspaceRequest, Workspace, WorkspaceRoleEnum, InviteUserToWorkspaceRequest, UpdateWorkspaceRequest, RemoveUserFromWorkspaceRequest, RemoveUserFromWorkspaceResponse, ListWorkspacesResponse, WorkspaceMemberStatus, ResendWorkspaceMembershipInvitationRequest, ResendWorkspaceMembershipInvitationResponse };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkspaceMemberStatus = exports.WorkspaceRoleEnum = void 0;
4
+ /*
5
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/fonoster
7
+ *
8
+ * This file is part of Fonoster
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ var WorkspaceRoleEnum;
23
+ (function (WorkspaceRoleEnum) {
24
+ WorkspaceRoleEnum["OWNER"] = "OWNER";
25
+ WorkspaceRoleEnum["ADMIN"] = "ADMIN";
26
+ WorkspaceRoleEnum["USER"] = "USER";
27
+ })(WorkspaceRoleEnum || (exports.WorkspaceRoleEnum = WorkspaceRoleEnum = {}));
28
+ var WorkspaceMemberStatus;
29
+ (function (WorkspaceMemberStatus) {
30
+ WorkspaceMemberStatus["PENDING"] = "PENDING";
31
+ WorkspaceMemberStatus["ACTIVE"] = "ACTIVE";
32
+ })(WorkspaceMemberStatus || (exports.WorkspaceMemberStatus = WorkspaceMemberStatus = {}));
package/package.json CHANGED
@@ -1,20 +1,21 @@
1
1
  {
2
2
  "name": "@fonoster/types",
3
- "version": "0.5.4",
4
- "description": "Handles Fonoster types",
3
+ "version": "0.6.2-alpha.0",
4
+ "description": "Common types for Fonoster projects",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
7
7
  "license": "MIT",
8
8
  "main": "dist/index",
9
9
  "types": "dist/index",
10
- "scripts": {
11
- "prebuild": "rimraf ./dist tsconfig.tsbuildinfo",
12
- "build": "tsc -b tsconfig.json"
13
- },
14
10
  "directories": {
15
11
  "src": "src",
16
12
  "test": "test"
17
13
  },
14
+ "scripts": {
15
+ "prebuild": "rimraf ./dist tsconfig.tsbuildinfo",
16
+ "build": "tsc -b tsconfig.json",
17
+ "clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo"
18
+ },
18
19
  "files": [
19
20
  "dist"
20
21
  ],
@@ -28,5 +29,5 @@
28
29
  "bugs": {
29
30
  "url": "https://github.com/fonoster/fonoster/issues"
30
31
  },
31
- "gitHead": "a1dae664944ab191e925e49346e0916f8c8347a1"
32
+ "gitHead": "16ee05408eb3680afbf5ad2d313e889e89e3ef6d"
32
33
  }