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

@mcma/api

Package Overview
Dependencies
Maintainers
3
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mcma/api - npm Package Compare versions

Comparing version 0.11.1 to 0.12.0

4

dist/lib/http/http-statuses.d.ts

@@ -10,3 +10,3 @@ export declare enum HttpStatusCode {

NonAuthoritativeInformation = 203,
NoConsent = 204,
NoContent = 204,
ResetContent = 205,

@@ -40,3 +40,3 @@ PartialContent = 206,

UnsupportedMediaType = 415,
RequiredRangeNotSatisfiable = 416,
RequestedRangeNotSatisfiable = 416,
ExpectationFailed = 417,

@@ -43,0 +43,0 @@ IAmATeapot = 418,

@@ -13,3 +13,3 @@ "use strict";

HttpStatusCode[HttpStatusCode["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
HttpStatusCode[HttpStatusCode["NoConsent"] = 204] = "NoConsent";
HttpStatusCode[HttpStatusCode["NoContent"] = 204] = "NoContent";
HttpStatusCode[HttpStatusCode["ResetContent"] = 205] = "ResetContent";

@@ -43,3 +43,3 @@ HttpStatusCode[HttpStatusCode["PartialContent"] = 206] = "PartialContent";

HttpStatusCode[HttpStatusCode["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
HttpStatusCode[HttpStatusCode["RequiredRangeNotSatisfiable"] = 416] = "RequiredRangeNotSatisfiable";
HttpStatusCode[HttpStatusCode["RequestedRangeNotSatisfiable"] = 416] = "RequestedRangeNotSatisfiable";
HttpStatusCode[HttpStatusCode["ExpectationFailed"] = 417] = "ExpectationFailed";

@@ -87,3 +87,3 @@ HttpStatusCode[HttpStatusCode["IAmATeapot"] = 418] = "IAmATeapot";

return "Non-Authoritative Information";
case HttpStatusCode.NoConsent:
case HttpStatusCode.NoContent:
return "No Content";

@@ -146,3 +146,3 @@ case HttpStatusCode.ResetContent:

return "Unsupported Media Type";
case HttpStatusCode.RequiredRangeNotSatisfiable:
case HttpStatusCode.RequestedRangeNotSatisfiable:
return "Requested Range Not Satisfiable";

@@ -149,0 +149,0 @@ case HttpStatusCode.ExpectationFailed:

@@ -7,6 +7,5 @@ import { McmaResourceType, McmaResource } from "@mcma/core";

import { DefaultRouteBuilder } from "./default-route-builder";
import { DefaultRoutesPartitionKeyProviders } from "./default-routes-partition-key-providers";
export declare class DefaultRouteCollectionBuilder<T extends McmaResource> {
private routes;
constructor(dbTableProvider: DocumentDatabaseTableProvider, resourceType: McmaResourceType<T>, root?: string, partitionKeyProviders?: DefaultRoutesPartitionKeyProviders<T>);
constructor(dbTableProvider: DocumentDatabaseTableProvider, resourceType: McmaResourceType<T>, root?: string);
build(): McmaApiRouteCollection;

@@ -13,0 +12,0 @@ addAll(): this;

@@ -9,5 +9,4 @@ "use strict";

const default_route_collection_1 = require("./default-route-collection");
const default_routes_partition_key_providers_1 = require("./default-routes-partition-key-providers");
class DefaultRouteCollectionBuilder {
constructor(dbTableProvider, resourceType, root, partitionKeyProviders) {
constructor(dbTableProvider, resourceType, root) {
resourceType = core_1.Utils.getTypeName(resourceType);

@@ -21,11 +20,8 @@ if (!resourceType) {

}
if (!partitionKeyProviders) {
partitionKeyProviders = default_routes_partition_key_providers_1.getConstantPartitionKeyProviders(core_1.Utils.getTypeName(resourceType));
}
this.routes = new default_route_collection_1.DefaultRouteCollection({
query: routes.defaultQueryBuilder(dbTableProvider, root, partitionKeyProviders.query),
create: routes.defaultCreateBuilder(dbTableProvider, root, partitionKeyProviders.create),
get: routes.defaultGetBuilder(dbTableProvider, root, partitionKeyProviders.get),
update: routes.defaultUpdateBuilder(dbTableProvider, root, partitionKeyProviders.update),
delete: routes.defaultDeleteBuilder(dbTableProvider, root, partitionKeyProviders.delete)
query: routes.defaultQueryBuilder(dbTableProvider, root),
create: routes.defaultCreateBuilder(dbTableProvider, root),
get: routes.defaultGetBuilder(dbTableProvider, root),
update: routes.defaultUpdateBuilder(dbTableProvider, root),
delete: routes.defaultDeleteBuilder(dbTableProvider, root)
});

@@ -32,0 +28,0 @@ }

@@ -20,3 +20,3 @@ "use strict";

await workerInvoker.invoke(context_variable_provider_ext_1.getWorkerFunctionId(requestContext), "ProcessJobAssignment", requestContext.getAllContextVariables(), {
jobAssignmentId: jobAssignment.id
jobAssignmentId: jobAssignment.id.replace(context_variable_provider_ext_1.getPublicUrl(requestContext), "")
}, jobAssignment.tracker);

@@ -23,0 +23,0 @@ return jobAssignment;

import { McmaResource } from "@mcma/core";
import { DocumentDatabaseTableProvider } from "@mcma/data";
import { DefaultRouteBuilder } from "../default-route-builder";
import { McmaApiRequestContext } from "../../../http/mcma-api-request-context";
export declare function defaultCreateBuilder<T extends McmaResource>(dbTableProvider: DocumentDatabaseTableProvider, root: string, partitionKeyProvider?: ((requestContext: McmaApiRequestContext, resource: T) => string)): DefaultRouteBuilder<T>;
export declare function defaultCreateBuilder<T extends McmaResource>(dbTableProvider: DocumentDatabaseTableProvider, root: string): DefaultRouteBuilder<T>;

@@ -8,3 +8,3 @@ "use strict";

const default_route_builder_1 = require("../default-route-builder");
function defaultCreateBuilder(dbTableProvider, root, partitionKeyProvider) {
function defaultCreateBuilder(dbTableProvider, root) {
return new default_route_builder_1.DefaultRouteBuilder("POST", root, new default_route_handler_configurator_1.DefaultRouteHandlerConfigurator((onStarted, onCompleted) => async (requestContext) => {

@@ -22,6 +22,6 @@ if (onStarted) {

}
core_1.onResourceCreate(resource, context_variable_provider_ext_1.getPublicUrl(requestContext) + root + "/" + uuid_1.v4());
const resourcePath = root + "/" + uuid_1.v4();
core_1.onResourceCreate(resource, context_variable_provider_ext_1.getPublicUrl(requestContext) + resourcePath);
const dbTable = await dbTableProvider.get(core_1.getTableName(requestContext));
const partitionKey = partitionKeyProvider(requestContext, resource);
await dbTable.put(partitionKey, resource.id, resource);
await dbTable.put(resourcePath, resource);
if (onCompleted) {

@@ -28,0 +28,0 @@ await onCompleted(requestContext, resource);

import { McmaResource } from "@mcma/core";
import { DocumentDatabaseTableProvider } from "@mcma/data";
import { DefaultRouteBuilder } from "../default-route-builder";
import { McmaApiRequestContext } from "../../../http/mcma-api-request-context";
export declare function defaultDeleteBuilder<T extends McmaResource>(dbTableProvider: DocumentDatabaseTableProvider, root: string, partitionKeyProvider: ((requestContext: McmaApiRequestContext) => string)): DefaultRouteBuilder<T>;
export declare function defaultDeleteBuilder<T extends McmaResource>(dbTableProvider: DocumentDatabaseTableProvider, root: string): DefaultRouteBuilder<T>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@mcma/core");
const context_variable_provider_ext_1 = require("../../../context-variable-provider-ext");
const default_route_handler_configurator_1 = require("../default-route-handler-configurator");
const default_route_builder_1 = require("../default-route-builder");
function defaultDeleteBuilder(dbTableProvider, root, partitionKeyProvider) {
function defaultDeleteBuilder(dbTableProvider, root) {
return new default_route_builder_1.DefaultRouteBuilder("DELETE", root + "/{id}", new default_route_handler_configurator_1.DefaultRouteHandlerConfigurator((onStarted, onCompleted) => async (requestContext) => {

@@ -16,5 +15,3 @@ if (onStarted) {

const table = await dbTableProvider.get(core_1.getTableName(requestContext));
const id = context_variable_provider_ext_1.getPublicUrl(requestContext) + requestContext.request.path;
const partitionKey = partitionKeyProvider(requestContext);
const resource = await table.get(partitionKey, id);
const resource = await table.get(requestContext.request.path);
if (!resource) {

@@ -24,3 +21,3 @@ requestContext.setResponseResourceNotFound();

}
await table.delete(partitionKey, id);
await table.delete(requestContext.request.path);
if (onCompleted) {

@@ -27,0 +24,0 @@ await onCompleted(requestContext, resource);

import { McmaResource } from "@mcma/core";
import { DocumentDatabaseTableProvider } from "@mcma/data";
import { DefaultRouteBuilder } from "../default-route-builder";
import { McmaApiRequestContext } from "../../../http/mcma-api-request-context";
export declare function defaultGetBuilder<T extends McmaResource>(dbTableProvider: DocumentDatabaseTableProvider, root: string, partitionKeyProvider: ((requestContext: McmaApiRequestContext) => string)): DefaultRouteBuilder<T>;
export declare function defaultGetBuilder<T extends McmaResource>(dbTableProvider: DocumentDatabaseTableProvider, root: string): DefaultRouteBuilder<T>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@mcma/core");
const context_variable_provider_ext_1 = require("../../../context-variable-provider-ext");
const default_route_handler_configurator_1 = require("../default-route-handler-configurator");
const default_route_builder_1 = require("../default-route-builder");
function defaultGetBuilder(dbTableProvider, root, partitionKeyProvider) {
function defaultGetBuilder(dbTableProvider, root) {
return new default_route_builder_1.DefaultRouteBuilder("GET", root + "/{id}", new default_route_handler_configurator_1.DefaultRouteHandlerConfigurator((onStarted, onCompleted) => async (requestContext) => {

@@ -15,6 +14,4 @@ if (onStarted) {

}
const id = context_variable_provider_ext_1.getPublicUrl(requestContext) + requestContext.request.path;
const dbTable = await dbTableProvider.get(core_1.getTableName(requestContext));
const partitionKey = partitionKeyProvider(requestContext);
const resource = await dbTable.get(partitionKey, id);
const resource = await dbTable.get(requestContext.request.path);
if (onCompleted) {

@@ -21,0 +18,0 @@ await onCompleted(requestContext, resource);

import { McmaResource } from "@mcma/core";
import { DocumentDatabaseTableProvider } from "@mcma/data";
import { DefaultRouteBuilder } from "../default-route-builder";
import { McmaApiRequestContext } from "../../../http/mcma-api-request-context";
export declare function defaultQueryBuilder<T extends McmaResource>(dbTableProvider: DocumentDatabaseTableProvider, root: string, partitionKeyProvider?: ((requestContext: McmaApiRequestContext) => string)): DefaultRouteBuilder<T[]>;
export declare function defaultQueryBuilder<T extends McmaResource>(dbTableProvider: DocumentDatabaseTableProvider, root: string): DefaultRouteBuilder<T[]>;

@@ -7,3 +7,3 @@ "use strict";

const default_route_builder_1 = require("../default-route-builder");
function defaultQueryBuilder(dbTableProvider, root, partitionKeyProvider) {
function defaultQueryBuilder(dbTableProvider, root) {
return new default_route_builder_1.DefaultRouteBuilder("GET", root, new default_route_handler_configurator_1.DefaultRouteHandlerConfigurator((onStarted, onCompleted) => async (requestContext) => {

@@ -16,3 +16,3 @@ if (onStarted) {

}
const filter = requestContext.request.queryStringParameters && Object.keys(requestContext.request.queryStringParameters).length > 0
const filterExpression = requestContext.request.queryStringParameters && Object.keys(requestContext.request.queryStringParameters).length > 0
? data_1.getFilterExpressionFromKeyValuePairs(requestContext.request.queryStringParameters)

@@ -35,4 +35,3 @@ : null;

const table = await dbTableProvider.get(core_1.getTableName(requestContext));
const partitionKey = partitionKeyProvider(requestContext);
const resources = await table.query({ partitionKey, pageNumber, pageSize, filter });
const resources = await table.query({ path: requestContext.request.path, pageNumber, pageSize, filterExpression });
if (onCompleted) {

@@ -39,0 +38,0 @@ await onCompleted(requestContext, resources);

import { McmaResource } from "@mcma/core";
import { DocumentDatabaseTableProvider } from "@mcma/data";
import { DefaultRouteBuilder } from "../default-route-builder";
import { McmaApiRequestContext } from "../../../http/mcma-api-request-context";
export declare function defaultUpdateBuilder<T extends McmaResource>(dbTableProvider: DocumentDatabaseTableProvider, root: string, partitionKeyProvider: ((requestContext: McmaApiRequestContext, resource: T) => string)): DefaultRouteBuilder<T>;
export declare function defaultUpdateBuilder<T extends McmaResource>(dbTableProvider: DocumentDatabaseTableProvider, root: string): DefaultRouteBuilder<T>;

@@ -7,3 +7,3 @@ "use strict";

const default_route_builder_1 = require("../default-route-builder");
function defaultUpdateBuilder(dbTableProvider, root, partitionKeyProvider) {
function defaultUpdateBuilder(dbTableProvider, root) {
return new default_route_builder_1.DefaultRouteBuilder("PUT", root + "/{id}", new default_route_handler_configurator_1.DefaultRouteHandlerConfigurator((onStarted, onCompleted) => async (requestContext) => {

@@ -23,4 +23,3 @@ if (onStarted) {

const dbTable = await dbTableProvider.get(core_1.getTableName(requestContext));
const partitionKey = partitionKeyProvider(requestContext, resource);
await dbTable.put(partitionKey, resource.id, resource);
await dbTable.put(requestContext.request.path, resource);
if (onCompleted) {

@@ -27,0 +26,0 @@ await onCompleted(requestContext, resource);

import { McmaApiRequestContext } from "../http/mcma-api-request-context";
export declare type McmaApiRouteHandler = (requestContxt: McmaApiRequestContext) => Promise<void>;
export declare type McmaApiRouteHandler = (requestContext: McmaApiRequestContext) => Promise<void>;
{
"name": "@mcma/api",
"version": "0.11.1",
"version": "0.12.0",
"description": "Node module for building APIs based on the EBU MCMA framework",

@@ -40,10 +40,10 @@ "engines": {

"peerDependencies": {
"@mcma/client": "0.11.1",
"@mcma/core": "0.11.1",
"@mcma/data": "0.11.1"
"@mcma/client": "0.12.0",
"@mcma/core": "0.12.0",
"@mcma/data": "0.12.0"
},
"devDependencies": {
"@mcma/client": "0.11.1",
"@mcma/core": "0.11.1",
"@mcma/data": "0.11.1",
"@mcma/client": "0.12.0",
"@mcma/core": "0.12.0",
"@mcma/data": "0.12.0",
"@types/node": "^13.7.4",

@@ -50,0 +50,0 @@ "@types/pluralize": "0.0.29",

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