@atscript/db-mongo 0.1.63 → 0.1.65

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 CHANGED
@@ -1224,6 +1224,16 @@ var MongoAdapter = class MongoAdapter extends _atscript_db.BaseDbAdapter {
1224
1224
  getValidatorPlugins() {
1225
1225
  return [validateMongoIdPlugin];
1226
1226
  }
1227
+ /**
1228
+ * Mongo can filter on JSON-stored fields natively — arrays via implicit
1229
+ * `$in` and embedded documents via dot-paths — so JSON storage is not a
1230
+ * filterability blocker the way it is for SQL adapters.
1231
+ * `canSortField` keeps the conservative default (no sort on JSON storage):
1232
+ * sort-by-min/max-element on arrays is a footgun for generic UI sort headers.
1233
+ */
1234
+ canFilterField(_fd) {
1235
+ return true;
1236
+ }
1227
1237
  getAdapterTableName(_type) {}
1228
1238
  supportsNativeRelations() {
1229
1239
  return true;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseDbAdapter, DbQuery, DbSpace, FilterExpr, TColumnDiff, TDbDeleteResult, TDbForeignKey, TDbInsertManyResult, TDbInsertResult, TDbRelation, TDbUpdateResult, TExistingTableOption, TFieldOps, TMetadataOverrides, TSearchIndexInfo, TSyncColumnResult, TTableResolver, TableMetadata, WithRelation, getKeyProps } from "@atscript/db";
1
+ import { BaseDbAdapter, DbQuery, DbSpace, FilterExpr, TColumnDiff, TDbDeleteResult, TDbFieldMeta, TDbForeignKey, TDbInsertManyResult, TDbInsertResult, TDbRelation, TDbUpdateResult, TExistingTableOption, TFieldOps, TMetadataOverrides, TSearchIndexInfo, TSyncColumnResult, TTableResolver, TableMetadata, WithRelation, getKeyProps } from "@atscript/db";
2
2
  import { AggregationCursor, ClientSession, Collection, Db, Document, Filter, MongoClient, ObjectId, UpdateFilter, UpdateOptions } from "mongodb";
3
3
  import { TAtscriptAnnotatedType, TMetadataMap, TValidatorOptions, TValidatorPlugin, Validator } from "@atscript/typescript/utils";
4
4
 
@@ -233,6 +233,14 @@ declare class MongoAdapter extends BaseDbAdapter {
233
233
  supportsNestedObjects(): boolean;
234
234
  supportsNativePatch(): boolean;
235
235
  getValidatorPlugins(): ReturnType<BaseDbAdapter["getValidatorPlugins"]>;
236
+ /**
237
+ * Mongo can filter on JSON-stored fields natively — arrays via implicit
238
+ * `$in` and embedded documents via dot-paths — so JSON storage is not a
239
+ * filterability blocker the way it is for SQL adapters.
240
+ * `canSortField` keeps the conservative default (no sort on JSON storage):
241
+ * sort-by-min/max-element on arrays is a footgun for generic UI sort headers.
242
+ */
243
+ canFilterField(_fd: TDbFieldMeta): boolean;
236
244
  getAdapterTableName(_type: unknown): string | undefined;
237
245
  supportsNativeRelations(): boolean;
238
246
  loadRelations(rows: Array<Record<string, unknown>>, withRelations: WithRelation[], relations: ReadonlyMap<string, TDbRelation>, foreignKeys: ReadonlyMap<string, TDbForeignKey>, tableResolver?: TTableResolver): Promise<void>;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseDbAdapter, DbQuery, DbSpace, FilterExpr, TColumnDiff, TDbDeleteResult, TDbForeignKey, TDbInsertManyResult, TDbInsertResult, TDbRelation, TDbUpdateResult, TExistingTableOption, TFieldOps, TMetadataOverrides, TSearchIndexInfo, TSyncColumnResult, TTableResolver, TableMetadata, WithRelation, getKeyProps } from "@atscript/db";
1
+ import { BaseDbAdapter, DbQuery, DbSpace, FilterExpr, TColumnDiff, TDbDeleteResult, TDbFieldMeta, TDbForeignKey, TDbInsertManyResult, TDbInsertResult, TDbRelation, TDbUpdateResult, TExistingTableOption, TFieldOps, TMetadataOverrides, TSearchIndexInfo, TSyncColumnResult, TTableResolver, TableMetadata, WithRelation, getKeyProps } from "@atscript/db";
2
2
  import { AggregationCursor, ClientSession, Collection, Db, Document, Filter, MongoClient, ObjectId, UpdateFilter, UpdateOptions } from "mongodb";
3
3
  import { TAtscriptAnnotatedType, TMetadataMap, TValidatorOptions, TValidatorPlugin, Validator } from "@atscript/typescript/utils";
4
4
 
@@ -233,6 +233,14 @@ declare class MongoAdapter extends BaseDbAdapter {
233
233
  supportsNestedObjects(): boolean;
234
234
  supportsNativePatch(): boolean;
235
235
  getValidatorPlugins(): ReturnType<BaseDbAdapter["getValidatorPlugins"]>;
236
+ /**
237
+ * Mongo can filter on JSON-stored fields natively — arrays via implicit
238
+ * `$in` and embedded documents via dot-paths — so JSON storage is not a
239
+ * filterability blocker the way it is for SQL adapters.
240
+ * `canSortField` keeps the conservative default (no sort on JSON storage):
241
+ * sort-by-min/max-element on arrays is a footgun for generic UI sort headers.
242
+ */
243
+ canFilterField(_fd: TDbFieldMeta): boolean;
236
244
  getAdapterTableName(_type: unknown): string | undefined;
237
245
  supportsNativeRelations(): boolean;
238
246
  loadRelations(rows: Array<Record<string, unknown>>, withRelations: WithRelation[], relations: ReadonlyMap<string, TDbRelation>, foreignKeys: ReadonlyMap<string, TDbForeignKey>, tableResolver?: TTableResolver): Promise<void>;
package/dist/index.mjs CHANGED
@@ -1223,6 +1223,16 @@ var MongoAdapter = class MongoAdapter extends BaseDbAdapter {
1223
1223
  getValidatorPlugins() {
1224
1224
  return [validateMongoIdPlugin];
1225
1225
  }
1226
+ /**
1227
+ * Mongo can filter on JSON-stored fields natively — arrays via implicit
1228
+ * `$in` and embedded documents via dot-paths — so JSON storage is not a
1229
+ * filterability blocker the way it is for SQL adapters.
1230
+ * `canSortField` keeps the conservative default (no sort on JSON storage):
1231
+ * sort-by-min/max-element on arrays is a footgun for generic UI sort headers.
1232
+ */
1233
+ canFilterField(_fd) {
1234
+ return true;
1235
+ }
1226
1236
  getAdapterTableName(_type) {}
1227
1237
  supportsNativeRelations() {
1228
1238
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/db-mongo",
3
- "version": "0.1.63",
3
+ "version": "0.1.65",
4
4
  "description": "Mongodb plugin for atscript.",
5
5
  "keywords": [
6
6
  "atscript",
@@ -55,7 +55,7 @@
55
55
  "@atscript/core": "^0.1.50",
56
56
  "@atscript/typescript": "^0.1.50",
57
57
  "mongodb": "^6.17.0",
58
- "@atscript/db": "^0.1.63"
58
+ "@atscript/db": "^0.1.65"
59
59
  },
60
60
  "scripts": {
61
61
  "postinstall": "asc -f dts",