Comparing version 0.35.1 to 0.35.2
import { Auth } from "./auth"; | ||
import { ClientOpts } from "./types"; | ||
import { GraphQLClient } from "./graphql/client"; | ||
import { ClientOpts } from "./types"; | ||
export declare class Client<T extends Partial<ClientOpts> = ClientOpts> { | ||
auth: T extends { | ||
clientId?: string | undefined; | ||
clientId: string; | ||
} ? Auth : undefined; | ||
@@ -18,3 +18,3 @@ graphQL: GraphQLClient; | ||
constructor(opts: T, baseUrl?: string, baseSubscriptionUrl?: string, auth?: T extends { | ||
clientId?: string | undefined; | ||
clientId: string; | ||
} ? Auth : undefined, graphQL?: GraphQLClient, models?: { | ||
@@ -21,0 +21,0 @@ account: import("./graphql/account").Account; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var constants_1 = require("./constants"); | ||
var auth_1 = require("./auth"); | ||
var constants_1 = require("./constants"); | ||
var client_1 = require("./graphql/client"); | ||
var graphql_1 = require("./graphql"); | ||
var client_1 = require("./graphql/client"); | ||
var Client = /** @class */ (function () { | ||
@@ -11,3 +11,3 @@ function Client(opts, baseUrl, baseSubscriptionUrl, auth, graphQL, models) { | ||
if (baseSubscriptionUrl === void 0) { baseSubscriptionUrl = opts.baseSubscriptionUrl || constants_1.KONTIST_SUBSCRIPTION_API_BASE_URL; } | ||
if (auth === void 0) { auth = opts.hasOwnProperty("clientId") ? new auth_1.Auth(baseUrl, opts) : undefined; } | ||
if (auth === void 0) { auth = opts.clientId ? new auth_1.Auth(baseUrl, opts) : undefined; } | ||
if (graphQL === void 0) { graphQL = new client_1.GraphQLClient({ | ||
@@ -14,0 +14,0 @@ auth: auth, |
@@ -20,3 +20,3 @@ import * as ClientOAuth2 from "client-oauth2"; | ||
baseSubscriptionUrl?: string; | ||
clientId?: string; | ||
clientId: string; | ||
clientSecret?: string; | ||
@@ -23,0 +23,0 @@ oauthClient?: ClientOAuth2; |
{ | ||
"name": "kontist", | ||
"version": "0.35.1", | ||
"version": "0.35.2", | ||
"description": "Kontist client SDK", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/index.js", |
@@ -1,3 +0,1 @@ | ||
import { Client } from "../lib"; | ||
import { ClientOpts } from "../lib/types"; | ||
import { | ||
@@ -10,2 +8,5 @@ Transaction, | ||
import { Client } from "../lib"; | ||
import { ClientOpts } from "../lib/types"; | ||
export const clientId = "26990216-e340-4f54-b5a5-df9baacc0440"; | ||
@@ -17,15 +18,9 @@ export const redirectUri = "https://localhost:3000/auth/callback"; | ||
export const createClient = (opts: Partial<ClientOpts> = {}) => { | ||
const { clientId: optClientId, ...rest } = opts; | ||
// trying to trim clientId from request | ||
const clientIdObj = opts.hasOwnProperty("clientId") && optClientId === undefined | ||
? {} | ||
: { clientId: optClientId ?? clientId }; | ||
return new Client({ | ||
...clientIdObj, | ||
clientId, | ||
redirectUri, | ||
scopes, | ||
state: opts.state || state, | ||
...rest, | ||
state, | ||
...opts, | ||
}); | ||
@@ -32,0 +27,0 @@ }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
672509
11560