@resistdesign/voltra 3.0.0-alpha.43 → 3.0.0-alpha.45

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.
@@ -17,6 +17,17 @@
17
17
  import { BaseTypeInfoORMServiceConfig, TypeInfoORMDACConfig } from "./TypeInfoORMService";
18
18
  import { AuthInfo, RouteAuthConfig, RouteMap } from "../Router/Types";
19
19
  import { TypeInfoORMAPI } from "../../common/TypeInfoORM";
20
+ /**
21
+ * Optional configuration for Type Info ORM route-map behavior.
22
+ */
23
+ export type TypeInfoORMRouteMapConfig = {
24
+ /**
25
+ * Whether update handlers should forward field operators from request args.
26
+ *
27
+ * Defaults to `true`.
28
+ */
29
+ allowUpdateFieldOperators?: boolean;
30
+ };
20
31
  /**
21
32
  * A collection of errors that can occur when creating or using a Type Info ORM Route Map.
22
33
  * */
@@ -52,4 +63,8 @@ getAccessingRoleId?: (authInfo: AuthInfo) => string,
52
63
  /**
53
64
  * Optional route-level auth configuration.
54
65
  */
55
- authConfig?: RouteAuthConfig) => RouteMap;
66
+ authConfig?: RouteAuthConfig,
67
+ /**
68
+ * Optional route-map behavior config.
69
+ */
70
+ routeMapConfig?: TypeInfoORMRouteMapConfig) => RouteMap;
@@ -8,7 +8,7 @@
8
8
  import { LiteralValue, TypeInfo, TypeInfoDataItem, TypeInfoField, TypeInfoMap, TypeOperation } from "../../common/TypeParsing/TypeInfo";
9
9
  import { CustomTypeInfoFieldValidatorMap } from "../../common/TypeParsing/Validation";
10
10
  import { ComparisonOperators, FieldCriterion, ListItemsConfig, ListItemsResults, ListRelationshipsConfig, SearchCriteria } from "../../common/SearchTypes";
11
- import { DeleteRelationshipResults, RelationshipOperation, TypeInfoORMAPI, TypeInfoORMContext } from "../../common/TypeInfoORM";
11
+ import { DeleteRelationshipResults, RelationshipOperation, TypeInfoORMAPI, TypeInfoORMContext, TypeInfoORMUpdateConfig } from "../../common/TypeInfoORM";
12
12
  import { DataItemDBDriver, IndexingRelationshipDriver, ItemRelationshipDBDriver } from "./drivers";
13
13
  import { BaseItemRelationshipInfo, ItemRelationshipInfo, ItemRelationshipInfoKeys, ItemRelationshipInfoType, ItemRelationshipOriginatingItemInfo } from "../../common/ItemRelationshipInfoTypes";
14
14
  import { DACAccessResult, DACDataItemResourceAccessResultMap, DACRole } from "../DataAccessControl";
@@ -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
  */
@@ -604,6 +738,10 @@ export declare class TypeInfoORMService implements TypeInfoORMAPI {
604
738
  * Whether the item is a partial update.
605
739
  */
606
740
  itemIsPartial?: boolean) => void;
741
+ /**
742
+ * Validate update operator config against the target TypeInfo fields.
743
+ */
744
+ protected validateUpdateConfig: (typeName: string, item: TypeInfoDataItem, updateConfig?: TypeInfoORMUpdateConfig) => void;
607
745
  /**
608
746
  * @returns Cleaned item with selected fields and DAC constraints applied.
609
747
  */
@@ -719,9 +857,10 @@ export declare class TypeInfoORMService implements TypeInfoORMAPI {
719
857
  * The `item` **must always** contain its **primary field value**.
720
858
  * @param typeName Type name to update.
721
859
  * @param item Item payload to update.
860
+ * @param updateConfig Optional per-field operator config.
722
861
  * @returns True when the update succeeded.
723
862
  * */
724
- update: (typeName: string, item: TypeInfoDataItem, context?: TypeInfoORMContext) => Promise<boolean>;
863
+ update: (typeName: string, item: TypeInfoDataItem, updateConfig?: TypeInfoORMUpdateConfig, context?: TypeInfoORMContext) => Promise<boolean>;
725
864
  /**
726
865
  * Delete an existing item of the given type.
727
866
  * @param typeName Type name to delete.
@@ -7,6 +7,7 @@
7
7
  import { DataItemDBDriver, DataItemDBDriverConfig, SupportedDataItemDBDriverEntry } from "./common/Types";
8
8
  import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
9
9
  import { TypeInfoDataItem } from "../../../common/TypeParsing/TypeInfo";
10
+ import { TypeInfoORMUpdateConfig } from "../../../common/TypeInfoORM";
10
11
  import { ListItemsConfig, ListItemsResults } from "../../../common/SearchTypes";
11
12
  /**
12
13
  * A {@link DataItemDBDriver} that uses DynamoDB as its database.
@@ -59,7 +60,7 @@ export declare class DynamoDBDataItemDBDriver<ItemType extends TypeInfoDataItem,
59
60
  /**
60
61
  * Partial update payload for the item.
61
62
  */
62
- updatedItem: Partial<ItemType>) => Promise<boolean>;
63
+ updatedItem: Partial<ItemType>, updateConfig?: TypeInfoORMUpdateConfig) => Promise<boolean>;
63
64
  /**
64
65
  * Delete an item from the database.
65
66
  * @returns True when an item was deleted.
@@ -1,6 +1,7 @@
1
1
  import { DataItemDBDriver, DataItemDBDriverConfig, SupportedDataItemDBDriverEntry } from "./common/Types";
2
2
  import type { TypeInfoDataItem } from "../../../common/TypeParsing/TypeInfo";
3
3
  import type { ListItemsConfig, ListItemsResults } from "../../../common/SearchTypes";
4
+ import { TypeInfoORMUpdateConfig } from "../../../common/TypeInfoORM";
4
5
  /**
5
6
  * In-memory data item driver for testing and local usage.
6
7
  */
@@ -34,7 +35,7 @@ export declare class InMemoryDataItemDBDriver<ItemType extends TypeInfoDataItem,
34
35
  * @param updatedItem Partial update payload for the item.
35
36
  * @returns True when the item was updated.
36
37
  */
37
- updateItem: (uniqueIdentifier: ItemType[UniquelyIdentifyingFieldName], updatedItem: Partial<ItemType>) => Promise<boolean>;
38
+ updateItem: (uniqueIdentifier: ItemType[UniquelyIdentifyingFieldName], updatedItem: Partial<ItemType>, updateConfig?: TypeInfoORMUpdateConfig) => Promise<boolean>;
38
39
  /**
39
40
  * Delete an item from memory.
40
41
  * @param uniqueIdentifier Unique identifier value for the item.
@@ -1,6 +1,7 @@
1
1
  import { TypeInfoDataItem, TypeInfoPack } from "../../../../common/TypeParsing/TypeInfo";
2
2
  import { ItemRelationshipInfo, ItemRelationshipInfoIdentifyingKeys } from "../../../../common/ItemRelationshipInfoTypes";
3
3
  import { ListItemsConfig, ListItemsResults } from "../../../../common/SearchTypes";
4
+ import type { TypeInfoORMUpdateConfig } from "../../../../common/TypeInfoORM/Types";
4
5
  /**
5
6
  * The errors that can be thrown by a {@link DataItemDBDriver}.
6
7
  * */
@@ -24,7 +25,11 @@ export declare enum DATA_ITEM_DB_DRIVER_ERRORS {
24
25
  /**
25
26
  * Search operator is not supported by the driver.
26
27
  */
27
- SEARCH_COMPARISON_OPERATOR_NOT_SUPPORTED = "SEARCH_COMPARISON_OPERATOR_NOT_SUPPORTED"
28
+ SEARCH_COMPARISON_OPERATOR_NOT_SUPPORTED = "SEARCH_COMPARISON_OPERATOR_NOT_SUPPORTED",
29
+ /**
30
+ * Update operator is not supported by the driver.
31
+ */
32
+ UPDATE_OPERATOR_NOT_SUPPORTED = "UPDATE_OPERATOR_NOT_SUPPORTED"
28
33
  }
29
34
  /**
30
35
  * The generic type for a database driver configuration.
@@ -70,7 +75,7 @@ export type DataItemDBDriver<ItemType extends TypeInfoDataItem, UniquelyIdentify
70
75
  * @param updatedItem Partial update payload for the item.
71
76
  * @returns True when the item was updated.
72
77
  */
73
- updateItem: (uniqueIdentifier: ItemType[UniquelyIdentifyingFieldName], updatedItem: Partial<ItemType>) => Promise<boolean>;
78
+ updateItem: (uniqueIdentifier: ItemType[UniquelyIdentifyingFieldName], updatedItem: Partial<ItemType>, updateConfig?: TypeInfoORMUpdateConfig) => Promise<boolean>;
74
79
  /**
75
80
  * Delete an item from the data store.
76
81
  * @param uniqueIdentifier Unique identifier value for the item.
@@ -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;
@@ -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
@@ -1,4 +1,4 @@
1
- import { ITEM_RELATIONSHIP_DAC_RESOURCE_NAME, ComparisonOperators } from '../chunk-7AMEFPPP.js';
1
+ import { TypeInfoORMUpdateOperators, ITEM_RELATIONSHIP_DAC_RESOURCE_NAME, ComparisonOperators } from '../chunk-RUNXRISF.js';
2
2
  import { getNoErrorDescriptor, getErrorDescriptor, ERROR_MESSAGE_CONSTANTS, validateTypeOperationAllowed, getValidityValue, validateTypeInfoValue, validateTypeInfoFieldValue } from '../chunk-YCTVEW2I.js';
3
3
  import { mergeStringPaths, getPathString, getPathArray } from '../chunk-WNFRDIBW.js';
4
4
  import '../chunk-I2KLQ2HA.js';
@@ -4540,6 +4540,7 @@ var DATA_ITEM_DB_DRIVER_ERRORS = /* @__PURE__ */ ((DATA_ITEM_DB_DRIVER_ERRORS2)
4540
4540
  DATA_ITEM_DB_DRIVER_ERRORS2["ITEM_NOT_FOUND"] = "ITEM_NOT_FOUND";
4541
4541
  DATA_ITEM_DB_DRIVER_ERRORS2["MISSING_UNIQUE_IDENTIFIER"] = "MISSING_UNIQUE_IDENTIFIER";
4542
4542
  DATA_ITEM_DB_DRIVER_ERRORS2["SEARCH_COMPARISON_OPERATOR_NOT_SUPPORTED"] = "SEARCH_COMPARISON_OPERATOR_NOT_SUPPORTED";
4543
+ DATA_ITEM_DB_DRIVER_ERRORS2["UPDATE_OPERATOR_NOT_SUPPORTED"] = "UPDATE_OPERATOR_NOT_SUPPORTED";
4543
4544
  return DATA_ITEM_DB_DRIVER_ERRORS2;
4544
4545
  })(DATA_ITEM_DB_DRIVER_ERRORS || {});
4545
4546
 
@@ -5778,8 +5779,9 @@ var createFilterExpression = (fieldCriteria, logicalOperator) => {
5778
5779
  }
5779
5780
  return output;
5780
5781
  };
5781
- var buildUpdateExpression = (updatedItem, uniquelyIdentifyingFieldName) => {
5782
- const updateExpressionParts = [];
5782
+ var buildUpdateExpression = (updatedItem, uniquelyIdentifyingFieldName, updateConfig) => {
5783
+ const setExpressionParts = [];
5784
+ const addExpressionParts = [];
5783
5785
  const attributeNames = {};
5784
5786
  const attributeValues = {};
5785
5787
  for (const f in updatedItem) {
@@ -5787,13 +5789,35 @@ var buildUpdateExpression = (updatedItem, uniquelyIdentifyingFieldName) => {
5787
5789
  if (f !== uniquelyIdentifyingFieldName && typeof value !== "undefined") {
5788
5790
  const placeholderName = `#${f}`;
5789
5791
  const placeholderValue = `:${f}`;
5790
- updateExpressionParts.push(`${placeholderName} = ${placeholderValue}`);
5792
+ const operator = updateConfig?.fieldOperators?.[f];
5791
5793
  attributeNames[placeholderName] = f;
5792
5794
  attributeValues[placeholderValue] = marshall(value);
5795
+ if (operator === TypeInfoORMUpdateOperators.NUMBER.INCREMENT) {
5796
+ addExpressionParts.push(`${placeholderName} ${placeholderValue}`);
5797
+ continue;
5798
+ }
5799
+ if (operator === TypeInfoORMUpdateOperators.NUMBER.DECREMENT) {
5800
+ const decrementPlaceholderValue = `:${f}_decrement`;
5801
+ addExpressionParts.push(
5802
+ `${placeholderName} ${decrementPlaceholderValue}`
5803
+ );
5804
+ attributeValues[decrementPlaceholderValue] = marshall(
5805
+ -value
5806
+ );
5807
+ continue;
5808
+ }
5809
+ setExpressionParts.push(`${placeholderName} = ${placeholderValue}`);
5793
5810
  }
5794
5811
  }
5812
+ const expressionParts = [];
5813
+ if (setExpressionParts.length > 0) {
5814
+ expressionParts.push(`SET ${setExpressionParts.join(", ")}`);
5815
+ }
5816
+ if (addExpressionParts.length > 0) {
5817
+ expressionParts.push(`ADD ${addExpressionParts.join(", ")}`);
5818
+ }
5795
5819
  return {
5796
- UpdateExpression: `SET ${updateExpressionParts.join(", ")}`,
5820
+ UpdateExpression: expressionParts.join(" "),
5797
5821
  ExpressionAttributeNames: attributeNames,
5798
5822
  ExpressionAttributeValues: attributeValues
5799
5823
  };
@@ -5872,7 +5896,7 @@ var DynamoDBDataItemDBDriver = class {
5872
5896
  * Update an item in the database.
5873
5897
  * @returns True when an item was updated.
5874
5898
  */
5875
- updateItem = async (uniqueIdentifier, updatedItem) => {
5899
+ updateItem = async (uniqueIdentifier, updatedItem, updateConfig) => {
5876
5900
  const { tableName, uniquelyIdentifyingFieldName } = this.config;
5877
5901
  const {
5878
5902
  [uniquelyIdentifyingFieldName]: _unusedUniqueIdentifier,
@@ -5887,7 +5911,8 @@ var DynamoDBDataItemDBDriver = class {
5887
5911
  ReturnValues: "ALL_NEW",
5888
5912
  ...buildUpdateExpression(
5889
5913
  cleanUpdatedItem,
5890
- uniquelyIdentifyingFieldName
5914
+ uniquelyIdentifyingFieldName,
5915
+ updateConfig
5891
5916
  )
5892
5917
  });
5893
5918
  const { Attributes } = await this.dynamoDBClient.send(command);
@@ -6092,7 +6117,7 @@ var InMemoryDataItemDBDriver = class {
6092
6117
  * @param updatedItem Partial update payload for the item.
6093
6118
  * @returns True when the item was updated.
6094
6119
  */
6095
- updateItem = async (uniqueIdentifier, updatedItem) => {
6120
+ updateItem = async (uniqueIdentifier, updatedItem, updateConfig) => {
6096
6121
  const { uniquelyIdentifyingFieldName } = this.config;
6097
6122
  if (typeof uniqueIdentifier === "undefined") {
6098
6123
  throw {
@@ -6110,6 +6135,17 @@ var InMemoryDataItemDBDriver = class {
6110
6135
  };
6111
6136
  for (const [key, value] of Object.entries(cleanUpdatedItem)) {
6112
6137
  if (typeof value !== "undefined") {
6138
+ const operator = updateConfig?.fieldOperators?.[key];
6139
+ if (operator === TypeInfoORMUpdateOperators.NUMBER.INCREMENT) {
6140
+ const currentValue = nextItem[key];
6141
+ nextItem[key] = (typeof currentValue === "number" ? currentValue : 0) + value;
6142
+ continue;
6143
+ }
6144
+ if (operator === TypeInfoORMUpdateOperators.NUMBER.DECREMENT) {
6145
+ const currentValue = nextItem[key];
6146
+ nextItem[key] = (typeof currentValue === "number" ? currentValue : 0) - value;
6147
+ continue;
6148
+ }
6113
6149
  nextItem[key] = value;
6114
6150
  }
6115
6151
  }
@@ -7528,8 +7564,24 @@ var TypeInfoORMService = class {
7528
7564
  * @returns Resolved full-text index field names.
7529
7565
  */
7530
7566
  resolveFullTextIndexFields = (typeName, override) => {
7531
- if (override) {
7532
- return [override];
7567
+ if (typeof override === "string") {
7568
+ return this.resolveFullTextIndexFields(typeName, [override]);
7569
+ }
7570
+ if (Array.isArray(override)) {
7571
+ const seen2 = /* @__PURE__ */ new Set();
7572
+ const fields2 = [];
7573
+ for (const field of override) {
7574
+ if (typeof field !== "string") {
7575
+ continue;
7576
+ }
7577
+ const trimmed = field.trim();
7578
+ if (!trimmed || seen2.has(trimmed)) {
7579
+ continue;
7580
+ }
7581
+ seen2.add(trimmed);
7582
+ fields2.push(trimmed);
7583
+ }
7584
+ return fields2;
7533
7585
  }
7534
7586
  const defaults = this.config.indexing?.fullText?.defaultIndexFieldByType?.[typeName];
7535
7587
  if (typeof defaults === "string") {
@@ -7833,6 +7885,10 @@ var TypeInfoORMService = class {
7833
7885
  }
7834
7886
  return fields;
7835
7887
  };
7888
+ /**
7889
+ * @returns Item snapshot normalized for indexing operations.
7890
+ */
7891
+ getIndexedItemSnapshot = (typeName, item) => this.getCleanItem(typeName, item, {});
7836
7892
  /**
7837
7893
  * @returns Mapped structured query.
7838
7894
  */
@@ -7952,6 +8008,132 @@ var TypeInfoORMService = class {
7952
8008
  });
7953
8009
  }
7954
8010
  }
8011
+ /**
8012
+ * Write the provided item snapshot into the configured indexes.
8013
+ *
8014
+ * Use this when data was created or modified outside `TypeInfoORMService`.
8015
+ *
8016
+ * @param typeName Type name for the indexed item.
8017
+ * @param item Item snapshot to index.
8018
+ * @param config Optional full-text field overrides.
8019
+ * @returns Promise resolved when manual indexing completes.
8020
+ */
8021
+ indexItemIndexes = async (typeName, item, config = {}) => {
8022
+ const indexedItem = this.getIndexedItemSnapshot(typeName, item);
8023
+ await this.indexFullTextDocument(
8024
+ typeName,
8025
+ indexedItem,
8026
+ config.fullTextIndexFields
8027
+ );
8028
+ await this.indexStructuredDocument(typeName, indexedItem);
8029
+ };
8030
+ /**
8031
+ * Remove the provided item snapshot from the configured indexes.
8032
+ *
8033
+ * Use this when data was deleted outside `TypeInfoORMService`.
8034
+ *
8035
+ * @param typeName Type name for the indexed item.
8036
+ * @param item Item snapshot to remove from the indexes.
8037
+ * @param config Optional full-text field overrides.
8038
+ * @returns Promise resolved when index cleanup completes.
8039
+ */
8040
+ removeItemIndexes = async (typeName, item, config = {}) => {
8041
+ const indexedItem = this.getIndexedItemSnapshot(typeName, item);
8042
+ await this.removeFullTextDocument(
8043
+ typeName,
8044
+ indexedItem,
8045
+ config.fullTextIndexFields
8046
+ );
8047
+ await this.removeStructuredDocument(typeName, indexedItem);
8048
+ };
8049
+ /**
8050
+ * Replace one indexed item snapshot with another.
8051
+ *
8052
+ * Use this when an existing stored item changed outside `TypeInfoORMService`
8053
+ * or when a schema/config change requires removing old full-text fields and
8054
+ * indexing a new field set.
8055
+ *
8056
+ * @param typeName Type name for the indexed item.
8057
+ * @param previousItem Previous item snapshot to remove.
8058
+ * @param nextItem Next item snapshot to index.
8059
+ * @param config Optional previous/next full-text field overrides.
8060
+ * @returns Promise resolved when replacement indexing completes.
8061
+ */
8062
+ replaceItemIndexes = async (typeName, previousItem, nextItem, config = {}) => {
8063
+ const previousIndexedItem = this.getIndexedItemSnapshot(typeName, previousItem);
8064
+ const nextIndexedItem = this.getIndexedItemSnapshot(typeName, nextItem);
8065
+ await this.removeFullTextDocument(
8066
+ typeName,
8067
+ previousIndexedItem,
8068
+ config.previousFullTextIndexFields
8069
+ );
8070
+ await this.indexFullTextDocument(
8071
+ typeName,
8072
+ nextIndexedItem,
8073
+ config.nextFullTextIndexFields
8074
+ );
8075
+ await this.indexStructuredDocument(typeName, nextIndexedItem);
8076
+ };
8077
+ /**
8078
+ * Reindex the current stored item using the configured driver.
8079
+ *
8080
+ * When no previous snapshot is supplied, the current stored item is used for
8081
+ * both removal and indexing to refresh existing postings without duplication.
8082
+ * Supply `previousItem` when an out-of-band update changed indexed field
8083
+ * values, otherwise old full-text tokens cannot be removed safely.
8084
+ *
8085
+ * @param typeName Type name to reindex.
8086
+ * @param primaryFieldValue Primary field value for the stored item.
8087
+ * @param config Optional previous snapshot and full-text field overrides.
8088
+ * @returns True when reindexing completed.
8089
+ */
8090
+ reindexStoredItem = async (typeName, primaryFieldValue, config = {}) => {
8091
+ const driver = this.getDriverInternal(typeName);
8092
+ const currentItem = await driver.readItem(primaryFieldValue);
8093
+ const previousItem = config.previousItem ?? currentItem;
8094
+ await this.replaceItemIndexes(typeName, previousItem, currentItem, {
8095
+ previousFullTextIndexFields: config.previousFullTextIndexFields,
8096
+ nextFullTextIndexFields: config.nextFullTextIndexFields
8097
+ });
8098
+ return true;
8099
+ };
8100
+ /**
8101
+ * Reindex all currently stored items for a type.
8102
+ *
8103
+ * This is intended for maintenance passes after out-of-band writes or
8104
+ * schema/index configuration changes. Deleted items still require explicit
8105
+ * cleanup via {@link removeItemIndexes}, because full-text token removal
8106
+ * needs a prior snapshot of indexed field values. For out-of-band updates
8107
+ * that changed indexed values, provide `previousItemsByPrimaryField`.
8108
+ *
8109
+ * @param typeName Type name to reindex.
8110
+ * @param config Paging, previous snapshots, and full-text field overrides.
8111
+ * @returns Count of processed stored items.
8112
+ */
8113
+ reindexStoredType = async (typeName, config = {}) => {
8114
+ const driver = this.getDriverInternal(typeName);
8115
+ const primaryFieldName = String(this.getTypeInfo(typeName).primaryField);
8116
+ const itemsPerPage = config.itemsPerPage ?? 100;
8117
+ let processedCount = 0;
8118
+ let cursor;
8119
+ do {
8120
+ const page = await driver.listItems({ itemsPerPage, cursor });
8121
+ for (const item of page.items) {
8122
+ const primaryFieldValue = item[primaryFieldName];
8123
+ if (typeof primaryFieldValue === "undefined") {
8124
+ continue;
8125
+ }
8126
+ const previousItem = config.previousItemsByPrimaryField?.[String(primaryFieldValue)] ?? item;
8127
+ await this.replaceItemIndexes(typeName, previousItem, item, {
8128
+ previousFullTextIndexFields: config.previousFullTextIndexFields,
8129
+ nextFullTextIndexFields: config.nextFullTextIndexFields
8130
+ });
8131
+ processedCount += 1;
8132
+ }
8133
+ cursor = page.cursor;
8134
+ } while (cursor);
8135
+ return { processedCount };
8136
+ };
7955
8137
  /**
7956
8138
  * @returns Promise resolved once indexing is complete.
7957
8139
  */
@@ -8063,6 +8245,40 @@ var TypeInfoORMService = class {
8063
8245
  throw validationResults;
8064
8246
  }
8065
8247
  };
8248
+ /**
8249
+ * Validate update operator config against the target TypeInfo fields.
8250
+ */
8251
+ validateUpdateConfig = (typeName, item, updateConfig) => {
8252
+ const fieldOperators = updateConfig?.fieldOperators;
8253
+ if (!fieldOperators) {
8254
+ return;
8255
+ }
8256
+ const { fields = {}, primaryField } = this.getTypeInfo(typeName);
8257
+ for (const [fieldName, operator] of Object.entries(fieldOperators)) {
8258
+ const field = fields[fieldName];
8259
+ const itemValue = item[fieldName];
8260
+ const isNumberOperator = Object.values(
8261
+ TypeInfoORMUpdateOperators.NUMBER
8262
+ ).includes(
8263
+ operator
8264
+ );
8265
+ if (!field || fieldName === primaryField || !isNumberOperator || field.array || field.type !== "number" || typeof itemValue !== "number") {
8266
+ const validationResults = {
8267
+ typeName,
8268
+ valid: false,
8269
+ error: getErrorDescriptor(
8270
+ "INVALID_UPDATE_OPERATOR" /* INVALID_UPDATE_OPERATOR */
8271
+ ),
8272
+ errorMap: {
8273
+ [fieldName]: [
8274
+ getErrorDescriptor("INVALID_UPDATE_OPERATOR" /* INVALID_UPDATE_OPERATOR */)
8275
+ ]
8276
+ }
8277
+ };
8278
+ throw validationResults;
8279
+ }
8280
+ }
8281
+ };
8066
8282
  /**
8067
8283
  * @returns Cleaned item with selected fields and DAC constraints applied.
8068
8284
  */
@@ -8475,8 +8691,7 @@ var TypeInfoORMService = class {
8475
8691
  ...cleanItem,
8476
8692
  [primaryField]: newIdentifier
8477
8693
  };
8478
- await this.indexFullTextDocument(typeName, indexedItem);
8479
- await this.indexStructuredDocument(typeName, indexedItem);
8694
+ await this.indexItemIndexes(typeName, indexedItem);
8480
8695
  return newIdentifier;
8481
8696
  };
8482
8697
  /**
@@ -8537,10 +8752,12 @@ var TypeInfoORMService = class {
8537
8752
  * The `item` **must always** contain its **primary field value**.
8538
8753
  * @param typeName Type name to update.
8539
8754
  * @param item Item payload to update.
8755
+ * @param updateConfig Optional per-field operator config.
8540
8756
  * @returns True when the update succeeded.
8541
8757
  * */
8542
- update = async (typeName, item, context) => {
8758
+ update = async (typeName, item, updateConfig, context) => {
8543
8759
  this.validate(typeName, item, "UPDATE" /* UPDATE */, true);
8760
+ this.validateUpdateConfig(typeName, item, updateConfig);
8544
8761
  const { primaryField } = this.getTypeInfo(typeName);
8545
8762
  const primaryFieldValue = typeof item === "object" && item !== null ? item[primaryField] : void 0;
8546
8763
  if (typeof primaryFieldValue === "undefined") {
@@ -8616,15 +8833,17 @@ var TypeInfoORMService = class {
8616
8833
  throw error;
8617
8834
  }
8618
8835
  }
8619
- const result = await driver.updateItem(primaryFieldValue, cleanItem);
8836
+ const result = await driver.updateItem(
8837
+ primaryFieldValue,
8838
+ cleanItem,
8839
+ updateConfig
8840
+ );
8620
8841
  const updatedItem = await driver.readItem(primaryFieldValue);
8621
8842
  if (existingItem) {
8622
- await this.removeFullTextDocument(typeName, existingItem);
8623
- await this.indexFullTextDocument(typeName, updatedItem);
8843
+ await this.replaceItemIndexes(typeName, existingItem, updatedItem);
8624
8844
  } else {
8625
- await this.indexFullTextDocument(typeName, updatedItem);
8845
+ await this.indexItemIndexes(typeName, updatedItem);
8626
8846
  }
8627
- await this.indexStructuredDocument(typeName, updatedItem);
8628
8847
  return result;
8629
8848
  }
8630
8849
  }
@@ -8661,8 +8880,7 @@ var TypeInfoORMService = class {
8661
8880
  fromTypeName: typeName,
8662
8881
  fromTypePrimaryFieldValue: primaryFieldValue
8663
8882
  });
8664
- await this.removeFullTextDocument(typeName, existingItem);
8665
- await this.removeStructuredDocument(typeName, existingItem);
8883
+ await this.removeItemIndexes(typeName, existingItem);
8666
8884
  return result;
8667
8885
  }
8668
8886
  };
@@ -8897,6 +9115,100 @@ var TypeInfoORMService = class {
8897
9115
  };
8898
9116
  };
8899
9117
 
9118
+ // src/api/ORM/getTypeInfoORMIndexingConfigFromTypeInfoMap.ts
9119
+ var dedupeFieldNames = (fieldNames) => {
9120
+ const seen = /* @__PURE__ */ new Set();
9121
+ const deduped = [];
9122
+ for (const fieldName of fieldNames) {
9123
+ if (typeof fieldName !== "string") {
9124
+ continue;
9125
+ }
9126
+ const trimmed = fieldName.trim();
9127
+ if (!trimmed || seen.has(trimmed)) {
9128
+ continue;
9129
+ }
9130
+ seen.add(trimmed);
9131
+ deduped.push(trimmed);
9132
+ }
9133
+ return deduped;
9134
+ };
9135
+ var normalizeFieldMap = (fieldMap) => {
9136
+ const normalized = {};
9137
+ if (!fieldMap) {
9138
+ return normalized;
9139
+ }
9140
+ for (const [typeName, configuredFieldNames] of Object.entries(fieldMap)) {
9141
+ const values = Array.isArray(configuredFieldNames) ? configuredFieldNames : [configuredFieldNames];
9142
+ const deduped = dedupeFieldNames(values);
9143
+ if (deduped.length > 0) {
9144
+ normalized[typeName] = deduped;
9145
+ }
9146
+ }
9147
+ return normalized;
9148
+ };
9149
+ var mergeFieldMaps = (existing, generated) => {
9150
+ const merged = { ...existing };
9151
+ for (const [typeName, generatedFieldNames] of Object.entries(generated)) {
9152
+ merged[typeName] = dedupeFieldNames([
9153
+ ...existing[typeName] ?? [],
9154
+ ...generatedFieldNames
9155
+ ]);
9156
+ }
9157
+ return merged;
9158
+ };
9159
+ var hasIndexedFields = (fieldMap) => Object.keys(fieldMap).length > 0;
9160
+ var getTypeInfoORMIndexingConfigFromTypeInfoMap = (typeInfoMap, baseConfig = {}) => {
9161
+ const generatedFullText = {};
9162
+ const generatedStructured = {};
9163
+ for (const [typeName, typeInfo] of Object.entries(typeInfoMap)) {
9164
+ const fields = typeInfo.fields ?? {};
9165
+ for (const [fieldName, field] of Object.entries(fields)) {
9166
+ const indexed = field.tags?.indexed;
9167
+ if (indexed?.fullText) {
9168
+ generatedFullText[typeName] = [
9169
+ ...generatedFullText[typeName] ?? [],
9170
+ fieldName
9171
+ ];
9172
+ }
9173
+ if (indexed?.structured) {
9174
+ generatedStructured[typeName] = [
9175
+ ...generatedStructured[typeName] ?? [],
9176
+ fieldName
9177
+ ];
9178
+ }
9179
+ }
9180
+ }
9181
+ if (hasIndexedFields(generatedFullText) && !baseConfig.fullText?.backend) {
9182
+ throw new Error(
9183
+ "Cannot generate fullText indexing config from tags without fullText.backend."
9184
+ );
9185
+ }
9186
+ if (hasIndexedFields(generatedStructured) && !baseConfig.structured?.reader) {
9187
+ throw new Error(
9188
+ "Cannot generate structured indexing config from tags without structured.reader."
9189
+ );
9190
+ }
9191
+ const mergedFullTextByType = mergeFieldMaps(
9192
+ normalizeFieldMap(baseConfig.fullText?.defaultIndexFieldByType),
9193
+ generatedFullText
9194
+ );
9195
+ const mergedStructuredByType = mergeFieldMaps(
9196
+ normalizeFieldMap(baseConfig.structured?.indexedFieldsByType),
9197
+ generatedStructured
9198
+ );
9199
+ return {
9200
+ ...baseConfig,
9201
+ fullText: baseConfig.fullText ? {
9202
+ ...baseConfig.fullText,
9203
+ ...hasIndexedFields(mergedFullTextByType) ? { defaultIndexFieldByType: mergedFullTextByType } : {}
9204
+ } : void 0,
9205
+ structured: baseConfig.structured ? {
9206
+ ...baseConfig.structured,
9207
+ ...hasIndexedFields(mergedStructuredByType) ? { indexedFieldsByType: mergedStructuredByType } : {}
9208
+ } : void 0
9209
+ };
9210
+ };
9211
+
8900
9212
  // src/api/Router/Auth.ts
8901
9213
  var getRouteIsAuthorized = (authInfo, authConfig) => {
8902
9214
  const { userId, roles = [] } = authInfo;
@@ -9175,7 +9487,7 @@ var TYPE_INFO_ORM_API_PATH_METHOD_NAME_MAP = {
9175
9487
  delete: "delete",
9176
9488
  list: "list"
9177
9489
  };
9178
- var getTypeInfoORMRouteMap = (config, dacConfig, getAccessingRoleId, authConfig) => {
9490
+ var getTypeInfoORMRouteMap = (config, dacConfig, getAccessingRoleId, authConfig, routeMapConfig) => {
9179
9491
  if (dacConfig && !getAccessingRoleId) {
9180
9492
  throw {
9181
9493
  message: "MISSING_ACCESSING_ROLE_GETTER" /* MISSING_ACCESSING_ROLE_GETTER */
@@ -9194,6 +9506,7 @@ var getTypeInfoORMRouteMap = (config, dacConfig, getAccessingRoleId, authConfig)
9194
9506
  const defaultAuthConfig = authConfig ?? {
9195
9507
  anyAuthorized: true
9196
9508
  };
9509
+ const allowUpdateFieldOperators = routeMapConfig?.allowUpdateFieldOperators ?? true;
9197
9510
  const resolveContext = (eventData) => getContextFromEventData(eventData, dacConfig, getAccessingRoleId);
9198
9511
  const createRoute = (path, handlerFactory) => ({
9199
9512
  path,
@@ -9214,10 +9527,18 @@ var getTypeInfoORMRouteMap = (config, dacConfig, getAccessingRoleId, authConfig)
9214
9527
  };
9215
9528
  const updateHandlerFactory = (eventData) => {
9216
9529
  if (!dacConfig) {
9217
- return orm.update;
9530
+ if (allowUpdateFieldOperators) {
9531
+ return orm.update;
9532
+ }
9533
+ return ((typeName, item) => orm.update(typeName, item, void 0));
9218
9534
  }
9219
9535
  const context = resolveContext(eventData);
9220
- return ((typeName, item) => orm.update(typeName, item, context));
9536
+ return ((typeName, item, updateConfig) => orm.update(
9537
+ typeName,
9538
+ item,
9539
+ allowUpdateFieldOperators ? updateConfig : void 0,
9540
+ context
9541
+ ));
9221
9542
  };
9222
9543
  const deleteHandlerFactory = (eventData) => {
9223
9544
  if (!dacConfig) {
@@ -9302,4 +9623,4 @@ var getContextFromEventData = (eventData, dacConfig, getAccessingRoleId) => {
9302
9623
  return { accessingRoleId };
9303
9624
  };
9304
9625
 
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 };
9626
+ 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,7 +1,7 @@
1
1
  export { createEasyLayout, getEasyLayoutTemplateDetails, getPascalCaseAreaName } from '../chunk-CMH6L5QQ.js';
2
2
  export { computeTrackPixels } from '../chunk-TJFTWPXQ.js';
3
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
- import '../chunk-7AMEFPPP.js';
4
+ import '../chunk-RUNXRISF.js';
5
5
  import '../chunk-YCTVEW2I.js';
6
6
  import { mergeStringPaths, PATH_DELIMITER } from '../chunk-WNFRDIBW.js';
7
7
  import '../chunk-I2KLQ2HA.js';
@@ -473,12 +473,14 @@ var TypeInfoORMClient = class {
473
473
  *
474
474
  * @param typeName - TypeInfo type name.
475
475
  * @param item - Updated item payload.
476
+ * @param updateConfig - Optional per-field operator config.
476
477
  * @returns Whether the update succeeded.
477
478
  */
478
- update = async (typeName, item) => {
479
+ update = async (typeName, item, updateConfig) => {
479
480
  return await this.makeRequest("update" /* UPDATE */, [
480
481
  typeName,
481
- item
482
+ item,
483
+ updateConfig
482
484
  ]);
483
485
  };
484
486
  /**
@@ -4,7 +4,7 @@
4
4
  * Client wrapper around the TypeInfoORM API RouteMap. Uses ServiceConfig to
5
5
  * route requests to the server-side TypeInfoORM routes.
6
6
  */
7
- import { DeleteRelationshipResults, TypeInfoORMClientAPI, TypeInfoORMAPIRoutePaths } from "../../common/TypeInfoORM";
7
+ import { DeleteRelationshipResults, TypeInfoORMClientAPI, TypeInfoORMAPIRoutePaths, TypeInfoORMUpdateConfig } from "../../common/TypeInfoORM";
8
8
  import { ServiceConfig } from "./Service";
9
9
  import { TypeInfoDataItem } from "../../common/TypeParsing/TypeInfo";
10
10
  import { ListItemsConfig, ListItemsResults, ListRelationshipsConfig } from "../../common/SearchTypes";
@@ -51,9 +51,10 @@ export declare class TypeInfoORMClient implements TypeInfoORMClientAPI {
51
51
  *
52
52
  * @param typeName - TypeInfo type name.
53
53
  * @param item - Updated item payload.
54
+ * @param updateConfig - Optional per-field operator config.
54
55
  * @returns Whether the update succeeded.
55
56
  */
56
- update: (typeName: string, item: TypeInfoDataItem) => Promise<boolean>;
57
+ update: (typeName: string, item: TypeInfoDataItem, updateConfig?: TypeInfoORMUpdateConfig) => Promise<boolean>;
57
58
  /**
58
59
  * Delete an item by its primary field value.
59
60
  *
@@ -54,6 +54,7 @@ var TypeInfoORMServiceError = /* @__PURE__ */ ((TypeInfoORMServiceError2) => {
54
54
  TypeInfoORMServiceError2["TYPE_INFO_MISSING_PRIMARY_FIELD"] = "TYPE_INFO_MISSING_PRIMARY_FIELD";
55
55
  TypeInfoORMServiceError2["INVALID_RELATIONSHIP"] = "INVALID_RELATIONSHIP";
56
56
  TypeInfoORMServiceError2["INVALID_OPERATION"] = "INVALID_OPERATION";
57
+ TypeInfoORMServiceError2["INVALID_UPDATE_OPERATOR"] = "INVALID_UPDATE_OPERATOR";
57
58
  TypeInfoORMServiceError2["MISSING_ACCESSING_ROLE"] = "MISSING_ACCESSING_ROLE";
58
59
  TypeInfoORMServiceError2["INDEXING_UNSUPPORTED_CRITERIA"] = "INDEXING_UNSUPPORTED_CRITERIA";
59
60
  TypeInfoORMServiceError2["INDEXING_UNSUPPORTED_COMBINATION"] = "INDEXING_UNSUPPORTED_COMBINATION";
@@ -74,5 +75,11 @@ var TypeInfoORMAPIRoutePaths = /* @__PURE__ */ ((TypeInfoORMAPIRoutePaths2) => {
74
75
  TypeInfoORMAPIRoutePaths2["LIST_RELATED_ITEMS"] = "list-related-items";
75
76
  return TypeInfoORMAPIRoutePaths2;
76
77
  })(TypeInfoORMAPIRoutePaths || {});
78
+ var TypeInfoORMUpdateOperators = {
79
+ NUMBER: {
80
+ INCREMENT: "INCREMENT",
81
+ DECREMENT: "DECREMENT"
82
+ }
83
+ };
77
84
 
78
- export { ComparisonOperators, ITEM_RELATIONSHIP_DAC_RESOURCE_NAME, LogicalOperators, OperationGroup, RelationshipOperation, TypeInfoORMAPIRoutePaths, TypeInfoORMServiceError };
85
+ export { ComparisonOperators, ITEM_RELATIONSHIP_DAC_RESOURCE_NAME, LogicalOperators, OperationGroup, RelationshipOperation, TypeInfoORMAPIRoutePaths, TypeInfoORMServiceError, TypeInfoORMUpdateOperators };
@@ -91,6 +91,10 @@ export declare enum TypeInfoORMServiceError {
91
91
  * Operation is not supported.
92
92
  * */
93
93
  INVALID_OPERATION = "INVALID_OPERATION",
94
+ /**
95
+ * Update operator config is invalid.
96
+ * */
97
+ INVALID_UPDATE_OPERATOR = "INVALID_UPDATE_OPERATOR",
94
98
  /**
95
99
  * Accessing role is missing when DAC is required.
96
100
  * */
@@ -181,6 +185,32 @@ export type TypeInfoORMContext = {
181
185
  */
182
186
  accessingRoleId: string;
183
187
  };
188
+ /**
189
+ * Supported numeric field update operators.
190
+ */
191
+ export declare const TypeInfoORMUpdateOperators: {
192
+ readonly NUMBER: {
193
+ readonly INCREMENT: "INCREMENT";
194
+ readonly DECREMENT: "DECREMENT";
195
+ };
196
+ };
197
+ /**
198
+ * Supported numeric field update operator values.
199
+ */
200
+ export type TypeInfoORMNumberFieldUpdateOperator = (typeof TypeInfoORMUpdateOperators.NUMBER)[keyof typeof TypeInfoORMUpdateOperators.NUMBER];
201
+ /**
202
+ * Supported field update operator values.
203
+ */
204
+ export type TypeInfoORMFieldUpdateOperator = TypeInfoORMNumberFieldUpdateOperator;
205
+ /**
206
+ * Optional config for TypeInfo ORM update calls.
207
+ */
208
+ export type TypeInfoORMUpdateConfig = {
209
+ /**
210
+ * Optional per-field operator map applied during update.
211
+ */
212
+ fieldOperators?: Record<string, TypeInfoORMFieldUpdateOperator>;
213
+ };
184
214
  /**
185
215
  * Server-side TypeInfoORM API contract.
186
216
  *
@@ -239,9 +269,10 @@ export type TypeInfoORMAPI = {
239
269
  *
240
270
  * @param typeName - Type name to update.
241
271
  * @param item - Updated item payload.
272
+ * @param updateConfig - Optional per-field operator config.
242
273
  * @returns Whether the update succeeded.
243
274
  */
244
- update: (typeName: string, item: TypeInfoDataItem, context?: TypeInfoORMContext) => Promise<boolean>;
275
+ update: (typeName: string, item: TypeInfoDataItem, updateConfig?: TypeInfoORMUpdateConfig, context?: TypeInfoORMContext) => Promise<boolean>;
245
276
  /**
246
277
  * Delete an item by primary field value.
247
278
  *
@@ -319,9 +350,10 @@ export type TypeInfoORMClientAPI = {
319
350
  *
320
351
  * @param typeName - Type name to update.
321
352
  * @param item - Updated item payload.
353
+ * @param updateConfig - Optional per-field operator config.
322
354
  * @returns Whether the update succeeded.
323
355
  */
324
- update: (typeName: string, item: TypeInfoDataItem) => Promise<boolean>;
356
+ update: (typeName: string, item: TypeInfoDataItem, updateConfig?: TypeInfoORMUpdateConfig) => Promise<boolean>;
325
357
  /**
326
358
  * Delete an item by primary field value.
327
359
  *
@@ -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/common/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { ComparisonOperators, ITEM_RELATIONSHIP_DAC_RESOURCE_NAME, LogicalOperators, OperationGroup, RelationshipOperation, TypeInfoORMAPIRoutePaths, TypeInfoORMServiceError } from '../chunk-7AMEFPPP.js';
1
+ export { ComparisonOperators, ITEM_RELATIONSHIP_DAC_RESOURCE_NAME, LogicalOperators, OperationGroup, RelationshipOperation, TypeInfoORMAPIRoutePaths, TypeInfoORMServiceError, TypeInfoORMUpdateOperators } from '../chunk-RUNXRISF.js';
2
2
  export { DENIED_TYPE_OPERATIONS, ERROR_MESSAGE_CONSTANTS, INVALID_CUSTOM_TYPE, PRIMITIVE_ERROR_MESSAGE_CONSTANTS, RelationshipValidationType, TYPE_KEYWORD_ERROR_MESSAGE_CONSTANTS, TYPE_KEYWORD_VALIDATORS, TypeOperation, getArrayItemErrorMap, getErrorDescriptor, getErrorDescriptors, getNoErrorDescriptor, getValidityValue, hasValue, isArrayErrorDescriptorCollection, validateArrayOfTypeInfoFieldValues, validateCustomType, validateKeywordType, validateTypeInfoDataItem, validateTypeInfoFieldOperationAllowed, validateTypeInfoFieldValue, validateTypeInfoValue, validateTypeOperationAllowed, validateValueMatchesPattern } from '../chunk-YCTVEW2I.js';
3
3
  import '../chunk-WNFRDIBW.js';
4
4
  import '../chunk-I2KLQ2HA.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resistdesign/voltra",
3
- "version": "3.0.0-alpha.43",
3
+ "version": "3.0.0-alpha.45",
4
4
  "description": "With our powers combined!",
5
5
  "homepage": "https://voltra.app",
6
6
  "repository": "git@github.com:resistdesign/voltra.git",