@resistdesign/voltra 3.0.0-alpha.4 → 3.0.0-alpha.40
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/README.md +379 -14
- package/api/DBX/DBXAsserts.d.ts +95 -0
- package/api/DBX/DBXRequest.d.ts +5 -0
- package/api/DBX/DBXRuntime.d.ts +5 -0
- package/api/DBX/DBXScenarioConfig.d.ts +9 -0
- package/api/DBX/DBXSeed.d.ts +124 -0
- package/api/DBX/DBXTypes.d.ts +176 -0
- package/api/DBX/index.d.ts +8 -0
- package/api/DataAccessControl.d.ts +220 -0
- package/api/Indexing/API.d.ts +224 -0
- package/api/Indexing/Cursor.d.ts +101 -0
- package/api/Indexing/Handler/Config.d.ts +39 -0
- package/api/Indexing/Handler.d.ts +166 -0
- package/api/Indexing/Trace.d.ts +54 -0
- package/api/Indexing/Types.d.ts +204 -0
- package/api/Indexing/ddb/AwsSdkV3Adapter.d.ts +8 -0
- package/api/Indexing/ddb/Types.d.ts +209 -0
- package/api/Indexing/docId.d.ts +27 -0
- package/api/Indexing/exact/ExactDdb.d.ts +58 -0
- package/api/Indexing/exact/ExactIndex.d.ts +90 -0
- package/api/Indexing/exact/ExactS3.d.ts +41 -0
- package/api/Indexing/fieldQualification.d.ts +12 -0
- package/api/Indexing/fulltext/FullTextDdbBackend.d.ts +212 -0
- package/api/Indexing/fulltext/FullTextMemoryBackend.d.ts +93 -0
- package/api/Indexing/fulltext/Schema.d.ts +164 -0
- package/api/Indexing/hashUniversal.d.ts +13 -0
- package/api/Indexing/index.d.ts +45 -0
- package/api/Indexing/lossy/LossyDdb.d.ts +43 -0
- package/api/Indexing/lossy/LossyIndex.d.ts +72 -0
- package/api/Indexing/lossy/LossyS3.d.ts +40 -0
- package/api/Indexing/rel/Cursor.d.ts +25 -0
- package/api/Indexing/rel/Handlers.d.ts +144 -0
- package/api/Indexing/rel/RelationalDdb.d.ts +169 -0
- package/api/Indexing/rel/RelationalInMemoryBackend.d.ts +38 -0
- package/api/Indexing/rel/Types.d.ts +69 -0
- package/api/Indexing/structured/Cursor.d.ts +26 -0
- package/api/Indexing/structured/Handlers.d.ts +128 -0
- package/api/Indexing/structured/SearchStructured.d.ts +44 -0
- package/api/Indexing/structured/StructuredDdb.d.ts +184 -0
- package/api/Indexing/structured/StructuredDdbBackend.d.ts +112 -0
- package/api/Indexing/structured/StructuredInMemoryBackend.d.ts +40 -0
- package/api/Indexing/structured/StructuredInMemoryIndex.d.ts +61 -0
- package/api/Indexing/structured/StructuredStringLike.d.ts +54 -0
- package/api/Indexing/structured/StructuredWriter.d.ts +74 -0
- package/api/Indexing/structured/Types.d.ts +126 -0
- package/api/Indexing/structured/index.d.ts +9 -0
- package/api/Indexing/tokenize.d.ts +31 -0
- package/api/ORM/DACUtils.d.ts +270 -0
- package/api/ORM/ListItemUtils.d.ts +40 -0
- package/api/ORM/ORMRouteMap.d.ts +55 -0
- package/api/ORM/TypeInfoORMService.d.ts +740 -0
- package/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.d.ts +229 -0
- package/api/ORM/drivers/DynamoDBDataItemDBDriver.d.ts +89 -0
- package/api/ORM/drivers/InMemoryDataItemDBDriver/ConfigTypes.d.ts +4 -0
- package/api/ORM/drivers/InMemoryDataItemDBDriver.d.ts +55 -0
- package/api/ORM/drivers/InMemoryFileItemDBDriver/ConfigTypes.d.ts +13 -0
- package/api/ORM/drivers/InMemoryFileItemDBDriver.d.ts +98 -0
- package/api/ORM/drivers/InMemoryItemRelationshipDBDriver.d.ts +16 -0
- package/api/ORM/drivers/IndexingRelationshipDriver.d.ts +123 -0
- package/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.d.ts +322 -0
- package/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.d.ts +118 -0
- package/api/ORM/drivers/S3FileItemDBDriver.d.ts +71 -0
- package/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.d.ts +36 -0
- package/api/ORM/drivers/common/Types.d.ts +197 -0
- package/api/ORM/drivers/common/index.d.ts +2 -0
- package/api/ORM/drivers/index.d.ts +8 -0
- package/api/ORM/index.d.ts +9 -0
- package/api/ORM/indexing/criteriaToStructuredWhere.d.ts +22 -0
- package/api/Router/AWS.d.ts +80 -0
- package/api/Router/Auth.d.ts +14 -0
- package/api/Router/CORS.d.ts +66 -0
- package/api/Router/Types.d.ts +138 -0
- package/api/Router/index.d.ts +89 -0
- package/api/index.d.ts +72 -6
- package/api/index.js +3291 -1954
- package/app/forms/Engine.d.ts +23 -0
- package/app/forms/UI.d.ts +83 -0
- package/app/forms/core/createAutoField.d.ts +43 -0
- package/app/forms/core/createFormRenderer.d.ts +25 -0
- package/app/forms/core/getFieldKind.d.ts +14 -0
- package/app/forms/core/index.d.ts +11 -0
- package/app/forms/core/mergeSuites.d.ts +23 -0
- package/app/forms/core/resolveSuite.d.ts +15 -0
- package/app/forms/core/types.d.ts +180 -0
- package/app/forms/index.d.ts +9 -0
- package/app/forms/types.d.ts +137 -0
- package/app/helpers/styled.d.ts +3 -0
- package/app/index.d.ts +102 -5
- package/app/index.js +98 -327
- package/app/utils/ApplicationState.d.ts +167 -0
- package/app/utils/ApplicationStateLoader.d.ts +86 -0
- package/app/utils/Controller.d.ts +10 -0
- package/app/utils/Debug.d.ts +14 -0
- package/app/utils/EasyLayout.d.ts +89 -0
- package/app/utils/History.d.ts +165 -0
- package/app/utils/Route.d.ts +173 -0
- package/app/utils/RouteHistory.d.ts +27 -0
- package/app/utils/Service.d.ts +45 -0
- package/app/utils/TypeInfoORMAPIUtils.d.ts +94 -0
- package/app/utils/TypeInfoORMClient.d.ts +103 -0
- package/app/utils/UniversalRouteAdapter.d.ts +73 -0
- package/app/utils/easy-layout/computeAreaBounds.d.ts +5 -0
- package/app/utils/easy-layout/computeTracks.d.ts +16 -0
- package/app/utils/easy-layout/index.d.ts +5 -0
- package/app/utils/easy-layout/parseTemplate.d.ts +12 -0
- package/app/utils/easy-layout/types.d.ts +52 -0
- package/app/utils/easy-layout/validateAreas.d.ts +5 -0
- package/app/utils/index.d.ts +24 -0
- package/build/TypeMapping.d.ts +17 -0
- package/build/TypeParsing.d.ts +10 -0
- package/build/index.d.ts +15 -0
- package/build/index.js +569 -0
- package/chunk-2MOLWZMQ.js +71 -0
- package/chunk-7AMEFPPP.js +78 -0
- package/chunk-ATO2455Q.js +258 -0
- package/chunk-DT6WWJUI.js +1185 -0
- package/chunk-I2KLQ2HA.js +19 -0
- package/chunk-TJFTWPXQ.js +39 -0
- package/chunk-WNFRDIBW.js +121 -0
- package/chunk-YCTVEW2I.js +546 -0
- package/common/CommandLine/collectRequiredEnvironmentVariables.d.ts +9 -0
- package/common/CommandLine/index.d.ts +6 -0
- package/common/HelperTypes.d.ts +9 -0
- package/common/IdGeneration/getSimpleId.d.ts +8 -0
- package/common/IdGeneration/index.d.ts +1 -0
- package/common/ItemRelationshipInfoTypes.d.ts +64 -0
- package/common/ItemRelationships/ItemRelationshipValidation.d.ts +21 -0
- package/common/ItemRelationships/index.d.ts +2 -0
- package/common/Logging/Utils.d.ts +10 -0
- package/common/Logging/index.d.ts +1 -0
- package/common/Routing.d.ts +81 -0
- package/common/SearchTypes.d.ts +227 -0
- package/common/SearchUtils.d.ts +55 -0
- package/common/SearchValidation.d.ts +27 -0
- package/common/StringTransformers.d.ts +28 -0
- package/common/Testing/CLI.d.ts +6 -0
- package/common/Testing/Types.d.ts +216 -0
- package/common/Testing/Utils.d.ts +112 -0
- package/common/Testing/index.d.ts +8 -0
- package/common/TypeInfoDataItemUtils.d.ts +39 -0
- package/{Types-C7XjUjoF.d.ts → common/TypeInfoORM/Types.d.ts} +117 -15
- package/common/TypeInfoORM/index.d.ts +3 -0
- package/common/TypeParsing/Constants.d.ts +4 -0
- package/common/TypeParsing/ParsingUtils/Constants.d.ts +8 -0
- package/common/TypeParsing/ParsingUtils/checkType.d.ts +14 -0
- package/common/TypeParsing/ParsingUtils/checkUnionType.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/extractCommentTags.d.ts +8 -0
- package/common/TypeParsing/ParsingUtils/extractLiteralValues.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/extractTypeDetails.d.ts +14 -0
- package/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.d.ts +18 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfo.d.ts +9 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoField.d.ts +9 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getTypeKeyword.d.ts +9 -0
- package/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.d.ts +8 -0
- package/common/TypeParsing/TypeInfo.d.ts +222 -0
- package/common/TypeParsing/Utils.d.ts +47 -0
- package/common/TypeParsing/Validation.d.ts +327 -0
- package/common/TypeParsing/index.d.ts +8 -0
- package/common/index.d.ts +40 -4
- package/common/index.js +25 -1737
- package/{index-BkFZlfit.d.ts → iac/SimpleCFT.d.ts} +5 -25
- package/iac/index.d.ts +40 -2
- package/iac/index.js +2 -1661
- package/iac/packs/auth.d.ts +131 -0
- package/iac/packs/build/utils.d.ts +289 -0
- package/iac/packs/build.d.ts +92 -0
- package/iac/packs/cdn.d.ts +33 -0
- package/iac/packs/cloud-function.d.ts +67 -0
- package/iac/packs/database.d.ts +32 -0
- package/iac/packs/dns.d.ts +34 -0
- package/iac/packs/file-storage.d.ts +46 -0
- package/iac/packs/gateway.d.ts +82 -0
- package/iac/packs/index.d.ts +60 -1
- package/iac/packs/index.js +311 -566
- package/iac/packs/repo.d.ts +28 -0
- package/iac/packs/ssl-certificate.d.ts +28 -0
- package/iac/types/Constants.d.ts +24 -0
- package/{index-DcvJOZ_c.d.ts → iac/types/IaCTypes.d.ts} +23 -1018
- package/iac/types/Renderers.d.ts +96 -0
- package/iac/types/Types.d.ts +131 -0
- package/iac/types/Utils.d.ts +9 -0
- package/iac/types/generate.d.ts +1 -0
- package/iac/utils/index.d.ts +87 -0
- package/iac/utils/patch-utils.d.ts +66 -0
- package/iac-packs/index.d.ts +6 -0
- package/native/forms/UI.d.ts +73 -0
- package/native/forms/createNativeFormRenderer.d.ts +21 -0
- package/native/forms/index.d.ts +25 -0
- package/native/forms/primitives/index.d.ts +38 -0
- package/native/forms/suite.d.ts +15 -0
- package/native/index.d.ts +19 -0
- package/native/index.js +748 -0
- package/native/testing/react-native.d.ts +46 -0
- package/native/utils/EasyLayout.d.ts +88 -0
- package/native/utils/History.d.ts +102 -0
- package/native/utils/Route.d.ts +80 -0
- package/native/utils/index.d.ts +20 -0
- package/package.json +54 -21
- package/web/forms/UI.d.ts +74 -0
- package/web/forms/createWebFormRenderer.d.ts +21 -0
- package/web/forms/index.d.ts +9 -0
- package/web/forms/primitives/index.d.ts +21 -0
- package/web/forms/suite.d.ts +15 -0
- package/web/index.d.ts +15 -0
- package/web/index.js +668 -0
- package/web/utils/EasyLayout.d.ts +47 -0
- package/web/utils/Route.d.ts +16 -0
- package/web/utils/index.d.ts +7 -0
- package/SearchTypes-DjN6YQzE.d.ts +0 -577
- package/Validation-CFP59oIP.d.ts +0 -226
- package/index-C3-iD9Mh.d.ts +0 -690
- package/index-DZ2BB4iX.d.ts +0 -5357
- package/index-IokxSNxm.d.ts +0 -745
- package/index.d.ts +0 -13
- package/index.js +0 -10973
|
@@ -0,0 +1,740 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* TypeInfo-driven ORM service. Configure with a type map and a driver resolver,
|
|
5
|
+
* and optionally provide DAC and indexing integrations. The constructor validates
|
|
6
|
+
* configuration once, and each call resolves drivers as needed.
|
|
7
|
+
*/
|
|
8
|
+
import { LiteralValue, TypeInfo, TypeInfoDataItem, TypeInfoField, TypeInfoMap, TypeOperation } from "../../common/TypeParsing/TypeInfo";
|
|
9
|
+
import { CustomTypeInfoFieldValidatorMap } from "../../common/TypeParsing/Validation";
|
|
10
|
+
import { ComparisonOperators, FieldCriterion, ListItemsConfig, ListItemsResults, ListRelationshipsConfig, SearchCriteria } from "../../common/SearchTypes";
|
|
11
|
+
import { DeleteRelationshipResults, RelationshipOperation, TypeInfoORMAPI, TypeInfoORMContext } from "../../common/TypeInfoORM";
|
|
12
|
+
import { DataItemDBDriver, IndexingRelationshipDriver, ItemRelationshipDBDriver } from "./drivers";
|
|
13
|
+
import { BaseItemRelationshipInfo, ItemRelationshipInfo, ItemRelationshipInfoKeys, ItemRelationshipInfoType, ItemRelationshipOriginatingItemInfo } from "../../common/ItemRelationshipInfoTypes";
|
|
14
|
+
import { DACAccessResult, DACDataItemResourceAccessResultMap, DACRole } from "../DataAccessControl";
|
|
15
|
+
import type { IndexBackend } from "../Indexing/Types";
|
|
16
|
+
import { type StructuredSearchDependencies } from "../Indexing/structured/SearchStructured";
|
|
17
|
+
import type { StructuredWriter } from "../Indexing/structured/Handlers";
|
|
18
|
+
import type { ResolvedSearchLimits } from "../Indexing/Handler/Config";
|
|
19
|
+
import type { StructuredDocFieldsRecord } from "../Indexing/structured/StructuredDdb";
|
|
20
|
+
import type { Where, WhereValue } from "../Indexing/structured/Types";
|
|
21
|
+
import type { StructuredStringTokenizerConfig } from "../Indexing/structured/StructuredStringLike";
|
|
22
|
+
import type { RelationalBackend } from "./drivers/IndexingRelationshipDriver";
|
|
23
|
+
/**
|
|
24
|
+
* Strip a relationship item down to its identifying keys.
|
|
25
|
+
* @returns Relationship item containing only identifying fields.
|
|
26
|
+
* */
|
|
27
|
+
export declare const cleanRelationshipItem: (
|
|
28
|
+
/**
|
|
29
|
+
* Relationship item to normalize.
|
|
30
|
+
*/
|
|
31
|
+
relationshipItem: BaseItemRelationshipInfo) => BaseItemRelationshipInfo;
|
|
32
|
+
/**
|
|
33
|
+
* Wrap a driver method to attach extra fields to thrown errors.
|
|
34
|
+
* @returns Wrapped driver method with extended error data.
|
|
35
|
+
* */
|
|
36
|
+
export declare const getDriverMethodWithModifiedError: <ItemType extends TypeInfoDataItem, UniquelyIdentifyingFieldName extends keyof ItemType, DriverMethodNameType extends keyof DataItemDBDriver<ItemType, UniquelyIdentifyingFieldName>, MethodType extends DataItemDBDriver<ItemType, UniquelyIdentifyingFieldName>[DriverMethodNameType]>(
|
|
37
|
+
/**
|
|
38
|
+
* Extra fields to attach to thrown errors.
|
|
39
|
+
*/
|
|
40
|
+
extendedData: Record<any, any>,
|
|
41
|
+
/**
|
|
42
|
+
* Driver instance containing the method.
|
|
43
|
+
*/
|
|
44
|
+
driver: DataItemDBDriver<ItemType, UniquelyIdentifyingFieldName>,
|
|
45
|
+
/**
|
|
46
|
+
* Driver method name to wrap.
|
|
47
|
+
*/
|
|
48
|
+
driverMethodName: DriverMethodNameType) => MethodType;
|
|
49
|
+
/**
|
|
50
|
+
* The configuration for the TypeInfoORMService DAC features.
|
|
51
|
+
* */
|
|
52
|
+
export type TypeInfoORMDACConfig = {
|
|
53
|
+
/**
|
|
54
|
+
* DAC path prefix for item resources.
|
|
55
|
+
*
|
|
56
|
+
* This prefix is prepended to canonical item paths before evaluating
|
|
57
|
+
* DAC constraints.
|
|
58
|
+
*/
|
|
59
|
+
itemResourcePathPrefix: LiteralValue[];
|
|
60
|
+
/**
|
|
61
|
+
* DAC path prefix for relationship resources.
|
|
62
|
+
*
|
|
63
|
+
* This prefix is prepended to canonical relationship paths before
|
|
64
|
+
* evaluating DAC constraints.
|
|
65
|
+
*/
|
|
66
|
+
relationshipResourcePathPrefix: LiteralValue[];
|
|
67
|
+
/**
|
|
68
|
+
* Optional resolver for owner/tenant prefix applied to item resource paths.
|
|
69
|
+
*
|
|
70
|
+
* When present, the returned prefix is inserted after
|
|
71
|
+
* `itemResourcePathPrefix` and before the canonical item path segments.
|
|
72
|
+
*
|
|
73
|
+
* Relationship create/delete operations also use this prefix to validate
|
|
74
|
+
* endpoint ownership for both the `from` and `to` items.
|
|
75
|
+
*/
|
|
76
|
+
getOwnerPrefix?: (typeName: string, primaryFieldValue: LiteralValue) => Promise<LiteralValue[] | undefined>;
|
|
77
|
+
/**
|
|
78
|
+
* Lookup helper used to resolve roles by id.
|
|
79
|
+
*/
|
|
80
|
+
getDACRoleById: (id: string) => Promise<DACRole>;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Configuration for TypeInfoORM indexing integrations.
|
|
84
|
+
*/
|
|
85
|
+
export type TypeInfoORMIndexingConfig = {
|
|
86
|
+
/**
|
|
87
|
+
* Full text indexing configuration.
|
|
88
|
+
*/
|
|
89
|
+
fullText?: {
|
|
90
|
+
/**
|
|
91
|
+
* Backend used for full text indexing.
|
|
92
|
+
*/
|
|
93
|
+
backend: IndexBackend;
|
|
94
|
+
/**
|
|
95
|
+
* Default index field name(s) by type.
|
|
96
|
+
*/
|
|
97
|
+
defaultIndexFieldByType?: Record<string, string | string[]>;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Structured indexing configuration.
|
|
101
|
+
*/
|
|
102
|
+
structured?: {
|
|
103
|
+
/**
|
|
104
|
+
* Reader used for structured queries.
|
|
105
|
+
*/
|
|
106
|
+
reader: StructuredSearchDependencies;
|
|
107
|
+
/**
|
|
108
|
+
* Optional writer for structured indexing.
|
|
109
|
+
*/
|
|
110
|
+
writer?: StructuredWriter;
|
|
111
|
+
/**
|
|
112
|
+
* Explicitly indexed field names by type. Fields not listed are excluded
|
|
113
|
+
* from structured indexing and structured query routing.
|
|
114
|
+
*/
|
|
115
|
+
indexedFieldsByType?: Record<string, string[]>;
|
|
116
|
+
/**
|
|
117
|
+
* Optional tokenizer overrides for structured string contains/LIKE behavior.
|
|
118
|
+
*/
|
|
119
|
+
tokenizer?: Partial<StructuredStringTokenizerConfig>;
|
|
120
|
+
/**
|
|
121
|
+
* Field name mapping per type.
|
|
122
|
+
*/
|
|
123
|
+
fieldMapByType?: Record<string, Record<string, string>>;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Relationship indexing configuration.
|
|
127
|
+
*/
|
|
128
|
+
relations?: {
|
|
129
|
+
/**
|
|
130
|
+
* Backend used for relationship indexing.
|
|
131
|
+
*/
|
|
132
|
+
backend: RelationalBackend;
|
|
133
|
+
/**
|
|
134
|
+
* Resolver for relation name from type/field.
|
|
135
|
+
*/
|
|
136
|
+
relationNameFor: (fromTypeName: string, fromTypeFieldName: string) => string;
|
|
137
|
+
/**
|
|
138
|
+
* Optional encoder for entity ids.
|
|
139
|
+
*/
|
|
140
|
+
encodeEntityId?: (typeName: string, primaryFieldValue: string) => string;
|
|
141
|
+
/**
|
|
142
|
+
* Optional decoder for entity ids.
|
|
143
|
+
*/
|
|
144
|
+
decodeEntityId?: (typeName: string, entityId: string) => string;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Optional search limits for indexing queries.
|
|
148
|
+
*/
|
|
149
|
+
limits?: ResolvedSearchLimits;
|
|
150
|
+
/**
|
|
151
|
+
* Optional observability hooks for indexing/routing diagnostics.
|
|
152
|
+
*/
|
|
153
|
+
observability?: {
|
|
154
|
+
/**
|
|
155
|
+
* Called when list routing chooses a query execution path.
|
|
156
|
+
*/
|
|
157
|
+
onListRoutingDecision?: (event: {
|
|
158
|
+
typeName: string;
|
|
159
|
+
path: "fullText" | "structured" | "fullScanCompare";
|
|
160
|
+
reason: "fullTextPlan" | "structuredEligible" | "criteriaWithoutIndexedPath" | "indexedPathFailedOrUnsupported";
|
|
161
|
+
criteriaCount: number;
|
|
162
|
+
}) => void;
|
|
163
|
+
/**
|
|
164
|
+
* Called when structured indexing writes/removes document entries.
|
|
165
|
+
*/
|
|
166
|
+
onStructuredIndexWrite?: (event: {
|
|
167
|
+
typeName: string;
|
|
168
|
+
docId: string;
|
|
169
|
+
action: "upsert" | "remove";
|
|
170
|
+
indexedFieldCount: number;
|
|
171
|
+
}) => void;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* The basis for the configuration for the TypeInfoORMService.
|
|
176
|
+
* */
|
|
177
|
+
export type BaseTypeInfoORMServiceConfig = {
|
|
178
|
+
/**
|
|
179
|
+
* Type info map used to validate and shape items.
|
|
180
|
+
*/
|
|
181
|
+
typeInfoMap: TypeInfoMap;
|
|
182
|
+
/**
|
|
183
|
+
* Driver resolver for item types.
|
|
184
|
+
*/
|
|
185
|
+
getDriver: (typeName: string) => DataItemDBDriver<any, any>;
|
|
186
|
+
/**
|
|
187
|
+
* Optional relationship driver resolver.
|
|
188
|
+
*/
|
|
189
|
+
getRelationshipDriver?: (typeName: string, fieldName: string) => ItemRelationshipDBDriver;
|
|
190
|
+
/**
|
|
191
|
+
* Optional indexing configuration.
|
|
192
|
+
*/
|
|
193
|
+
indexing?: TypeInfoORMIndexingConfig;
|
|
194
|
+
/**
|
|
195
|
+
* Optional relationship cleanup hook on delete.
|
|
196
|
+
*/
|
|
197
|
+
createRelationshipCleanupItem?: (relationshipOriginatingItem: ItemRelationshipOriginatingItemInfo) => Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Optional custom validators by type/field.
|
|
200
|
+
*/
|
|
201
|
+
customValidators?: CustomTypeInfoFieldValidatorMap;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* The options determining the usage of DAC features in a {@link TypeInfoORMServiceConfig}.
|
|
205
|
+
* */
|
|
206
|
+
export type TypeInfoORMServiceDACOptions = {
|
|
207
|
+
useDAC: true;
|
|
208
|
+
dacConfig: TypeInfoORMDACConfig;
|
|
209
|
+
} | {
|
|
210
|
+
useDAC: false;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* The configuration for the TypeInfoORMService, including DAC features.
|
|
214
|
+
* */
|
|
215
|
+
export type TypeInfoORMServiceConfig = BaseTypeInfoORMServiceConfig & TypeInfoORMServiceDACOptions;
|
|
216
|
+
/**
|
|
217
|
+
* TypeInfo-driven ORM service with optional DAC and indexing integrations.
|
|
218
|
+
*/
|
|
219
|
+
export declare class TypeInfoORMService implements TypeInfoORMAPI {
|
|
220
|
+
protected config: TypeInfoORMServiceConfig;
|
|
221
|
+
protected dacRoleCache: Record<string, DACRole>;
|
|
222
|
+
protected indexingRelationshipDriver?: IndexingRelationshipDriver;
|
|
223
|
+
/**
|
|
224
|
+
* Emit list routing decision observability events without impacting runtime behavior.
|
|
225
|
+
*/
|
|
226
|
+
protected emitListRoutingDecision: (
|
|
227
|
+
/**
|
|
228
|
+
* Type being listed.
|
|
229
|
+
*/
|
|
230
|
+
typeName: string,
|
|
231
|
+
/**
|
|
232
|
+
* Selected routing path.
|
|
233
|
+
*/
|
|
234
|
+
path: "fullText" | "structured" | "fullScanCompare",
|
|
235
|
+
/**
|
|
236
|
+
* Why this path was selected.
|
|
237
|
+
*/
|
|
238
|
+
reason: "fullTextPlan" | "structuredEligible" | "criteriaWithoutIndexedPath" | "indexedPathFailedOrUnsupported",
|
|
239
|
+
/**
|
|
240
|
+
* Number of criteria considered.
|
|
241
|
+
*/
|
|
242
|
+
criteriaCount: number) => void;
|
|
243
|
+
/**
|
|
244
|
+
* Emit structured index write observability events without impacting behavior.
|
|
245
|
+
*/
|
|
246
|
+
protected emitStructuredIndexWrite: (
|
|
247
|
+
/**
|
|
248
|
+
* Type being indexed.
|
|
249
|
+
*/
|
|
250
|
+
typeName: string,
|
|
251
|
+
/**
|
|
252
|
+
* Indexed document id.
|
|
253
|
+
*/
|
|
254
|
+
docId: string,
|
|
255
|
+
/**
|
|
256
|
+
* Structured indexing action.
|
|
257
|
+
*/
|
|
258
|
+
action: "upsert" | "remove",
|
|
259
|
+
/**
|
|
260
|
+
* Number of indexed fields in the write payload.
|
|
261
|
+
*/
|
|
262
|
+
indexedFieldCount: number) => void;
|
|
263
|
+
/**
|
|
264
|
+
* @param config ORM service configuration.
|
|
265
|
+
*/
|
|
266
|
+
constructor(config: TypeInfoORMServiceConfig);
|
|
267
|
+
protected resolveAccessingRole: (context?: TypeInfoORMContext) => Promise<DACRole | undefined>;
|
|
268
|
+
protected getItemDACValidation: (
|
|
269
|
+
/**
|
|
270
|
+
* Item to evaluate for access.
|
|
271
|
+
*/
|
|
272
|
+
item: Partial<TypeInfoDataItem>,
|
|
273
|
+
/**
|
|
274
|
+
* Type name for the item.
|
|
275
|
+
*/
|
|
276
|
+
typeName: string,
|
|
277
|
+
/**
|
|
278
|
+
* Operation being evaluated.
|
|
279
|
+
*/
|
|
280
|
+
typeOperation: TypeOperation,
|
|
281
|
+
/**
|
|
282
|
+
* Optional access context for the call.
|
|
283
|
+
*/
|
|
284
|
+
context?: TypeInfoORMContext) => Promise<DACDataItemResourceAccessResultMap>;
|
|
285
|
+
protected getRelationshipDACValidation: (
|
|
286
|
+
/**
|
|
287
|
+
* Relationship to evaluate for access.
|
|
288
|
+
*/
|
|
289
|
+
itemRelationship: BaseItemRelationshipInfo,
|
|
290
|
+
/**
|
|
291
|
+
* Relationship operation being evaluated.
|
|
292
|
+
*/
|
|
293
|
+
relationshipOperation: RelationshipOperation,
|
|
294
|
+
/**
|
|
295
|
+
* Optional access context for the call.
|
|
296
|
+
*/
|
|
297
|
+
context?: TypeInfoORMContext,
|
|
298
|
+
/**
|
|
299
|
+
* Optional relationship resource path prefix override.
|
|
300
|
+
*/
|
|
301
|
+
relationshipPrefixOverride?: LiteralValue[]) => Promise<DACAccessResult>;
|
|
302
|
+
protected getRelationshipEndpointDACValidation: (relationshipItem: BaseItemRelationshipInfo, relationshipOperation: RelationshipOperation, relatedTypeName: string, context?: TypeInfoORMContext) => Promise<DACAccessResult>;
|
|
303
|
+
protected getWrappedDriverWithExtendedErrorData: <ItemType extends TypeInfoDataItem, UniquelyIdentifyingFieldName extends keyof ItemType>(
|
|
304
|
+
/**
|
|
305
|
+
* Driver instance to wrap.
|
|
306
|
+
*/
|
|
307
|
+
driver: DataItemDBDriver<ItemType, UniquelyIdentifyingFieldName>,
|
|
308
|
+
/**
|
|
309
|
+
* Extra fields to attach to thrown errors.
|
|
310
|
+
*/
|
|
311
|
+
extendedData: Record<any, any>) => DataItemDBDriver<ItemType, UniquelyIdentifyingFieldName>;
|
|
312
|
+
protected getDriverInternal: (
|
|
313
|
+
/**
|
|
314
|
+
* Type name used to resolve the driver.
|
|
315
|
+
*/
|
|
316
|
+
typeName: string) => DataItemDBDriver<any, any>;
|
|
317
|
+
protected getRelationshipDriverInternal: (
|
|
318
|
+
/**
|
|
319
|
+
* Type name used to resolve the relationship driver.
|
|
320
|
+
*/
|
|
321
|
+
typeName: string,
|
|
322
|
+
/**
|
|
323
|
+
* Field name used to resolve the relationship driver.
|
|
324
|
+
*/
|
|
325
|
+
fieldName: string) => ItemRelationshipDBDriver;
|
|
326
|
+
/**
|
|
327
|
+
* @returns Indexing relationship driver for relation indexing.
|
|
328
|
+
*/
|
|
329
|
+
/**
|
|
330
|
+
* @returns Indexing relationship driver for relation indexing.
|
|
331
|
+
*/
|
|
332
|
+
protected getIndexingRelationshipDriverInternal: () => IndexingRelationshipDriver;
|
|
333
|
+
/**
|
|
334
|
+
* @param typeName Type name to resolve.
|
|
335
|
+
* @returns Type info for the requested type.
|
|
336
|
+
*/
|
|
337
|
+
/**
|
|
338
|
+
* @param typeName Type name to resolve.
|
|
339
|
+
* @returns Type info for the requested type.
|
|
340
|
+
*/
|
|
341
|
+
protected getTypeInfo: (typeName: string) => TypeInfo;
|
|
342
|
+
/**
|
|
343
|
+
* @returns Resolved full-text index field names.
|
|
344
|
+
*/
|
|
345
|
+
protected resolveFullTextIndexFields: (
|
|
346
|
+
/**
|
|
347
|
+
* Type name used to resolve the default index field(s).
|
|
348
|
+
*/
|
|
349
|
+
typeName: string,
|
|
350
|
+
/**
|
|
351
|
+
* Optional override for the index field.
|
|
352
|
+
*/
|
|
353
|
+
override?: string) => string[];
|
|
354
|
+
/**
|
|
355
|
+
* @returns True when the operator maps to full-text search.
|
|
356
|
+
*/
|
|
357
|
+
protected isFullTextSearchOperator: (
|
|
358
|
+
/**
|
|
359
|
+
* Operator to evaluate.
|
|
360
|
+
*/
|
|
361
|
+
operator: ComparisonOperators) => boolean;
|
|
362
|
+
/**
|
|
363
|
+
* @returns Explicitly indexed structured field names for a type.
|
|
364
|
+
*/
|
|
365
|
+
protected resolveStructuredIndexedFields: (
|
|
366
|
+
/**
|
|
367
|
+
* Type name used to resolve indexed structured fields.
|
|
368
|
+
*/
|
|
369
|
+
typeName: string) => Set<string>;
|
|
370
|
+
/**
|
|
371
|
+
* @returns True when the field type and operator can be served by structured indexing.
|
|
372
|
+
*/
|
|
373
|
+
protected isStructuredOperatorSupportedForField: (
|
|
374
|
+
/**
|
|
375
|
+
* Field definition from TypeInfo.
|
|
376
|
+
*/
|
|
377
|
+
field: TypeInfoField,
|
|
378
|
+
/**
|
|
379
|
+
* Search operator to evaluate.
|
|
380
|
+
*/
|
|
381
|
+
operator: ComparisonOperators) => boolean;
|
|
382
|
+
/**
|
|
383
|
+
* @returns True when criteria can be evaluated using structured indexing.
|
|
384
|
+
*/
|
|
385
|
+
protected canUseStructuredIndexForCriteria: (
|
|
386
|
+
/**
|
|
387
|
+
* Type being listed.
|
|
388
|
+
*/
|
|
389
|
+
typeName: string,
|
|
390
|
+
/**
|
|
391
|
+
* Criteria to evaluate.
|
|
392
|
+
*/
|
|
393
|
+
criteria?: SearchCriteria) => boolean;
|
|
394
|
+
/**
|
|
395
|
+
* @returns Full-text query plan derived from a field criterion.
|
|
396
|
+
*/
|
|
397
|
+
protected toFullTextSearchPlan: (
|
|
398
|
+
/**
|
|
399
|
+
* Criterion to map.
|
|
400
|
+
*/
|
|
401
|
+
criterion: FieldCriterion) => {
|
|
402
|
+
mode: "lossy" | "exact";
|
|
403
|
+
query: string;
|
|
404
|
+
} | undefined;
|
|
405
|
+
/**
|
|
406
|
+
* @returns Auto full-text search plan for list criteria, if applicable.
|
|
407
|
+
*/
|
|
408
|
+
protected resolveAutoFullTextCriteriaPlan: (
|
|
409
|
+
/**
|
|
410
|
+
* Type being listed.
|
|
411
|
+
*/
|
|
412
|
+
typeName: string,
|
|
413
|
+
/**
|
|
414
|
+
* Search criteria from list config.
|
|
415
|
+
*/
|
|
416
|
+
criteria?: SearchCriteria) => {
|
|
417
|
+
mode: "lossy" | "exact";
|
|
418
|
+
query: string;
|
|
419
|
+
indexField: string;
|
|
420
|
+
} | undefined;
|
|
421
|
+
/**
|
|
422
|
+
* @returns Encoded cursor for full-scan compare pagination.
|
|
423
|
+
*/
|
|
424
|
+
protected encodeFullScanCompareCursor: (
|
|
425
|
+
/**
|
|
426
|
+
* Next offset in filtered/sorted results.
|
|
427
|
+
*/
|
|
428
|
+
offset: number) => string;
|
|
429
|
+
/**
|
|
430
|
+
* @returns Decoded offset for full-scan compare pagination.
|
|
431
|
+
*/
|
|
432
|
+
protected decodeFullScanCompareCursor: (
|
|
433
|
+
/**
|
|
434
|
+
* Cursor from list config.
|
|
435
|
+
*/
|
|
436
|
+
cursor?: string) => number;
|
|
437
|
+
/**
|
|
438
|
+
* Execute a criteria list via full scan + in-memory compare.
|
|
439
|
+
*
|
|
440
|
+
* This is the universal fallback strategy for criteria/operators that are not
|
|
441
|
+
* supported by indexed query planners.
|
|
442
|
+
*
|
|
443
|
+
* @returns List results with cursor.
|
|
444
|
+
*/
|
|
445
|
+
protected listByFullScanAndCompare(
|
|
446
|
+
/**
|
|
447
|
+
* Type name to list.
|
|
448
|
+
*/
|
|
449
|
+
typeName: string,
|
|
450
|
+
/**
|
|
451
|
+
* Original list config.
|
|
452
|
+
*/
|
|
453
|
+
config: ListItemsConfig,
|
|
454
|
+
/**
|
|
455
|
+
* Selected fields for cleaned response.
|
|
456
|
+
*/
|
|
457
|
+
cleanSelectedFields: (keyof TypeInfoDataItem)[] | undefined,
|
|
458
|
+
/**
|
|
459
|
+
* Whether DAC checks are enabled.
|
|
460
|
+
*/
|
|
461
|
+
useDAC: boolean,
|
|
462
|
+
/**
|
|
463
|
+
* Optional request context.
|
|
464
|
+
*/
|
|
465
|
+
context?: TypeInfoORMContext): Promise<ListItemsResults<Partial<TypeInfoDataItem>>>;
|
|
466
|
+
/**
|
|
467
|
+
* @param value Value to check.
|
|
468
|
+
* @returns True when the value is a supported structured value.
|
|
469
|
+
*/
|
|
470
|
+
protected isStructuredValue: (value: unknown) => value is WhereValue;
|
|
471
|
+
/**
|
|
472
|
+
* @returns Structured fields record for indexing.
|
|
473
|
+
*/
|
|
474
|
+
protected buildStructuredFields: (
|
|
475
|
+
/**
|
|
476
|
+
* Type name for field mapping.
|
|
477
|
+
*/
|
|
478
|
+
typeName: string,
|
|
479
|
+
/**
|
|
480
|
+
* Item to extract structured fields from.
|
|
481
|
+
*/
|
|
482
|
+
item: Partial<TypeInfoDataItem>) => StructuredDocFieldsRecord;
|
|
483
|
+
/**
|
|
484
|
+
* @returns Mapped structured query.
|
|
485
|
+
*/
|
|
486
|
+
protected applyStructuredFieldMap: (
|
|
487
|
+
/**
|
|
488
|
+
* Type name used for field qualification.
|
|
489
|
+
*/
|
|
490
|
+
typeName: string,
|
|
491
|
+
/**
|
|
492
|
+
* Structured query to map.
|
|
493
|
+
*/
|
|
494
|
+
where: Where,
|
|
495
|
+
/**
|
|
496
|
+
* Optional field mapping by type.
|
|
497
|
+
*/
|
|
498
|
+
fieldMap?: Record<string, string>) => Where;
|
|
499
|
+
/**
|
|
500
|
+
* @returns Promise resolved once indexing is complete.
|
|
501
|
+
*/
|
|
502
|
+
protected indexFullTextDocument(
|
|
503
|
+
/**
|
|
504
|
+
* Type name for index field resolution.
|
|
505
|
+
*/
|
|
506
|
+
typeName: string,
|
|
507
|
+
/**
|
|
508
|
+
* Item to index.
|
|
509
|
+
*/
|
|
510
|
+
item: Partial<TypeInfoDataItem>,
|
|
511
|
+
/**
|
|
512
|
+
* Optional override for the index field.
|
|
513
|
+
*/
|
|
514
|
+
indexFieldOverride?: string): Promise<void>;
|
|
515
|
+
/**
|
|
516
|
+
* @returns Promise resolved once removal is complete.
|
|
517
|
+
*/
|
|
518
|
+
protected removeFullTextDocument(
|
|
519
|
+
/**
|
|
520
|
+
* Type name for index field resolution.
|
|
521
|
+
*/
|
|
522
|
+
typeName: string,
|
|
523
|
+
/**
|
|
524
|
+
* Item to remove from the index.
|
|
525
|
+
*/
|
|
526
|
+
item: Partial<TypeInfoDataItem>,
|
|
527
|
+
/**
|
|
528
|
+
* Optional override for the index field.
|
|
529
|
+
*/
|
|
530
|
+
indexFieldOverride?: string): Promise<void>;
|
|
531
|
+
/**
|
|
532
|
+
* @returns Promise resolved once replacement is complete.
|
|
533
|
+
*/
|
|
534
|
+
protected replaceFullTextDocument(
|
|
535
|
+
/**
|
|
536
|
+
* Type name for index field resolution.
|
|
537
|
+
*/
|
|
538
|
+
typeName: string,
|
|
539
|
+
/**
|
|
540
|
+
* Previous item state to remove from the index.
|
|
541
|
+
*/
|
|
542
|
+
previousItem: Partial<TypeInfoDataItem>,
|
|
543
|
+
/**
|
|
544
|
+
* Next item state to index.
|
|
545
|
+
*/
|
|
546
|
+
nextItem: Partial<TypeInfoDataItem>,
|
|
547
|
+
/**
|
|
548
|
+
* Optional override for the index field.
|
|
549
|
+
*/
|
|
550
|
+
indexFieldOverride?: string): Promise<void>;
|
|
551
|
+
/**
|
|
552
|
+
* @returns Promise resolved once indexing is complete.
|
|
553
|
+
*/
|
|
554
|
+
protected indexStructuredDocument(
|
|
555
|
+
/**
|
|
556
|
+
* Type name for field mapping.
|
|
557
|
+
*/
|
|
558
|
+
typeName: string,
|
|
559
|
+
/**
|
|
560
|
+
* Item to index.
|
|
561
|
+
*/
|
|
562
|
+
item: Partial<TypeInfoDataItem>): Promise<void>;
|
|
563
|
+
/**
|
|
564
|
+
* @returns Promise resolved once removal is complete.
|
|
565
|
+
*/
|
|
566
|
+
protected removeStructuredDocument(
|
|
567
|
+
/**
|
|
568
|
+
* Type name for field mapping.
|
|
569
|
+
*/
|
|
570
|
+
typeName: string,
|
|
571
|
+
/**
|
|
572
|
+
* Item to remove from the structured index.
|
|
573
|
+
*/
|
|
574
|
+
item: Partial<TypeInfoDataItem>): Promise<void>;
|
|
575
|
+
/**
|
|
576
|
+
* @returns Nothing (throws on invalid operations).
|
|
577
|
+
*/
|
|
578
|
+
protected validateReadOperation: (
|
|
579
|
+
/**
|
|
580
|
+
* Type name to validate for read.
|
|
581
|
+
*/
|
|
582
|
+
typeName: string,
|
|
583
|
+
/**
|
|
584
|
+
* Optional selected fields to validate.
|
|
585
|
+
*/
|
|
586
|
+
selectedFields?: (keyof TypeInfoDataItem)[]) => void;
|
|
587
|
+
/**
|
|
588
|
+
* @returns Nothing (throws on invalid items).
|
|
589
|
+
*/
|
|
590
|
+
protected validate: (
|
|
591
|
+
/**
|
|
592
|
+
* Type name to validate.
|
|
593
|
+
*/
|
|
594
|
+
typeName: string,
|
|
595
|
+
/**
|
|
596
|
+
* Item to validate.
|
|
597
|
+
*/
|
|
598
|
+
item: TypeInfoDataItem,
|
|
599
|
+
/**
|
|
600
|
+
* Operation being validated.
|
|
601
|
+
*/
|
|
602
|
+
typeOperation: TypeOperation,
|
|
603
|
+
/**
|
|
604
|
+
* Whether the item is a partial update.
|
|
605
|
+
*/
|
|
606
|
+
itemIsPartial?: boolean) => void;
|
|
607
|
+
/**
|
|
608
|
+
* @returns Cleaned item with selected fields and DAC constraints applied.
|
|
609
|
+
*/
|
|
610
|
+
protected getCleanItem: (
|
|
611
|
+
/**
|
|
612
|
+
* Type name used to look up TypeInfo.
|
|
613
|
+
*/
|
|
614
|
+
typeName: string,
|
|
615
|
+
/**
|
|
616
|
+
* Item to clean.
|
|
617
|
+
*/
|
|
618
|
+
item: Partial<TypeInfoDataItem>,
|
|
619
|
+
/**
|
|
620
|
+
* Optional DAC field resource map.
|
|
621
|
+
*/
|
|
622
|
+
dacFieldResources?: Partial<Record<keyof TypeInfoDataItem, DACAccessResult>>,
|
|
623
|
+
/**
|
|
624
|
+
* Optional selected fields to include.
|
|
625
|
+
*/
|
|
626
|
+
selectedFields?: (keyof TypeInfoDataItem)[]) => Partial<TypeInfoDataItem>;
|
|
627
|
+
/**
|
|
628
|
+
* @returns Sanitized selected fields or undefined for all fields.
|
|
629
|
+
*/
|
|
630
|
+
protected getCleanSelectedFields: (
|
|
631
|
+
/**
|
|
632
|
+
* Type name used to look up TypeInfo.
|
|
633
|
+
*/
|
|
634
|
+
typeName: string,
|
|
635
|
+
/**
|
|
636
|
+
* Optional selected fields to include.
|
|
637
|
+
*/
|
|
638
|
+
selectedFields?: (keyof TypeInfoDataItem)[]) => (keyof TypeInfoDataItem)[] | undefined;
|
|
639
|
+
/**
|
|
640
|
+
* @returns Nothing (throws on invalid relationships).
|
|
641
|
+
*/
|
|
642
|
+
protected validateRelationshipItem: (
|
|
643
|
+
/**
|
|
644
|
+
* Relationship item to validate.
|
|
645
|
+
*/
|
|
646
|
+
relationshipItem: ItemRelationshipInfoType,
|
|
647
|
+
/**
|
|
648
|
+
* Relationship fields to omit from validation.
|
|
649
|
+
*/
|
|
650
|
+
omitFields: ItemRelationshipInfoKeys[]) => void;
|
|
651
|
+
/**
|
|
652
|
+
* @returns Promise resolved once cleanup is complete.
|
|
653
|
+
*/
|
|
654
|
+
protected cleanupRelationships: (
|
|
655
|
+
/**
|
|
656
|
+
* Relationship originating item used for cleanup.
|
|
657
|
+
*/
|
|
658
|
+
relationshipOriginatingItem: ItemRelationshipOriginatingItemInfo) => Promise<void>;
|
|
659
|
+
/**
|
|
660
|
+
* Create a new relationship between two items.
|
|
661
|
+
* @param relationshipItem Relationship item to create.
|
|
662
|
+
*
|
|
663
|
+
* When DAC is enabled and `getOwnerPrefix` is configured, relationship
|
|
664
|
+
* creation requires:
|
|
665
|
+
* 1) relationship permission on the relationship resource path, and
|
|
666
|
+
* 2) endpoint ownership permission for both `from` and `to` items.
|
|
667
|
+
* @returns True when the relationship was created.
|
|
668
|
+
* */
|
|
669
|
+
createRelationship: (relationshipItem: BaseItemRelationshipInfo, context?: TypeInfoORMContext) => Promise<boolean>;
|
|
670
|
+
/**
|
|
671
|
+
* Delete a relationship between two items.
|
|
672
|
+
* @param relationshipItem Relationship item to delete.
|
|
673
|
+
*
|
|
674
|
+
* When DAC is enabled and `getOwnerPrefix` is configured, relationship
|
|
675
|
+
* deletion requires:
|
|
676
|
+
* 1) relationship permission on the relationship resource path, and
|
|
677
|
+
* 2) endpoint ownership permission for both `from` and `to` items.
|
|
678
|
+
* @returns Deletion results including whether items remain.
|
|
679
|
+
* */
|
|
680
|
+
deleteRelationship: (relationshipItem: BaseItemRelationshipInfo, context?: TypeInfoORMContext) => Promise<DeleteRelationshipResults>;
|
|
681
|
+
/**
|
|
682
|
+
* List the relationships for a given item.
|
|
683
|
+
* @param config Relationship list configuration.
|
|
684
|
+
* @returns Relationship items and paging cursor.
|
|
685
|
+
* */
|
|
686
|
+
listRelationships: (config: ListRelationshipsConfig, context?: TypeInfoORMContext) => Promise<ListItemsResults<ItemRelationshipInfo>>;
|
|
687
|
+
/**
|
|
688
|
+
* List related items for the relationship origin.
|
|
689
|
+
* @param config Relationship list configuration.
|
|
690
|
+
* @param selectedFields Optional fields to select on related items.
|
|
691
|
+
* @returns Items and cursor for related items.
|
|
692
|
+
*/
|
|
693
|
+
listRelatedItems: (config: ListRelationshipsConfig, selectedFields?: (keyof TypeInfoDataItem)[], context?: TypeInfoORMContext) => Promise<{
|
|
694
|
+
items: Partial<TypeInfoDataItem>[];
|
|
695
|
+
cursor: string | undefined;
|
|
696
|
+
}>;
|
|
697
|
+
/**
|
|
698
|
+
* Create a new item of the given type.
|
|
699
|
+
* @param typeName Type name to create.
|
|
700
|
+
* @param item Item payload to create.
|
|
701
|
+
* @returns Primary field value for the created item.
|
|
702
|
+
* */
|
|
703
|
+
create: (typeName: string, item: TypeInfoDataItem) => Promise<any>;
|
|
704
|
+
/**
|
|
705
|
+
* Read an existing item of the given type.
|
|
706
|
+
* @param typeName Type name to read.
|
|
707
|
+
* @param primaryFieldValue Primary field value to fetch.
|
|
708
|
+
* @param selectedFields Optional fields to select.
|
|
709
|
+
* @returns Cleaned item data.
|
|
710
|
+
* */
|
|
711
|
+
read: (typeName: string, primaryFieldValue: any, selectedFields?: string[], context?: TypeInfoORMContext) => Promise<Partial<TypeInfoDataItem>>;
|
|
712
|
+
/**
|
|
713
|
+
* Update an existing item of the given type.
|
|
714
|
+
*
|
|
715
|
+
* This update will always act as a **patch**.
|
|
716
|
+
* Use `null` to signify the deletion of a field.
|
|
717
|
+
* Assign values to **all** fields to perform a **replacement**.
|
|
718
|
+
*
|
|
719
|
+
* The `item` **must always** contain its **primary field value**.
|
|
720
|
+
* @param typeName Type name to update.
|
|
721
|
+
* @param item Item payload to update.
|
|
722
|
+
* @returns True when the update succeeded.
|
|
723
|
+
* */
|
|
724
|
+
update: (typeName: string, item: TypeInfoDataItem, context?: TypeInfoORMContext) => Promise<boolean>;
|
|
725
|
+
/**
|
|
726
|
+
* Delete an existing item of the given type.
|
|
727
|
+
* @param typeName Type name to delete.
|
|
728
|
+
* @param primaryFieldValue Primary field value to delete.
|
|
729
|
+
* @returns True when the delete succeeded.
|
|
730
|
+
* */
|
|
731
|
+
delete: (typeName: string, primaryFieldValue: any, context?: TypeInfoORMContext) => Promise<boolean>;
|
|
732
|
+
/**
|
|
733
|
+
* List items of the given type, with the given criteria.
|
|
734
|
+
* @param typeName Type name to list.
|
|
735
|
+
* @param config List configuration and criteria.
|
|
736
|
+
* @param selectedFields Optional fields to select.
|
|
737
|
+
* @returns List results with items and cursor.
|
|
738
|
+
* */
|
|
739
|
+
list: (typeName: string, config: ListItemsConfig, selectedFields?: (keyof TypeInfoDataItem)[], context?: TypeInfoORMContext) => Promise<ListItemsResults<Partial<TypeInfoDataItem>>>;
|
|
740
|
+
}
|