@takeshape/schema 12.1.4 → 12.1.6
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/builtin-schema.js
CHANGED
|
@@ -158,6 +158,65 @@ const builtInShapes = {
|
|
|
158
158
|
required: ['value']
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
|
+
TSWhereMatchPhraseAdvanced: {
|
|
162
|
+
id: 'TSWhereMatchPhraseAdvanced',
|
|
163
|
+
name: 'TSWhereMatchPhraseAdvanced',
|
|
164
|
+
title: 'Where Match Phrase Advanced',
|
|
165
|
+
schema: {
|
|
166
|
+
type: 'object',
|
|
167
|
+
properties: {
|
|
168
|
+
query: { type: 'string', description: 'The phrase to match.' },
|
|
169
|
+
slop: {
|
|
170
|
+
type: 'integer',
|
|
171
|
+
description: 'Number of positions terms can be apart. Use to match phrases with words in between, e.g., slop: 1 allows "cool shirt" to match "cool t shirt".'
|
|
172
|
+
},
|
|
173
|
+
analyzer: {
|
|
174
|
+
type: 'string',
|
|
175
|
+
description: "Analyzer to use for the query. If not specified, uses the field's default analyzer."
|
|
176
|
+
},
|
|
177
|
+
zero_terms_query: {
|
|
178
|
+
type: 'string',
|
|
179
|
+
enum: ['none', 'all'],
|
|
180
|
+
description: "What to do if the analyzer removes all tokens. 'none' returns no results (default), 'all' matches all documents."
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
required: ['query']
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
TSWhereMatchAdvanced: {
|
|
187
|
+
id: 'TSWhereMatchAdvanced',
|
|
188
|
+
name: 'TSWhereMatchAdvanced',
|
|
189
|
+
title: 'Where Match Advanced',
|
|
190
|
+
schema: {
|
|
191
|
+
type: 'object',
|
|
192
|
+
properties: {
|
|
193
|
+
query: { type: 'string', description: 'The text to search for.' },
|
|
194
|
+
operator: {
|
|
195
|
+
type: 'string',
|
|
196
|
+
enum: ['and', 'or'],
|
|
197
|
+
description: "Whether all terms must match ('and') or any term can match ('or', default)."
|
|
198
|
+
},
|
|
199
|
+
fuzziness: {
|
|
200
|
+
type: 'string',
|
|
201
|
+
description: "Allows fuzzy matching for typo tolerance. Use 'AUTO' to adjust based on term length, or 0, 1, 2 to specify edit distance."
|
|
202
|
+
},
|
|
203
|
+
minimum_should_match: {
|
|
204
|
+
type: 'string',
|
|
205
|
+
description: "Minimum number or percentage of terms that must match. E.g., '2' or '75%'."
|
|
206
|
+
},
|
|
207
|
+
analyzer: {
|
|
208
|
+
type: 'string',
|
|
209
|
+
description: "Analyzer to use for the query. If not specified, uses the field's default analyzer."
|
|
210
|
+
},
|
|
211
|
+
zero_terms_query: {
|
|
212
|
+
type: 'string',
|
|
213
|
+
enum: ['none', 'all'],
|
|
214
|
+
description: "What to do if the analyzer removes all tokens. 'none' returns no results (default), 'all' matches all documents."
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
required: ['query']
|
|
218
|
+
}
|
|
219
|
+
},
|
|
161
220
|
[asset.shapeName]: {
|
|
162
221
|
id: asset.shapeId,
|
|
163
222
|
name: asset.shapeName,
|
|
@@ -3,7 +3,7 @@ import type { ObjectSchema, ProjectSchemaJSON, PropertySchema, ShapeJSON, ShapeM
|
|
|
3
3
|
import type { ResolvedTemplate } from './types.ts';
|
|
4
4
|
export declare const MAX_RELATIONSHIP_DEPTH = 1;
|
|
5
5
|
export declare const exceededRelationshipDepth: (depth?: number) => boolean;
|
|
6
|
-
type ComparisonOperatorKey = 'eq' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'match' | 'match_phrase' | 'regexp' | 'wildcard';
|
|
6
|
+
type ComparisonOperatorKey = 'eq' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'match' | 'match_advanced' | 'match_phrase' | 'match_phrase_advanced' | 'regexp' | 'wildcard';
|
|
7
7
|
type ShapeThunk = ShapeJSON | (() => ShapeJSON);
|
|
8
8
|
declare class ShapeCache {
|
|
9
9
|
thunks: Map<string, ShapeThunk>;
|
|
@@ -46,7 +46,7 @@ export const fieldTypeComparison = {
|
|
|
46
46
|
id: { comparators: ['eq', 'in'], type: 'string' },
|
|
47
47
|
boolean: { comparators: ['eq'], type: 'boolean' },
|
|
48
48
|
string: {
|
|
49
|
-
comparators: ['eq', 'in', 'match', 'match_phrase', 'regexp', 'wildcard'],
|
|
49
|
+
comparators: ['eq', 'in', 'match', 'match_advanced', 'match_phrase', 'match_phrase_advanced', 'regexp', 'wildcard'],
|
|
50
50
|
type: 'string'
|
|
51
51
|
},
|
|
52
52
|
date: { comparators: ['eq', 'lt', 'lte', 'gt', 'gte'], type: 'string' },
|
|
@@ -62,8 +62,8 @@ export const fieldTypeComparison = {
|
|
|
62
62
|
comparators: ['eq', 'lt', 'lte', 'gt', 'gte', 'in'],
|
|
63
63
|
type: 'string'
|
|
64
64
|
},
|
|
65
|
-
draftjs: { comparators: ['match', 'match_phrase'], type: 'string' },
|
|
66
|
-
mdx: { comparators: ['match', 'match_phrase'], type: 'string' }
|
|
65
|
+
draftjs: { comparators: ['match', 'match_advanced', 'match_phrase', 'match_phrase_advanced'], type: 'string' },
|
|
66
|
+
mdx: { comparators: ['match', 'match_advanced', 'match_phrase', 'match_phrase_advanced'], type: 'string' }
|
|
67
67
|
};
|
|
68
68
|
export const comparatorDescriptions = {
|
|
69
69
|
eq: 'Exact match',
|
|
@@ -73,7 +73,9 @@ export const comparatorDescriptions = {
|
|
|
73
73
|
lte: 'Less than or equal',
|
|
74
74
|
in: 'Array of possible exact match values.',
|
|
75
75
|
match: 'Full text searching with fuzzy matching.',
|
|
76
|
+
match_advanced: 'Full text searching with advanced options like operator (and/or), fuzziness, minimum_should_match, analyzer, and zero_terms_query.',
|
|
76
77
|
match_phrase: 'Full text searching requiring the exact phrase to appear in order.',
|
|
78
|
+
match_phrase_advanced: 'Full text phrase matching with advanced options like slop (word distance), analyzer, and zero_terms_query.',
|
|
77
79
|
regexp: 'Regular expression string matching. Use of * wildcards could degrade performance.',
|
|
78
80
|
wildcard: 'Wildcard pattern matching with * (multiple characters) and ? (single character).'
|
|
79
81
|
};
|
|
@@ -113,6 +115,12 @@ export function getFieldTypeComparison(fieldType) {
|
|
|
113
115
|
else if (op === 'wildcard') {
|
|
114
116
|
result[op] = { '@ref': 'TSWhereWildcard', description };
|
|
115
117
|
}
|
|
118
|
+
else if (op === 'match_advanced') {
|
|
119
|
+
result[op] = { '@ref': 'TSWhereMatchAdvanced', description };
|
|
120
|
+
}
|
|
121
|
+
else if (op === 'match_phrase_advanced') {
|
|
122
|
+
result[op] = { '@ref': 'TSWhereMatchPhraseAdvanced', description };
|
|
123
|
+
}
|
|
116
124
|
else {
|
|
117
125
|
result[op] = { description, type };
|
|
118
126
|
}
|
|
@@ -396,7 +404,9 @@ export function getWhereShape(projectSchema, selectedShapes) {
|
|
|
396
404
|
}
|
|
397
405
|
}),
|
|
398
406
|
...shapeCache.resolveAll(),
|
|
399
|
-
TSWhereWildcard: allBuiltInShapes.TSWhereWildcard
|
|
407
|
+
TSWhereWildcard: allBuiltInShapes.TSWhereWildcard,
|
|
408
|
+
TSWhereMatchAdvanced: allBuiltInShapes.TSWhereMatchAdvanced,
|
|
409
|
+
TSWhereMatchPhraseAdvanced: allBuiltInShapes.TSWhereMatchPhraseAdvanced
|
|
400
410
|
})
|
|
401
411
|
};
|
|
402
412
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/schema",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.6",
|
|
4
4
|
"description": "TakeShape Schema",
|
|
5
5
|
"homepage": "https://www.takeshape.io",
|
|
6
6
|
"repository": {
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"p-reduce": "3.0.0",
|
|
58
58
|
"semver": "7.7.2",
|
|
59
59
|
"tiny-invariant": "1.3.3",
|
|
60
|
-
"@takeshape/errors": "12.1.
|
|
61
|
-
"@takeshape/json-schema": "12.1.
|
|
62
|
-
"@takeshape/util": "12.1.
|
|
60
|
+
"@takeshape/errors": "12.1.6",
|
|
61
|
+
"@takeshape/json-schema": "12.1.6",
|
|
62
|
+
"@takeshape/util": "12.1.6"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@takeshape/json-schema-to-typescript": "11.0.0",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"glob": "11.0.1",
|
|
77
77
|
"json-schema-to-ts": "3.1.1",
|
|
78
78
|
"shortid": "2.2.16",
|
|
79
|
-
"@takeshape/infra": "12.1.
|
|
80
|
-
"@takeshape/logger": "12.1.
|
|
79
|
+
"@takeshape/infra": "12.1.6",
|
|
80
|
+
"@takeshape/logger": "12.1.6"
|
|
81
81
|
},
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": ">=24"
|