@getanthill/datastore
Version:
Event-Sourced Datastore
1,016 lines (1,015 loc) • 25.8 kB
TypeScript
import type { Models } from '../../models';
import type { GenericType, Links, SpecFragment, BuiltLinks } from '../../typings';
export declare function build(origin: SpecFragment, models: Models): SpecFragment;
export declare function findLinks(model: GenericType, models: Models): Links;
export declare function eventNametoCamelCase(str: string): string;
export declare function buildFromModel(spec: SpecFragment, model: GenericType, links: Links): {
components: any;
tags: {
name: string;
description: string;
}[];
paths: any;
openapi: string;
servers: {
[key: string]: any;
description: "API Server";
url: "/api";
}[];
info: {
[key: string]: any;
title: string;
description: string;
version: string;
license: {
[key: string]: any;
name: string;
url: string;
};
};
};
export declare function getEntityName(model: GenericType | string, singular?: boolean): string;
export declare function defaultSchema(model: GenericType): {
tags: string[];
security: {
apiKey: never[];
}[];
responses: {
default: {
$ref: string;
};
};
};
export declare function buildAdditionalPaths(model: GenericType): {
[key: string]: {};
};
export declare function stream(models: Models, isSSE?: boolean): {
responses: {
200: {
description: string;
content: {
[x: string]: {
schema: {
type: string;
items: {
type: string;
};
example: {
firstname: string;
}[];
};
};
};
};
400: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
404: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
};
requestBody?: {
content: {
"application/json": {
schema: {
type: string;
items: {
type: string;
};
default: never[];
example: {
$match: {
'fullDocument.firstname': string;
};
}[];
};
};
};
} | undefined;
operationId: string;
summary: string;
description: string;
parameters: {
in: string;
name: string;
description: string;
schema: {
type: string;
example: string;
enum: string[];
};
required: boolean;
}[];
};
export declare function createModel(model: GenericType, links: Links): {
tags: string[];
security: {
apiKey: never[];
}[];
responses: {
default: {
$ref: string;
};
};
} & {
operationId: string;
summary: any;
description: any;
requestBody: {
content: {
"application/json": {
schema: {
properties: {};
required: any[] | undefined;
};
};
};
};
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
$ref: string;
};
};
};
links: BuiltLinks;
};
400: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
409: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
};
};
export declare function updateModel(model: GenericType, links: Links): {
tags: string[];
security: {
apiKey: never[];
}[];
responses: {
default: {
$ref: string;
};
};
} & {
operationId: string;
summary: any;
description: any;
parameters: {
in: string;
name: string;
description: string;
schema: {
type: string;
description: string;
example: string;
};
required: boolean;
}[];
requestBody: {
content: {
"application/json": {
schema: {
properties: {};
required: any[] | undefined;
};
};
};
};
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
$ref: string;
};
};
};
links: BuiltLinks;
};
400: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
409: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
422: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
};
};
export declare function patchModel(model: GenericType, links: Links): {
tags: string[];
security: {
apiKey: never[];
}[];
responses: {
default: {
$ref: string;
};
};
} & {
operationId: string;
summary: any;
description: any;
parameters: {
in: string;
name: string;
description: string;
schema: {
type: string;
description: string;
example: string;
};
required: boolean;
}[];
requestBody: {
content: {
"application/json": {
schema: {
type: string;
required: string[];
additionalProperties: boolean;
properties: {
json_patch: any;
};
};
};
};
};
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
$ref: string;
};
};
};
links: BuiltLinks;
};
400: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
409: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
422: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
};
};
export declare function getModels(model: GenericType, links: Links): {
tags: string[];
security: {
apiKey: never[];
}[];
responses: {
default: {
$ref: string;
};
};
} & {
operationId: string;
summary: string;
description: string;
parameters: any[];
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: string;
items: {
$ref: string;
};
};
};
};
headers: {
'correlation-field': {
description: string;
schema: {
type: string;
};
};
page: {
description: string;
schema: {
type: string;
minimum: number;
default: number;
};
};
'page-size': {
description: string;
schema: {
type: string;
minimum: number;
maximum: number;
default: number;
};
};
'page-count': {
description: string;
schema: {
type: string;
};
};
count: {
description: string;
schema: {
type: string;
minimum: number;
};
};
};
links: BuiltLinks;
};
400: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
};
};
export declare function getModel(model: GenericType, links: Links): {
tags: string[];
security: {
apiKey: never[];
}[];
responses: {
default: {
$ref: string;
};
};
} & {
operationId: string;
summary: string;
description: string;
parameters: ({
in: string;
name: string;
description: string;
schema: {
type: string;
description: string;
example: string;
};
required: boolean;
} | {
in: string;
name: string;
description: string;
schema: {
type: string;
enum: string[];
};
required?: undefined;
})[];
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
$ref: string;
};
};
};
links: BuiltLinks;
};
400: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
404: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
};
};
export declare function getModelAtVersion(model: GenericType, links: Links): {
tags: string[];
security: {
apiKey: never[];
}[];
responses: {
default: {
$ref: string;
};
};
} & {
operationId: string;
summary: string;
description: string;
parameters: ({
in: string;
name: string;
description: string;
schema: {
type: string;
description: string;
example: string;
};
required: boolean;
} | {
in: string;
name: string;
schema: {
type: string;
default: string;
};
required: boolean;
description: string;
})[];
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
$ref: string;
};
};
};
links: BuiltLinks;
};
400: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
404: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
};
};
export declare function restoreVersion(model: GenericType, links: Links): {
tags: string[];
security: {
apiKey: never[];
}[];
responses: {
default: {
$ref: string;
};
};
} & {
operationId: string;
summary: string;
description: string;
parameters: ({
in: string;
name: string;
description: string;
schema: {
type: string;
description: string;
example: string;
};
required: boolean;
} | {
in: string;
name: string;
schema: {
type: string;
default: number;
};
required: boolean;
description: string;
})[];
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
$ref: string;
};
};
};
links: BuiltLinks;
};
400: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
404: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
409: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
};
};
export declare function getModelEvents(model: GenericType, links: Links, options?: {
skipCorrelationField: boolean;
}): {
tags: string[];
security: {
apiKey: never[];
}[];
responses: {
default: {
$ref: string;
};
};
} & {
operationId: string;
summary: string;
description: string;
parameters: ({
in: string;
name: string;
description: string;
schema: {
type: string;
description: string;
example: string;
};
required: boolean;
} | {
description: string;
schema: {
type: string;
minimum: number;
default: number;
};
in: string;
name: string;
})[];
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: string;
items: {
type: string;
required: string[];
properties: {
type: {
type: string;
description: string;
example: string;
};
v: {
type: string;
description: string;
example: string;
};
version: {
type: string;
description: string;
example: number;
minimum: number;
};
};
};
};
};
};
links: BuiltLinks;
};
400: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
404: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
};
};
export declare function createModelSnapshot(model: GenericType, links: Links): {
tags: string[];
security: {
apiKey: never[];
}[];
responses: {
default: {
$ref: string;
};
};
} & {
operationId: string;
summary: string;
description: string;
parameters: {
in: string;
name: string;
description: string;
schema: {
type: string;
description: string;
example: string;
};
required: boolean;
}[];
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
$ref: string;
};
};
};
links: BuiltLinks;
};
400: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
422: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
};
};
export declare function encrypt(model: GenericType, links: Links): {
tags: string[];
security: {
apiKey: never[];
}[];
responses: {
default: {
$ref: string;
};
};
} & {
operationId: string;
summary: string;
description: string;
requestBody: {
content: {
"application/json": {
schema: {
type: string;
items: {
type: string;
properties: any;
};
};
};
};
};
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: string;
items: {
required: undefined;
};
};
};
};
links: BuiltLinks;
};
400: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
422: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
};
};
export declare function decrypt(model: GenericType, links: Links): {
tags: string[];
security: {
apiKey: never[];
}[];
responses: {
default: {
$ref: string;
};
};
} & {
operationId: string;
summary: string;
description: string;
requestBody: {
content: {
"application/json": {
schema: {
type: string;
items: {
type: string;
properties: any;
};
};
};
};
};
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: string;
items: {
additionalProperties: boolean;
required: undefined;
};
};
};
};
links: BuiltLinks;
};
400: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
422: {
description: string;
content: {
'application/json': {
example: {
status: number;
message: string;
};
schema: {
$ref: string;
};
};
};
};
};
};