okengine 0.21.0 → 0.21.1
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/package.json +2 -7
- package/src/cli/dev.test.ts +105 -2
- package/src/cli/dev.ts +37 -2
- package/src/client/create.ts +13 -26
- package/src/client/live.ts +44 -101
- package/src/client/sse.ts +20 -66
- package/src/client/stream.ts +25 -67
- package/src/client/transport.ts +28 -73
- package/src/client/wire.ts +119 -0
- package/src/compiler/aot.ts +3 -32
- package/src/compiler/dynamic.ts +13 -11
- package/src/compiler/interpret.ts +45 -0
- package/src/console/ui-next/dist/assets/{access-page-tIbsiphz.js → access-page-Bgt9bq2r.js} +1 -1
- package/src/console/ui-next/dist/assets/{agent-disclosure-CSKumwS2.js → agent-disclosure-B43CXZZR.js} +1 -1
- package/src/console/ui-next/dist/assets/{cache-glyph-BCC-DxKT.js → cache-glyph-92uM5MO7.js} +1 -1
- package/src/console/ui-next/dist/assets/{call-pii-button-jOmYISdc.js → call-pii-button-DtGVPtcs.js} +1 -1
- package/src/console/ui-next/dist/assets/{collapsible-DC2xNaAb.js → collapsible-DN7l6zmC.js} +1 -1
- package/src/console/ui-next/dist/assets/{duration-tone-CwoV56jn.js → duration-tone-BmIR9FV8.js} +1 -1
- package/src/console/ui-next/dist/assets/{flows-page-gT1lsWQK.js → flows-page-BMHs-IzK.js} +1 -1
- package/src/console/ui-next/dist/assets/{highlighted-json-C2GZEJNI.js → highlighted-json-BlAEVgNW.js} +1 -1
- package/src/console/ui-next/dist/assets/{http-method-BdYjcIrD.js → http-method-BDf7OAHv.js} +1 -1
- package/src/console/ui-next/dist/assets/{index-Cul17AcV.js → index-BKpaes3n.js} +3 -3
- package/src/console/ui-next/dist/assets/{observability-page-oY9vdYBk.js → observability-page-WnVLI-0j.js} +1 -1
- package/src/console/ui-next/dist/assets/{replica-lag-C4QdAF7J.js → replica-lag-B3GLNVfF.js} +1 -1
- package/src/console/ui-next/dist/assets/{request-meta-C43DHyld.js → request-meta-DMbnAe3f.js} +1 -1
- package/src/console/ui-next/dist/assets/{store-page-CL0D9dOq.js → store-page-KvFDingJ.js} +1 -1
- package/src/console/ui-next/dist/assets/{trace-detail-sheet-Dcpo4Us_.js → trace-detail-sheet-Htk8Cm9t.js} +1 -1
- package/src/console/ui-next/dist/assets/{tree-expand-toggle-CKJTuv43.js → tree-expand-toggle-CFMPWX4f.js} +1 -1
- package/src/console/ui-next/dist/assets/{units-page-1PlT19ft.js → units-page-C4NdNuxP.js} +1 -1
- package/src/console/ui-next/dist/assets/{vault-page-BwZ9YjTW.js → vault-page-CBYl0LW_.js} +1 -1
- package/src/console/ui-next/dist/index.html +1 -1
- package/src/elements/store/sql-session.ts +20 -4
- package/src/kernel/app.ts +9 -2
- package/src/kernel/client-descriptor.test.ts +78 -0
- package/src/kernel/client-descriptor.ts +23 -0
- package/src/kernel/errors-text.ts +99 -0
- package/src/kernel/errors.ts +90 -138
- package/src/kernel/fx-sql-handle.ts +305 -0
- package/src/kernel/fx.ts +37 -329
- package/src/kernel/json-result.ts +59 -0
- package/src/kernel/project-out.ts +6 -1
- package/src/okid-extended.ts +175 -0
- package/src/okid-shared.ts +103 -0
- package/src/okid.ts +30 -213
- package/src/release/build-lib.ts +9 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OKID constants and the options-path encoder.
|
|
3
|
+
*
|
|
4
|
+
* The default `okid()` / `okid(length)` hot path does not import the
|
|
5
|
+
* alphabet resolver — only these constants and {@link assertLength}.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Default `okid()` / `okid(length)` alphabet.
|
|
10
|
+
*
|
|
11
|
+
* Same 64-character set and order as
|
|
12
|
+
* `resolveAlphabet(true, true, true, true, true)` (numbers, lowercase,
|
|
13
|
+
* uppercase, symbols). Power-of-two size, so a bitmask is unbiased.
|
|
14
|
+
*/
|
|
15
|
+
export const OKID_DEFAULT_CHARS =
|
|
16
|
+
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Characters removed when `lookAlikes` is disabled (human transcription).
|
|
20
|
+
*/
|
|
21
|
+
export const OKID_LOOKALIKE_CHARS = "1lI0Oouv5Ss";
|
|
22
|
+
|
|
23
|
+
/** Default URL-safe alphabet: Base64URL charset in its conventional order. */
|
|
24
|
+
export const OKID_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Codepoint-ordered variant of {@link OKID_ALPHABET}: identical characters,
|
|
28
|
+
* sorted by code unit so plain string comparison equals value comparison.
|
|
29
|
+
* The default Base64URL order is NOT lexicographic (`_` sorts between `Z`
|
|
30
|
+
* and `a`), which would silently break time ordering — so the sortable
|
|
31
|
+
* encoder always uses this order.
|
|
32
|
+
*
|
|
33
|
+
* Kept as a literal (not `[...OKID_ALPHABET].sort().join("")`) so the public
|
|
34
|
+
* JSR API stays fast-type / explicitly typed.
|
|
35
|
+
*/
|
|
36
|
+
export const OKID_SORTABLE_ALPHABET: string =
|
|
37
|
+
"-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
|
|
38
|
+
|
|
39
|
+
/** Default id length — 21 chars × 6 bits = 126 bits of entropy. */
|
|
40
|
+
export const OKID_DEFAULT_LENGTH = 21;
|
|
41
|
+
|
|
42
|
+
/** Shortest permitted id length (8 chars ≈ 48 bits entropy floor). */
|
|
43
|
+
export const OKID_MIN_LENGTH = 8;
|
|
44
|
+
|
|
45
|
+
/** Longest permitted id length. */
|
|
46
|
+
export const OKID_MAX_LENGTH = 128;
|
|
47
|
+
|
|
48
|
+
/** Sortable ids need ≥ 16: 8 timestamp chars alone would leave no randomness. */
|
|
49
|
+
export const OKID_SORTABLE_MIN_LENGTH = 16;
|
|
50
|
+
|
|
51
|
+
/** Longest permitted semantic {@link OkidOptions.prefix}. */
|
|
52
|
+
export const OKID_MAX_PREFIX_LENGTH = 32;
|
|
53
|
+
|
|
54
|
+
/** Options for {@link okid}. All alphabet toggles default to included. */
|
|
55
|
+
export interface OkidOptions {
|
|
56
|
+
/**
|
|
57
|
+
* Generated body length (default {@link OKID_DEFAULT_LENGTH}). Does not
|
|
58
|
+
* include {@link prefix} — the returned string is `prefix + body`.
|
|
59
|
+
*/
|
|
60
|
+
readonly length?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Fixed semantic label prepended to the body (e.g. `"usr_"`, `"evt_"`).
|
|
63
|
+
* Characters must belong to {@link OKID_ALPHABET}; max
|
|
64
|
+
* {@link OKID_MAX_PREFIX_LENGTH}. Empty / omitted means no label.
|
|
65
|
+
*/
|
|
66
|
+
readonly prefix?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Prefix the body with a 48-bit epoch-ms timestamp (exactly 8 chars) so
|
|
69
|
+
* lexicographic order tracks creation time across milliseconds. Alphabet
|
|
70
|
+
* toggles are ignored under this mode — see {@link OKID_SORTABLE_ALPHABET}.
|
|
71
|
+
* Combines with {@link prefix}: `prefix + timestamp + random`.
|
|
72
|
+
*/
|
|
73
|
+
readonly sortable?: boolean;
|
|
74
|
+
/** Include `a-z` (default true). */
|
|
75
|
+
readonly lowercase?: boolean;
|
|
76
|
+
/** Include `A-Z` (default true). */
|
|
77
|
+
readonly uppercase?: boolean;
|
|
78
|
+
/** Include `0-9` (default true). */
|
|
79
|
+
readonly numbers?: boolean;
|
|
80
|
+
/** Include `-` and `_` (default true). */
|
|
81
|
+
readonly symbols?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Include visually confusable characters (`1lI0Oouv5Ss`, default true).
|
|
84
|
+
* Set `false` to drop them for human transcription.
|
|
85
|
+
*/
|
|
86
|
+
readonly lookAlikes?: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Assert `length` is a valid integer within bounds for the requested mode.
|
|
91
|
+
*
|
|
92
|
+
* @param length - Requested length
|
|
93
|
+
* @param min - Mode-specific minimum
|
|
94
|
+
* @param label - Option name used in the error message
|
|
95
|
+
*/
|
|
96
|
+
export function assertLength(length: number, min: number, label: string): void {
|
|
97
|
+
if (!Number.isInteger(length)) {
|
|
98
|
+
throw new RangeError(`okid: ${label} must be an integer, got ${length}`);
|
|
99
|
+
}
|
|
100
|
+
if (length < min || length > OKID_MAX_LENGTH) {
|
|
101
|
+
throw new RangeError(`okid: ${label} ${length} is out of range [${min}, ${OKID_MAX_LENGTH}]`);
|
|
102
|
+
}
|
|
103
|
+
}
|
package/src/okid.ts
CHANGED
|
@@ -52,193 +52,33 @@
|
|
|
52
52
|
* @module
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
import { lazyRequire } from "./kernel/lazy-require.ts";
|
|
56
|
+
import {
|
|
57
|
+
assertLength,
|
|
58
|
+
OKID_DEFAULT_CHARS,
|
|
59
|
+
OKID_DEFAULT_LENGTH,
|
|
60
|
+
OKID_MIN_LENGTH,
|
|
61
|
+
type OkidOptions,
|
|
62
|
+
} from "./okid-shared.ts";
|
|
63
|
+
|
|
64
|
+
export type { OkidOptions } from "./okid-shared.ts";
|
|
65
|
+
export {
|
|
66
|
+
OKID_ALPHABET,
|
|
67
|
+
OKID_DEFAULT_LENGTH,
|
|
68
|
+
OKID_LOOKALIKE_CHARS,
|
|
69
|
+
OKID_MAX_LENGTH,
|
|
70
|
+
OKID_MAX_PREFIX_LENGTH,
|
|
71
|
+
OKID_MIN_LENGTH,
|
|
72
|
+
OKID_SORTABLE_ALPHABET,
|
|
73
|
+
OKID_SORTABLE_MIN_LENGTH,
|
|
74
|
+
} from "./okid-shared.ts";
|
|
62
75
|
|
|
63
76
|
/**
|
|
64
|
-
*
|
|
77
|
+
* Load sortable / prefix / alphabet-toggle encoding.
|
|
78
|
+
* Computed stem so the edge profile does not inline it.
|
|
65
79
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/** Default URL-safe alphabet: Base64URL charset in its conventional order. */
|
|
69
|
-
export const OKID_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Codepoint-ordered variant of {@link OKID_ALPHABET}: identical characters,
|
|
73
|
-
* sorted by code unit so plain string comparison equals value comparison.
|
|
74
|
-
* The default Base64URL order is NOT lexicographic (`_` sorts between `Z`
|
|
75
|
-
* and `a`), which would silently break time ordering — so the sortable
|
|
76
|
-
* encoder always uses this order.
|
|
77
|
-
*
|
|
78
|
-
* Kept as a literal (not `[...OKID_ALPHABET].sort().join("")`) so the public
|
|
79
|
-
* JSR API stays fast-type / explicitly typed.
|
|
80
|
-
*/
|
|
81
|
-
export const OKID_SORTABLE_ALPHABET: string =
|
|
82
|
-
"-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
|
|
83
|
-
|
|
84
|
-
/** Default id length — 21 chars × 6 bits = 126 bits of entropy. */
|
|
85
|
-
export const OKID_DEFAULT_LENGTH = 21;
|
|
86
|
-
|
|
87
|
-
/** Shortest permitted id length (8 chars ≈ 48 bits entropy floor). */
|
|
88
|
-
export const OKID_MIN_LENGTH = 8;
|
|
89
|
-
|
|
90
|
-
/** Longest permitted id length. */
|
|
91
|
-
export const OKID_MAX_LENGTH = 128;
|
|
92
|
-
|
|
93
|
-
/** Sortable ids need ≥ 16: 8 timestamp chars alone would leave no randomness. */
|
|
94
|
-
export const OKID_SORTABLE_MIN_LENGTH = 16;
|
|
95
|
-
|
|
96
|
-
/** Longest permitted semantic {@link OkidOptions.prefix}. */
|
|
97
|
-
export const OKID_MAX_PREFIX_LENGTH = 32;
|
|
98
|
-
|
|
99
|
-
/** Options for {@link okid}. All alphabet toggles default to included. */
|
|
100
|
-
export interface OkidOptions {
|
|
101
|
-
/**
|
|
102
|
-
* Generated body length (default {@link OKID_DEFAULT_LENGTH}). Does not
|
|
103
|
-
* include {@link prefix} — the returned string is `prefix + body`.
|
|
104
|
-
*/
|
|
105
|
-
readonly length?: number;
|
|
106
|
-
/**
|
|
107
|
-
* Fixed semantic label prepended to the body (e.g. `"usr_"`, `"evt_"`).
|
|
108
|
-
* Characters must belong to {@link OKID_ALPHABET}; max
|
|
109
|
-
* {@link OKID_MAX_PREFIX_LENGTH}. Empty / omitted means no label.
|
|
110
|
-
*/
|
|
111
|
-
readonly prefix?: string;
|
|
112
|
-
/**
|
|
113
|
-
* Prefix the body with a 48-bit epoch-ms timestamp (exactly 8 chars) so
|
|
114
|
-
* lexicographic order tracks creation time across milliseconds. Alphabet
|
|
115
|
-
* toggles are ignored under this mode — see {@link OKID_SORTABLE_ALPHABET}.
|
|
116
|
-
* Combines with {@link prefix}: `prefix + timestamp + random`.
|
|
117
|
-
*/
|
|
118
|
-
readonly sortable?: boolean;
|
|
119
|
-
/** Include `a-z` (default true). */
|
|
120
|
-
readonly lowercase?: boolean;
|
|
121
|
-
/** Include `A-Z` (default true). */
|
|
122
|
-
readonly uppercase?: boolean;
|
|
123
|
-
/** Include `0-9` (default true). */
|
|
124
|
-
readonly numbers?: boolean;
|
|
125
|
-
/** Include `-` and `_` (default true). */
|
|
126
|
-
readonly symbols?: boolean;
|
|
127
|
-
/**
|
|
128
|
-
* Include visually confusable characters (`1lI0Oouv5Ss`, default true).
|
|
129
|
-
* Set `false` to drop them for human transcription.
|
|
130
|
-
*/
|
|
131
|
-
readonly lookAlikes?: boolean;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/** Resolved alphabet + encoding metadata for one options combination. */
|
|
135
|
-
interface ResolvedAlphabet {
|
|
136
|
-
readonly chars: string;
|
|
137
|
-
readonly size: number;
|
|
138
|
-
/** Bitmask covering `size` values (`size` is always a power of two here). */
|
|
139
|
-
readonly mask: number;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/** Memoized resolutions keyed by the toggle bitmask (32 combinations max). */
|
|
143
|
-
const ALPHABET_CACHE = new Map<number, ResolvedAlphabet>();
|
|
144
|
-
|
|
145
|
-
function resolveAlphabet(
|
|
146
|
-
numbers: boolean,
|
|
147
|
-
lowercase: boolean,
|
|
148
|
-
uppercase: boolean,
|
|
149
|
-
symbols: boolean,
|
|
150
|
-
lookAlikes: boolean,
|
|
151
|
-
): ResolvedAlphabet {
|
|
152
|
-
const key =
|
|
153
|
-
(numbers ? 1 : 0) |
|
|
154
|
-
(lowercase ? 2 : 0) |
|
|
155
|
-
(uppercase ? 4 : 0) |
|
|
156
|
-
(symbols ? 8 : 0) |
|
|
157
|
-
(lookAlikes ? 0 : 16);
|
|
158
|
-
const cached = ALPHABET_CACHE.get(key);
|
|
159
|
-
if (cached) return cached;
|
|
160
|
-
|
|
161
|
-
let chars = "";
|
|
162
|
-
if (numbers) chars += GROUPS.numbers;
|
|
163
|
-
if (lowercase) chars += GROUPS.lowercase;
|
|
164
|
-
if (uppercase) chars += GROUPS.uppercase;
|
|
165
|
-
if (symbols) chars += GROUPS.symbols;
|
|
166
|
-
if (!chars) {
|
|
167
|
-
throw new RangeError("okid: alphabet is empty — enable at least one character group");
|
|
168
|
-
}
|
|
169
|
-
if (!lookAlikes) {
|
|
170
|
-
chars = [...chars].filter((c) => !OKID_LOOKALIKE_CHARS.includes(c)).join("");
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Round up to a power of two for mask-based rejection sampling: bytes below
|
|
174
|
-
// `size` map uniformly, bytes above are discarded and re-drawn — unbiased at
|
|
175
|
-
// every alphabet size, unlike naive modulo.
|
|
176
|
-
const rawSize = chars.length;
|
|
177
|
-
const size = 1 << Math.ceil(Math.log2(rawSize));
|
|
178
|
-
const resolved: ResolvedAlphabet = { chars, size: rawSize, mask: size - 1 };
|
|
179
|
-
ALPHABET_CACHE.set(key, resolved);
|
|
180
|
-
return resolved;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/** Encode one random byte stream into `length` characters of `alphabet`. */
|
|
184
|
-
function encode(alphabet: ResolvedAlphabet, length: number): string {
|
|
185
|
-
const { chars, size, mask } = alphabet;
|
|
186
|
-
const bytes = new Uint8Array(length + Math.ceil(length >> 2));
|
|
187
|
-
crypto.getRandomValues(bytes.subarray(0, length));
|
|
188
|
-
let out = "";
|
|
189
|
-
let i = 0;
|
|
190
|
-
while (out.length < length && i < bytes.length) {
|
|
191
|
-
const byte = bytes[i++]!;
|
|
192
|
-
if ((byte & mask) < size) out += chars[byte & mask];
|
|
193
|
-
}
|
|
194
|
-
return out;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/** Pack epoch-ms into exactly 8 codepoint-ordered characters (48 bits). */
|
|
198
|
-
function encodeTimestamp(nowMs: number): string {
|
|
199
|
-
let t = nowMs % 2 ** 48;
|
|
200
|
-
let out = "";
|
|
201
|
-
for (let i = 0; i < 8; i++) {
|
|
202
|
-
out = OKID_SORTABLE_ALPHABET[t & 63]! + out;
|
|
203
|
-
t = Math.floor(t / 64);
|
|
204
|
-
}
|
|
205
|
-
return out;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Assert `length` is a valid integer within bounds for the requested mode.
|
|
210
|
-
*
|
|
211
|
-
* @param length - Requested length
|
|
212
|
-
* @param min - Mode-specific minimum
|
|
213
|
-
* @param label - Option name used in the error message
|
|
214
|
-
*/
|
|
215
|
-
function assertLength(length: number, min: number, label: string): void {
|
|
216
|
-
if (!Number.isInteger(length)) {
|
|
217
|
-
throw new RangeError(`okid: ${label} must be an integer, got ${length}`);
|
|
218
|
-
}
|
|
219
|
-
if (length < min || length > OKID_MAX_LENGTH) {
|
|
220
|
-
throw new RangeError(`okid: ${label} ${length} is out of range [${min}, ${OKID_MAX_LENGTH}]`);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Assert a semantic prefix is within bounds and stays on the URL-safe alphabet.
|
|
226
|
-
*
|
|
227
|
-
* @param prefix - Caller-supplied label
|
|
228
|
-
*/
|
|
229
|
-
function assertPrefix(prefix: string): void {
|
|
230
|
-
if (prefix.length > OKID_MAX_PREFIX_LENGTH) {
|
|
231
|
-
throw new RangeError(
|
|
232
|
-
`okid: prefix length ${prefix.length} exceeds max ${OKID_MAX_PREFIX_LENGTH}`,
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
for (const char of prefix) {
|
|
236
|
-
if (!OKID_ALPHABET.includes(char)) {
|
|
237
|
-
throw new RangeError(
|
|
238
|
-
`okid: prefix contains invalid character ${JSON.stringify(char)} — use characters from OKID_ALPHABET`,
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
80
|
+
function loadOkidExtended(): typeof import("./okid-extended.ts") {
|
|
81
|
+
return lazyRequire(import.meta.dir, ["okid", "extended"].join("-"));
|
|
242
82
|
}
|
|
243
83
|
|
|
244
84
|
/**
|
|
@@ -256,34 +96,11 @@ function assertPrefix(prefix: string): void {
|
|
|
256
96
|
export function okid(options: number | OkidOptions = OKID_DEFAULT_LENGTH): string {
|
|
257
97
|
if (typeof options === "number") {
|
|
258
98
|
assertLength(options, OKID_MIN_LENGTH, "length");
|
|
259
|
-
|
|
99
|
+
const bytes = new Uint8Array(options);
|
|
100
|
+
crypto.getRandomValues(bytes);
|
|
101
|
+
let out = "";
|
|
102
|
+
for (let i = 0; i < options; i++) out += OKID_DEFAULT_CHARS[bytes[i]! & 63]!;
|
|
103
|
+
return out;
|
|
260
104
|
}
|
|
261
|
-
|
|
262
|
-
const {
|
|
263
|
-
length = OKID_DEFAULT_LENGTH,
|
|
264
|
-
prefix = "",
|
|
265
|
-
sortable = false,
|
|
266
|
-
lowercase = true,
|
|
267
|
-
uppercase = true,
|
|
268
|
-
numbers = true,
|
|
269
|
-
symbols = true,
|
|
270
|
-
lookAlikes = true,
|
|
271
|
-
} = options;
|
|
272
|
-
|
|
273
|
-
if (prefix) assertPrefix(prefix);
|
|
274
|
-
|
|
275
|
-
let body: string;
|
|
276
|
-
if (sortable) {
|
|
277
|
-
assertLength(length, OKID_SORTABLE_MIN_LENGTH, "length");
|
|
278
|
-
// Time ordering requires lexicographic encoding, which requires the full
|
|
279
|
-
// codepoint-ordered alphabet — partial subsets cannot preserve both the
|
|
280
|
-
// caller's charset choice AND cross-ms ordering, so toggles are ignored.
|
|
281
|
-
const alphabet = resolveAlphabet(true, true, true, true, true);
|
|
282
|
-
body = encodeTimestamp(Date.now()) + encode(alphabet, length - 8);
|
|
283
|
-
} else {
|
|
284
|
-
assertLength(length, OKID_MIN_LENGTH, "length");
|
|
285
|
-
body = encode(resolveAlphabet(numbers, lowercase, uppercase, symbols, lookAlikes), length);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
return prefix ? prefix + body : body;
|
|
105
|
+
return loadOkidExtended().okidWithOptions(options);
|
|
289
106
|
}
|
package/src/release/build-lib.ts
CHANGED
|
@@ -26,6 +26,7 @@ const ENTRIES: readonly { readonly src: string; readonly out: string }[] = [
|
|
|
26
26
|
// Lazy sync chunks — loaded via requirePackageModule / computed require
|
|
27
27
|
// when the feature actually runs (auth, list page, auto-cache).
|
|
28
28
|
{ src: "src/kernel/fx-runtime.ts", out: "dist/fx-runtime.js" },
|
|
29
|
+
{ src: "src/kernel/client-descriptor.ts", out: "dist/client-descriptor.js" },
|
|
29
30
|
{ src: "src/auth/config.ts", out: "dist/auth-config.js" },
|
|
30
31
|
{ src: "src/kernel/fx-auth-keys.ts", out: "dist/fx-auth-keys.js" },
|
|
31
32
|
{ src: "src/kernel/fx-auth-tenants.ts", out: "dist/fx-auth-tenants.js" },
|
|
@@ -37,6 +38,12 @@ const ENTRIES: readonly { readonly src: string; readonly out: string }[] = [
|
|
|
37
38
|
{ src: "src/kernel/errors-live-resume.ts", out: "dist/errors-live-resume.js" },
|
|
38
39
|
{ src: "src/kernel/errors-channel.ts", out: "dist/errors-channel.js" },
|
|
39
40
|
{ src: "src/kernel/errors-tenant.ts", out: "dist/errors-tenant.js" },
|
|
41
|
+
{ src: "src/kernel/errors-text.ts", out: "dist/errors-text.js" },
|
|
42
|
+
{ src: "src/kernel/fx-sql-handle.ts", out: "dist/fx-sql-handle.js" },
|
|
43
|
+
{ src: "src/kernel/concurrency.ts", out: "dist/concurrency.js" },
|
|
44
|
+
{ src: "src/compiler/aot.ts", out: "dist/aot.js" },
|
|
45
|
+
{ src: "src/runs/window.ts", out: "dist/window.js" },
|
|
46
|
+
{ src: "src/okid-extended.ts", out: "dist/okid-extended.js" },
|
|
40
47
|
{ src: "src/kernel/clock-durable.ts", out: "dist/clock-durable.js" },
|
|
41
48
|
{ src: "src/kernel/clock-reconcile.ts", out: "dist/clock-reconcile.js" },
|
|
42
49
|
{ src: "src/kernel/clock-per-tenant-name.ts", out: "dist/clock-per-tenant-name.js" },
|
|
@@ -44,6 +51,8 @@ const ENTRIES: readonly { readonly src: string; readonly out: string }[] = [
|
|
|
44
51
|
{ src: "src/kernel/list-page.ts", out: "dist/list-page.js" },
|
|
45
52
|
{ src: "src/kernel/http-resource.ts", out: "dist/http-resource.js" },
|
|
46
53
|
{ src: "src/elements/store/cache.ts", out: "dist/store-cache.js" },
|
|
54
|
+
{ src: "src/elements/store/search-runtime.ts", out: "dist/search-runtime.js" },
|
|
55
|
+
{ src: "src/elements/store/schema-decl.ts", out: "dist/schema-decl.js" },
|
|
47
56
|
{ src: "src/i18n/messages.ts", out: "dist/messages.js" },
|
|
48
57
|
{ src: "src/i18n/failure-message.ts", out: "dist/failure-message.js" },
|
|
49
58
|
{ src: "src/okid.ts", out: "dist/okid.js" },
|