@teamlearners/clawops 0.20.2 → 0.22.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/index.d.ts CHANGED
@@ -664,24 +664,47 @@ declare const PhoneNumberSchema: z.ZodObject<{
664
664
  source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
665
665
  webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
666
666
  webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodEnum<["POST", "GET"]>>>;
667
+ routingType: z.ZodOptional<z.ZodNullable<z.ZodEnum<["webhook", "sip", "softphone"]>>>;
668
+ sipEndpointId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
669
+ sipCredentialId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
667
670
  createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
668
671
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
669
672
  number: z.ZodString;
670
673
  source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
671
674
  webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
672
675
  webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodEnum<["POST", "GET"]>>>;
676
+ routingType: z.ZodOptional<z.ZodNullable<z.ZodEnum<["webhook", "sip", "softphone"]>>>;
677
+ sipEndpointId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
678
+ sipCredentialId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
673
679
  createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
674
680
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
675
681
  number: z.ZodString;
676
682
  source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
677
683
  webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
678
684
  webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodEnum<["POST", "GET"]>>>;
685
+ routingType: z.ZodOptional<z.ZodNullable<z.ZodEnum<["webhook", "sip", "softphone"]>>>;
686
+ sipEndpointId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
687
+ sipCredentialId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
679
688
  createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
680
689
  }, z.ZodTypeAny, "passthrough">>;
681
690
  type PhoneNumber = z.infer<typeof PhoneNumberSchema>;
682
691
  type NumberListItem = PhoneNumber;
683
692
  type NumberUpdateResponse = PhoneNumber;
684
693
 
694
+ interface NumberCreateParams {
695
+ webhookUrl?: string;
696
+ }
697
+ interface NumberUpdateParams {
698
+ webhookUrl?: string;
699
+ webhookMethod?: 'POST' | 'GET';
700
+ /** inbound 라우팅: webhook | sip | softphone. */
701
+ routingType?: 'webhook' | 'sip' | 'softphone';
702
+ /** routingType='sip' 일 때 라우팅할 SipEndpoint id. */
703
+ sipEndpointId?: string | null;
704
+ /** routingType='softphone' 일 때 착신할 등록 SIP credential(단말) id. */
705
+ sipCredentialId?: string | null;
706
+ }
707
+
685
708
  declare class Numbers extends APIResource {
686
709
  create(params?: {
687
710
  webhookUrl?: string;
@@ -695,10 +718,7 @@ declare class Numbers extends APIResource {
695
718
  extraQuery?: Record<string, unknown>;
696
719
  timeout?: number;
697
720
  }): Promise<NumberListItem[]>;
698
- update(number: string, params?: {
699
- webhookUrl?: string;
700
- webhookMethod?: 'POST' | 'GET';
701
- }, options?: {
721
+ update(number: string, params?: NumberUpdateParams, options?: {
702
722
  extraHeaders?: Record<string, string>;
703
723
  extraQuery?: Record<string, unknown>;
704
724
  timeout?: number;
@@ -743,6 +763,128 @@ declare class Recordings extends APIResource {
743
763
  }): Promise<void>;
744
764
  }
745
765
 
766
+ /**
767
+ * SIP 단말(digest credential). 평문 password/ha1 은 조회 응답에 포함되지 않음
768
+ * (생성 시 1회만 노출). softphone 라우팅 설정 시 이 객체의 id 를
769
+ * numbers.update(number, { sipCredentialId }) 로 넘긴다.
770
+ */
771
+ declare const SipCredentialSchema: z.ZodObject<{
772
+ id: z.ZodString;
773
+ accountId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
774
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
775
+ username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
776
+ realm: z.ZodOptional<z.ZodNullable<z.ZodString>>;
777
+ enabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
778
+ status: z.ZodOptional<z.ZodNullable<z.ZodEnum<["active", "disabled", "deleted"]>>>;
779
+ ipAclId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
780
+ allowedNumbers: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
781
+ lastUsedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
782
+ dateCreated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
783
+ dateUpdated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
784
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
785
+ id: z.ZodString;
786
+ accountId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
787
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
788
+ username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
789
+ realm: z.ZodOptional<z.ZodNullable<z.ZodString>>;
790
+ enabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
791
+ status: z.ZodOptional<z.ZodNullable<z.ZodEnum<["active", "disabled", "deleted"]>>>;
792
+ ipAclId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
793
+ allowedNumbers: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
794
+ lastUsedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
795
+ dateCreated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
796
+ dateUpdated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
797
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
798
+ id: z.ZodString;
799
+ accountId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
800
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
801
+ username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
802
+ realm: z.ZodOptional<z.ZodNullable<z.ZodString>>;
803
+ enabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
804
+ status: z.ZodOptional<z.ZodNullable<z.ZodEnum<["active", "disabled", "deleted"]>>>;
805
+ ipAclId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
806
+ allowedNumbers: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
807
+ lastUsedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
808
+ dateCreated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
809
+ dateUpdated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
810
+ }, z.ZodTypeAny, "passthrough">>;
811
+ type SipCredential = z.infer<typeof SipCredentialSchema>;
812
+ /**
813
+ * SIP 엔드포인트(외부 PBX 트렁크). sip 라우팅 설정 시 이 객체의 id 를
814
+ * numbers.update(number, { sipEndpointId }) 로 넘긴다.
815
+ */
816
+ declare const SipEndpointSchema: z.ZodObject<{
817
+ id: z.ZodString;
818
+ accountId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
819
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
820
+ maxConcurrent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
821
+ status: z.ZodOptional<z.ZodNullable<z.ZodEnum<["active", "disabled"]>>>;
822
+ routes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown, "many">>>;
823
+ dateCreated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
824
+ dateUpdated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
825
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
826
+ id: z.ZodString;
827
+ accountId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
828
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
829
+ maxConcurrent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
830
+ status: z.ZodOptional<z.ZodNullable<z.ZodEnum<["active", "disabled"]>>>;
831
+ routes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown, "many">>>;
832
+ dateCreated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
833
+ dateUpdated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
834
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
835
+ id: z.ZodString;
836
+ accountId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
837
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
838
+ maxConcurrent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
839
+ status: z.ZodOptional<z.ZodNullable<z.ZodEnum<["active", "disabled"]>>>;
840
+ routes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown, "many">>>;
841
+ dateCreated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
842
+ dateUpdated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
843
+ }, z.ZodTypeAny, "passthrough">>;
844
+ type SipEndpoint = z.infer<typeof SipEndpointSchema>;
845
+
846
+ /**
847
+ * SIP 단말(credential) 리소스 — 조회 전용.
848
+ * 생성/수정/삭제는 대시보드 또는 REST API 사용. 본 SDK 는 softphone 라우팅 설정에
849
+ * 필요한 credential id 확인용 list/get 만 제공한다 (password/ha1 미노출).
850
+ */
851
+ declare class SipCredentials extends APIResource {
852
+ list(params?: {
853
+ status?: 'active' | 'disabled';
854
+ page?: number;
855
+ pageSize?: number;
856
+ }, options?: {
857
+ extraHeaders?: Record<string, string>;
858
+ extraQuery?: Record<string, unknown>;
859
+ timeout?: number;
860
+ }): Promise<SipCredential[]>;
861
+ get(credentialId: string, options?: {
862
+ extraHeaders?: Record<string, string>;
863
+ timeout?: number;
864
+ }): Promise<SipCredential>;
865
+ }
866
+
867
+ /**
868
+ * SIP 엔드포인트(외부 PBX 트렁크) 리소스 — 조회 전용.
869
+ * 생성/수정/삭제는 대시보드 또는 REST API 사용. 본 SDK 는 sip 라우팅 설정에
870
+ * 필요한 endpoint id 확인용 list/get 만 제공한다.
871
+ */
872
+ declare class SipEndpoints extends APIResource {
873
+ list(params?: {
874
+ status?: 'active' | 'disabled';
875
+ page?: number;
876
+ pageSize?: number;
877
+ }, options?: {
878
+ extraHeaders?: Record<string, string>;
879
+ extraQuery?: Record<string, unknown>;
880
+ timeout?: number;
881
+ }): Promise<SipEndpoint[]>;
882
+ get(endpointId: string, options?: {
883
+ extraHeaders?: Record<string, string>;
884
+ timeout?: number;
885
+ }): Promise<SipEndpoint>;
886
+ }
887
+
746
888
  declare const WebhookLogSchema: z.ZodObject<{
747
889
  id: z.ZodString;
748
890
  webhookId: z.ZodString;
@@ -988,6 +1130,8 @@ declare class ClawOps extends APIClient {
988
1130
  get calls(): Calls;
989
1131
  get messages(): Messages;
990
1132
  get numbers(): Numbers;
1133
+ get sipCredentials(): SipCredentials;
1134
+ get sipEndpoints(): SipEndpoints;
991
1135
  get recordings(): Recordings;
992
1136
  get webhookLogs(): WebhookLogs;
993
1137
  get assignmentLinks(): AssignmentLinks;
@@ -1012,12 +1156,4 @@ declare const PaginationMetaSchema: z.ZodObject<{
1012
1156
  }, z.ZodTypeAny, "passthrough">>;
1013
1157
  type PaginationMeta = z.infer<typeof PaginationMetaSchema>;
1014
1158
 
1015
- interface NumberCreateParams {
1016
- webhookUrl?: string;
1017
- }
1018
- interface NumberUpdateParams {
1019
- webhookUrl?: string;
1020
- webhookMethod?: 'POST' | 'GET';
1021
- }
1022
-
1023
- export { APIClient, type APIClientOptions, APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AccountContext, AgentConnectionError, AgentError, type AssignmentLink, type AssignmentLinkAssignment, type AssignmentLinkCreateResponse, type AssignmentLinkStatus, AssignmentLinks, AuthenticationError, BadRequestError, type Call, type CallControlResponse, type CallCreateParams, type CallListParams, type CallUpdateParams, Calls, ClawOps, ClawOpsError, type ClawOpsOptions, ConflictError, InternalServerError, type Message, type MessageCreateParams, type MessageListParams, Messages, NotFoundError, type NumberCreateParams, type NumberListItem, type NumberUpdateParams, type NumberUpdateResponse, Numbers, Page, type PaginationMeta, PermissionDeniedError, type PhoneNumber, RateLimitError, type RecordingDownload, Recordings, ServiceUnavailableError, UnprocessableEntityError, VERSION, type WebhookLog, WebhookLogs, WebhookVerificationError, Webhooks, ClawOps as default };
1159
+ export { APIClient, type APIClientOptions, APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AccountContext, AgentConnectionError, AgentError, type AssignmentLink, type AssignmentLinkAssignment, type AssignmentLinkCreateResponse, type AssignmentLinkStatus, AssignmentLinks, AuthenticationError, BadRequestError, type Call, type CallControlResponse, type CallCreateParams, type CallListParams, type CallUpdateParams, Calls, ClawOps, ClawOpsError, type ClawOpsOptions, ConflictError, InternalServerError, type Message, type MessageCreateParams, type MessageListParams, Messages, NotFoundError, type NumberCreateParams, type NumberListItem, type NumberUpdateParams, type NumberUpdateResponse, Numbers, Page, type PaginationMeta, PermissionDeniedError, type PhoneNumber, RateLimitError, type RecordingDownload, Recordings, ServiceUnavailableError, type SipCredential, SipCredentials, type SipEndpoint, SipEndpoints, UnprocessableEntityError, VERSION, type WebhookLog, WebhookLogs, WebhookVerificationError, Webhooks, ClawOps as default };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, VERSION, APITimeoutError, APIConnectionError, makeStatusError, APIResponseValidationError, ClawOpsError, INITIAL_RETRY_DELAY, MAX_RETRY_DELAY } from './chunk-NFIXFBG7.js';
2
- export { APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AgentConnectionError, AgentError, AuthenticationError, BadRequestError, ClawOpsError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, ServiceUnavailableError, UnprocessableEntityError, VERSION } from './chunk-NFIXFBG7.js';
1
+ import { DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, VERSION, APITimeoutError, APIConnectionError, makeStatusError, APIResponseValidationError, ClawOpsError, INITIAL_RETRY_DELAY, MAX_RETRY_DELAY } from './chunk-5PLVSC2U.js';
2
+ export { APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AgentConnectionError, AgentError, AuthenticationError, BadRequestError, ClawOpsError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, ServiceUnavailableError, UnprocessableEntityError, VERSION } from './chunk-5PLVSC2U.js';
3
3
  import { z } from 'zod';
4
4
  import { timingSafeEqual, createHmac } from 'crypto';
5
5
 
@@ -524,6 +524,9 @@ var PhoneNumberSchema = z.object({
524
524
  source: z.string().nullable().optional(),
525
525
  webhookUrl: z.string().nullable().optional(),
526
526
  webhookMethod: z.enum(["POST", "GET"]).nullable().optional(),
527
+ routingType: z.enum(["webhook", "sip", "softphone"]).nullable().optional(),
528
+ sipEndpointId: z.string().nullable().optional(),
529
+ sipCredentialId: z.string().nullable().optional(),
527
530
  createdAt: z.string().nullable().optional()
528
531
  }).passthrough();
529
532
 
@@ -548,7 +551,10 @@ var Numbers = class extends APIResource {
548
551
  async update(number, params = {}, options = {}) {
549
552
  const body = stripNotGiven({
550
553
  webhookUrl: params.webhookUrl,
551
- webhookMethod: params.webhookMethod
554
+ webhookMethod: params.webhookMethod,
555
+ routingType: params.routingType,
556
+ sipEndpointId: params.sipEndpointId,
557
+ sipCredentialId: params.sipCredentialId
552
558
  });
553
559
  return this._client._put(`${this._basePath}/numbers/${number}`, {
554
560
  body,
@@ -607,6 +613,76 @@ var Recordings = class extends APIResource {
607
613
  await this._client._delete(`${this._basePath}/recordings/${callId}`, options);
608
614
  }
609
615
  };
616
+ var SipCredentialSchema = z.object({
617
+ id: z.string(),
618
+ accountId: z.string().nullable().optional(),
619
+ name: z.string().nullable().optional(),
620
+ username: z.string().nullable().optional(),
621
+ realm: z.string().nullable().optional(),
622
+ enabled: z.boolean().nullable().optional(),
623
+ status: z.enum(["active", "disabled", "deleted"]).nullable().optional(),
624
+ ipAclId: z.string().nullable().optional(),
625
+ allowedNumbers: z.array(z.string()).nullable().optional(),
626
+ lastUsedAt: z.string().nullable().optional(),
627
+ dateCreated: z.string().nullable().optional(),
628
+ dateUpdated: z.string().nullable().optional()
629
+ }).passthrough();
630
+ var SipEndpointSchema = z.object({
631
+ id: z.string(),
632
+ accountId: z.string().nullable().optional(),
633
+ name: z.string().nullable().optional(),
634
+ maxConcurrent: z.number().nullable().optional(),
635
+ status: z.enum(["active", "disabled"]).nullable().optional(),
636
+ routes: z.array(z.unknown()).nullable().optional(),
637
+ dateCreated: z.string().nullable().optional(),
638
+ dateUpdated: z.string().nullable().optional()
639
+ }).passthrough();
640
+
641
+ // src/resources/sip-credentials.ts
642
+ var SipCredentials = class extends APIResource {
643
+ async list(params = {}, options = {}) {
644
+ const query = stripNotGiven({
645
+ status: params.status,
646
+ page: params.page,
647
+ pageSize: params.pageSize
648
+ });
649
+ const schema = z.object({ data: z.array(SipCredentialSchema) }).passthrough();
650
+ const result = await this._client._get(`${this._basePath}/sip-credentials`, {
651
+ castTo: schema,
652
+ ...options,
653
+ extraQuery: { ...query, ...options.extraQuery }
654
+ });
655
+ return result.data;
656
+ }
657
+ async get(credentialId, options = {}) {
658
+ return this._client._get(`${this._basePath}/sip-credentials/${credentialId}`, {
659
+ castTo: SipCredentialSchema,
660
+ ...options
661
+ });
662
+ }
663
+ };
664
+ var SipEndpoints = class extends APIResource {
665
+ async list(params = {}, options = {}) {
666
+ const query = stripNotGiven({
667
+ status: params.status,
668
+ page: params.page,
669
+ pageSize: params.pageSize
670
+ });
671
+ const schema = z.object({ data: z.array(SipEndpointSchema) }).passthrough();
672
+ const result = await this._client._get(`${this._basePath}/sip-endpoints`, {
673
+ castTo: schema,
674
+ ...options,
675
+ extraQuery: { ...query, ...options.extraQuery }
676
+ });
677
+ return result.data;
678
+ }
679
+ async get(endpointId, options = {}) {
680
+ return this._client._get(`${this._basePath}/sip-endpoints/${endpointId}`, {
681
+ castTo: SipEndpointSchema,
682
+ ...options
683
+ });
684
+ }
685
+ };
610
686
  var WebhookLogSchema = z.object({
611
687
  id: z.string(),
612
688
  webhookId: z.string(),
@@ -723,6 +799,12 @@ var ClawOps = class extends APIClient {
723
799
  get numbers() {
724
800
  return new Numbers(this, this._defaultAccountId);
725
801
  }
802
+ get sipCredentials() {
803
+ return new SipCredentials(this, this._defaultAccountId);
804
+ }
805
+ get sipEndpoints() {
806
+ return new SipEndpoints(this, this._defaultAccountId);
807
+ }
726
808
  get recordings() {
727
809
  return new Recordings(this, this._defaultAccountId);
728
810
  }
@@ -743,6 +825,6 @@ var ClawOps = class extends APIClient {
743
825
  // src/client-default.ts
744
826
  var client_default_default = ClawOps;
745
827
 
746
- export { APIClient, AccountContext, AssignmentLinks, Calls, ClawOps, Messages, Numbers, Page, Recordings, WebhookLogs, WebhookVerificationError, Webhooks, client_default_default as default };
828
+ export { APIClient, AccountContext, AssignmentLinks, Calls, ClawOps, Messages, Numbers, Page, Recordings, SipCredentials, SipEndpoints, WebhookLogs, WebhookVerificationError, Webhooks, client_default_default as default };
747
829
  //# sourceMappingURL=index.js.map
748
830
  //# sourceMappingURL=index.js.map