@travetto/model-query 7.0.3 → 7.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/README.md +2 -2
- package/package.json +5 -5
- package/src/internal/types.ts +2 -2
- package/src/model/query.ts +1 -1
- package/src/model/where-clause.ts +1 -1
- package/src/types/crud.ts +4 -4
- package/src/types/facet.ts +5 -5
- package/src/types/query.ts +3 -3
- package/src/types/suggest.ts +5 -5
- package/src/util/crud.ts +3 -3
- package/src/util/facet.ts +1 -1
- package/src/util/query.ts +4 -4
- package/src/util/suggest.ts +5 -5
- package/src/verifier.ts +3 -3
- package/support/doc.support.tsx +5 -5
- package/support/test/crud.ts +2 -2
- package/support/test/facet.ts +2 -2
- package/support/test/model.ts +2 -2
- package/support/test/polymorphism.ts +5 -5
- package/support/test/query.ts +2 -2
- package/support/test/suggest.ts +2 -2
package/README.md
CHANGED
|
@@ -178,7 +178,7 @@ A sample query for `User`'s might be:
|
|
|
178
178
|
|
|
179
179
|
**Code: Using the query structure for specific queries**
|
|
180
180
|
```typescript
|
|
181
|
-
import { ModelQuerySupport } from '@travetto/model-query';
|
|
181
|
+
import type { ModelQuerySupport } from '@travetto/model-query';
|
|
182
182
|
import { User } from './user.ts';
|
|
183
183
|
|
|
184
184
|
export class UserSearch {
|
|
@@ -217,7 +217,7 @@ In addition to the provided contracts, the module also provides common utilities
|
|
|
217
217
|
import { Suite } from '@travetto/test';
|
|
218
218
|
import { Config } from '@travetto/config';
|
|
219
219
|
import { Injectable } from '@travetto/di';
|
|
220
|
-
import { ModelQueryFacetSupport, ModelQuerySuggestSupport, ModelQueryCrudSupport } from '@travetto/model-query';
|
|
220
|
+
import type { ModelQueryFacetSupport, ModelQuerySuggestSupport, ModelQueryCrudSupport } from '@travetto/model-query';
|
|
221
221
|
|
|
222
222
|
import { ModelQuerySuite } from '@travetto/model-query/support/test/query.ts';
|
|
223
223
|
import { ModelQueryCrudSuite } from '@travetto/model-query/support/test/crud.ts';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-query",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Datastore abstraction for advanced query support.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"directory": "module/model-query"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/di": "^7.0.
|
|
31
|
-
"@travetto/model": "^7.0.
|
|
32
|
-
"@travetto/schema": "^7.0.
|
|
30
|
+
"@travetto/di": "^7.0.5",
|
|
31
|
+
"@travetto/model": "^7.0.5",
|
|
32
|
+
"@travetto/schema": "^7.0.5"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@travetto/test": "^7.0.
|
|
35
|
+
"@travetto/test": "^7.0.5"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@travetto/test": {
|
package/src/internal/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SchemaFieldConfig, Point } from '@travetto/schema';
|
|
2
|
-
import { Class, toConcrete } from '@travetto/runtime';
|
|
1
|
+
import type { SchemaFieldConfig, Point } from '@travetto/schema';
|
|
2
|
+
import { type Class, toConcrete } from '@travetto/runtime';
|
|
3
3
|
|
|
4
4
|
const st = (value: string | string[], isArray: boolean = false): Set<string> =>
|
|
5
5
|
new Set((Array.isArray(value) ? value : [value]).map(item => isArray ? `${item}[]` : item));
|
package/src/model/query.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Primitive, RetainPrimitiveFields, TimeSpan } from '@travetto/runtime';
|
|
2
|
-
import { Point } from '@travetto/schema';
|
|
2
|
+
import type { Point } from '@travetto/schema';
|
|
3
3
|
|
|
4
4
|
export type QueryPrimitive = Primitive | Point;
|
|
5
5
|
export type QueryPrimitiveArray = QueryPrimitive[];
|
package/src/types/crud.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Class } from '@travetto/runtime';
|
|
2
|
-
import { ModelCrudSupport, ModelType } from '@travetto/model';
|
|
1
|
+
import type { Class } from '@travetto/runtime';
|
|
2
|
+
import type { ModelCrudSupport, ModelType } from '@travetto/model';
|
|
3
3
|
|
|
4
|
-
import { ModelQuerySupport } from './query.ts';
|
|
5
|
-
import { ModelQuery } from '../model/query.ts';
|
|
4
|
+
import type { ModelQuerySupport } from './query.ts';
|
|
5
|
+
import type { ModelQuery } from '../model/query.ts';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The contract for a model service with query support
|
package/src/types/facet.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Class } from '@travetto/runtime';
|
|
2
|
-
import { ModelType } from '@travetto/model';
|
|
1
|
+
import type { Class } from '@travetto/runtime';
|
|
2
|
+
import type { ModelType } from '@travetto/model';
|
|
3
3
|
|
|
4
|
-
import { ModelQuery } from '../model/query.ts';
|
|
5
|
-
import { ModelQuerySupport } from './query.ts';
|
|
6
|
-
import { ValidStringFields } from '../model/where-clause.ts';
|
|
4
|
+
import type { ModelQuery } from '../model/query.ts';
|
|
5
|
+
import type { ModelQuerySupport } from './query.ts';
|
|
6
|
+
import type { ValidStringFields } from '../model/where-clause.ts';
|
|
7
7
|
|
|
8
8
|
export type ModelQueryFacet = { key: string, count: number };
|
|
9
9
|
|
package/src/types/query.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Class } from '@travetto/runtime';
|
|
2
|
-
import { ModelType } from '@travetto/model';
|
|
1
|
+
import type { Class } from '@travetto/runtime';
|
|
2
|
+
import type { ModelType } from '@travetto/model';
|
|
3
3
|
|
|
4
|
-
import { ModelQuery, PageableModelQuery } from '../model/query.ts';
|
|
4
|
+
import type { ModelQuery, PageableModelQuery } from '../model/query.ts';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The contract for a model service with query support
|
package/src/types/suggest.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Class } from '@travetto/runtime';
|
|
2
|
-
import { ModelType } from '@travetto/model';
|
|
1
|
+
import type { Class } from '@travetto/runtime';
|
|
2
|
+
import type { ModelType } from '@travetto/model';
|
|
3
3
|
|
|
4
|
-
import { PageableModelQuery } from '../model/query.ts';
|
|
5
|
-
import { ModelQuerySupport } from './query.ts';
|
|
6
|
-
import { ValidStringFields } from '../model/where-clause.ts';
|
|
4
|
+
import type { PageableModelQuery } from '../model/query.ts';
|
|
5
|
+
import type { ModelQuerySupport } from './query.ts';
|
|
6
|
+
import type { ValidStringFields } from '../model/where-clause.ts';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The contract for a model service with suggesting support
|
package/src/util/crud.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Class, hasFunction } from '@travetto/runtime';
|
|
2
|
-
import { ModelType, ModelCrudSupport, ModelRegistryIndex } from '@travetto/model';
|
|
1
|
+
import { type Class, hasFunction } from '@travetto/runtime';
|
|
2
|
+
import { type ModelType, type ModelCrudSupport, ModelRegistryIndex } from '@travetto/model';
|
|
3
3
|
|
|
4
|
-
import { ModelQueryCrudSupport } from '../types/crud.ts';
|
|
4
|
+
import type { ModelQueryCrudSupport } from '../types/crud.ts';
|
|
5
5
|
|
|
6
6
|
export class ModelQueryCrudUtil {
|
|
7
7
|
/**
|
package/src/util/facet.ts
CHANGED
package/src/util/query.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Class, AppError, TimeUtil, castTo, hasFunction } from '@travetto/runtime';
|
|
2
|
-
import { ModelType, NotFoundError, ModelRegistryIndex } from '@travetto/model';
|
|
1
|
+
import { type Class, AppError, TimeUtil, castTo, hasFunction } from '@travetto/runtime';
|
|
2
|
+
import { type ModelType, NotFoundError, ModelRegistryIndex } from '@travetto/model';
|
|
3
3
|
import { SchemaRegistryIndex } from '@travetto/schema';
|
|
4
4
|
|
|
5
|
-
import { WhereClause, WhereClauseRaw } from '../model/where-clause.ts';
|
|
6
|
-
import { ModelQuerySupport } from '../types/query.ts';
|
|
5
|
+
import type { WhereClause, WhereClauseRaw } from '../model/where-clause.ts';
|
|
6
|
+
import type { ModelQuerySupport } from '../types/query.ts';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Common model utils, that should be usable by end users
|
package/src/util/suggest.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ModelRegistryIndex, ModelType } from '@travetto/model';
|
|
2
|
-
import { castTo, Class, hasFunction } from '@travetto/runtime';
|
|
1
|
+
import { ModelRegistryIndex, type ModelType } from '@travetto/model';
|
|
2
|
+
import { castTo, type Class, hasFunction } from '@travetto/runtime';
|
|
3
3
|
import { SchemaRegistryIndex } from '@travetto/schema';
|
|
4
4
|
|
|
5
|
-
import { PageableModelQuery, Query } from '../model/query.ts';
|
|
6
|
-
import { ValidStringFields, WhereClauseRaw } from '../model/where-clause.ts';
|
|
7
|
-
import { ModelQuerySuggestSupport } from '../types/suggest.ts';
|
|
5
|
+
import type { PageableModelQuery, Query } from '../model/query.ts';
|
|
6
|
+
import type { ValidStringFields, WhereClauseRaw } from '../model/where-clause.ts';
|
|
7
|
+
import type { ModelQuerySuggestSupport } from '../types/suggest.ts';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Tools for building suggestion queries
|
package/src/verifier.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint @typescript-eslint/no-unused-vars: ["error", { "args": "none"} ] */
|
|
2
|
-
import { DataUtil, ValidationResultError, ValidationError, SchemaRegistryIndex } from '@travetto/schema';
|
|
3
|
-
import { Class } from '@travetto/runtime';
|
|
2
|
+
import { DataUtil, ValidationResultError, type ValidationError, SchemaRegistryIndex } from '@travetto/schema';
|
|
3
|
+
import type { Class } from '@travetto/runtime';
|
|
4
4
|
|
|
5
|
-
import { ModelQuery, Query, PageableModelQuery } from './model/query.ts';
|
|
5
|
+
import type { ModelQuery, Query, PageableModelQuery } from './model/query.ts';
|
|
6
6
|
|
|
7
7
|
import { TypeUtil } from './internal/types.ts';
|
|
8
8
|
|
package/support/doc.support.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** @jsxImportSource @travetto/doc/support */
|
|
2
|
-
import { d, DocJSXElementByFn, DocJSXElement, DocFileUtil } from '@travetto/doc';
|
|
2
|
+
import { d, type DocJSXElementByFn, type DocJSXElement, DocFileUtil } from '@travetto/doc';
|
|
3
3
|
import { Runtime, toConcrete } from '@travetto/runtime';
|
|
4
4
|
|
|
5
|
-
import { ModelQueryCrudSupport } from '../src/types/crud.ts';
|
|
6
|
-
import { ModelQuerySupport } from '../src/types/query.ts';
|
|
7
|
-
import { ModelQueryFacetSupport, } from '../src/types/facet.ts';
|
|
8
|
-
import { ModelQuerySuggestSupport } from '../src/types/suggest.ts';
|
|
5
|
+
import type { ModelQueryCrudSupport } from '../src/types/crud.ts';
|
|
6
|
+
import type { ModelQuerySupport } from '../src/types/query.ts';
|
|
7
|
+
import type { ModelQueryFacetSupport, } from '../src/types/facet.ts';
|
|
8
|
+
import type { ModelQuerySuggestSupport } from '../src/types/suggest.ts';
|
|
9
9
|
|
|
10
10
|
const toLink = (title: string, target: Function): DocJSXElementByFn<'CodeLink'> =>
|
|
11
11
|
d.codeLink(title, Runtime.getSourceFile(target), new RegExp(`\\binterface\\s+${target.name}`));
|
package/support/test/crud.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
|
|
3
3
|
import { Suite, Test } from '@travetto/test';
|
|
4
|
-
import { ModelCrudSupport, NotFoundError } from '@travetto/model';
|
|
4
|
+
import { type ModelCrudSupport, NotFoundError } from '@travetto/model';
|
|
5
5
|
|
|
6
6
|
import { BaseModelSuite } from '@travetto/model/support/test/base.ts';
|
|
7
7
|
|
|
8
8
|
import { Address, Person, Todo } from './model.ts';
|
|
9
|
-
import { ModelQueryCrudSupport } from '../../src/types/crud.ts';
|
|
9
|
+
import type { ModelQueryCrudSupport } from '../../src/types/crud.ts';
|
|
10
10
|
|
|
11
11
|
@Suite()
|
|
12
12
|
export abstract class ModelQueryCrudSuite extends BaseModelSuite<ModelQueryCrudSupport & ModelCrudSupport> {
|
package/support/test/facet.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
|
|
3
|
-
import { ModelCrudSupport } from '@travetto/model';
|
|
3
|
+
import type { ModelCrudSupport } from '@travetto/model';
|
|
4
4
|
import { Suite, Test } from '@travetto/test';
|
|
5
5
|
|
|
6
6
|
import { BaseModelSuite } from '@travetto/model/support/test/base.ts';
|
|
7
7
|
|
|
8
8
|
import { Person } from './model.ts';
|
|
9
|
-
import { ModelQueryFacetSupport } from '../../src/types/facet.ts';
|
|
9
|
+
import type { ModelQueryFacetSupport } from '../../src/types/facet.ts';
|
|
10
10
|
|
|
11
11
|
const pick = <T>(arr: T[] | readonly T[]): T => arr[Math.trunc(Math.random() * arr.length)]!;
|
|
12
12
|
|
package/support/test/model.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Precision, Schema, Text, Point } from '@travetto/schema';
|
|
2
|
-
import { Model, ModelType } from '@travetto/model';
|
|
1
|
+
import { Precision, Schema, Text, type Point } from '@travetto/schema';
|
|
2
|
+
import { Model, type ModelType } from '@travetto/model';
|
|
3
3
|
|
|
4
4
|
@Schema()
|
|
5
5
|
export class Address {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
|
|
3
3
|
import { Suite, Test } from '@travetto/test';
|
|
4
|
-
import { NotFoundError, ModelCrudSupport } from '@travetto/model';
|
|
4
|
+
import { NotFoundError, type ModelCrudSupport } from '@travetto/model';
|
|
5
5
|
import { castTo } from '@travetto/runtime';
|
|
6
6
|
|
|
7
7
|
import { BaseModelSuite } from '@travetto/model/support/test/base.ts';
|
|
8
8
|
import { Doctor, Engineer, Worker, Firefighter } from '@travetto/model/support/test/polymorphism.ts';
|
|
9
9
|
|
|
10
|
-
import { ModelQueryCrudSupport } from '../../src/types/crud.ts';
|
|
11
|
-
import { ModelQuerySupport } from '../../src/types/query.ts';
|
|
12
|
-
import { ModelQueryFacetSupport } from '../../src/types/facet.ts';
|
|
13
|
-
import { ModelQuerySuggestSupport } from '../../src/types/suggest.ts';
|
|
10
|
+
import type { ModelQueryCrudSupport } from '../../src/types/crud.ts';
|
|
11
|
+
import type { ModelQuerySupport } from '../../src/types/query.ts';
|
|
12
|
+
import type { ModelQueryFacetSupport } from '../../src/types/facet.ts';
|
|
13
|
+
import type { ModelQuerySuggestSupport } from '../../src/types/suggest.ts';
|
|
14
14
|
|
|
15
15
|
import { ModelQueryFacetUtil } from '../../src/util/facet.ts';
|
|
16
16
|
import { ModelQuerySuggestUtil } from '../../src/util/suggest.ts';
|
package/support/test/query.ts
CHANGED
|
@@ -2,13 +2,13 @@ import assert from 'node:assert';
|
|
|
2
2
|
|
|
3
3
|
import { Suite, Test } from '@travetto/test';
|
|
4
4
|
import { TimeUtil } from '@travetto/runtime';
|
|
5
|
-
import { NotFoundError, ModelCrudSupport } from '@travetto/model';
|
|
5
|
+
import { NotFoundError, type ModelCrudSupport } from '@travetto/model';
|
|
6
6
|
|
|
7
7
|
import { BaseModelSuite } from '@travetto/model/support/test/base.ts';
|
|
8
8
|
|
|
9
9
|
import { Aged, Location, Names, Note, Person, SimpleList, WithNestedLists, WithNestedNestedLists } from './model.ts';
|
|
10
10
|
|
|
11
|
-
import { ModelQuerySupport } from '../../src/types/query.ts';
|
|
11
|
+
import type { ModelQuerySupport } from '../../src/types/query.ts';
|
|
12
12
|
|
|
13
13
|
@Suite()
|
|
14
14
|
export abstract class ModelQuerySuite extends BaseModelSuite<ModelQuerySupport & ModelCrudSupport> {
|
package/support/test/suggest.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
|
|
3
|
-
import { ModelCrudSupport } from '@travetto/model';
|
|
3
|
+
import type { ModelCrudSupport } from '@travetto/model';
|
|
4
4
|
import { Suite, Test } from '@travetto/test';
|
|
5
5
|
|
|
6
6
|
import { BaseModelSuite } from '@travetto/model/support/test/base.ts';
|
|
7
7
|
|
|
8
8
|
import { Person } from './model.ts';
|
|
9
|
-
import { ModelQuerySuggestSupport } from '../../src/types/suggest.ts';
|
|
9
|
+
import type { ModelQuerySuggestSupport } from '../../src/types/suggest.ts';
|
|
10
10
|
|
|
11
11
|
@Suite()
|
|
12
12
|
export abstract class ModelQuerySuggestSuite extends BaseModelSuite<ModelQuerySuggestSupport & ModelCrudSupport> {
|