@mcma/api
Advanced tools
Comparing version 0.12.1 to 0.13.0
@@ -1,14 +0,17 @@ | ||
import { McmaResource } from "@mcma/core"; | ||
import { DefaultRouteBuilderType } from "./default-route-builder-type"; | ||
import { DefaultRoutes } from "./default-routes"; | ||
import { DefaultRouteBuilder } from "./default-route-builder"; | ||
export declare class DefaultRouteCollection<T extends McmaResource> { | ||
included: DefaultRouteBuilderType[]; | ||
query: DefaultRouteBuilder<T[]>; | ||
create: DefaultRouteBuilder<T>; | ||
get: DefaultRouteBuilder<T>; | ||
update: DefaultRouteBuilder<T>; | ||
delete: DefaultRouteBuilder<T>; | ||
constructor(initialRoutes: DefaultRoutes<T>); | ||
addAll(): this; | ||
import { McmaResource, McmaResourceType } from "@mcma/core"; | ||
import { DocumentDatabaseTableProvider } from "@mcma/data"; | ||
import { McmaApiRouteCollection } from "../route-collection"; | ||
import { DefaultQueryRoute } from "./default-query-route"; | ||
import { DefaultCreateRoute } from "./default-create-route"; | ||
import { DefaultGetRoute } from "./default-get-route"; | ||
import { DefaultUpdateRoute } from "./default-update-route"; | ||
import { DefaultDeleteRoute } from "./default-delete-route"; | ||
export declare class DefaultRouteCollection<T extends McmaResource> extends McmaApiRouteCollection { | ||
query: DefaultQueryRoute<T>; | ||
create: DefaultCreateRoute<T>; | ||
get: DefaultGetRoute<T>; | ||
update: DefaultUpdateRoute<T>; | ||
delete: DefaultDeleteRoute<T>; | ||
constructor(dbTableProvider: DocumentDatabaseTableProvider, resourceType: McmaResourceType<T>, root?: string); | ||
remove(key: "query" | "create" | "get" | "update" | "delete"): void; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class DefaultRouteCollection { | ||
constructor(initialRoutes) { | ||
var _a, _b, _c, _d, _e; | ||
this.included = []; | ||
this.query = (_a = initialRoutes) === null || _a === void 0 ? void 0 : _a.query; | ||
this.create = (_b = initialRoutes) === null || _b === void 0 ? void 0 : _b.create; | ||
this.get = (_c = initialRoutes) === null || _c === void 0 ? void 0 : _c.get; | ||
this.update = (_d = initialRoutes) === null || _d === void 0 ? void 0 : _d.update; | ||
this.delete = (_e = initialRoutes) === null || _e === void 0 ? void 0 : _e.delete; | ||
const core_1 = require("@mcma/core"); | ||
const strings_1 = require("../../strings"); | ||
const route_collection_1 = require("../route-collection"); | ||
const default_query_route_1 = require("./default-query-route"); | ||
const default_create_route_1 = require("./default-create-route"); | ||
const default_get_route_1 = require("./default-get-route"); | ||
const default_update_route_1 = require("./default-update-route"); | ||
const default_delete_route_1 = require("./default-delete-route"); | ||
class DefaultRouteCollection extends route_collection_1.McmaApiRouteCollection { | ||
constructor(dbTableProvider, resourceType, root) { | ||
super(); | ||
resourceType = core_1.Utils.getTypeName(resourceType); | ||
if (!resourceType) { | ||
throw new core_1.McmaException("Invalid resource type specified for default routes."); | ||
} | ||
root = root || strings_1.pluralizeKebabCase(strings_1.camelCaseToKebabCase(resourceType)); | ||
if (root[0] !== "/") { | ||
root = "/" + root; | ||
} | ||
this.query = new default_query_route_1.DefaultQueryRoute(dbTableProvider, root); | ||
this.create = new default_create_route_1.DefaultCreateRoute(dbTableProvider, root); | ||
this.get = new default_get_route_1.DefaultGetRoute(dbTableProvider, root); | ||
this.update = new default_update_route_1.DefaultUpdateRoute(dbTableProvider, root); | ||
this.delete = new default_delete_route_1.DefaultDeleteRoute(dbTableProvider, root); | ||
this.addRoutes([ | ||
this.query, | ||
this.create, | ||
this.get, | ||
this.update, | ||
this.delete | ||
]); | ||
} | ||
addAll() { | ||
this.included.push(this.query, this.create, this.get, this.update, this.delete); | ||
return this; | ||
remove(key) { | ||
const indexToRemove = this.routes.indexOf(this[key]); | ||
if (indexToRemove >= 0) { | ||
this.routes.splice(indexToRemove, 1); | ||
} | ||
this[key] = null; | ||
} | ||
} | ||
exports.DefaultRouteCollection = DefaultRouteCollection; |
@@ -1,11 +0,2 @@ | ||
export * from "./default-route-builder-type"; | ||
export * from "./default-route-builder"; | ||
export * from "./default-route-collection-builder"; | ||
export * from "./default-route-collection"; | ||
export * from "./default-route-configurator"; | ||
export * from "./default-route-handler-builder"; | ||
export * from "./default-route-handler-configurator"; | ||
export * from "./default-routes-jobs-ext"; | ||
export * from "./default-routes"; | ||
export * from "./route-completed-handler"; | ||
export * from "./route-started-handler"; | ||
export * from "./default-job-route-collection"; |
@@ -6,7 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./default-route-builder")); | ||
__export(require("./default-route-collection-builder")); | ||
__export(require("./default-route-collection")); | ||
__export(require("./default-route-configurator")); | ||
__export(require("./default-route-handler-configurator")); | ||
__export(require("./default-routes-jobs-ext")); | ||
__export(require("./default-job-route-collection")); |
import { McmaApiRoute } from "./route"; | ||
import { McmaApiRouteHandler } from "./route-handler"; | ||
export declare class McmaApiRouteCollection { | ||
private routes; | ||
protected routes: McmaApiRoute[]; | ||
constructor(routes?: McmaApiRoute[]); | ||
@@ -6,0 +6,0 @@ addRoute(methodOrRoute: string | McmaApiRoute, path?: string, handler?: McmaApiRouteHandler): McmaApiRouteCollection; |
{ | ||
"name": "@mcma/api", | ||
"version": "0.12.1", | ||
"version": "0.13.0", | ||
"description": "Node module for building APIs based on the EBU MCMA framework", | ||
@@ -40,10 +40,10 @@ "engines": { | ||
"peerDependencies": { | ||
"@mcma/client": "0.12.1", | ||
"@mcma/core": "0.12.1", | ||
"@mcma/data": "0.12.1" | ||
"@mcma/client": "0.13.0", | ||
"@mcma/core": "0.13.0", | ||
"@mcma/data": "0.13.0" | ||
}, | ||
"devDependencies": { | ||
"@mcma/client": "0.12.1", | ||
"@mcma/core": "0.12.1", | ||
"@mcma/data": "0.12.1", | ||
"@mcma/client": "0.13.0", | ||
"@mcma/core": "0.13.0", | ||
"@mcma/data": "0.13.0", | ||
"@types/node": "^13.7.4", | ||
@@ -50,0 +50,0 @@ "@types/pluralize": "0.0.29", |
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
56845
53
1203