Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@great-detail/support-sdk

Package Overview
Dependencies
Maintainers
0
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@great-detail/support-sdk - npm Package Compare versions

Comparing version 0.0.10 to 0.1.0

dist/chunk-F7GYYFWQ.js

2

dist/cli.js
#!/usr/bin/env node
import{a as r}from"./chunk-565FNIKF.js";import"./chunk-K2S74QO7.js";r.parseAsync(process.argv);
import{a as r}from"./chunk-POO5QTDO.js";import"./chunk-F7GYYFWQ.js";r.parseAsync(process.argv);
import { Command } from 'commander';
import { C as Client } from '../index-CAMI8mLN.js';
import { C as Client } from '../index-EaleABGN.js';
import { Options as Options$1 } from 'ora';

@@ -4,0 +4,0 @@ import 'zod';

@@ -1,1 +0,1 @@

import{a}from"../chunk-565FNIKF.js";import"../chunk-K2S74QO7.js";export{a as default};
import{a}from"../chunk-POO5QTDO.js";import"../chunk-F7GYYFWQ.js";export{a as default};

@@ -1,3 +0,3 @@

import { A as Authentication } from './index-CAMI8mLN.js';
export { C as Client, h as CreateCorrectionResponsePayload, d as CreateLabelResponsePayload, i as CreateResponseResponsePayload, G as GetConversationResponsePayload, L as ListActionsResponsePayload, a as ListChannelsResponsePayload, b as ListContactsResponsePayload, c as ListConversationsResponsePayload, e as ListLabelsResponsePayload, f as ListMessagesResponsePayload, g as ListModelsResponsePayload, j as ListSourcesResponsePayload, R as RequestFilterable, C as default } from './index-CAMI8mLN.js';
import { A as Authentication } from './index-EaleABGN.js';
export { C as Client, h as CreateCorrectionResponsePayload, d as CreateLabelResponsePayload, i as CreateResponseResponsePayload, G as GetConversationResponsePayload, L as ListActionsResponsePayload, a as ListChannelsResponsePayload, b as ListContactsResponsePayload, c as ListConversationsResponsePayload, e as ListLabelsResponsePayload, f as ListMessagesResponsePayload, g as ListModelsResponsePayload, j as ListSourcesResponsePayload, R as RequestFilterable, C as default } from './index-EaleABGN.js';
import 'zod';

@@ -4,0 +4,0 @@

@@ -1,1 +0,1 @@

import{a as l,b as i,c as n,d as a,e as p,f as m,g as f}from"./chunk-K2S74QO7.js";var t=class s{static DEFAULT_NAME=i;name;#e;constructor({name:e=process.env[p]??s.DEFAULT_NAME,key:r=process.env[a]}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=r}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var o=class{#e;constructor({token:e=process.env[n]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};export{f as Client,l as DEFAULT_SUPPORT_BASE_URL,t as KeyAuthentication,m as PublicAuthentication,o as TokenAuthentication,f as default};
import{a as l,b as i,c as n,d as a,e as p,f as m,g as f}from"./chunk-F7GYYFWQ.js";var t=class s{static DEFAULT_NAME=i;name;#e;constructor({name:e=process.env[p]??s.DEFAULT_NAME,key:r=process.env[a]}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=r}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var o=class{#e;constructor({token:e=process.env[n]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};export{f as Client,l as DEFAULT_SUPPORT_BASE_URL,t as KeyAuthentication,m as PublicAuthentication,o as TokenAuthentication,f as default};
{
"name": "@great-detail/support-sdk",
"version": "0.0.10",
"version": "0.1.0",
"type": "module",

@@ -5,0 +5,0 @@ "description": "JavaScript SDK for the Great Detail Support System",

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Client, { SendOptions } from "../Transport/index.js";

@@ -18,6 +18,6 @@ export interface Options extends SendOptions {

export default class ListActionsRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Client) {}
public async send({ request = {}, ...options }: Options = {}) {
return this._client
return this._transport
.send(

@@ -24,0 +24,0 @@ "v1/actions",

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Client, { SendOptions } from "../Transport/index.js";

@@ -18,6 +18,6 @@ export interface Options extends SendOptions {

export default class ListChannelsRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Client) {}
public async send({ request = {}, ...options }: Options = {}) {
return this._client
return this._transport
.send(

@@ -24,0 +24,0 @@ "v1/channels",

@@ -44,3 +44,20 @@ /**

command.addCommand(
new Command("conversations")
.description("Find label conversations")
.argument("<label>", "Label ID")
.action(async (id) => {
const result = await oraPromise(
() => client.label.conversation.list.send({ id }),
{
...ora,
text: "Finding conversations",
},
);
console.log(await result.result());
}),
);
return command;
}

@@ -16,8 +16,12 @@ /**

import ListContactsRequest from "../Contact/ListContacts.js";
import UpdateContactRequest from "../Contact/UpdateContact.js";
import GetConversationRequest from "../Conversation/GetConversation.js";
import ListConversationsRequest from "../Conversation/ListConversations.js";
import ListLabelConversations from "../Conversation/ListLabelConversations.js";
import UpdateConversationRequest from "../Conversation/UpdateConversation.js";
import CreateLabelRequest from "../Label/CreateLabel.js";
import DeleteLabelRequest from "../Label/DeleteLabel.js";
import GetLabelRequest from "../Label/GetLabel.js";
import ListLabelsRequest from "../Label/ListLabels.js";
import UpdateLabelRequest from "../Label/UpdateLabel.js";
import ListConversationMessages from "../Message/ListConversationMessages.js";

@@ -29,41 +33,25 @@ import ListMessagesRequest from "../Message/ListMessages.js";

import CreateResponseModelRequest from "../Model/Response/CreateResponseModel.js";
import RequestFilterable from "../Request/RequestFilterable.js";
import RequestStandardHeaders from "../Request/RequestStandardHeaders.js";
import GetSourceRequest from "../Source/GetSource.js";
import ListSourcesRequest from "../Source/ListSources.js";
import Transport from "../Transport/index.js";
export interface ClientOptions {
requestFilterables: RequestFilterable[];
baseURL: string;
}
export interface InputClientOptions {
baseURL?: string | URL;
}
export interface SendOptions {
/**
* Alternative Fetch Provider.
* Used to override the default fetch provider and use polyfills or other
* libraries.
*
* @since 1.0.0
*/
fetch?: typeof fetch;
}
export default class Client {
public static DEFAULT_BASE_URL = DEFAULT_SUPPORT_BASE_URL;
public options: ClientOptions;
public transport: Transport;
constructor(
authentication: Authentication,
{ baseURL, ...options }: InputClientOptions = {},
{ baseURL, ...options }: ClientOptions = {},
) {
this.options = {
this.transport = new Transport({
requestFilterables: [new RequestStandardHeaders(), authentication],
...options,
baseURL: baseURL?.toString() ?? Client.getBaseURL(),
};
});
}

@@ -75,71 +63,71 @@

public action = {
list: new ListActionsRequest(this),
};
public get action() {
return {
list: new ListActionsRequest(this.transport),
};
}
public channel = {
list: new ListChannelsRequest(this),
};
public get channel() {
return {
list: new ListChannelsRequest(this.transport),
};
}
public contact = {
get: new GetContactRequest(this),
list: new ListContactsRequest(this),
};
public get contact() {
return {
get: new GetContactRequest(this.transport),
list: new ListContactsRequest(this.transport),
update: new UpdateContactRequest(this.transport),
};
}
public conversation = {
get: new GetConversationRequest(this),
list: new ListConversationsRequest(this),
update: new UpdateConversationRequest(this),
message: {
list: new ListConversationMessages(this),
},
};
public get conversation() {
return {
get: new GetConversationRequest(this.transport),
list: new ListConversationsRequest(this.transport),
update: new UpdateConversationRequest(this.transport),
message: {
list: new ListConversationMessages(this.transport),
},
};
}
public label = {
create: new CreateLabelRequest(this),
get: new GetLabelRequest(this),
list: new ListLabelsRequest(this),
};
public get label() {
return {
create: new CreateLabelRequest(this.transport),
get: new GetLabelRequest(this.transport),
list: new ListLabelsRequest(this.transport),
update: new UpdateLabelRequest(this.transport),
delete: new DeleteLabelRequest(this.transport),
conversation: {
list: new ListLabelConversations(this.transport),
},
};
}
public message = {
list: new ListMessagesRequest(this),
};
public get message() {
return {
list: new ListMessagesRequest(this.transport),
};
}
public model = {
get: new GetModelRequest(this),
list: new ListModelsRequest(this),
response: {
create: new CreateResponseModelRequest(this),
},
correction: {
create: new CreateCorrectionModelRequest(this),
},
};
public source = {
get: new GetSourceRequest(this),
list: new ListSourcesRequest(this),
};
protected async _filterRequest(request: RequestInit): Promise<RequestInit> {
for (const filterable of this.options.requestFilterables) {
request = await filterable.filter(request);
}
return request;
public get model() {
return {
get: new GetModelRequest(this.transport),
list: new ListModelsRequest(this.transport),
response: {
create: new CreateResponseModelRequest(this.transport),
},
correction: {
create: new CreateCorrectionModelRequest(this.transport),
},
};
}
public async send(
url: string | URL,
request: RequestInit,
{ fetch: fetchAlternative = fetch }: SendOptions = {},
) {
// See: https://github.com/node-fetch/node-fetch/issues/481#issuecomment-592491825
return await fetchAlternative(
new Request(
new URL(url, this.options.baseURL),
await this._filterRequest(request),
),
);
public get source() {
return {
get: new GetSourceRequest(this.transport),
list: new ListSourcesRequest(this.transport),
};
}
}

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Client, { SendOptions } from "../Transport/index.js";

@@ -19,6 +19,6 @@ export interface Options extends SendOptions {

export default class GetContactRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Client) {}
public async send({ id, request = {}, ...options }: Options) {
return this._client
return this._transport
.send(

@@ -25,0 +25,0 @@ "v1/contacts/" + encodeURIComponent(id),

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Client, { SendOptions } from "../Transport/index.js";

@@ -18,6 +18,6 @@ export interface Options extends SendOptions {

export default class ListContactsRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Client) {}
public async send({ request = {}, ...options }: Options = {}) {
return this._client
return this._transport
.send(

@@ -24,0 +24,0 @@ "v1/contacts",

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Client, { SendOptions } from "../Transport/index.js";

@@ -19,6 +19,6 @@ export interface Options extends SendOptions {

export default class GetConversationRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Client) {}
public async send({ id, request = {}, ...options }: Options) {
return this._client
return this._transport
.send(

@@ -25,0 +25,0 @@ "v1/conversations/" + encodeURIComponent(id),

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Client, { SendOptions } from "../Transport/index.js";

@@ -18,6 +18,6 @@ export interface Options extends SendOptions {

export default class ListConversationsRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Client) {}
public async send({ request = {}, ...options }: Options = {}) {
return this._client
return this._transport
.send(

@@ -24,0 +24,0 @@ "v1/conversations",

@@ -11,3 +11,3 @@ /**

import { z } from "zod";
import Client, { SendOptions } from "../Client/index.js";
import Client, { SendOptions } from "../Transport/index.js";

@@ -25,6 +25,6 @@ export interface Options extends SendOptions {

constructor(protected _client: Client) {}
constructor(protected _transport: Client) {}
public async send({ id, body, request = {}, ...options }: Options) {
return this._client
return this._transport
.send(

@@ -31,0 +31,0 @@ "v1/conversations/" + encodeURIComponent(id),

@@ -11,3 +11,3 @@ /**

import { z } from "zod";
import Client, { SendOptions } from "../Client/index.js";
import Client, { SendOptions } from "../Transport/index.js";

@@ -22,10 +22,10 @@ export interface Options extends SendOptions {

title: z.string(),
description: z.optional(z.string()),
description: z.string().optional(),
account: z.string(),
});
constructor(protected _client: Client) {}
constructor(protected _transport: Client) {}
public async send({ body, request = {}, ...options }: Options) {
return this._client
return this._transport
.send(

@@ -32,0 +32,0 @@ "v1/labels",

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Client, { SendOptions } from "../Transport/index.js";

@@ -19,6 +19,6 @@ export interface Options extends SendOptions {

export default class GetLabelRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Client) {}
public async send({ id, request = {}, ...options }: Options) {
return this._client
return this._transport
.send(

@@ -25,0 +25,0 @@ "v1/labels/" + encodeURIComponent(id),

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Transport, { SendOptions } from "../Transport/index.js";

@@ -18,6 +18,6 @@ export interface Options extends SendOptions {

export default class ListLabelsRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Transport) {}
public async send({ request = {}, ...options }: Options = {}) {
return this._client
return this._transport
.send(

@@ -24,0 +24,0 @@ "v1/labels",

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Transport, { SendOptions } from "../Transport/index.js";

@@ -19,6 +19,6 @@ export interface Options extends SendOptions {

export default class ListConversationMessages {
constructor(protected _client: Client) {}
constructor(protected _transport: Transport) {}
public async send({ id, request = {}, ...options }: Options) {
return this._client
return this._transport
.send(

@@ -25,0 +25,0 @@ "v1/conversations/" + encodeURIComponent(id) + "/messages",

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Transport, { SendOptions } from "../Transport/index.js";

@@ -18,6 +18,6 @@ export interface Options extends SendOptions {

export default class ListMessagesRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Transport) {}
public async send({ request = {}, ...options }: Options = {}) {
return this._client
return this._transport
.send(

@@ -24,0 +24,0 @@ "v1/messages",

@@ -11,3 +11,3 @@ /**

import { z } from "zod";
import Client, { SendOptions } from "../../Client/index.js";
import Transport, { SendOptions } from "../../Transport/index.js";

@@ -27,6 +27,6 @@ export interface Options extends SendOptions {

constructor(protected _client: Client) {}
constructor(protected _transport: Transport) {}
public async send({ id, body, request = {}, ...options }: Options) {
return this._client
return this._transport
.send(

@@ -33,0 +33,0 @@ "v1/models/" + encodeURIComponent(id) + "/correction",

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Transport, { SendOptions } from "../Transport/index.js";

@@ -19,6 +19,6 @@ export interface Options extends SendOptions {

export default class GetModelRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Transport) {}
public async send({ id, request = {}, ...options }: Options) {
return this._client
return this._transport
.send(

@@ -25,0 +25,0 @@ "v1/models/" + encodeURIComponent(id),

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Transport, { SendOptions } from "../Transport/index.js";

@@ -18,6 +18,6 @@ export interface Options extends SendOptions {

export default class ListModelsRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Transport) {}
public async send({ request = {}, ...options }: Options = {}) {
return this._client
return this._transport
.send(

@@ -24,0 +24,0 @@ "v1/models",

@@ -11,3 +11,3 @@ /**

import { z } from "zod";
import Client, { SendOptions } from "../../Client/index.js";
import Transport, { SendOptions } from "../../Transport/index.js";

@@ -30,6 +30,6 @@ export interface Options extends SendOptions {

constructor(protected _client: Client) {}
constructor(protected _transport: Transport) {}
public async send({ id, body, request = {}, ...options }: Options) {
return this._client
return this._transport
.send(

@@ -36,0 +36,0 @@ "v1/models/" + encodeURIComponent(id) + "/response",

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Transport, { SendOptions } from "../Transport/index.js";

@@ -19,6 +19,6 @@ export interface Options extends SendOptions {

export default class GetSourceRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Transport) {}
public async send({ id, request = {}, ...options }: Options) {
return this._client
return this._transport
.send(

@@ -25,0 +25,0 @@ "v1/sources/" + encodeURIComponent(id),

@@ -10,3 +10,3 @@ /**

import Client, { SendOptions } from "../Client/index.js";
import Transport, { SendOptions } from "../Transport/index.js";

@@ -18,6 +18,6 @@ export interface Options extends SendOptions {

export default class ListSourcesRequest {
constructor(protected _client: Client) {}
constructor(protected _transport: Transport) {}
public async send({ request = {}, ...options }: Options = {}) {
return this._client
return this._transport
.send(

@@ -24,0 +24,0 @@ "v1/sources",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc