@ipcom/asterisk-ari 0.0.1

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.
Files changed (41) hide show
  1. package/dist/cjs/index.cjs +17073 -0
  2. package/dist/cjs/index.cjs.map +7 -0
  3. package/dist/esm/index.js +17068 -0
  4. package/dist/esm/index.js.map +7 -0
  5. package/dist/types/ari-client/ariClient.d.ts +21 -0
  6. package/dist/types/ari-client/ariClient.d.ts.map +1 -0
  7. package/dist/types/ari-client/baseClient.d.ts +7 -0
  8. package/dist/types/ari-client/baseClient.d.ts.map +1 -0
  9. package/dist/types/ari-client/interfaces/channels.types.d.ts +38 -0
  10. package/dist/types/ari-client/interfaces/channels.types.d.ts.map +1 -0
  11. package/dist/types/ari-client/interfaces/errors.d.ts +1 -0
  12. package/dist/types/ari-client/interfaces/errors.d.ts.map +1 -0
  13. package/dist/types/ari-client/interfaces/requests.d.ts +8 -0
  14. package/dist/types/ari-client/interfaces/requests.d.ts.map +1 -0
  15. package/dist/types/ari-client/interfaces/responses.d.ts +1 -0
  16. package/dist/types/ari-client/interfaces/responses.d.ts.map +1 -0
  17. package/dist/types/ari-client/resources/applications.d.ts +1 -0
  18. package/dist/types/ari-client/resources/applications.d.ts.map +1 -0
  19. package/dist/types/ari-client/resources/asterisk.d.ts +1 -0
  20. package/dist/types/ari-client/resources/asterisk.d.ts.map +1 -0
  21. package/dist/types/ari-client/resources/bridges.d.ts +1 -0
  22. package/dist/types/ari-client/resources/bridges.d.ts.map +1 -0
  23. package/dist/types/ari-client/resources/channels.d.ts +13 -0
  24. package/dist/types/ari-client/resources/channels.d.ts.map +1 -0
  25. package/dist/types/ari-client/resources/deviceStates.d.ts +1 -0
  26. package/dist/types/ari-client/resources/deviceStates.d.ts.map +1 -0
  27. package/dist/types/ari-client/resources/endpoints.d.ts +1 -0
  28. package/dist/types/ari-client/resources/endpoints.d.ts.map +1 -0
  29. package/dist/types/ari-client/resources/events.d.ts +1 -0
  30. package/dist/types/ari-client/resources/events.d.ts.map +1 -0
  31. package/dist/types/ari-client/resources/playbacks.d.ts +1 -0
  32. package/dist/types/ari-client/resources/playbacks.d.ts.map +1 -0
  33. package/dist/types/ari-client/resources/recordings.d.ts +1 -0
  34. package/dist/types/ari-client/resources/recordings.d.ts.map +1 -0
  35. package/dist/types/ari-client/resources/sounds.d.ts +1 -0
  36. package/dist/types/ari-client/resources/sounds.d.ts.map +1 -0
  37. package/dist/types/ari-client/websocketClient.d.ts +9 -0
  38. package/dist/types/ari-client/websocketClient.d.ts.map +1 -0
  39. package/dist/types/index.d.ts +5 -0
  40. package/dist/types/index.d.ts.map +1 -0
  41. package/package.json +55 -0
@@ -0,0 +1,21 @@
1
+ import { Channels } from "./resources/channels";
2
+ export interface AriClientConfig {
3
+ host: string;
4
+ port: number;
5
+ username: string;
6
+ password: string;
7
+ secure?: boolean;
8
+ }
9
+ export declare class AriClient {
10
+ private config;
11
+ private wsClient;
12
+ private readonly baseClient;
13
+ channels: Channels;
14
+ constructor(config: AriClientConfig);
15
+ connectWebSocket(): Promise<void>;
16
+ onWebSocketEvent(event: string, callback: (data: any) => void): void;
17
+ closeWebSocket(): void;
18
+ listChannels(): Promise<unknown>;
19
+ originateChannel(data: any): Promise<unknown>;
20
+ }
21
+ //# sourceMappingURL=ariClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ariClient.d.ts","sourceRoot":"","sources":["../../../src/ari-client/ariClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,SAAS;IAMR,OAAO,CAAC,MAAM;IAL1B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAEjC,QAAQ,EAAE,QAAQ,CAAC;gBAEN,MAAM,EAAE,eAAe;IAYrC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAIpE,cAAc,IAAI,IAAI;IAIhB,YAAY;IAIZ,gBAAgB,CAAC,IAAI,EAAE,GAAG;CAGjC"}
@@ -0,0 +1,7 @@
1
+ export declare class BaseClient {
2
+ private client;
3
+ constructor(baseUrl: string, username: string, password: string);
4
+ get<T>(path: string): Promise<T>;
5
+ post<T>(path: string, data?: unknown): Promise<T>;
6
+ }
7
+ //# sourceMappingURL=baseClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseClient.d.ts","sourceRoot":"","sources":["../../../src/ari-client/baseClient.ts"],"names":[],"mappings":"AAEA,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAgB;gBAElB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAOzD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAKhC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAIxD"}
@@ -0,0 +1,38 @@
1
+ export interface Channel {
2
+ id: string;
3
+ name: string;
4
+ state: string;
5
+ caller: {
6
+ name: string;
7
+ number: string;
8
+ };
9
+ connected: {
10
+ name: string;
11
+ number: string;
12
+ };
13
+ accountcode: string;
14
+ dialplan: {
15
+ context: string;
16
+ exten: string;
17
+ priority: number;
18
+ };
19
+ creationtime: string;
20
+ language: string;
21
+ }
22
+ export interface OriginateRequest {
23
+ endpoint: string;
24
+ extension?: string;
25
+ context?: string;
26
+ priority?: number;
27
+ label?: string;
28
+ app?: string;
29
+ appArgs?: string;
30
+ callerId?: string;
31
+ timeout?: number;
32
+ variables?: Record<string, string>;
33
+ channelId?: string;
34
+ otherChannelId?: string;
35
+ originator?: string;
36
+ formats?: string;
37
+ }
38
+ //# sourceMappingURL=channels.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.types.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/interfaces/channels.types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/interfaces/errors.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export interface AriClientConfig {
2
+ host: string;
3
+ port: number;
4
+ username: string;
5
+ password: string;
6
+ secure?: boolean;
7
+ }
8
+ //# sourceMappingURL=requests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/interfaces/requests.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=responses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/interfaces/responses.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=applications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applications.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/applications.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=asterisk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asterisk.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/asterisk.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=bridges.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridges.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/bridges.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import type { BaseClient } from "../baseClient";
2
+ import type { Channel, OriginateRequest } from "../interfaces/channels.types";
3
+ export declare class Channels {
4
+ private client;
5
+ constructor(client: BaseClient);
6
+ list(): Promise<Channel[]>;
7
+ originate(data: OriginateRequest): Promise<Channel>;
8
+ getDetails(channelId: string): Promise<Channel>;
9
+ hangup(channelId: string): Promise<void>;
10
+ continueDialplan(channelId: string, context?: string, extension?: string, priority?: number, label?: string): Promise<void>;
11
+ moveToApplication(channelId: string, app: string, appArgs?: string): Promise<void>;
12
+ }
13
+ //# sourceMappingURL=channels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/channels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAE9E,qBAAa,QAAQ;IACP,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAGhC,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAK1B,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAKnD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/C,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxC,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IAUV,iBAAiB,CACrB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;CAMjB"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=deviceStates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceStates.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/deviceStates.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/endpoints.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/events.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=playbacks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playbacks.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/playbacks.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=recordings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordings.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/recordings.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=sounds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sounds.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/sounds.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ export declare class WebSocketClient {
2
+ private url;
3
+ private ws;
4
+ constructor(url: string);
5
+ connect(): Promise<void>;
6
+ on(event: string, callback: (data: any) => void): void;
7
+ close(): void;
8
+ }
9
+ //# sourceMappingURL=websocketClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocketClient.d.ts","sourceRoot":"","sources":["../../../src/ari-client/websocketClient.ts"],"names":[],"mappings":"AAEA,qBAAa,eAAe;IAGd,OAAO,CAAC,GAAG;IAFvB,OAAO,CAAC,EAAE,CAA0B;gBAEhB,GAAG,EAAE,MAAM;IAEzB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ9B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAKtD,KAAK,IAAI,IAAI;CAGd"}
@@ -0,0 +1,5 @@
1
+ export { AriClient } from "./ari-client/ariClient";
2
+ export { Channels } from "./ari-client/resources/channels";
3
+ export type { AriClientConfig } from "./ari-client/ariClient";
4
+ export type { Channel } from "./ari-client/interfaces/channels.types";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAG3D,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@ipcom/asterisk-ari",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "description": "JavaScript client for Asterisk REST Interface.",
6
+ "homepage": "https://github.com/fabiotheo/ipcom-asterisk-ari",
7
+ "keywords": ["Asterisk", "ARI", "Node.js", "TypeScript"],
8
+ "types": "dist/client.d.ts",
9
+ "main": "./dist/cjs/client.cjs",
10
+ "module": "./dist/esm/client.js",
11
+ "scripts": {
12
+ "test": "echo \"Error: no test specified\" && exit 1",
13
+ "build": "node build.js",
14
+ "prepublishOnly": "npm run build",
15
+ "start": "node dist/esm/index.js",
16
+ "docs": "./node_modules/.bin/typedoc && touch docs/.nojekyll"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git://fabiotheo/ipcom-asterisk-ari"
21
+ },
22
+ "bugs": {
23
+ "url": "https://ipcom.com.br",
24
+ "email": "suporte@ipcom.com.br"
25
+ },
26
+ "license": "Apache-2.0",
27
+ "author": "Fábio Fernandes Theodoro",
28
+ "dependencies": {
29
+ "@types/ws": "^8.5.13",
30
+ "axios": "^1.7.8",
31
+ "uuid": "^11.0.3",
32
+ "ws": "^8.18.0"
33
+ },
34
+ "engines": {
35
+ "node": ">=20"
36
+ },
37
+ "exports": {
38
+ ".": {
39
+ "types": "./dist/types/index.d.ts",
40
+ "require": "./dist/cjs/index.cjs",
41
+ "import": "./dist/esm/index.js"
42
+ }
43
+ },
44
+ "files": ["dist"],
45
+ "devDependencies": {
46
+ "@biomejs/biome": "1.9.4",
47
+ "@types/uuid": "^10.0.0",
48
+ "esbuild": "^0.24.0",
49
+ "typedoc": "^0.26.11",
50
+ "typescript": "5.6"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ }
55
+ }