@resistdesign/voltra 3.0.0-alpha.46 → 3.0.0-alpha.47

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TypeInfoORMUpdateOperators, ITEM_RELATIONSHIP_DAC_RESOURCE_NAME, ComparisonOperators } from '../chunk-RUNXRISF.js';
2
- import { getNoErrorDescriptor, getErrorDescriptor, ERROR_MESSAGE_CONSTANTS, validateTypeOperationAllowed, getValidityValue, validateTypeInfoValue, validateTypeInfoFieldValue } from '../chunk-YCTVEW2I.js';
3
- import { mergeStringPaths, getPathString, getPathArray } from '../chunk-WNFRDIBW.js';
2
+ import { getNoErrorDescriptor, getErrorDescriptor, ERROR_MESSAGE_CONSTANTS, validateTypeOperationAllowed, getValidityValue, validateTypeInfoValue, validateTypeInfoFieldValue } from '../chunk-3HVYVX3S.js';
3
+ import { mergeStringPaths, getPathString, getPathArray } from '../chunk-2JDOM6PB.js';
4
4
  import '../chunk-I2KLQ2HA.js';
5
5
  import { QueryCommand, PutItemCommand, ConditionalCheckFailedException, GetItemCommand, BatchGetItemCommand, BatchWriteItemCommand, DynamoDBClient, UpdateItemCommand, DeleteItemCommand, ScanCommand } from '@aws-sdk/client-dynamodb';
6
6
  import { marshall, unmarshall } from '@aws-sdk/util-dynamodb';
package/app/index.js CHANGED
@@ -1,9 +1,9 @@
1
- export { createEasyLayout, getEasyLayoutTemplateDetails, getPascalCaseAreaName } from '../chunk-CMH6L5QQ.js';
1
+ export { createEasyLayout, getEasyLayoutTemplateDetails, getPascalCaseAreaName } from '../chunk-QXYUXJKM.js';
2
2
  export { computeTrackPixels } from '../chunk-TJFTWPXQ.js';
3
- export { AutoForm, AutoFormView, Route, RouteContext, RouteContextConsumer, RouteContextProvider, RouteProvider, buildHistoryPath, buildQueryString, buildRoutePath, canUseBrowserHistory, computeAreaBounds, createAutoField, createBrowserRouteAdapter, createFormRenderer, createHistoryBackHandler, createManualRouteAdapter, createMemoryHistory, createNativeRouteAdapter, createRouteAdapterFromHistory, createUniversalAdapter, defaultTranslateValidationErrorCode, getFieldKind, parseHistoryPath, parseTemplate, resolveSuite, useFormEngine, useRouteContext, validateAreas, wrapRouteAdapterWithPathResolver } from '../chunk-44BMFTKD.js';
3
+ export { AutoForm, AutoFormView, Route, RouteContext, RouteContextConsumer, RouteContextProvider, RouteProvider, buildHistoryPath, buildQueryString, buildRoutePath, canUseBrowserHistory, computeAreaBounds, createAutoField, createBrowserRouteAdapter, createFormRenderer, createHistoryBackHandler, createManualRouteAdapter, createMemoryHistory, createNativeRouteAdapter, createRouteAdapterFromHistory, createUniversalAdapter, defaultTranslateValidationErrorCode, getFieldKind, parseHistoryPath, parseTemplate, resolveSuite, useFormEngine, useRouteContext, validateAreas, wrapRouteAdapterWithPathResolver } from '../chunk-UD2ALOCE.js';
4
4
  import '../chunk-RUNXRISF.js';
5
- import '../chunk-YCTVEW2I.js';
6
- import { mergeStringPaths, PATH_DELIMITER } from '../chunk-WNFRDIBW.js';
5
+ import '../chunk-3HVYVX3S.js';
6
+ import { mergeStringPaths, PATH_DELIMITER } from '../chunk-2JDOM6PB.js';
7
7
  import '../chunk-I2KLQ2HA.js';
8
8
  import { createContext, useContext, useRef, useMemo, useCallback, useState, useEffect } from 'react';
9
9
  import { jsx } from 'react/jsx-runtime';
@@ -84,7 +84,15 @@ export declare const buildQueryString: (query?: RouteQuery) => string;
84
84
  */
85
85
  export declare const buildRoutePath: (segments: Array<string | number>, query?: RouteQuery) => string;
86
86
  /**
87
- * Access values for the current Route.
87
+ * Access values for the current `Route`.
88
+ *
89
+ * `parentPath` is the consumer-facing route pattern for the currently matched
90
+ * parent route chain, expressed as plain slash-delimited segments such as
91
+ * `app/books/:id`.
92
+ *
93
+ * `parentPathInternal` carries the same logical route pattern in the
94
+ * JSON-serialized segment format used by the shared routing internals. Most
95
+ * consumers should prefer `parentPath`.
88
96
  */
89
97
  export type RouteContextType = {
90
98
  /**
@@ -92,9 +100,17 @@ export type RouteContextType = {
92
100
  */
93
101
  currentWindowPath: string;
94
102
  /**
95
- * The parent path for this route level.
103
+ * Consumer-facing parent route pattern for this route level.
104
+ *
105
+ * Example: `app/books/:id`
96
106
  */
97
107
  parentPath: string;
108
+ /**
109
+ * Internal parent route pattern used by routing utilities and matcher logic.
110
+ *
111
+ * Example: `"app"/"books"/":id"`
112
+ */
113
+ parentPathInternal: string;
98
114
  /**
99
115
  * Aggregated route params from parent and current routes.
100
116
  */
@@ -116,6 +132,10 @@ export declare const RouteContextProvider: import("react").Provider<RouteContext
116
132
  /**
117
133
  * Access Route path and parameter information.
118
134
  *
135
+ * Use `parentPath` for app-facing route logic. `parentPathInternal` is exposed
136
+ * so advanced integrations can align with the internal routing helpers when
137
+ * needed.
138
+ *
119
139
  * @returns The current route context.
120
140
  */
121
141
  export declare const useRouteContext: () => RouteContextType;
package/build/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getPotentialJSONValue, getPathArray } from '../chunk-WNFRDIBW.js';
1
+ import { getPotentialJSONValue, getPathArray } from '../chunk-2JDOM6PB.js';
2
2
  import '../chunk-I2KLQ2HA.js';
3
3
  import { SyntaxKind, isLiteralTypeNode, isStringLiteral, isNumericLiteral, createSourceFile, ScriptTarget } from 'typescript';
4
4
 
@@ -33,6 +33,23 @@ var mergeStringPaths = (path1, path2, delimiter = PATH_DELIMITER, filterEmptyOut
33
33
  useJson,
34
34
  uriEncodeParts
35
35
  );
36
+ var resolvePath = (currentPath, newPath) => {
37
+ const newSegments = getPathArray(newPath, PATH_DELIMITER, true);
38
+ let currentSegments = getPathArray(currentPath, PATH_DELIMITER, true);
39
+ if (newPath.startsWith("/")) {
40
+ currentSegments = [];
41
+ }
42
+ newSegments.forEach((segment) => {
43
+ if (segment === "..") {
44
+ if (currentSegments.length > 0) {
45
+ currentSegments.pop();
46
+ }
47
+ } else if (segment !== ".") {
48
+ currentSegments.push(segment);
49
+ }
50
+ });
51
+ return "/" + currentSegments.join("/");
52
+ };
36
53
  var splitRoutePathParts = (rawPath) => {
37
54
  let path = rawPath;
38
55
  let hash = "";
@@ -118,4 +135,4 @@ var getParamsAndTestPath = (path, testPath, exact = false) => {
118
135
  }
119
136
  };
120
137
 
121
- export { PATH_DELIMITER, getParamsAndTestPath, getPathArray, getPathString, getPotentialJSONValue, mergeStringPaths, resolveRouteAdapterPath };
138
+ export { PATH_DELIMITER, getParamsAndTestPath, getPathArray, getPathString, getPotentialJSONValue, mergeStringPaths, resolvePath, resolveRouteAdapterPath };
@@ -1,4 +1,4 @@
1
- import { getPathString } from './chunk-WNFRDIBW.js';
1
+ import { getPathString } from './chunk-2JDOM6PB.js';
2
2
 
3
3
  // src/common/TypeParsing/TypeInfo.ts
4
4
  var TypeOperation = /* @__PURE__ */ ((TypeOperation2) => {
@@ -1,4 +1,4 @@
1
- import { parseTemplate, validateAreas } from './chunk-44BMFTKD.js';
1
+ import { parseTemplate, validateAreas } from './chunk-UD2ALOCE.js';
2
2
 
3
3
  // src/app/utils/EasyLayout.tsx
4
4
  var getPascalCaseAreaName = (area) => {
@@ -1,5 +1,5 @@
1
- import { getErrorDescriptor, getNoErrorDescriptor, validateTypeInfoDataItem, getArrayItemErrorMap, getErrorDescriptors, ERROR_MESSAGE_CONSTANTS } from './chunk-YCTVEW2I.js';
2
- import { resolveRouteAdapterPath, getPathString, mergeStringPaths, getParamsAndTestPath } from './chunk-WNFRDIBW.js';
1
+ import { getErrorDescriptor, getNoErrorDescriptor, validateTypeInfoDataItem, getArrayItemErrorMap, getErrorDescriptors, ERROR_MESSAGE_CONSTANTS } from './chunk-3HVYVX3S.js';
2
+ import { resolveRouteAdapterPath, getPathString, mergeStringPaths, getParamsAndTestPath, getPathArray, PATH_DELIMITER } from './chunk-2JDOM6PB.js';
3
3
  import { createContext, useContext, useMemo, useState, useEffect, useCallback, createElement, useRef } from 'react';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -540,9 +540,17 @@ var buildRoutePath = (segments, query) => {
540
540
  const queryString = query ? buildQueryString(query) : "";
541
541
  return queryString ? `${basePath}?${queryString}` : basePath;
542
542
  };
543
+ var getReadableRoutePath = (path) => getPathString(
544
+ getPathArray(path, PATH_DELIMITER, true, true, true, false),
545
+ PATH_DELIMITER,
546
+ true,
547
+ false,
548
+ false
549
+ );
543
550
  var RouteContext = createContext({
544
551
  currentWindowPath: "",
545
552
  parentPath: "",
553
+ parentPathInternal: "",
546
554
  params: {},
547
555
  isTopLevel: true
548
556
  });
@@ -646,6 +654,7 @@ var RouteProvider = ({
646
654
  () => ({
647
655
  currentWindowPath: currentPath,
648
656
  parentPath: "",
657
+ parentPathInternal: "",
649
658
  params: {},
650
659
  isTopLevel: true,
651
660
  adapter: normalizedAdapter
@@ -666,6 +675,7 @@ var RouteMatcher = ({
666
675
  const {
667
676
  currentWindowPath = "",
668
677
  parentPath = "",
678
+ parentPathInternal = "",
669
679
  params: parentParams = {},
670
680
  adapter
671
681
  } = useRouteContext();
@@ -685,7 +695,10 @@ var RouteMatcher = ({
685
695
  const matchedRoute = useMemo(
686
696
  () => {
687
697
  for (const routePathConfig of normalizedPaths) {
688
- const fullPath = mergeStringPaths(parentPath, routePathConfig.path);
698
+ const fullPath = mergeStringPaths(
699
+ parentPathInternal,
700
+ routePathConfig.path
701
+ );
689
702
  const newParams = getParamsAndTestPath(
690
703
  targetCurrentPath,
691
704
  fullPath,
@@ -700,7 +713,7 @@ var RouteMatcher = ({
700
713
  }
701
714
  return null;
702
715
  },
703
- [targetCurrentPath, parentPath, normalizedPaths]
716
+ [targetCurrentPath, parentPathInternal, normalizedPaths]
704
717
  );
705
718
  const params = useMemo(
706
719
  () => ({
@@ -712,12 +725,13 @@ var RouteMatcher = ({
712
725
  const newRouteContext = useMemo(
713
726
  () => ({
714
727
  currentWindowPath: targetCurrentPath,
715
- parentPath: matchedRoute?.fullPath ?? parentPath,
728
+ parentPath: getReadableRoutePath(matchedRoute?.fullPath ?? parentPathInternal),
729
+ parentPathInternal: matchedRoute?.fullPath ?? parentPathInternal,
716
730
  params,
717
731
  isTopLevel: false,
718
732
  adapter
719
733
  }),
720
- [targetCurrentPath, matchedRoute, parentPath, params, adapter]
734
+ [targetCurrentPath, matchedRoute, parentPathInternal, params, adapter]
721
735
  );
722
736
  useEffect(() => {
723
737
  if (onParamsChange) {
package/common/index.d.ts CHANGED
@@ -7,10 +7,12 @@
7
7
  * Import from the common subpath only:
8
8
  * ```ts
9
9
  * import {
10
+ * getPathArray,
10
11
  * getPathString,
11
12
  * getSimpleId,
12
13
  * } from "@resistdesign/voltra/common";
13
14
  *
15
+ * const segments = getPathArray("/users/42", "/", true, true, false, false);
14
16
  * const path = getPathString(["users", 42], "/", true, false);
15
17
  * const id = getSimpleId();
16
18
  * ```
@@ -28,6 +30,11 @@ export type * from "./HelperTypes";
28
30
  * @group Command Line
29
31
  */
30
32
  export * from "./CommandLine";
33
+ /**
34
+ * @category common
35
+ * @group Routing
36
+ */
37
+ export * from "./Routing";
31
38
  /**
32
39
  * @category common
33
40
  * @group Type Parsing
package/common/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { ComparisonOperators, ITEM_RELATIONSHIP_DAC_RESOURCE_NAME, LogicalOperators, OperationGroup, RelationshipOperation, TypeInfoORMAPIRoutePaths, TypeInfoORMServiceError, TypeInfoORMUpdateOperators } from '../chunk-RUNXRISF.js';
2
- export { DENIED_TYPE_OPERATIONS, ERROR_MESSAGE_CONSTANTS, INVALID_CUSTOM_TYPE, PRIMITIVE_ERROR_MESSAGE_CONSTANTS, RelationshipValidationType, TYPE_KEYWORD_ERROR_MESSAGE_CONSTANTS, TYPE_KEYWORD_VALIDATORS, TypeOperation, getArrayItemErrorMap, getErrorDescriptor, getErrorDescriptors, getNoErrorDescriptor, getValidityValue, hasValue, isArrayErrorDescriptorCollection, validateArrayOfTypeInfoFieldValues, validateCustomType, validateKeywordType, validateTypeInfoDataItem, validateTypeInfoFieldOperationAllowed, validateTypeInfoFieldValue, validateTypeInfoValue, validateTypeOperationAllowed, validateValueMatchesPattern } from '../chunk-YCTVEW2I.js';
3
- import '../chunk-WNFRDIBW.js';
2
+ export { DENIED_TYPE_OPERATIONS, ERROR_MESSAGE_CONSTANTS, INVALID_CUSTOM_TYPE, PRIMITIVE_ERROR_MESSAGE_CONSTANTS, RelationshipValidationType, TYPE_KEYWORD_ERROR_MESSAGE_CONSTANTS, TYPE_KEYWORD_VALIDATORS, TypeOperation, getArrayItemErrorMap, getErrorDescriptor, getErrorDescriptors, getNoErrorDescriptor, getValidityValue, hasValue, isArrayErrorDescriptorCollection, validateArrayOfTypeInfoFieldValues, validateCustomType, validateKeywordType, validateTypeInfoDataItem, validateTypeInfoFieldOperationAllowed, validateTypeInfoFieldValue, validateTypeInfoValue, validateTypeOperationAllowed, validateValueMatchesPattern } from '../chunk-3HVYVX3S.js';
3
+ export { PATH_DELIMITER, getParamsAndTestPath, getPathArray, getPathString, getPotentialJSONValue, mergeStringPaths, resolvePath, resolveRouteAdapterPath } from '../chunk-2JDOM6PB.js';
4
4
  import '../chunk-I2KLQ2HA.js';
5
5
 
6
6
  // src/common/CommandLine/collectRequiredEnvironmentVariables.ts
package/native/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { computeTrackPixels } from '../chunk-TJFTWPXQ.js';
2
- import { createFormRenderer, createHistoryBackHandler, buildHistoryPath, AutoFormView, AutoForm, parseTemplate, validateAreas, computeAreaBounds, parseHistoryPath, createMemoryHistory, createBrowserRouteAdapter, Route, createRouteAdapterFromHistory } from '../chunk-44BMFTKD.js';
3
- import { ERROR_MESSAGE_CONSTANTS } from '../chunk-YCTVEW2I.js';
4
- import '../chunk-WNFRDIBW.js';
2
+ import { createFormRenderer, createHistoryBackHandler, buildHistoryPath, AutoFormView, AutoForm, parseTemplate, validateAreas, computeAreaBounds, parseHistoryPath, createMemoryHistory, createBrowserRouteAdapter, Route, createRouteAdapterFromHistory } from '../chunk-UD2ALOCE.js';
3
+ import { ERROR_MESSAGE_CONSTANTS } from '../chunk-3HVYVX3S.js';
4
+ import '../chunk-2JDOM6PB.js';
5
5
  import '../chunk-I2KLQ2HA.js';
6
6
  import { createElement, useMemo, useRef } from 'react';
7
7
  import { Text, View, Platform, Switch, TextInput, Pressable, BackHandler } from 'react-native';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resistdesign/voltra",
3
- "version": "3.0.0-alpha.46",
3
+ "version": "3.0.0-alpha.47",
4
4
  "description": "With our powers combined!",
5
5
  "homepage": "https://voltra.app",
6
6
  "repository": "git@github.com:resistdesign/voltra.git",
package/web/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { createEasyLayout } from '../chunk-CMH6L5QQ.js';
2
- import { createFormRenderer, AutoFormView, AutoForm, createBrowserRouteAdapter, Route } from '../chunk-44BMFTKD.js';
3
- import { ERROR_MESSAGE_CONSTANTS } from '../chunk-YCTVEW2I.js';
4
- import '../chunk-WNFRDIBW.js';
1
+ import { createEasyLayout } from '../chunk-QXYUXJKM.js';
2
+ import { createFormRenderer, AutoFormView, AutoForm, createBrowserRouteAdapter, Route } from '../chunk-UD2ALOCE.js';
3
+ import { ERROR_MESSAGE_CONSTANTS } from '../chunk-3HVYVX3S.js';
4
+ import '../chunk-2JDOM6PB.js';
5
5
  import { __export, __reExport } from '../chunk-I2KLQ2HA.js';
6
6
  import { createElement, useCallback, useRef } from 'react';
7
7
  import * as styledBase from 'styled-components';