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

api-core

Package Overview
Dependencies
Maintainers
1
Versions
225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-core - npm Package Compare versions

Comparing version 0.19.0 to 0.19.1

2

dist/src/query/ApiQuery.d.ts

@@ -19,6 +19,8 @@ /// <reference types="node" />

export declare class ApiQuery {
readonly id: string;
request: ApiRequest;
steps: QueryStep[];
constructor();
unshift: (step: QueryStep) => ApiQuery;
execute: (identity?: any) => Promise<ApiEdgeQueryResponse>;
}

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

const ApiEdgeQueryResponse_1 = require("../edge/ApiEdgeQueryResponse");
const uuid = require('uuid/v4');
class ApiQuery {

@@ -38,2 +39,3 @@ constructor() {

};
this.id = uuid();
}

@@ -40,0 +42,0 @@ }

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

const parse = require('obj-parse');
const debug = require('debug')('api-core');
class EmbedQueryQueryStep {

@@ -23,2 +24,3 @@ constructor(query, segment, request) {

return new Promise((resolve, reject) => {
debug(`[${scope.query.id}]`, this.inspect());
if (scope.response) {

@@ -131,2 +133,3 @@ const target = scope.response.data;

return new Promise((resolve, reject) => {
debug(`[${scope.query.id}]`, this.inspect());
this.query.body = scope.body;

@@ -150,6 +153,11 @@ this.query.context = scope.context;

return new Promise((resolve, reject) => {
this.method.execute(scope).then((response) => {
debug(`[${scope.query.id}]`, this.inspect());
this.method.execute(scope)
.then((response) => {
scope.response = response;
resolve(scope);
}).catch(reject);
}).catch((e) => {
debug(`failed to execute ${this.method.name} method`, e);
reject(e);
});
});

@@ -167,2 +175,3 @@ };

return new Promise((resolve, reject) => {
debug(`[${scope.query.id}]`, this.inspect());
if (!scope.response)

@@ -183,2 +192,3 @@ return reject(new ApiEdgeError_1.ApiEdgeError(404, "Missing Related Entry"));

return new Promise((resolve, reject) => {
debug(`[${scope.query.id}]`, this.inspect());
if (!scope.response)

@@ -199,2 +209,3 @@ return reject(new ApiEdgeError_1.ApiEdgeError(404, "Missing Related Entry"));

return new Promise((resolve, reject) => {
debug(`[${scope.query.id}]`, this.inspect());
if (!scope.body)

@@ -217,2 +228,3 @@ return reject(new ApiEdgeError_1.ApiEdgeError(404, "Missing Body"));

return new Promise(resolve => {
debug(`[${scope.query.id}]`, this.inspect());
scope.response = this.response;

@@ -232,2 +244,3 @@ scope.context = new ApiEdgeQueryContext_1.ApiEdgeQueryContext();

return new Promise(resolve => {
debug(`[${scope.query.id}]`, this.inspect());
scope.body = this.body;

@@ -248,2 +261,3 @@ scope.stream = this.stream;

return new Promise((resolve, reject) => {
debug(`[${scope.query.id}]`, this.inspect());
if (!scope.response)

@@ -264,2 +278,3 @@ return reject(new ApiEdgeError_1.ApiEdgeError(404, "Missing Entry"));

return new Promise(resolve => {
debug(`[${scope.query.id}]`, this.inspect());
scope.context.id = this.context.id || scope.context.id;

@@ -292,2 +307,3 @@ if (this.context.pagination) {

return new Promise(resolve => {
debug(`[${scope.query.id}]`, this.inspect());
this.apply(scope.context);

@@ -294,0 +310,0 @@ resolve(scope);

6

package.json
{
"name": "api-core",
"version": "0.19.0",
"version": "0.19.1",
"description": "Model-based dynamic multi-level APIs for any provider, plus multiple consumption channels",

@@ -58,6 +58,8 @@ "main": "dist/index.js",

"dependencies": {
"debug": "^4.1.1",
"deep-keys": "^0.3.0",
"obj-parse": "^0.3.0",
"simpl-schema": "^1.4.2"
"simpl-schema": "^1.4.2",
"uuid": "^3.3.2"
}
}
import {ApiEdgeQueryContext} from "../edge/ApiEdgeQueryContext";
import {ApiEdgeQueryResponse} from "../edge/ApiEdgeQueryResponse";
import {ApiRequest} from "../request/ApiRequest";
const uuid = require('uuid/v4');

@@ -22,5 +23,10 @@

export class ApiQuery {
readonly id: string;
request: ApiRequest;
steps: QueryStep[] = [];
constructor() {
this.id = uuid()
}
unshift = (step: QueryStep): ApiQuery => {

@@ -27,0 +33,0 @@ this.steps.unshift(step);

@@ -21,2 +21,3 @@ import {QueryStep, ApiQueryScope, ApiQuery} from "./ApiQuery";

const parse = require('obj-parse');
const debug = require('debug')('api-core');

@@ -48,2 +49,3 @@ export class EmbedQueryQueryStep implements QueryStep {

return new Promise((resolve, reject) => {
debug(`[${scope.query.id}]`, this.inspect());
if(scope.response) {

@@ -154,2 +156,4 @@ const target = scope.response.data;

return new Promise((resolve, reject) => {
debug(`[${scope.query.id}]`, this.inspect());
this.query.body = scope.body;

@@ -180,6 +184,12 @@ this.query.context = scope.context;

return new Promise((resolve, reject) => {
this.method.execute(scope).then((response) => {
scope.response = response;
resolve(scope)
}).catch(reject);
debug(`[${scope.query.id}]`, this.inspect());
this.method.execute(scope)
.then((response) => {
scope.response = response;
resolve(scope)
}).catch((e) => {
debug(`failed to execute ${this.method.name} method`, e);
reject(e)
});
})

@@ -200,2 +210,4 @@ };

return new Promise((resolve, reject) => {
debug(`[${scope.query.id}]`, this.inspect());
if(!scope.response) return reject(new ApiEdgeError(404, "Missing Related Entry"));

@@ -219,2 +231,4 @@ scope.context.filter(this.relation.relationId, ApiEdgeQueryFilterType.Equals, scope.response.data[this.relation.relatedId]);

return new Promise((resolve, reject) => {
debug(`[${scope.query.id}]`, this.inspect());
if(!scope.response) return reject(new ApiEdgeError(404, "Missing Related Entry"));

@@ -238,2 +252,4 @@ scope.context.filter(this.relation.relatedId, ApiEdgeQueryFilterType.Equals, scope.response.data[this.relation.relationId]);

return new Promise((resolve, reject) => {
debug(`[${scope.query.id}]`, this.inspect());
if(!scope.body) return reject(new ApiEdgeError(404, "Missing Body"));

@@ -287,2 +303,4 @@ if(!scope.response) return reject(new ApiEdgeError(404, "Missing Related Entry"));

return new Promise(resolve => {
debug(`[${scope.query.id}]`, this.inspect());
scope.response = this.response;

@@ -308,2 +326,4 @@ scope.context = new ApiEdgeQueryContext();

return new Promise(resolve => {
debug(`[${scope.query.id}]`, this.inspect());
scope.body = this.body;

@@ -327,2 +347,4 @@ scope.stream = this.stream;

return new Promise((resolve, reject) => {
debug(`[${scope.query.id}]`, this.inspect());
if(!scope.response) return reject(new ApiEdgeError(404, "Missing Entry"));

@@ -346,2 +368,4 @@ scope.context.id = scope.response.data[this.fieldName];

return new Promise(resolve => {
debug(`[${scope.query.id}]`, this.inspect());
scope.context.id = this.context.id || scope.context.id;

@@ -378,2 +402,4 @@ if(this.context.pagination) {

return new Promise(resolve => {
debug(`[${scope.query.id}]`, this.inspect());
this.apply(scope.context);

@@ -380,0 +406,0 @@ resolve(scope)

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

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

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

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

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

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

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