@resistdesign/voltra 3.0.0-alpha.26 → 3.0.0-alpha.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -218,6 +218,14 @@ How it works:
218
218
  - Strategy is auto-selected:
219
219
  - DOM + History API => browser history strategy.
220
220
  - Otherwise => in-memory native strategy.
221
+ - Native strategy automatically wires Android hardware back to route history.
222
+ - If Voltra can go back (`history.index > 0`), it consumes the event and navigates back.
223
+ - If Voltra cannot go back, the event is not consumed so OS/native container behavior continues.
224
+
225
+ Optional back affordances:
226
+
227
+ - `adapter.back?.()` navigates backward when supported.
228
+ - `adapter.canGoBack?.()` reports whether back navigation is currently possible.
221
229
 
222
230
  Escape hatches (root-only):
223
231
 
package/api/index.js CHANGED
@@ -1,3 +1,9 @@
1
+ import '../chunk-MUCSL3UR.js';
2
+ import { ERROR_MESSAGE_CONSTANTS, validateTypeOperationAllowed, getValidityValue, validateTypeInfoValue, validateTypeInfoFieldValue } from '../chunk-LGM75I6P.js';
3
+ import { ITEM_RELATIONSHIP_DAC_RESOURCE_NAME } from '../chunk-HVY7POTD.js';
4
+ import '../chunk-IWRHGGGH.js';
5
+ import { mergeStringPaths, getPathString, getPathArray } from '../chunk-GYWRAW3Y.js';
6
+ import '../chunk-I2KLQ2HA.js';
1
7
  import { QueryCommand, GetItemCommand, BatchGetItemCommand, BatchWriteItemCommand, DynamoDBClient, PutItemCommand, UpdateItemCommand, DeleteItemCommand, ScanCommand } from '@aws-sdk/client-dynamodb';
2
8
  import { marshall, unmarshall } from '@aws-sdk/util-dynamodb';
3
9
  import { S3, PutObjectCommand, HeadObjectCommand, CopyObjectCommand, GetObjectCommand, DeleteObjectCommand, ListObjectsV2Command } from '@aws-sdk/client-s3';
@@ -4135,44 +4141,6 @@ function createSearchTrace() {
4135
4141
  ddbItemReadCalls: 0
4136
4142
  };
4137
4143
  }
4138
-
4139
- // src/common/Routing.ts
4140
- var PATH_DELIMITER = "/";
4141
- var getPotentialJSONValue = (value) => {
4142
- try {
4143
- return JSON.parse(value);
4144
- } catch (error) {
4145
- return value;
4146
- }
4147
- };
4148
- var getPathArray = (path, delimiter = PATH_DELIMITER, filterEmptyOutput = false, filterEmptyInput = true, useJson = true, uriDecodeParts = true) => path.split(delimiter).filter(filterEmptyInput ? (p) => p !== "" : () => true).map(uriDecodeParts ? decodeURIComponent : (x) => x).map(useJson ? getPotentialJSONValue : (p) => p).filter(filterEmptyOutput ? (p) => p ?? false : () => true);
4149
- var getPathString = (parts = [], delimiter = PATH_DELIMITER, filterEmptyInput = false, useJson = true, uriEncodeParts = false) => parts.filter(filterEmptyInput ? (p) => p ?? false : () => true).map(useJson ? (p) => JSON.stringify(p) : (x) => x).map(uriEncodeParts ? encodeURIComponent : (x) => x).join(delimiter);
4150
- var mergeStringPaths = (path1, path2, delimiter = PATH_DELIMITER, filterEmptyOutput = false, filterEmptyInput = true, useJson = true, uriEncodeParts = false) => getPathString(
4151
- [
4152
- ...getPathArray(
4153
- path1,
4154
- delimiter,
4155
- filterEmptyOutput,
4156
- filterEmptyInput,
4157
- useJson,
4158
- uriEncodeParts
4159
- ),
4160
- ...getPathArray(
4161
- path2,
4162
- delimiter,
4163
- filterEmptyOutput,
4164
- filterEmptyInput,
4165
- useJson,
4166
- uriEncodeParts
4167
- )
4168
- ],
4169
- delimiter,
4170
- filterEmptyInput,
4171
- useJson,
4172
- uriEncodeParts
4173
- );
4174
-
4175
- // src/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.ts
4176
4144
  var S3_FILE_DRIVER_ERRORS = {
4177
4145
  /**
4178
4146
  * File path contains invalid segments.
@@ -6489,348 +6457,6 @@ var SUPPORTED_TYPE_INFO_ORM_DB_DRIVERS = {
6489
6457
  ["S3_FILE_ITEM" /* S3_FILE_ITEM */]: S3SupportedFileItemDBDriverEntry
6490
6458
  };
6491
6459
 
6492
- // src/common/TypeParsing/Validation.ts
6493
- var INVALID_CUSTOM_TYPE = "INVALID_CUSTOM_TYPE";
6494
- var PRIMITIVE_ERROR_MESSAGE_CONSTANTS = {
6495
- string: "NOT_A_STRING",
6496
- number: "NOT_A_NUMBER",
6497
- boolean: "NOT_A_BOOLEAN"
6498
- };
6499
- var ERROR_MESSAGE_CONSTANTS = {
6500
- MISSING: "MISSING",
6501
- INVALID_OPTION: "INVALID_OPTION",
6502
- INVALID_FIELD: "INVALID_FIELD",
6503
- RELATIONSHIP_VALUES_ARE_STRICTLY_EXCLUDED: "RELATIONSHIP_VALUES_ARE_STRICTLY_EXCLUDED",
6504
- INVALID_TYPE: "INVALID_TYPE",
6505
- NO_UNION_TYPE_MATCHED: "NO_UNION_TYPE_MATCHED",
6506
- TYPE_DOES_NOT_EXIST: "TYPE_DOES_NOT_EXIST",
6507
- INVALID_PATTERN: "INVALID_PATTERN",
6508
- VALUE_DOES_NOT_MATCH_PATTERN: "VALUE_DOES_NOT_MATCH_PATTERN"
6509
- };
6510
- var DENIED_TYPE_OPERATIONS = {
6511
- CREATE: "DENIED_TYPE_OPERATION_CREATE",
6512
- READ: "DENIED_TYPE_OPERATION_READ",
6513
- UPDATE: "DENIED_TYPE_OPERATION_UPDATE",
6514
- DELETE: "DENIED_TYPE_OPERATION_DELETE"
6515
- };
6516
- var validateValueMatchesPattern = (typeName, value, pattern) => {
6517
- const results = {
6518
- typeName,
6519
- valid: true,
6520
- error: "",
6521
- errorMap: {}
6522
- };
6523
- {
6524
- try {
6525
- const regex = new RegExp(pattern);
6526
- const testResult = typeof value === "string" && regex.test(value);
6527
- if (!testResult) {
6528
- results.valid = false;
6529
- results.error = ERROR_MESSAGE_CONSTANTS.VALUE_DOES_NOT_MATCH_PATTERN;
6530
- }
6531
- } catch (e) {
6532
- results.valid = false;
6533
- results.error = ERROR_MESSAGE_CONSTANTS.INVALID_PATTERN;
6534
- }
6535
- }
6536
- return results;
6537
- };
6538
- var getValidityValue = (existing, pending) => !existing ? false : pending;
6539
- var TYPE_KEYWORD_VALIDATORS = {
6540
- string: (value) => typeof value === "string",
6541
- number: (value) => typeof value === "number",
6542
- boolean: (value) => typeof value === "boolean"
6543
- };
6544
- var hasValue = (value) => value ?? false;
6545
- var validateKeywordType = (value, type) => {
6546
- const validator = TYPE_KEYWORD_VALIDATORS[type];
6547
- let valid = true;
6548
- if (validator) {
6549
- valid = validator(value);
6550
- }
6551
- return valid;
6552
- };
6553
- var validateCustomType = (value, customType, customValidators) => {
6554
- let valid = true;
6555
- if (customValidators && customType) {
6556
- const validator = customValidators[customType];
6557
- if (validator) {
6558
- try {
6559
- valid = validator(value);
6560
- } catch (e) {
6561
- valid = false;
6562
- }
6563
- }
6564
- }
6565
- return valid;
6566
- };
6567
- var validateTypeInfoFieldValue = (value, typeInfoField, typeInfoMap, ignoreArray = false, strict = false, customValidators, typeOperation, relationshipValidationType = "STRICT_EXCLUDE" /* STRICT_EXCLUDE */, itemIsPartial) => {
6568
- const {
6569
- type,
6570
- typeReference,
6571
- array,
6572
- optional,
6573
- possibleValues,
6574
- tags: { customType, constraints: { pattern = void 0 } = {} } = {}
6575
- } = typeInfoField;
6576
- const results = {
6577
- typeName: typeReference ?? type,
6578
- valid: true,
6579
- error: "",
6580
- errorMap: {}
6581
- };
6582
- const requiredValueAllowed = !typeReference || relationshipValidationType === "INCLUDE" /* INCLUDE */;
6583
- const valueIsUndefined = typeof value === "undefined";
6584
- const valueIsNull = value === null;
6585
- const canSkipValidation = itemIsPartial && (valueIsUndefined || valueIsNull) || optional && valueIsUndefined;
6586
- if (canSkipValidation) {
6587
- results.valid = true;
6588
- } else if (requiredValueAllowed && !itemIsPartial && !optional && !hasValue(value)) {
6589
- results.valid = false;
6590
- results.error = ERROR_MESSAGE_CONSTANTS.MISSING;
6591
- } else if (array && !ignoreArray) {
6592
- const {
6593
- valid: validArray,
6594
- error: arrayError,
6595
- errorMap: arrayErrorMap
6596
- } = validateArrayOfTypeInfoFieldValues(
6597
- value,
6598
- typeInfoField,
6599
- typeInfoMap,
6600
- strict,
6601
- customValidators,
6602
- typeOperation,
6603
- relationshipValidationType,
6604
- itemIsPartial
6605
- );
6606
- results.valid = getValidityValue(results.valid, validArray);
6607
- results.error = arrayError;
6608
- results.errorMap = arrayErrorMap;
6609
- } else {
6610
- if (typeReference) {
6611
- if (relationshipValidationType === "INCLUDE" /* INCLUDE */) {
6612
- const {
6613
- valid: validTypeInfo,
6614
- error: typeInfoError,
6615
- errorMap: typeInfoErrorMap
6616
- } = validateTypeInfoValue(
6617
- value,
6618
- typeReference,
6619
- typeInfoMap,
6620
- strict,
6621
- customValidators,
6622
- typeOperation,
6623
- relationshipValidationType,
6624
- itemIsPartial
6625
- );
6626
- results.valid = getValidityValue(results.valid, validTypeInfo);
6627
- results.error = typeInfoError;
6628
- results.errorMap = typeInfoErrorMap;
6629
- } else if (relationshipValidationType === "STRICT_EXCLUDE" /* STRICT_EXCLUDE */) {
6630
- const valueSupplied = typeof value !== "undefined";
6631
- if (valueSupplied) {
6632
- results.valid = false;
6633
- results.error = ERROR_MESSAGE_CONSTANTS.RELATIONSHIP_VALUES_ARE_STRICTLY_EXCLUDED;
6634
- }
6635
- } else if (relationshipValidationType === "EXCLUDE" /* EXCLUDE */) {
6636
- results.valid = getValidityValue(results.valid, true);
6637
- }
6638
- } else if (possibleValues && !possibleValues.includes(value)) {
6639
- results.valid = false;
6640
- results.error = ERROR_MESSAGE_CONSTANTS.INVALID_OPTION;
6641
- } else {
6642
- const pendingValid = validateKeywordType(value, type);
6643
- const customValid = validateCustomType(
6644
- value,
6645
- customType,
6646
- customValidators
6647
- );
6648
- results.valid = getValidityValue(results.valid, pendingValid);
6649
- results.valid = getValidityValue(results.valid, customValid);
6650
- if (type === "string" && typeof pattern === "string") {
6651
- const { valid: patternValid, error: patternError } = validateValueMatchesPattern(value, pattern);
6652
- results.valid = getValidityValue(results.valid, patternValid);
6653
- results.error = patternError;
6654
- }
6655
- if (!customValid) {
6656
- results.error = INVALID_CUSTOM_TYPE;
6657
- } else if (!results.valid) {
6658
- results.error = results.error ? results.error : PRIMITIVE_ERROR_MESSAGE_CONSTANTS[type];
6659
- }
6660
- }
6661
- }
6662
- return results;
6663
- };
6664
- var validateArrayOfTypeInfoFieldValues = (values = [], typeInfoField, typeInfoMap, strict = false, customValidators, typeOperation, relationshipValidationType, itemIsPartial) => {
6665
- const { type, typeReference } = typeInfoField;
6666
- const results = {
6667
- typeName: typeReference ?? type,
6668
- valid: true,
6669
- error: "",
6670
- errorMap: {}
6671
- };
6672
- for (let i = 0; i < values.length; i++) {
6673
- const v = values[i];
6674
- const {
6675
- valid: indexValid,
6676
- error: indexError = "",
6677
- errorMap: indexErrorMap
6678
- } = validateTypeInfoFieldValue(
6679
- v,
6680
- typeInfoField,
6681
- typeInfoMap,
6682
- true,
6683
- strict,
6684
- customValidators,
6685
- typeOperation,
6686
- relationshipValidationType,
6687
- itemIsPartial
6688
- );
6689
- results.valid = getValidityValue(results.valid, indexValid);
6690
- results.errorMap[getPathString([i])] = [indexError];
6691
- for (const er in indexErrorMap) {
6692
- results.errorMap[getPathString([i, er])] = indexErrorMap[er];
6693
- }
6694
- }
6695
- return results;
6696
- };
6697
- var validateTypeInfoFieldOperationAllowed = (fieldName, fieldOperation, typeInfoField) => {
6698
- const results = {
6699
- typeName: null,
6700
- valid: true,
6701
- error: "",
6702
- errorMap: {}
6703
- };
6704
- if (fieldOperation && typeInfoField) {
6705
- const {
6706
- type,
6707
- typeReference,
6708
- tags = {}
6709
- } = typeInfoField || {};
6710
- const { deniedOperations: { [fieldOperation]: denied = false } = {} } = tags;
6711
- results.typeName = typeReference ?? type;
6712
- results.valid = !denied;
6713
- if (!results.valid) {
6714
- results.error = DENIED_TYPE_OPERATIONS[fieldOperation];
6715
- results.errorMap[fieldName] = [results.error];
6716
- }
6717
- }
6718
- return results;
6719
- };
6720
- var validateTypeOperationAllowed = (typeName, valueFields, typeOperation, typeInfo) => {
6721
- const results = {
6722
- typeName,
6723
- valid: true,
6724
- error: "",
6725
- errorMap: {}
6726
- };
6727
- const { fields = {}, tags = {} } = typeInfo;
6728
- const { deniedOperations: { [typeOperation]: denied = false } = {} } = tags;
6729
- if (denied) {
6730
- results.valid = false;
6731
- results.error = DENIED_TYPE_OPERATIONS[typeOperation];
6732
- } else {
6733
- for (const vF of valueFields) {
6734
- const vFieldInfo = fields[vF];
6735
- const { valid: vFValid, error: vFError } = validateTypeInfoFieldOperationAllowed(vF, typeOperation, vFieldInfo);
6736
- results.valid = getValidityValue(results.valid, vFValid);
6737
- if (!vFValid) {
6738
- results.errorMap[vF] = [vFError];
6739
- }
6740
- }
6741
- }
6742
- return results;
6743
- };
6744
- var validateTypeInfoValue = (value, typeInfoFullName, typeInfoMap, strict = false, customValidators, typeOperation, relationshipValidationType, itemIsPartial) => {
6745
- const typeInfo = typeInfoMap[typeInfoFullName];
6746
- const results = {
6747
- typeName: typeInfoFullName,
6748
- valid: !!typeInfo,
6749
- error: !!typeInfo ? "" : ERROR_MESSAGE_CONSTANTS.TYPE_DOES_NOT_EXIST,
6750
- errorMap: {}
6751
- };
6752
- if (typeInfo) {
6753
- const { primaryField, fields, unionFieldSets } = typeInfo;
6754
- if (typeOperation) {
6755
- const valueFields = typeof value === "object" ? Object.keys(value ?? {}) : [];
6756
- const {
6757
- valid: operationValid,
6758
- error: operationError,
6759
- errorMap: operationErrorMap
6760
- } = validateTypeOperationAllowed(
6761
- typeInfoFullName,
6762
- valueFields,
6763
- typeOperation,
6764
- typeInfo
6765
- );
6766
- results.valid = getValidityValue(results.valid, operationValid);
6767
- results.error = operationError;
6768
- for (const oE in operationErrorMap) {
6769
- const existingError = results.errorMap[oE] ?? [];
6770
- results.errorMap[oE] = existingError ? [...existingError, ...operationErrorMap[oE]] : operationErrorMap[oE];
6771
- }
6772
- if (!operationValid && operationError) {
6773
- results.error = operationError;
6774
- }
6775
- }
6776
- if (unionFieldSets) {
6777
- const valueFields = Object.keys(value || {});
6778
- let valid = false;
6779
- for (const uFS of unionFieldSets) {
6780
- valid = valueFields.every((vF) => uFS.includes(vF));
6781
- if (valid) {
6782
- break;
6783
- }
6784
- }
6785
- if (!valid) {
6786
- results.valid = false;
6787
- results.error = ERROR_MESSAGE_CONSTANTS.NO_UNION_TYPE_MATCHED;
6788
- }
6789
- } else if (strict) {
6790
- const knownFields = Object.keys(fields || {});
6791
- const valueFields = Object.keys(value || {});
6792
- for (const vF of valueFields) {
6793
- if (!knownFields.includes(vF)) {
6794
- results.valid = false;
6795
- results.errorMap[vF] = [ERROR_MESSAGE_CONSTANTS.INVALID_FIELD];
6796
- }
6797
- }
6798
- }
6799
- if (fields) {
6800
- for (const key in fields) {
6801
- if (typeOperation !== "CREATE" /* CREATE */ || typeof primaryField !== "string" || key !== primaryField) {
6802
- const typeInfoField = fields[key];
6803
- const fieldValue = value[key];
6804
- const {
6805
- valid: fieldValid,
6806
- error: fieldError,
6807
- errorMap: fieldErrorMap
6808
- } = validateTypeInfoFieldValue(
6809
- fieldValue,
6810
- typeInfoField,
6811
- typeInfoMap,
6812
- false,
6813
- strict,
6814
- customValidators,
6815
- typeOperation,
6816
- relationshipValidationType,
6817
- itemIsPartial
6818
- );
6819
- results.valid = getValidityValue(results.valid, fieldValid);
6820
- results.errorMap[key] = [fieldError];
6821
- for (const fE in fieldErrorMap) {
6822
- results.errorMap[getPathString([key, fE])] = fieldErrorMap[fE];
6823
- }
6824
- }
6825
- }
6826
- }
6827
- if (!results.valid && !results.error) {
6828
- results.error = ERROR_MESSAGE_CONSTANTS.INVALID_TYPE;
6829
- }
6830
- }
6831
- return results;
6832
- };
6833
-
6834
6460
  // src/common/SearchValidation.ts
6835
6461
  var SEARCH_VALIDATION_ERRORS = {
6836
6462
  INVALID_TYPE_INFO: "INVALID_TYPE_INFO",
@@ -6962,9 +6588,6 @@ var validateRelationshipItem = (relationshipItem, omitFields) => {
6962
6588
  return results;
6963
6589
  };
6964
6590
 
6965
- // src/common/TypeInfoORM/Types.ts
6966
- var ITEM_RELATIONSHIP_DAC_RESOURCE_NAME = "TYPE_INFO_ORM_ITEM_RELATIONSHIP";
6967
-
6968
6591
  // src/common/TypeParsing/Utils.ts
6969
6592
  var removeNonexistentFieldsFromSelectedFields = (typeInfo = {}, selectedFields) => {
6970
6593
  if (Array.isArray(selectedFields)) {