elseware-nodejs 1.11.8 → 1.12.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.cjs +69 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -4
- package/dist/index.d.ts +21 -4
- package/dist/index.js +67 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5027,17 +5027,11 @@ var DefaultApiFeaturesConfig = {
|
|
|
5027
5027
|
|
|
5028
5028
|
// src/infrastructure/http/query/ApiFeatures.ts
|
|
5029
5029
|
var ApiFeatures = class {
|
|
5030
|
-
static config = {
|
|
5031
|
-
...DefaultApiFeaturesConfig
|
|
5032
|
-
};
|
|
5033
|
-
static configure(config) {
|
|
5034
|
-
this.config = {
|
|
5035
|
-
...this.config,
|
|
5036
|
-
...config
|
|
5037
|
-
};
|
|
5038
|
-
}
|
|
5039
5030
|
static getConfig() {
|
|
5040
|
-
return
|
|
5031
|
+
return {
|
|
5032
|
+
...DefaultApiFeaturesConfig,
|
|
5033
|
+
...EJSContext.get().apiFeatures ?? {}
|
|
5034
|
+
};
|
|
5041
5035
|
}
|
|
5042
5036
|
static parse(query) {
|
|
5043
5037
|
return {
|
|
@@ -5049,12 +5043,13 @@ var ApiFeatures = class {
|
|
|
5049
5043
|
};
|
|
5050
5044
|
}
|
|
5051
5045
|
static parseFilters(query) {
|
|
5046
|
+
const config = this.getConfig();
|
|
5052
5047
|
const filters = [];
|
|
5053
5048
|
Object.entries(query).forEach(([key, value]) => {
|
|
5054
|
-
if (
|
|
5049
|
+
if (config.reservedFields.includes(key)) {
|
|
5055
5050
|
return;
|
|
5056
5051
|
}
|
|
5057
|
-
const operatorsPattern =
|
|
5052
|
+
const operatorsPattern = config.supportedOperators.join("|");
|
|
5058
5053
|
const match = key.match(new RegExp(`^(.+)\\[(${operatorsPattern})\\]$`));
|
|
5059
5054
|
if (match) {
|
|
5060
5055
|
filters.push({
|
|
@@ -5105,9 +5100,10 @@ var ApiFeatures = class {
|
|
|
5105
5100
|
return populate.split(",").map((field) => field.trim()).filter(Boolean);
|
|
5106
5101
|
}
|
|
5107
5102
|
static parsePagination(query) {
|
|
5108
|
-
const
|
|
5109
|
-
const
|
|
5110
|
-
const
|
|
5103
|
+
const config = this.getConfig();
|
|
5104
|
+
const page = Math.max(1, Number(query.page) || config.defaultPage);
|
|
5105
|
+
const requestedLimit = Number(query.limit) || config.defaultLimit;
|
|
5106
|
+
const limit = Math.min(Math.max(1, requestedLimit), config.maxLimit);
|
|
5111
5107
|
return {
|
|
5112
5108
|
page,
|
|
5113
5109
|
limit
|
|
@@ -5802,6 +5798,61 @@ var InternalServiceClient = class extends ServiceClient {
|
|
|
5802
5798
|
}
|
|
5803
5799
|
};
|
|
5804
5800
|
|
|
5801
|
+
// src/ejs/context/EJSConfig.ts
|
|
5802
|
+
var DefaultEJSConfig = {
|
|
5803
|
+
apiFeatures: DefaultApiFeaturesConfig
|
|
5804
|
+
};
|
|
5805
|
+
|
|
5806
|
+
// src/ejs/context/EJSContext.ts
|
|
5807
|
+
function deepMerge(target, source) {
|
|
5808
|
+
const result = {
|
|
5809
|
+
...target
|
|
5810
|
+
};
|
|
5811
|
+
Object.entries(source).forEach(([key, value]) => {
|
|
5812
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
5813
|
+
result[key] = deepMerge(
|
|
5814
|
+
result[key] ?? {},
|
|
5815
|
+
value
|
|
5816
|
+
);
|
|
5817
|
+
return;
|
|
5818
|
+
}
|
|
5819
|
+
result[key] = value;
|
|
5820
|
+
});
|
|
5821
|
+
return result;
|
|
5822
|
+
}
|
|
5823
|
+
var EJSContext = class {
|
|
5824
|
+
static config = {
|
|
5825
|
+
...DefaultEJSConfig
|
|
5826
|
+
};
|
|
5827
|
+
static configure(config) {
|
|
5828
|
+
this.config = deepMerge(
|
|
5829
|
+
this.config,
|
|
5830
|
+
config
|
|
5831
|
+
);
|
|
5832
|
+
}
|
|
5833
|
+
static get() {
|
|
5834
|
+
return this.config;
|
|
5835
|
+
}
|
|
5836
|
+
static reset() {
|
|
5837
|
+
this.config = {
|
|
5838
|
+
...DefaultEJSConfig
|
|
5839
|
+
};
|
|
5840
|
+
}
|
|
5841
|
+
};
|
|
5842
|
+
|
|
5843
|
+
// src/ejs/EJS.ts
|
|
5844
|
+
var EJS = class {
|
|
5845
|
+
static configure(config) {
|
|
5846
|
+
EJSContext.configure(config);
|
|
5847
|
+
}
|
|
5848
|
+
static getConfig() {
|
|
5849
|
+
return EJSContext.get();
|
|
5850
|
+
}
|
|
5851
|
+
static reset() {
|
|
5852
|
+
EJSContext.reset();
|
|
5853
|
+
}
|
|
5854
|
+
};
|
|
5855
|
+
|
|
5805
5856
|
// src/repositories/providers/MongoRepository.ts
|
|
5806
5857
|
var MongoRepository = class {
|
|
5807
5858
|
model;
|
|
@@ -6414,11 +6465,14 @@ exports.CountMinSketch = CountMinSketch;
|
|
|
6414
6465
|
exports.CrudControllerFactory = CrudControllerFactory;
|
|
6415
6466
|
exports.DatabaseManager = DatabaseManager;
|
|
6416
6467
|
exports.DefaultApiFeaturesConfig = DefaultApiFeaturesConfig;
|
|
6468
|
+
exports.DefaultEJSConfig = DefaultEJSConfig;
|
|
6417
6469
|
exports.Deque = Deque;
|
|
6418
6470
|
exports.DirectedGraph = DirectedGraph;
|
|
6419
6471
|
exports.DisjointSetUnion = DisjointSetUnion;
|
|
6420
6472
|
exports.DoublyLinkedList = DoublyLinkedList;
|
|
6421
6473
|
exports.DynamicArray = DynamicArray;
|
|
6474
|
+
exports.EJS = EJS;
|
|
6475
|
+
exports.EJSContext = EJSContext;
|
|
6422
6476
|
exports.EmailService = EmailService;
|
|
6423
6477
|
exports.ErrorMiddleware = ErrorMiddleware;
|
|
6424
6478
|
exports.ExponentialBackoffRetryPolicy = ExponentialBackoffRetryPolicy;
|