monsqlize 2.0.4 → 2.0.5

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/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # CHANGELOG
2
2
 
3
- > Summary index — current release details are packaged in [changelogs/v2.0.4.md](./changelogs/v2.0.4.md); historical details live in the repository changelog archive.
4
- > **Last updated**: 2026-06-12
3
+ > Summary index — current release details are packaged in [changelogs/v2.0.5.md](./changelogs/v2.0.5.md); historical details live in the repository changelog archive.
4
+ > **Last updated**: 2026-06-13
5
5
 
6
6
  ---
7
7
 
@@ -9,6 +9,7 @@
9
9
 
10
10
  | Version | Date | Summary | Details |
11
11
  |---------|------|---------|---------|
12
+ | [v2.0.5](./changelogs/v2.0.5.md) | 2026-06-13 | Patch: Model schema adapter delegates DSL type authority to `schema-dsl@2.0.10`, removing the duplicated monSQLize allowlist while preserving legacy aliases and business literals | [View](./changelogs/v2.0.5.md) |
12
13
  | [v2.0.4](./changelogs/v2.0.4.md) | 2026-06-12 | Patch: production-safe Model index rollout controls, `schema-dsl@2.0.9`, capability-index wording cleanup, and documentation home refinements | [View](./changelogs/v2.0.4.md) |
13
14
  | [v2.0.3](./changelogs/v2.0.3.md) | 2026-06-11 | Patch: v1 compatibility fixes, public stats APIs, standalone docs-site link safety, bilingual docs consistency, and release preflight alignment | [View](./changelogs/v2.0.3.md) |
14
15
  | [v2.0.2](./changelogs/v2.0.2.md) | 2026-06-09 | Patch: direct runtime, optional and development dependencies pinned to exact versions for deterministic consumer installs | [View](./changelogs/v2.0.2.md) |
@@ -447,7 +448,8 @@ const result = await msq.collection('orders').insertOne(dataFromMongoose);
447
448
  changelogs/
448
449
  ├── README.md # 变更文档说明
449
450
  ├── TEMPLATE.md # 变更文档模板
450
- ├── v2.0.4.md # 当前发布详细变更
451
+ ├── v2.0.5.md # 当前发布详细变更
452
+ ├── v2.0.4.md # v2.0.4 详细变更
451
453
  ├── v2.0.3.md # v2.0.3 详细变更
452
454
  ├── v2.0.2.md # v2.0.2 详细变更
453
455
  ├── v2.0.1.md # v2.0.1 详细变更
@@ -502,7 +504,8 @@ changelogs/
502
504
 
503
505
  ## 相关文档
504
506
 
505
- - [changelogs/v2.0.4.md](./changelogs/v2.0.4.md) - 当前发布详细变更文档
507
+ - [changelogs/v2.0.5.md](./changelogs/v2.0.5.md) - 当前发布详细变更文档
508
+ - [changelogs/v2.0.4.md](./changelogs/v2.0.4.md) - v2.0.4 详细变更文档
506
509
  - [changelogs/v2.0.3.md](./changelogs/v2.0.3.md) - v2.0.3 详细变更文档
507
510
  - [changelogs/v2.0.2.md](./changelogs/v2.0.2.md) - v2.0.2 详细变更文档
508
511
  - [changelogs/v2.0.1.md](./changelogs/v2.0.1.md) - v2.0.1 详细变更文档
@@ -511,5 +514,5 @@ changelogs/
511
514
 
512
515
  ---
513
516
 
514
- **最后更新**: 2026-06-12
517
+ **最后更新**: 2026-06-13
515
518
 
@@ -0,0 +1,33 @@
1
+ # v2.0.5 — 2026-06-13
2
+
3
+ ## Overview
4
+
5
+ v2.0.5 is a compatibility patch for Model schema validation. It removes the duplicated schema-dsl base-type allowlist from monSQLize and delegates DSL type decisions to schema-dsl, keeping schema-dsl as the single validation DSL authority.
6
+
7
+ ---
8
+
9
+ ## Runtime Fixes
10
+
11
+ - Removed the monSQLize-side schema-dsl base-type allowlist from the Model schema adapter.
12
+ - Delegated schema compilation and unknown-type handling to schema-dsl diagnostics instead of maintaining a second type table.
13
+ - Preserved compatibility for schema-dsl-owned aliases such as `int`, `mixed`, `buffer` and `objectid`.
14
+ - Preserved existing literal business DSL strings such as `datetime` and `admin_login!` through schema-dsl fallback semantics.
15
+
16
+ ## Dependencies
17
+
18
+ - Targets `schema-dsl@2.0.10`, which contains the shared legacy DSL aliases and structured diagnostics used by this patch.
19
+ - Keeps the root `cache-hub@2.2.4` dependency unchanged.
20
+
21
+ ## Compatibility
22
+
23
+ - SemVer: patch release.
24
+ - Breaking changes: none.
25
+ - Existing v2 Model schema declarations continue to validate through the same public Model API.
26
+ - Consumer projects do not need to change source code for the checked schema alias and business-literal paths.
27
+
28
+ ## Validation
29
+
30
+ - `npm run type-check`
31
+ - targeted Model schema validation tests
32
+ - targeted pure-function and branch coverage tests
33
+ - local schema-dsl@2.0.10 compatibility smoke
@@ -320,49 +320,8 @@ try {
320
320
  _schemaValidateFn = mod.validate;
321
321
  } catch {
322
322
  }
323
- var KNOWN_SCHEMA_BASE_TYPES = /* @__PURE__ */ new Set([
324
- "string",
325
- "number",
326
- "boolean",
327
- "integer",
328
- "float",
329
- "int",
330
- "double",
331
- "decimal",
332
- "date",
333
- "objectid",
334
- "uuid",
335
- "email",
336
- "url",
337
- "buffer",
338
- "binary",
339
- "object",
340
- "array",
341
- "any",
342
- "mixed",
343
- "null"
344
- ]);
345
- function _extractBaseType(typeStr) {
346
- const m = typeStr.match(/^[a-zA-Z_]+/);
347
- return m ? m[0].toLowerCase() : "";
348
- }
349
323
  function _makeValidatingDslFn(realDsl) {
350
324
  const validating = function validatingDsl(fields) {
351
- if (fields && typeof fields === "object") {
352
- for (const [field, spec] of Object.entries(fields)) {
353
- if (typeof spec === "string") {
354
- if (spec.includes("|")) {
355
- continue;
356
- }
357
- const base = _extractBaseType(spec);
358
- if (base && !KNOWN_SCHEMA_BASE_TYPES.has(base)) {
359
- throw new TypeError(
360
- `[schema] Invalid type "${base}" in field "${field}". Known types: ${[...KNOWN_SCHEMA_BASE_TYPES].join(", ")}.`
361
- );
362
- }
363
- }
364
- }
365
- }
366
325
  return realDsl(fields);
367
326
  };
368
327
  return validating;
@@ -303,49 +303,8 @@ try {
303
303
  _schemaValidateFn = mod.validate;
304
304
  } catch {
305
305
  }
306
- var KNOWN_SCHEMA_BASE_TYPES = /* @__PURE__ */ new Set([
307
- "string",
308
- "number",
309
- "boolean",
310
- "integer",
311
- "float",
312
- "int",
313
- "double",
314
- "decimal",
315
- "date",
316
- "objectid",
317
- "uuid",
318
- "email",
319
- "url",
320
- "buffer",
321
- "binary",
322
- "object",
323
- "array",
324
- "any",
325
- "mixed",
326
- "null"
327
- ]);
328
- function _extractBaseType(typeStr) {
329
- const m = typeStr.match(/^[a-zA-Z_]+/);
330
- return m ? m[0].toLowerCase() : "";
331
- }
332
306
  function _makeValidatingDslFn(realDsl) {
333
307
  const validating = function validatingDsl(fields) {
334
- if (fields && typeof fields === "object") {
335
- for (const [field, spec] of Object.entries(fields)) {
336
- if (typeof spec === "string") {
337
- if (spec.includes("|")) {
338
- continue;
339
- }
340
- const base = _extractBaseType(spec);
341
- if (base && !KNOWN_SCHEMA_BASE_TYPES.has(base)) {
342
- throw new TypeError(
343
- `[schema] Invalid type "${base}" in field "${field}". Known types: ${[...KNOWN_SCHEMA_BASE_TYPES].join(", ")}.`
344
- );
345
- }
346
- }
347
- }
348
- }
349
308
  return realDsl(fields);
350
309
  };
351
310
  return validating;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monsqlize",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "TypeScript-native MongoDB ODM with multi-level caching (cache-hub), distributed locks, Saga orchestration, unified expression system (122 operators), connection pool management, ChangeStream sync, slow-query logging, and full v1 API compatibility",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/cjs/index.cjs",
@@ -18,6 +18,7 @@
18
18
  "dist/**/*.cjs",
19
19
  "dist/**/*.mjs",
20
20
  "dist/**/*.d.ts",
21
+ "changelogs/v2.0.5.md",
21
22
  "changelogs/v2.0.4.md",
22
23
  "changelogs/v2.0.3.md",
23
24
  "changelogs/v2.0.2.md",
@@ -116,7 +117,7 @@
116
117
  "cache-hub": "2.2.4",
117
118
  "ioredis": "5.8.2",
118
119
  "mongodb": "6.21.0",
119
- "schema-dsl": "2.0.9",
120
+ "schema-dsl": "2.0.10",
120
121
  "ssh2": "1.17.0"
121
122
  }
122
123
  }