@resistdesign/voltra 3.0.0-alpha.42 → 3.0.0-alpha.44
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/api/ORM/TypeInfoORMService.d.ts +138 -4
- package/api/ORM/getTypeInfoORMIndexingConfigFromTypeInfoMap.d.ts +31 -0
- package/api/ORM/index.d.ts +1 -0
- package/api/index.js +247 -11
- package/app/index.js +2 -2
- package/app/utils/Route.d.ts +10 -1
- package/{chunk-FXMKH3RB.js → chunk-44BMFTKD.js} +17 -8
- package/{chunk-B4DHXYKJ.js → chunk-CMH6L5QQ.js} +1 -1
- package/common/TypeParsing/TypeInfo.d.ts +13 -0
- package/native/index.js +1 -1
- package/package.json +1 -1
- package/web/index.js +2 -2
|
@@ -171,6 +171,64 @@ export type TypeInfoORMIndexingConfig = {
|
|
|
171
171
|
}) => void;
|
|
172
172
|
};
|
|
173
173
|
};
|
|
174
|
+
/**
|
|
175
|
+
* Optional field overrides for manual indexing maintenance operations.
|
|
176
|
+
*/
|
|
177
|
+
export type TypeInfoORMManualIndexingConfig = {
|
|
178
|
+
/**
|
|
179
|
+
* Explicit full-text field name(s) to target instead of the configured defaults.
|
|
180
|
+
*
|
|
181
|
+
* Supply the previous field set when cleaning up after a schema/config change.
|
|
182
|
+
*/
|
|
183
|
+
fullTextIndexFields?: string | string[];
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Optional field overrides for manual index replacement/reindex operations.
|
|
187
|
+
*/
|
|
188
|
+
export type TypeInfoORMReplaceIndexingConfig = {
|
|
189
|
+
/**
|
|
190
|
+
* Full-text field name(s) to remove from the previous snapshot.
|
|
191
|
+
*/
|
|
192
|
+
previousFullTextIndexFields?: string | string[];
|
|
193
|
+
/**
|
|
194
|
+
* Full-text field name(s) to add for the next snapshot.
|
|
195
|
+
*/
|
|
196
|
+
nextFullTextIndexFields?: string | string[];
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Options for reindexing a stored item from the backing driver.
|
|
200
|
+
*/
|
|
201
|
+
export type TypeInfoORMReindexStoredItemConfig = TypeInfoORMReplaceIndexingConfig & {
|
|
202
|
+
/**
|
|
203
|
+
* Optional previous snapshot to remove before indexing the current stored item.
|
|
204
|
+
*/
|
|
205
|
+
previousItem?: Partial<TypeInfoDataItem>;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Options for reindexing all currently stored items of a type.
|
|
209
|
+
*/
|
|
210
|
+
export type TypeInfoORMReindexStoredTypeConfig = TypeInfoORMReplaceIndexingConfig & {
|
|
211
|
+
/**
|
|
212
|
+
* Maximum number of items to load per driver page.
|
|
213
|
+
*/
|
|
214
|
+
itemsPerPage?: number;
|
|
215
|
+
/**
|
|
216
|
+
* Optional previous snapshots keyed by primary field value.
|
|
217
|
+
*
|
|
218
|
+
* Use this when a schema/config change requires cleanup of previously indexed
|
|
219
|
+
* full-text fields before the current item is reindexed.
|
|
220
|
+
*/
|
|
221
|
+
previousItemsByPrimaryField?: Record<string, Partial<TypeInfoDataItem>>;
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Results from reindexing all currently stored items of a type.
|
|
225
|
+
*/
|
|
226
|
+
export type TypeInfoORMReindexStoredTypeResults = {
|
|
227
|
+
/**
|
|
228
|
+
* Number of stored items that were reindexed.
|
|
229
|
+
*/
|
|
230
|
+
processedCount: number;
|
|
231
|
+
};
|
|
174
232
|
/**
|
|
175
233
|
* The basis for the configuration for the TypeInfoORMService.
|
|
176
234
|
* */
|
|
@@ -350,7 +408,7 @@ export declare class TypeInfoORMService implements TypeInfoORMAPI {
|
|
|
350
408
|
/**
|
|
351
409
|
* Optional override for the index field.
|
|
352
410
|
*/
|
|
353
|
-
override?: string) => string[];
|
|
411
|
+
override?: string | string[]) => string[];
|
|
354
412
|
/**
|
|
355
413
|
* @returns True when the operator maps to full-text search.
|
|
356
414
|
*/
|
|
@@ -480,6 +538,18 @@ export declare class TypeInfoORMService implements TypeInfoORMAPI {
|
|
|
480
538
|
* Item to extract structured fields from.
|
|
481
539
|
*/
|
|
482
540
|
item: Partial<TypeInfoDataItem>) => StructuredDocFieldsRecord;
|
|
541
|
+
/**
|
|
542
|
+
* @returns Item snapshot normalized for indexing operations.
|
|
543
|
+
*/
|
|
544
|
+
protected getIndexedItemSnapshot: (
|
|
545
|
+
/**
|
|
546
|
+
* Type name used to clean the item.
|
|
547
|
+
*/
|
|
548
|
+
typeName: string,
|
|
549
|
+
/**
|
|
550
|
+
* Item snapshot to normalize.
|
|
551
|
+
*/
|
|
552
|
+
item: Partial<TypeInfoDataItem>) => Partial<TypeInfoDataItem>;
|
|
483
553
|
/**
|
|
484
554
|
* @returns Mapped structured query.
|
|
485
555
|
*/
|
|
@@ -511,7 +581,7 @@ export declare class TypeInfoORMService implements TypeInfoORMAPI {
|
|
|
511
581
|
/**
|
|
512
582
|
* Optional override for the index field.
|
|
513
583
|
*/
|
|
514
|
-
indexFieldOverride?: string): Promise<void>;
|
|
584
|
+
indexFieldOverride?: string | string[]): Promise<void>;
|
|
515
585
|
/**
|
|
516
586
|
* @returns Promise resolved once removal is complete.
|
|
517
587
|
*/
|
|
@@ -527,7 +597,7 @@ export declare class TypeInfoORMService implements TypeInfoORMAPI {
|
|
|
527
597
|
/**
|
|
528
598
|
* Optional override for the index field.
|
|
529
599
|
*/
|
|
530
|
-
indexFieldOverride?: string): Promise<void>;
|
|
600
|
+
indexFieldOverride?: string | string[]): Promise<void>;
|
|
531
601
|
/**
|
|
532
602
|
* @returns Promise resolved once replacement is complete.
|
|
533
603
|
*/
|
|
@@ -547,7 +617,71 @@ export declare class TypeInfoORMService implements TypeInfoORMAPI {
|
|
|
547
617
|
/**
|
|
548
618
|
* Optional override for the index field.
|
|
549
619
|
*/
|
|
550
|
-
indexFieldOverride?: string): Promise<void>;
|
|
620
|
+
indexFieldOverride?: string | string[]): Promise<void>;
|
|
621
|
+
/**
|
|
622
|
+
* Write the provided item snapshot into the configured indexes.
|
|
623
|
+
*
|
|
624
|
+
* Use this when data was created or modified outside `TypeInfoORMService`.
|
|
625
|
+
*
|
|
626
|
+
* @param typeName Type name for the indexed item.
|
|
627
|
+
* @param item Item snapshot to index.
|
|
628
|
+
* @param config Optional full-text field overrides.
|
|
629
|
+
* @returns Promise resolved when manual indexing completes.
|
|
630
|
+
*/
|
|
631
|
+
indexItemIndexes: (typeName: string, item: Partial<TypeInfoDataItem>, config?: TypeInfoORMManualIndexingConfig) => Promise<void>;
|
|
632
|
+
/**
|
|
633
|
+
* Remove the provided item snapshot from the configured indexes.
|
|
634
|
+
*
|
|
635
|
+
* Use this when data was deleted outside `TypeInfoORMService`.
|
|
636
|
+
*
|
|
637
|
+
* @param typeName Type name for the indexed item.
|
|
638
|
+
* @param item Item snapshot to remove from the indexes.
|
|
639
|
+
* @param config Optional full-text field overrides.
|
|
640
|
+
* @returns Promise resolved when index cleanup completes.
|
|
641
|
+
*/
|
|
642
|
+
removeItemIndexes: (typeName: string, item: Partial<TypeInfoDataItem>, config?: TypeInfoORMManualIndexingConfig) => Promise<void>;
|
|
643
|
+
/**
|
|
644
|
+
* Replace one indexed item snapshot with another.
|
|
645
|
+
*
|
|
646
|
+
* Use this when an existing stored item changed outside `TypeInfoORMService`
|
|
647
|
+
* or when a schema/config change requires removing old full-text fields and
|
|
648
|
+
* indexing a new field set.
|
|
649
|
+
*
|
|
650
|
+
* @param typeName Type name for the indexed item.
|
|
651
|
+
* @param previousItem Previous item snapshot to remove.
|
|
652
|
+
* @param nextItem Next item snapshot to index.
|
|
653
|
+
* @param config Optional previous/next full-text field overrides.
|
|
654
|
+
* @returns Promise resolved when replacement indexing completes.
|
|
655
|
+
*/
|
|
656
|
+
replaceItemIndexes: (typeName: string, previousItem: Partial<TypeInfoDataItem>, nextItem: Partial<TypeInfoDataItem>, config?: TypeInfoORMReplaceIndexingConfig) => Promise<void>;
|
|
657
|
+
/**
|
|
658
|
+
* Reindex the current stored item using the configured driver.
|
|
659
|
+
*
|
|
660
|
+
* When no previous snapshot is supplied, the current stored item is used for
|
|
661
|
+
* both removal and indexing to refresh existing postings without duplication.
|
|
662
|
+
* Supply `previousItem` when an out-of-band update changed indexed field
|
|
663
|
+
* values, otherwise old full-text tokens cannot be removed safely.
|
|
664
|
+
*
|
|
665
|
+
* @param typeName Type name to reindex.
|
|
666
|
+
* @param primaryFieldValue Primary field value for the stored item.
|
|
667
|
+
* @param config Optional previous snapshot and full-text field overrides.
|
|
668
|
+
* @returns True when reindexing completed.
|
|
669
|
+
*/
|
|
670
|
+
reindexStoredItem: (typeName: string, primaryFieldValue: LiteralValue, config?: TypeInfoORMReindexStoredItemConfig) => Promise<boolean>;
|
|
671
|
+
/**
|
|
672
|
+
* Reindex all currently stored items for a type.
|
|
673
|
+
*
|
|
674
|
+
* This is intended for maintenance passes after out-of-band writes or
|
|
675
|
+
* schema/index configuration changes. Deleted items still require explicit
|
|
676
|
+
* cleanup via {@link removeItemIndexes}, because full-text token removal
|
|
677
|
+
* needs a prior snapshot of indexed field values. For out-of-band updates
|
|
678
|
+
* that changed indexed values, provide `previousItemsByPrimaryField`.
|
|
679
|
+
*
|
|
680
|
+
* @param typeName Type name to reindex.
|
|
681
|
+
* @param config Paging, previous snapshots, and full-text field overrides.
|
|
682
|
+
* @returns Count of processed stored items.
|
|
683
|
+
*/
|
|
684
|
+
reindexStoredType: (typeName: string, config?: TypeInfoORMReindexStoredTypeConfig) => Promise<TypeInfoORMReindexStoredTypeResults>;
|
|
551
685
|
/**
|
|
552
686
|
* @returns Promise resolved once indexing is complete.
|
|
553
687
|
*/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { TypeInfoMap } from "../../common/TypeParsing/TypeInfo";
|
|
2
|
+
import type { TypeInfoORMIndexingConfig } from "./TypeInfoORMService";
|
|
3
|
+
/**
|
|
4
|
+
* Base indexing config accepted by {@link getTypeInfoORMIndexingConfigFromTypeInfoMap}.
|
|
5
|
+
*
|
|
6
|
+
* The utility derives only field lists from `TypeInfo` tags. Concrete backends,
|
|
7
|
+
* readers, writers, and other runtime dependencies must be supplied here when
|
|
8
|
+
* a tagged field requires that indexing mode.
|
|
9
|
+
*/
|
|
10
|
+
export type TypeInfoORMIndexingConfigSeed = Omit<TypeInfoORMIndexingConfig, "fullText" | "structured"> & {
|
|
11
|
+
/**
|
|
12
|
+
* Optional full-text runtime dependencies and existing field map.
|
|
13
|
+
*/
|
|
14
|
+
fullText?: TypeInfoORMIndexingConfig["fullText"];
|
|
15
|
+
/**
|
|
16
|
+
* Optional structured runtime dependencies and existing field map.
|
|
17
|
+
*/
|
|
18
|
+
structured?: TypeInfoORMIndexingConfig["structured"];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Derive ORM indexing field configuration from `TypeInfoField.tags.indexed`.
|
|
22
|
+
*
|
|
23
|
+
* The returned config preserves the supplied runtime dependencies and merges
|
|
24
|
+
* any generated field names into existing `fullText.defaultIndexFieldByType`
|
|
25
|
+
* and `structured.indexedFieldsByType` entries.
|
|
26
|
+
*
|
|
27
|
+
* @param typeInfoMap Type definitions to scan for indexing tags.
|
|
28
|
+
* @param baseConfig Runtime indexing dependencies and any existing field lists.
|
|
29
|
+
* @returns ORM indexing config with generated field lists merged in.
|
|
30
|
+
*/
|
|
31
|
+
export declare const getTypeInfoORMIndexingConfigFromTypeInfoMap: (typeInfoMap: TypeInfoMap, baseConfig?: TypeInfoORMIndexingConfigSeed) => TypeInfoORMIndexingConfig;
|
package/api/ORM/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
export * from "./drivers";
|
|
5
5
|
export * from "./TypeInfoORMService";
|
|
6
6
|
export * from "./DACUtils";
|
|
7
|
+
export * from "./getTypeInfoORMIndexingConfigFromTypeInfoMap";
|
|
7
8
|
export * from "./ORMRouteMap";
|
|
8
9
|
export * from "../DataAccessControl";
|
|
9
10
|
export * from "../Router/Types";
|
package/api/index.js
CHANGED
|
@@ -7528,8 +7528,24 @@ var TypeInfoORMService = class {
|
|
|
7528
7528
|
* @returns Resolved full-text index field names.
|
|
7529
7529
|
*/
|
|
7530
7530
|
resolveFullTextIndexFields = (typeName, override) => {
|
|
7531
|
-
if (override) {
|
|
7532
|
-
return [override];
|
|
7531
|
+
if (typeof override === "string") {
|
|
7532
|
+
return this.resolveFullTextIndexFields(typeName, [override]);
|
|
7533
|
+
}
|
|
7534
|
+
if (Array.isArray(override)) {
|
|
7535
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
7536
|
+
const fields2 = [];
|
|
7537
|
+
for (const field of override) {
|
|
7538
|
+
if (typeof field !== "string") {
|
|
7539
|
+
continue;
|
|
7540
|
+
}
|
|
7541
|
+
const trimmed = field.trim();
|
|
7542
|
+
if (!trimmed || seen2.has(trimmed)) {
|
|
7543
|
+
continue;
|
|
7544
|
+
}
|
|
7545
|
+
seen2.add(trimmed);
|
|
7546
|
+
fields2.push(trimmed);
|
|
7547
|
+
}
|
|
7548
|
+
return fields2;
|
|
7533
7549
|
}
|
|
7534
7550
|
const defaults = this.config.indexing?.fullText?.defaultIndexFieldByType?.[typeName];
|
|
7535
7551
|
if (typeof defaults === "string") {
|
|
@@ -7833,6 +7849,10 @@ var TypeInfoORMService = class {
|
|
|
7833
7849
|
}
|
|
7834
7850
|
return fields;
|
|
7835
7851
|
};
|
|
7852
|
+
/**
|
|
7853
|
+
* @returns Item snapshot normalized for indexing operations.
|
|
7854
|
+
*/
|
|
7855
|
+
getIndexedItemSnapshot = (typeName, item) => this.getCleanItem(typeName, item, {});
|
|
7836
7856
|
/**
|
|
7837
7857
|
* @returns Mapped structured query.
|
|
7838
7858
|
*/
|
|
@@ -7952,6 +7972,132 @@ var TypeInfoORMService = class {
|
|
|
7952
7972
|
});
|
|
7953
7973
|
}
|
|
7954
7974
|
}
|
|
7975
|
+
/**
|
|
7976
|
+
* Write the provided item snapshot into the configured indexes.
|
|
7977
|
+
*
|
|
7978
|
+
* Use this when data was created or modified outside `TypeInfoORMService`.
|
|
7979
|
+
*
|
|
7980
|
+
* @param typeName Type name for the indexed item.
|
|
7981
|
+
* @param item Item snapshot to index.
|
|
7982
|
+
* @param config Optional full-text field overrides.
|
|
7983
|
+
* @returns Promise resolved when manual indexing completes.
|
|
7984
|
+
*/
|
|
7985
|
+
indexItemIndexes = async (typeName, item, config = {}) => {
|
|
7986
|
+
const indexedItem = this.getIndexedItemSnapshot(typeName, item);
|
|
7987
|
+
await this.indexFullTextDocument(
|
|
7988
|
+
typeName,
|
|
7989
|
+
indexedItem,
|
|
7990
|
+
config.fullTextIndexFields
|
|
7991
|
+
);
|
|
7992
|
+
await this.indexStructuredDocument(typeName, indexedItem);
|
|
7993
|
+
};
|
|
7994
|
+
/**
|
|
7995
|
+
* Remove the provided item snapshot from the configured indexes.
|
|
7996
|
+
*
|
|
7997
|
+
* Use this when data was deleted outside `TypeInfoORMService`.
|
|
7998
|
+
*
|
|
7999
|
+
* @param typeName Type name for the indexed item.
|
|
8000
|
+
* @param item Item snapshot to remove from the indexes.
|
|
8001
|
+
* @param config Optional full-text field overrides.
|
|
8002
|
+
* @returns Promise resolved when index cleanup completes.
|
|
8003
|
+
*/
|
|
8004
|
+
removeItemIndexes = async (typeName, item, config = {}) => {
|
|
8005
|
+
const indexedItem = this.getIndexedItemSnapshot(typeName, item);
|
|
8006
|
+
await this.removeFullTextDocument(
|
|
8007
|
+
typeName,
|
|
8008
|
+
indexedItem,
|
|
8009
|
+
config.fullTextIndexFields
|
|
8010
|
+
);
|
|
8011
|
+
await this.removeStructuredDocument(typeName, indexedItem);
|
|
8012
|
+
};
|
|
8013
|
+
/**
|
|
8014
|
+
* Replace one indexed item snapshot with another.
|
|
8015
|
+
*
|
|
8016
|
+
* Use this when an existing stored item changed outside `TypeInfoORMService`
|
|
8017
|
+
* or when a schema/config change requires removing old full-text fields and
|
|
8018
|
+
* indexing a new field set.
|
|
8019
|
+
*
|
|
8020
|
+
* @param typeName Type name for the indexed item.
|
|
8021
|
+
* @param previousItem Previous item snapshot to remove.
|
|
8022
|
+
* @param nextItem Next item snapshot to index.
|
|
8023
|
+
* @param config Optional previous/next full-text field overrides.
|
|
8024
|
+
* @returns Promise resolved when replacement indexing completes.
|
|
8025
|
+
*/
|
|
8026
|
+
replaceItemIndexes = async (typeName, previousItem, nextItem, config = {}) => {
|
|
8027
|
+
const previousIndexedItem = this.getIndexedItemSnapshot(typeName, previousItem);
|
|
8028
|
+
const nextIndexedItem = this.getIndexedItemSnapshot(typeName, nextItem);
|
|
8029
|
+
await this.removeFullTextDocument(
|
|
8030
|
+
typeName,
|
|
8031
|
+
previousIndexedItem,
|
|
8032
|
+
config.previousFullTextIndexFields
|
|
8033
|
+
);
|
|
8034
|
+
await this.indexFullTextDocument(
|
|
8035
|
+
typeName,
|
|
8036
|
+
nextIndexedItem,
|
|
8037
|
+
config.nextFullTextIndexFields
|
|
8038
|
+
);
|
|
8039
|
+
await this.indexStructuredDocument(typeName, nextIndexedItem);
|
|
8040
|
+
};
|
|
8041
|
+
/**
|
|
8042
|
+
* Reindex the current stored item using the configured driver.
|
|
8043
|
+
*
|
|
8044
|
+
* When no previous snapshot is supplied, the current stored item is used for
|
|
8045
|
+
* both removal and indexing to refresh existing postings without duplication.
|
|
8046
|
+
* Supply `previousItem` when an out-of-band update changed indexed field
|
|
8047
|
+
* values, otherwise old full-text tokens cannot be removed safely.
|
|
8048
|
+
*
|
|
8049
|
+
* @param typeName Type name to reindex.
|
|
8050
|
+
* @param primaryFieldValue Primary field value for the stored item.
|
|
8051
|
+
* @param config Optional previous snapshot and full-text field overrides.
|
|
8052
|
+
* @returns True when reindexing completed.
|
|
8053
|
+
*/
|
|
8054
|
+
reindexStoredItem = async (typeName, primaryFieldValue, config = {}) => {
|
|
8055
|
+
const driver = this.getDriverInternal(typeName);
|
|
8056
|
+
const currentItem = await driver.readItem(primaryFieldValue);
|
|
8057
|
+
const previousItem = config.previousItem ?? currentItem;
|
|
8058
|
+
await this.replaceItemIndexes(typeName, previousItem, currentItem, {
|
|
8059
|
+
previousFullTextIndexFields: config.previousFullTextIndexFields,
|
|
8060
|
+
nextFullTextIndexFields: config.nextFullTextIndexFields
|
|
8061
|
+
});
|
|
8062
|
+
return true;
|
|
8063
|
+
};
|
|
8064
|
+
/**
|
|
8065
|
+
* Reindex all currently stored items for a type.
|
|
8066
|
+
*
|
|
8067
|
+
* This is intended for maintenance passes after out-of-band writes or
|
|
8068
|
+
* schema/index configuration changes. Deleted items still require explicit
|
|
8069
|
+
* cleanup via {@link removeItemIndexes}, because full-text token removal
|
|
8070
|
+
* needs a prior snapshot of indexed field values. For out-of-band updates
|
|
8071
|
+
* that changed indexed values, provide `previousItemsByPrimaryField`.
|
|
8072
|
+
*
|
|
8073
|
+
* @param typeName Type name to reindex.
|
|
8074
|
+
* @param config Paging, previous snapshots, and full-text field overrides.
|
|
8075
|
+
* @returns Count of processed stored items.
|
|
8076
|
+
*/
|
|
8077
|
+
reindexStoredType = async (typeName, config = {}) => {
|
|
8078
|
+
const driver = this.getDriverInternal(typeName);
|
|
8079
|
+
const primaryFieldName = String(this.getTypeInfo(typeName).primaryField);
|
|
8080
|
+
const itemsPerPage = config.itemsPerPage ?? 100;
|
|
8081
|
+
let processedCount = 0;
|
|
8082
|
+
let cursor;
|
|
8083
|
+
do {
|
|
8084
|
+
const page = await driver.listItems({ itemsPerPage, cursor });
|
|
8085
|
+
for (const item of page.items) {
|
|
8086
|
+
const primaryFieldValue = item[primaryFieldName];
|
|
8087
|
+
if (typeof primaryFieldValue === "undefined") {
|
|
8088
|
+
continue;
|
|
8089
|
+
}
|
|
8090
|
+
const previousItem = config.previousItemsByPrimaryField?.[String(primaryFieldValue)] ?? item;
|
|
8091
|
+
await this.replaceItemIndexes(typeName, previousItem, item, {
|
|
8092
|
+
previousFullTextIndexFields: config.previousFullTextIndexFields,
|
|
8093
|
+
nextFullTextIndexFields: config.nextFullTextIndexFields
|
|
8094
|
+
});
|
|
8095
|
+
processedCount += 1;
|
|
8096
|
+
}
|
|
8097
|
+
cursor = page.cursor;
|
|
8098
|
+
} while (cursor);
|
|
8099
|
+
return { processedCount };
|
|
8100
|
+
};
|
|
7955
8101
|
/**
|
|
7956
8102
|
* @returns Promise resolved once indexing is complete.
|
|
7957
8103
|
*/
|
|
@@ -8475,8 +8621,7 @@ var TypeInfoORMService = class {
|
|
|
8475
8621
|
...cleanItem,
|
|
8476
8622
|
[primaryField]: newIdentifier
|
|
8477
8623
|
};
|
|
8478
|
-
await this.
|
|
8479
|
-
await this.indexStructuredDocument(typeName, indexedItem);
|
|
8624
|
+
await this.indexItemIndexes(typeName, indexedItem);
|
|
8480
8625
|
return newIdentifier;
|
|
8481
8626
|
};
|
|
8482
8627
|
/**
|
|
@@ -8619,12 +8764,10 @@ var TypeInfoORMService = class {
|
|
|
8619
8764
|
const result = await driver.updateItem(primaryFieldValue, cleanItem);
|
|
8620
8765
|
const updatedItem = await driver.readItem(primaryFieldValue);
|
|
8621
8766
|
if (existingItem) {
|
|
8622
|
-
await this.
|
|
8623
|
-
await this.indexFullTextDocument(typeName, updatedItem);
|
|
8767
|
+
await this.replaceItemIndexes(typeName, existingItem, updatedItem);
|
|
8624
8768
|
} else {
|
|
8625
|
-
await this.
|
|
8769
|
+
await this.indexItemIndexes(typeName, updatedItem);
|
|
8626
8770
|
}
|
|
8627
|
-
await this.indexStructuredDocument(typeName, updatedItem);
|
|
8628
8771
|
return result;
|
|
8629
8772
|
}
|
|
8630
8773
|
}
|
|
@@ -8661,8 +8804,7 @@ var TypeInfoORMService = class {
|
|
|
8661
8804
|
fromTypeName: typeName,
|
|
8662
8805
|
fromTypePrimaryFieldValue: primaryFieldValue
|
|
8663
8806
|
});
|
|
8664
|
-
await this.
|
|
8665
|
-
await this.removeStructuredDocument(typeName, existingItem);
|
|
8807
|
+
await this.removeItemIndexes(typeName, existingItem);
|
|
8666
8808
|
return result;
|
|
8667
8809
|
}
|
|
8668
8810
|
};
|
|
@@ -8897,6 +9039,100 @@ var TypeInfoORMService = class {
|
|
|
8897
9039
|
};
|
|
8898
9040
|
};
|
|
8899
9041
|
|
|
9042
|
+
// src/api/ORM/getTypeInfoORMIndexingConfigFromTypeInfoMap.ts
|
|
9043
|
+
var dedupeFieldNames = (fieldNames) => {
|
|
9044
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9045
|
+
const deduped = [];
|
|
9046
|
+
for (const fieldName of fieldNames) {
|
|
9047
|
+
if (typeof fieldName !== "string") {
|
|
9048
|
+
continue;
|
|
9049
|
+
}
|
|
9050
|
+
const trimmed = fieldName.trim();
|
|
9051
|
+
if (!trimmed || seen.has(trimmed)) {
|
|
9052
|
+
continue;
|
|
9053
|
+
}
|
|
9054
|
+
seen.add(trimmed);
|
|
9055
|
+
deduped.push(trimmed);
|
|
9056
|
+
}
|
|
9057
|
+
return deduped;
|
|
9058
|
+
};
|
|
9059
|
+
var normalizeFieldMap = (fieldMap) => {
|
|
9060
|
+
const normalized = {};
|
|
9061
|
+
if (!fieldMap) {
|
|
9062
|
+
return normalized;
|
|
9063
|
+
}
|
|
9064
|
+
for (const [typeName, configuredFieldNames] of Object.entries(fieldMap)) {
|
|
9065
|
+
const values = Array.isArray(configuredFieldNames) ? configuredFieldNames : [configuredFieldNames];
|
|
9066
|
+
const deduped = dedupeFieldNames(values);
|
|
9067
|
+
if (deduped.length > 0) {
|
|
9068
|
+
normalized[typeName] = deduped;
|
|
9069
|
+
}
|
|
9070
|
+
}
|
|
9071
|
+
return normalized;
|
|
9072
|
+
};
|
|
9073
|
+
var mergeFieldMaps = (existing, generated) => {
|
|
9074
|
+
const merged = { ...existing };
|
|
9075
|
+
for (const [typeName, generatedFieldNames] of Object.entries(generated)) {
|
|
9076
|
+
merged[typeName] = dedupeFieldNames([
|
|
9077
|
+
...existing[typeName] ?? [],
|
|
9078
|
+
...generatedFieldNames
|
|
9079
|
+
]);
|
|
9080
|
+
}
|
|
9081
|
+
return merged;
|
|
9082
|
+
};
|
|
9083
|
+
var hasIndexedFields = (fieldMap) => Object.keys(fieldMap).length > 0;
|
|
9084
|
+
var getTypeInfoORMIndexingConfigFromTypeInfoMap = (typeInfoMap, baseConfig = {}) => {
|
|
9085
|
+
const generatedFullText = {};
|
|
9086
|
+
const generatedStructured = {};
|
|
9087
|
+
for (const [typeName, typeInfo] of Object.entries(typeInfoMap)) {
|
|
9088
|
+
const fields = typeInfo.fields ?? {};
|
|
9089
|
+
for (const [fieldName, field] of Object.entries(fields)) {
|
|
9090
|
+
const indexed = field.tags?.indexed;
|
|
9091
|
+
if (indexed?.fullText) {
|
|
9092
|
+
generatedFullText[typeName] = [
|
|
9093
|
+
...generatedFullText[typeName] ?? [],
|
|
9094
|
+
fieldName
|
|
9095
|
+
];
|
|
9096
|
+
}
|
|
9097
|
+
if (indexed?.structured) {
|
|
9098
|
+
generatedStructured[typeName] = [
|
|
9099
|
+
...generatedStructured[typeName] ?? [],
|
|
9100
|
+
fieldName
|
|
9101
|
+
];
|
|
9102
|
+
}
|
|
9103
|
+
}
|
|
9104
|
+
}
|
|
9105
|
+
if (hasIndexedFields(generatedFullText) && !baseConfig.fullText?.backend) {
|
|
9106
|
+
throw new Error(
|
|
9107
|
+
"Cannot generate fullText indexing config from tags without fullText.backend."
|
|
9108
|
+
);
|
|
9109
|
+
}
|
|
9110
|
+
if (hasIndexedFields(generatedStructured) && !baseConfig.structured?.reader) {
|
|
9111
|
+
throw new Error(
|
|
9112
|
+
"Cannot generate structured indexing config from tags without structured.reader."
|
|
9113
|
+
);
|
|
9114
|
+
}
|
|
9115
|
+
const mergedFullTextByType = mergeFieldMaps(
|
|
9116
|
+
normalizeFieldMap(baseConfig.fullText?.defaultIndexFieldByType),
|
|
9117
|
+
generatedFullText
|
|
9118
|
+
);
|
|
9119
|
+
const mergedStructuredByType = mergeFieldMaps(
|
|
9120
|
+
normalizeFieldMap(baseConfig.structured?.indexedFieldsByType),
|
|
9121
|
+
generatedStructured
|
|
9122
|
+
);
|
|
9123
|
+
return {
|
|
9124
|
+
...baseConfig,
|
|
9125
|
+
fullText: baseConfig.fullText ? {
|
|
9126
|
+
...baseConfig.fullText,
|
|
9127
|
+
...hasIndexedFields(mergedFullTextByType) ? { defaultIndexFieldByType: mergedFullTextByType } : {}
|
|
9128
|
+
} : void 0,
|
|
9129
|
+
structured: baseConfig.structured ? {
|
|
9130
|
+
...baseConfig.structured,
|
|
9131
|
+
...hasIndexedFields(mergedStructuredByType) ? { indexedFieldsByType: mergedStructuredByType } : {}
|
|
9132
|
+
} : void 0
|
|
9133
|
+
};
|
|
9134
|
+
};
|
|
9135
|
+
|
|
8900
9136
|
// src/api/Router/Auth.ts
|
|
8901
9137
|
var getRouteIsAuthorized = (authInfo, authConfig) => {
|
|
8902
9138
|
const { userId, roles = [] } = authInfo;
|
|
@@ -9302,4 +9538,4 @@ var getContextFromEventData = (eventData, dacConfig, getAccessingRoleId) => {
|
|
|
9302
9538
|
return { accessingRoleId };
|
|
9303
9539
|
};
|
|
9304
9540
|
|
|
9305
|
-
export { AWS, DACConstraintType, DATA_ITEM_DB_DRIVER_ERRORS, DynamoDBDataItemDBDriver, DynamoDBSupportedDataItemDBDriverEntry, ExactIndex, FullTextDdbBackend, FullTextDdbWriter, FullTextMemoryBackend, InMemoryDataItemDBDriver, InMemoryFileItemDBDriver, InMemoryFileSupportedDataItemDBDriverEntry, InMemoryItemRelationshipDBDriver, InMemorySupportedDataItemDBDriverEntry, IndexingRelationshipDriver, LossyIndex, RelationalDdbBackend, RelationalInMemoryBackend, S3FileItemDBDriver, S3SupportedFileItemDBDriverEntry, SEARCH_CAPS, SEARCH_DEFAULTS, SUPPORTED_TYPE_INFO_ORM_DB_DRIVERS, StructuredDdbBackend, StructuredDdbReader, StructuredDdbWriter, StructuredInMemoryBackend, StructuredInMemoryIndex, SupportedTypeInfoORMDBDriverNames, TYPE_INFO_ORM_API_PATH_METHOD_NAME_MAP, TYPE_INFO_ORM_ROUTE_MAP_ERRORS, TypeInfoORMService, WILDCARD_SIGNIFIER_PROTOTYPE, addRouteMapToRouteMap, addRouteToRouteMap, addRoutesToRouteMap, batchWriteWithRetry, buildExactDdbItem, buildExactDdbKey, buildExactS3Key, buildLossyDdbKey, buildLossyS3Key, buildRelationEdgeDdbItem, buildRelationEdgeDdbKey, buildStructuredDocFieldsItem, buildStructuredRangeItem, buildStructuredRangeKey, buildStructuredTermItem, buildStructuredTermKey, cleanRelationshipItem, createAwsSdkV3DynamoClient, createRelationEdgesDdbDependencies, createSearchTrace, decodeExactCursor, decodeLossyCursor, decodeRelationalCursor, decodeStructuredCursor, docTokenPositionsSchema, docTokensSchema, encodeDocKey, encodeDocMirrorKey, encodeDocTokenPositionSortKey, encodeDocTokenSortKey, encodeExactCursor, encodeLossyCursor, encodeRelationEdgePartitionKey, encodeRelationalCursor, encodeStructuredCursor, encodeTokenDocSortKey, encodeTokenKey, exactDdbSchema, exactPostingsSchema, fullTextDocMirrorSchema, fullTextKeyPrefixes, fullTextTokenStatsSchema, getDACPathsMatch, getDACRoleHasAccessToDataItem, getDataItemDACResourcePath, getDataItemFieldValueDACResourcePath, getDriverMethodWithModifiedError, getFlattenedDACConstraints, getFullORMDACRole, getItemRelationshipDACResourcePath, getItemRelationshipOriginDACConstraint, getItemRelationshipOriginDACResourcePath, getItemRelationshipOriginDACRole, getItemTypeDACConstraint, getItemTypeDACResourcePath, getItemTypeDACRole, getORMDACResourcePath, getResourceAccessByDACRole, getTypeInfoORMRouteMap, getValueIsWildcardSignifier, handleCloudFunctionEvent, handler, indexDocument, loadExactPositions, loadLossyIndex, lossyDdbSchema, lossyPostingsSchema, mergeDACAccessResults, mergeDACDataItemResourceAccessResultMaps, qualifyIndexField, relHandler, relationEdgesSchema, removeDocument, replaceFullTextDocument, resolveSearchLimits, searchExact, searchLossy, searchStructured, serializeStructuredValue, setIndexBackend, setRelationalHandlerDependencies, setStructuredHandlerDependencies, storeExactPositions, storeLossyIndex, structuredDocFieldsSchema, structuredHandler, structuredRangeIndexSchema, structuredTermIndexSchema, tokenize, tokenizeLossyTrigrams };
|
|
9541
|
+
export { AWS, DACConstraintType, DATA_ITEM_DB_DRIVER_ERRORS, DynamoDBDataItemDBDriver, DynamoDBSupportedDataItemDBDriverEntry, ExactIndex, FullTextDdbBackend, FullTextDdbWriter, FullTextMemoryBackend, InMemoryDataItemDBDriver, InMemoryFileItemDBDriver, InMemoryFileSupportedDataItemDBDriverEntry, InMemoryItemRelationshipDBDriver, InMemorySupportedDataItemDBDriverEntry, IndexingRelationshipDriver, LossyIndex, RelationalDdbBackend, RelationalInMemoryBackend, S3FileItemDBDriver, S3SupportedFileItemDBDriverEntry, SEARCH_CAPS, SEARCH_DEFAULTS, SUPPORTED_TYPE_INFO_ORM_DB_DRIVERS, StructuredDdbBackend, StructuredDdbReader, StructuredDdbWriter, StructuredInMemoryBackend, StructuredInMemoryIndex, SupportedTypeInfoORMDBDriverNames, TYPE_INFO_ORM_API_PATH_METHOD_NAME_MAP, TYPE_INFO_ORM_ROUTE_MAP_ERRORS, TypeInfoORMService, WILDCARD_SIGNIFIER_PROTOTYPE, addRouteMapToRouteMap, addRouteToRouteMap, addRoutesToRouteMap, batchWriteWithRetry, buildExactDdbItem, buildExactDdbKey, buildExactS3Key, buildLossyDdbKey, buildLossyS3Key, buildRelationEdgeDdbItem, buildRelationEdgeDdbKey, buildStructuredDocFieldsItem, buildStructuredRangeItem, buildStructuredRangeKey, buildStructuredTermItem, buildStructuredTermKey, cleanRelationshipItem, createAwsSdkV3DynamoClient, createRelationEdgesDdbDependencies, createSearchTrace, decodeExactCursor, decodeLossyCursor, decodeRelationalCursor, decodeStructuredCursor, docTokenPositionsSchema, docTokensSchema, encodeDocKey, encodeDocMirrorKey, encodeDocTokenPositionSortKey, encodeDocTokenSortKey, encodeExactCursor, encodeLossyCursor, encodeRelationEdgePartitionKey, encodeRelationalCursor, encodeStructuredCursor, encodeTokenDocSortKey, encodeTokenKey, exactDdbSchema, exactPostingsSchema, fullTextDocMirrorSchema, fullTextKeyPrefixes, fullTextTokenStatsSchema, getDACPathsMatch, getDACRoleHasAccessToDataItem, getDataItemDACResourcePath, getDataItemFieldValueDACResourcePath, getDriverMethodWithModifiedError, getFlattenedDACConstraints, getFullORMDACRole, getItemRelationshipDACResourcePath, getItemRelationshipOriginDACConstraint, getItemRelationshipOriginDACResourcePath, getItemRelationshipOriginDACRole, getItemTypeDACConstraint, getItemTypeDACResourcePath, getItemTypeDACRole, getORMDACResourcePath, getResourceAccessByDACRole, getTypeInfoORMIndexingConfigFromTypeInfoMap, getTypeInfoORMRouteMap, getValueIsWildcardSignifier, handleCloudFunctionEvent, handler, indexDocument, loadExactPositions, loadLossyIndex, lossyDdbSchema, lossyPostingsSchema, mergeDACAccessResults, mergeDACDataItemResourceAccessResultMaps, qualifyIndexField, relHandler, relationEdgesSchema, removeDocument, replaceFullTextDocument, resolveSearchLimits, searchExact, searchLossy, searchStructured, serializeStructuredValue, setIndexBackend, setRelationalHandlerDependencies, setStructuredHandlerDependencies, storeExactPositions, storeLossyIndex, structuredDocFieldsSchema, structuredHandler, structuredRangeIndexSchema, structuredTermIndexSchema, tokenize, tokenizeLossyTrigrams };
|
package/app/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createEasyLayout, getEasyLayoutTemplateDetails, getPascalCaseAreaName } from '../chunk-
|
|
1
|
+
export { createEasyLayout, getEasyLayoutTemplateDetails, getPascalCaseAreaName } from '../chunk-CMH6L5QQ.js';
|
|
2
2
|
export { computeTrackPixels } from '../chunk-TJFTWPXQ.js';
|
|
3
|
-
export { AutoForm, AutoFormView, Route, RouteContext, RouteContextConsumer, RouteContextProvider, RouteProvider, buildHistoryPath, buildQueryString, buildRoutePath, canUseBrowserHistory, computeAreaBounds, createAutoField, createBrowserRouteAdapter, createFormRenderer, createHistoryBackHandler, createManualRouteAdapter, createMemoryHistory, createNativeRouteAdapter, createRouteAdapterFromHistory, createUniversalAdapter, defaultTranslateValidationErrorCode, getFieldKind, parseHistoryPath, parseTemplate, resolveSuite, useFormEngine, useRouteContext, validateAreas, wrapRouteAdapterWithPathResolver } from '../chunk-
|
|
3
|
+
export { AutoForm, AutoFormView, Route, RouteContext, RouteContextConsumer, RouteContextProvider, RouteProvider, buildHistoryPath, buildQueryString, buildRoutePath, canUseBrowserHistory, computeAreaBounds, createAutoField, createBrowserRouteAdapter, createFormRenderer, createHistoryBackHandler, createManualRouteAdapter, createMemoryHistory, createNativeRouteAdapter, createRouteAdapterFromHistory, createUniversalAdapter, defaultTranslateValidationErrorCode, getFieldKind, parseHistoryPath, parseTemplate, resolveSuite, useFormEngine, useRouteContext, validateAreas, wrapRouteAdapterWithPathResolver } from '../chunk-44BMFTKD.js';
|
|
4
4
|
import '../chunk-7AMEFPPP.js';
|
|
5
5
|
import '../chunk-YCTVEW2I.js';
|
|
6
6
|
import { mergeStringPaths, PATH_DELIMITER } from '../chunk-WNFRDIBW.js';
|
package/app/utils/Route.d.ts
CHANGED
|
@@ -50,6 +50,15 @@ export type RouteQueryValue = string | number | boolean | null | undefined | Arr
|
|
|
50
50
|
* Query string map for route serialization.
|
|
51
51
|
*/
|
|
52
52
|
export type RouteQuery = Record<string, RouteQueryValue>;
|
|
53
|
+
/**
|
|
54
|
+
* Route path matcher config.
|
|
55
|
+
*/
|
|
56
|
+
export type RoutePathConfig = {
|
|
57
|
+
/** Path pattern, using `:` for params. */
|
|
58
|
+
path: string;
|
|
59
|
+
/** Optional exact-match override for this path entry. */
|
|
60
|
+
exact?: boolean;
|
|
61
|
+
};
|
|
53
62
|
/**
|
|
54
63
|
* Create a manual adapter for non-DOM runtimes (e.g., React Native).
|
|
55
64
|
*
|
|
@@ -142,7 +151,7 @@ export type RouteProps<ParamsType extends Record<string, any>> = {
|
|
|
142
151
|
/**
|
|
143
152
|
* Route path pattern(s), using `:` for params.
|
|
144
153
|
*/
|
|
145
|
-
path?: string | string[];
|
|
154
|
+
path?: string | (string | RoutePathConfig)[];
|
|
146
155
|
/**
|
|
147
156
|
* Callback when params update for this route.
|
|
148
157
|
*
|
|
@@ -673,15 +673,24 @@ var RouteMatcher = ({
|
|
|
673
673
|
() => currentWindowPath,
|
|
674
674
|
[currentWindowPath]
|
|
675
675
|
);
|
|
676
|
-
const normalizedPaths = useMemo(
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
676
|
+
const normalizedPaths = useMemo(() => {
|
|
677
|
+
const routePaths = Array.isArray(path) ? path : [path];
|
|
678
|
+
return routePaths.map(
|
|
679
|
+
(routePath) => typeof routePath === "string" ? {
|
|
680
|
+
path: routePath,
|
|
681
|
+
exact
|
|
682
|
+
} : routePath
|
|
683
|
+
);
|
|
684
|
+
}, [path, exact]);
|
|
680
685
|
const matchedRoute = useMemo(
|
|
681
686
|
() => {
|
|
682
|
-
for (const
|
|
683
|
-
const fullPath = mergeStringPaths(parentPath,
|
|
684
|
-
const newParams = getParamsAndTestPath(
|
|
687
|
+
for (const routePathConfig of normalizedPaths) {
|
|
688
|
+
const fullPath = mergeStringPaths(parentPath, routePathConfig.path);
|
|
689
|
+
const newParams = getParamsAndTestPath(
|
|
690
|
+
targetCurrentPath,
|
|
691
|
+
fullPath,
|
|
692
|
+
routePathConfig.exact
|
|
693
|
+
);
|
|
685
694
|
if (newParams) {
|
|
686
695
|
return {
|
|
687
696
|
fullPath,
|
|
@@ -691,7 +700,7 @@ var RouteMatcher = ({
|
|
|
691
700
|
}
|
|
692
701
|
return null;
|
|
693
702
|
},
|
|
694
|
-
[targetCurrentPath, parentPath, normalizedPaths
|
|
703
|
+
[targetCurrentPath, parentPath, normalizedPaths]
|
|
695
704
|
);
|
|
696
705
|
const params = useMemo(
|
|
697
706
|
() => ({
|
|
@@ -132,6 +132,19 @@ export type SupportedFieldTags = Partial<{
|
|
|
132
132
|
*/
|
|
133
133
|
emptyArrayIsValid: boolean;
|
|
134
134
|
}>;
|
|
135
|
+
/**
|
|
136
|
+
* Indexing behavior flags used to derive ORM indexing configuration.
|
|
137
|
+
* */
|
|
138
|
+
indexed: Partial<{
|
|
139
|
+
/**
|
|
140
|
+
* Whether this field should be added to the type's default full-text index fields.
|
|
141
|
+
* */
|
|
142
|
+
fullText: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Whether this field should be added to the type's structured indexed field list.
|
|
145
|
+
* */
|
|
146
|
+
structured: boolean;
|
|
147
|
+
}>;
|
|
135
148
|
}>;
|
|
136
149
|
/**
|
|
137
150
|
* The set of acceptable literal value types.
|
package/native/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computeTrackPixels } from '../chunk-TJFTWPXQ.js';
|
|
2
|
-
import { createFormRenderer, createHistoryBackHandler, buildHistoryPath, AutoFormView, AutoForm, parseTemplate, validateAreas, computeAreaBounds, parseHistoryPath, createMemoryHistory, Route, buildRoutePath } from '../chunk-
|
|
2
|
+
import { createFormRenderer, createHistoryBackHandler, buildHistoryPath, AutoFormView, AutoForm, parseTemplate, validateAreas, computeAreaBounds, parseHistoryPath, createMemoryHistory, Route, buildRoutePath } from '../chunk-44BMFTKD.js';
|
|
3
3
|
import { ERROR_MESSAGE_CONSTANTS } from '../chunk-YCTVEW2I.js';
|
|
4
4
|
import { resolveRouteAdapterPath, getPathArray } from '../chunk-WNFRDIBW.js';
|
|
5
5
|
import '../chunk-I2KLQ2HA.js';
|
package/package.json
CHANGED
package/web/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createEasyLayout } from '../chunk-
|
|
2
|
-
import { createFormRenderer, AutoFormView, AutoForm, createBrowserRouteAdapter, Route } from '../chunk-
|
|
1
|
+
import { createEasyLayout } from '../chunk-CMH6L5QQ.js';
|
|
2
|
+
import { createFormRenderer, AutoFormView, AutoForm, createBrowserRouteAdapter, Route } from '../chunk-44BMFTKD.js';
|
|
3
3
|
import { ERROR_MESSAGE_CONSTANTS } from '../chunk-YCTVEW2I.js';
|
|
4
4
|
import '../chunk-WNFRDIBW.js';
|
|
5
5
|
import { __export, __reExport } from '../chunk-I2KLQ2HA.js';
|