@routier/core 0.1.0-rc.1 → 0.1.0-rc.2

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.js CHANGED
@@ -173,10 +173,12 @@ __webpack_require__.r(__webpack_exports__);
173
173
  __webpack_require__.d(__webpack_exports__, {
174
174
  PerformanceCapability: () => (PerformanceCapability)
175
175
  });
176
- /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utilities */ "./src/utilities/strings.ts");
176
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utilities */ "./src/utilities/strings.ts");
177
177
  /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
178
178
  /* ESM import */var _performance_PerformanceTracker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./performance/PerformanceTracker */ "./src/capabilities/performance/PerformanceTracker.ts");
179
179
  /* ESM import */var _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tracing/CallTraceManager */ "./src/capabilities/tracing/CallTraceManager.ts");
180
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utilities */ "./src/utilities/logger.ts");
181
+
180
182
 
181
183
 
182
184
 
@@ -212,12 +214,12 @@ class PerformanceCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Cap
212
214
  depth = callTrace.length - 1;
213
215
  const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
214
216
  this.performanceTracker.startMethodTiming(operationId, path);
215
- console.log(`\n${'═'.repeat(60)}`);
216
- console.log(`▶ ORIGIN [${operationId}] ${path}`);
217
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(`\n${'═'.repeat(60)}`);
218
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(`▶ ORIGIN [${operationId}] ${path}`);
217
219
  if (args.length > 0) {
218
- console.log(` Args:`, (0,_utilities__WEBPACK_IMPORTED_MODULE_3__.stringifyObject)(args, 4, 0));
220
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(` Args:`, (0,_utilities__WEBPACK_IMPORTED_MODULE_4__.stringifyObject)(args, 4, 0));
219
221
  }
220
- console.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);
222
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);
221
223
  }
222
224
  else {
223
225
  operationId = this.callTraceManager.getActiveOperationId();
@@ -228,9 +230,9 @@ class PerformanceCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Cap
228
230
  const childMethodKey = `${operationId}:${path}`;
229
231
  this.childDurations.set(childMethodKey, []);
230
232
  this.performanceTracker.startMethodTiming(operationId, path);
231
- console.log(`${indent}└─ CHILD [${operationId}] ${path}`);
233
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(`${indent}└─ CHILD [${operationId}] ${path}`);
232
234
  if (args.length > 0) {
233
- console.log(`${indent} Args:`, (0,_utilities__WEBPACK_IMPORTED_MODULE_3__.stringifyObject)(args, 4, 0));
235
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(`${indent} Args:`, (0,_utilities__WEBPACK_IMPORTED_MODULE_4__.stringifyObject)(args, 4, 0));
234
236
  }
235
237
  }
236
238
  try {
@@ -246,14 +248,14 @@ class PerformanceCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Cap
246
248
  const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);
247
249
  const overhead = duration - totalChildTime;
248
250
  const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));
249
- console.log(`\n${'═'.repeat(60)}`);
250
- console.log(`◀ COMPLETE [${operationId}] ${path}`);
251
- console.log(` Total Duration: ${formattedDuration}`);
251
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(`\n${'═'.repeat(60)}`);
252
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(`◀ COMPLETE [${operationId}] ${path}`);
253
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(` Total Duration: ${formattedDuration}`);
252
254
  if (childDurations.length > 0) {
253
- console.log(` Children Duration: ${formattedTotalChildTime} (${childDurations.length} calls)`);
254
- console.log(` Overhead: ${formattedOverhead}`);
255
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(` Children Duration: ${formattedTotalChildTime} (${childDurations.length} calls)`);
256
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(` Overhead: ${formattedOverhead}`);
255
257
  }
256
- console.log(`${'═'.repeat(60)}\n`);
258
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(`${'═'.repeat(60)}\n`);
257
259
  this.childDurations.delete(operationId);
258
260
  this.performanceTracker.cleanupOperation(operationId);
259
261
  this.callTraceManager.endOperation();
@@ -266,9 +268,9 @@ class PerformanceCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Cap
266
268
  const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);
267
269
  const overhead = duration - totalChildTime;
268
270
  const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));
269
- console.log(`${indent} ✓ ${formattedDuration}`);
271
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(`${indent} ✓ ${formattedDuration}`);
270
272
  if (childDurations.length > 0) {
271
- console.log(`${indent} Children: ${formattedTotalChildTime} (${childDurations.length} calls), Overhead: ${formattedOverhead}`);
273
+ _utilities__WEBPACK_IMPORTED_MODULE_3__.logger.log(`${indent} Children: ${formattedTotalChildTime} (${childDurations.length} calls), Overhead: ${formattedOverhead}`);
272
274
  }
273
275
  // Clean up child method tracking
274
276
  this.childDurations.delete(childMethodKey);
@@ -317,7 +319,9 @@ __webpack_require__.d(__webpack_exports__, {
317
319
  });
318
320
  /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
319
321
  /* ESM import */var _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tracing/CallTraceManager */ "./src/capabilities/tracing/CallTraceManager.ts");
320
- /* ESM import */var _utilities_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utilities/strings */ "./src/utilities/strings.ts");
322
+ /* ESM import */var _utilities_strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utilities/strings */ "./src/utilities/strings.ts");
323
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utilities */ "./src/utilities/logger.ts");
324
+
321
325
 
322
326
 
323
327
 
@@ -344,20 +348,20 @@ class TracingCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Capabil
344
348
  operationId = this.callTraceManager.startNewOperation();
345
349
  const callTrace = this.callTraceManager.addMethodToTrace(path);
346
350
  const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
347
- console.log(`\n${'═'.repeat(60)}`);
348
- console.log(`▶ ORIGIN [${operationId}] ${path}`);
351
+ _utilities__WEBPACK_IMPORTED_MODULE_2__.logger.log(`\n${'═'.repeat(60)}`);
352
+ _utilities__WEBPACK_IMPORTED_MODULE_2__.logger.log(`▶ ORIGIN [${operationId}] ${path}`);
349
353
  if (args.length > 0) {
350
- console.log(` Args:`, (0,_utilities_strings__WEBPACK_IMPORTED_MODULE_2__.stringifyObject)(args, 4, 0));
354
+ _utilities__WEBPACK_IMPORTED_MODULE_2__.logger.log(` Args:`, (0,_utilities_strings__WEBPACK_IMPORTED_MODULE_3__.stringifyObject)(args, 4, 0));
351
355
  }
352
- console.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);
356
+ _utilities__WEBPACK_IMPORTED_MODULE_2__.logger.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);
353
357
  }
354
358
  else {
355
359
  operationId = this.callTraceManager.getActiveOperationId();
356
360
  const callTrace = this.callTraceManager.addMethodToTrace(path);
357
361
  const indent = ' '.repeat(Math.min(callTrace.length - 1, 4));
358
- console.log(`${indent}└─ CHILD [${operationId}] ${path}`);
362
+ _utilities__WEBPACK_IMPORTED_MODULE_2__.logger.log(`${indent}└─ CHILD [${operationId}] ${path}`);
359
363
  if (args.length > 0) {
360
- console.log(`${indent} Args:`, (0,_utilities_strings__WEBPACK_IMPORTED_MODULE_2__.stringifyObject)(args, 4, 0));
364
+ _utilities__WEBPACK_IMPORTED_MODULE_2__.logger.log(`${indent} Args:`, (0,_utilities_strings__WEBPACK_IMPORTED_MODULE_3__.stringifyObject)(args, 4, 0));
361
365
  }
362
366
  }
363
367
  try {
@@ -4014,10 +4018,12 @@ __webpack_require__.d(__webpack_exports__, {
4014
4018
  combineExpressions: () => (combineExpressions),
4015
4019
  toExpression: () => (toExpression)
4016
4020
  });
4021
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utilities */ "./src/utilities/logger.ts");
4017
4022
  /* ESM import */var _assertions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../assertions */ "./src/assertions/index.ts");
4018
4023
  /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./src/expressions/types.ts");
4019
4024
 
4020
4025
 
4026
+
4021
4027
  // Pre-compiled regex patterns for better performance
4022
4028
  const METHOD_REGEX = /([a-zA-Z0-9_.]+)\.(startsWith|endsWith|includes)\(([^)]+)\)(\s*(===|==|!==|!=)\s*(true|false))?/;
4023
4029
  const TRANSFORM_METHOD_REGEX = /([a-zA-Z0-9_.]+)\.(toLowerCase|toUpperCase|toLocaleLowerCase|toLocaleUpperCase)\(\)\.(startsWith|endsWith|includes)\(((?:[^()]|\([^)]*\))*)\)(\s*(===|==|!==|!=)\s*(true|false))?/;
@@ -4165,7 +4171,7 @@ const toExpression = (schema, fn, params) => {
4165
4171
  return parseExpressionToTree(schema, expression, parameterData);
4166
4172
  }
4167
4173
  catch (error) {
4168
- console.warn("Error parsing expression", {
4174
+ _utilities__WEBPACK_IMPORTED_MODULE_2__.logger.warn("Error parsing expression", {
4169
4175
  error,
4170
4176
  collectionName: schema.collectionName,
4171
4177
  params,
@@ -4902,6 +4908,8 @@ __webpack_require__.d(__webpack_exports__, {
4902
4908
  measure: () => (measure),
4903
4909
  now: () => (now)
4904
4910
  });
4911
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utilities */ "./src/utilities/logger.ts");
4912
+
4905
4913
  const measurements = {};
4906
4914
  const now = () => {
4907
4915
  if (typeof performance !== 'undefined' && performance.now) {
@@ -4919,7 +4927,7 @@ const measure = {
4919
4927
  const start = measurements[name];
4920
4928
  delete measurements[name];
4921
4929
  const delta = now() - start;
4922
- console.log(`[ROUTIER] - Performance: ${name} took ${delta}`);
4930
+ _utilities__WEBPACK_IMPORTED_MODULE_0__.logger.log(`[ROUTIER] - Performance: ${name} took ${delta}`);
4923
4931
  }
4924
4932
  };
4925
4933
 
@@ -4966,11 +4974,12 @@ class SyncronousQueue {
4966
4974
  (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4967
4975
  __webpack_require__.r(__webpack_exports__);
4968
4976
  __webpack_require__.d(__webpack_exports__, {
4969
- AsyncPipeline: () => (AsyncPipeline),
4970
4977
  TrampolinePipeline: () => (TrampolinePipeline),
4971
4978
  WorkPipeline: () => (WorkPipeline)
4972
4979
  });
4973
- /* ESM import */var _results__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../results */ "./src/results/Result.ts");
4980
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utilities */ "./src/utilities/logger.ts");
4981
+ /* ESM import */var _results__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../results */ "./src/results/Result.ts");
4982
+
4974
4983
 
4975
4984
  class TrampolinePipeline {
4976
4985
  _list = [];
@@ -5008,7 +5017,7 @@ class TrampolinePipeline {
5008
5017
  processor(currentData, (result, error) => {
5009
5018
  // --- Error Handling ---
5010
5019
  if (error) {
5011
- console.error(`Error reported by processor at index ${idx}:`, error);
5020
+ _utilities__WEBPACK_IMPORTED_MODULE_0__.logger.error(`Error reported by processor at index ${idx}:`, error);
5012
5021
  this._hasErrored = true; // Set flag
5013
5022
  // Throw the error to be caught by outer try...catch blocks
5014
5023
  throw error;
@@ -5031,7 +5040,7 @@ class TrampolinePipeline {
5031
5040
  }
5032
5041
  catch (error) {
5033
5042
  if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback
5034
- console.error(`Error thrown by processor at index ${idx} or its callback:`, error);
5043
+ _utilities__WEBPACK_IMPORTED_MODULE_0__.logger.error(`Error thrown by processor at index ${idx} or its callback:`, error);
5035
5044
  this._hasErrored = true;
5036
5045
  }
5037
5046
  // Rethrow to be caught by the trampoline's catch block
@@ -5066,7 +5075,7 @@ class TrampolinePipeline {
5066
5075
  catch (trampolineError) {
5067
5076
  // Catch errors propagated from step execution (processor or callback errors)
5068
5077
  if (!this._hasErrored) { // Avoid double logging
5069
- console.error("Error during trampoline step execution:", trampolineError);
5078
+ _utilities__WEBPACK_IMPORTED_MODULE_0__.logger.error("Error during trampoline step execution:", trampolineError);
5070
5079
  this._hasErrored = true;
5071
5080
  }
5072
5081
  currentStep = null; // Stop the loop
@@ -5095,135 +5104,11 @@ class TrampolinePipeline {
5095
5104
  pipeEach(items, fn, map) {
5096
5105
  for (let i = 0, length = items.length; i < length; i++) {
5097
5106
  this.pipe((previous, done) => {
5098
- fn(map(previous, _results__WEBPACK_IMPORTED_MODULE_0__.Result.success(items[i])), done);
5107
+ fn(map(previous, _results__WEBPACK_IMPORTED_MODULE_1__.Result.success(items[i])), done);
5099
5108
  });
5100
5109
  }
5101
5110
  }
5102
5111
  }
5103
- class AsyncPipeline {
5104
- _list = [];
5105
- _hasErrored = false; // Flag to prevent calling done on error
5106
- filter(done) {
5107
- this._hasErrored = false; // Reset error flag on new execution
5108
- let currentData = [];
5109
- if (this._list.length === 0) {
5110
- queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
5111
- return;
5112
- }
5113
- let index = 0;
5114
- let isRunning = false; // Guard against overlapping trampoline calls
5115
- try {
5116
- // --- Revised Completion Logic --- (Moved up for clarity)
5117
- const finalStepSentinel = () => {
5118
- // Only call done if no error has occurred
5119
- if (!this._hasErrored) {
5120
- queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success(currentData)));
5121
- }
5122
- return null; // Stop the trampoline
5123
- };
5124
- const createStepRevised = (idx) => {
5125
- return () => {
5126
- if (this._hasErrored)
5127
- return null; // Stop if an error occurred elsewhere
5128
- if (idx >= this._list.length) {
5129
- return finalStepSentinel(); // Execute the dedicated final step
5130
- }
5131
- const [payload, processor] = this._list[idx];
5132
- // Initialize syncCallbackResult to null to satisfy StepResult type
5133
- let syncCallbackResult = null;
5134
- let calledSync = false;
5135
- try {
5136
- processor(payload, (result) => {
5137
- // --- Error Handling ---
5138
- if (result.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
5139
- console.error(`Error reported by AsyncPipeline at index ${idx}:`, result.error);
5140
- this._hasErrored = true; // Set flag
5141
- // Throw the error to be caught by outer try...catch blocks
5142
- throw result.error;
5143
- }
5144
- // --- /Error Handling ---
5145
- // If no error, proceed as before
5146
- currentData.push(result.data);
5147
- index = idx + 1; // Update index for the next step
5148
- const nextStep = createStepRevised(index); // Use updated index
5149
- if (isRunning) {
5150
- // Callback was synchronous
5151
- syncCallbackResult = nextStep; // Store next step function
5152
- calledSync = true;
5153
- }
5154
- else {
5155
- // Callback was asynchronous, restart trampoline
5156
- trampoline(nextStep);
5157
- }
5158
- });
5159
- }
5160
- catch (error) {
5161
- if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback
5162
- console.error(`Error thrown by processor at index ${idx} or its callback:`, error);
5163
- this._hasErrored = true;
5164
- }
5165
- // Rethrow to be caught by the trampoline's catch block
5166
- throw error;
5167
- }
5168
- if (calledSync) {
5169
- // Return the next step function for the sync loop
5170
- return syncCallbackResult;
5171
- }
5172
- else {
5173
- // Pause trampoline for async, loop will stop as step returns null
5174
- return null;
5175
- }
5176
- };
5177
- };
5178
- // The trampoline loop
5179
- const trampoline = (step) => {
5180
- if (isRunning) {
5181
- return;
5182
- }
5183
- isRunning = true;
5184
- let currentStep = step;
5185
- while (typeof currentStep === 'function') {
5186
- try {
5187
- // Stop immediately if an error was flagged elsewhere
5188
- if (this._hasErrored) {
5189
- currentStep = null;
5190
- break;
5191
- }
5192
- currentStep = currentStep(); // Execute step, get next step or null
5193
- }
5194
- catch (trampolineError) {
5195
- // Catch errors propagated from step execution (processor or callback errors)
5196
- if (!this._hasErrored) { // Avoid double logging
5197
- console.error("Error during trampoline step execution:", trampolineError);
5198
- this._hasErrored = true;
5199
- }
5200
- currentStep = null; // Stop the loop
5201
- // We don't call `done` here because an error occurred.
5202
- // The application should handle the uncaught exception if desired.
5203
- break; // Explicitly break loop on error
5204
- }
5205
- }
5206
- // Loop ends when currentStep is null or loop is broken by error
5207
- isRunning = false;
5208
- // Completion check is now handled by finalStepSentinel ensuring `done` isn't called on error.
5209
- };
5210
- // --- Start the process ---
5211
- index = 0; // Reset index
5212
- trampoline(createStepRevised(0)); // Start with the revised step creator
5213
- }
5214
- catch (error) {
5215
- done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error));
5216
- }
5217
- }
5218
- pipe(data, processor) {
5219
- this._list.push([data, processor]);
5220
- }
5221
- pipeEach(items, processor) {
5222
- for (let i = 0, length = items.length; i < length; i++) {
5223
- this.pipe(items[i], processor);
5224
- }
5225
- }
5226
- }
5227
5112
  /**
5228
5113
  * Processes functions with callbacks asynchronously.
5229
5114
  *
@@ -5237,7 +5122,7 @@ class WorkPipeline {
5237
5122
  filter(done) {
5238
5123
  this._hasErrored = false; // Reset error flag on new execution
5239
5124
  if (this.unitsOfWork.length === 0) {
5240
- queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
5125
+ queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_1__.Result.success()));
5241
5126
  return;
5242
5127
  }
5243
5128
  let index = 0;
@@ -5247,7 +5132,7 @@ class WorkPipeline {
5247
5132
  const finalStepSentinel = () => {
5248
5133
  // Only call done if no error has occurred
5249
5134
  if (!this._hasErrored) {
5250
- queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
5135
+ queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_1__.Result.success()));
5251
5136
  }
5252
5137
  return null; // Stop the trampoline
5253
5138
  };
@@ -5265,8 +5150,8 @@ class WorkPipeline {
5265
5150
  try {
5266
5151
  processor((result) => {
5267
5152
  // --- Error Handling ---
5268
- if (result.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
5269
- console.error(`Error reported by AsyncPipeline at index ${idx}:`, result.error);
5153
+ if (result.ok === _results__WEBPACK_IMPORTED_MODULE_1__.Result.ERROR) {
5154
+ _utilities__WEBPACK_IMPORTED_MODULE_0__.logger.error(`Error reported by AsyncPipeline at index ${idx}:`, result.error);
5270
5155
  this._hasErrored = true; // Set flag
5271
5156
  // Throw the error to be caught by outer try...catch blocks
5272
5157
  throw result.error;
@@ -5288,7 +5173,7 @@ class WorkPipeline {
5288
5173
  }
5289
5174
  catch (error) {
5290
5175
  if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback
5291
- console.error(`Error thrown by processor at index ${idx} or its callback:`, error);
5176
+ _utilities__WEBPACK_IMPORTED_MODULE_0__.logger.error(`Error thrown by processor at index ${idx} or its callback:`, error);
5292
5177
  this._hasErrored = true;
5293
5178
  }
5294
5179
  // Rethrow to be caught by the trampoline's catch block
@@ -5323,7 +5208,7 @@ class WorkPipeline {
5323
5208
  catch (trampolineError) {
5324
5209
  // Catch errors propagated from step execution (processor or callback errors)
5325
5210
  if (!this._hasErrored) { // Avoid double logging
5326
- console.error("Error during trampoline step execution:", trampolineError);
5211
+ _utilities__WEBPACK_IMPORTED_MODULE_0__.logger.error("Error during trampoline step execution:", trampolineError);
5327
5212
  this._hasErrored = true;
5328
5213
  }
5329
5214
  currentStep = null; // Stop the loop
@@ -5341,7 +5226,7 @@ class WorkPipeline {
5341
5226
  trampoline(createStepRevised(0)); // Start with the revised step creator
5342
5227
  }
5343
5228
  catch (error) {
5344
- done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error));
5229
+ done(_results__WEBPACK_IMPORTED_MODULE_1__.Result.error(error));
5345
5230
  }
5346
5231
  }
5347
5232
  pipe(work) {
@@ -5358,7 +5243,6 @@ class WorkPipeline {
5358
5243
  (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5359
5244
  __webpack_require__.r(__webpack_exports__);
5360
5245
  __webpack_require__.d(__webpack_exports__, {
5361
- AsyncPipeline: () => (/* reexport safe */ _TrampolinePipeline__WEBPACK_IMPORTED_MODULE_1__.AsyncPipeline),
5362
5246
  SyncronousQueue: () => (/* reexport safe */ _SyncronousQueue__WEBPACK_IMPORTED_MODULE_0__.SyncronousQueue),
5363
5247
  TrampolinePipeline: () => (/* reexport safe */ _TrampolinePipeline__WEBPACK_IMPORTED_MODULE_1__.TrampolinePipeline),
5364
5248
  WorkPipeline: () => (/* reexport safe */ _TrampolinePipeline__WEBPACK_IMPORTED_MODULE_1__.WorkPipeline)
@@ -6026,10 +5910,10 @@ class ReplicationDbPlugin {
6026
5910
  }
6027
5911
  destroy(event, done) {
6028
5912
  try {
6029
- const pipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_1__.AsyncPipeline();
5913
+ const pipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_1__.WorkPipeline();
6030
5914
  const plugins = [this.plugins.source, ...this.plugins.replicas];
6031
5915
  for (let i = 0, length = plugins.length; i < length; i++) {
6032
- pipeline.pipe(plugins[i], (plugin, done) => plugin.destroy(event, done));
5916
+ pipeline.pipe((done) => plugins[i].destroy(event, done));
6033
5917
  }
6034
5918
  pipeline.filter((result) => {
6035
5919
  if (result.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
@@ -8623,6 +8507,9 @@ class SchemaNumber extends _base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__.SchemaB
8623
8507
  instance;
8624
8508
  type = _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Number;
8625
8509
  _schemaNumber = true;
8510
+ constrain() {
8511
+ return new SchemaNumber(this);
8512
+ }
8626
8513
  from(propertyName) {
8627
8514
  return new _modifiers_SchemaFrom__WEBPACK_IMPORTED_MODULE_2__.SchemaFrom(propertyName, this);
8628
8515
  }
@@ -8762,6 +8649,9 @@ class SchemaString extends _base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__.SchemaB
8762
8649
  from(propertyName) {
8763
8650
  return new _modifiers_SchemaFrom__WEBPACK_IMPORTED_MODULE_2__.SchemaFrom(propertyName, this);
8764
8651
  }
8652
+ constrain() {
8653
+ return new SchemaString(this);
8654
+ }
8765
8655
  optional() {
8766
8656
  return new _modifiers_SchemaOptional__WEBPACK_IMPORTED_MODULE_3__.SchemaOptional(this);
8767
8657
  }
@@ -9039,6 +8929,7 @@ __webpack_require__.d(__webpack_exports__, {
9039
8929
  hash: () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_1__.hash),
9040
8930
  isDate: () => (/* reexport safe */ _dates__WEBPACK_IMPORTED_MODULE_2__.isDate),
9041
8931
  isNodeRuntime: () => (/* reexport safe */ _runtime__WEBPACK_IMPORTED_MODULE_4__.isNodeRuntime),
8932
+ logger: () => (/* reexport safe */ _logger__WEBPACK_IMPORTED_MODULE_11__.logger),
9042
8933
  noop: () => (/* reexport safe */ _functions__WEBPACK_IMPORTED_MODULE_9__.noop),
9043
8934
  resolveBulkPersistChanges: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_6__.resolveBulkPersistChanges),
9044
8935
  stringifyObject: () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_1__.stringifyObject),
@@ -9059,6 +8950,8 @@ __webpack_require__.d(__webpack_exports__, {
9059
8950
  /* ESM import */var _dbPluginEventUtils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dbPluginEventUtils */ "./src/utilities/dbPluginEventUtils.ts");
9060
8951
  /* ESM import */var _functions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./functions */ "./src/utilities/functions.ts");
9061
8952
  /* ESM import */var _unsafeCast__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./unsafeCast */ "./src/utilities/unsafeCast.ts");
8953
+ /* ESM import */var _logger__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./logger */ "./src/utilities/logger.ts");
8954
+
9062
8955
 
9063
8956
 
9064
8957
 
@@ -9073,6 +8966,51 @@ __webpack_require__.d(__webpack_exports__, {
9073
8966
 
9074
8967
 
9075
8968
 
8969
+ }),
8970
+ "./src/utilities/logger.ts":
8971
+ /*!*********************************!*\
8972
+ !*** ./src/utilities/logger.ts ***!
8973
+ \*********************************/
8974
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8975
+ __webpack_require__.r(__webpack_exports__);
8976
+ __webpack_require__.d(__webpack_exports__, {
8977
+ logger: () => (logger)
8978
+ });
8979
+ const isDevelopment = () => {
8980
+ if (typeof process === 'undefined' || process.env == null) {
8981
+ return false;
8982
+ }
8983
+ const env = "development"?.toLowerCase();
8984
+ return env === 'dev' || env === 'development' || env === 'test';
8985
+ };
8986
+ const shouldLog = isDevelopment();
8987
+ const tryLog = (type, ...args) => {
8988
+ if (shouldLog) {
8989
+ console[type](...args);
8990
+ }
8991
+ };
8992
+ const logger = {
8993
+ log: (...args) => {
8994
+ tryLog("log", ...args);
8995
+ },
8996
+ info: (...args) => {
8997
+ tryLog("info", ...args);
8998
+ },
8999
+ warn: (...args) => {
9000
+ tryLog("warn", ...args);
9001
+ },
9002
+ error: (...args) => {
9003
+ tryLog("error", ...args);
9004
+ },
9005
+ debug: (...args) => {
9006
+ tryLog("debug", ...args);
9007
+ },
9008
+ table: (...args) => {
9009
+ tryLog("table", ...args);
9010
+ },
9011
+ };
9012
+
9013
+
9076
9014
  }),
9077
9015
  "./src/utilities/objects.ts":
9078
9016
  /*!**********************************!*\
@@ -9468,7 +9406,6 @@ __webpack_require__.d(__webpack_exports__, {
9468
9406
  AndBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.AndBuilder),
9469
9407
  ArrayBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.ArrayBuilder),
9470
9408
  AssignmentBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.AssignmentBuilder),
9471
- AsyncPipeline: () => (/* reexport safe */ _pipeline__WEBPACK_IMPORTED_MODULE_6__.AsyncPipeline),
9472
9409
  Block: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.Block),
9473
9410
  BulkPersistChanges: () => (/* reexport safe */ _collections__WEBPACK_IMPORTED_MODULE_2__.BulkPersistChanges),
9474
9411
  BulkPersistResult: () => (/* reexport safe */ _collections__WEBPACK_IMPORTED_MODULE_2__.BulkPersistResult),
@@ -9557,6 +9494,7 @@ __webpack_require__.d(__webpack_exports__, {
9557
9494
  isDate: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.isDate),
9558
9495
  isNodeRuntime: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.isNodeRuntime),
9559
9496
  isPropertyExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.isPropertyExpression),
9497
+ logger: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.logger),
9560
9498
  measure: () => (/* reexport safe */ _performance__WEBPACK_IMPORTED_MODULE_5__.measure),
9561
9499
  noop: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.noop),
9562
9500
  now: () => (/* reexport safe */ _performance__WEBPACK_IMPORTED_MODULE_5__.now),
@@ -9602,7 +9540,6 @@ __webpack_require__.d(__webpack_exports__, {
9602
9540
  var __webpack_exports__AndBuilder = __webpack_exports__.AndBuilder;
9603
9541
  var __webpack_exports__ArrayBuilder = __webpack_exports__.ArrayBuilder;
9604
9542
  var __webpack_exports__AssignmentBuilder = __webpack_exports__.AssignmentBuilder;
9605
- var __webpack_exports__AsyncPipeline = __webpack_exports__.AsyncPipeline;
9606
9543
  var __webpack_exports__Block = __webpack_exports__.Block;
9607
9544
  var __webpack_exports__BulkPersistChanges = __webpack_exports__.BulkPersistChanges;
9608
9545
  var __webpack_exports__BulkPersistResult = __webpack_exports__.BulkPersistResult;
@@ -9691,6 +9628,7 @@ var __webpack_exports__hash = __webpack_exports__.hash;
9691
9628
  var __webpack_exports__isDate = __webpack_exports__.isDate;
9692
9629
  var __webpack_exports__isNodeRuntime = __webpack_exports__.isNodeRuntime;
9693
9630
  var __webpack_exports__isPropertyExpression = __webpack_exports__.isPropertyExpression;
9631
+ var __webpack_exports__logger = __webpack_exports__.logger;
9694
9632
  var __webpack_exports__measure = __webpack_exports__.measure;
9695
9633
  var __webpack_exports__noop = __webpack_exports__.noop;
9696
9634
  var __webpack_exports__now = __webpack_exports__.now;
@@ -9704,6 +9642,6 @@ var __webpack_exports__toPromise = __webpack_exports__.toPromise;
9704
9642
  var __webpack_exports__unsafeCast = __webpack_exports__.unsafeCast;
9705
9643
  var __webpack_exports__uuid = __webpack_exports__.uuid;
9706
9644
  var __webpack_exports__uuidv4 = __webpack_exports__.uuidv4;
9707
- export { __webpack_exports__AndBuilder as AndBuilder, __webpack_exports__ArrayBuilder as ArrayBuilder, __webpack_exports__AssignmentBuilder as AssignmentBuilder, __webpack_exports__AsyncPipeline as AsyncPipeline, __webpack_exports__Block as Block, __webpack_exports__BulkPersistChanges as BulkPersistChanges, __webpack_exports__BulkPersistResult as BulkPersistResult, __webpack_exports__Capability as Capability, __webpack_exports__CodeBuilder as CodeBuilder, __webpack_exports__ComparatorExpression as ComparatorExpression, __webpack_exports__ContainerBlock as ContainerBlock, __webpack_exports__DataTranslator as DataTranslator, __webpack_exports__EmptyExpression as EmptyExpression, __webpack_exports__EphemeralDataPlugin as EphemeralDataPlugin, __webpack_exports__Expression as Expression, __webpack_exports__FunctionBuilder as FunctionBuilder, __webpack_exports__FunctionFactoryBuilder as FunctionFactoryBuilder, __webpack_exports__HashType as HashType, __webpack_exports__IdSet as IdSet, __webpack_exports__IfBuilder as IfBuilder, __webpack_exports__JsonTranslator as JsonTranslator, __webpack_exports__MemoryDataCollection as MemoryDataCollection, __webpack_exports__NotParsableExpression as NotParsableExpression, __webpack_exports__ObjectBuilder as ObjectBuilder, __webpack_exports__OperatorExpression as OperatorExpression, __webpack_exports__OptimisticReplicationDbPlugin as OptimisticReplicationDbPlugin, __webpack_exports__PerformanceCapability as PerformanceCapability, __webpack_exports__PluginEventResult as PluginEventResult, __webpack_exports__PropertyExpression as PropertyExpression, __webpack_exports__PropertyInfo as PropertyInfo, __webpack_exports__Query as Query, __webpack_exports__QueryOptionsCollection as QueryOptionsCollection, __webpack_exports__QueryOrdering as QueryOrdering, __webpack_exports__RawBuilder as RawBuilder, __webpack_exports__ReadonlySchemaCollection as ReadonlySchemaCollection, __webpack_exports__ReplicationDbPlugin as ReplicationDbPlugin, __webpack_exports__Result as Result, __webpack_exports__SchemaArray as SchemaArray, __webpack_exports__SchemaBase as SchemaBase, __webpack_exports__SchemaBoolean as SchemaBoolean, __webpack_exports__SchemaCollection as SchemaCollection, __webpack_exports__SchemaComputed as SchemaComputed, __webpack_exports__SchemaDate as SchemaDate, __webpack_exports__SchemaDefault as SchemaDefault, __webpack_exports__SchemaDeserialize as SchemaDeserialize, __webpack_exports__SchemaDistinct as SchemaDistinct, __webpack_exports__SchemaError as SchemaError, __webpack_exports__SchemaFrom as SchemaFrom, __webpack_exports__SchemaFunction as SchemaFunction, __webpack_exports__SchemaIdentity as SchemaIdentity, __webpack_exports__SchemaIndex as SchemaIndex, __webpack_exports__SchemaKey as SchemaKey, __webpack_exports__SchemaNullable as SchemaNullable, __webpack_exports__SchemaNumber as SchemaNumber, __webpack_exports__SchemaObject as SchemaObject, __webpack_exports__SchemaOptional as SchemaOptional, __webpack_exports__SchemaPersistChanges as SchemaPersistChanges, __webpack_exports__SchemaPersistResult as SchemaPersistResult, __webpack_exports__SchemaReadonly as SchemaReadonly, __webpack_exports__SchemaSerialize as SchemaSerialize, __webpack_exports__SchemaString as SchemaString, __webpack_exports__SchemaTracked as SchemaTracked, __webpack_exports__SchemaTypes as SchemaTypes, __webpack_exports__SlotBlock as SlotBlock, __webpack_exports__SqlTranslator as SqlTranslator, __webpack_exports__StringBuilder as StringBuilder, __webpack_exports__SyncronousQueue as SyncronousQueue, __webpack_exports__TagCollection as TagCollection, __webpack_exports__TracingCapability as TracingCapability, __webpack_exports__TrampolinePipeline as TrampolinePipeline, __webpack_exports__TranslatedArrayValue as TranslatedArrayValue, __webpack_exports__TranslatedGroupValue as TranslatedGroupValue, __webpack_exports__TranslatedSingleValue as TranslatedSingleValue, __webpack_exports__ValueExpression as ValueExpression, __webpack_exports__VariableBuilder as VariableBuilder, __webpack_exports__WorkPipeline as WorkPipeline, __webpack_exports__assertDate as assertDate, __webpack_exports__assertInstanceOf as assertInstanceOf, __webpack_exports__assertIsArray as assertIsArray, __webpack_exports__assertIsNotNull as assertIsNotNull, __webpack_exports__assertString as assertString, __webpack_exports__cast as cast, __webpack_exports__clone as clone, __webpack_exports__combineExpressions as combineExpressions, __webpack_exports__combineQueryOptionsCollections as combineQueryOptionsCollections, __webpack_exports__fastHash as fastHash, __webpack_exports__forEach as forEach, __webpack_exports__getProperties as getProperties, __webpack_exports__hash as hash, __webpack_exports__isDate as isDate, __webpack_exports__isNodeRuntime as isNodeRuntime, __webpack_exports__isPropertyExpression as isPropertyExpression, __webpack_exports__measure as measure, __webpack_exports__noop as noop, __webpack_exports__now as now, __webpack_exports__resolveBulkPersistChanges as resolveBulkPersistChanges, __webpack_exports__s as s, __webpack_exports__stringifyObject as stringifyObject, __webpack_exports__toEventArray as toEventArray, __webpack_exports__toExpression as toExpression, __webpack_exports__toMap as toMap, __webpack_exports__toPromise as toPromise, __webpack_exports__unsafeCast as unsafeCast, __webpack_exports__uuid as uuid, __webpack_exports__uuidv4 as uuidv4 };
9645
+ export { __webpack_exports__AndBuilder as AndBuilder, __webpack_exports__ArrayBuilder as ArrayBuilder, __webpack_exports__AssignmentBuilder as AssignmentBuilder, __webpack_exports__Block as Block, __webpack_exports__BulkPersistChanges as BulkPersistChanges, __webpack_exports__BulkPersistResult as BulkPersistResult, __webpack_exports__Capability as Capability, __webpack_exports__CodeBuilder as CodeBuilder, __webpack_exports__ComparatorExpression as ComparatorExpression, __webpack_exports__ContainerBlock as ContainerBlock, __webpack_exports__DataTranslator as DataTranslator, __webpack_exports__EmptyExpression as EmptyExpression, __webpack_exports__EphemeralDataPlugin as EphemeralDataPlugin, __webpack_exports__Expression as Expression, __webpack_exports__FunctionBuilder as FunctionBuilder, __webpack_exports__FunctionFactoryBuilder as FunctionFactoryBuilder, __webpack_exports__HashType as HashType, __webpack_exports__IdSet as IdSet, __webpack_exports__IfBuilder as IfBuilder, __webpack_exports__JsonTranslator as JsonTranslator, __webpack_exports__MemoryDataCollection as MemoryDataCollection, __webpack_exports__NotParsableExpression as NotParsableExpression, __webpack_exports__ObjectBuilder as ObjectBuilder, __webpack_exports__OperatorExpression as OperatorExpression, __webpack_exports__OptimisticReplicationDbPlugin as OptimisticReplicationDbPlugin, __webpack_exports__PerformanceCapability as PerformanceCapability, __webpack_exports__PluginEventResult as PluginEventResult, __webpack_exports__PropertyExpression as PropertyExpression, __webpack_exports__PropertyInfo as PropertyInfo, __webpack_exports__Query as Query, __webpack_exports__QueryOptionsCollection as QueryOptionsCollection, __webpack_exports__QueryOrdering as QueryOrdering, __webpack_exports__RawBuilder as RawBuilder, __webpack_exports__ReadonlySchemaCollection as ReadonlySchemaCollection, __webpack_exports__ReplicationDbPlugin as ReplicationDbPlugin, __webpack_exports__Result as Result, __webpack_exports__SchemaArray as SchemaArray, __webpack_exports__SchemaBase as SchemaBase, __webpack_exports__SchemaBoolean as SchemaBoolean, __webpack_exports__SchemaCollection as SchemaCollection, __webpack_exports__SchemaComputed as SchemaComputed, __webpack_exports__SchemaDate as SchemaDate, __webpack_exports__SchemaDefault as SchemaDefault, __webpack_exports__SchemaDeserialize as SchemaDeserialize, __webpack_exports__SchemaDistinct as SchemaDistinct, __webpack_exports__SchemaError as SchemaError, __webpack_exports__SchemaFrom as SchemaFrom, __webpack_exports__SchemaFunction as SchemaFunction, __webpack_exports__SchemaIdentity as SchemaIdentity, __webpack_exports__SchemaIndex as SchemaIndex, __webpack_exports__SchemaKey as SchemaKey, __webpack_exports__SchemaNullable as SchemaNullable, __webpack_exports__SchemaNumber as SchemaNumber, __webpack_exports__SchemaObject as SchemaObject, __webpack_exports__SchemaOptional as SchemaOptional, __webpack_exports__SchemaPersistChanges as SchemaPersistChanges, __webpack_exports__SchemaPersistResult as SchemaPersistResult, __webpack_exports__SchemaReadonly as SchemaReadonly, __webpack_exports__SchemaSerialize as SchemaSerialize, __webpack_exports__SchemaString as SchemaString, __webpack_exports__SchemaTracked as SchemaTracked, __webpack_exports__SchemaTypes as SchemaTypes, __webpack_exports__SlotBlock as SlotBlock, __webpack_exports__SqlTranslator as SqlTranslator, __webpack_exports__StringBuilder as StringBuilder, __webpack_exports__SyncronousQueue as SyncronousQueue, __webpack_exports__TagCollection as TagCollection, __webpack_exports__TracingCapability as TracingCapability, __webpack_exports__TrampolinePipeline as TrampolinePipeline, __webpack_exports__TranslatedArrayValue as TranslatedArrayValue, __webpack_exports__TranslatedGroupValue as TranslatedGroupValue, __webpack_exports__TranslatedSingleValue as TranslatedSingleValue, __webpack_exports__ValueExpression as ValueExpression, __webpack_exports__VariableBuilder as VariableBuilder, __webpack_exports__WorkPipeline as WorkPipeline, __webpack_exports__assertDate as assertDate, __webpack_exports__assertInstanceOf as assertInstanceOf, __webpack_exports__assertIsArray as assertIsArray, __webpack_exports__assertIsNotNull as assertIsNotNull, __webpack_exports__assertString as assertString, __webpack_exports__cast as cast, __webpack_exports__clone as clone, __webpack_exports__combineExpressions as combineExpressions, __webpack_exports__combineQueryOptionsCollections as combineQueryOptionsCollections, __webpack_exports__fastHash as fastHash, __webpack_exports__forEach as forEach, __webpack_exports__getProperties as getProperties, __webpack_exports__hash as hash, __webpack_exports__isDate as isDate, __webpack_exports__isNodeRuntime as isNodeRuntime, __webpack_exports__isPropertyExpression as isPropertyExpression, __webpack_exports__logger as logger, __webpack_exports__measure as measure, __webpack_exports__noop as noop, __webpack_exports__now as now, __webpack_exports__resolveBulkPersistChanges as resolveBulkPersistChanges, __webpack_exports__s as s, __webpack_exports__stringifyObject as stringifyObject, __webpack_exports__toEventArray as toEventArray, __webpack_exports__toExpression as toExpression, __webpack_exports__toMap as toMap, __webpack_exports__toPromise as toPromise, __webpack_exports__unsafeCast as unsafeCast, __webpack_exports__uuid as uuid, __webpack_exports__uuidv4 as uuidv4 };
9708
9646
 
9709
9647
  //# sourceMappingURL=index.js.map