@resistdesign/voltra 3.0.0-alpha.5 → 3.0.0-alpha.7

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/index.js CHANGED
@@ -4,15 +4,15 @@ import { QueryCommand, DynamoDBClient, PutItemCommand, GetItemCommand, UpdateIte
4
4
  import { marshall, unmarshall } from '@aws-sdk/util-dynamodb';
5
5
  import { S3, PutObjectCommand, HeadObjectCommand, CopyObjectCommand, GetObjectCommand, DeleteObjectCommand, ListObjectsV2Command } from '@aws-sdk/client-s3';
6
6
  import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
7
- import Path5 from 'path';
8
- import FS, { promises } from 'fs';
9
- import { fileURLToPath, pathToFileURL } from 'url';
10
- import { SyntaxKind, isLiteralTypeNode, isStringLiteral, isNumericLiteral, createSourceFile, ScriptTarget } from 'typescript';
11
7
  import { v4 } from 'uuid';
8
+ import Path4 from 'path';
9
+ import { fileURLToPath, pathToFileURL } from 'url';
12
10
  import { createContext, useContext, useRef, useMemo, useCallback, useState, useEffect } from 'react';
13
11
  import { jsx } from 'react/jsx-runtime';
14
12
  import styled from 'styled-components';
15
13
  import YAML from 'yaml';
14
+ import { SyntaxKind } from 'typescript';
15
+ import { promises } from 'fs';
16
16
 
17
17
  var __defProp = Object.defineProperty;
18
18
  var __export = (target, all) => {
@@ -4049,985 +4049,582 @@ var DATA_ITEM_DB_DRIVER_ERRORS = /* @__PURE__ */ ((DATA_ITEM_DB_DRIVER_ERRORS2)
4049
4049
  return DATA_ITEM_DB_DRIVER_ERRORS2;
4050
4050
  })(DATA_ITEM_DB_DRIVER_ERRORS || {});
4051
4051
 
4052
- // src/common/TypeParsing/index.ts
4053
- var TypeParsing_exports = {};
4054
- __export(TypeParsing_exports, {
4055
- Constants: () => Constants_exports,
4056
- TypeInfo: () => TypeInfo_exports,
4057
- TypeMapping: () => TypeMapping_exports,
4058
- Validation: () => Validation_exports,
4059
- getTypeInfoMapFromTypeScript: () => getTypeInfoMapFromTypeScript
4060
- });
4061
-
4062
- // src/common/TypeParsing/TypeMapping.ts
4063
- var TypeMapping_exports = {};
4064
- __export(TypeMapping_exports, {
4065
- convertASTToMap: () => convertASTToMap
4066
- });
4067
- var convertASTToMap = (node, map = {}, parentName) => {
4068
- node.forEachChild((child) => {
4069
- const { kind: childKind } = child;
4070
- if (childKind === SyntaxKind.ModuleDeclaration) {
4071
- const moduleNode = child;
4072
- const { name: moduleName } = moduleNode;
4073
- const textModuleName = moduleName.getText();
4074
- const fullModuleName = parentName ? `${parentName}.${textModuleName}` : textModuleName;
4075
- convertASTToMap(moduleNode, map, fullModuleName);
4076
- }
4077
- if (childKind === SyntaxKind.ModuleBlock) {
4078
- convertASTToMap(child, map, parentName);
4079
- }
4080
- if (childKind === SyntaxKind.TypeAliasDeclaration) {
4081
- const typeAliasDec = child;
4082
- const {
4083
- name: { text: typeName }
4084
- } = typeAliasDec;
4085
- const fullTypeName = parentName ? `${parentName}.${typeName}` : typeName;
4086
- map[fullTypeName] = typeAliasDec;
4087
- }
4088
- });
4089
- return map;
4090
- };
4091
-
4092
- // src/common/TypeParsing/ParsingUtils/extractCommentTags.ts
4093
- var TAG_NAME_PATH_DELIMITER = ".";
4094
- var getFlatTagValue = (tagValue) => {
4095
- if (typeof tagValue === "undefined") {
4096
- return "";
4097
- } else if (Array.isArray(tagValue)) {
4098
- const valueNodeArray = tagValue;
4099
- const valueList = [];
4100
- for (let i = 0; i < valueNodeArray.length; i++) {
4101
- const { text } = valueNodeArray[i];
4102
- valueList.push(getFlatTagValue(text));
4103
- }
4104
- return valueList.join(" ");
4105
- } else {
4106
- return `${tagValue}`;
4107
- }
4108
- };
4109
- var getTagNameAndValue = (tag) => {
4110
- let name = tag.tagName.text, value = getFlatTagValue(tag.comment);
4111
- if (value.startsWith(TAG_NAME_PATH_DELIMITER)) {
4112
- const extendedTagNameEndIndex = value.indexOf(" ");
4113
- const hasActualValue = extendedTagNameEndIndex !== -1;
4114
- name += hasActualValue ? value.slice(0, extendedTagNameEndIndex) : value;
4115
- value = hasActualValue ? value.slice(extendedTagNameEndIndex + 1) : "";
4116
- }
4117
- if (value === "") {
4118
- value = "true";
4119
- }
4120
- return {
4121
- name,
4122
- value
4123
- };
4124
- };
4125
- var getObjectWithValueAppliedToPath = (path = [], value, baseObject) => {
4126
- let baseParentObject = void 0, currentParent = void 0;
4127
- if (path.length === 0) {
4128
- baseParentObject = value;
4129
- } else {
4130
- for (let i = 0; i < path.length; i++) {
4131
- const pathPart = path[i];
4132
- const cleanPathPart = typeof pathPart === "number" ? pathPart : `${typeof pathPart !== "undefined" ? pathPart : ""}`;
4133
- const isNum = typeof cleanPathPart === "number";
4134
- let newCurrentParent = void 0;
4135
- if (i === 0) {
4136
- if (!baseObject) {
4137
- baseParentObject = isNum ? [] : {};
4138
- } else {
4139
- baseParentObject = isNum ? [...Array.isArray(baseObject) ? baseObject : []] : {
4140
- ...typeof baseObject === "object" ? baseObject : {}
4141
- };
4142
- }
4143
- currentParent = baseParentObject;
4144
- }
4145
- if (i < path.length - 1) {
4146
- const existingNewCurrentParent = currentParent[cleanPathPart];
4147
- newCurrentParent = isNum ? [
4148
- ...Array.isArray(existingNewCurrentParent) ? existingNewCurrentParent : []
4149
- ] : {
4150
- ...typeof existingNewCurrentParent === "object" ? existingNewCurrentParent : {}
4151
- };
4152
- currentParent[cleanPathPart] = newCurrentParent;
4153
- currentParent = newCurrentParent;
4154
- } else {
4155
- currentParent[cleanPathPart] = value;
4156
- }
4157
- }
4158
- }
4159
- return baseParentObject;
4160
- };
4161
- var extractCommentTags = (node) => {
4162
- const jsDocComments = node["jsDoc"];
4163
- let commentTags = {};
4164
- if (jsDocComments) {
4165
- jsDocComments.forEach((jsDoc) => {
4166
- const tags = jsDoc.tags;
4167
- if (tags) {
4168
- tags.forEach((tag) => {
4169
- const { name: tagName, value: tagValue } = getTagNameAndValue(tag);
4170
- const potentialJSONValue = getPotentialJSONValue(tagValue);
4171
- commentTags = getObjectWithValueAppliedToPath(
4172
- getPathArray(tagName, TAG_NAME_PATH_DELIMITER),
4173
- potentialJSONValue,
4174
- commentTags
4175
- );
4176
- });
4177
- }
4178
- });
4179
- }
4180
- return commentTags;
4181
- };
4182
- var extractLiteralValues = (node) => {
4183
- const literalValues = [];
4184
- let detectedTypeKeyword;
4185
- for (const type of node.types) {
4186
- if (isLiteralTypeNode(type)) {
4187
- const literal = type.literal;
4188
- if (isStringLiteral(literal)) {
4189
- if (!detectedTypeKeyword) detectedTypeKeyword = "string";
4190
- if (detectedTypeKeyword === "string") {
4191
- literalValues.push(literal.text);
4192
- }
4193
- } else if (isNumericLiteral(literal)) {
4194
- if (!detectedTypeKeyword) detectedTypeKeyword = "number";
4195
- if (detectedTypeKeyword === "number") {
4196
- literalValues.push(Number(literal.text));
4197
- }
4198
- } else if (literal.kind === SyntaxKind.TrueKeyword || literal.kind === SyntaxKind.FalseKeyword) {
4199
- if (!detectedTypeKeyword) detectedTypeKeyword = "boolean";
4200
- if (detectedTypeKeyword === "boolean") {
4201
- literalValues.push(literal.kind === SyntaxKind.TrueKeyword);
4202
- }
4203
- } else if (literal.kind === SyntaxKind.NullKeyword) {
4204
- literalValues.push(null);
4052
+ // src/api/ORM/drivers/S3FileItemDBDriver/ConfigTypeInfoMap.json
4053
+ var ConfigTypeInfoMap_default = {
4054
+ Logger: {
4055
+ fields: {
4056
+ trace: {
4057
+ type: "string",
4058
+ array: false,
4059
+ readonly: false,
4060
+ optional: true,
4061
+ possibleValues: [],
4062
+ tags: {}
4063
+ },
4064
+ debug: {
4065
+ type: "string",
4066
+ array: false,
4067
+ readonly: false,
4068
+ optional: false,
4069
+ typeReference: "Trace",
4070
+ tags: {}
4071
+ },
4072
+ info: {
4073
+ type: "string",
4074
+ array: false,
4075
+ readonly: false,
4076
+ optional: false,
4077
+ typeReference: "Trace",
4078
+ tags: {}
4079
+ },
4080
+ warn: {
4081
+ type: "string",
4082
+ array: false,
4083
+ readonly: false,
4084
+ optional: false,
4085
+ typeReference: "Trace",
4086
+ tags: {}
4087
+ },
4088
+ error: {
4089
+ type: "string",
4090
+ array: false,
4091
+ readonly: false,
4092
+ optional: false,
4093
+ typeReference: "Trace",
4094
+ tags: {}
4205
4095
  }
4206
- } else {
4207
- return void 0;
4208
- }
4209
- }
4210
- return literalValues.length ? { values: literalValues, type: detectedTypeKeyword } : void 0;
4211
- };
4212
-
4213
- // src/common/TypeParsing/ParsingUtils/checkUnionType.ts
4214
- var checkUnionType = (unionType) => {
4215
- const extracted = extractLiteralValues(unionType);
4216
- let typeKeyword = "string";
4217
- let options;
4218
- if (extracted) {
4219
- options = extracted.values;
4220
- typeKeyword = extracted.type;
4221
- }
4222
- return { options: options || [], typeKeyword };
4223
- };
4224
- var getTypeKeyword = (node) => {
4225
- switch (node.kind) {
4226
- case SyntaxKind.StringKeyword:
4227
- return "string";
4228
- case SyntaxKind.NumberKeyword:
4229
- return "number";
4230
- case SyntaxKind.BooleanKeyword:
4231
- return "boolean";
4232
- default:
4233
- return "string";
4234
- }
4235
- };
4236
-
4237
- // src/common/TypeParsing/ParsingUtils/checkType.ts
4238
- var checkType = (node) => {
4239
- let typeReference;
4240
- let isArray = false;
4241
- let typeKeyword;
4242
- let options;
4243
- if (node.kind === SyntaxKind.TypeReference) {
4244
- typeReference = node.typeName.getText();
4245
- typeKeyword = "string";
4246
- } else if (node.kind === SyntaxKind.ArrayType) {
4247
- isArray = true;
4248
- const elementType = node.elementType;
4249
- const {
4250
- typeReference: elementReference,
4251
- isArray: elementIsArray,
4252
- typeKeyword: elementKeyword,
4253
- options: elementOptions
4254
- } = checkType(elementType);
4255
- typeReference = elementReference;
4256
- isArray = !!elementIsArray;
4257
- typeKeyword = elementKeyword || "string";
4258
- options = elementOptions;
4259
- } else if (node.kind === SyntaxKind.UnionType) {
4260
- const { types: unionTypes } = node;
4261
- const { options: unionOptions, typeKeyword: unionTypeKeyword } = checkUnionType(node);
4262
- options = unionOptions;
4263
- typeKeyword = unionTypeKeyword;
4264
- if (!options) {
4265
- typeKeyword = getTypeKeyword(unionTypes[0]);
4266
- }
4267
- } else if (node.kind === SyntaxKind.ParenthesizedType) {
4268
- const {
4269
- typeReference: parenthesizedReference,
4270
- isArray: parenthesizedIsArray,
4271
- typeKeyword: parenthesizedKeyword,
4272
- options: parenthesizedOptions
4273
- } = checkType(node.type);
4274
- typeReference = parenthesizedReference;
4275
- isArray = !!parenthesizedIsArray;
4276
- typeKeyword = parenthesizedKeyword || "string";
4277
- options = parenthesizedOptions;
4278
- } else {
4279
- typeKeyword = getTypeKeyword(node);
4280
- }
4281
- return { typeReference, isArray, typeKeyword, options };
4282
- };
4283
-
4284
- // src/common/TypeParsing/ParsingUtils/extractTypeDetails.ts
4285
- var extractTypeDetails = (type) => {
4286
- const { isArray, typeReference, options, typeKeyword } = checkType(type);
4287
- return {
4288
- type: typeKeyword || "string",
4289
- typeReference,
4290
- array: !!isArray,
4291
- options
4292
- };
4293
- };
4294
-
4295
- // src/common/TypeParsing/ParsingUtils/getTypeInfoField.ts
4296
- var getTypeInfoField = (propertySignature) => {
4297
- const { type, modifiers } = propertySignature;
4298
- const {
4299
- array,
4300
- typeReference,
4301
- type: typeKeyword,
4302
- options
4303
- } = type ? extractTypeDetails(type) : {
4304
- array: false,
4305
- typeReference: void 0,
4306
- type: "string",
4307
- options: void 0
4308
- };
4309
- const readonly = modifiers ? modifiers.some((modifier) => modifier.kind === SyntaxKind.ReadonlyKeyword) : false;
4310
- const optional = !!propertySignature.questionToken;
4311
- let tags = extractCommentTags(propertySignature);
4312
- if (readonly) {
4313
- const {
4314
- deniedOperations,
4315
- deniedOperations: { CREATE, UPDATE, DELETE } = {}
4316
- } = tags || {};
4317
- tags = {
4318
- ...tags,
4319
- deniedOperations: {
4320
- ...deniedOperations,
4321
- create: CREATE ?? true,
4322
- update: UPDATE ?? true,
4323
- delete: DELETE ?? true
4096
+ },
4097
+ tags: {},
4098
+ primaryField: "trace"
4099
+ },
4100
+ Endpoint: {
4101
+ fields: {
4102
+ protocol: {
4103
+ type: "string",
4104
+ array: false,
4105
+ readonly: false,
4106
+ optional: false,
4107
+ tags: {}
4108
+ },
4109
+ hostname: {
4110
+ type: "string",
4111
+ array: false,
4112
+ readonly: false,
4113
+ optional: false,
4114
+ tags: {}
4115
+ },
4116
+ port: {
4117
+ type: "string",
4118
+ array: false,
4119
+ readonly: false,
4120
+ optional: true,
4121
+ tags: {}
4122
+ },
4123
+ path: {
4124
+ type: "string",
4125
+ array: false,
4126
+ readonly: false,
4127
+ optional: false,
4128
+ tags: {}
4129
+ },
4130
+ query: {
4131
+ type: "string",
4132
+ array: false,
4133
+ readonly: false,
4134
+ optional: true,
4135
+ tags: {}
4324
4136
  }
4325
- };
4326
- }
4327
- return {
4328
- type: typeKeyword,
4329
- array,
4330
- readonly,
4331
- optional,
4332
- typeReference,
4333
- possibleValues: options,
4334
- tags
4335
- };
4336
- };
4337
-
4338
- // src/common/TypeParsing/ParsingUtils/getTypeInfo.ts
4339
- var getTypeInfo = (typeLiteral) => {
4340
- const { members } = typeLiteral;
4341
- const tags = extractCommentTags(typeLiteral);
4342
- let fields = {};
4343
- for (const m of members) {
4344
- const { name, kind } = m;
4345
- if (name && kind === SyntaxKind.PropertySignature) {
4346
- const fieldName = name.getText();
4347
- const field = getTypeInfoField(m);
4348
- fields = {
4349
- ...fields,
4350
- [fieldName]: field
4351
- };
4352
- }
4353
- }
4354
- return {
4355
- fields,
4356
- tags
4357
- };
4358
- };
4359
- var getUnionOrIntersectionTypeInfo = (unionType, typeMap) => {
4360
- const { kind, types } = unionType;
4361
- const isUnion = kind === SyntaxKind.UnionType;
4362
- let typeInfo;
4363
- for (const t of types) {
4364
- const { kind: kind2 } = t;
4365
- let nextTypeInfo;
4366
- if (kind2 === SyntaxKind.TypeReference) {
4367
- const { typeName } = t;
4368
- const refNode = typeMap[typeName.getText()];
4369
- if (refNode) {
4370
- nextTypeInfo = getTypeInfoFromTypeAlias(refNode, typeMap);
4371
- }
4372
- } else if (kind2 === SyntaxKind.TypeLiteral) {
4373
- nextTypeInfo = getTypeInfo(t);
4374
- }
4375
- if (nextTypeInfo) {
4376
- const {
4377
- fields: existingFields = {},
4378
- unionFieldSets: existingFieldSets = []
4379
- } = typeInfo || {};
4380
- const { fields: nextFields, unionFieldSets: nextUnionFieldSets = [] } = nextTypeInfo;
4381
- if (isUnion && nextFields) {
4382
- const newUnionFieldSet = Object.keys(nextFields);
4383
- typeInfo = {
4384
- ...typeInfo,
4385
- unionFieldSets: [
4386
- ...existingFieldSets,
4387
- ...nextUnionFieldSets,
4388
- newUnionFieldSet
4389
- ]
4390
- };
4137
+ },
4138
+ tags: {},
4139
+ primaryField: "protocol"
4140
+ },
4141
+ Properties: {
4142
+ fields: {
4143
+ authSchemes: {
4144
+ type: "string",
4145
+ array: false,
4146
+ readonly: false,
4147
+ optional: true,
4148
+ tags: {}
4391
4149
  }
4392
- typeInfo = {
4393
- ...typeInfo,
4394
- fields: {
4395
- ...existingFields,
4396
- ...nextFields
4397
- }
4398
- };
4399
- }
4400
- }
4401
- return typeInfo;
4402
- };
4403
-
4404
- // src/common/TypeParsing/ParsingUtils/Constants.ts
4405
- var FIELD_FILTERS = {
4406
- OMIT: "Omit",
4407
- PICK: "Pick",
4408
- EXCLUDE: "Exclude"
4409
- };
4410
- var getUnionOrLiteralStringValues = (node) => {
4411
- let values = [];
4412
- if (node) {
4413
- if (node.kind === SyntaxKind.LiteralType) {
4414
- const { literal } = node;
4415
- if (literal.kind === SyntaxKind.StringLiteral || literal.kind === SyntaxKind.NumericLiteral) {
4416
- const { text } = literal;
4417
- values = [text];
4150
+ },
4151
+ tags: {},
4152
+ primaryField: "authSchemes"
4153
+ },
4154
+ RetryStrategy: {
4155
+ fields: {
4156
+ mode: {
4157
+ type: "string",
4158
+ array: false,
4159
+ readonly: false,
4160
+ optional: true,
4161
+ tags: {}
4162
+ },
4163
+ retry: {
4164
+ type: "string",
4165
+ array: false,
4166
+ readonly: false,
4167
+ optional: false,
4168
+ tags: {}
4418
4169
  }
4419
- } else if (node.kind === SyntaxKind.UnionType) {
4420
- const { types } = node;
4421
- for (const type of types) {
4422
- values = [...values, ...getUnionOrLiteralStringValues(type)];
4170
+ },
4171
+ tags: {},
4172
+ primaryField: "mode"
4173
+ },
4174
+ Credentials: {
4175
+ fields: {
4176
+ accessKeyId: {
4177
+ type: "string",
4178
+ array: false,
4179
+ readonly: false,
4180
+ optional: false,
4181
+ tags: {}
4182
+ },
4183
+ secretAccessKey: {
4184
+ type: "string",
4185
+ array: false,
4186
+ readonly: false,
4187
+ optional: false,
4188
+ tags: {}
4189
+ },
4190
+ sessionToken: {
4191
+ type: "string",
4192
+ array: false,
4193
+ readonly: false,
4194
+ optional: true,
4195
+ tags: {}
4196
+ },
4197
+ credentialScope: {
4198
+ type: "string",
4199
+ array: false,
4200
+ readonly: false,
4201
+ optional: true,
4202
+ tags: {}
4203
+ },
4204
+ expiration: {
4205
+ type: "string",
4206
+ array: false,
4207
+ readonly: false,
4208
+ optional: true,
4209
+ tags: {}
4423
4210
  }
4424
- }
4425
- }
4426
- return values;
4427
- };
4428
-
4429
- // src/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.ts
4430
- var getTypeInfoFromPickOmitFieldFilters = (typeNameStr, typeRef, typeMap) => {
4431
- const picking = typeNameStr === FIELD_FILTERS.PICK;
4432
- const omitTypeKind = typeRef.typeArguments?.[0].kind;
4433
- let typeInfo;
4434
- if (omitTypeKind === SyntaxKind.TypeReference && typeRef.typeArguments && typeRef.typeArguments[0].kind === SyntaxKind.TypeReference) {
4435
- const omitType = typeRef.typeArguments[0];
4436
- const omitTypeFields = typeRef.typeArguments[1];
4437
- const omitTypeName = omitType.typeName.getText();
4438
- const refNode = typeMap[omitTypeName];
4439
- if (refNode) {
4440
- const {
4441
- fields: existingFields = {},
4442
- unionFieldSets: existingUnionFieldSets,
4443
- ...typeInfoOther
4444
- } = getTypeInfoFromTypeAlias(refNode, typeMap) || {};
4445
- const omitFieldNames = getUnionOrLiteralStringValues(omitTypeFields);
4446
- const cleanTypeInfoFields = Object.keys(
4447
- existingFields
4448
- ).reduce(
4449
- (acc, key) => {
4450
- if (acc && (picking && omitFieldNames.includes(key) || !picking && !omitFieldNames.includes(key)) && existingFields[key]) {
4451
- acc[key] = existingFields[key];
4452
- }
4453
- return acc;
4454
- },
4455
- {}
4456
- );
4457
- const cleanUnionFieldSets = existingUnionFieldSets ? existingUnionFieldSets.map(
4458
- (fieldSet) => fieldSet.filter(
4459
- (field) => picking ? omitFieldNames.includes(field) : !omitFieldNames.includes(field)
4460
- )
4461
- ) : void 0;
4462
- typeInfo = {
4463
- ...typeInfoOther,
4464
- fields: cleanTypeInfoFields,
4465
- unionFieldSets: cleanUnionFieldSets
4466
- };
4467
- }
4468
- }
4469
- return typeInfo;
4470
- };
4471
- var getTypeInfoFromExcludeFieldFilter = (typeNameStr, typeRef, typeMap) => {
4472
- const baseTypeKind = typeRef.typeArguments?.[0].kind;
4473
- const excludeTypeKind = typeRef.typeArguments?.[1].kind;
4474
- let typeInfo;
4475
- if (baseTypeKind === SyntaxKind.TypeReference && excludeTypeKind === SyntaxKind.TypeReference && typeRef.typeArguments) {
4476
- const baseType = typeRef.typeArguments[0];
4477
- const excludeType = typeRef.typeArguments[1];
4478
- const baseTypeName = baseType.typeName.getText();
4479
- const excludeTypeName = excludeType.typeName.getText();
4480
- const refNode = typeMap[baseTypeName];
4481
- const excludeNode = typeMap[excludeTypeName];
4482
- if (refNode && excludeNode) {
4483
- const baseTypeInfo = getTypeInfoFromTypeAlias(refNode, typeMap);
4484
- const excludeTypeInfo = getTypeInfoFromTypeAlias(excludeNode, typeMap);
4485
- if (baseTypeInfo && excludeTypeInfo) {
4486
- const {
4487
- fields: baseFields = {},
4488
- unionFieldSets: existingUnionFieldSets
4489
- } = baseTypeInfo;
4490
- const { fields: excludeFields = {} } = excludeTypeInfo;
4491
- const excludeFieldNames = Object.keys(excludeFields);
4492
- const cleanTypeInfoFields = Object.keys(
4493
- baseFields
4494
- ).reduce(
4495
- (acc, key) => {
4496
- if (acc && !excludeFieldNames.includes(key) && baseFields[key]) {
4497
- acc[key] = baseFields[key];
4498
- }
4499
- return acc;
4500
- },
4501
- {}
4502
- );
4503
- const cleanUnionFieldSets = existingUnionFieldSets ? existingUnionFieldSets.map(
4504
- (fieldSet) => fieldSet.filter((field) => !excludeFieldNames.includes(field))
4505
- ) : void 0;
4506
- typeInfo = {
4507
- ...baseTypeInfo,
4508
- fields: cleanTypeInfoFields,
4509
- unionFieldSets: cleanUnionFieldSets
4510
- };
4211
+ },
4212
+ tags: {},
4213
+ primaryField: "accessKeyId"
4214
+ },
4215
+ Signer: {
4216
+ fields: {
4217
+ sign: {
4218
+ type: "string",
4219
+ array: false,
4220
+ readonly: false,
4221
+ optional: false,
4222
+ tags: {}
4511
4223
  }
4512
- }
4513
- }
4514
- return typeInfo;
4515
- };
4516
- var defaultFieldFilterProcessor = (typeNameStr, typeRef, typeMap) => {
4517
- const refNode = typeNameStr ? typeMap[typeNameStr] : void 0;
4518
- let typeInfo;
4519
- if (refNode) {
4520
- typeInfo = getTypeInfoFromTypeAlias(refNode, typeMap);
4521
- }
4522
- return typeInfo;
4523
- };
4524
- var FIELD_FILTER_PROCESSORS = {
4525
- [FIELD_FILTERS.PICK]: getTypeInfoFromPickOmitFieldFilters,
4526
- [FIELD_FILTERS.OMIT]: getTypeInfoFromPickOmitFieldFilters,
4527
- [FIELD_FILTERS.EXCLUDE]: getTypeInfoFromExcludeFieldFilter
4528
- };
4529
- var getTypeInfoFromFieldFilter = (typeNameStr, typeRef, typeMap) => {
4530
- const processor = typeNameStr ? FIELD_FILTER_PROCESSORS[typeNameStr] : void 0;
4531
- return processor ? processor(typeNameStr, typeRef, typeMap) : defaultFieldFilterProcessor(typeNameStr, typeRef, typeMap);
4532
- };
4533
-
4534
- // src/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.ts
4535
- var getTypeInfoFromTypeLiteral = (type) => getTypeInfo(type);
4536
- var getTypeInfoFromUnionOrIntersectionType = (type, typeMap) => getUnionOrIntersectionTypeInfo(type, typeMap);
4537
- var getTypeInfoFromTypeReference = (type, typeMap) => {
4538
- const typeRef = type;
4539
- const { typeName } = typeRef;
4540
- const typeNameStr = typeName.getText();
4541
- return getTypeInfoFromFieldFilter(typeNameStr, typeRef, typeMap);
4542
- };
4543
- var ALIAS_TYPE_PROCESSORS = {
4544
- [SyntaxKind.TypeLiteral]: getTypeInfoFromTypeLiteral,
4545
- [SyntaxKind.UnionType]: getTypeInfoFromUnionOrIntersectionType,
4546
- [SyntaxKind.IntersectionType]: getTypeInfoFromUnionOrIntersectionType,
4547
- [SyntaxKind.TypeReference]: getTypeInfoFromTypeReference
4548
- };
4549
- var getTypeInfoFromAliasType = (type, typeMap) => {
4550
- const { kind } = type;
4551
- const processor = ALIAS_TYPE_PROCESSORS[kind];
4552
- const typeInfo = processor ? processor(type, typeMap) : void 0;
4553
- return typeInfo;
4554
- };
4555
-
4556
- // src/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.ts
4557
- var getTypeInfoFromTypeAlias = (typeAliasDec, typeMap) => {
4558
- const { type } = typeAliasDec;
4559
- const tags = extractCommentTags(typeAliasDec);
4560
- const typeInfo = getTypeInfoFromAliasType(type, typeMap);
4561
- return typeInfo ? {
4562
- ...typeInfo,
4563
- tags: {
4564
- ...tags,
4565
- ...typeInfo.tags
4566
- }
4567
- } : void 0;
4568
- };
4569
-
4570
- // src/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.ts
4571
- var getPrimaryFieldForTypeInfo = (typeInfo) => {
4572
- const { fields } = typeInfo;
4573
- let primaryField = void 0, primaryFieldReadDenied = false;
4574
- for (const fieldName in fields) {
4575
- const field = fields[fieldName];
4576
- const {
4577
- tags: {
4578
- primaryField: isPrimaryField = false,
4579
- deniedOperations: { READ: readDenied = false } = {}
4580
- } = {}
4581
- } = field;
4582
- if (isPrimaryField || !primaryField) {
4583
- primaryField = fieldName;
4584
- primaryFieldReadDenied = readDenied;
4585
- }
4586
- if (isPrimaryField) {
4587
- break;
4588
- }
4589
- }
4590
- if (primaryFieldReadDenied) {
4591
- throw new Error(
4592
- "READ_DENIED_PRIMARY_FIELD_NOT_SUPPORTED" /* READ_DENIED_PRIMARY_FIELD_NOT_SUPPORTED */
4593
- );
4594
- }
4595
- return primaryField;
4596
- };
4597
-
4598
- // src/common/TypeParsing/TypeParsing.ts
4599
- var getTypeInfoMapFromTypeScript = (source) => {
4600
- const typeScriptNode = createSourceFile(
4601
- "x.ts",
4602
- source,
4603
- ScriptTarget.Latest,
4604
- true
4605
- );
4606
- const typeMap = convertASTToMap(typeScriptNode, {});
4607
- const typeInfoMap = {};
4608
- for (const key in typeMap) {
4609
- const typeAliasDec = typeMap[key];
4610
- const { modifiers } = typeAliasDec;
4611
- let outputTypeInfo = false;
4612
- if (modifiers) {
4613
- modifiers.forEach((modifier) => {
4614
- const { kind } = modifier;
4615
- if (kind === SyntaxKind.ExportKeyword) {
4616
- outputTypeInfo = true;
4224
+ },
4225
+ tags: {},
4226
+ primaryField: "sign"
4227
+ },
4228
+ AbridgedS3ClientConfig: {
4229
+ fields: {
4230
+ requestHandler: {
4231
+ type: "string",
4232
+ array: false,
4233
+ readonly: false,
4234
+ optional: true,
4235
+ tags: {}
4236
+ },
4237
+ apiVersion: {
4238
+ type: "string",
4239
+ array: false,
4240
+ readonly: false,
4241
+ optional: true,
4242
+ tags: {}
4243
+ },
4244
+ sha256: {
4245
+ type: "string",
4246
+ array: false,
4247
+ readonly: false,
4248
+ optional: true,
4249
+ tags: {}
4250
+ },
4251
+ urlParser: {
4252
+ type: "string",
4253
+ array: false,
4254
+ readonly: false,
4255
+ optional: true,
4256
+ tags: {}
4257
+ },
4258
+ bodyLengthChecker: {
4259
+ type: "string",
4260
+ array: false,
4261
+ readonly: false,
4262
+ optional: true,
4263
+ tags: {}
4264
+ },
4265
+ streamCollector: {
4266
+ type: "string",
4267
+ array: false,
4268
+ readonly: false,
4269
+ optional: true,
4270
+ tags: {}
4271
+ },
4272
+ base64Decoder: {
4273
+ type: "string",
4274
+ array: false,
4275
+ readonly: false,
4276
+ optional: true,
4277
+ tags: {}
4278
+ },
4279
+ base64Encoder: {
4280
+ type: "string",
4281
+ array: false,
4282
+ readonly: false,
4283
+ optional: true,
4284
+ tags: {}
4285
+ },
4286
+ utf8Decoder: {
4287
+ type: "string",
4288
+ array: false,
4289
+ readonly: false,
4290
+ optional: true,
4291
+ tags: {}
4292
+ },
4293
+ utf8Encoder: {
4294
+ type: "string",
4295
+ array: false,
4296
+ readonly: false,
4297
+ optional: true,
4298
+ tags: {}
4299
+ },
4300
+ runtime: {
4301
+ type: "string",
4302
+ array: false,
4303
+ readonly: false,
4304
+ optional: true,
4305
+ tags: {}
4306
+ },
4307
+ disableHostPrefix: {
4308
+ type: "string",
4309
+ array: false,
4310
+ readonly: false,
4311
+ optional: true,
4312
+ possibleValues: [],
4313
+ tags: {}
4314
+ },
4315
+ serviceId: {
4316
+ type: "string",
4317
+ array: false,
4318
+ readonly: false,
4319
+ optional: true,
4320
+ tags: {}
4321
+ },
4322
+ useDualstackEndpoint: {
4323
+ type: "string",
4324
+ array: false,
4325
+ readonly: false,
4326
+ optional: true,
4327
+ possibleValues: [],
4328
+ tags: {}
4329
+ },
4330
+ useFipsEndpoint: {
4331
+ type: "string",
4332
+ array: false,
4333
+ readonly: false,
4334
+ optional: true,
4335
+ possibleValues: [],
4336
+ tags: {}
4337
+ },
4338
+ region: {
4339
+ type: "string",
4340
+ array: false,
4341
+ readonly: false,
4342
+ optional: true,
4343
+ tags: {}
4344
+ },
4345
+ credentialDefaultProvider: {
4346
+ type: "string",
4347
+ array: false,
4348
+ readonly: false,
4349
+ optional: true,
4350
+ tags: {}
4351
+ },
4352
+ signingEscapePath: {
4353
+ type: "string",
4354
+ array: false,
4355
+ readonly: false,
4356
+ optional: true,
4357
+ possibleValues: [],
4358
+ tags: {}
4359
+ },
4360
+ useArnRegion: {
4361
+ type: "string",
4362
+ array: false,
4363
+ readonly: false,
4364
+ optional: true,
4365
+ possibleValues: [],
4366
+ tags: {}
4367
+ },
4368
+ defaultUserAgentProvider: {
4369
+ type: "string",
4370
+ array: false,
4371
+ readonly: false,
4372
+ optional: true,
4373
+ tags: {}
4374
+ },
4375
+ streamHasher: {
4376
+ type: "string",
4377
+ array: false,
4378
+ readonly: false,
4379
+ optional: true,
4380
+ tags: {}
4381
+ },
4382
+ md5: {
4383
+ type: "string",
4384
+ array: false,
4385
+ readonly: false,
4386
+ optional: true,
4387
+ tags: {}
4388
+ },
4389
+ sha1: {
4390
+ type: "string",
4391
+ array: false,
4392
+ readonly: false,
4393
+ optional: true,
4394
+ tags: {}
4395
+ },
4396
+ getAwsChunkedEncodingStream: {
4397
+ type: "string",
4398
+ array: false,
4399
+ readonly: false,
4400
+ optional: true,
4401
+ tags: {}
4402
+ },
4403
+ maxAttempts: {
4404
+ type: "string",
4405
+ array: false,
4406
+ readonly: false,
4407
+ optional: true,
4408
+ tags: {}
4409
+ },
4410
+ retryMode: {
4411
+ type: "string",
4412
+ array: false,
4413
+ readonly: false,
4414
+ optional: true,
4415
+ tags: {}
4416
+ },
4417
+ logger: {
4418
+ type: "string",
4419
+ array: false,
4420
+ readonly: false,
4421
+ optional: true,
4422
+ possibleValues: [],
4423
+ tags: {}
4424
+ },
4425
+ extensions: {
4426
+ type: "string",
4427
+ array: false,
4428
+ readonly: false,
4429
+ optional: true,
4430
+ tags: {}
4431
+ },
4432
+ eventStreamSerdeProvider: {
4433
+ type: "string",
4434
+ array: false,
4435
+ readonly: false,
4436
+ optional: true,
4437
+ tags: {}
4438
+ },
4439
+ defaultsMode: {
4440
+ type: "string",
4441
+ array: false,
4442
+ readonly: false,
4443
+ optional: true,
4444
+ possibleValues: [
4445
+ "standard",
4446
+ "in-region",
4447
+ "cross-region",
4448
+ "mobile",
4449
+ "auto",
4450
+ "legacy"
4451
+ ],
4452
+ tags: {
4453
+ allowCustomSelection: true
4617
4454
  }
4618
- });
4619
- }
4620
- if (outputTypeInfo) {
4621
- const typeInfo = getTypeInfoFromTypeAlias(typeAliasDec, typeMap);
4622
- if (typeInfo) {
4623
- typeInfoMap[key] = {
4624
- ...typeInfo,
4625
- primaryField: getPrimaryFieldForTypeInfo(typeInfo)
4626
- };
4455
+ },
4456
+ sdkStreamMixin: {
4457
+ type: "string",
4458
+ array: false,
4459
+ readonly: false,
4460
+ optional: true,
4461
+ tags: {}
4462
+ },
4463
+ endpoint: {
4464
+ type: "string",
4465
+ array: false,
4466
+ readonly: false,
4467
+ optional: true,
4468
+ possibleValues: [],
4469
+ tags: {}
4470
+ },
4471
+ endpointProvider: {
4472
+ type: "string",
4473
+ array: false,
4474
+ readonly: false,
4475
+ optional: true,
4476
+ tags: {}
4477
+ },
4478
+ tls: {
4479
+ type: "string",
4480
+ array: false,
4481
+ readonly: false,
4482
+ optional: true,
4483
+ possibleValues: [],
4484
+ tags: {}
4485
+ },
4486
+ retryStrategy: {
4487
+ type: "string",
4488
+ array: false,
4489
+ readonly: false,
4490
+ optional: true,
4491
+ possibleValues: [],
4492
+ tags: {}
4493
+ },
4494
+ credentials: {
4495
+ type: "string",
4496
+ array: false,
4497
+ readonly: false,
4498
+ optional: true,
4499
+ possibleValues: [],
4500
+ tags: {}
4501
+ },
4502
+ signer: {
4503
+ type: "string",
4504
+ array: false,
4505
+ readonly: false,
4506
+ optional: true,
4507
+ possibleValues: [],
4508
+ tags: {}
4509
+ },
4510
+ systemClockOffset: {
4511
+ type: "string",
4512
+ array: false,
4513
+ readonly: false,
4514
+ optional: true,
4515
+ tags: {}
4516
+ },
4517
+ signingRegion: {
4518
+ type: "string",
4519
+ array: false,
4520
+ readonly: false,
4521
+ optional: true,
4522
+ tags: {}
4523
+ },
4524
+ signerConstructor: {
4525
+ type: "string",
4526
+ array: false,
4527
+ readonly: false,
4528
+ optional: true,
4529
+ tags: {}
4530
+ },
4531
+ forcePathStyle: {
4532
+ type: "string",
4533
+ array: false,
4534
+ readonly: false,
4535
+ optional: true,
4536
+ possibleValues: [],
4537
+ tags: {}
4538
+ },
4539
+ useAccelerateEndpoint: {
4540
+ type: "string",
4541
+ array: false,
4542
+ readonly: false,
4543
+ optional: true,
4544
+ possibleValues: [],
4545
+ tags: {}
4546
+ },
4547
+ disableMultiregionAccessPoints: {
4548
+ type: "string",
4549
+ array: false,
4550
+ readonly: false,
4551
+ optional: true,
4552
+ possibleValues: [],
4553
+ tags: {}
4554
+ },
4555
+ followRegionRedirects: {
4556
+ type: "string",
4557
+ array: false,
4558
+ readonly: false,
4559
+ optional: true,
4560
+ possibleValues: [],
4561
+ tags: {}
4562
+ },
4563
+ s3ExpressIdentityProvider: {
4564
+ type: "string",
4565
+ array: false,
4566
+ readonly: false,
4567
+ optional: true,
4568
+ tags: {}
4569
+ },
4570
+ customUserAgent: {
4571
+ type: "string",
4572
+ array: false,
4573
+ readonly: false,
4574
+ optional: true,
4575
+ tags: {}
4576
+ },
4577
+ useGlobalEndpoint: {
4578
+ type: "string",
4579
+ array: false,
4580
+ readonly: false,
4581
+ optional: true,
4582
+ possibleValues: [],
4583
+ tags: {}
4584
+ },
4585
+ disableS3ExpressSessionAuth: {
4586
+ type: "string",
4587
+ array: false,
4588
+ readonly: false,
4589
+ optional: true,
4590
+ possibleValues: [],
4591
+ tags: {}
4627
4592
  }
4628
- }
4593
+ },
4594
+ tags: {},
4595
+ primaryField: "requestHandler"
4596
+ },
4597
+ S3SpecificConfig: {
4598
+ fields: {
4599
+ s3Config: {
4600
+ type: "string",
4601
+ array: false,
4602
+ readonly: false,
4603
+ optional: true,
4604
+ typeReference: "AbridgedS3ClientConfig",
4605
+ tags: {}
4606
+ },
4607
+ bucketName: {
4608
+ type: "string",
4609
+ array: false,
4610
+ readonly: false,
4611
+ optional: false,
4612
+ tags: {}
4613
+ },
4614
+ urlExpirationInSeconds: {
4615
+ type: "number",
4616
+ array: false,
4617
+ readonly: false,
4618
+ optional: true,
4619
+ tags: {}
4620
+ }
4621
+ },
4622
+ tags: {},
4623
+ primaryField: "s3Config"
4629
4624
  }
4630
- return typeInfoMap;
4631
4625
  };
4632
4626
 
4633
- // src/common/TypeParsing/Validation.ts
4634
- var Validation_exports = {};
4635
- __export(Validation_exports, {
4636
- DENIED_TYPE_OPERATIONS: () => DENIED_TYPE_OPERATIONS,
4637
- ERROR_MESSAGE_CONSTANTS: () => ERROR_MESSAGE_CONSTANTS,
4638
- INVALID_CUSTOM_TYPE: () => INVALID_CUSTOM_TYPE,
4639
- PRIMITIVE_ERROR_MESSAGE_CONSTANTS: () => PRIMITIVE_ERROR_MESSAGE_CONSTANTS,
4640
- RelationshipValidationType: () => RelationshipValidationType,
4641
- TYPE_KEYWORD_VALIDATORS: () => TYPE_KEYWORD_VALIDATORS,
4642
- getValidityValue: () => getValidityValue,
4643
- hasValue: () => hasValue,
4644
- validateArrayOfTypeInfoFieldValues: () => validateArrayOfTypeInfoFieldValues,
4645
- validateCustomType: () => validateCustomType,
4646
- validateKeywordType: () => validateKeywordType,
4647
- validateTypeInfoFieldOperationAllowed: () => validateTypeInfoFieldOperationAllowed,
4648
- validateTypeInfoFieldValue: () => validateTypeInfoFieldValue,
4649
- validateTypeInfoValue: () => validateTypeInfoValue,
4650
- validateTypeOperationAllowed: () => validateTypeOperationAllowed,
4651
- validateValueMatchesPattern: () => validateValueMatchesPattern
4652
- });
4653
-
4654
- // src/common/TypeParsing/TypeInfo.ts
4655
- var TypeInfo_exports = {};
4656
- __export(TypeInfo_exports, {
4657
- TypeOperation: () => TypeOperation
4658
- });
4659
- var TypeOperation = /* @__PURE__ */ ((TypeOperation2) => {
4660
- TypeOperation2["CREATE"] = "CREATE";
4661
- TypeOperation2["READ"] = "READ";
4662
- TypeOperation2["UPDATE"] = "UPDATE";
4663
- TypeOperation2["DELETE"] = "DELETE";
4664
- return TypeOperation2;
4665
- })(TypeOperation || {});
4666
-
4667
- // src/common/TypeParsing/Validation.ts
4668
- var RelationshipValidationType = /* @__PURE__ */ ((RelationshipValidationType2) => {
4669
- RelationshipValidationType2["INCLUDE"] = "INCLUDE";
4670
- RelationshipValidationType2["EXCLUDE"] = "EXCLUDE";
4671
- RelationshipValidationType2["STRICT_EXCLUDE"] = "STRICT_EXCLUDE";
4672
- return RelationshipValidationType2;
4673
- })(RelationshipValidationType || {});
4674
- var INVALID_CUSTOM_TYPE = "INVALID_CUSTOM_TYPE";
4675
- var PRIMITIVE_ERROR_MESSAGE_CONSTANTS = {
4676
- string: "NOT_A_STRING",
4677
- number: "NOT_A_NUMBER",
4678
- boolean: "NOT_A_BOOLEAN"
4679
- };
4680
- var ERROR_MESSAGE_CONSTANTS = {
4681
- MISSING: "MISSING",
4682
- INVALID_OPTION: "INVALID_OPTION",
4683
- INVALID_FIELD: "INVALID_FIELD",
4684
- RELATIONSHIP_VALUES_ARE_STRICTLY_EXCLUDED: "RELATIONSHIP_VALUES_ARE_STRICTLY_EXCLUDED",
4685
- INVALID_TYPE: "INVALID_TYPE",
4686
- NO_UNION_TYPE_MATCHED: "NO_UNION_TYPE_MATCHED",
4687
- TYPE_DOES_NOT_EXIST: "TYPE_DOES_NOT_EXIST",
4688
- INVALID_PATTERN: "INVALID_PATTERN",
4689
- VALUE_DOES_NOT_MATCH_PATTERN: "VALUE_DOES_NOT_MATCH_PATTERN"
4690
- };
4691
- var DENIED_TYPE_OPERATIONS = {
4692
- CREATE: "DENIED_TYPE_OPERATION_CREATE",
4693
- READ: "DENIED_TYPE_OPERATION_READ",
4694
- UPDATE: "DENIED_TYPE_OPERATION_UPDATE",
4695
- DELETE: "DENIED_TYPE_OPERATION_DELETE"
4696
- };
4697
- var validateValueMatchesPattern = (typeName, value, pattern) => {
4698
- const results = {
4699
- typeName,
4700
- valid: true,
4701
- error: "",
4702
- errorMap: {}
4703
- };
4704
- const valueSupplied = typeof value !== "undefined";
4705
- const patternSupplied = typeof pattern === "string" && pattern.trim() !== "";
4706
- if (!valueSupplied || !patternSupplied) {
4707
- try {
4708
- const regex = new RegExp(pattern);
4709
- const testResult = typeof value === "string" && regex.test(value);
4710
- if (!testResult) {
4711
- results.valid = false;
4712
- results.error = ERROR_MESSAGE_CONSTANTS.VALUE_DOES_NOT_MATCH_PATTERN;
4713
- }
4714
- } catch (e) {
4715
- results.valid = false;
4716
- results.error = ERROR_MESSAGE_CONSTANTS.INVALID_PATTERN;
4717
- }
4718
- }
4719
- return results;
4720
- };
4721
- var getValidityValue = (existing, pending) => !existing ? false : pending;
4722
- var TYPE_KEYWORD_VALIDATORS = {
4723
- string: (value) => typeof value === "string",
4724
- number: (value) => typeof value === "number",
4725
- boolean: (value) => typeof value === "boolean"
4726
- };
4727
- var hasValue = (value) => value ?? false;
4728
- var validateKeywordType = (value, type) => {
4729
- const validator = TYPE_KEYWORD_VALIDATORS[type];
4730
- let valid = true;
4731
- if (validator) {
4732
- valid = validator(value);
4733
- }
4734
- return valid;
4735
- };
4736
- var validateCustomType = (value, customType, customValidators) => {
4737
- let valid = true;
4738
- if (customValidators && customType) {
4739
- const validator = customValidators[customType];
4740
- if (validator) {
4741
- try {
4742
- valid = validator(value);
4743
- } catch (e) {
4744
- valid = false;
4745
- }
4746
- }
4747
- }
4748
- return valid;
4749
- };
4750
- var validateTypeInfoFieldValue = (value, typeInfoField, typeInfoMap, ignoreArray = false, strict = false, customValidators, typeOperation, relationshipValidationType = "STRICT_EXCLUDE" /* STRICT_EXCLUDE */, itemIsPartial) => {
4751
- const {
4752
- type,
4753
- typeReference,
4754
- array,
4755
- optional,
4756
- possibleValues,
4757
- tags: { customType, constraints: { pattern = void 0 } = {} } = {}
4758
- } = typeInfoField;
4759
- const results = {
4760
- typeName: typeReference ?? type,
4761
- valid: true,
4762
- error: "",
4763
- errorMap: {}
4764
- };
4765
- const requiredValueAllowed = !typeReference || relationshipValidationType === "INCLUDE" /* INCLUDE */;
4766
- if (requiredValueAllowed && !itemIsPartial && !optional && !hasValue(value)) {
4767
- results.valid = false;
4768
- results.error = ERROR_MESSAGE_CONSTANTS.MISSING;
4769
- } else if (array && !ignoreArray) {
4770
- const {
4771
- valid: validArray,
4772
- error: arrayError,
4773
- errorMap: arrayErrorMap
4774
- } = validateArrayOfTypeInfoFieldValues(
4775
- value,
4776
- typeInfoField,
4777
- typeInfoMap,
4778
- strict,
4779
- customValidators,
4780
- typeOperation,
4781
- relationshipValidationType,
4782
- itemIsPartial
4783
- );
4784
- results.valid = getValidityValue(results.valid, validArray);
4785
- results.error = arrayError;
4786
- results.errorMap = arrayErrorMap;
4787
- } else {
4788
- if (typeReference) {
4789
- if (relationshipValidationType === "INCLUDE" /* INCLUDE */) {
4790
- const {
4791
- valid: validTypeInfo,
4792
- error: typeInfoError,
4793
- errorMap: typeInfoErrorMap
4794
- } = validateTypeInfoValue(
4795
- value,
4796
- typeReference,
4797
- typeInfoMap,
4798
- strict,
4799
- customValidators,
4800
- typeOperation,
4801
- relationshipValidationType,
4802
- itemIsPartial
4803
- );
4804
- results.valid = getValidityValue(results.valid, validTypeInfo);
4805
- results.error = typeInfoError;
4806
- results.errorMap = typeInfoErrorMap;
4807
- } else if (relationshipValidationType === "STRICT_EXCLUDE" /* STRICT_EXCLUDE */) {
4808
- const valueSupplied = typeof value !== "undefined";
4809
- if (valueSupplied) {
4810
- results.valid = false;
4811
- results.error = ERROR_MESSAGE_CONSTANTS.RELATIONSHIP_VALUES_ARE_STRICTLY_EXCLUDED;
4812
- }
4813
- } else if (relationshipValidationType === "EXCLUDE" /* EXCLUDE */) {
4814
- results.valid = getValidityValue(results.valid, true);
4815
- }
4816
- } else if (possibleValues && !possibleValues.includes(value)) {
4817
- results.valid = false;
4818
- results.error = ERROR_MESSAGE_CONSTANTS.INVALID_OPTION;
4819
- } else {
4820
- const pendingValid = validateKeywordType(value, type);
4821
- const customValid = validateCustomType(
4822
- value,
4823
- customType,
4824
- customValidators
4825
- );
4826
- results.valid = getValidityValue(results.valid, pendingValid);
4827
- results.valid = getValidityValue(results.valid, customValid);
4828
- if (type === "string" && typeof pattern === "string") {
4829
- const { valid: patternValid, error: patternError } = validateValueMatchesPattern(value, pattern);
4830
- results.valid = getValidityValue(results.valid, patternValid);
4831
- results.error = patternError;
4832
- }
4833
- if (!customValid) {
4834
- results.error = INVALID_CUSTOM_TYPE;
4835
- } else if (!results.valid) {
4836
- results.error = results.error ? results.error : PRIMITIVE_ERROR_MESSAGE_CONSTANTS[type];
4837
- }
4838
- }
4839
- }
4840
- return results;
4841
- };
4842
- var validateArrayOfTypeInfoFieldValues = (values = [], typeInfoField, typeInfoMap, strict = false, customValidators, typeOperation, relationshipValidationType, itemIsPartial) => {
4843
- const { type, typeReference } = typeInfoField;
4844
- const results = {
4845
- typeName: typeReference ?? type,
4846
- valid: true,
4847
- error: "",
4848
- errorMap: {}
4849
- };
4850
- for (let i = 0; i < values.length; i++) {
4851
- const v = values[i];
4852
- const {
4853
- valid: indexValid,
4854
- error: indexError = "",
4855
- errorMap: indexErrorMap
4856
- } = validateTypeInfoFieldValue(
4857
- v,
4858
- typeInfoField,
4859
- typeInfoMap,
4860
- true,
4861
- strict,
4862
- customValidators,
4863
- typeOperation,
4864
- relationshipValidationType,
4865
- itemIsPartial
4866
- );
4867
- results.valid = getValidityValue(results.valid, indexValid);
4868
- results.errorMap[getPathString([i])] = [indexError];
4869
- for (const er in indexErrorMap) {
4870
- results.errorMap[getPathString([i, er])] = indexErrorMap[er];
4871
- }
4872
- }
4873
- return results;
4874
- };
4875
- var validateTypeInfoFieldOperationAllowed = (fieldName, fieldOperation, typeInfoField) => {
4876
- const results = {
4877
- typeName: null,
4878
- valid: true,
4879
- error: "",
4880
- errorMap: {}
4881
- };
4882
- if (fieldOperation && typeInfoField) {
4883
- const {
4884
- type,
4885
- typeReference,
4886
- tags = {}
4887
- } = typeInfoField || {};
4888
- const { deniedOperations: { [fieldOperation]: denied = false } = {} } = tags;
4889
- results.typeName = typeReference ?? type;
4890
- results.valid = !denied;
4891
- if (!results.valid) {
4892
- results.error = DENIED_TYPE_OPERATIONS[fieldOperation];
4893
- results.errorMap[fieldName] = [results.error];
4894
- }
4895
- }
4896
- return results;
4897
- };
4898
- var validateTypeOperationAllowed = (typeName, valueFields, typeOperation, typeInfo) => {
4899
- const results = {
4900
- typeName,
4901
- valid: true,
4902
- error: "",
4903
- errorMap: {}
4904
- };
4905
- const { fields = {}, tags = {} } = typeInfo;
4906
- const { deniedOperations: { [typeOperation]: denied = false } = {} } = tags;
4907
- if (denied) {
4908
- results.valid = false;
4909
- results.error = DENIED_TYPE_OPERATIONS[typeOperation];
4910
- } else {
4911
- for (const vF of valueFields) {
4912
- const vFieldInfo = fields[vF];
4913
- const { valid: vFValid, error: vFError } = validateTypeInfoFieldOperationAllowed(vF, typeOperation, vFieldInfo);
4914
- results.valid = getValidityValue(results.valid, vFValid);
4915
- if (!vFValid) {
4916
- results.errorMap[vF] = [vFError];
4917
- }
4918
- }
4919
- }
4920
- return results;
4921
- };
4922
- var validateTypeInfoValue = (value, typeInfoFullName, typeInfoMap, strict = false, customValidators, typeOperation, relationshipValidationType, itemIsPartial) => {
4923
- const typeInfo = typeInfoMap[typeInfoFullName];
4924
- const results = {
4925
- typeName: typeInfoFullName,
4926
- valid: !!typeInfo,
4927
- error: !!typeInfo ? "" : ERROR_MESSAGE_CONSTANTS.TYPE_DOES_NOT_EXIST,
4928
- errorMap: {}
4929
- };
4930
- if (typeInfo) {
4931
- const { primaryField, fields, unionFieldSets } = typeInfo;
4932
- if (typeOperation) {
4933
- const valueFields = typeof value === "object" ? Object.keys(value ?? {}) : [];
4934
- const {
4935
- valid: operationValid,
4936
- error: operationError,
4937
- errorMap: operationErrorMap
4938
- } = validateTypeOperationAllowed(
4939
- typeInfoFullName,
4940
- valueFields,
4941
- typeOperation,
4942
- typeInfo
4943
- );
4944
- results.valid = getValidityValue(results.valid, operationValid);
4945
- results.error = operationError;
4946
- for (const oE in operationErrorMap) {
4947
- const existingError = results.errorMap[oE] ?? [];
4948
- results.errorMap[oE] = existingError ? [...existingError, ...operationErrorMap[oE]] : operationErrorMap[oE];
4949
- }
4950
- if (!operationValid && operationError) {
4951
- results.error = operationError;
4952
- }
4953
- }
4954
- if (unionFieldSets) {
4955
- const valueFields = Object.keys(value || {});
4956
- let valid = false;
4957
- for (const uFS of unionFieldSets) {
4958
- valid = valueFields.every((vF) => uFS.includes(vF));
4959
- if (valid) {
4960
- break;
4961
- }
4962
- }
4963
- if (!valid) {
4964
- results.valid = false;
4965
- results.error = ERROR_MESSAGE_CONSTANTS.NO_UNION_TYPE_MATCHED;
4966
- }
4967
- } else if (strict) {
4968
- const knownFields = Object.keys(fields || {});
4969
- const valueFields = Object.keys(value || {});
4970
- for (const vF of valueFields) {
4971
- if (!knownFields.includes(vF)) {
4972
- results.valid = false;
4973
- results.errorMap[vF] = [ERROR_MESSAGE_CONSTANTS.INVALID_FIELD];
4974
- }
4975
- }
4976
- }
4977
- if (fields) {
4978
- for (const key in fields) {
4979
- if (typeOperation !== "CREATE" /* CREATE */ || typeof primaryField !== "string" || key !== primaryField) {
4980
- const typeInfoField = fields[key];
4981
- const fieldValue = value[key];
4982
- const {
4983
- valid: fieldValid,
4984
- error: fieldError,
4985
- errorMap: fieldErrorMap
4986
- } = validateTypeInfoFieldValue(
4987
- fieldValue,
4988
- typeInfoField,
4989
- typeInfoMap,
4990
- false,
4991
- strict,
4992
- customValidators,
4993
- typeOperation,
4994
- relationshipValidationType,
4995
- itemIsPartial
4996
- );
4997
- results.valid = getValidityValue(results.valid, fieldValid);
4998
- results.errorMap[key] = [fieldError];
4999
- for (const fE in fieldErrorMap) {
5000
- results.errorMap[getPathString([key, fE])] = fieldErrorMap[fE];
5001
- }
5002
- }
5003
- }
5004
- }
5005
- if (!results.valid && !results.error) {
5006
- results.error = ERROR_MESSAGE_CONSTANTS.INVALID_TYPE;
5007
- }
5008
- }
5009
- return results;
5010
- };
5011
-
5012
- // src/common/TypeParsing/Constants.ts
5013
- var Constants_exports = {};
5014
- __export(Constants_exports, {
5015
- BUILTIN_TYPE_NAMES: () => BUILTIN_TYPE_NAMES
5016
- });
5017
- var BUILTIN_TYPE_NAMES = [
5018
- "string",
5019
- "number",
5020
- "boolean",
5021
- "null",
5022
- "object",
5023
- "array",
5024
- "any",
5025
- "unknown",
5026
- "never"
5027
- ];
5028
-
5029
4627
  // src/api/ORM/drivers/S3FileItemDBDriver.ts
5030
- var moduleDirname = typeof __dirname === "string" ? __dirname : Path5.dirname(fileURLToPath(import.meta.url));
5031
4628
  var S3FileItemDBDriver = class {
5032
4629
  /**
5033
4630
  * @param config Driver configuration including S3 settings.
@@ -5219,20 +4816,424 @@ var S3SupportedFileItemDBDriverEntry = {
5219
4816
  * @returns Type info pack for the S3 config.
5220
4817
  */
5221
4818
  getDBSpecificConfigTypeInfo: () => {
5222
- const configTypesPath = Path5.join(
5223
- moduleDirname,
5224
- "S3FileItemDBDriver",
5225
- "ConfigTypes.ts"
5226
- );
5227
- const configTypesTS = FS.readFileSync(configTypesPath, "utf8");
5228
- const typeInfoMap = getTypeInfoMapFromTypeScript(configTypesTS);
5229
4819
  return {
5230
4820
  entryTypeName: "S3SpecificConfig",
5231
- typeInfoMap
4821
+ typeInfoMap: ConfigTypeInfoMap_default
5232
4822
  };
5233
4823
  }
5234
4824
  };
5235
- var moduleDirname2 = typeof __dirname === "string" ? __dirname : Path5.dirname(fileURLToPath(import.meta.url));
4825
+
4826
+ // src/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypeInfoMap.json
4827
+ var ConfigTypeInfoMap_default2 = {
4828
+ Logger: {
4829
+ fields: {
4830
+ trace: {
4831
+ type: "string",
4832
+ array: false,
4833
+ readonly: false,
4834
+ optional: true,
4835
+ possibleValues: [],
4836
+ tags: {}
4837
+ },
4838
+ debug: {
4839
+ type: "string",
4840
+ array: false,
4841
+ readonly: false,
4842
+ optional: false,
4843
+ typeReference: "Trace",
4844
+ tags: {}
4845
+ },
4846
+ info: {
4847
+ type: "string",
4848
+ array: false,
4849
+ readonly: false,
4850
+ optional: false,
4851
+ typeReference: "Trace",
4852
+ tags: {}
4853
+ },
4854
+ warn: {
4855
+ type: "string",
4856
+ array: false,
4857
+ readonly: false,
4858
+ optional: false,
4859
+ typeReference: "Trace",
4860
+ tags: {}
4861
+ },
4862
+ error: {
4863
+ type: "string",
4864
+ array: false,
4865
+ readonly: false,
4866
+ optional: false,
4867
+ typeReference: "Trace",
4868
+ tags: {}
4869
+ }
4870
+ },
4871
+ tags: {},
4872
+ primaryField: "trace"
4873
+ },
4874
+ Endpoint: {
4875
+ fields: {
4876
+ protocol: {
4877
+ type: "string",
4878
+ array: false,
4879
+ readonly: false,
4880
+ optional: false,
4881
+ tags: {}
4882
+ },
4883
+ hostname: {
4884
+ type: "string",
4885
+ array: false,
4886
+ readonly: false,
4887
+ optional: false,
4888
+ tags: {}
4889
+ },
4890
+ port: {
4891
+ type: "string",
4892
+ array: false,
4893
+ readonly: false,
4894
+ optional: true,
4895
+ tags: {}
4896
+ },
4897
+ path: {
4898
+ type: "string",
4899
+ array: false,
4900
+ readonly: false,
4901
+ optional: false,
4902
+ tags: {}
4903
+ },
4904
+ query: {
4905
+ type: "string",
4906
+ array: false,
4907
+ readonly: false,
4908
+ optional: true,
4909
+ tags: {}
4910
+ }
4911
+ },
4912
+ tags: {},
4913
+ primaryField: "protocol"
4914
+ },
4915
+ RetryStrategy: {
4916
+ fields: {
4917
+ mode: {
4918
+ type: "string",
4919
+ array: false,
4920
+ readonly: false,
4921
+ optional: true,
4922
+ tags: {}
4923
+ },
4924
+ retry: {
4925
+ type: "string",
4926
+ array: false,
4927
+ readonly: false,
4928
+ optional: false,
4929
+ tags: {}
4930
+ }
4931
+ },
4932
+ tags: {},
4933
+ primaryField: "mode"
4934
+ },
4935
+ DynamoDBSpecificConfig: {
4936
+ fields: {
4937
+ requestHandler: {
4938
+ type: "string",
4939
+ array: false,
4940
+ readonly: false,
4941
+ optional: true,
4942
+ tags: {}
4943
+ },
4944
+ apiVersion: {
4945
+ type: "string",
4946
+ array: false,
4947
+ readonly: false,
4948
+ optional: true,
4949
+ tags: {}
4950
+ },
4951
+ sha256: {
4952
+ type: "string",
4953
+ array: false,
4954
+ readonly: false,
4955
+ optional: true,
4956
+ tags: {}
4957
+ },
4958
+ urlParser: {
4959
+ type: "string",
4960
+ array: false,
4961
+ readonly: false,
4962
+ optional: true,
4963
+ tags: {}
4964
+ },
4965
+ bodyLengthChecker: {
4966
+ type: "string",
4967
+ array: false,
4968
+ readonly: false,
4969
+ optional: true,
4970
+ tags: {}
4971
+ },
4972
+ streamCollector: {
4973
+ type: "string",
4974
+ array: false,
4975
+ readonly: false,
4976
+ optional: true,
4977
+ tags: {}
4978
+ },
4979
+ base64Decoder: {
4980
+ type: "string",
4981
+ array: false,
4982
+ readonly: false,
4983
+ optional: true,
4984
+ tags: {}
4985
+ },
4986
+ base64Encoder: {
4987
+ type: "string",
4988
+ array: false,
4989
+ readonly: false,
4990
+ optional: true,
4991
+ tags: {}
4992
+ },
4993
+ utf8Decoder: {
4994
+ type: "string",
4995
+ array: false,
4996
+ readonly: false,
4997
+ optional: true,
4998
+ tags: {}
4999
+ },
5000
+ utf8Encoder: {
5001
+ type: "string",
5002
+ array: false,
5003
+ readonly: false,
5004
+ optional: true,
5005
+ tags: {}
5006
+ },
5007
+ runtime: {
5008
+ type: "string",
5009
+ array: false,
5010
+ readonly: false,
5011
+ optional: true,
5012
+ tags: {}
5013
+ },
5014
+ disableHostPrefix: {
5015
+ type: "string",
5016
+ array: false,
5017
+ readonly: false,
5018
+ optional: true,
5019
+ possibleValues: [],
5020
+ tags: {}
5021
+ },
5022
+ serviceId: {
5023
+ type: "string",
5024
+ array: false,
5025
+ readonly: false,
5026
+ optional: true,
5027
+ tags: {}
5028
+ },
5029
+ useDualstackEndpoint: {
5030
+ type: "string",
5031
+ array: false,
5032
+ readonly: false,
5033
+ optional: true,
5034
+ possibleValues: [],
5035
+ tags: {}
5036
+ },
5037
+ useFipsEndpoint: {
5038
+ type: "string",
5039
+ array: false,
5040
+ readonly: false,
5041
+ optional: true,
5042
+ possibleValues: [],
5043
+ tags: {}
5044
+ },
5045
+ defaultUserAgentProvider: {
5046
+ type: "string",
5047
+ array: false,
5048
+ readonly: false,
5049
+ optional: true,
5050
+ tags: {}
5051
+ },
5052
+ region: {
5053
+ type: "string",
5054
+ array: false,
5055
+ readonly: false,
5056
+ optional: true,
5057
+ tags: {}
5058
+ },
5059
+ credentialDefaultProvider: {
5060
+ type: "string",
5061
+ array: false,
5062
+ readonly: false,
5063
+ optional: true,
5064
+ tags: {}
5065
+ },
5066
+ maxAttempts: {
5067
+ type: "string",
5068
+ array: false,
5069
+ readonly: false,
5070
+ optional: true,
5071
+ tags: {}
5072
+ },
5073
+ retryMode: {
5074
+ type: "string",
5075
+ array: false,
5076
+ readonly: false,
5077
+ optional: true,
5078
+ tags: {}
5079
+ },
5080
+ logger: {
5081
+ type: "string",
5082
+ array: false,
5083
+ readonly: false,
5084
+ optional: true,
5085
+ possibleValues: [],
5086
+ tags: {}
5087
+ },
5088
+ extensions: {
5089
+ type: "string",
5090
+ array: false,
5091
+ readonly: false,
5092
+ optional: true,
5093
+ tags: {}
5094
+ },
5095
+ defaultsMode: {
5096
+ type: "string",
5097
+ array: false,
5098
+ readonly: false,
5099
+ optional: true,
5100
+ possibleValues: [
5101
+ "standard",
5102
+ "in-region",
5103
+ "cross-region",
5104
+ "mobile",
5105
+ "auto",
5106
+ "legacy"
5107
+ ],
5108
+ tags: {
5109
+ allowCustomSelection: true
5110
+ }
5111
+ },
5112
+ endpointDiscoveryEnabledProvider: {
5113
+ type: "string",
5114
+ array: false,
5115
+ readonly: false,
5116
+ optional: true,
5117
+ tags: {}
5118
+ },
5119
+ endpoint: {
5120
+ type: "string",
5121
+ array: false,
5122
+ readonly: false,
5123
+ optional: true,
5124
+ possibleValues: [],
5125
+ tags: {}
5126
+ },
5127
+ endpointProvider: {
5128
+ type: "string",
5129
+ array: false,
5130
+ readonly: false,
5131
+ optional: true,
5132
+ tags: {}
5133
+ },
5134
+ tls: {
5135
+ type: "string",
5136
+ array: false,
5137
+ readonly: false,
5138
+ optional: true,
5139
+ possibleValues: [],
5140
+ tags: {}
5141
+ },
5142
+ retryStrategy: {
5143
+ type: "string",
5144
+ array: false,
5145
+ readonly: false,
5146
+ optional: true,
5147
+ possibleValues: [],
5148
+ tags: {}
5149
+ },
5150
+ customUserAgent: {
5151
+ type: "string",
5152
+ array: false,
5153
+ readonly: false,
5154
+ optional: true,
5155
+ tags: {}
5156
+ },
5157
+ httpAuthSchemes: {
5158
+ type: "string",
5159
+ array: false,
5160
+ readonly: false,
5161
+ optional: true,
5162
+ tags: {}
5163
+ },
5164
+ httpAuthSchemeProvider: {
5165
+ type: "string",
5166
+ array: false,
5167
+ readonly: false,
5168
+ optional: true,
5169
+ tags: {}
5170
+ },
5171
+ credentials: {
5172
+ type: "string",
5173
+ array: false,
5174
+ readonly: false,
5175
+ optional: true,
5176
+ tags: {}
5177
+ },
5178
+ signer: {
5179
+ type: "string",
5180
+ array: false,
5181
+ readonly: false,
5182
+ optional: true,
5183
+ tags: {}
5184
+ },
5185
+ signingEscapePath: {
5186
+ type: "string",
5187
+ array: false,
5188
+ readonly: false,
5189
+ optional: true,
5190
+ possibleValues: [],
5191
+ tags: {}
5192
+ },
5193
+ systemClockOffset: {
5194
+ type: "string",
5195
+ array: false,
5196
+ readonly: false,
5197
+ optional: true,
5198
+ tags: {}
5199
+ },
5200
+ signingRegion: {
5201
+ type: "string",
5202
+ array: false,
5203
+ readonly: false,
5204
+ optional: true,
5205
+ tags: {}
5206
+ },
5207
+ signerConstructor: {
5208
+ type: "string",
5209
+ array: false,
5210
+ readonly: false,
5211
+ optional: true,
5212
+ tags: {}
5213
+ },
5214
+ endpointCacheSize: {
5215
+ type: "string",
5216
+ array: false,
5217
+ readonly: false,
5218
+ optional: true,
5219
+ tags: {}
5220
+ },
5221
+ endpointDiscoveryEnabled: {
5222
+ type: "string",
5223
+ array: false,
5224
+ readonly: false,
5225
+ optional: true,
5226
+ possibleValues: [],
5227
+ tags: {}
5228
+ }
5229
+ },
5230
+ tags: {},
5231
+ primaryField: "requestHandler"
5232
+ }
5233
+ };
5234
+
5235
+ // src/api/ORM/drivers/DynamoDBDataItemDBDriver.ts
5236
+ typeof __dirname === "string" ? __dirname : Path4.dirname(fileURLToPath(import.meta.url));
5236
5237
  var DynamoDBOperatorMappings = {
5237
5238
  ["EQUALS" /* EQUALS */]: (fieldName) => `#${fieldName} = :${fieldName}`,
5238
5239
  ["NOT_EQUALS" /* NOT_EQUALS */]: (fieldName) => `#${fieldName} <> :${fieldName}`,
@@ -5505,20 +5506,23 @@ var DynamoDBSupportedDataItemDBDriverEntry = {
5505
5506
  * @returns Type info pack for the DynamoDB-specific config.
5506
5507
  */
5507
5508
  getDBSpecificConfigTypeInfo: () => {
5508
- const configTypesPath = Path5.join(
5509
- moduleDirname2,
5510
- "DynamoDBDataItemDBDriver",
5511
- "ConfigTypes.ts"
5512
- );
5513
- const configTypesTS = FS.readFileSync(configTypesPath, "utf8");
5514
- const typeInfoMap = getTypeInfoMapFromTypeScript(configTypesTS);
5515
5509
  return {
5516
5510
  entryTypeName: "DynamoDBSpecificConfig",
5517
- typeInfoMap
5511
+ typeInfoMap: ConfigTypeInfoMap_default2
5518
5512
  };
5519
5513
  }
5520
5514
  };
5521
- var moduleDirname3 = typeof __dirname === "string" ? __dirname : Path5.dirname(fileURLToPath(import.meta.url));
5515
+
5516
+ // src/api/ORM/drivers/InMemoryDataItemDBDriver/ConfigTypeInfoMap.json
5517
+ var ConfigTypeInfoMap_default3 = {
5518
+ InMemorySpecificConfig: {
5519
+ fields: {},
5520
+ tags: {}
5521
+ }
5522
+ };
5523
+
5524
+ // src/api/ORM/drivers/InMemoryDataItemDBDriver.ts
5525
+ typeof __dirname === "string" ? __dirname : Path4.dirname(fileURLToPath(import.meta.url));
5522
5526
  var decodeCursor2 = (cursor) => {
5523
5527
  if (!cursor) {
5524
5528
  return 0;
@@ -5564,7 +5568,9 @@ var InMemoryDataItemDBDriver = class {
5564
5568
  uniquelyIdentifyingFieldName,
5565
5569
  generateUniqueIdentifier = () => v4()
5566
5570
  } = this.config;
5567
- const newItemId = generateUniqueIdentifier(newItem);
5571
+ const newItemId = generateUniqueIdentifier(
5572
+ newItem
5573
+ );
5568
5574
  const cleanNewItemWithId = {
5569
5575
  ...newItem,
5570
5576
  [uniquelyIdentifyingFieldName]: newItemId
@@ -5636,18 +5642,16 @@ var InMemoryDataItemDBDriver = class {
5636
5642
  * @returns List results with items and cursor.
5637
5643
  */
5638
5644
  listItems = async (config, selectedFields) => {
5639
- const {
5640
- itemsPerPage = 10,
5641
- cursor,
5642
- sortFields,
5643
- criteria
5644
- } = config;
5645
+ const { itemsPerPage = 10, cursor, sortFields, criteria } = config;
5645
5646
  const allItems = Array.from(this.items.values());
5646
5647
  const filteredItems = criteria ? getFilterTypeInfoDataItemsBySearchCriteria(
5647
5648
  criteria,
5648
5649
  allItems
5649
5650
  ) : allItems;
5650
- const sortedItems = getSortedItems(sortFields, filteredItems);
5651
+ const sortedItems = getSortedItems(
5652
+ sortFields,
5653
+ filteredItems
5654
+ );
5651
5655
  const offset = decodeCursor2(cursor);
5652
5656
  const items = sortedItems.slice(offset, offset + itemsPerPage).map((item) => selectFieldsFromItem(item, selectedFields));
5653
5657
  const nextOffset = offset + itemsPerPage;
@@ -5669,16 +5673,9 @@ var InMemorySupportedDataItemDBDriverEntry = {
5669
5673
  * @returns Type info pack for the in-memory config.
5670
5674
  */
5671
5675
  getDBSpecificConfigTypeInfo: () => {
5672
- const configTypesPath = Path5.join(
5673
- moduleDirname3,
5674
- "InMemoryDataItemDBDriver",
5675
- "ConfigTypes.ts"
5676
- );
5677
- const configTypesTS = FS.readFileSync(configTypesPath, "utf8");
5678
- const typeInfoMap = getTypeInfoMapFromTypeScript(configTypesTS);
5679
5676
  return {
5680
5677
  entryTypeName: "InMemorySpecificConfig",
5681
- typeInfoMap
5678
+ typeInfoMap: ConfigTypeInfoMap_default3
5682
5679
  };
5683
5680
  }
5684
5681
  };
@@ -5710,7 +5707,33 @@ var InMemoryItemRelationshipDBDriver = class extends InMemoryDataItemDBDriver {
5710
5707
  });
5711
5708
  }
5712
5709
  };
5713
- var moduleDirname4 = typeof __dirname === "string" ? __dirname : Path5.dirname(fileURLToPath(import.meta.url));
5710
+
5711
+ // src/api/ORM/drivers/InMemoryFileItemDBDriver/ConfigTypeInfoMap.json
5712
+ var ConfigTypeInfoMap_default4 = {
5713
+ InMemoryFileSpecificConfig: {
5714
+ fields: {
5715
+ uploadUrlPrefix: {
5716
+ type: "string",
5717
+ array: false,
5718
+ readonly: false,
5719
+ optional: true,
5720
+ tags: {}
5721
+ },
5722
+ downloadUrlPrefix: {
5723
+ type: "string",
5724
+ array: false,
5725
+ readonly: false,
5726
+ optional: true,
5727
+ tags: {}
5728
+ }
5729
+ },
5730
+ tags: {},
5731
+ primaryField: "uploadUrlPrefix"
5732
+ }
5733
+ };
5734
+
5735
+ // src/api/ORM/drivers/InMemoryFileItemDBDriver.ts
5736
+ typeof __dirname === "string" ? __dirname : Path4.dirname(fileURLToPath(import.meta.url));
5714
5737
  var decodeCursor3 = (cursor) => {
5715
5738
  if (!cursor) {
5716
5739
  return 0;
@@ -5766,13 +5789,14 @@ var InMemoryFileItemDBDriver = class {
5766
5789
  * @returns Generated file id.
5767
5790
  */
5768
5791
  createItem = async (item) => {
5769
- const {
5770
- generateUniqueIdentifier
5771
- } = this.config;
5792
+ const { generateUniqueIdentifier } = this.config;
5772
5793
  if (!item?.name) {
5773
5794
  throw new Error("MISSING_ID" /* MISSING_ID */);
5774
5795
  }
5775
- const fileLocation = { name: item.name, directory: item.directory };
5796
+ const fileLocation = {
5797
+ name: item.name,
5798
+ directory: item.directory
5799
+ };
5776
5800
  const id = typeof generateUniqueIdentifier === "function" ? String(generateUniqueIdentifier(item)) : getFullFileKey({ file: fileLocation });
5777
5801
  const mimeType = item.mimeType ?? "application/octet-stream";
5778
5802
  const newItem = {
@@ -5862,189 +5886,562 @@ var InMemoryFileItemDBDriver = class {
5862
5886
  this.aliases.delete(resolvedId);
5863
5887
  return true;
5864
5888
  };
5865
- /**
5866
- * List file items from memory.
5867
- * @returns List results with items and cursor.
5868
- */
5869
- listItems = async (config, selectFields) => {
5870
- const {
5871
- itemsPerPage = Infinity,
5872
- cursor,
5873
- sortFields = [],
5874
- criteria
5875
- } = config;
5876
- const allItems = Array.from(this.items.values());
5877
- const filteredItems = criteria ? getFilterTypeInfoDataItemsBySearchCriteria(
5878
- criteria,
5879
- allItems
5880
- ) : allItems;
5881
- const sortedItems = getSortedItems(sortFields, filteredItems);
5882
- const offset = decodeCursor3(cursor);
5883
- const slice = sortedItems.slice(offset, offset + itemsPerPage);
5884
- const expandedItems = slice.map((item) => {
5885
- const entry = { ...item };
5886
- if (selectFields?.includes("uploadUrl")) {
5887
- entry.uploadUrl = this.buildUrl(this.uploadUrlPrefix, item.id);
5888
- }
5889
- if (selectFields?.includes("downloadUrl")) {
5890
- entry.downloadUrl = this.buildUrl(this.downloadUrlPrefix, item.id);
5889
+ /**
5890
+ * List file items from memory.
5891
+ * @returns List results with items and cursor.
5892
+ */
5893
+ listItems = async (config, selectFields) => {
5894
+ const {
5895
+ itemsPerPage = Infinity,
5896
+ cursor,
5897
+ sortFields = [],
5898
+ criteria
5899
+ } = config;
5900
+ const allItems = Array.from(this.items.values());
5901
+ const filteredItems = criteria ? getFilterTypeInfoDataItemsBySearchCriteria(
5902
+ criteria,
5903
+ allItems
5904
+ ) : allItems;
5905
+ const sortedItems = getSortedItems(
5906
+ sortFields,
5907
+ filteredItems
5908
+ );
5909
+ const offset = decodeCursor3(cursor);
5910
+ const slice = sortedItems.slice(offset, offset + itemsPerPage);
5911
+ const expandedItems = slice.map((item) => {
5912
+ const entry = { ...item };
5913
+ if (selectFields?.includes("uploadUrl")) {
5914
+ entry.uploadUrl = this.buildUrl(this.uploadUrlPrefix, item.id);
5915
+ }
5916
+ if (selectFields?.includes("downloadUrl")) {
5917
+ entry.downloadUrl = this.buildUrl(this.downloadUrlPrefix, item.id);
5918
+ }
5919
+ return selectFields ? selectFieldsFromItem2(entry, selectFields) : entry;
5920
+ });
5921
+ const nextOffset = offset + itemsPerPage;
5922
+ return {
5923
+ items: expandedItems,
5924
+ cursor: nextOffset < sortedItems.length ? encodeCursor3(nextOffset) : void 0
5925
+ };
5926
+ };
5927
+ };
5928
+ var InMemoryFileSupportedDataItemDBDriverEntry = {
5929
+ /**
5930
+ * @param config Driver configuration.
5931
+ * @returns In-memory file driver instance.
5932
+ */
5933
+ factory: (config) => {
5934
+ return new InMemoryFileItemDBDriver(config);
5935
+ },
5936
+ /**
5937
+ * @returns Type info pack for the in-memory file config.
5938
+ */
5939
+ getDBSpecificConfigTypeInfo: () => {
5940
+ return {
5941
+ entryTypeName: "InMemoryFileSpecificConfig",
5942
+ typeInfoMap: ConfigTypeInfoMap_default4
5943
+ };
5944
+ }
5945
+ };
5946
+
5947
+ // src/common/ItemRelationshipInfoTypes.ts
5948
+ var ItemRelationshipInfoTypes_exports = {};
5949
+ __export(ItemRelationshipInfoTypes_exports, {
5950
+ ItemRelationshipInfoIdentifyingKeys: () => ItemRelationshipInfoIdentifyingKeys,
5951
+ ItemRelationshipInfoKeys: () => ItemRelationshipInfoKeys
5952
+ });
5953
+ var ItemRelationshipInfoKeys = /* @__PURE__ */ ((ItemRelationshipInfoKeys2) => {
5954
+ ItemRelationshipInfoKeys2["fromTypeName"] = "fromTypeName";
5955
+ ItemRelationshipInfoKeys2["fromTypeFieldName"] = "fromTypeFieldName";
5956
+ ItemRelationshipInfoKeys2["fromTypePrimaryFieldValue"] = "fromTypePrimaryFieldValue";
5957
+ ItemRelationshipInfoKeys2["toTypePrimaryFieldValue"] = "toTypePrimaryFieldValue";
5958
+ return ItemRelationshipInfoKeys2;
5959
+ })(ItemRelationshipInfoKeys || {});
5960
+ var ItemRelationshipInfoIdentifyingKeys = /* @__PURE__ */ ((ItemRelationshipInfoIdentifyingKeys2) => {
5961
+ ItemRelationshipInfoIdentifyingKeys2["id"] = "id";
5962
+ return ItemRelationshipInfoIdentifyingKeys2;
5963
+ })(ItemRelationshipInfoIdentifyingKeys || {});
5964
+
5965
+ // src/api/ORM/drivers/IndexingRelationshipDriver.ts
5966
+ var defaultEncodeEntityId = (typeName, primaryFieldValue) => `${typeName}#${primaryFieldValue}`;
5967
+ var defaultDecodeEntityId = (typeName, entityId) => {
5968
+ const prefix = `${typeName}#`;
5969
+ return entityId.startsWith(prefix) ? entityId.slice(prefix.length) : entityId;
5970
+ };
5971
+ var buildRelationshipId = (edgeKey2) => `${edgeKey2.from}|${edgeKey2.relation}|${edgeKey2.to}`;
5972
+ var IndexingRelationshipDriver = class {
5973
+ /**
5974
+ * @param config Driver configuration for relation indexing.
5975
+ */
5976
+ constructor(config) {
5977
+ this.config = config;
5978
+ this.encodeEntityId = config.encodeEntityId ?? defaultEncodeEntityId;
5979
+ this.decodeEntityId = config.decodeEntityId ?? defaultDecodeEntityId;
5980
+ }
5981
+ encodeEntityId;
5982
+ decodeEntityId;
5983
+ buildEdgeKey(relationship, toTypeName) {
5984
+ const { fromTypeName, fromTypeFieldName, fromTypePrimaryFieldValue, toTypePrimaryFieldValue } = relationship;
5985
+ const relation = this.config.relationNameFor(fromTypeName, fromTypeFieldName);
5986
+ return {
5987
+ from: this.encodeEntityId(fromTypeName, String(fromTypePrimaryFieldValue)),
5988
+ to: this.encodeEntityId(toTypeName, String(toTypePrimaryFieldValue)),
5989
+ relation
5990
+ };
5991
+ }
5992
+ buildRelationshipInfo(edge, origin, toTypeName) {
5993
+ const { fromTypeName, fromTypeFieldName } = origin;
5994
+ const fromTypePrimaryFieldValue = this.decodeEntityId(fromTypeName, edge.key.from);
5995
+ const toTypePrimaryFieldValue = this.decodeEntityId(toTypeName, edge.key.to);
5996
+ return {
5997
+ ["id" /* id */]: buildRelationshipId(edge.key),
5998
+ ["fromTypeName" /* fromTypeName */]: fromTypeName,
5999
+ ["fromTypeFieldName" /* fromTypeFieldName */]: fromTypeFieldName,
6000
+ ["fromTypePrimaryFieldValue" /* fromTypePrimaryFieldValue */]: fromTypePrimaryFieldValue,
6001
+ ["toTypePrimaryFieldValue" /* toTypePrimaryFieldValue */]: toTypePrimaryFieldValue
6002
+ };
6003
+ }
6004
+ async removeAllOutgoing(fromId, relation) {
6005
+ let cursor = void 0;
6006
+ do {
6007
+ const page = await this.config.backend.getOutgoing(fromId, relation, { limit: 100, cursor });
6008
+ await Promise.all(page.edges.map((edge) => this.config.backend.removeEdge(edge.key)));
6009
+ cursor = page.nextCursor;
6010
+ } while (cursor);
6011
+ }
6012
+ /**
6013
+ * Create a relationship via the relational backend.
6014
+ * @returns Promise resolved once the relationship is stored.
6015
+ */
6016
+ async createRelationship(relationship, toTypeName, ensureSingle) {
6017
+ const edgeKey2 = this.buildEdgeKey(relationship, toTypeName);
6018
+ if (ensureSingle) {
6019
+ await this.removeAllOutgoing(edgeKey2.from, edgeKey2.relation);
6020
+ }
6021
+ await this.config.backend.putEdge({ key: edgeKey2 });
6022
+ }
6023
+ /**
6024
+ * Delete a relationship via the relational backend.
6025
+ * @returns Promise resolved once the relationship is removed.
6026
+ */
6027
+ async deleteRelationship(relationship, toTypeName) {
6028
+ const edgeKey2 = this.buildEdgeKey(relationship, toTypeName);
6029
+ await this.config.backend.removeEdge(edgeKey2);
6030
+ }
6031
+ /**
6032
+ * List relationships via the relational backend.
6033
+ * @returns List results with items and cursor.
6034
+ */
6035
+ async listRelationships(config, toTypeName) {
6036
+ const { relationshipItemOrigin, itemsPerPage, cursor } = config;
6037
+ const { fromTypeName, fromTypeFieldName, fromTypePrimaryFieldValue } = relationshipItemOrigin;
6038
+ const relation = this.config.relationNameFor(fromTypeName, fromTypeFieldName);
6039
+ const fromId = this.encodeEntityId(fromTypeName, String(fromTypePrimaryFieldValue));
6040
+ const options = {
6041
+ limit: itemsPerPage,
6042
+ cursor
6043
+ };
6044
+ const page = await this.config.backend.getOutgoing(fromId, relation, options);
6045
+ const items = page.edges.map(
6046
+ (edge) => this.buildRelationshipInfo(edge, relationshipItemOrigin, toTypeName)
6047
+ );
6048
+ return {
6049
+ items,
6050
+ cursor: page.nextCursor
6051
+ };
6052
+ }
6053
+ };
6054
+
6055
+ // src/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.ts
6056
+ var SupportedTypeInfoORMDBDriverNames = /* @__PURE__ */ ((SupportedTypeInfoORMDBDriverNames2) => {
6057
+ SupportedTypeInfoORMDBDriverNames2["DYNAMO_DB_DATA_ITEM"] = "DYNAMO_DB_DATA_ITEM";
6058
+ SupportedTypeInfoORMDBDriverNames2["IN_MEMORY_DATA_ITEM"] = "IN_MEMORY_DATA_ITEM";
6059
+ SupportedTypeInfoORMDBDriverNames2["IN_MEMORY_FILE_ITEM"] = "IN_MEMORY_FILE_ITEM";
6060
+ SupportedTypeInfoORMDBDriverNames2["S3_FILE_ITEM"] = "S3_FILE_ITEM";
6061
+ return SupportedTypeInfoORMDBDriverNames2;
6062
+ })(SupportedTypeInfoORMDBDriverNames || {});
6063
+ var SUPPORTED_TYPE_INFO_ORM_DB_DRIVERS = {
6064
+ ["DYNAMO_DB_DATA_ITEM" /* DYNAMO_DB_DATA_ITEM */]: DynamoDBSupportedDataItemDBDriverEntry,
6065
+ ["IN_MEMORY_DATA_ITEM" /* IN_MEMORY_DATA_ITEM */]: InMemorySupportedDataItemDBDriverEntry,
6066
+ ["IN_MEMORY_FILE_ITEM" /* IN_MEMORY_FILE_ITEM */]: InMemoryFileSupportedDataItemDBDriverEntry,
6067
+ ["S3_FILE_ITEM" /* S3_FILE_ITEM */]: S3SupportedFileItemDBDriverEntry
6068
+ };
6069
+
6070
+ // src/common/TypeParsing/TypeInfo.ts
6071
+ var TypeInfo_exports = {};
6072
+ __export(TypeInfo_exports, {
6073
+ TypeOperation: () => TypeOperation
6074
+ });
6075
+ var TypeOperation = /* @__PURE__ */ ((TypeOperation2) => {
6076
+ TypeOperation2["CREATE"] = "CREATE";
6077
+ TypeOperation2["READ"] = "READ";
6078
+ TypeOperation2["UPDATE"] = "UPDATE";
6079
+ TypeOperation2["DELETE"] = "DELETE";
6080
+ return TypeOperation2;
6081
+ })(TypeOperation || {});
6082
+
6083
+ // src/common/TypeParsing/Validation.ts
6084
+ var Validation_exports = {};
6085
+ __export(Validation_exports, {
6086
+ DENIED_TYPE_OPERATIONS: () => DENIED_TYPE_OPERATIONS,
6087
+ ERROR_MESSAGE_CONSTANTS: () => ERROR_MESSAGE_CONSTANTS,
6088
+ INVALID_CUSTOM_TYPE: () => INVALID_CUSTOM_TYPE,
6089
+ PRIMITIVE_ERROR_MESSAGE_CONSTANTS: () => PRIMITIVE_ERROR_MESSAGE_CONSTANTS,
6090
+ RelationshipValidationType: () => RelationshipValidationType,
6091
+ TYPE_KEYWORD_VALIDATORS: () => TYPE_KEYWORD_VALIDATORS,
6092
+ getValidityValue: () => getValidityValue,
6093
+ hasValue: () => hasValue,
6094
+ validateArrayOfTypeInfoFieldValues: () => validateArrayOfTypeInfoFieldValues,
6095
+ validateCustomType: () => validateCustomType,
6096
+ validateKeywordType: () => validateKeywordType,
6097
+ validateTypeInfoFieldOperationAllowed: () => validateTypeInfoFieldOperationAllowed,
6098
+ validateTypeInfoFieldValue: () => validateTypeInfoFieldValue,
6099
+ validateTypeInfoValue: () => validateTypeInfoValue,
6100
+ validateTypeOperationAllowed: () => validateTypeOperationAllowed,
6101
+ validateValueMatchesPattern: () => validateValueMatchesPattern
6102
+ });
6103
+ var RelationshipValidationType = /* @__PURE__ */ ((RelationshipValidationType2) => {
6104
+ RelationshipValidationType2["INCLUDE"] = "INCLUDE";
6105
+ RelationshipValidationType2["EXCLUDE"] = "EXCLUDE";
6106
+ RelationshipValidationType2["STRICT_EXCLUDE"] = "STRICT_EXCLUDE";
6107
+ return RelationshipValidationType2;
6108
+ })(RelationshipValidationType || {});
6109
+ var INVALID_CUSTOM_TYPE = "INVALID_CUSTOM_TYPE";
6110
+ var PRIMITIVE_ERROR_MESSAGE_CONSTANTS = {
6111
+ string: "NOT_A_STRING",
6112
+ number: "NOT_A_NUMBER",
6113
+ boolean: "NOT_A_BOOLEAN"
6114
+ };
6115
+ var ERROR_MESSAGE_CONSTANTS = {
6116
+ MISSING: "MISSING",
6117
+ INVALID_OPTION: "INVALID_OPTION",
6118
+ INVALID_FIELD: "INVALID_FIELD",
6119
+ RELATIONSHIP_VALUES_ARE_STRICTLY_EXCLUDED: "RELATIONSHIP_VALUES_ARE_STRICTLY_EXCLUDED",
6120
+ INVALID_TYPE: "INVALID_TYPE",
6121
+ NO_UNION_TYPE_MATCHED: "NO_UNION_TYPE_MATCHED",
6122
+ TYPE_DOES_NOT_EXIST: "TYPE_DOES_NOT_EXIST",
6123
+ INVALID_PATTERN: "INVALID_PATTERN",
6124
+ VALUE_DOES_NOT_MATCH_PATTERN: "VALUE_DOES_NOT_MATCH_PATTERN"
6125
+ };
6126
+ var DENIED_TYPE_OPERATIONS = {
6127
+ CREATE: "DENIED_TYPE_OPERATION_CREATE",
6128
+ READ: "DENIED_TYPE_OPERATION_READ",
6129
+ UPDATE: "DENIED_TYPE_OPERATION_UPDATE",
6130
+ DELETE: "DENIED_TYPE_OPERATION_DELETE"
6131
+ };
6132
+ var validateValueMatchesPattern = (typeName, value, pattern) => {
6133
+ const results = {
6134
+ typeName,
6135
+ valid: true,
6136
+ error: "",
6137
+ errorMap: {}
6138
+ };
6139
+ const valueSupplied = typeof value !== "undefined";
6140
+ const patternSupplied = typeof pattern === "string" && pattern.trim() !== "";
6141
+ if (!valueSupplied || !patternSupplied) {
6142
+ try {
6143
+ const regex = new RegExp(pattern);
6144
+ const testResult = typeof value === "string" && regex.test(value);
6145
+ if (!testResult) {
6146
+ results.valid = false;
6147
+ results.error = ERROR_MESSAGE_CONSTANTS.VALUE_DOES_NOT_MATCH_PATTERN;
5891
6148
  }
5892
- return selectFields ? selectFieldsFromItem2(entry, selectFields) : entry;
5893
- });
5894
- const nextOffset = offset + itemsPerPage;
5895
- return {
5896
- items: expandedItems,
5897
- cursor: nextOffset < sortedItems.length ? encodeCursor3(nextOffset) : void 0
5898
- };
5899
- };
5900
- };
5901
- var InMemoryFileSupportedDataItemDBDriverEntry = {
5902
- /**
5903
- * @param config Driver configuration.
5904
- * @returns In-memory file driver instance.
5905
- */
5906
- factory: (config) => {
5907
- return new InMemoryFileItemDBDriver(config);
5908
- },
5909
- /**
5910
- * @returns Type info pack for the in-memory file config.
5911
- */
5912
- getDBSpecificConfigTypeInfo: () => {
5913
- const configTypesPath = Path5.join(
5914
- moduleDirname4,
5915
- "InMemoryFileItemDBDriver",
5916
- "ConfigTypes.ts"
5917
- );
5918
- const configTypesTS = FS.readFileSync(configTypesPath, "utf8");
5919
- const typeInfoMap = getTypeInfoMapFromTypeScript(configTypesTS);
5920
- return {
5921
- entryTypeName: "InMemoryFileSpecificConfig",
5922
- typeInfoMap
5923
- };
6149
+ } catch (e) {
6150
+ results.valid = false;
6151
+ results.error = ERROR_MESSAGE_CONSTANTS.INVALID_PATTERN;
6152
+ }
5924
6153
  }
6154
+ return results;
5925
6155
  };
5926
-
5927
- // src/common/ItemRelationshipInfoTypes.ts
5928
- var ItemRelationshipInfoTypes_exports = {};
5929
- __export(ItemRelationshipInfoTypes_exports, {
5930
- ItemRelationshipInfoIdentifyingKeys: () => ItemRelationshipInfoIdentifyingKeys,
5931
- ItemRelationshipInfoKeys: () => ItemRelationshipInfoKeys
5932
- });
5933
- var ItemRelationshipInfoKeys = /* @__PURE__ */ ((ItemRelationshipInfoKeys2) => {
5934
- ItemRelationshipInfoKeys2["fromTypeName"] = "fromTypeName";
5935
- ItemRelationshipInfoKeys2["fromTypeFieldName"] = "fromTypeFieldName";
5936
- ItemRelationshipInfoKeys2["fromTypePrimaryFieldValue"] = "fromTypePrimaryFieldValue";
5937
- ItemRelationshipInfoKeys2["toTypePrimaryFieldValue"] = "toTypePrimaryFieldValue";
5938
- return ItemRelationshipInfoKeys2;
5939
- })(ItemRelationshipInfoKeys || {});
5940
- var ItemRelationshipInfoIdentifyingKeys = /* @__PURE__ */ ((ItemRelationshipInfoIdentifyingKeys2) => {
5941
- ItemRelationshipInfoIdentifyingKeys2["id"] = "id";
5942
- return ItemRelationshipInfoIdentifyingKeys2;
5943
- })(ItemRelationshipInfoIdentifyingKeys || {});
5944
-
5945
- // src/api/ORM/drivers/IndexingRelationshipDriver.ts
5946
- var defaultEncodeEntityId = (typeName, primaryFieldValue) => `${typeName}#${primaryFieldValue}`;
5947
- var defaultDecodeEntityId = (typeName, entityId) => {
5948
- const prefix = `${typeName}#`;
5949
- return entityId.startsWith(prefix) ? entityId.slice(prefix.length) : entityId;
6156
+ var getValidityValue = (existing, pending) => !existing ? false : pending;
6157
+ var TYPE_KEYWORD_VALIDATORS = {
6158
+ string: (value) => typeof value === "string",
6159
+ number: (value) => typeof value === "number",
6160
+ boolean: (value) => typeof value === "boolean"
5950
6161
  };
5951
- var buildRelationshipId = (edgeKey2) => `${edgeKey2.from}|${edgeKey2.relation}|${edgeKey2.to}`;
5952
- var IndexingRelationshipDriver = class {
5953
- /**
5954
- * @param config Driver configuration for relation indexing.
5955
- */
5956
- constructor(config) {
5957
- this.config = config;
5958
- this.encodeEntityId = config.encodeEntityId ?? defaultEncodeEntityId;
5959
- this.decodeEntityId = config.decodeEntityId ?? defaultDecodeEntityId;
5960
- }
5961
- encodeEntityId;
5962
- decodeEntityId;
5963
- buildEdgeKey(relationship, toTypeName) {
5964
- const { fromTypeName, fromTypeFieldName, fromTypePrimaryFieldValue, toTypePrimaryFieldValue } = relationship;
5965
- const relation = this.config.relationNameFor(fromTypeName, fromTypeFieldName);
5966
- return {
5967
- from: this.encodeEntityId(fromTypeName, String(fromTypePrimaryFieldValue)),
5968
- to: this.encodeEntityId(toTypeName, String(toTypePrimaryFieldValue)),
5969
- relation
5970
- };
6162
+ var hasValue = (value) => value ?? false;
6163
+ var validateKeywordType = (value, type) => {
6164
+ const validator = TYPE_KEYWORD_VALIDATORS[type];
6165
+ let valid = true;
6166
+ if (validator) {
6167
+ valid = validator(value);
5971
6168
  }
5972
- buildRelationshipInfo(edge, origin, toTypeName) {
5973
- const { fromTypeName, fromTypeFieldName } = origin;
5974
- const fromTypePrimaryFieldValue = this.decodeEntityId(fromTypeName, edge.key.from);
5975
- const toTypePrimaryFieldValue = this.decodeEntityId(toTypeName, edge.key.to);
5976
- return {
5977
- ["id" /* id */]: buildRelationshipId(edge.key),
5978
- ["fromTypeName" /* fromTypeName */]: fromTypeName,
5979
- ["fromTypeFieldName" /* fromTypeFieldName */]: fromTypeFieldName,
5980
- ["fromTypePrimaryFieldValue" /* fromTypePrimaryFieldValue */]: fromTypePrimaryFieldValue,
5981
- ["toTypePrimaryFieldValue" /* toTypePrimaryFieldValue */]: toTypePrimaryFieldValue
5982
- };
6169
+ return valid;
6170
+ };
6171
+ var validateCustomType = (value, customType, customValidators) => {
6172
+ let valid = true;
6173
+ if (customValidators && customType) {
6174
+ const validator = customValidators[customType];
6175
+ if (validator) {
6176
+ try {
6177
+ valid = validator(value);
6178
+ } catch (e) {
6179
+ valid = false;
6180
+ }
6181
+ }
5983
6182
  }
5984
- async removeAllOutgoing(fromId, relation) {
5985
- let cursor = void 0;
5986
- do {
5987
- const page = await this.config.backend.getOutgoing(fromId, relation, { limit: 100, cursor });
5988
- await Promise.all(page.edges.map((edge) => this.config.backend.removeEdge(edge.key)));
5989
- cursor = page.nextCursor;
5990
- } while (cursor);
6183
+ return valid;
6184
+ };
6185
+ var validateTypeInfoFieldValue = (value, typeInfoField, typeInfoMap, ignoreArray = false, strict = false, customValidators, typeOperation, relationshipValidationType = "STRICT_EXCLUDE" /* STRICT_EXCLUDE */, itemIsPartial) => {
6186
+ const {
6187
+ type,
6188
+ typeReference,
6189
+ array,
6190
+ optional,
6191
+ possibleValues,
6192
+ tags: { customType, constraints: { pattern = void 0 } = {} } = {}
6193
+ } = typeInfoField;
6194
+ const results = {
6195
+ typeName: typeReference ?? type,
6196
+ valid: true,
6197
+ error: "",
6198
+ errorMap: {}
6199
+ };
6200
+ const requiredValueAllowed = !typeReference || relationshipValidationType === "INCLUDE" /* INCLUDE */;
6201
+ if (requiredValueAllowed && !itemIsPartial && !optional && !hasValue(value)) {
6202
+ results.valid = false;
6203
+ results.error = ERROR_MESSAGE_CONSTANTS.MISSING;
6204
+ } else if (array && !ignoreArray) {
6205
+ const {
6206
+ valid: validArray,
6207
+ error: arrayError,
6208
+ errorMap: arrayErrorMap
6209
+ } = validateArrayOfTypeInfoFieldValues(
6210
+ value,
6211
+ typeInfoField,
6212
+ typeInfoMap,
6213
+ strict,
6214
+ customValidators,
6215
+ typeOperation,
6216
+ relationshipValidationType,
6217
+ itemIsPartial
6218
+ );
6219
+ results.valid = getValidityValue(results.valid, validArray);
6220
+ results.error = arrayError;
6221
+ results.errorMap = arrayErrorMap;
6222
+ } else {
6223
+ if (typeReference) {
6224
+ if (relationshipValidationType === "INCLUDE" /* INCLUDE */) {
6225
+ const {
6226
+ valid: validTypeInfo,
6227
+ error: typeInfoError,
6228
+ errorMap: typeInfoErrorMap
6229
+ } = validateTypeInfoValue(
6230
+ value,
6231
+ typeReference,
6232
+ typeInfoMap,
6233
+ strict,
6234
+ customValidators,
6235
+ typeOperation,
6236
+ relationshipValidationType,
6237
+ itemIsPartial
6238
+ );
6239
+ results.valid = getValidityValue(results.valid, validTypeInfo);
6240
+ results.error = typeInfoError;
6241
+ results.errorMap = typeInfoErrorMap;
6242
+ } else if (relationshipValidationType === "STRICT_EXCLUDE" /* STRICT_EXCLUDE */) {
6243
+ const valueSupplied = typeof value !== "undefined";
6244
+ if (valueSupplied) {
6245
+ results.valid = false;
6246
+ results.error = ERROR_MESSAGE_CONSTANTS.RELATIONSHIP_VALUES_ARE_STRICTLY_EXCLUDED;
6247
+ }
6248
+ } else if (relationshipValidationType === "EXCLUDE" /* EXCLUDE */) {
6249
+ results.valid = getValidityValue(results.valid, true);
6250
+ }
6251
+ } else if (possibleValues && !possibleValues.includes(value)) {
6252
+ results.valid = false;
6253
+ results.error = ERROR_MESSAGE_CONSTANTS.INVALID_OPTION;
6254
+ } else {
6255
+ const pendingValid = validateKeywordType(value, type);
6256
+ const customValid = validateCustomType(
6257
+ value,
6258
+ customType,
6259
+ customValidators
6260
+ );
6261
+ results.valid = getValidityValue(results.valid, pendingValid);
6262
+ results.valid = getValidityValue(results.valid, customValid);
6263
+ if (type === "string" && typeof pattern === "string") {
6264
+ const { valid: patternValid, error: patternError } = validateValueMatchesPattern(value, pattern);
6265
+ results.valid = getValidityValue(results.valid, patternValid);
6266
+ results.error = patternError;
6267
+ }
6268
+ if (!customValid) {
6269
+ results.error = INVALID_CUSTOM_TYPE;
6270
+ } else if (!results.valid) {
6271
+ results.error = results.error ? results.error : PRIMITIVE_ERROR_MESSAGE_CONSTANTS[type];
6272
+ }
6273
+ }
5991
6274
  }
5992
- /**
5993
- * Create a relationship via the relational backend.
5994
- * @returns Promise resolved once the relationship is stored.
5995
- */
5996
- async createRelationship(relationship, toTypeName, ensureSingle) {
5997
- const edgeKey2 = this.buildEdgeKey(relationship, toTypeName);
5998
- if (ensureSingle) {
5999
- await this.removeAllOutgoing(edgeKey2.from, edgeKey2.relation);
6275
+ return results;
6276
+ };
6277
+ var validateArrayOfTypeInfoFieldValues = (values = [], typeInfoField, typeInfoMap, strict = false, customValidators, typeOperation, relationshipValidationType, itemIsPartial) => {
6278
+ const { type, typeReference } = typeInfoField;
6279
+ const results = {
6280
+ typeName: typeReference ?? type,
6281
+ valid: true,
6282
+ error: "",
6283
+ errorMap: {}
6284
+ };
6285
+ for (let i = 0; i < values.length; i++) {
6286
+ const v = values[i];
6287
+ const {
6288
+ valid: indexValid,
6289
+ error: indexError = "",
6290
+ errorMap: indexErrorMap
6291
+ } = validateTypeInfoFieldValue(
6292
+ v,
6293
+ typeInfoField,
6294
+ typeInfoMap,
6295
+ true,
6296
+ strict,
6297
+ customValidators,
6298
+ typeOperation,
6299
+ relationshipValidationType,
6300
+ itemIsPartial
6301
+ );
6302
+ results.valid = getValidityValue(results.valid, indexValid);
6303
+ results.errorMap[getPathString([i])] = [indexError];
6304
+ for (const er in indexErrorMap) {
6305
+ results.errorMap[getPathString([i, er])] = indexErrorMap[er];
6000
6306
  }
6001
- await this.config.backend.putEdge({ key: edgeKey2 });
6002
6307
  }
6003
- /**
6004
- * Delete a relationship via the relational backend.
6005
- * @returns Promise resolved once the relationship is removed.
6006
- */
6007
- async deleteRelationship(relationship, toTypeName) {
6008
- const edgeKey2 = this.buildEdgeKey(relationship, toTypeName);
6009
- await this.config.backend.removeEdge(edgeKey2);
6308
+ return results;
6309
+ };
6310
+ var validateTypeInfoFieldOperationAllowed = (fieldName, fieldOperation, typeInfoField) => {
6311
+ const results = {
6312
+ typeName: null,
6313
+ valid: true,
6314
+ error: "",
6315
+ errorMap: {}
6316
+ };
6317
+ if (fieldOperation && typeInfoField) {
6318
+ const {
6319
+ type,
6320
+ typeReference,
6321
+ tags = {}
6322
+ } = typeInfoField || {};
6323
+ const { deniedOperations: { [fieldOperation]: denied = false } = {} } = tags;
6324
+ results.typeName = typeReference ?? type;
6325
+ results.valid = !denied;
6326
+ if (!results.valid) {
6327
+ results.error = DENIED_TYPE_OPERATIONS[fieldOperation];
6328
+ results.errorMap[fieldName] = [results.error];
6329
+ }
6010
6330
  }
6011
- /**
6012
- * List relationships via the relational backend.
6013
- * @returns List results with items and cursor.
6014
- */
6015
- async listRelationships(config, toTypeName) {
6016
- const { relationshipItemOrigin, itemsPerPage, cursor } = config;
6017
- const { fromTypeName, fromTypeFieldName, fromTypePrimaryFieldValue } = relationshipItemOrigin;
6018
- const relation = this.config.relationNameFor(fromTypeName, fromTypeFieldName);
6019
- const fromId = this.encodeEntityId(fromTypeName, String(fromTypePrimaryFieldValue));
6020
- const options = {
6021
- limit: itemsPerPage,
6022
- cursor
6023
- };
6024
- const page = await this.config.backend.getOutgoing(fromId, relation, options);
6025
- const items = page.edges.map(
6026
- (edge) => this.buildRelationshipInfo(edge, relationshipItemOrigin, toTypeName)
6027
- );
6028
- return {
6029
- items,
6030
- cursor: page.nextCursor
6031
- };
6331
+ return results;
6332
+ };
6333
+ var validateTypeOperationAllowed = (typeName, valueFields, typeOperation, typeInfo) => {
6334
+ const results = {
6335
+ typeName,
6336
+ valid: true,
6337
+ error: "",
6338
+ errorMap: {}
6339
+ };
6340
+ const { fields = {}, tags = {} } = typeInfo;
6341
+ const { deniedOperations: { [typeOperation]: denied = false } = {} } = tags;
6342
+ if (denied) {
6343
+ results.valid = false;
6344
+ results.error = DENIED_TYPE_OPERATIONS[typeOperation];
6345
+ } else {
6346
+ for (const vF of valueFields) {
6347
+ const vFieldInfo = fields[vF];
6348
+ const { valid: vFValid, error: vFError } = validateTypeInfoFieldOperationAllowed(vF, typeOperation, vFieldInfo);
6349
+ results.valid = getValidityValue(results.valid, vFValid);
6350
+ if (!vFValid) {
6351
+ results.errorMap[vF] = [vFError];
6352
+ }
6353
+ }
6032
6354
  }
6355
+ return results;
6033
6356
  };
6034
-
6035
- // src/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.ts
6036
- var SupportedTypeInfoORMDBDriverNames = /* @__PURE__ */ ((SupportedTypeInfoORMDBDriverNames2) => {
6037
- SupportedTypeInfoORMDBDriverNames2["DYNAMO_DB_DATA_ITEM"] = "DYNAMO_DB_DATA_ITEM";
6038
- SupportedTypeInfoORMDBDriverNames2["IN_MEMORY_DATA_ITEM"] = "IN_MEMORY_DATA_ITEM";
6039
- SupportedTypeInfoORMDBDriverNames2["IN_MEMORY_FILE_ITEM"] = "IN_MEMORY_FILE_ITEM";
6040
- SupportedTypeInfoORMDBDriverNames2["S3_FILE_ITEM"] = "S3_FILE_ITEM";
6041
- return SupportedTypeInfoORMDBDriverNames2;
6042
- })(SupportedTypeInfoORMDBDriverNames || {});
6043
- var SUPPORTED_TYPE_INFO_ORM_DB_DRIVERS = {
6044
- ["DYNAMO_DB_DATA_ITEM" /* DYNAMO_DB_DATA_ITEM */]: DynamoDBSupportedDataItemDBDriverEntry,
6045
- ["IN_MEMORY_DATA_ITEM" /* IN_MEMORY_DATA_ITEM */]: InMemorySupportedDataItemDBDriverEntry,
6046
- ["IN_MEMORY_FILE_ITEM" /* IN_MEMORY_FILE_ITEM */]: InMemoryFileSupportedDataItemDBDriverEntry,
6047
- ["S3_FILE_ITEM" /* S3_FILE_ITEM */]: S3SupportedFileItemDBDriverEntry
6357
+ var validateTypeInfoValue = (value, typeInfoFullName, typeInfoMap, strict = false, customValidators, typeOperation, relationshipValidationType, itemIsPartial) => {
6358
+ const typeInfo = typeInfoMap[typeInfoFullName];
6359
+ const results = {
6360
+ typeName: typeInfoFullName,
6361
+ valid: !!typeInfo,
6362
+ error: !!typeInfo ? "" : ERROR_MESSAGE_CONSTANTS.TYPE_DOES_NOT_EXIST,
6363
+ errorMap: {}
6364
+ };
6365
+ if (typeInfo) {
6366
+ const { primaryField, fields, unionFieldSets } = typeInfo;
6367
+ if (typeOperation) {
6368
+ const valueFields = typeof value === "object" ? Object.keys(value ?? {}) : [];
6369
+ const {
6370
+ valid: operationValid,
6371
+ error: operationError,
6372
+ errorMap: operationErrorMap
6373
+ } = validateTypeOperationAllowed(
6374
+ typeInfoFullName,
6375
+ valueFields,
6376
+ typeOperation,
6377
+ typeInfo
6378
+ );
6379
+ results.valid = getValidityValue(results.valid, operationValid);
6380
+ results.error = operationError;
6381
+ for (const oE in operationErrorMap) {
6382
+ const existingError = results.errorMap[oE] ?? [];
6383
+ results.errorMap[oE] = existingError ? [...existingError, ...operationErrorMap[oE]] : operationErrorMap[oE];
6384
+ }
6385
+ if (!operationValid && operationError) {
6386
+ results.error = operationError;
6387
+ }
6388
+ }
6389
+ if (unionFieldSets) {
6390
+ const valueFields = Object.keys(value || {});
6391
+ let valid = false;
6392
+ for (const uFS of unionFieldSets) {
6393
+ valid = valueFields.every((vF) => uFS.includes(vF));
6394
+ if (valid) {
6395
+ break;
6396
+ }
6397
+ }
6398
+ if (!valid) {
6399
+ results.valid = false;
6400
+ results.error = ERROR_MESSAGE_CONSTANTS.NO_UNION_TYPE_MATCHED;
6401
+ }
6402
+ } else if (strict) {
6403
+ const knownFields = Object.keys(fields || {});
6404
+ const valueFields = Object.keys(value || {});
6405
+ for (const vF of valueFields) {
6406
+ if (!knownFields.includes(vF)) {
6407
+ results.valid = false;
6408
+ results.errorMap[vF] = [ERROR_MESSAGE_CONSTANTS.INVALID_FIELD];
6409
+ }
6410
+ }
6411
+ }
6412
+ if (fields) {
6413
+ for (const key in fields) {
6414
+ if (typeOperation !== "CREATE" /* CREATE */ || typeof primaryField !== "string" || key !== primaryField) {
6415
+ const typeInfoField = fields[key];
6416
+ const fieldValue = value[key];
6417
+ const {
6418
+ valid: fieldValid,
6419
+ error: fieldError,
6420
+ errorMap: fieldErrorMap
6421
+ } = validateTypeInfoFieldValue(
6422
+ fieldValue,
6423
+ typeInfoField,
6424
+ typeInfoMap,
6425
+ false,
6426
+ strict,
6427
+ customValidators,
6428
+ typeOperation,
6429
+ relationshipValidationType,
6430
+ itemIsPartial
6431
+ );
6432
+ results.valid = getValidityValue(results.valid, fieldValid);
6433
+ results.errorMap[key] = [fieldError];
6434
+ for (const fE in fieldErrorMap) {
6435
+ results.errorMap[getPathString([key, fE])] = fieldErrorMap[fE];
6436
+ }
6437
+ }
6438
+ }
6439
+ }
6440
+ if (!results.valid && !results.error) {
6441
+ results.error = ERROR_MESSAGE_CONSTANTS.INVALID_TYPE;
6442
+ }
6443
+ }
6444
+ return results;
6048
6445
  };
6049
6446
 
6050
6447
  // src/common/SearchValidation.ts
@@ -9991,7 +10388,8 @@ var addCloudFunction = createResourcePack(
9991
10388
  ]
9992
10389
  }
9993
10390
  }
9994
- ]
10391
+ ],
10392
+ memorySize = 128
9995
10393
  }) => {
9996
10394
  return {
9997
10395
  Resources: {
@@ -10026,7 +10424,8 @@ var addCloudFunction = createResourcePack(
10026
10424
  Role: {
10027
10425
  "Fn::GetAtt": [`${id}Role`, "Arn"]
10028
10426
  },
10029
- Runtime: runtime
10427
+ Runtime: runtime,
10428
+ MemorySize: memorySize
10030
10429
  }
10031
10430
  }
10032
10431
  }
@@ -10588,6 +10987,62 @@ __export(common_exports, {
10588
10987
  TypeParsing: () => TypeParsing_exports
10589
10988
  });
10590
10989
 
10990
+ // src/common/TypeParsing/index.ts
10991
+ var TypeParsing_exports = {};
10992
+ __export(TypeParsing_exports, {
10993
+ Constants: () => Constants_exports,
10994
+ TypeInfo: () => TypeInfo_exports,
10995
+ TypeMapping: () => TypeMapping_exports,
10996
+ Validation: () => Validation_exports
10997
+ });
10998
+
10999
+ // src/common/TypeParsing/TypeMapping.ts
11000
+ var TypeMapping_exports = {};
11001
+ __export(TypeMapping_exports, {
11002
+ convertASTToMap: () => convertASTToMap
11003
+ });
11004
+ var convertASTToMap = (node, map = {}, parentName) => {
11005
+ node.forEachChild((child) => {
11006
+ const { kind: childKind } = child;
11007
+ if (childKind === SyntaxKind.ModuleDeclaration) {
11008
+ const moduleNode = child;
11009
+ const { name: moduleName } = moduleNode;
11010
+ const textModuleName = moduleName.getText();
11011
+ const fullModuleName = parentName ? `${parentName}.${textModuleName}` : textModuleName;
11012
+ convertASTToMap(moduleNode, map, fullModuleName);
11013
+ }
11014
+ if (childKind === SyntaxKind.ModuleBlock) {
11015
+ convertASTToMap(child, map, parentName);
11016
+ }
11017
+ if (childKind === SyntaxKind.TypeAliasDeclaration) {
11018
+ const typeAliasDec = child;
11019
+ const {
11020
+ name: { text: typeName }
11021
+ } = typeAliasDec;
11022
+ const fullTypeName = parentName ? `${parentName}.${typeName}` : typeName;
11023
+ map[fullTypeName] = typeAliasDec;
11024
+ }
11025
+ });
11026
+ return map;
11027
+ };
11028
+
11029
+ // src/common/TypeParsing/Constants.ts
11030
+ var Constants_exports = {};
11031
+ __export(Constants_exports, {
11032
+ BUILTIN_TYPE_NAMES: () => BUILTIN_TYPE_NAMES
11033
+ });
11034
+ var BUILTIN_TYPE_NAMES = [
11035
+ "string",
11036
+ "number",
11037
+ "boolean",
11038
+ "null",
11039
+ "object",
11040
+ "array",
11041
+ "any",
11042
+ "unknown",
11043
+ "never"
11044
+ ];
11045
+
10591
11046
  // src/common/StringTransformers.ts
10592
11047
  var StringTransformers_exports = {};
10593
11048
  __export(StringTransformers_exports, {
@@ -10741,7 +11196,7 @@ var getResolvedConditions = async (testFilePath, targetTestIndex, targetTestExpo
10741
11196
  return conditions;
10742
11197
  } else if (typeof conditions === "object" && conditions !== null) {
10743
11198
  const { file, export: targetConditionExport } = conditions;
10744
- const modulePath = Path5.resolve(Path5.dirname(testFilePath), file);
11199
+ const modulePath = Path4.resolve(Path4.dirname(testFilePath), file);
10745
11200
  const targetModule = await importModule(modulePath);
10746
11201
  const conditionArray = targetModule[targetConditionExport];
10747
11202
  if (Array.isArray(conditionArray)) {
@@ -10802,7 +11257,7 @@ var getResolvedTestConfig = async (testFilePath) => {
10802
11257
  if (!file) {
10803
11258
  throw new Error(`Invalid test configuration in ${testFilePath}`);
10804
11259
  }
10805
- const modulePath = Path5.resolve(Path5.dirname(testFilePath), file);
11260
+ const modulePath = Path4.resolve(Path4.dirname(testFilePath), file);
10806
11261
  const targetModule = await importModule(modulePath);
10807
11262
  return {
10808
11263
  file,
@@ -10978,7 +11433,7 @@ var executeTestingCommand = async (testFiles, generateMode = false, report) => {
10978
11433
  const completeMessage = generateMode ? "Test generation complete." : "Testing complete.";
10979
11434
  try {
10980
11435
  for (const testFile of testFiles) {
10981
- const resolvedTestFile = Path5.resolve(testFile);
11436
+ const resolvedTestFile = Path4.resolve(testFile);
10982
11437
  if (generateMode) {
10983
11438
  await generateTestsForFile(resolvedTestFile, report);
10984
11439
  } else {