New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@plattar/sdk-core

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plattar/sdk-core - npm Package Compare versions

Comparing version

to
1.163.9

30

dist/core/service.d.ts
export type ServiceAuthType = 'cookie' | 'token';
export type ServiceErrorHandler = 'silent' | 'console.error' | 'console.warn' | 'throw';
export type ServiceErrorListener = (err: Error) => void;
export interface ServiceAuth {
readonly type: ServiceAuthType;
readonly token?: string | null;
}
export interface ServiceOptions {
readonly gzip?: boolean | null;
readonly tls?: boolean | null;
readonly errorHandler?: ServiceErrorHandler | null;
readonly errorListener?: ServiceErrorListener | null;
readonly version?: string | null;
}
export interface ServiceConfig {
readonly url: string;
readonly version?: string;
readonly options?: ServiceOptions | null;
readonly auth?: ServiceAuth | null;

@@ -26,10 +33,17 @@ }

readonly url: string;
readonly version: string;
readonly options: {
readonly version: string;
readonly tls: boolean;
readonly gzip: boolean;
readonly errorHandler: ServiceErrorHandler;
readonly errorListener: ServiceErrorListener;
};
readonly auth: {
readonly type: ServiceAuthType;
readonly token: string | null;
readonly tls: boolean;
readonly gzip: boolean;
};
}
/**
* Allows configuration of a connection service to an api-core based backend service
*/
export declare abstract class Service {

@@ -41,5 +55,11 @@ private readonly _config;

*/
static config(config: ServiceConfig): Service;
static config(_config: ServiceConfig): Service;
/**
* Returns the default service object
*/
static get default(): Service;
static get container(): ServiceStaticContainer;
/**
* Returns the currently locked, read-only Service Configuration
*/
get config(): LockedServiceConfig;

@@ -46,0 +66,0 @@ /**

30

dist/core/service.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Service = void 0;
const util_1 = require("../generator/generators/util");
/**
* Allows configuration of a connection service to an api-core based backend service
*/
class Service {

@@ -9,12 +13,16 @@ _config;

// plus creates proper defaults
this._config = {
this._config = Object.freeze({
url: config.url,
version: config.version ? config.version : 'v3',
options: {
version: (config.options && config.options.version) ? config.options.version : 'v3',
tls: (config.options && config.options.tls) ? true : false,
gzip: (config.options && config.options.gzip) ? true : false,
errorHandler: (config.options && config.options.errorHandler) ? config.options.errorHandler : 'console.error',
errorListener: (config.options && config.options.errorListener && util_1.Util.isFunction(config.options.errorListener)) ? config.options.errorListener : (_) => { }
},
auth: {
type: (config.auth && config.auth.type) ? config.auth.type : 'cookie',
token: (config.auth && config.auth.token) ? config.auth.token : null,
tls: (config.auth && config.auth.tls) ? true : false,
gzip: (config.auth && config.auth.gzip) ? true : false
token: (config.auth && config.auth.token) ? config.auth.token : null
}
};
});
}

@@ -24,5 +32,8 @@ /**

*/
static config(config) {
static config(_config) {
throw new Error('Service.config is not implemented correctly, contact admin');
}
/**
* Returns the default service object
*/
static get default() {

@@ -37,2 +48,5 @@ if (!this.container.service) {

}
/**
* Returns the currently locked, read-only Service Configuration
*/
get config() {

@@ -45,5 +59,5 @@ return this._config;

get url() {
return `${this.config.url}/${this.config.version}`;
return `${this.config.url}/${this.config.options.version}`;
}
}
exports.Service = Service;

@@ -10,3 +10,2 @@ "use strict";

const fs_1 = __importDefault(require("fs"));
const util_1 = require("./generators/util");
class Generator {

@@ -67,3 +66,3 @@ static async generate(data) {

static generateServiceFile(data) {
const className = `${util_1.Util.capitaliseClassName(data.package.name)}Service`;
const className = `Connection`;
let output = `import { Service, ServiceConfig, ServiceStaticContainer } from '@plattar/sdk-core';\n\n`;

@@ -81,4 +80,4 @@ output += `export class ${className} extends Service {\n`;

return {
name: `${data.package.name}-service`,
fname: `${data.package.name}-service.ts`,
name: `connection-service`,
fname: `connection-service.ts`,
data: output

@@ -85,0 +84,0 @@ };

@@ -12,2 +12,6 @@ export declare class Util {

static getParams(value: string): Array<string>;
/**
* Checks if the provided object is a function
*/
static isFunction(obj: any): boolean;
}

@@ -39,3 +39,9 @@ "use strict";

}
/**
* Checks if the provided object is a function
*/
static isFunction(obj) {
return !!(obj && obj.constructor && obj.call && obj.apply);
}
}
exports.Util = Util;

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

declare const _default: "1.163.8";
declare const _default: "1.163.9";
export default _default;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = "1.163.8";
exports.default = "1.163.9";
{
"name": "@plattar/sdk-core",
"version": "1.163.8",
"version": "1.163.9",
"description": "Core SDK Module for Generative SDK using API Core",

@@ -5,0 +5,0 @@ "main": "dist/index.js",