@hapiboo/flux 1.0.2 → 1.0.4
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/application.d.ts +1 -0
- package/dist/application.js +21 -2
- package/dist/decorators.d.ts +2 -2
- package/dist/decorators.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/interfaces.d.ts +2 -2
- package/dist/types.d.ts +8 -2
- package/dist/types.js +7 -2
- package/package.json +1 -1
package/dist/application.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare namespace fluxApplication {
|
|
|
7
7
|
function start(): void;
|
|
8
8
|
namespace repository {
|
|
9
9
|
function initializeModels(): IResponsePromiseVoid;
|
|
10
|
+
function countModel(source: FluxObjectCreator): IResponsePromise<number>;
|
|
10
11
|
function deleteModel(source: FluxObjectCreator, identifier: string): IResponsePromiseVoid;
|
|
11
12
|
function createModel<T extends IFluxObject>(source: FluxObjectCreator, item: T): IResponsePromise<T>;
|
|
12
13
|
function updateModel<T extends IFluxObject>(source: FluxObjectCreator, item: T): IResponsePromise<T>;
|
package/dist/application.js
CHANGED
|
@@ -97,8 +97,16 @@ var fluxApplication;
|
|
|
97
97
|
if (!kCol) {
|
|
98
98
|
throw new Error(`Index key column '${index.key}' not found in model '${source.name}'.`);
|
|
99
99
|
}
|
|
100
|
-
if (
|
|
101
|
-
throw new Error(`Index
|
|
100
|
+
if (kCol.info.type !== 'S' && kCol.info.type !== 'N') {
|
|
101
|
+
throw new Error(`Index key column '${index.key}' in model '${source.name}' has invalid type '${kCol.info.type}'. Only 'String' and 'Number' are allowed.`);
|
|
102
|
+
}
|
|
103
|
+
if (index.sort) {
|
|
104
|
+
if (!sCOl) {
|
|
105
|
+
throw new Error(`Index sort column '${index.sort}' not found in model '${source.name}'.`);
|
|
106
|
+
}
|
|
107
|
+
if (sCOl.info.type !== 'S' && sCOl.info.type !== 'N') {
|
|
108
|
+
throw new Error(`Index sort column '${index.sort}' in model '${source.name}' has invalid type '${sCOl.info.type}'. Only 'String' and 'Number' are allowed.`);
|
|
109
|
+
}
|
|
102
110
|
}
|
|
103
111
|
return {
|
|
104
112
|
name: index.name,
|
|
@@ -178,6 +186,17 @@ var fluxApplication;
|
|
|
178
186
|
});
|
|
179
187
|
}
|
|
180
188
|
repository.initializeModels = initializeModels;
|
|
189
|
+
function countModel(source) {
|
|
190
|
+
return core_1.promise.createDelayedPromise((resolve, reject) => {
|
|
191
|
+
core_1.promise.tryMethod(() => {
|
|
192
|
+
const model = objects.getModel(source);
|
|
193
|
+
return model;
|
|
194
|
+
}, reject).then((model) => {
|
|
195
|
+
core_1.promise.resolve(_dbProvider.count(model), resolve, reject);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
repository.countModel = countModel;
|
|
181
200
|
function deleteModel(source, identifier) {
|
|
182
201
|
return core_1.promise.createDelayedVoidPromise((resolve, reject) => {
|
|
183
202
|
core_1.promise.tryMethod(() => {
|
package/dist/decorators.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import {
|
|
2
|
+
import { FluxColumnExposed, FluxObjectCreator } from './types';
|
|
3
3
|
import { IFluxColumnInfo } from './interfaces';
|
|
4
4
|
export declare function FluxTable(name: string): ClassDecorator;
|
|
5
5
|
export declare function FluxIdentifier(): PropertyDecorator;
|
|
6
|
-
export declare function FluxExposedColumn(name: string, type?:
|
|
6
|
+
export declare function FluxExposedColumn(name: string, type?: FluxColumnExposed): PropertyDecorator;
|
|
7
7
|
export declare function FluxIndex(name: string, key: string, sort: string | undefined): ClassDecorator;
|
|
8
8
|
export declare namespace hapibooDecorators {
|
|
9
9
|
function getTableName(target: FluxObjectCreator): string;
|
package/dist/decorators.js
CHANGED
|
@@ -21,7 +21,7 @@ function FluxIdentifier() {
|
|
|
21
21
|
Reflect.defineMetadata(META_IDENTIFIER, { propertyKey: key }, target.constructor);
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function FluxExposedColumn(name, type = types_1.
|
|
24
|
+
function FluxExposedColumn(name, type = types_1.FluxColumnExposed.String) {
|
|
25
25
|
return (target, key) => {
|
|
26
26
|
const fields = Reflect.getMetadata(META_COLUMN, target.constructor) || [];
|
|
27
27
|
fields.push({ propertyKey: key, info: { name, type } });
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IFluxIndexInfo, IFluxColumnInfo, IFluxIndexData, IFluxDataModel, IFluxDataModelDefinition, IFluxDataModelWriter, IFluxDataModelReader, IFluxDBFilter, IFluxDBCondition, IFluxDBSubCondition, IFluxObject, IFluxModule, IDBProviderFlux } from './interfaces';
|
|
2
|
-
import { FluxColumn,
|
|
2
|
+
import { FluxColumn, FluxColumnIndex, FluxColumnExposed, FluxDBFilterLogic, FluxDBFilterOperator, FluxDBFilterOperatorValues, FluxDBFilterOperatorCollection } from './types';
|
|
3
3
|
import { FluxTable, FluxIndex, FluxExposedColumn, FluxIdentifier } from './decorators';
|
|
4
4
|
import { fluxApplication } from './application';
|
|
5
5
|
import { conditionBuilder } from './conditions';
|
|
6
|
-
export { FluxColumn,
|
|
6
|
+
export { FluxColumn, FluxColumnIndex, FluxColumnExposed };
|
|
7
7
|
export { IFluxIndexInfo, IFluxColumnInfo, IFluxIndexData };
|
|
8
8
|
export { IFluxDataModel, IFluxDataModelDefinition, IFluxDataModelWriter, IFluxDataModelReader };
|
|
9
9
|
export { IFluxDBFilter, IFluxDBCondition, IFluxDBSubCondition };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FluxIdentifier = exports.FluxExposedColumn = exports.FluxIndex = exports.FluxTable = exports.fluxApplication = exports.conditionBuilder = exports.
|
|
3
|
+
exports.FluxIdentifier = exports.FluxExposedColumn = exports.FluxIndex = exports.FluxTable = exports.fluxApplication = exports.conditionBuilder = exports.FluxColumnExposed = exports.FluxColumnIndex = exports.FluxColumn = void 0;
|
|
4
4
|
const types_1 = require("./types");
|
|
5
5
|
Object.defineProperty(exports, "FluxColumn", { enumerable: true, get: function () { return types_1.FluxColumn; } });
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "FluxColumnIndex", { enumerable: true, get: function () { return types_1.FluxColumnIndex; } });
|
|
7
|
+
Object.defineProperty(exports, "FluxColumnExposed", { enumerable: true, get: function () { return types_1.FluxColumnExposed; } });
|
|
7
8
|
const decorators_1 = require("./decorators");
|
|
8
9
|
Object.defineProperty(exports, "FluxTable", { enumerable: true, get: function () { return decorators_1.FluxTable; } });
|
|
9
10
|
Object.defineProperty(exports, "FluxIndex", { enumerable: true, get: function () { return decorators_1.FluxIndex; } });
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Dictionary, IResponsePromise, IResponsePromiseVoid } from '@hapiboo/core';
|
|
2
|
-
import {
|
|
2
|
+
import { FluxColumnExposed, FluxDBFilterLogic, FluxDBFilterOperator, FluxDBFilterOperatorCollection, FluxDBFilterOperatorValues, FluxObjectCreator } from './types';
|
|
3
3
|
export interface IFluxColumnInfo {
|
|
4
4
|
name: string;
|
|
5
|
-
type:
|
|
5
|
+
type: FluxColumnExposed;
|
|
6
6
|
}
|
|
7
7
|
export interface IFluxIndexInfo {
|
|
8
8
|
name: string;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { IFluxObject } from './interfaces';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const FluxColumnIndex: {
|
|
3
3
|
readonly String: "S";
|
|
4
4
|
readonly Number: "N";
|
|
5
5
|
};
|
|
6
|
+
export declare const FluxColumnExposed: {
|
|
7
|
+
readonly String: "S";
|
|
8
|
+
readonly Number: "N";
|
|
9
|
+
readonly Boolean: "BOOL";
|
|
10
|
+
};
|
|
6
11
|
export declare const FluxColumn: {
|
|
7
12
|
readonly String: "S";
|
|
8
13
|
readonly Number: "N";
|
|
@@ -11,7 +16,8 @@ export declare const FluxColumn: {
|
|
|
11
16
|
readonly List: "L";
|
|
12
17
|
readonly Object: "M";
|
|
13
18
|
};
|
|
14
|
-
export type
|
|
19
|
+
export type FluxColumnIndex = typeof FluxColumnIndex[keyof typeof FluxColumnIndex];
|
|
20
|
+
export type FluxColumnExposed = typeof FluxColumnExposed[keyof typeof FluxColumnExposed];
|
|
15
21
|
export type FluxColumn = typeof FluxColumn[keyof typeof FluxColumn];
|
|
16
22
|
export type FluxDBFilterOperator = '=' | '<>' | 'EXISTS' | 'NOT EXISTS';
|
|
17
23
|
export type FluxDBFilterOperatorValues = '<' | '<=' | '>' | '>=';
|
package/dist/types.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FluxColumn = exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.FluxColumn = exports.FluxColumnExposed = exports.FluxColumnIndex = void 0;
|
|
4
|
+
exports.FluxColumnIndex = {
|
|
5
5
|
String: 'S',
|
|
6
6
|
Number: 'N',
|
|
7
7
|
};
|
|
8
|
+
exports.FluxColumnExposed = {
|
|
9
|
+
String: 'S',
|
|
10
|
+
Number: 'N',
|
|
11
|
+
Boolean: 'BOOL',
|
|
12
|
+
};
|
|
8
13
|
exports.FluxColumn = {
|
|
9
14
|
String: 'S',
|
|
10
15
|
Number: 'N',
|