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

@bluexlab/maos-ts

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bluexlab/maos-ts - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

19

dist/index.d.ts

@@ -1,4 +0,17 @@

declare const foo = "foo";
declare function fn(): void;
interface MaosConfig {
apiKey?: string;
coreUrl?: string;
}
interface MaosResponse {
[key: string]: object;
}
export { fn, foo };
declare class Maos {
private apiKey;
private coreUrl;
constructor(config?: MaosConfig);
private fetchWithAuth;
getConfig(): Promise<MaosResponse>;
}
export { Maos, type MaosConfig, type MaosResponse };

@@ -1,8 +0,39 @@

// src/index.ts
var foo = "foo";
function fn() {
}
// src/maos.ts
import process from "process";
var Maos = class {
apiKey;
coreUrl;
constructor(config = {}) {
this.apiKey = config.apiKey || process.env.APIKEY || "";
this.coreUrl = config.coreUrl || process.env.CORE_URL || "";
if (!this.apiKey) {
throw new Error("API key is required. Please provide it in the constructor or set the APIKEY environment variable.");
}
if (!this.coreUrl) {
throw new Error("Core URL is required. Please provide it in the constructor or set the CORE_URL environment variable.");
}
}
async fetchWithAuth(endpoint, options = {}) {
const url = `${this.coreUrl}${endpoint}`;
const headers = new Headers({
"Authorization": `Bearer ${this.apiKey}`,
"Content-Type": "application/json",
...options.headers
});
const response = await fetch(url, { ...options, headers });
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
}
async getConfig() {
try {
return await this.fetchWithAuth("/config");
} catch (error) {
throw new Error(`Failed to get config: ${error instanceof Error ? error.message : error}`);
}
}
};
export {
fn,
foo
Maos
};

5

package.json
{
"name": "@bluexlab/maos-ts",
"type": "module",
"version": "0.0.1",
"version": "0.0.2",
"description": "TypeScript binding of MAOS",

@@ -27,2 +27,5 @@ "author": "Kevin Chung <kevin@bluextrade.com>",

},
"dependencies": {
"process": "^0.11.10"
},
"devDependencies": {

@@ -29,0 +32,0 @@ "@antfu/eslint-config": "^2.22.4",

# MAOS TypeScript Library
![MAOS Logo](./path-to-logo.png)
## Introduction

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

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