@ajustee/cc-frontoffice
Advanced tools
Comparing version 0.1.0 to 0.1.1
/// <reference types="node" /> | ||
import { AwsLambda } from "./CcLambda"; | ||
import { CcLambda } from "./CcLambda"; | ||
import { OutgoingHttpHeaders } from "http2"; | ||
@@ -14,5 +14,5 @@ declare const enum DataType { | ||
} | ||
export declare class CcFrontOfficeApi { | ||
private readonly awsLambda; | ||
constructor(awsLambda: AwsLambda); | ||
export declare class CcFrontOffice { | ||
private readonly ccLambda; | ||
constructor(ccLambda: CcLambda); | ||
getConfigKeys(appId: string, path?: string, headers?: OutgoingHttpHeaders): Promise<CcKey[]>; | ||
@@ -19,0 +19,0 @@ getConfigKeys2(appId: string, path?: string, headers?: OutgoingHttpHeaders): Promise<CcKey[]>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class CcFrontOfficeApi { | ||
constructor(awsLambda) { | ||
this.awsLambda = awsLambda; | ||
class CcFrontOffice { | ||
constructor(ccLambda) { | ||
this.ccLambda = ccLambda; | ||
} | ||
@@ -12,3 +12,3 @@ async getConfigKeys(appId, path, headers) { | ||
headers = { 'x-api-key': appId }; | ||
const res = await this.awsLambda.sendRequestNoAuth(path ? `configurationKeys?path=${path}` : 'configurationKeys', headers); | ||
const res = await this.ccLambda.sendRequestNoAuth(path ? `configurationKeys?path=${path}` : 'configurationKeys', headers); | ||
if (res.status !== 200) | ||
@@ -23,3 +23,3 @@ throw new Error(`Invalid status code: ${res.status}. Content: ${res.content || 'undefined'}`); | ||
headers = { 'x-api-key': appId }; | ||
const res = await this.awsLambda.sendRequestNoAuth(path ? `config/${path}` : 'config', headers); | ||
const res = await this.ccLambda.sendRequestNoAuth(path ? `config/${path}` : 'config', headers); | ||
if (res.status !== 200) | ||
@@ -30,2 +30,2 @@ throw new Error(`Invalid status code: ${res.status}. Content: ${res.content || 'undefined'}`); | ||
} | ||
exports.CcFrontOfficeApi = CcFrontOfficeApi; | ||
exports.CcFrontOffice = CcFrontOffice; |
/// <reference types="node" /> | ||
import { OutgoingHttpHeaders } from 'http2'; | ||
export declare const enum AwsLambdaMethod { | ||
export declare const enum CcLambdaMethod { | ||
put = "PUT", | ||
@@ -9,7 +9,7 @@ post = "POST", | ||
} | ||
interface AwsLambdaResponse { | ||
interface CcLambdaResponse { | ||
status: number; | ||
content?: string; | ||
} | ||
export declare class AwsLambda { | ||
export declare class CcLambda { | ||
private readonly gatewayApiId; | ||
@@ -22,7 +22,7 @@ private readonly gatewayApiRegion; | ||
close(): Promise<void>; | ||
sendRequest(method: AwsLambdaMethod, lambdaPath: string, idToken: string): Promise<AwsLambdaResponse>; | ||
sendRequestNoAuth(lambdaPath: string, headers?: OutgoingHttpHeaders): Promise<AwsLambdaResponse>; | ||
sendPayloadRequest(method: AwsLambdaMethod, lambdaPath: string, isJson: boolean, data: string, idToken: string): Promise<AwsLambdaResponse>; | ||
sendRequest(method: CcLambdaMethod, lambdaPath: string, idToken: string): Promise<CcLambdaResponse>; | ||
sendRequestNoAuth(lambdaPath: string, headers?: OutgoingHttpHeaders): Promise<CcLambdaResponse>; | ||
sendPayloadRequest(method: CcLambdaMethod, lambdaPath: string, isJson: boolean, data: string, idToken: string): Promise<CcLambdaResponse>; | ||
private static readResponse; | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const http2_1 = require("http2"); | ||
class AwsLambda { | ||
class CcLambda { | ||
constructor(gatewayApiId, gatewayApiRegion, gatewayApiStage) { | ||
@@ -23,3 +23,3 @@ this.gatewayApiId = gatewayApiId; | ||
const stream = this.session.request({ ':method': method, ':path': `/${this.gatewayApiStage}/${lambdaPath}`, Authorization: idToken }); | ||
AwsLambda.readResponse(stream, resolve); | ||
CcLambda.readResponse(stream, resolve); | ||
}); | ||
@@ -36,3 +36,3 @@ } | ||
const stream = this.session.request(headers); | ||
AwsLambda.readResponse(stream, resolve); | ||
CcLambda.readResponse(stream, resolve); | ||
}); | ||
@@ -45,3 +45,3 @@ } | ||
stream.end(); | ||
AwsLambda.readResponse(stream, resolve); | ||
CcLambda.readResponse(stream, resolve); | ||
}); | ||
@@ -67,2 +67,2 @@ } | ||
} | ||
exports.AwsLambda = AwsLambda; | ||
exports.CcLambda = CcLambda; |
{ | ||
"name": "@ajustee/cc-frontoffice", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Ajustee Config Center FrontOffice API", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5964