expresso-macchiato 0.4.8 → 0.4.10-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +23 -23
- package/dist/index.mjs +21 -21
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { DataSource, MixedList, EntitySchema, BaseEntity } from 'typeorm';
|
|
1
2
|
import { Request, Response as Response$1, RequestHandler, Router, Express } from 'express';
|
|
2
|
-
import { BaseEntity, MixedList, EntitySchema } from 'typeorm';
|
|
3
3
|
import { Socket, Namespace, Server as Server$1, ServerOptions } from 'socket.io';
|
|
4
4
|
import http from 'http';
|
|
5
5
|
import * as utils_logger_av from 'utils-logger-av';
|
|
@@ -50,6 +50,14 @@ type ListOptions = {
|
|
|
50
50
|
order?: 'ASC' | 'DESC';
|
|
51
51
|
} & SearchQuery;
|
|
52
52
|
|
|
53
|
+
declare class DbConnector {
|
|
54
|
+
private static DataSource;
|
|
55
|
+
static getDataSource: () => DataSource;
|
|
56
|
+
private readonly projectConfig;
|
|
57
|
+
constructor(projectConfig: ProjectConfigs);
|
|
58
|
+
connect: (entities: MixedList<Function | string | EntitySchema>, migrations?: string[], sync?: boolean, logging?: boolean) => Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
|
|
53
61
|
interface Info {
|
|
54
62
|
title: string;
|
|
55
63
|
version: string;
|
|
@@ -658,4 +666,4 @@ declare const socketNok: (message: string) => SocketConnectionNok;
|
|
|
658
666
|
declare const sleep: (ms: number) => Promise<unknown>;
|
|
659
667
|
declare const getCompiledPath: (__filename: string, __dirname: string, pathsWithoutExtension: string[]) => string[];
|
|
660
668
|
|
|
661
|
-
export { type ApiKeySecurity, BackgroundService, type BaseFormatContrainedParameter, type BaseOAuthSecurity, type BaseParameter, type BaseSchema, type BaseSecurity, type BasicAuthenticationSecurity, type BodyParameter, type Components, type ConnectedSocketClient, type Contact, type DefaultTokenPayload, type DynamicDbRouterOptions, type DynamicSwaggerOperation, type DynamicSwaggerOperationBody, type DynamicSwaggerPath, type DynamicSwaggerRequestBodyOperation, type ErrorsMapping, type ExpressReturn, type ExternalDocs, type FormDataParameter, type GenericFormat, type Header, type HeaderParameter, type Info, type IntegerFormat, type License, type ListOptions, type MethodPathHandling, type Methods, type NumberFormat, type OAuth2AccessCodeSecurity, type OAuth2ApplicationSecurity, type OAuth2ImplicitSecurity, type OAuth2PasswordSecurity, type OAuthScope, type Operation, type Parameter, type ParameterCollectionFormat, type ParameterType, type Path, type PathParameter, type ProjectConfigs, type QueryParameter, type Reference, type RequestBodyOperation, type Response, RouterWrapper, type RouterWrapperInterface, type Schema, type SchemaFormatConstraints, type SchemaV3, type SearchQuery, type SecureTokenConfig, type Security, type Server, type SocketConnectionMiddleware, type SocketConnectionNok, type SocketConnectionOk, SocketWrapper, type SocketWrapperConstructor, type Spec, Starter, type StarterOptions, type StringFormat, Swagger, type SwaggerMetadataInterface, type Tag, Token, type TokenApiOptions, type TokenConstructor, type XML, apiNok, apiOk, c, errorCatcher, fullLogNok, fullLogOk, getCompiledPath, i, log, sleep, socketNok, socketOk };
|
|
669
|
+
export { type ApiKeySecurity, BackgroundService, type BaseFormatContrainedParameter, type BaseOAuthSecurity, type BaseParameter, type BaseSchema, type BaseSecurity, type BasicAuthenticationSecurity, type BodyParameter, type Components, type ConnectedSocketClient, type Contact, DbConnector, type DefaultTokenPayload, type DynamicDbRouterOptions, type DynamicSwaggerOperation, type DynamicSwaggerOperationBody, type DynamicSwaggerPath, type DynamicSwaggerRequestBodyOperation, type ErrorsMapping, type ExpressReturn, type ExternalDocs, type FormDataParameter, type GenericFormat, type Header, type HeaderParameter, type Info, type IntegerFormat, type License, type ListOptions, type MethodPathHandling, type Methods, type NumberFormat, type OAuth2AccessCodeSecurity, type OAuth2ApplicationSecurity, type OAuth2ImplicitSecurity, type OAuth2PasswordSecurity, type OAuthScope, type Operation, type Parameter, type ParameterCollectionFormat, type ParameterType, type Path, type PathParameter, type ProjectConfigs, type QueryParameter, type Reference, type RequestBodyOperation, type Response, RouterWrapper, type RouterWrapperInterface, type Schema, type SchemaFormatConstraints, type SchemaV3, type SearchQuery, type SecureTokenConfig, type Security, type Server, type SocketConnectionMiddleware, type SocketConnectionNok, type SocketConnectionOk, SocketWrapper, type SocketWrapperConstructor, type Spec, Starter, type StarterOptions, type StringFormat, Swagger, type SwaggerMetadataInterface, type Tag, Token, type TokenApiOptions, type TokenConstructor, type XML, apiNok, apiOk, c, errorCatcher, fullLogNok, fullLogOk, getCompiledPath, i, log, sleep, socketNok, socketOk };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { DataSource, MixedList, EntitySchema, BaseEntity } from 'typeorm';
|
|
1
2
|
import { Request, Response as Response$1, RequestHandler, Router, Express } from 'express';
|
|
2
|
-
import { BaseEntity, MixedList, EntitySchema } from 'typeorm';
|
|
3
3
|
import { Socket, Namespace, Server as Server$1, ServerOptions } from 'socket.io';
|
|
4
4
|
import http from 'http';
|
|
5
5
|
import * as utils_logger_av from 'utils-logger-av';
|
|
@@ -50,6 +50,14 @@ type ListOptions = {
|
|
|
50
50
|
order?: 'ASC' | 'DESC';
|
|
51
51
|
} & SearchQuery;
|
|
52
52
|
|
|
53
|
+
declare class DbConnector {
|
|
54
|
+
private static DataSource;
|
|
55
|
+
static getDataSource: () => DataSource;
|
|
56
|
+
private readonly projectConfig;
|
|
57
|
+
constructor(projectConfig: ProjectConfigs);
|
|
58
|
+
connect: (entities: MixedList<Function | string | EntitySchema>, migrations?: string[], sync?: boolean, logging?: boolean) => Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
|
|
53
61
|
interface Info {
|
|
54
62
|
title: string;
|
|
55
63
|
version: string;
|
|
@@ -658,4 +666,4 @@ declare const socketNok: (message: string) => SocketConnectionNok;
|
|
|
658
666
|
declare const sleep: (ms: number) => Promise<unknown>;
|
|
659
667
|
declare const getCompiledPath: (__filename: string, __dirname: string, pathsWithoutExtension: string[]) => string[];
|
|
660
668
|
|
|
661
|
-
export { type ApiKeySecurity, BackgroundService, type BaseFormatContrainedParameter, type BaseOAuthSecurity, type BaseParameter, type BaseSchema, type BaseSecurity, type BasicAuthenticationSecurity, type BodyParameter, type Components, type ConnectedSocketClient, type Contact, type DefaultTokenPayload, type DynamicDbRouterOptions, type DynamicSwaggerOperation, type DynamicSwaggerOperationBody, type DynamicSwaggerPath, type DynamicSwaggerRequestBodyOperation, type ErrorsMapping, type ExpressReturn, type ExternalDocs, type FormDataParameter, type GenericFormat, type Header, type HeaderParameter, type Info, type IntegerFormat, type License, type ListOptions, type MethodPathHandling, type Methods, type NumberFormat, type OAuth2AccessCodeSecurity, type OAuth2ApplicationSecurity, type OAuth2ImplicitSecurity, type OAuth2PasswordSecurity, type OAuthScope, type Operation, type Parameter, type ParameterCollectionFormat, type ParameterType, type Path, type PathParameter, type ProjectConfigs, type QueryParameter, type Reference, type RequestBodyOperation, type Response, RouterWrapper, type RouterWrapperInterface, type Schema, type SchemaFormatConstraints, type SchemaV3, type SearchQuery, type SecureTokenConfig, type Security, type Server, type SocketConnectionMiddleware, type SocketConnectionNok, type SocketConnectionOk, SocketWrapper, type SocketWrapperConstructor, type Spec, Starter, type StarterOptions, type StringFormat, Swagger, type SwaggerMetadataInterface, type Tag, Token, type TokenApiOptions, type TokenConstructor, type XML, apiNok, apiOk, c, errorCatcher, fullLogNok, fullLogOk, getCompiledPath, i, log, sleep, socketNok, socketOk };
|
|
669
|
+
export { type ApiKeySecurity, BackgroundService, type BaseFormatContrainedParameter, type BaseOAuthSecurity, type BaseParameter, type BaseSchema, type BaseSecurity, type BasicAuthenticationSecurity, type BodyParameter, type Components, type ConnectedSocketClient, type Contact, DbConnector, type DefaultTokenPayload, type DynamicDbRouterOptions, type DynamicSwaggerOperation, type DynamicSwaggerOperationBody, type DynamicSwaggerPath, type DynamicSwaggerRequestBodyOperation, type ErrorsMapping, type ExpressReturn, type ExternalDocs, type FormDataParameter, type GenericFormat, type Header, type HeaderParameter, type Info, type IntegerFormat, type License, type ListOptions, type MethodPathHandling, type Methods, type NumberFormat, type OAuth2AccessCodeSecurity, type OAuth2ApplicationSecurity, type OAuth2ImplicitSecurity, type OAuth2PasswordSecurity, type OAuthScope, type Operation, type Parameter, type ParameterCollectionFormat, type ParameterType, type Path, type PathParameter, type ProjectConfigs, type QueryParameter, type Reference, type RequestBodyOperation, type Response, RouterWrapper, type RouterWrapperInterface, type Schema, type SchemaFormatConstraints, type SchemaV3, type SearchQuery, type SecureTokenConfig, type Security, type Server, type SocketConnectionMiddleware, type SocketConnectionNok, type SocketConnectionOk, SocketWrapper, type SocketWrapperConstructor, type Spec, Starter, type StarterOptions, type StringFormat, Swagger, type SwaggerMetadataInterface, type Tag, Token, type TokenApiOptions, type TokenConstructor, type XML, apiNok, apiOk, c, errorCatcher, fullLogNok, fullLogOk, getCompiledPath, i, log, sleep, socketNok, socketOk };
|
package/dist/index.js
CHANGED
|
@@ -58,15 +58,9 @@ var BackgroundService = class {
|
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
// src/RouterWrapper.ts
|
|
62
|
-
var _express = require('express'); var _express2 = _interopRequireDefault(_express);
|
|
63
|
-
|
|
64
|
-
// src/DynamicDbRouter.ts
|
|
65
|
-
var _typeorm = require('typeorm');
|
|
66
|
-
|
|
67
61
|
// src/DbConnector.ts
|
|
68
62
|
require('reflect-metadata');
|
|
69
|
-
|
|
63
|
+
var _typeorm = require('typeorm');
|
|
70
64
|
var _DbConnector = class _DbConnector {
|
|
71
65
|
constructor(projectConfig) {
|
|
72
66
|
this.connect = async (entities, migrations, sync, logging = false) => {
|
|
@@ -113,6 +107,12 @@ var _DbConnector = class _DbConnector {
|
|
|
113
107
|
_DbConnector.getDataSource = () => _DbConnector.DataSource;
|
|
114
108
|
var DbConnector = _DbConnector;
|
|
115
109
|
|
|
110
|
+
// src/RouterWrapper.ts
|
|
111
|
+
var _express = require('express'); var _express2 = _interopRequireDefault(_express);
|
|
112
|
+
|
|
113
|
+
// src/DynamicDbRouter.ts
|
|
114
|
+
|
|
115
|
+
|
|
116
116
|
// src/Swagger.ts
|
|
117
117
|
var _Swagger = class _Swagger {
|
|
118
118
|
};
|
|
@@ -627,8 +627,8 @@ var RouterWrapper = class {
|
|
|
627
627
|
constructor(data) {
|
|
628
628
|
this.createExpressRouter = () => {
|
|
629
629
|
const newRouter = _express.Router.call(void 0, );
|
|
630
|
+
const avoidOptionsForDefinedApis = [];
|
|
630
631
|
if (this.data.dbRouting) {
|
|
631
|
-
const avoidOptionsForDefinedApis = [];
|
|
632
632
|
if (_optionalChain([this, 'access', _17 => _17.data, 'access', _18 => _18.apis, 'optionalAccess', _19 => _19["/"], 'optionalAccess', _20 => _20.GET])) avoidOptionsForDefinedApis.push("LIST");
|
|
633
633
|
if (_optionalChain([this, 'access', _21 => _21.data, 'access', _22 => _22.apis, 'optionalAccess', _23 => _23["/:id"], 'optionalAccess', _24 => _24.GET])) avoidOptionsForDefinedApis.push("GET");
|
|
634
634
|
if (_optionalChain([this, 'access', _25 => _25.data, 'access', _26 => _26.apis, 'optionalAccess', _27 => _27["/"], 'optionalAccess', _28 => _28.POST])) avoidOptionsForDefinedApis.push("POST");
|
|
@@ -637,19 +637,6 @@ var RouterWrapper = class {
|
|
|
637
637
|
for (const avoid of _nullishCoalesce(this.data.dbRouting.avoid, () => ( []))) {
|
|
638
638
|
if (!avoidOptionsForDefinedApis.includes(avoid)) avoidOptionsForDefinedApis.push(avoid);
|
|
639
639
|
}
|
|
640
|
-
const { entity, bodyParameters, getParameters, primaryKey, secure, returningProps } = this.data.dbRouting;
|
|
641
|
-
DynamicDbRouter.createDbRouter({
|
|
642
|
-
entity,
|
|
643
|
-
bodyParameters,
|
|
644
|
-
getParameters,
|
|
645
|
-
primaryKey,
|
|
646
|
-
router: newRouter,
|
|
647
|
-
basePath: this.data.basePath,
|
|
648
|
-
tag: this.data.tag,
|
|
649
|
-
avoid: avoidOptionsForDefinedApis,
|
|
650
|
-
secure,
|
|
651
|
-
returningProps
|
|
652
|
-
});
|
|
653
640
|
}
|
|
654
641
|
if (this.data.swaggerNewSchemas) {
|
|
655
642
|
for (const schema in this.data.swaggerNewSchemas) Swagger.addSchema(schema, this.data.swaggerNewSchemas[schema].properties);
|
|
@@ -690,7 +677,19 @@ var RouterWrapper = class {
|
|
|
690
677
|
}
|
|
691
678
|
}
|
|
692
679
|
if (this.data.dbRouting) {
|
|
693
|
-
const { entity, bodyParameters, getParameters, primaryKey } = this.data.dbRouting;
|
|
680
|
+
const { entity, bodyParameters, getParameters, primaryKey, secure, returningProps } = this.data.dbRouting;
|
|
681
|
+
DynamicDbRouter.createDbRouter({
|
|
682
|
+
entity,
|
|
683
|
+
bodyParameters,
|
|
684
|
+
getParameters,
|
|
685
|
+
primaryKey,
|
|
686
|
+
router: newRouter,
|
|
687
|
+
basePath: this.data.basePath,
|
|
688
|
+
tag: this.data.tag,
|
|
689
|
+
avoid: avoidOptionsForDefinedApis,
|
|
690
|
+
secure,
|
|
691
|
+
returningProps
|
|
692
|
+
});
|
|
694
693
|
DynamicDbRouter.addDbRouterSwagger({
|
|
695
694
|
entity,
|
|
696
695
|
bodyParameters,
|
|
@@ -962,4 +961,5 @@ var Token = class {
|
|
|
962
961
|
|
|
963
962
|
|
|
964
963
|
|
|
965
|
-
|
|
964
|
+
|
|
965
|
+
exports.BackgroundService = BackgroundService; exports.DbConnector = DbConnector; exports.RouterWrapper = RouterWrapper; exports.SocketWrapper = SocketWrapper; exports.Starter = Starter; exports.Swagger = Swagger; exports.Token = Token; exports.apiNok = apiNok; exports.apiOk = apiOk; exports.c = c; exports.errorCatcher = errorCatcher; exports.fullLogNok = fullLogNok; exports.fullLogOk = fullLogOk; exports.getCompiledPath = getCompiledPath; exports.i = i; exports.log = log; exports.sleep = sleep; exports.socketNok = socketNok; exports.socketOk = socketOk;
|
package/dist/index.mjs
CHANGED
|
@@ -58,12 +58,6 @@ var BackgroundService = class {
|
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
// src/RouterWrapper.ts
|
|
62
|
-
import { Router } from "express";
|
|
63
|
-
|
|
64
|
-
// src/DynamicDbRouter.ts
|
|
65
|
-
import { EntityMetadataNotFoundError, Equal, Like } from "typeorm";
|
|
66
|
-
|
|
67
61
|
// src/DbConnector.ts
|
|
68
62
|
import "reflect-metadata";
|
|
69
63
|
import { DataSource } from "typeorm";
|
|
@@ -113,6 +107,12 @@ var _DbConnector = class _DbConnector {
|
|
|
113
107
|
_DbConnector.getDataSource = () => _DbConnector.DataSource;
|
|
114
108
|
var DbConnector = _DbConnector;
|
|
115
109
|
|
|
110
|
+
// src/RouterWrapper.ts
|
|
111
|
+
import { Router } from "express";
|
|
112
|
+
|
|
113
|
+
// src/DynamicDbRouter.ts
|
|
114
|
+
import { EntityMetadataNotFoundError, Equal, Like } from "typeorm";
|
|
115
|
+
|
|
116
116
|
// src/Swagger.ts
|
|
117
117
|
var _Swagger = class _Swagger {
|
|
118
118
|
};
|
|
@@ -627,8 +627,8 @@ var RouterWrapper = class {
|
|
|
627
627
|
constructor(data) {
|
|
628
628
|
this.createExpressRouter = () => {
|
|
629
629
|
const newRouter = Router();
|
|
630
|
+
const avoidOptionsForDefinedApis = [];
|
|
630
631
|
if (this.data.dbRouting) {
|
|
631
|
-
const avoidOptionsForDefinedApis = [];
|
|
632
632
|
if (this.data.apis?.["/"]?.GET) avoidOptionsForDefinedApis.push("LIST");
|
|
633
633
|
if (this.data.apis?.["/:id"]?.GET) avoidOptionsForDefinedApis.push("GET");
|
|
634
634
|
if (this.data.apis?.["/"]?.POST) avoidOptionsForDefinedApis.push("POST");
|
|
@@ -637,19 +637,6 @@ var RouterWrapper = class {
|
|
|
637
637
|
for (const avoid of this.data.dbRouting.avoid ?? []) {
|
|
638
638
|
if (!avoidOptionsForDefinedApis.includes(avoid)) avoidOptionsForDefinedApis.push(avoid);
|
|
639
639
|
}
|
|
640
|
-
const { entity, bodyParameters, getParameters, primaryKey, secure, returningProps } = this.data.dbRouting;
|
|
641
|
-
DynamicDbRouter.createDbRouter({
|
|
642
|
-
entity,
|
|
643
|
-
bodyParameters,
|
|
644
|
-
getParameters,
|
|
645
|
-
primaryKey,
|
|
646
|
-
router: newRouter,
|
|
647
|
-
basePath: this.data.basePath,
|
|
648
|
-
tag: this.data.tag,
|
|
649
|
-
avoid: avoidOptionsForDefinedApis,
|
|
650
|
-
secure,
|
|
651
|
-
returningProps
|
|
652
|
-
});
|
|
653
640
|
}
|
|
654
641
|
if (this.data.swaggerNewSchemas) {
|
|
655
642
|
for (const schema in this.data.swaggerNewSchemas) Swagger.addSchema(schema, this.data.swaggerNewSchemas[schema].properties);
|
|
@@ -690,7 +677,19 @@ var RouterWrapper = class {
|
|
|
690
677
|
}
|
|
691
678
|
}
|
|
692
679
|
if (this.data.dbRouting) {
|
|
693
|
-
const { entity, bodyParameters, getParameters, primaryKey } = this.data.dbRouting;
|
|
680
|
+
const { entity, bodyParameters, getParameters, primaryKey, secure, returningProps } = this.data.dbRouting;
|
|
681
|
+
DynamicDbRouter.createDbRouter({
|
|
682
|
+
entity,
|
|
683
|
+
bodyParameters,
|
|
684
|
+
getParameters,
|
|
685
|
+
primaryKey,
|
|
686
|
+
router: newRouter,
|
|
687
|
+
basePath: this.data.basePath,
|
|
688
|
+
tag: this.data.tag,
|
|
689
|
+
avoid: avoidOptionsForDefinedApis,
|
|
690
|
+
secure,
|
|
691
|
+
returningProps
|
|
692
|
+
});
|
|
694
693
|
DynamicDbRouter.addDbRouterSwagger({
|
|
695
694
|
entity,
|
|
696
695
|
bodyParameters,
|
|
@@ -945,6 +944,7 @@ var Token = class {
|
|
|
945
944
|
};
|
|
946
945
|
export {
|
|
947
946
|
BackgroundService,
|
|
947
|
+
DbConnector,
|
|
948
948
|
RouterWrapper,
|
|
949
949
|
SocketWrapper,
|
|
950
950
|
Starter,
|