@featurevisor/site
Advanced tools
Comparing version 1.3.0 to 1.5.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [1.5.0](https://github.com/featurevisor/featurevisor/compare/v1.4.0...v1.5.0) (2024-02-01) | ||
### Features | ||
* additional advanced search options in generated site ([#257](https://github.com/featurevisor/featurevisor/issues/257)) ([6e0b34a](https://github.com/featurevisor/featurevisor/commit/6e0b34a150119b990c10d8c882d99f8aba4bff66)) | ||
# [1.3.0](https://github.com/featurevisor/featurevisor/compare/v1.2.4...v1.3.0) (2024-01-23) | ||
@@ -8,0 +19,0 @@ |
@@ -8,2 +8,6 @@ import { SearchIndex } from "@featurevisor/types"; | ||
capture?: boolean; | ||
hasVariations?: boolean; | ||
hasVariables?: boolean; | ||
variableKeys?: string[]; | ||
variationValues?: string[]; | ||
} | ||
@@ -10,0 +14,0 @@ export declare function parseSearchQuery(queryString: string): Query; |
{ | ||
"name": "@featurevisor/site", | ||
"version": "1.3.0", | ||
"version": "1.5.0", | ||
"description": "Static site for Featurevisor", | ||
@@ -68,3 +68,3 @@ "main": "dist", | ||
}, | ||
"gitHead": "92829e94ab09474433695d29577bd3eb22490f97" | ||
"gitHead": "522f5c631801a198ecb676ce7ee719b45fbf4cf4" | ||
} |
@@ -9,2 +9,6 @@ import { SearchIndex } from "@featurevisor/types"; | ||
capture?: boolean; | ||
hasVariations?: boolean; | ||
hasVariables?: boolean; | ||
variableKeys?: string[]; | ||
variationValues?: string[]; | ||
} | ||
@@ -52,2 +56,30 @@ | ||
} | ||
} else if (part.startsWith("variable:")) { | ||
const variableKey = part.replace("variable:", ""); | ||
if (typeof query.variableKeys === "undefined") { | ||
query.variableKeys = []; | ||
} | ||
if (variableKey.length > 0) { | ||
query.variableKeys.push(variableKey); | ||
} | ||
} else if (part.startsWith("variation:")) { | ||
const variationValue = part.replace("variation:", ""); | ||
if (typeof query.variationValues === "undefined") { | ||
query.variationValues = []; | ||
} | ||
if (variationValue.length > 0) { | ||
query.variationValues.push(variationValue); | ||
} | ||
} else if (part === "with:variations") { | ||
query.hasVariations = true; | ||
} else if (part === "without:variations") { | ||
query.hasVariations = false; | ||
} else if (part === "with:variables") { | ||
query.hasVariables = true; | ||
} else if (part === "without:variables") { | ||
query.hasVariables = false; | ||
} else { | ||
@@ -132,2 +164,46 @@ if (part.length > 0) { | ||
if (typeof query.hasVariations !== "undefined") { | ||
if (query.hasVariations && !feature.variations) { | ||
matched = false; | ||
} | ||
if (!query.hasVariations && feature.variations) { | ||
matched = false; | ||
} | ||
} | ||
if (typeof query.variationValues !== "undefined") { | ||
if (!feature.variations) { | ||
matched = false; | ||
} else { | ||
const valuesFromFeature = feature.variations.map((v: any) => v.value); | ||
if (query.variationValues.some((v) => valuesFromFeature.indexOf(v) === -1)) { | ||
matched = false; | ||
} | ||
} | ||
} | ||
if (typeof query.variableKeys !== "undefined") { | ||
if (!feature.variablesSchema) { | ||
matched = false; | ||
} else { | ||
const keysFromFeature = feature.variablesSchema.map((v: any) => v.key); | ||
if (query.variableKeys.some((k) => keysFromFeature.indexOf(k) === -1)) { | ||
matched = false; | ||
} | ||
} | ||
} | ||
if (typeof query.hasVariables !== "undefined") { | ||
if (query.hasVariables && !feature.variablesSchema) { | ||
matched = false; | ||
} | ||
if (!query.hasVariables && feature.variablesSchema) { | ||
matched = false; | ||
} | ||
} | ||
return matched; | ||
@@ -134,0 +210,0 @@ }) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2670096
5119