Comparing version 0.17.3 to 0.18.0
@@ -5,3 +5,3 @@ import { ApiEdgeRelation } from "../relations/ApiEdgeRelation"; | ||
import { ApiQueryScope } from "../query/ApiQuery"; | ||
import { ApiEdgeMethod } from "./ApiEdgeMethod"; | ||
import { ApiEdgeMethod, ApiEdgeMethodScope } from "./ApiEdgeMethod"; | ||
import { ApiRequestType } from "../request/ApiRequest"; | ||
@@ -94,2 +94,3 @@ import { ApiEdgeAction, ApiEdgeActionTriggerKind, ApiEdgeActionTrigger } from "./ApiEdgeAction"; | ||
type: ApiRequestType; | ||
scope: ApiEdgeMethodScope; | ||
parameters: string[]; | ||
@@ -96,0 +97,0 @@ }[]; |
@@ -27,3 +27,8 @@ "use strict"; | ||
fields: this.schema.fields, | ||
methods: this.methods.map(m => ({ name: m.name, type: m.acceptedTypes, parameters: m.parameters })), | ||
methods: this.methods.map(m => ({ | ||
name: m.name, | ||
type: m.acceptedTypes, | ||
scope: m.scope, | ||
parameters: m.parameters | ||
})), | ||
typings: this.schema.originalSchema | ||
@@ -30,0 +35,0 @@ ? SchemaTypeMapper_1.SchemaTypeMapper.exportSchema(this.schema.originalSchema) |
import { ApiEdgeQueryContext } from "./ApiEdgeQueryContext"; | ||
import { ApiEdgeQueryResponse } from "./ApiEdgeQueryResponse"; | ||
import { ApiEdge, ApiEdgeDefinition } from "./ApiEdgeDefinition"; | ||
import { ApiQueryScope } from "../query/ApiQuery"; | ||
export declare abstract class ExternalApiProvider { | ||
protected metadata: any; | ||
constructor(metadata: any); | ||
protected constructor(metadata: any); | ||
abstract getEntry: (context: ApiEdgeQueryContext) => Promise<ApiEdgeQueryResponse>; | ||
@@ -14,2 +15,3 @@ abstract listEntries: (context: ApiEdgeQueryContext) => Promise<ApiEdgeQueryResponse>; | ||
abstract exists: (context: ApiEdgeQueryContext) => Promise<ApiEdgeQueryResponse>; | ||
abstract callMethod: (scope: ApiQueryScope) => Promise<ApiEdgeQueryResponse>; | ||
protected abstract prepare(): Promise<void>; | ||
@@ -16,0 +18,0 @@ edge(): Promise<ApiEdgeDefinition>; |
@@ -11,5 +11,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ApiEdgeQueryResponse_1 = require("./ApiEdgeQueryResponse"); | ||
const ApiEdgeSchema_1 = require("./ApiEdgeSchema"); | ||
const ApiEdgeDefinition_1 = require("./ApiEdgeDefinition"); | ||
const SchemaTypeMapper_1 = require("./utils/SchemaTypeMapper"); | ||
const ApiEdgeMethod_1 = require("./ApiEdgeMethod"); | ||
class ExternalApiProvider { | ||
@@ -59,2 +61,6 @@ constructor(metadata) { | ||
: null); | ||
const callMethod = provider ? provider.callMethod : () => __awaiter(this, void 0, void 0, function* () { return new ApiEdgeQueryResponse_1.ApiEdgeQueryResponse(null); }); | ||
for (let { name, scope, type, parameters } of metadata.methods) { | ||
this.methods.push(new ApiEdgeMethod_1.ApiEdgeMethod(name, callMethod, scope, type, parameters, false)); | ||
} | ||
this.allowGet = metadata.allowGet; | ||
@@ -61,0 +67,0 @@ this.allowList = metadata.allowList; |
{ | ||
"name": "api-core", | ||
"version": "0.17.3", | ||
"version": "0.18.0", | ||
"description": "Model-based dynamic multi-level APIs for any provider, plus multiple consumption channels", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -98,3 +98,8 @@ import {ApiEdgeRelation} from "../relations/ApiEdgeRelation"; | ||
fields: this.schema.fields, | ||
methods: this.methods.map(m => ({ name: m.name, type: m.acceptedTypes, parameters: m.parameters })), | ||
methods: this.methods.map(m => ({ | ||
name: m.name, | ||
type: m.acceptedTypes, | ||
scope: m.scope, | ||
parameters: m.parameters | ||
})), | ||
//relatedFields, | ||
@@ -101,0 +106,0 @@ typings: this.schema.originalSchema |
@@ -6,2 +6,4 @@ import {ApiEdgeQueryContext} from "./ApiEdgeQueryContext"; | ||
import {SchemaTypeMapper} from "./utils/SchemaTypeMapper"; | ||
import {ApiEdgeMethod} from "./ApiEdgeMethod"; | ||
import {ApiQueryScope} from "../query/ApiQuery"; | ||
@@ -11,3 +13,3 @@ export abstract class ExternalApiProvider { | ||
constructor(metadata: any) { | ||
protected constructor(metadata: any) { | ||
this.metadata = metadata | ||
@@ -23,2 +25,3 @@ } | ||
abstract exists: (context: ApiEdgeQueryContext) => Promise<ApiEdgeQueryResponse>; | ||
abstract callMethod: (scope: ApiQueryScope) => Promise<ApiEdgeQueryResponse>; | ||
@@ -50,2 +53,9 @@ protected abstract prepare(): Promise<void>; | ||
const callMethod = provider ? provider.callMethod : async () => new ApiEdgeQueryResponse(null); | ||
for(let { name, scope, type, parameters } of metadata.methods) { | ||
this.methods.push( | ||
new ApiEdgeMethod(name, callMethod, scope, type, parameters, false) | ||
) | ||
} | ||
this.allowGet = metadata.allowGet; | ||
@@ -52,0 +62,0 @@ this.allowList = metadata.allowList; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
616903
7613