@datawheel/bespoke 1.0.0-beta.5 → 1.0.0-beta.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.
@@ -4,8 +4,8 @@ import * as querystring from 'querystring';
4
4
  import * as next_redux_wrapper from 'next-redux-wrapper';
5
5
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
6
6
  import { ThunkAction, Action, ThunkDispatch } from '@reduxjs/toolkit';
7
- import { w as SearchContentModel, I as ImageModel, c as AnyNestedReport, x as NormalizedEntityMap, y as NestedEntityMap, z as SearchAttributes, B as SearchContentAttributes, C as ReportAttributes, E as DimensionAttributes, G as VariantAttributes, v as ReportsDB, i as SearchReportParams, R as Result, j as SearchReportResponse, k as ReadMetadataParams, l as ReadMetadataResponse, m as UpdateMyDataParams, r as RevalidateReportRequest, s as RevalidateReportResponse, p as RevalidateUrlRequest, q as RevalidateUrlResponse, H as InternalReadPrivateBlocksParams, o as ReadPrivateBlocksResponse, t as ReadEnvSecretsResponse, J as CreateMethod, K as DeleteMethod, L as ReadMethod, M as UpdateMethod, O as CreateBulkMethod, P as UpdateBulkMethod, Q as UpdateMemberParams, T as UpdateMemberResponse } from './types-BcIo0oyw.mjs';
8
- import { e as BespokeAuthOptions } from './auth-BwgF4GT9.mjs';
7
+ import { x as SearchContentModel, I as ImageModel, c as AnyNestedReport, y as NormalizedEntityMap, z as NestedEntityMap, v as FlexsearchOptions, B as SearchAttributes, C as SearchContentAttributes, E as ReportAttributes, G as VariantAttributes, H as DimensionAttributes, J as ImageAttributes, w as ReportsDB, i as SearchReportParams, R as Result, j as SearchReportResponse, k as ReadMetadataParams, l as ReadMetadataResponse, m as UpdateMyDataParams, r as RevalidateReportRequest, s as RevalidateReportResponse, p as RevalidateUrlRequest, q as RevalidateUrlResponse, K as InternalReadPrivateBlocksParams, o as ReadPrivateBlocksResponse, t as ReadEnvSecretsResponse, L as CreateMethod, M as DeleteMethod, O as ReadMethod, P as UpdateMethod, Q as CreateBulkMethod, T as UpdateBulkMethod, W as UpdateMemberParams, X as UpdateMemberResponse } from './types-CSkx7guL.mjs';
8
+ import { e as BespokeAuthOptions } from './auth-Djd0coy0.mjs';
9
9
 
10
10
  interface ReadMembersIdsParams {
11
11
  /** Perform the members search by original ID. */
@@ -218,7 +218,7 @@ interface ReadMemberImageParams {
218
218
  }
219
219
  type ReadMemberImageResponse = Buffer | Blob;
220
220
 
221
- interface SearchMemberParams {
221
+ interface SearchMemberParams extends FlexsearchOptions {
222
222
  /**
223
223
  * The query string to search members for.
224
224
  * If requesting an empty string (`""`), will return the top most ranked
@@ -273,6 +273,11 @@ interface SearchMemberParams {
273
273
  direction?: string;
274
274
  offset?: number;
275
275
  origin?: "flexsearch" | "typesense";
276
+ /**
277
+ * Determines if multilateral reports should be excluded from results.
278
+ * When true, only unilateral reports (with single dimension) will be included.
279
+ */
280
+ excludeMultilateral?: boolean;
276
281
  }
277
282
  interface SearchMemberResponse {
278
283
  meta: {
@@ -287,12 +292,15 @@ interface SearchMemberResult extends SearchAttributes {
287
292
  name?: SearchContentAttributes["name"];
288
293
  attributes?: SearchContentAttributes["attributes"];
289
294
  keywords?: SearchContentAttributes["keywords"];
290
- contentByLocale?: SearchContentAttributes["contentByLocale"];
291
- score?: number;
292
- contentId?: number;
295
+ contentByLocale?: SearchContentAttributes[];
293
296
  report?: ReportAttributes;
294
- dimension?: DimensionAttributes;
295
297
  variant?: VariantAttributes;
298
+ dimension?: DimensionAttributes;
299
+ image?: ImageAttributes;
300
+ score?: number;
301
+ contentId?: number;
302
+ rank?: number;
303
+ [key: string]: any;
296
304
  }
297
305
 
298
306
  interface ValidateVariantSlugParams {
@@ -359,7 +367,7 @@ interface RegenerateSearchResponse {
359
367
 
360
368
  type PublicAPI = ReturnType<typeof apiFactory>;
361
369
  declare function useDatabaseApi(_: any, __: any, api: any): Promise<void>;
362
- declare function apiFactory(dbModels: ReportsDB, authOptions?: BespokeAuthOptions): {
370
+ declare function apiFactory(dbModels: ReportsDB, authOptions?: BespokeAuthOptions, flexsearchOptions?: FlexsearchOptions): {
363
371
  searchReport: (param: SearchReportParams) => Promise<Result<SearchReportResponse>>;
364
372
  readMetadata: (param: ReadMetadataParams) => Promise<Result<ReadMetadataResponse>>;
365
373
  regenerateSearch: (param: unknown) => Promise<Result<RegenerateSearchResponse>>;
@@ -730,6 +730,29 @@ interface UpdateBulkMethod<T extends keyof UpdateBulkParams> {
730
730
  interface DeleteMethod {
731
731
  (params: DeleteParams): Promise<Result<DeleteResponse>>;
732
732
  }
733
+ interface FlexsearchOptions {
734
+ /**
735
+ * How many candidates to fetch from the search engine before
736
+ * performing the database-level sort.
737
+ * @default 2000
738
+ */
739
+ candidateLimit?: number;
740
+ /**
741
+ * The matching strategy to use for the FlexSearch index.
742
+ * @default "forward"
743
+ */
744
+ tokenize?: "strict" | "forward" | "reverse" | "full";
745
+ /**
746
+ * Scoring resolution for the index (1-9).
747
+ * @default 9
748
+ */
749
+ indexResolution?: number;
750
+ /**
751
+ * List of attributes to include in the index and the results payload.
752
+ * If provided, these attributes will be flattened into the payload.
753
+ */
754
+ attributes?: string[];
755
+ }
733
756
  interface SearchReportParams {
734
757
  query: string;
735
758
  locale: string;
@@ -744,15 +767,17 @@ interface SearchReportParams {
744
767
  report: number[];
745
768
  all?: boolean;
746
769
  origin?: "flexsearch" | "typesense";
747
- sort?: "report" | "name" | string;
770
+ sort?: "report" | "name" | "rank" | string;
748
771
  direction?: string;
749
772
  }
750
773
  interface SearchReportItem {
751
774
  name: string;
752
775
  id: string;
753
776
  path: string;
754
- confidence: number;
777
+ zvalue: number;
778
+ rank?: number;
755
779
  members: Array<Record<string, any>>;
780
+ [key: string]: any;
756
781
  }
757
782
  interface SearchReportResponse {
758
783
  meta: {
@@ -844,4 +869,4 @@ interface ReadEnvSecretsResponse {
844
869
  };
845
870
  }
846
871
 
847
- export { type AnyBlock as A, type SearchContentAttributes as B, type ReportAttributes as C, type DataSource as D, type DimensionAttributes as E, type Formatter as F, type VariantAttributes as G, type InternalReadPrivateBlocksParams as H, ImageModel as I, type CreateMethod as J, type DeleteMethod as K, type ReadMethod as L, type UpdateMethod as M, type NestedDimension as N, type CreateBulkMethod as O, type UpdateBulkMethod as P, type UpdateMemberParams as Q, type Result as R, type SearchUsersParams as S, type UpdateMemberResponse as T, type UpdateUserParams as U, type Variant as V, type AnyNestedBlock as a, type AnyReport as b, type AnyNestedReport as c, type Section as d, type NestedSection as e, type DeleteParams as f, type ReadParams as g, type Dimension as h, type SearchReportParams as i, type SearchReportResponse as j, type ReadMetadataParams as k, type ReadMetadataResponse as l, type UpdateMyDataParams as m, type ReadPrivateBlocksParams as n, type ReadPrivateBlocksResponse as o, type RevalidateUrlRequest as p, type RevalidateUrlResponse as q, type RevalidateReportRequest as r, type RevalidateReportResponse as s, type ReadEnvSecretsResponse as t, type SearchReportItem as u, type ReportsDB as v, SearchContentModel as w, type NormalizedEntityMap as x, type NestedEntityMap as y, type SearchAttributes as z };
872
+ export { type AnyBlock as A, type SearchAttributes as B, type SearchContentAttributes as C, type DataSource as D, type ReportAttributes as E, type Formatter as F, type VariantAttributes as G, type DimensionAttributes as H, ImageModel as I, type ImageAttributes as J, type InternalReadPrivateBlocksParams as K, type CreateMethod as L, type DeleteMethod as M, type NestedDimension as N, type ReadMethod as O, type UpdateMethod as P, type CreateBulkMethod as Q, type Result as R, type SearchUsersParams as S, type UpdateBulkMethod as T, type UpdateUserParams as U, type Variant as V, type UpdateMemberParams as W, type UpdateMemberResponse as X, type AnyNestedBlock as a, type AnyReport as b, type AnyNestedReport as c, type Section as d, type NestedSection as e, type DeleteParams as f, type ReadParams as g, type Dimension as h, type SearchReportParams as i, type SearchReportResponse as j, type ReadMetadataParams as k, type ReadMetadataResponse as l, type UpdateMyDataParams as m, type ReadPrivateBlocksParams as n, type ReadPrivateBlocksResponse as o, type RevalidateUrlRequest as p, type RevalidateUrlResponse as q, type RevalidateReportRequest as r, type RevalidateReportResponse as s, type ReadEnvSecretsResponse as t, type SearchReportItem as u, type FlexsearchOptions as v, type ReportsDB as w, SearchContentModel as x, type NormalizedEntityMap as y, type NestedEntityMap as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datawheel/bespoke",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0-beta.6",
4
4
  "description": "Content management system for creating automated data reports",
5
5
  "exports": {
6
6
  ".": {
@@ -109,7 +109,7 @@
109
109
  "fast-glob": "^3.2.12",
110
110
  "file-loader": "^6.2.0",
111
111
  "file-saver": "^1.3.8",
112
- "flexsearch": "^0.7.43",
112
+ "flexsearch": "^0.8.212",
113
113
  "flickr-sdk": "6.3.0",
114
114
  "formidable": "^2.1.1",
115
115
  "html-react-parser": "^5.2.5",