@resistdesign/voltra 3.0.0-alpha.4 → 3.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { D as DAC, a as Indexing, b as ORM, c as Routing } from '../index-DZ2BB4iX.js';
1
+ export { D as DAC, a as Indexing, b as ORM, c as Routing } from '../index-DbLgMAxB.js';
2
2
  import '@aws-sdk/client-dynamodb';
3
3
  import '@aws-sdk/client-s3';
4
4
  import '../SearchTypes-DjN6YQzE.js';
package/api/index.js CHANGED
@@ -6110,7 +6110,7 @@ var getDACPathsMatch = (dacPath, resourcePath) => {
6110
6110
  }
6111
6111
  return results;
6112
6112
  };
6113
- var getFlattenedDACConstraints = (role, getDACRoleById, dacRoleCache) => {
6113
+ var getFlattenedDACConstraints = async (role, getDACRoleById, dacRoleCache) => {
6114
6114
  const { childRoleIds = [], constraints = [] } = role;
6115
6115
  let flattenedConstraints = [...constraints];
6116
6116
  for (const cRI of childRoleIds) {
@@ -6118,20 +6118,22 @@ var getFlattenedDACConstraints = (role, getDACRoleById, dacRoleCache) => {
6118
6118
  if (dacRoleCache && dacRoleCache[cRI]) {
6119
6119
  childRole = dacRoleCache[cRI];
6120
6120
  } else {
6121
- childRole = getDACRoleById(cRI);
6121
+ childRole = await getDACRoleById(cRI);
6122
6122
  if (dacRoleCache) {
6123
6123
  dacRoleCache[cRI] = childRole;
6124
6124
  }
6125
6125
  }
6126
- flattenedConstraints = [
6127
- ...flattenedConstraints,
6128
- ...getFlattenedDACConstraints(childRole, getDACRoleById, dacRoleCache)
6129
- ];
6126
+ const childConstraints = await getFlattenedDACConstraints(
6127
+ childRole,
6128
+ getDACRoleById,
6129
+ dacRoleCache
6130
+ );
6131
+ flattenedConstraints = [...flattenedConstraints, ...childConstraints];
6130
6132
  }
6131
6133
  return flattenedConstraints;
6132
6134
  };
6133
- var getResourceAccessByDACRole = (fullResourcePath, role, getDACRoleById, dacRoleCache) => {
6134
- const flattenedConstraints = getFlattenedDACConstraints(
6135
+ var getResourceAccessByDACRole = async (fullResourcePath, role, getDACRoleById, dacRoleCache) => {
6136
+ const flattenedConstraints = await getFlattenedDACConstraints(
6135
6137
  role,
6136
6138
  getDACRoleById,
6137
6139
  dacRoleCache
@@ -6272,7 +6274,7 @@ var getFullORMDACRole = (prefixPath = [], constraintType) => ({
6272
6274
  }
6273
6275
  ]
6274
6276
  });
6275
- var getDACRoleHasAccessToDataItem = (prefixPath, operation, typeName, dataItem, typeInfo, role, getDACRoleById, dacRoleCache) => {
6277
+ var getDACRoleHasAccessToDataItem = async (prefixPath, operation, typeName, dataItem, typeInfo, role, getDACRoleById, dacRoleCache) => {
6276
6278
  const cleanItemPathPrefix = prefixPath ? prefixPath : [];
6277
6279
  const resultMap = {
6278
6280
  allowed: false,
@@ -6295,7 +6297,7 @@ var getDACRoleHasAccessToDataItem = (prefixPath, operation, typeName, dataItem,
6295
6297
  const {
6296
6298
  allowed: primaryResourceAllowed,
6297
6299
  denied: primaryResourceDenied
6298
- } = getResourceAccessByDACRole(
6300
+ } = await getResourceAccessByDACRole(
6299
6301
  primaryResourcePath,
6300
6302
  role,
6301
6303
  getDACRoleById,
@@ -6316,7 +6318,7 @@ var getDACRoleHasAccessToDataItem = (prefixPath, operation, typeName, dataItem,
6316
6318
  const {
6317
6319
  allowed: fieldResourceAllowed,
6318
6320
  denied: fieldResourceDenied
6319
- } = getResourceAccessByDACRole(
6321
+ } = await getResourceAccessByDACRole(
6320
6322
  fieldResourcePath,
6321
6323
  role,
6322
6324
  getDACRoleById,
@@ -6378,9 +6380,9 @@ var executeDriverListItems = async (driver, config, filter, transform, selectedF
6378
6380
  filter ? void 0 : selectedFields
6379
6381
  );
6380
6382
  for (const itm of items) {
6381
- const includeItem = filter ? filter(itm) : true;
6383
+ const includeItem = filter ? await filter(itm) : true;
6382
6384
  if (includeItem) {
6383
- const transformedItem = transform ? transform(itm) : itm;
6385
+ const transformedItem = transform ? await transform(itm) : itm;
6384
6386
  filteredItems.push(transformedItem);
6385
6387
  }
6386
6388
  }
@@ -6500,13 +6502,17 @@ var TypeInfoORMService = class {
6500
6502
  }
6501
6503
  dacRoleCache = {};
6502
6504
  indexingRelationshipDriver;
6503
- getItemDACValidation = (item, typeName, typeOperation) => {
6505
+ getItemDACValidation = async (item, typeName, typeOperation) => {
6504
6506
  const { useDAC } = this.config;
6505
6507
  if (useDAC) {
6506
6508
  const typeInfo = this.getTypeInfo(typeName);
6507
6509
  const { dacConfig } = this.config;
6508
6510
  const { itemResourcePathPrefix, accessingRole, getDACRoleById } = dacConfig;
6509
- return mergeDACDataItemResourceAccessResultMaps(
6511
+ const [
6512
+ typeOperationAccess,
6513
+ allItemOperationsAccess,
6514
+ allOperationsAccess
6515
+ ] = await Promise.all([
6510
6516
  getDACRoleHasAccessToDataItem(
6511
6517
  itemResourcePathPrefix,
6512
6518
  typeOperation,
@@ -6537,6 +6543,11 @@ var TypeInfoORMService = class {
6537
6543
  getDACRoleById,
6538
6544
  this.dacRoleCache
6539
6545
  )
6546
+ ]);
6547
+ return mergeDACDataItemResourceAccessResultMaps(
6548
+ typeOperationAccess,
6549
+ allItemOperationsAccess,
6550
+ allOperationsAccess
6540
6551
  );
6541
6552
  } else {
6542
6553
  return {
@@ -6546,12 +6557,16 @@ var TypeInfoORMService = class {
6546
6557
  };
6547
6558
  }
6548
6559
  };
6549
- getRelationshipDACValidation = (itemRelationship, relationshipOperation) => {
6560
+ getRelationshipDACValidation = async (itemRelationship, relationshipOperation) => {
6550
6561
  const { useDAC } = this.config;
6551
6562
  if (useDAC) {
6552
6563
  const { dacConfig } = this.config;
6553
6564
  const { relationshipResourcePathPrefix, accessingRole, getDACRoleById } = dacConfig;
6554
- return mergeDACAccessResults(
6565
+ const [
6566
+ operationAccess,
6567
+ allRelationshipOperationsAccess,
6568
+ allOperationsAccess
6569
+ ] = await Promise.all([
6555
6570
  getResourceAccessByDACRole(
6556
6571
  getItemRelationshipDACResourcePath(
6557
6572
  relationshipResourcePathPrefix,
@@ -6582,6 +6597,11 @@ var TypeInfoORMService = class {
6582
6597
  getDACRoleById,
6583
6598
  this.dacRoleCache
6584
6599
  )
6600
+ ]);
6601
+ return mergeDACAccessResults(
6602
+ operationAccess,
6603
+ allRelationshipOperationsAccess,
6604
+ allOperationsAccess
6585
6605
  );
6586
6606
  } else {
6587
6607
  return {
@@ -6980,7 +7000,7 @@ var TypeInfoORMService = class {
6980
7000
  * */
6981
7001
  createRelationship = async (relationshipItem) => {
6982
7002
  this.validateRelationshipItem(relationshipItem);
6983
- const { allowed: createAllowed, denied: createDenied } = this.getRelationshipDACValidation(
7003
+ const { allowed: createAllowed, denied: createDenied } = await this.getRelationshipDACValidation(
6984
7004
  relationshipItem,
6985
7005
  "SET" /* SET */
6986
7006
  );
@@ -7063,7 +7083,7 @@ var TypeInfoORMService = class {
7063
7083
  * */
7064
7084
  deleteRelationship = async (relationshipItem) => {
7065
7085
  this.validateRelationshipItem(relationshipItem);
7066
- const { allowed: deleteAllowed, denied: deleteDenied } = this.getRelationshipDACValidation(
7086
+ const { allowed: deleteAllowed, denied: deleteDenied } = await this.getRelationshipDACValidation(
7067
7087
  relationshipItem,
7068
7088
  "UNSET" /* UNSET */
7069
7089
  );
@@ -7197,7 +7217,7 @@ var TypeInfoORMService = class {
7197
7217
  const { items = [], cursor: nextCursor } = results;
7198
7218
  const revisedItems = [];
7199
7219
  for (const rItm of items) {
7200
- const { allowed: readAllowed, denied: readDenied } = this.getRelationshipDACValidation(
7220
+ const { allowed: readAllowed, denied: readDenied } = await this.getRelationshipDACValidation(
7201
7221
  rItm,
7202
7222
  "GET" /* GET */
7203
7223
  );
@@ -7264,7 +7284,7 @@ var TypeInfoORMService = class {
7264
7284
  allowed: createAllowed,
7265
7285
  denied: createDenied,
7266
7286
  fieldsResources = {}
7267
- } = this.getItemDACValidation(item, typeName, "CREATE" /* CREATE */);
7287
+ } = await this.getItemDACValidation(item, typeName, "CREATE" /* CREATE */);
7268
7288
  if (createDenied || !createAllowed) {
7269
7289
  throw {
7270
7290
  message: "INVALID_OPERATION" /* INVALID_OPERATION */,
@@ -7310,7 +7330,7 @@ var TypeInfoORMService = class {
7310
7330
  allowed: readAllowed,
7311
7331
  denied: readDenied,
7312
7332
  fieldsResources = {}
7313
- } = this.getItemDACValidation(item, typeName, "READ" /* READ */);
7333
+ } = await this.getItemDACValidation(item, typeName, "READ" /* READ */);
7314
7334
  if (readDenied || !readAllowed) {
7315
7335
  throw {
7316
7336
  message: "INVALID_OPERATION" /* INVALID_OPERATION */,
@@ -7359,7 +7379,7 @@ var TypeInfoORMService = class {
7359
7379
  allowed: updateAllowed,
7360
7380
  denied: updateDenied,
7361
7381
  fieldsResources = {}
7362
- } = this.getItemDACValidation(
7382
+ } = await this.getItemDACValidation(
7363
7383
  initialCleanItem,
7364
7384
  typeName,
7365
7385
  "UPDATE" /* UPDATE */
@@ -7371,7 +7391,7 @@ var TypeInfoORMService = class {
7371
7391
  item
7372
7392
  };
7373
7393
  } else {
7374
- const { fieldsResources: fieldsResourcesForDeleteOperation = {} } = this.getItemDACValidation(
7394
+ const { fieldsResources: fieldsResourcesForDeleteOperation = {} } = await this.getItemDACValidation(
7375
7395
  initialCleanItem,
7376
7396
  typeName,
7377
7397
  "DELETE" /* DELETE */
@@ -7427,7 +7447,11 @@ var TypeInfoORMService = class {
7427
7447
  this.validate(typeName, itemWithPrimaryFieldOnly, "DELETE" /* DELETE */);
7428
7448
  const driver = this.getDriverInternal(typeName);
7429
7449
  const existingItem = await driver.readItem(primaryFieldValue);
7430
- const { allowed: deleteAllowed, denied: deleteDenied } = this.getItemDACValidation(existingItem, typeName, "DELETE" /* DELETE */);
7450
+ const { allowed: deleteAllowed, denied: deleteDenied } = await this.getItemDACValidation(
7451
+ existingItem,
7452
+ typeName,
7453
+ "DELETE" /* DELETE */
7454
+ );
7431
7455
  if (deleteDenied || !deleteAllowed) {
7432
7456
  throw {
7433
7457
  message: "INVALID_OPERATION" /* INVALID_OPERATION */,
@@ -7568,7 +7592,11 @@ var TypeInfoORMService = class {
7568
7592
  allowed: readAllowed,
7569
7593
  denied: readDenied,
7570
7594
  fieldsResources = {}
7571
- } = this.getItemDACValidation(item, typeName, "READ" /* READ */);
7595
+ } = await this.getItemDACValidation(
7596
+ item,
7597
+ typeName,
7598
+ "READ" /* READ */
7599
+ );
7572
7600
  const listDenied = readDenied || !readAllowed;
7573
7601
  if (listDenied) {
7574
7602
  continue;
@@ -7606,12 +7634,16 @@ var TypeInfoORMService = class {
7606
7634
  const results = await executeDriverListItems(
7607
7635
  driver,
7608
7636
  config,
7609
- useDAC ? (item) => {
7637
+ useDAC ? async (item) => {
7610
7638
  const {
7611
7639
  allowed: readAllowed,
7612
7640
  denied: readDenied,
7613
7641
  fieldsResources = {}
7614
- } = this.getItemDACValidation(item, typeName, "READ" /* READ */);
7642
+ } = await this.getItemDACValidation(
7643
+ item,
7644
+ typeName,
7645
+ "READ" /* READ */
7646
+ );
7615
7647
  const listDenied = readDenied || !readAllowed;
7616
7648
  if (!listDenied) {
7617
7649
  fieldsResourcesCache.push(fieldsResources);
package/iac/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { i as Packs, b as Utils } from '../index-DcvJOZ_c.js';
2
- export { a as SimpleCFT, S as SimpleCFTModification } from '../index-BkFZlfit.js';
1
+ export { i as Packs, b as Utils } from '../index-DgOzPKdr.js';
2
+ export { a as SimpleCFT, S as SimpleCFTModification } from '../index-BjFkoQmK.js';
package/iac/index.js CHANGED
@@ -1076,7 +1076,8 @@ var addCloudFunction = createResourcePack(
1076
1076
  ]
1077
1077
  }
1078
1078
  }
1079
- ]
1079
+ ],
1080
+ memorySize = 128
1080
1081
  }) => {
1081
1082
  return {
1082
1083
  Resources: {
@@ -1111,7 +1112,8 @@ var addCloudFunction = createResourcePack(
1111
1112
  Role: {
1112
1113
  "Fn::GetAtt": [`${id}Role`, "Arn"]
1113
1114
  },
1114
- Runtime: runtime
1115
+ Runtime: runtime,
1116
+ MemorySize: memorySize
1115
1117
  }
1116
1118
  }
1117
1119
  }
@@ -1 +1 @@
1
- export { A as AddAuthConfig, g as AddBuildPipelineConfig, w as AddCDNConfig, F as AddCloudFunctionConfig, J as AddDNSConfig, H as AddDatabaseConfig, Q as AddGatewayAuthorizerConfig, T as AddGatewayConfig, V as AddRepoConfig, X as AddSSLCertificateConfig, M as AddSecureFileStorageConfig, r as ArtifactIdentifier, s as Artifacts, j as AtLeastOne, m as Batch, B as BuildPipelineRepoConfig, u as BuildSpec, k as COMMAND_HELPERS, t as Cache, z as CloudFunctionRuntime, f as CodeBuildComputeType, e as CodeBuildEnvironmentType, d as CustomCodeBuildString, O as DEFAULT_AUTH_TYPE, D as DEFAULT_BUILD_PIPELINE_REPO_PROVIDER, E as Env, L as LinuxUserNameString, y as PLACEHOLDER_FUNCTION_CODE, n as Phase, o as PhaseConfig, l as Proxy, p as ReportGroupNameOrArn, q as Reports, S as SecondaryArtifacts, Y as YesOrNo, c as addAuth, h as addBuildPipeline, x as addCDN, G as addCloudFunction, K as addDNS, I as addDatabase, U as addGateway, W as addRepo, Z as addSSLCertificate, N as addSecureFileStorage, v as createBuildSpec } from '../../index-DcvJOZ_c.js';
1
+ export { A as AddAuthConfig, g as AddBuildPipelineConfig, w as AddCDNConfig, F as AddCloudFunctionConfig, J as AddDNSConfig, H as AddDatabaseConfig, Q as AddGatewayAuthorizerConfig, T as AddGatewayConfig, V as AddRepoConfig, X as AddSSLCertificateConfig, M as AddSecureFileStorageConfig, r as ArtifactIdentifier, s as Artifacts, j as AtLeastOne, m as Batch, B as BuildPipelineRepoConfig, u as BuildSpec, k as COMMAND_HELPERS, t as Cache, z as CloudFunctionRuntime, f as CodeBuildComputeType, e as CodeBuildEnvironmentType, d as CustomCodeBuildString, O as DEFAULT_AUTH_TYPE, D as DEFAULT_BUILD_PIPELINE_REPO_PROVIDER, E as Env, L as LinuxUserNameString, y as PLACEHOLDER_FUNCTION_CODE, n as Phase, o as PhaseConfig, l as Proxy, p as ReportGroupNameOrArn, q as Reports, S as SecondaryArtifacts, Y as YesOrNo, c as addAuth, h as addBuildPipeline, x as addCDN, G as addCloudFunction, K as addDNS, I as addDatabase, U as addGateway, W as addRepo, Z as addSSLCertificate, N as addSecureFileStorage, v as createBuildSpec } from '../../index-DgOzPKdr.js';
@@ -1035,7 +1035,8 @@ var addCloudFunction = createResourcePack(
1035
1035
  ]
1036
1036
  }
1037
1037
  }
1038
- ]
1038
+ ],
1039
+ memorySize = 128
1039
1040
  }) => {
1040
1041
  return {
1041
1042
  Resources: {
@@ -1070,7 +1071,8 @@ var addCloudFunction = createResourcePack(
1070
1071
  Role: {
1071
1072
  "Fn::GetAtt": [`${id}Role`, "Arn"]
1072
1073
  },
1073
- Runtime: runtime
1074
+ Runtime: runtime,
1075
+ MemorySize: memorySize
1074
1076
  }
1075
1077
  }
1076
1078
  }
@@ -1,4 +1,4 @@
1
- import { C as CloudFormationTemplate, R as ResourcePackApplier, P as ParameterInfo, a as ParameterGroup, i as index$1, b as index$2 } from './index-DcvJOZ_c.js';
1
+ import { C as CloudFormationTemplate, R as ResourcePackApplier, P as ParameterInfo, a as ParameterGroup, i as index$1, b as index$2 } from './index-DgOzPKdr.js';
2
2
 
3
3
  /**
4
4
  * @packageDocumentation
@@ -3995,6 +3995,7 @@ declare namespace index$3 {
3995
3995
  * import {
3996
3996
  * DACConstraintType,
3997
3997
  * DACRole,
3998
+ * getResourceAccessByDACRole,
3998
3999
  * WILDCARD_SIGNIFIER_PROTOTYPE,
3999
4000
  * } from "./DataAccessControl";
4000
4001
  *
@@ -4014,6 +4015,15 @@ declare namespace index$3 {
4014
4015
  * },
4015
4016
  * ],
4016
4017
  * };
4018
+ *
4019
+ * const getDACRoleById = async (id: string) =>
4020
+ * id === readerRole.id ? readerRole : readerRole;
4021
+ *
4022
+ * const access = await getResourceAccessByDACRole(
4023
+ * ["books", "public"],
4024
+ * readerRole,
4025
+ * getDACRoleById,
4026
+ * );
4017
4027
  * ```
4018
4028
  */
4019
4029
 
@@ -4024,9 +4034,23 @@ declare enum DACConstraintType {
4024
4034
  ALLOW = "ALLOW",
4025
4035
  DENY = "DENY"
4026
4036
  }
4037
+ /**
4038
+ * A wildcard segment used in DAC resource paths.
4039
+ * */
4040
+ type DACWildcardSignifier = {
4041
+ WILD_CARD: "*";
4042
+ };
4027
4043
  /**
4028
4044
  * A data access control (DAC) constraint.
4029
4045
  * */
4046
+ type DACResourcePathPart = LiteralValue | DACWildcardSignifier;
4047
+ /**
4048
+ * An ordered list of resource path segments used in DAC constraints.
4049
+ */
4050
+ type DACResourcePath = DACResourcePathPart[];
4051
+ /**
4052
+ * A data access control (DAC) constraint that defines an allow or deny rule for a resource path.
4053
+ */
4030
4054
  type DACConstraint = {
4031
4055
  /**
4032
4056
  * Whether the constraint explicitly allows or denies access.
@@ -4035,7 +4059,7 @@ type DACConstraint = {
4035
4059
  /**
4036
4060
  * The resource path to match against, in order of path segments.
4037
4061
  */
4038
- resourcePath: LiteralValue[];
4062
+ resourcePath: DACResourcePath;
4039
4063
  /**
4040
4064
  * When true, match the resource path as a prefix instead of an exact match.
4041
4065
  */
@@ -4101,7 +4125,7 @@ type DACPathMatchResults = {
4101
4125
  /**
4102
4126
  * The prototype of a DAC wildcard signifier.
4103
4127
  * */
4104
- declare const WILDCARD_SIGNIFIER_PROTOTYPE: Record<string, string>;
4128
+ declare const WILDCARD_SIGNIFIER_PROTOTYPE: DACWildcardSignifier;
4105
4129
  /**
4106
4130
  * Check if a given DAC path part value is a DAC wildcard signifier.
4107
4131
  * @returns True when the value matches the wildcard signifier prototype.
@@ -4127,7 +4151,7 @@ declare const getDACPathsMatch: (
4127
4151
  /**
4128
4152
  * DAC constraint path to evaluate for prefix/exact matches.
4129
4153
  */
4130
- dacPath: LiteralValue[],
4154
+ dacPath: DACResourcePath,
4131
4155
  /**
4132
4156
  * Resource path to compare against the DAC path.
4133
4157
  */
@@ -4144,11 +4168,11 @@ role: DACRole,
4144
4168
  /**
4145
4169
  * Lookup helper used to resolve child roles by id.
4146
4170
  */
4147
- getDACRoleById: (id: string) => DACRole,
4171
+ getDACRoleById: (id: string) => Promise<DACRole>,
4148
4172
  /**
4149
4173
  * SECURITY: Don't use this if you want realtime role resolution.
4150
4174
  * */
4151
- dacRoleCache?: Record<string, DACRole>) => DACConstraint[];
4175
+ dacRoleCache?: Record<string, DACRole>) => Promise<DACConstraint[]>;
4152
4176
  /**
4153
4177
  * Get the access to a given resource for a given DAC role.
4154
4178
  * @returns Allow/deny summary for the resource path.
@@ -4165,11 +4189,11 @@ role: DACRole,
4165
4189
  /**
4166
4190
  * Lookup helper used to resolve child roles by id.
4167
4191
  */
4168
- getDACRoleById: (id: string) => DACRole,
4192
+ getDACRoleById: (id: string) => Promise<DACRole>,
4169
4193
  /**
4170
4194
  * Optional cache to reuse resolved roles across calls.
4171
4195
  */
4172
- dacRoleCache?: Record<string, DACRole>) => DACAccessResult;
4196
+ dacRoleCache?: Record<string, DACRole>) => Promise<DACAccessResult>;
4173
4197
  /**
4174
4198
  * Merge multiple DAC access results.
4175
4199
  * @returns Combined allow/deny result.
@@ -4187,7 +4211,10 @@ type DataAccessControl_DACConstraintType = DACConstraintType;
4187
4211
  declare const DataAccessControl_DACConstraintType: typeof DACConstraintType;
4188
4212
  type DataAccessControl_DACDataItemResourceAccessResultMap = DACDataItemResourceAccessResultMap;
4189
4213
  type DataAccessControl_DACPathMatchResults = DACPathMatchResults;
4214
+ type DataAccessControl_DACResourcePath = DACResourcePath;
4215
+ type DataAccessControl_DACResourcePathPart = DACResourcePathPart;
4190
4216
  type DataAccessControl_DACRole = DACRole;
4217
+ type DataAccessControl_DACWildcardSignifier = DACWildcardSignifier;
4191
4218
  declare const DataAccessControl_WILDCARD_SIGNIFIER_PROTOTYPE: typeof WILDCARD_SIGNIFIER_PROTOTYPE;
4192
4219
  declare const DataAccessControl_getDACPathsMatch: typeof getDACPathsMatch;
4193
4220
  declare const DataAccessControl_getFlattenedDACConstraints: typeof getFlattenedDACConstraints;
@@ -4195,7 +4222,7 @@ declare const DataAccessControl_getResourceAccessByDACRole: typeof getResourceAc
4195
4222
  declare const DataAccessControl_getValueIsWildcardSignifier: typeof getValueIsWildcardSignifier;
4196
4223
  declare const DataAccessControl_mergeDACAccessResults: typeof mergeDACAccessResults;
4197
4224
  declare namespace DataAccessControl {
4198
- export { type DataAccessControl_BaseDACRole as BaseDACRole, type DataAccessControl_DACAccessResult as DACAccessResult, type DataAccessControl_DACConstraint as DACConstraint, DataAccessControl_DACConstraintType as DACConstraintType, type DataAccessControl_DACDataItemResourceAccessResultMap as DACDataItemResourceAccessResultMap, type DataAccessControl_DACPathMatchResults as DACPathMatchResults, type DataAccessControl_DACRole as DACRole, DataAccessControl_WILDCARD_SIGNIFIER_PROTOTYPE as WILDCARD_SIGNIFIER_PROTOTYPE, DataAccessControl_getDACPathsMatch as getDACPathsMatch, DataAccessControl_getFlattenedDACConstraints as getFlattenedDACConstraints, DataAccessControl_getResourceAccessByDACRole as getResourceAccessByDACRole, DataAccessControl_getValueIsWildcardSignifier as getValueIsWildcardSignifier, DataAccessControl_mergeDACAccessResults as mergeDACAccessResults };
4225
+ export { type DataAccessControl_BaseDACRole as BaseDACRole, type DataAccessControl_DACAccessResult as DACAccessResult, type DataAccessControl_DACConstraint as DACConstraint, DataAccessControl_DACConstraintType as DACConstraintType, type DataAccessControl_DACDataItemResourceAccessResultMap as DACDataItemResourceAccessResultMap, type DataAccessControl_DACPathMatchResults as DACPathMatchResults, type DataAccessControl_DACResourcePath as DACResourcePath, type DataAccessControl_DACResourcePathPart as DACResourcePathPart, type DataAccessControl_DACRole as DACRole, type DataAccessControl_DACWildcardSignifier as DACWildcardSignifier, DataAccessControl_WILDCARD_SIGNIFIER_PROTOTYPE as WILDCARD_SIGNIFIER_PROTOTYPE, DataAccessControl_getDACPathsMatch as getDACPathsMatch, DataAccessControl_getFlattenedDACConstraints as getFlattenedDACConstraints, DataAccessControl_getResourceAccessByDACRole as getResourceAccessByDACRole, DataAccessControl_getValueIsWildcardSignifier as getValueIsWildcardSignifier, DataAccessControl_mergeDACAccessResults as mergeDACAccessResults };
4199
4226
  }
4200
4227
 
4201
4228
  /**
@@ -4251,7 +4278,7 @@ type TypeInfoORMDACConfig = {
4251
4278
  /**
4252
4279
  * Lookup helper used to resolve roles by id.
4253
4280
  */
4254
- getDACRoleById: (id: string) => DACRole;
4281
+ getDACRoleById: (id: string) => Promise<DACRole>;
4255
4282
  };
4256
4283
  /**
4257
4284
  * Configuration for TypeInfoORM indexing integrations.
@@ -4378,7 +4405,7 @@ declare class TypeInfoORMService implements TypeInfoORMAPI {
4378
4405
  /**
4379
4406
  * Operation being evaluated.
4380
4407
  */
4381
- typeOperation: TypeOperation) => DACDataItemResourceAccessResultMap;
4408
+ typeOperation: TypeOperation) => Promise<DACDataItemResourceAccessResultMap>;
4382
4409
  protected getRelationshipDACValidation: (
4383
4410
  /**
4384
4411
  * Relationship to evaluate for access.
@@ -4387,7 +4414,7 @@ declare class TypeInfoORMService implements TypeInfoORMAPI {
4387
4414
  /**
4388
4415
  * Relationship operation being evaluated.
4389
4416
  */
4390
- relationshipOperation: RelationshipOperation) => DACAccessResult;
4417
+ relationshipOperation: RelationshipOperation) => Promise<DACAccessResult>;
4391
4418
  protected getWrappedDriverWithExtendedErrorData: <ItemType extends TypeInfoDataItem, UniquelyIdentifyingFieldName extends keyof ItemType>(
4392
4419
  /**
4393
4420
  * Driver instance to wrap.
@@ -4934,11 +4961,11 @@ role: DACRole,
4934
4961
  /**
4935
4962
  * Lookup helper used to resolve roles by id.
4936
4963
  */
4937
- getDACRoleById: (id: string) => DACRole,
4964
+ getDACRoleById: (id: string) => Promise<DACRole>,
4938
4965
  /**
4939
4966
  * SECURITY: Don't use this if you want realtime role resolution.
4940
4967
  * */
4941
- dacRoleCache?: Record<string, DACRole>) => DACDataItemResourceAccessResultMap;
4968
+ dacRoleCache?: Record<string, DACRole>) => Promise<DACDataItemResourceAccessResultMap>;
4942
4969
  /**
4943
4970
  * Merge multiple DAC data item resource access result maps.
4944
4971
  * @returns Merged access result map.
@@ -235679,6 +235679,14 @@ type AddCloudFunctionConfig = {
235679
235679
  * IAM policy statements to attach to the role.
235680
235680
  */
235681
235681
  policies?: AWS.IAM.Role.Policy[];
235682
+ /**
235683
+ * Lambda function memory size in MB.
235684
+ *
235685
+ * You can configure memory between 128 MB and 10,240 MB in 1-MB increments.
235686
+ *
235687
+ * @default 128
235688
+ */
235689
+ memorySize?: number;
235682
235690
  };
235683
235691
  /**
235684
235692
  * Add a serverless cloud function to run part or all of your API (back-end) without always running servers.
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { i as API } from './index-DZ2BB4iX.js';
1
+ export { i as API } from './index-DbLgMAxB.js';
2
2
  export { i as App } from './index-IokxSNxm.js';
3
- export { i as IaC } from './index-BkFZlfit.js';
3
+ export { i as IaC } from './index-BjFkoQmK.js';
4
4
  export { i as Common } from './index-C3-iD9Mh.js';
5
5
  import '@aws-sdk/client-dynamodb';
6
6
  import '@aws-sdk/client-s3';
@@ -9,5 +9,5 @@ import './Validation-CFP59oIP.js';
9
9
  import './Types-C7XjUjoF.js';
10
10
  import 'react';
11
11
  import 'react/jsx-runtime';
12
- import './index-DcvJOZ_c.js';
12
+ import './index-DgOzPKdr.js';
13
13
  import 'typescript';
package/index.js CHANGED
@@ -6285,7 +6285,7 @@ var getDACPathsMatch = (dacPath, resourcePath) => {
6285
6285
  }
6286
6286
  return results;
6287
6287
  };
6288
- var getFlattenedDACConstraints = (role, getDACRoleById, dacRoleCache) => {
6288
+ var getFlattenedDACConstraints = async (role, getDACRoleById, dacRoleCache) => {
6289
6289
  const { childRoleIds = [], constraints = [] } = role;
6290
6290
  let flattenedConstraints = [...constraints];
6291
6291
  for (const cRI of childRoleIds) {
@@ -6293,20 +6293,22 @@ var getFlattenedDACConstraints = (role, getDACRoleById, dacRoleCache) => {
6293
6293
  if (dacRoleCache && dacRoleCache[cRI]) {
6294
6294
  childRole = dacRoleCache[cRI];
6295
6295
  } else {
6296
- childRole = getDACRoleById(cRI);
6296
+ childRole = await getDACRoleById(cRI);
6297
6297
  if (dacRoleCache) {
6298
6298
  dacRoleCache[cRI] = childRole;
6299
6299
  }
6300
6300
  }
6301
- flattenedConstraints = [
6302
- ...flattenedConstraints,
6303
- ...getFlattenedDACConstraints(childRole, getDACRoleById, dacRoleCache)
6304
- ];
6301
+ const childConstraints = await getFlattenedDACConstraints(
6302
+ childRole,
6303
+ getDACRoleById,
6304
+ dacRoleCache
6305
+ );
6306
+ flattenedConstraints = [...flattenedConstraints, ...childConstraints];
6305
6307
  }
6306
6308
  return flattenedConstraints;
6307
6309
  };
6308
- var getResourceAccessByDACRole = (fullResourcePath, role, getDACRoleById, dacRoleCache) => {
6309
- const flattenedConstraints = getFlattenedDACConstraints(
6310
+ var getResourceAccessByDACRole = async (fullResourcePath, role, getDACRoleById, dacRoleCache) => {
6311
+ const flattenedConstraints = await getFlattenedDACConstraints(
6310
6312
  role,
6311
6313
  getDACRoleById,
6312
6314
  dacRoleCache
@@ -6447,7 +6449,7 @@ var getFullORMDACRole = (prefixPath = [], constraintType) => ({
6447
6449
  }
6448
6450
  ]
6449
6451
  });
6450
- var getDACRoleHasAccessToDataItem = (prefixPath, operation, typeName, dataItem, typeInfo, role, getDACRoleById, dacRoleCache) => {
6452
+ var getDACRoleHasAccessToDataItem = async (prefixPath, operation, typeName, dataItem, typeInfo, role, getDACRoleById, dacRoleCache) => {
6451
6453
  const cleanItemPathPrefix = prefixPath ? prefixPath : [];
6452
6454
  const resultMap = {
6453
6455
  allowed: false,
@@ -6470,7 +6472,7 @@ var getDACRoleHasAccessToDataItem = (prefixPath, operation, typeName, dataItem,
6470
6472
  const {
6471
6473
  allowed: primaryResourceAllowed,
6472
6474
  denied: primaryResourceDenied
6473
- } = getResourceAccessByDACRole(
6475
+ } = await getResourceAccessByDACRole(
6474
6476
  primaryResourcePath,
6475
6477
  role,
6476
6478
  getDACRoleById,
@@ -6491,7 +6493,7 @@ var getDACRoleHasAccessToDataItem = (prefixPath, operation, typeName, dataItem,
6491
6493
  const {
6492
6494
  allowed: fieldResourceAllowed,
6493
6495
  denied: fieldResourceDenied
6494
- } = getResourceAccessByDACRole(
6496
+ } = await getResourceAccessByDACRole(
6495
6497
  fieldResourcePath,
6496
6498
  role,
6497
6499
  getDACRoleById,
@@ -6553,9 +6555,9 @@ var executeDriverListItems = async (driver, config, filter, transform, selectedF
6553
6555
  filter ? void 0 : selectedFields
6554
6556
  );
6555
6557
  for (const itm of items) {
6556
- const includeItem = filter ? filter(itm) : true;
6558
+ const includeItem = filter ? await filter(itm) : true;
6557
6559
  if (includeItem) {
6558
- const transformedItem = transform ? transform(itm) : itm;
6560
+ const transformedItem = transform ? await transform(itm) : itm;
6559
6561
  filteredItems.push(transformedItem);
6560
6562
  }
6561
6563
  }
@@ -6675,13 +6677,17 @@ var TypeInfoORMService = class {
6675
6677
  }
6676
6678
  dacRoleCache = {};
6677
6679
  indexingRelationshipDriver;
6678
- getItemDACValidation = (item, typeName, typeOperation) => {
6680
+ getItemDACValidation = async (item, typeName, typeOperation) => {
6679
6681
  const { useDAC } = this.config;
6680
6682
  if (useDAC) {
6681
6683
  const typeInfo = this.getTypeInfo(typeName);
6682
6684
  const { dacConfig } = this.config;
6683
6685
  const { itemResourcePathPrefix, accessingRole, getDACRoleById } = dacConfig;
6684
- return mergeDACDataItemResourceAccessResultMaps(
6686
+ const [
6687
+ typeOperationAccess,
6688
+ allItemOperationsAccess,
6689
+ allOperationsAccess
6690
+ ] = await Promise.all([
6685
6691
  getDACRoleHasAccessToDataItem(
6686
6692
  itemResourcePathPrefix,
6687
6693
  typeOperation,
@@ -6712,6 +6718,11 @@ var TypeInfoORMService = class {
6712
6718
  getDACRoleById,
6713
6719
  this.dacRoleCache
6714
6720
  )
6721
+ ]);
6722
+ return mergeDACDataItemResourceAccessResultMaps(
6723
+ typeOperationAccess,
6724
+ allItemOperationsAccess,
6725
+ allOperationsAccess
6715
6726
  );
6716
6727
  } else {
6717
6728
  return {
@@ -6721,12 +6732,16 @@ var TypeInfoORMService = class {
6721
6732
  };
6722
6733
  }
6723
6734
  };
6724
- getRelationshipDACValidation = (itemRelationship, relationshipOperation) => {
6735
+ getRelationshipDACValidation = async (itemRelationship, relationshipOperation) => {
6725
6736
  const { useDAC } = this.config;
6726
6737
  if (useDAC) {
6727
6738
  const { dacConfig } = this.config;
6728
6739
  const { relationshipResourcePathPrefix, accessingRole, getDACRoleById } = dacConfig;
6729
- return mergeDACAccessResults(
6740
+ const [
6741
+ operationAccess,
6742
+ allRelationshipOperationsAccess,
6743
+ allOperationsAccess
6744
+ ] = await Promise.all([
6730
6745
  getResourceAccessByDACRole(
6731
6746
  getItemRelationshipDACResourcePath(
6732
6747
  relationshipResourcePathPrefix,
@@ -6757,6 +6772,11 @@ var TypeInfoORMService = class {
6757
6772
  getDACRoleById,
6758
6773
  this.dacRoleCache
6759
6774
  )
6775
+ ]);
6776
+ return mergeDACAccessResults(
6777
+ operationAccess,
6778
+ allRelationshipOperationsAccess,
6779
+ allOperationsAccess
6760
6780
  );
6761
6781
  } else {
6762
6782
  return {
@@ -7155,7 +7175,7 @@ var TypeInfoORMService = class {
7155
7175
  * */
7156
7176
  createRelationship = async (relationshipItem) => {
7157
7177
  this.validateRelationshipItem(relationshipItem);
7158
- const { allowed: createAllowed, denied: createDenied } = this.getRelationshipDACValidation(
7178
+ const { allowed: createAllowed, denied: createDenied } = await this.getRelationshipDACValidation(
7159
7179
  relationshipItem,
7160
7180
  "SET" /* SET */
7161
7181
  );
@@ -7238,7 +7258,7 @@ var TypeInfoORMService = class {
7238
7258
  * */
7239
7259
  deleteRelationship = async (relationshipItem) => {
7240
7260
  this.validateRelationshipItem(relationshipItem);
7241
- const { allowed: deleteAllowed, denied: deleteDenied } = this.getRelationshipDACValidation(
7261
+ const { allowed: deleteAllowed, denied: deleteDenied } = await this.getRelationshipDACValidation(
7242
7262
  relationshipItem,
7243
7263
  "UNSET" /* UNSET */
7244
7264
  );
@@ -7372,7 +7392,7 @@ var TypeInfoORMService = class {
7372
7392
  const { items = [], cursor: nextCursor } = results;
7373
7393
  const revisedItems = [];
7374
7394
  for (const rItm of items) {
7375
- const { allowed: readAllowed, denied: readDenied } = this.getRelationshipDACValidation(
7395
+ const { allowed: readAllowed, denied: readDenied } = await this.getRelationshipDACValidation(
7376
7396
  rItm,
7377
7397
  "GET" /* GET */
7378
7398
  );
@@ -7439,7 +7459,7 @@ var TypeInfoORMService = class {
7439
7459
  allowed: createAllowed,
7440
7460
  denied: createDenied,
7441
7461
  fieldsResources = {}
7442
- } = this.getItemDACValidation(item, typeName, "CREATE" /* CREATE */);
7462
+ } = await this.getItemDACValidation(item, typeName, "CREATE" /* CREATE */);
7443
7463
  if (createDenied || !createAllowed) {
7444
7464
  throw {
7445
7465
  message: "INVALID_OPERATION" /* INVALID_OPERATION */,
@@ -7485,7 +7505,7 @@ var TypeInfoORMService = class {
7485
7505
  allowed: readAllowed,
7486
7506
  denied: readDenied,
7487
7507
  fieldsResources = {}
7488
- } = this.getItemDACValidation(item, typeName, "READ" /* READ */);
7508
+ } = await this.getItemDACValidation(item, typeName, "READ" /* READ */);
7489
7509
  if (readDenied || !readAllowed) {
7490
7510
  throw {
7491
7511
  message: "INVALID_OPERATION" /* INVALID_OPERATION */,
@@ -7534,7 +7554,7 @@ var TypeInfoORMService = class {
7534
7554
  allowed: updateAllowed,
7535
7555
  denied: updateDenied,
7536
7556
  fieldsResources = {}
7537
- } = this.getItemDACValidation(
7557
+ } = await this.getItemDACValidation(
7538
7558
  initialCleanItem,
7539
7559
  typeName,
7540
7560
  "UPDATE" /* UPDATE */
@@ -7546,7 +7566,7 @@ var TypeInfoORMService = class {
7546
7566
  item
7547
7567
  };
7548
7568
  } else {
7549
- const { fieldsResources: fieldsResourcesForDeleteOperation = {} } = this.getItemDACValidation(
7569
+ const { fieldsResources: fieldsResourcesForDeleteOperation = {} } = await this.getItemDACValidation(
7550
7570
  initialCleanItem,
7551
7571
  typeName,
7552
7572
  "DELETE" /* DELETE */
@@ -7602,7 +7622,11 @@ var TypeInfoORMService = class {
7602
7622
  this.validate(typeName, itemWithPrimaryFieldOnly, "DELETE" /* DELETE */);
7603
7623
  const driver = this.getDriverInternal(typeName);
7604
7624
  const existingItem = await driver.readItem(primaryFieldValue);
7605
- const { allowed: deleteAllowed, denied: deleteDenied } = this.getItemDACValidation(existingItem, typeName, "DELETE" /* DELETE */);
7625
+ const { allowed: deleteAllowed, denied: deleteDenied } = await this.getItemDACValidation(
7626
+ existingItem,
7627
+ typeName,
7628
+ "DELETE" /* DELETE */
7629
+ );
7606
7630
  if (deleteDenied || !deleteAllowed) {
7607
7631
  throw {
7608
7632
  message: "INVALID_OPERATION" /* INVALID_OPERATION */,
@@ -7743,7 +7767,11 @@ var TypeInfoORMService = class {
7743
7767
  allowed: readAllowed,
7744
7768
  denied: readDenied,
7745
7769
  fieldsResources = {}
7746
- } = this.getItemDACValidation(item, typeName, "READ" /* READ */);
7770
+ } = await this.getItemDACValidation(
7771
+ item,
7772
+ typeName,
7773
+ "READ" /* READ */
7774
+ );
7747
7775
  const listDenied = readDenied || !readAllowed;
7748
7776
  if (listDenied) {
7749
7777
  continue;
@@ -7781,12 +7809,16 @@ var TypeInfoORMService = class {
7781
7809
  const results = await executeDriverListItems(
7782
7810
  driver,
7783
7811
  config,
7784
- useDAC ? (item) => {
7812
+ useDAC ? async (item) => {
7785
7813
  const {
7786
7814
  allowed: readAllowed,
7787
7815
  denied: readDenied,
7788
7816
  fieldsResources = {}
7789
- } = this.getItemDACValidation(item, typeName, "READ" /* READ */);
7817
+ } = await this.getItemDACValidation(
7818
+ item,
7819
+ typeName,
7820
+ "READ" /* READ */
7821
+ );
7790
7822
  const listDenied = readDenied || !readAllowed;
7791
7823
  if (!listDenied) {
7792
7824
  fieldsResourcesCache.push(fieldsResources);
@@ -9959,7 +9991,8 @@ var addCloudFunction = createResourcePack(
9959
9991
  ]
9960
9992
  }
9961
9993
  }
9962
- ]
9994
+ ],
9995
+ memorySize = 128
9963
9996
  }) => {
9964
9997
  return {
9965
9998
  Resources: {
@@ -9994,7 +10027,8 @@ var addCloudFunction = createResourcePack(
9994
10027
  Role: {
9995
10028
  "Fn::GetAtt": [`${id}Role`, "Arn"]
9996
10029
  },
9997
- Runtime: runtime
10030
+ Runtime: runtime,
10031
+ MemorySize: memorySize
9998
10032
  }
9999
10033
  }
10000
10034
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resistdesign/voltra",
3
- "version": "3.0.0-alpha.4",
3
+ "version": "3.0.0-alpha.6",
4
4
  "description": "With our powers combined!",
5
5
  "homepage": "https://voltra.app",
6
6
  "repository": "git@github.com:resistdesign/voltra.git",