@rljson/rljson 0.0.65 → 0.0.67

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.
@@ -11,6 +11,7 @@ export type RouteSegmentFlat<N extends string> = `${N}` | `${N}@${string}` | `${
11
11
  */
12
12
  export declare class Route {
13
13
  private readonly _segments;
14
+ private _propertyKey?;
14
15
  constructor(_segments: RouteSegment<any>[]);
15
16
  /**
16
17
  * Creates a Route from a flat string representation.
@@ -31,6 +32,33 @@ export declare class Route {
31
32
  * @returns A new Route that is one level deeper or 'steps' levels deeper
32
33
  */
33
34
  deeper(steps?: number): Route;
35
+ /**
36
+ * Returns a new Route that is one level higher than the current route.
37
+ * If steps is provided, it returns a new Route that is 'steps' levels higher.
38
+ * @param steps - The number of levels to go higher (optional)
39
+ * @returns A new Route that is one level higher or 'steps' levels higher
40
+ */
41
+ upper(steps?: number): Route;
42
+ /**
43
+ * Returns a new Route with the property key set to the last segment's table key.
44
+ * If the property key is already set, it returns the current route.
45
+ * @returns A new Route with the property key set
46
+ */
47
+ toRouteWithProperty(): Route;
48
+ /**
49
+ * Returns a new Route without the property key.
50
+ * If the property key is not set, it returns the current route.
51
+ * @returns A new Route without the property key
52
+ */
53
+ toRouteWithoutProperty(): Route;
54
+ /**
55
+ * Checks if the current route includes another route.
56
+ * A route includes another route if all segments of the other route
57
+ * are present in the current route in the same order.
58
+ * @param other - The other route to check
59
+ * @returns True if the current route includes the other route, false otherwise
60
+ */
61
+ includes(other: Route): boolean;
34
62
  /**
35
63
  * Checks if the current route is the root route.
36
64
  * @returns True if the current route is the root route, false otherwise
@@ -41,6 +69,16 @@ export declare class Route {
41
69
  * @returns The flat string representation of the route (e.g. "/a/b/c")
42
70
  */
43
71
  get flat(): string;
72
+ /**
73
+ * Returns the flat string representation of the route without the property key.
74
+ * @returns The flat string representation of the route without the property key
75
+ */
76
+ get flatWithoutPropertyKey(): string;
77
+ /**
78
+ * Returns the flat string representation of the route without any references.
79
+ * @returns The flat string representation of the route without any references
80
+ */
81
+ get flatWithoutRefs(): string;
44
82
  /**
45
83
  * Returns the segments of the route as an array of strings.
46
84
  * @returns The segments of the route as an array of strings
@@ -66,6 +104,39 @@ export declare class Route {
66
104
  * @returns True if the route is valid, false otherwise
67
105
  */
68
106
  get isValid(): boolean;
107
+ /**
108
+ * Checks if the route has a property key.
109
+ * @returns True if the route has a property key, false otherwise
110
+ */
111
+ get hasPropertyKey(): boolean;
112
+ /**
113
+ * Returns the property key of the route if it exists.
114
+ * @returns The property key of the route or undefined if it doesn't exist
115
+ */
116
+ get propertyKey(): string | undefined;
117
+ /**
118
+ * Sets the property key of the route.
119
+ * @param key - The property key to set
120
+ */
121
+ set propertyKey(key: string | undefined);
122
+ /**
123
+ * Checks if two routes are equal.
124
+ * @param other - The other route to compare with
125
+ * @returns True if the routes are equal, false otherwise
126
+ */
127
+ equals(other: Route): boolean;
128
+ /**
129
+ * Checks if two routes are equal without considering the property key.
130
+ * @param other - The other route to compare with
131
+ * @returns True if the routes are equal without considering the property key, false otherwise
132
+ */
133
+ equalsWithoutPropertyKey(other: Route): boolean;
134
+ /**
135
+ * Checks if two routes are equal without considering the references.
136
+ * @param other - The other route to compare with
137
+ * @returns True if the routes are equal without considering the references, false otherwise
138
+ */
139
+ equalsWithoutRefs(other: Route): boolean;
69
140
  /**
70
141
  * Returns the reference of a segment if it exists.
71
142
  * @param segment - The segment to get the reference from
@@ -73,21 +144,21 @@ export declare class Route {
73
144
  */
74
145
  static segmentRef(segment: RouteSegment<any>): string | undefined;
75
146
  /**
76
- * Checks if a segment has any reference (either default or history).
147
+ * Checks if a segment has any reference (either default or insertHistory).
77
148
  * @param segment - The segment to check
78
149
  * @returns True if the segment has any reference, false otherwise
79
150
  */
80
151
  static segmentHasRef(segment: RouteSegment<any>): boolean;
81
152
  /**
82
- * Checks if a segment has a default reference (i.e. not a history reference).
153
+ * Checks if a segment has a default reference (i.e. not a insertHistory reference).
83
154
  * @param segment - The segment to check
84
155
  * @returns True if the segment has a default reference, false otherwise
85
156
  */
86
157
  static segmentHasDefaultRef(segment: RouteSegment<any>): boolean;
87
158
  /**
88
- * Checks if a segment has a history reference (i.e. an HistoryRef).
159
+ * Checks if a segment has a insertHistory reference (i.e. an InsertHistoryRef).
89
160
  * @param segment - The segment to check
90
- * @returns True if the segment has a history reference, false otherwise
161
+ * @returns True if the segment has a insertHistory reference, false otherwise
91
162
  */
92
- static segmentHasHistoryRef(segment: RouteSegment<any>): boolean;
163
+ static segmentHasInsertHistoryRef(segment: RouteSegment<any>): boolean;
93
164
  }