@orkestrel/database 0.0.17 → 0.0.19
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/dist/src/browser/index.js +59 -45
- package/dist/src/browser/index.js.map +1 -1
- package/dist/src/core/index.cjs +219 -233
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +65 -11
- package/dist/src/core/index.d.ts +65 -11
- package/dist/src/core/index.js +218 -235
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +225 -219
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +49 -0
- package/dist/src/server/index.d.ts +49 -0
- package/dist/src/server/index.js +225 -222
- package/dist/src/server/index.js.map +1 -1
- package/package.json +20 -20
|
@@ -89,6 +89,16 @@ export declare function auditDriver(factory: () => DriverInterface): Promise<rea
|
|
|
89
89
|
*/
|
|
90
90
|
export declare function bindRowKey(row: Row, primary: string, key: Key): Row;
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Captures the exact rejection or synchronous throw from a driver conformance operation.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* await captureFailure(() => Promise.reject('refused')) // 'refused'
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare function captureFailure(operation: () => Promise<unknown>): Promise<unknown>;
|
|
101
|
+
|
|
92
102
|
/**
|
|
93
103
|
* Throws when an {@link OperationOptions.signal | AbortSignal} has fired — the shared
|
|
94
104
|
* abort gate checked at operation boundaries and between streamed rows.
|
|
@@ -913,6 +923,11 @@ export declare function isColumnSchema(value: unknown): value is ColumnSchema;
|
|
|
913
923
|
/**
|
|
914
924
|
* Narrows an unknown caught value to a {@link DatabaseError}.
|
|
915
925
|
*
|
|
926
|
+
* @remarks
|
|
927
|
+
* Accepts branded instances and subclasses across package copies and module formats.
|
|
928
|
+
* Requires the declared code and context shape. Refuses look-alikes and transparent
|
|
929
|
+
* proxies without requiring an exact `name`.
|
|
930
|
+
*
|
|
916
931
|
* @param value - The value to test (typically a `catch` binding)
|
|
917
932
|
* @returns True if `value` is a {@link DatabaseError}; false otherwise
|
|
918
933
|
*
|
|
@@ -1122,19 +1137,20 @@ export declare function matchesQuery(row: Row, conditions: readonly Condition[])
|
|
|
1122
1137
|
* `.*` segments separated by literals, matched against a long non-matching input, blow
|
|
1123
1138
|
* up super-linearly — and JS has no atomic groups / possessive quantifiers to bound it,
|
|
1124
1139
|
* while a `LIKE` / `GLOB` pattern is a caller-supplied operand this package cannot
|
|
1125
|
-
* trust.
|
|
1126
|
-
* the
|
|
1127
|
-
*
|
|
1128
|
-
*
|
|
1129
|
-
*
|
|
1130
|
-
*
|
|
1131
|
-
* pattern.
|
|
1140
|
+
* trust. This builds no regex. It splits the pattern on `any` into fixed-length
|
|
1141
|
+
* segments, anchors the first at the value's start and the last at its end, and places
|
|
1142
|
+
* each middle segment at its leftmost match after the one before it, which is the only
|
|
1143
|
+
* placement a match needs, so the work is O(value × pattern) at worst, never the
|
|
1144
|
+
* exponential / polynomial backtracking a regex would do. The pattern length is capped
|
|
1145
|
+
* at {@link MAX_PATTERN_LENGTH} (a `VALIDATION` {@link DatabaseError} over it), bounding
|
|
1146
|
+
* the pattern factor so a match stays linear in the value length whatever the pattern.
|
|
1132
1147
|
*
|
|
1133
1148
|
* The `any` wildcard matches any run (including empty); `single` matches exactly one
|
|
1134
|
-
*
|
|
1135
|
-
* a literal — the regex-metacharacter hazard is gone with the regex).
|
|
1136
|
-
* before
|
|
1137
|
-
* shadows the wildcard. Case folding is applied to
|
|
1149
|
+
* UTF-16 code unit; every other pattern char matches itself literally (a pattern `.` /
|
|
1150
|
+
* `(` / `\` is a literal — the regex-metacharacter hazard is gone with the regex). The
|
|
1151
|
+
* pattern splits on `any` before any literal comparison, so a value that literally
|
|
1152
|
+
* contains the wildcard char never shadows the wildcard. Case folding is applied to
|
|
1153
|
+
* both sides when `fold` is set.
|
|
1138
1154
|
*
|
|
1139
1155
|
* @param value - The value to test
|
|
1140
1156
|
* @param pattern - The wildcard pattern
|
|
@@ -1146,6 +1162,26 @@ export declare function matchesQuery(row: Row, conditions: readonly Condition[])
|
|
|
1146
1162
|
*/
|
|
1147
1163
|
export declare function matchesWildcardPattern(value: string, pattern: string, any: string, single: string, fold: boolean): boolean;
|
|
1148
1164
|
|
|
1165
|
+
/**
|
|
1166
|
+
* Checks whether a fixed-length wildcard segment matches a value at an offset.
|
|
1167
|
+
*
|
|
1168
|
+
* @remarks
|
|
1169
|
+
* Compares UTF-16 code units: `single` matches any one unit, and every other segment
|
|
1170
|
+
* unit matches itself. An offset that leaves the segment outside the value fails.
|
|
1171
|
+
*
|
|
1172
|
+
* @param value - The value to read
|
|
1173
|
+
* @param segment - The segment, holding no any-run wildcard
|
|
1174
|
+
* @param at - The value offset the segment starts at
|
|
1175
|
+
* @param single - The single-char wildcard char
|
|
1176
|
+
* @returns True if every segment unit matches the value unit at its offset; false otherwise
|
|
1177
|
+
*
|
|
1178
|
+
* @example
|
|
1179
|
+
* ```ts
|
|
1180
|
+
* matchesWildcardSegment('hello', 'l_o', 2, '_') // true
|
|
1181
|
+
* ```
|
|
1182
|
+
*/
|
|
1183
|
+
export declare function matchesWildcardSegment(value: string, segment: string, at: number, single: string): boolean;
|
|
1184
|
+
|
|
1149
1185
|
/**
|
|
1150
1186
|
* Sets the longest `LIKE` / `GLOB` pattern the wildcard matcher accepts, 1024 characters, before
|
|
1151
1187
|
* rejecting it.
|
|
@@ -1770,6 +1806,24 @@ export declare interface StorageInterface {
|
|
|
1770
1806
|
stamp?(metadata: DriverMetadata): Promise<void>;
|
|
1771
1807
|
}
|
|
1772
1808
|
|
|
1809
|
+
/**
|
|
1810
|
+
* Tracks the matching-row position of one streaming page.
|
|
1811
|
+
*
|
|
1812
|
+
* @example
|
|
1813
|
+
* ```ts
|
|
1814
|
+
* const page = new StreamPage(1)
|
|
1815
|
+
* page.next() // false
|
|
1816
|
+
* page.next() // true
|
|
1817
|
+
* page.count // 1
|
|
1818
|
+
* ```
|
|
1819
|
+
*/
|
|
1820
|
+
export declare class StreamPage {
|
|
1821
|
+
#private;
|
|
1822
|
+
constructor(offset: number);
|
|
1823
|
+
get count(): number;
|
|
1824
|
+
next(): boolean;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1773
1827
|
/**
|
|
1774
1828
|
* Represents one table's portable definition, produced by `export` — the unit of schema /
|
|
1775
1829
|
* migration exchange across environments.
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -89,6 +89,16 @@ export declare function auditDriver(factory: () => DriverInterface): Promise<rea
|
|
|
89
89
|
*/
|
|
90
90
|
export declare function bindRowKey(row: Row, primary: string, key: Key): Row;
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Captures the exact rejection or synchronous throw from a driver conformance operation.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* await captureFailure(() => Promise.reject('refused')) // 'refused'
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare function captureFailure(operation: () => Promise<unknown>): Promise<unknown>;
|
|
101
|
+
|
|
92
102
|
/**
|
|
93
103
|
* Throws when an {@link OperationOptions.signal | AbortSignal} has fired — the shared
|
|
94
104
|
* abort gate checked at operation boundaries and between streamed rows.
|
|
@@ -913,6 +923,11 @@ export declare function isColumnSchema(value: unknown): value is ColumnSchema;
|
|
|
913
923
|
/**
|
|
914
924
|
* Narrows an unknown caught value to a {@link DatabaseError}.
|
|
915
925
|
*
|
|
926
|
+
* @remarks
|
|
927
|
+
* Accepts branded instances and subclasses across package copies and module formats.
|
|
928
|
+
* Requires the declared code and context shape. Refuses look-alikes and transparent
|
|
929
|
+
* proxies without requiring an exact `name`.
|
|
930
|
+
*
|
|
916
931
|
* @param value - The value to test (typically a `catch` binding)
|
|
917
932
|
* @returns True if `value` is a {@link DatabaseError}; false otherwise
|
|
918
933
|
*
|
|
@@ -1122,19 +1137,20 @@ export declare function matchesQuery(row: Row, conditions: readonly Condition[])
|
|
|
1122
1137
|
* `.*` segments separated by literals, matched against a long non-matching input, blow
|
|
1123
1138
|
* up super-linearly — and JS has no atomic groups / possessive quantifiers to bound it,
|
|
1124
1139
|
* while a `LIKE` / `GLOB` pattern is a caller-supplied operand this package cannot
|
|
1125
|
-
* trust.
|
|
1126
|
-
* the
|
|
1127
|
-
*
|
|
1128
|
-
*
|
|
1129
|
-
*
|
|
1130
|
-
*
|
|
1131
|
-
* pattern.
|
|
1140
|
+
* trust. This builds no regex. It splits the pattern on `any` into fixed-length
|
|
1141
|
+
* segments, anchors the first at the value's start and the last at its end, and places
|
|
1142
|
+
* each middle segment at its leftmost match after the one before it, which is the only
|
|
1143
|
+
* placement a match needs, so the work is O(value × pattern) at worst, never the
|
|
1144
|
+
* exponential / polynomial backtracking a regex would do. The pattern length is capped
|
|
1145
|
+
* at {@link MAX_PATTERN_LENGTH} (a `VALIDATION` {@link DatabaseError} over it), bounding
|
|
1146
|
+
* the pattern factor so a match stays linear in the value length whatever the pattern.
|
|
1132
1147
|
*
|
|
1133
1148
|
* The `any` wildcard matches any run (including empty); `single` matches exactly one
|
|
1134
|
-
*
|
|
1135
|
-
* a literal — the regex-metacharacter hazard is gone with the regex).
|
|
1136
|
-
* before
|
|
1137
|
-
* shadows the wildcard. Case folding is applied to
|
|
1149
|
+
* UTF-16 code unit; every other pattern char matches itself literally (a pattern `.` /
|
|
1150
|
+
* `(` / `\` is a literal — the regex-metacharacter hazard is gone with the regex). The
|
|
1151
|
+
* pattern splits on `any` before any literal comparison, so a value that literally
|
|
1152
|
+
* contains the wildcard char never shadows the wildcard. Case folding is applied to
|
|
1153
|
+
* both sides when `fold` is set.
|
|
1138
1154
|
*
|
|
1139
1155
|
* @param value - The value to test
|
|
1140
1156
|
* @param pattern - The wildcard pattern
|
|
@@ -1146,6 +1162,26 @@ export declare function matchesQuery(row: Row, conditions: readonly Condition[])
|
|
|
1146
1162
|
*/
|
|
1147
1163
|
export declare function matchesWildcardPattern(value: string, pattern: string, any: string, single: string, fold: boolean): boolean;
|
|
1148
1164
|
|
|
1165
|
+
/**
|
|
1166
|
+
* Checks whether a fixed-length wildcard segment matches a value at an offset.
|
|
1167
|
+
*
|
|
1168
|
+
* @remarks
|
|
1169
|
+
* Compares UTF-16 code units: `single` matches any one unit, and every other segment
|
|
1170
|
+
* unit matches itself. An offset that leaves the segment outside the value fails.
|
|
1171
|
+
*
|
|
1172
|
+
* @param value - The value to read
|
|
1173
|
+
* @param segment - The segment, holding no any-run wildcard
|
|
1174
|
+
* @param at - The value offset the segment starts at
|
|
1175
|
+
* @param single - The single-char wildcard char
|
|
1176
|
+
* @returns True if every segment unit matches the value unit at its offset; false otherwise
|
|
1177
|
+
*
|
|
1178
|
+
* @example
|
|
1179
|
+
* ```ts
|
|
1180
|
+
* matchesWildcardSegment('hello', 'l_o', 2, '_') // true
|
|
1181
|
+
* ```
|
|
1182
|
+
*/
|
|
1183
|
+
export declare function matchesWildcardSegment(value: string, segment: string, at: number, single: string): boolean;
|
|
1184
|
+
|
|
1149
1185
|
/**
|
|
1150
1186
|
* Sets the longest `LIKE` / `GLOB` pattern the wildcard matcher accepts, 1024 characters, before
|
|
1151
1187
|
* rejecting it.
|
|
@@ -1770,6 +1806,24 @@ export declare interface StorageInterface {
|
|
|
1770
1806
|
stamp?(metadata: DriverMetadata): Promise<void>;
|
|
1771
1807
|
}
|
|
1772
1808
|
|
|
1809
|
+
/**
|
|
1810
|
+
* Tracks the matching-row position of one streaming page.
|
|
1811
|
+
*
|
|
1812
|
+
* @example
|
|
1813
|
+
* ```ts
|
|
1814
|
+
* const page = new StreamPage(1)
|
|
1815
|
+
* page.next() // false
|
|
1816
|
+
* page.next() // true
|
|
1817
|
+
* page.count // 1
|
|
1818
|
+
* ```
|
|
1819
|
+
*/
|
|
1820
|
+
export declare class StreamPage {
|
|
1821
|
+
#private;
|
|
1822
|
+
constructor(offset: number);
|
|
1823
|
+
get count(): number;
|
|
1824
|
+
next(): boolean;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1773
1827
|
/**
|
|
1774
1828
|
* Represents one table's portable definition, produced by `export` — the unit of schema /
|
|
1775
1829
|
* migration exchange across environments.
|