ADAPT-Chase commited on
Commit
e7cdb8f
·
verified ·
1 Parent(s): 96a88ce

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/glob/dist/esm/bin.d.mts.map +1 -0
  2. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/glob/dist/esm/glob.d.ts +388 -0
  3. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/auth/authclient.js +286 -0
  4. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/auth/envDetect.js +90 -0
  5. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/auth/identitypoolclient.d.ts +132 -0
  6. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/auth/loginticket.js +60 -0
  7. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/auth/pluggable-auth-client.d.ts +141 -0
  8. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/crypto/crypto.js +54 -0
  9. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/crypto/node/crypto.d.ts +25 -0
  10. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/crypto/shared.js +32 -0
  11. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-logging-utils/build/src/logging-utils.js +437 -0
  12. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-logging-utils/build/src/temporal.js.map +1 -0
  13. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/gtoken/build/cjs/src/index.cjs +450 -0
  14. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/hasown/.github/FUNDING.yml +12 -0
  15. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  16. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +15 -0
  17. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/https-proxy-agent/dist/parse-proxy-response.js +101 -0
  18. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/jackspeak/dist/esm/index.js.map +1 -0
  19. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/json-bigint/lib/parse.js +443 -0
  20. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/json-schema-ref-resolver/test/anchor.test.js +56 -0
  21. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/json-schema-ref-resolver/test/deref-schema.test.js +287 -0
  22. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/json5/lib/parse.js +1114 -0
  23. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/jsonrepair/lib/esm/index.js +4 -0
  24. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/jsonrepair/lib/types/regular/jsonrepair.d.ts +18 -0
  25. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/jsonrepair/lib/types/streaming/buffer/InputBuffer.d.ts.map +1 -0
  26. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/jsonrepair/lib/types/utils/stringUtils.d.ts +65 -0
  27. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/light-my-request/.github/workflows/benchmark.yml +30 -0
  28. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/light-my-request/build/build-validation.js +100 -0
  29. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/light-my-request/node_modules/process-warning/.github/workflows/ci.yml +24 -0
  30. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/light-my-request/node_modules/process-warning/eslint.config.js +6 -0
  31. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/light-my-request/node_modules/process-warning/test/no-warnings.test.js +80 -0
  32. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/light-my-request/node_modules/process-warning/types/index.d.ts +37 -0
  33. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/commonjs/index.d.ts +1306 -0
  34. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
  35. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/commonjs/index.min.js.map +0 -0
  36. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/esm/index.d.ts +1306 -0
  37. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
  38. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/esm/index.min.js.map +0 -0
  39. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/esm/package.json +3 -0
  40. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
  41. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
  42. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/ast.js +592 -0
  43. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
  44. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
  45. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
  46. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/escape.d.ts +12 -0
  47. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/index.d.ts +94 -0
  48. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
  49. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/index.js +1014 -0
  50. platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/unescape.d.ts +17 -0
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/glob/dist/esm/bin.d.mts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"bin.d.mts","sourceRoot":"","sources":["../../src/bin.mts"],"names":[],"mappings":""}
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/glob/dist/esm/glob.d.ts ADDED
@@ -0,0 +1,388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Minimatch } from 'minimatch';
2
+ import { Minipass } from 'minipass';
3
+ import { FSOption, Path, PathScurry } from 'path-scurry';
4
+ import { IgnoreLike } from './ignore.js';
5
+ import { Pattern } from './pattern.js';
6
+ export type MatchSet = Minimatch['set'];
7
+ export type GlobParts = Exclude<Minimatch['globParts'], undefined>;
8
+ /**
9
+ * A `GlobOptions` object may be provided to any of the exported methods, and
10
+ * must be provided to the `Glob` constructor.
11
+ *
12
+ * All options are optional, boolean, and false by default, unless otherwise
13
+ * noted.
14
+ *
15
+ * All resolved options are added to the Glob object as properties.
16
+ *
17
+ * If you are running many `glob` operations, you can pass a Glob object as the
18
+ * `options` argument to a subsequent operation to share the previously loaded
19
+ * cache.
20
+ */
21
+ export interface GlobOptions {
22
+ /**
23
+ * Set to `true` to always receive absolute paths for
24
+ * matched files. Set to `false` to always return relative paths.
25
+ *
26
+ * When this option is not set, absolute paths are returned for patterns
27
+ * that are absolute, and otherwise paths are returned that are relative
28
+ * to the `cwd` setting.
29
+ *
30
+ * This does _not_ make an extra system call to get
31
+ * the realpath, it only does string path resolution.
32
+ *
33
+ * Conflicts with {@link withFileTypes}
34
+ */
35
+ absolute?: boolean;
36
+ /**
37
+ * Set to false to enable {@link windowsPathsNoEscape}
38
+ *
39
+ * @deprecated
40
+ */
41
+ allowWindowsEscape?: boolean;
42
+ /**
43
+ * The current working directory in which to search. Defaults to
44
+ * `process.cwd()`.
45
+ *
46
+ * May be eiher a string path or a `file://` URL object or string.
47
+ */
48
+ cwd?: string | URL;
49
+ /**
50
+ * Include `.dot` files in normal matches and `globstar`
51
+ * matches. Note that an explicit dot in a portion of the pattern
52
+ * will always match dot files.
53
+ */
54
+ dot?: boolean;
55
+ /**
56
+ * Prepend all relative path strings with `./` (or `.\` on Windows).
57
+ *
58
+ * Without this option, returned relative paths are "bare", so instead of
59
+ * returning `'./foo/bar'`, they are returned as `'foo/bar'`.
60
+ *
61
+ * Relative patterns starting with `'../'` are not prepended with `./`, even
62
+ * if this option is set.
63
+ */
64
+ dotRelative?: boolean;
65
+ /**
66
+ * Follow symlinked directories when expanding `**`
67
+ * patterns. This can result in a lot of duplicate references in
68
+ * the presence of cyclic links, and make performance quite bad.
69
+ *
70
+ * By default, a `**` in a pattern will follow 1 symbolic link if
71
+ * it is not the first item in the pattern, or none if it is the
72
+ * first item in the pattern, following the same behavior as Bash.
73
+ */
74
+ follow?: boolean;
75
+ /**
76
+ * string or string[], or an object with `ignored` and `childrenIgnored`
77
+ * methods.
78
+ *
79
+ * If a string or string[] is provided, then this is treated as a glob
80
+ * pattern or array of glob patterns to exclude from matches. To ignore all
81
+ * children within a directory, as well as the entry itself, append `'/**'`
82
+ * to the ignore pattern.
83
+ *
84
+ * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of
85
+ * any other settings.
86
+ *
87
+ * If an object is provided that has `ignored(path)` and/or
88
+ * `childrenIgnored(path)` methods, then these methods will be called to
89
+ * determine whether any Path is a match or if its children should be
90
+ * traversed, respectively.
91
+ */
92
+ ignore?: string | string[] | IgnoreLike;
93
+ /**
94
+ * Treat brace expansion like `{a,b}` as a "magic" pattern. Has no
95
+ * effect if {@link nobrace} is set.
96
+ *
97
+ * Only has effect on the {@link hasMagic} function.
98
+ */
99
+ magicalBraces?: boolean;
100
+ /**
101
+ * Add a `/` character to directory matches. Note that this requires
102
+ * additional stat calls in some cases.
103
+ */
104
+ mark?: boolean;
105
+ /**
106
+ * Perform a basename-only match if the pattern does not contain any slash
107
+ * characters. That is, `*.js` would be treated as equivalent to
108
+ * `**\/*.js`, matching all js files in all directories.
109
+ */
110
+ matchBase?: boolean;
111
+ /**
112
+ * Limit the directory traversal to a given depth below the cwd.
113
+ * Note that this does NOT prevent traversal to sibling folders,
114
+ * root patterns, and so on. It only limits the maximum folder depth
115
+ * that the walk will descend, relative to the cwd.
116
+ */
117
+ maxDepth?: number;
118
+ /**
119
+ * Do not expand `{a,b}` and `{1..3}` brace sets.
120
+ */
121
+ nobrace?: boolean;
122
+ /**
123
+ * Perform a case-insensitive match. This defaults to `true` on macOS and
124
+ * Windows systems, and `false` on all others.
125
+ *
126
+ * **Note** `nocase` should only be explicitly set when it is
127
+ * known that the filesystem's case sensitivity differs from the
128
+ * platform default. If set `true` on case-sensitive file
129
+ * systems, or `false` on case-insensitive file systems, then the
130
+ * walk may return more or less results than expected.
131
+ */
132
+ nocase?: boolean;
133
+ /**
134
+ * Do not match directories, only files. (Note: to match
135
+ * _only_ directories, put a `/` at the end of the pattern.)
136
+ */
137
+ nodir?: boolean;
138
+ /**
139
+ * Do not match "extglob" patterns such as `+(a|b)`.
140
+ */
141
+ noext?: boolean;
142
+ /**
143
+ * Do not match `**` against multiple filenames. (Ie, treat it as a normal
144
+ * `*` instead.)
145
+ *
146
+ * Conflicts with {@link matchBase}
147
+ */
148
+ noglobstar?: boolean;
149
+ /**
150
+ * Defaults to value of `process.platform` if available, or `'linux'` if
151
+ * not. Setting `platform:'win32'` on non-Windows systems may cause strange
152
+ * behavior.
153
+ */
154
+ platform?: NodeJS.Platform;
155
+ /**
156
+ * Set to true to call `fs.realpath` on all of the
157
+ * results. In the case of an entry that cannot be resolved, the
158
+ * entry is omitted. This incurs a slight performance penalty, of
159
+ * course, because of the added system calls.
160
+ */
161
+ realpath?: boolean;
162
+ /**
163
+ *
164
+ * A string path resolved against the `cwd` option, which
165
+ * is used as the starting point for absolute patterns that start
166
+ * with `/`, (but not drive letters or UNC paths on Windows).
167
+ *
168
+ * Note that this _doesn't_ necessarily limit the walk to the
169
+ * `root` directory, and doesn't affect the cwd starting point for
170
+ * non-absolute patterns. A pattern containing `..` will still be
171
+ * able to traverse out of the root directory, if it is not an
172
+ * actual root directory on the filesystem, and any non-absolute
173
+ * patterns will be matched in the `cwd`. For example, the
174
+ * pattern `/../*` with `{root:'/some/path'}` will return all
175
+ * files in `/some`, not all files in `/some/path`. The pattern
176
+ * `*` with `{root:'/some/path'}` will return all the entries in
177
+ * the cwd, not the entries in `/some/path`.
178
+ *
179
+ * To start absolute and non-absolute patterns in the same
180
+ * path, you can use `{root:''}`. However, be aware that on
181
+ * Windows systems, a pattern like `x:/*` or `//host/share/*` will
182
+ * _always_ start in the `x:/` or `//host/share` directory,
183
+ * regardless of the `root` setting.
184
+ */
185
+ root?: string;
186
+ /**
187
+ * A [PathScurry](http://npm.im/path-scurry) object used
188
+ * to traverse the file system. If the `nocase` option is set
189
+ * explicitly, then any provided `scurry` object must match this
190
+ * setting.
191
+ */
192
+ scurry?: PathScurry;
193
+ /**
194
+ * Call `lstat()` on all entries, whether required or not to determine
195
+ * if it's a valid match. When used with {@link withFileTypes}, this means
196
+ * that matches will include data such as modified time, permissions, and
197
+ * so on. Note that this will incur a performance cost due to the added
198
+ * system calls.
199
+ */
200
+ stat?: boolean;
201
+ /**
202
+ * An AbortSignal which will cancel the Glob walk when
203
+ * triggered.
204
+ */
205
+ signal?: AbortSignal;
206
+ /**
207
+ * Use `\\` as a path separator _only_, and
208
+ * _never_ as an escape character. If set, all `\\` characters are
209
+ * replaced with `/` in the pattern.
210
+ *
211
+ * Note that this makes it **impossible** to match against paths
212
+ * containing literal glob pattern characters, but allows matching
213
+ * with patterns constructed using `path.join()` and
214
+ * `path.resolve()` on Windows platforms, mimicking the (buggy!)
215
+ * behavior of Glob v7 and before on Windows. Please use with
216
+ * caution, and be mindful of [the caveat below about Windows
217
+ * paths](#windows). (For legacy reasons, this is also set if
218
+ * `allowWindowsEscape` is set to the exact value `false`.)
219
+ */
220
+ windowsPathsNoEscape?: boolean;
221
+ /**
222
+ * Return [PathScurry](http://npm.im/path-scurry)
223
+ * `Path` objects instead of strings. These are similar to a
224
+ * NodeJS `Dirent` object, but with additional methods and
225
+ * properties.
226
+ *
227
+ * Conflicts with {@link absolute}
228
+ */
229
+ withFileTypes?: boolean;
230
+ /**
231
+ * An fs implementation to override some or all of the defaults. See
232
+ * http://npm.im/path-scurry for details about what can be overridden.
233
+ */
234
+ fs?: FSOption;
235
+ /**
236
+ * Just passed along to Minimatch. Note that this makes all pattern
237
+ * matching operations slower and *extremely* noisy.
238
+ */
239
+ debug?: boolean;
240
+ /**
241
+ * Return `/` delimited paths, even on Windows.
242
+ *
243
+ * On posix systems, this has no effect. But, on Windows, it means that
244
+ * paths will be `/` delimited, and absolute paths will be their full
245
+ * resolved UNC forms, eg instead of `'C:\\foo\\bar'`, it would return
246
+ * `'//?/C:/foo/bar'`
247
+ */
248
+ posix?: boolean;
249
+ /**
250
+ * Do not match any children of any matches. For example, the pattern
251
+ * `**\/foo` would match `a/foo`, but not `a/foo/b/foo` in this mode.
252
+ *
253
+ * This is especially useful for cases like "find all `node_modules`
254
+ * folders, but not the ones in `node_modules`".
255
+ *
256
+ * In order to support this, the `Ignore` implementation must support an
257
+ * `add(pattern: string)` method. If using the default `Ignore` class, then
258
+ * this is fine, but if this is set to `false`, and a custom `Ignore` is
259
+ * provided that does not have an `add()` method, then it will throw an
260
+ * error.
261
+ *
262
+ * **Caveat** It *only* ignores matches that would be a descendant of a
263
+ * previous match, and only if that descendant is matched *after* the
264
+ * ancestor is encountered. Since the file system walk happens in
265
+ * indeterminate order, it's possible that a match will already be added
266
+ * before its ancestor, if multiple or braced patterns are used.
267
+ *
268
+ * For example:
269
+ *
270
+ * ```ts
271
+ * const results = await glob([
272
+ * // likely to match first, since it's just a stat
273
+ * 'a/b/c/d/e/f',
274
+ *
275
+ * // this pattern is more complicated! It must to various readdir()
276
+ * // calls and test the results against a regular expression, and that
277
+ * // is certainly going to take a little bit longer.
278
+ * //
279
+ * // So, later on, it encounters a match at 'a/b/c/d/e', but it's too
280
+ * // late to ignore a/b/c/d/e/f, because it's already been emitted.
281
+ * 'a/[bdf]/?/[a-z]/*',
282
+ * ], { includeChildMatches: false })
283
+ * ```
284
+ *
285
+ * It's best to only set this to `false` if you can be reasonably sure that
286
+ * no components of the pattern will potentially match one another's file
287
+ * system descendants, or if the occasional included child entry will not
288
+ * cause problems.
289
+ *
290
+ * @default true
291
+ */
292
+ includeChildMatches?: boolean;
293
+ }
294
+ export type GlobOptionsWithFileTypesTrue = GlobOptions & {
295
+ withFileTypes: true;
296
+ absolute?: undefined;
297
+ mark?: undefined;
298
+ posix?: undefined;
299
+ };
300
+ export type GlobOptionsWithFileTypesFalse = GlobOptions & {
301
+ withFileTypes?: false;
302
+ };
303
+ export type GlobOptionsWithFileTypesUnset = GlobOptions & {
304
+ withFileTypes?: undefined;
305
+ };
306
+ export type Result<Opts> = Opts extends GlobOptionsWithFileTypesTrue ? Path : Opts extends GlobOptionsWithFileTypesFalse ? string : Opts extends GlobOptionsWithFileTypesUnset ? string : string | Path;
307
+ export type Results<Opts> = Result<Opts>[];
308
+ export type FileTypes<Opts> = Opts extends GlobOptionsWithFileTypesTrue ? true : Opts extends GlobOptionsWithFileTypesFalse ? false : Opts extends GlobOptionsWithFileTypesUnset ? false : boolean;
309
+ /**
310
+ * An object that can perform glob pattern traversals.
311
+ */
312
+ export declare class Glob<Opts extends GlobOptions> implements GlobOptions {
313
+ absolute?: boolean;
314
+ cwd: string;
315
+ root?: string;
316
+ dot: boolean;
317
+ dotRelative: boolean;
318
+ follow: boolean;
319
+ ignore?: string | string[] | IgnoreLike;
320
+ magicalBraces: boolean;
321
+ mark?: boolean;
322
+ matchBase: boolean;
323
+ maxDepth: number;
324
+ nobrace: boolean;
325
+ nocase: boolean;
326
+ nodir: boolean;
327
+ noext: boolean;
328
+ noglobstar: boolean;
329
+ pattern: string[];
330
+ platform: NodeJS.Platform;
331
+ realpath: boolean;
332
+ scurry: PathScurry;
333
+ stat: boolean;
334
+ signal?: AbortSignal;
335
+ windowsPathsNoEscape: boolean;
336
+ withFileTypes: FileTypes<Opts>;
337
+ includeChildMatches: boolean;
338
+ /**
339
+ * The options provided to the constructor.
340
+ */
341
+ opts: Opts;
342
+ /**
343
+ * An array of parsed immutable {@link Pattern} objects.
344
+ */
345
+ patterns: Pattern[];
346
+ /**
347
+ * All options are stored as properties on the `Glob` object.
348
+ *
349
+ * See {@link GlobOptions} for full options descriptions.
350
+ *
351
+ * Note that a previous `Glob` object can be passed as the
352
+ * `GlobOptions` to another `Glob` instantiation to re-use settings
353
+ * and caches with a new pattern.
354
+ *
355
+ * Traversal functions can be called multiple times to run the walk
356
+ * again.
357
+ */
358
+ constructor(pattern: string | string[], opts: Opts);
359
+ /**
360
+ * Returns a Promise that resolves to the results array.
361
+ */
362
+ walk(): Promise<Results<Opts>>;
363
+ /**
364
+ * synchronous {@link Glob.walk}
365
+ */
366
+ walkSync(): Results<Opts>;
367
+ /**
368
+ * Stream results asynchronously.
369
+ */
370
+ stream(): Minipass<Result<Opts>, Result<Opts>>;
371
+ /**
372
+ * Stream results synchronously.
373
+ */
374
+ streamSync(): Minipass<Result<Opts>, Result<Opts>>;
375
+ /**
376
+ * Default sync iteration function. Returns a Generator that
377
+ * iterates over the results.
378
+ */
379
+ iterateSync(): Generator<Result<Opts>, void, void>;
380
+ [Symbol.iterator](): Generator<Result<Opts>, void, void>;
381
+ /**
382
+ * Default async iteration function. Returns an AsyncGenerator that
383
+ * iterates over the results.
384
+ */
385
+ iterate(): AsyncGenerator<Result<Opts>, void, void>;
386
+ [Symbol.asyncIterator](): AsyncGenerator<Result<Opts>, void, void>;
387
+ }
388
+ //# sourceMappingURL=glob.d.ts.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/auth/authclient.js ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ // Copyright 2012 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.AuthClient = exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS = exports.DEFAULT_UNIVERSE = void 0;
17
+ const events_1 = require("events");
18
+ const gaxios_1 = require("gaxios");
19
+ const util_1 = require("../util");
20
+ const google_logging_utils_1 = require("google-logging-utils");
21
+ const shared_cjs_1 = require("../shared.cjs");
22
+ /**
23
+ * The default cloud universe
24
+ *
25
+ * @see {@link AuthJSONOptions.universe_domain}
26
+ */
27
+ exports.DEFAULT_UNIVERSE = 'googleapis.com';
28
+ /**
29
+ * The default {@link AuthClientOptions.eagerRefreshThresholdMillis}
30
+ */
31
+ exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS = 5 * 60 * 1000;
32
+ /**
33
+ * The base of all Auth Clients.
34
+ */
35
+ class AuthClient extends events_1.EventEmitter {
36
+ apiKey;
37
+ projectId;
38
+ /**
39
+ * The quota project ID. The quota project can be used by client libraries for the billing purpose.
40
+ * See {@link https://cloud.google.com/docs/quota Working with quotas}
41
+ */
42
+ quotaProjectId;
43
+ /**
44
+ * The {@link Gaxios `Gaxios`} instance used for making requests.
45
+ */
46
+ transporter;
47
+ credentials = {};
48
+ eagerRefreshThresholdMillis = exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS;
49
+ forceRefreshOnFailure = false;
50
+ universeDomain = exports.DEFAULT_UNIVERSE;
51
+ /**
52
+ * Symbols that can be added to GaxiosOptions to specify the method name that is
53
+ * making an RPC call, for logging purposes, as well as a string ID that can be
54
+ * used to correlate calls and responses.
55
+ */
56
+ static RequestMethodNameSymbol = Symbol('request method name');
57
+ static RequestLogIdSymbol = Symbol('request log id');
58
+ constructor(opts = {}) {
59
+ super();
60
+ const options = (0, util_1.originalOrCamelOptions)(opts);
61
+ // Shared auth options
62
+ this.apiKey = opts.apiKey;
63
+ this.projectId = options.get('project_id') ?? null;
64
+ this.quotaProjectId = options.get('quota_project_id');
65
+ this.credentials = options.get('credentials') ?? {};
66
+ this.universeDomain = options.get('universe_domain') ?? exports.DEFAULT_UNIVERSE;
67
+ // Shared client options
68
+ this.transporter = opts.transporter ?? new gaxios_1.Gaxios(opts.transporterOptions);
69
+ if (options.get('useAuthRequestParameters') !== false) {
70
+ this.transporter.interceptors.request.add(AuthClient.DEFAULT_REQUEST_INTERCEPTOR);
71
+ this.transporter.interceptors.response.add(AuthClient.DEFAULT_RESPONSE_INTERCEPTOR);
72
+ }
73
+ if (opts.eagerRefreshThresholdMillis) {
74
+ this.eagerRefreshThresholdMillis = opts.eagerRefreshThresholdMillis;
75
+ }
76
+ this.forceRefreshOnFailure = opts.forceRefreshOnFailure ?? false;
77
+ }
78
+ /**
79
+ * A {@link fetch `fetch`} compliant API for {@link AuthClient}.
80
+ *
81
+ * @see {@link AuthClient.request} for the classic method.
82
+ *
83
+ * @remarks
84
+ *
85
+ * This is useful as a drop-in replacement for `fetch` API usage.
86
+ *
87
+ * @example
88
+ *
89
+ * ```ts
90
+ * const authClient = new AuthClient();
91
+ * const fetchWithAuthClient: typeof fetch = (...args) => authClient.fetch(...args);
92
+ * await fetchWithAuthClient('https://example.com');
93
+ * ```
94
+ *
95
+ * @param args `fetch` API or {@link Gaxios.fetch `Gaxios#fetch`} parameters
96
+ * @returns the {@link GaxiosResponse} with Gaxios-added properties
97
+ */
98
+ fetch(...args) {
99
+ // Up to 2 parameters in either overload
100
+ const input = args[0];
101
+ const init = args[1];
102
+ let url = undefined;
103
+ const headers = new Headers();
104
+ // prepare URL
105
+ if (typeof input === 'string') {
106
+ url = new URL(input);
107
+ }
108
+ else if (input instanceof URL) {
109
+ url = input;
110
+ }
111
+ else if (input && input.url) {
112
+ url = new URL(input.url);
113
+ }
114
+ // prepare headers
115
+ if (input && typeof input === 'object' && 'headers' in input) {
116
+ gaxios_1.Gaxios.mergeHeaders(headers, input.headers);
117
+ }
118
+ if (init) {
119
+ gaxios_1.Gaxios.mergeHeaders(headers, new Headers(init.headers));
120
+ }
121
+ // prepare request
122
+ if (typeof input === 'object' && !(input instanceof URL)) {
123
+ // input must have been a non-URL object
124
+ return this.request({ ...init, ...input, headers, url });
125
+ }
126
+ else {
127
+ // input must have been a string or URL
128
+ return this.request({ ...init, headers, url });
129
+ }
130
+ }
131
+ /**
132
+ * Sets the auth credentials.
133
+ */
134
+ setCredentials(credentials) {
135
+ this.credentials = credentials;
136
+ }
137
+ /**
138
+ * Append additional headers, e.g., x-goog-user-project, shared across the
139
+ * classes inheriting AuthClient. This method should be used by any method
140
+ * that overrides getRequestMetadataAsync(), which is a shared helper for
141
+ * setting request information in both gRPC and HTTP API calls.
142
+ *
143
+ * @param headers object to append additional headers to.
144
+ */
145
+ addSharedMetadataHeaders(headers) {
146
+ // quota_project_id, stored in application_default_credentials.json, is set in
147
+ // the x-goog-user-project header, to indicate an alternate account for
148
+ // billing and quota:
149
+ if (!headers.has('x-goog-user-project') && // don't override a value the user sets.
150
+ this.quotaProjectId) {
151
+ headers.set('x-goog-user-project', this.quotaProjectId);
152
+ }
153
+ return headers;
154
+ }
155
+ /**
156
+ * Adds the `x-goog-user-project` and `authorization` headers to the target Headers
157
+ * object, if they exist on the source.
158
+ *
159
+ * @param target the headers to target
160
+ * @param source the headers to source from
161
+ * @returns the target headers
162
+ */
163
+ addUserProjectAndAuthHeaders(target, source) {
164
+ const xGoogUserProject = source.get('x-goog-user-project');
165
+ const authorizationHeader = source.get('authorization');
166
+ if (xGoogUserProject) {
167
+ target.set('x-goog-user-project', xGoogUserProject);
168
+ }
169
+ if (authorizationHeader) {
170
+ target.set('authorization', authorizationHeader);
171
+ }
172
+ return target;
173
+ }
174
+ static log = (0, google_logging_utils_1.log)('auth');
175
+ static DEFAULT_REQUEST_INTERCEPTOR = {
176
+ resolved: async (config) => {
177
+ // Set `x-goog-api-client`, if not already set
178
+ if (!config.headers.has('x-goog-api-client')) {
179
+ const nodeVersion = process.version.replace(/^v/, '');
180
+ config.headers.set('x-goog-api-client', `gl-node/${nodeVersion}`);
181
+ }
182
+ // Set `User-Agent`
183
+ const userAgent = config.headers.get('User-Agent');
184
+ if (!userAgent) {
185
+ config.headers.set('User-Agent', shared_cjs_1.USER_AGENT);
186
+ }
187
+ else if (!userAgent.includes(`${shared_cjs_1.PRODUCT_NAME}/`)) {
188
+ config.headers.set('User-Agent', `${userAgent} ${shared_cjs_1.USER_AGENT}`);
189
+ }
190
+ try {
191
+ const symbols = config;
192
+ const methodName = symbols[AuthClient.RequestMethodNameSymbol];
193
+ // This doesn't need to be very unique or interesting, it's just an aid for
194
+ // matching requests to responses.
195
+ const logId = `${Math.floor(Math.random() * 1000)}`;
196
+ symbols[AuthClient.RequestLogIdSymbol] = logId;
197
+ // Boil down the object we're printing out.
198
+ const logObject = {
199
+ url: config.url,
200
+ headers: config.headers,
201
+ };
202
+ if (methodName) {
203
+ AuthClient.log.info('%s [%s] request %j', methodName, logId, logObject);
204
+ }
205
+ else {
206
+ AuthClient.log.info('[%s] request %j', logId, logObject);
207
+ }
208
+ }
209
+ catch (e) {
210
+ // Logging must not create new errors; swallow them all.
211
+ }
212
+ return config;
213
+ },
214
+ };
215
+ static DEFAULT_RESPONSE_INTERCEPTOR = {
216
+ resolved: async (response) => {
217
+ try {
218
+ const symbols = response.config;
219
+ const methodName = symbols[AuthClient.RequestMethodNameSymbol];
220
+ const logId = symbols[AuthClient.RequestLogIdSymbol];
221
+ if (methodName) {
222
+ AuthClient.log.info('%s [%s] response %j', methodName, logId, response.data);
223
+ }
224
+ else {
225
+ AuthClient.log.info('[%s] response %j', logId, response.data);
226
+ }
227
+ }
228
+ catch (e) {
229
+ // Logging must not create new errors; swallow them all.
230
+ }
231
+ return response;
232
+ },
233
+ rejected: async (error) => {
234
+ try {
235
+ const symbols = error.config;
236
+ const methodName = symbols[AuthClient.RequestMethodNameSymbol];
237
+ const logId = symbols[AuthClient.RequestLogIdSymbol];
238
+ if (methodName) {
239
+ AuthClient.log.info('%s [%s] error %j', methodName, logId, error.response?.data);
240
+ }
241
+ else {
242
+ AuthClient.log.error('[%s] error %j', logId, error.response?.data);
243
+ }
244
+ }
245
+ catch (e) {
246
+ // Logging must not create new errors; swallow them all.
247
+ }
248
+ // Re-throw the error.
249
+ throw error;
250
+ },
251
+ };
252
+ /**
253
+ * Sets the method name that is making a Gaxios request, so that logging may tag
254
+ * log lines with the operation.
255
+ * @param config A Gaxios request config
256
+ * @param methodName The method name making the call
257
+ */
258
+ static setMethodName(config, methodName) {
259
+ try {
260
+ const symbols = config;
261
+ symbols[AuthClient.RequestMethodNameSymbol] = methodName;
262
+ }
263
+ catch (e) {
264
+ // Logging must not create new errors; swallow them all.
265
+ }
266
+ }
267
+ /**
268
+ * Retry config for Auth-related requests.
269
+ *
270
+ * @remarks
271
+ *
272
+ * This is not a part of the default {@link AuthClient.transporter transporter/gaxios}
273
+ * config as some downstream APIs would prefer if customers explicitly enable retries,
274
+ * such as GCS.
275
+ */
276
+ static get RETRY_CONFIG() {
277
+ return {
278
+ retry: true,
279
+ retryConfig: {
280
+ httpMethodsToRetry: ['GET', 'PUT', 'POST', 'HEAD', 'OPTIONS', 'DELETE'],
281
+ },
282
+ };
283
+ }
284
+ }
285
+ exports.AuthClient = AuthClient;
286
+ //# sourceMappingURL=authclient.js.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/auth/envDetect.js ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ // Copyright 2018 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.GCPEnv = void 0;
17
+ exports.clear = clear;
18
+ exports.getEnv = getEnv;
19
+ const gcpMetadata = require("gcp-metadata");
20
+ var GCPEnv;
21
+ (function (GCPEnv) {
22
+ GCPEnv["APP_ENGINE"] = "APP_ENGINE";
23
+ GCPEnv["KUBERNETES_ENGINE"] = "KUBERNETES_ENGINE";
24
+ GCPEnv["CLOUD_FUNCTIONS"] = "CLOUD_FUNCTIONS";
25
+ GCPEnv["COMPUTE_ENGINE"] = "COMPUTE_ENGINE";
26
+ GCPEnv["CLOUD_RUN"] = "CLOUD_RUN";
27
+ GCPEnv["NONE"] = "NONE";
28
+ })(GCPEnv || (exports.GCPEnv = GCPEnv = {}));
29
+ let envPromise;
30
+ function clear() {
31
+ envPromise = undefined;
32
+ }
33
+ async function getEnv() {
34
+ if (envPromise) {
35
+ return envPromise;
36
+ }
37
+ envPromise = getEnvMemoized();
38
+ return envPromise;
39
+ }
40
+ async function getEnvMemoized() {
41
+ let env = GCPEnv.NONE;
42
+ if (isAppEngine()) {
43
+ env = GCPEnv.APP_ENGINE;
44
+ }
45
+ else if (isCloudFunction()) {
46
+ env = GCPEnv.CLOUD_FUNCTIONS;
47
+ }
48
+ else if (await isComputeEngine()) {
49
+ if (await isKubernetesEngine()) {
50
+ env = GCPEnv.KUBERNETES_ENGINE;
51
+ }
52
+ else if (isCloudRun()) {
53
+ env = GCPEnv.CLOUD_RUN;
54
+ }
55
+ else {
56
+ env = GCPEnv.COMPUTE_ENGINE;
57
+ }
58
+ }
59
+ else {
60
+ env = GCPEnv.NONE;
61
+ }
62
+ return env;
63
+ }
64
+ function isAppEngine() {
65
+ return !!(process.env.GAE_SERVICE || process.env.GAE_MODULE_NAME);
66
+ }
67
+ function isCloudFunction() {
68
+ return !!(process.env.FUNCTION_NAME || process.env.FUNCTION_TARGET);
69
+ }
70
+ /**
71
+ * This check only verifies that the environment is running knative.
72
+ * This must be run *after* checking for Kubernetes, otherwise it will
73
+ * return a false positive.
74
+ */
75
+ function isCloudRun() {
76
+ return !!process.env.K_CONFIGURATION;
77
+ }
78
+ async function isKubernetesEngine() {
79
+ try {
80
+ await gcpMetadata.instance('attributes/cluster-name');
81
+ return true;
82
+ }
83
+ catch (e) {
84
+ return false;
85
+ }
86
+ }
87
+ async function isComputeEngine() {
88
+ return gcpMetadata.isAvailable();
89
+ }
90
+ //# sourceMappingURL=envDetect.js.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/auth/identitypoolclient.d.ts ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { BaseExternalAccountClient, BaseExternalAccountClientOptions, ExternalAccountSupplierContext } from './baseexternalclient';
2
+ import { SnakeToCamelObject } from '../util';
3
+ export type SubjectTokenFormatType = 'json' | 'text';
4
+ export interface SubjectTokenJsonResponse {
5
+ [key: string]: string;
6
+ }
7
+ /**
8
+ * Supplier interface for subject tokens. This can be implemented to
9
+ * return a subject token which can then be exchanged for a GCP token by an
10
+ * {@link IdentityPoolClient}.
11
+ */
12
+ export interface SubjectTokenSupplier {
13
+ /**
14
+ * Gets a valid subject token for the requested external account identity.
15
+ * Note that these are not cached by the calling {@link IdentityPoolClient},
16
+ * so caching should be including in the implementation.
17
+ * @param context {@link ExternalAccountSupplierContext} from the calling
18
+ * {@link IdentityPoolClient}, contains the requested audience and subject token type
19
+ * for the external account identity as well as the transport from the
20
+ * calling client to use for requests.
21
+ * @return A promise that resolves with the requested subject token string.
22
+ */
23
+ getSubjectToken: (context: ExternalAccountSupplierContext) => Promise<string>;
24
+ }
25
+ /**
26
+ * Url-sourced/file-sourced credentials json interface.
27
+ * This is used for K8s and Azure workloads.
28
+ */
29
+ export interface IdentityPoolClientOptions extends BaseExternalAccountClientOptions {
30
+ /**
31
+ * Object containing options to retrieve identity pool credentials. A valid credential
32
+ * source or a subject token supplier must be specified.
33
+ */
34
+ credential_source?: {
35
+ /**
36
+ * The file location to read the subject token from. Either this, a URL
37
+ * or a certificate location should be specified.
38
+ */
39
+ file?: string;
40
+ /**
41
+ * The URL to call to retrieve the subject token. Either this, a file
42
+ * location or a certificate location should be specified.
43
+ */
44
+ url?: string;
45
+ /**
46
+ * Optional headers to send on the request to the specified URL.
47
+ */
48
+ headers?: {
49
+ [key: string]: string;
50
+ };
51
+ /**
52
+ * The format that the subject token is in the file or the URL response.
53
+ * If not provided, will default to reading the text string directly.
54
+ */
55
+ format?: {
56
+ /**
57
+ * The format type. Can either be 'text' or 'json'.
58
+ */
59
+ type: SubjectTokenFormatType;
60
+ /**
61
+ * The field name containing the subject token value if the type is 'json'.
62
+ */
63
+ subject_token_field_name?: string;
64
+ };
65
+ /**
66
+ * The certificate location to call to retrieve the subject token. Either this, a file
67
+ * location, or an url should be specified.
68
+ * @example
69
+ * File Format:
70
+ * ```json
71
+ * {
72
+ * "cert_configs": {
73
+ * "workload": {
74
+ * "key_path": "$PATH_TO_LEAF_KEY",
75
+ * "cert_path": "$PATH_TO_LEAF_CERT"
76
+ * }
77
+ * }
78
+ * }
79
+ * ```
80
+ */
81
+ certificate?: {
82
+ /**
83
+ * Specify whether the certificate config should be used from the default location.
84
+ * Either this or the certificate_config_location must be provided.
85
+ * The certificate config file must be in the following JSON format:
86
+ */
87
+ use_default_certificate_config?: boolean;
88
+ /**
89
+ * Location to fetch certificate config from in case default config is not to be used.
90
+ * Either this or use_default_certificate_config=true should be provided.
91
+ */
92
+ certificate_config_location?: string;
93
+ /**
94
+ * TrustChainPath specifies the path to a PEM-formatted file containing the X.509 certificate trust chain.
95
+ * The file should contain any intermediate certificates needed to connect
96
+ * the mTLS leaf certificate to a root certificate in the trust store.
97
+ */
98
+ trust_chain_path?: string;
99
+ };
100
+ };
101
+ /**
102
+ * The subject token supplier to call to retrieve the subject token to exchange
103
+ * for a GCP access token. Either this or a valid credential source should
104
+ * be specified.
105
+ */
106
+ subject_token_supplier?: SubjectTokenSupplier;
107
+ }
108
+ /**
109
+ * Defines the Url-sourced and file-sourced external account clients mainly
110
+ * used for K8s and Azure workloads.
111
+ */
112
+ export declare class IdentityPoolClient extends BaseExternalAccountClient {
113
+ private readonly subjectTokenSupplier;
114
+ /**
115
+ * Instantiate an IdentityPoolClient instance using the provided JSON
116
+ * object loaded from an external account credentials file.
117
+ * An error is thrown if the credential is not a valid file-sourced or
118
+ * url-sourced credential or a workforce pool user project is provided
119
+ * with a non workforce audience.
120
+ * @param options The external account options object typically loaded
121
+ * from the external account JSON credential file. The camelCased options
122
+ * are aliases for the snake_cased options.
123
+ */
124
+ constructor(options: IdentityPoolClientOptions | SnakeToCamelObject<IdentityPoolClientOptions>);
125
+ /**
126
+ * Triggered when a external subject token is needed to be exchanged for a GCP
127
+ * access token via GCP STS endpoint. Gets a subject token by calling
128
+ * the configured {@link SubjectTokenSupplier}
129
+ * @return A promise that resolves with the external subject token.
130
+ */
131
+ retrieveSubjectToken(): Promise<string>;
132
+ }
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/auth/loginticket.js ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ // Copyright 2014 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.LoginTicket = void 0;
17
+ class LoginTicket {
18
+ envelope;
19
+ payload;
20
+ /**
21
+ * Create a simple class to extract user ID from an ID Token
22
+ *
23
+ * @param {string} env Envelope of the jwt
24
+ * @param {TokenPayload} pay Payload of the jwt
25
+ * @constructor
26
+ */
27
+ constructor(env, pay) {
28
+ this.envelope = env;
29
+ this.payload = pay;
30
+ }
31
+ getEnvelope() {
32
+ return this.envelope;
33
+ }
34
+ getPayload() {
35
+ return this.payload;
36
+ }
37
+ /**
38
+ * Create a simple class to extract user ID from an ID Token
39
+ *
40
+ * @return The user ID
41
+ */
42
+ getUserId() {
43
+ const payload = this.getPayload();
44
+ if (payload && payload.sub) {
45
+ return payload.sub;
46
+ }
47
+ return null;
48
+ }
49
+ /**
50
+ * Returns attributes from the login ticket. This can contain
51
+ * various information about the user session.
52
+ *
53
+ * @return The envelope and payload
54
+ */
55
+ getAttributes() {
56
+ return { envelope: this.getEnvelope(), payload: this.getPayload() };
57
+ }
58
+ }
59
+ exports.LoginTicket = LoginTicket;
60
+ //# sourceMappingURL=loginticket.js.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/auth/pluggable-auth-client.d.ts ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { BaseExternalAccountClient, BaseExternalAccountClientOptions } from './baseexternalclient';
2
+ export { ExecutableError } from './pluggable-auth-handler';
3
+ /**
4
+ * Defines the credential source portion of the configuration for PluggableAuthClient.
5
+ *
6
+ * <p>Command is the only required field. If timeout_millis is not specified, the library will
7
+ * default to a 30-second timeout.
8
+ *
9
+ * <pre>
10
+ * Sample credential source for Pluggable Auth Client:
11
+ * {
12
+ * ...
13
+ * "credential_source": {
14
+ * "executable": {
15
+ * "command": "/path/to/get/credentials.sh --arg1=value1 --arg2=value2",
16
+ * "timeout_millis": 5000,
17
+ * "output_file": "/path/to/generated/cached/credentials"
18
+ * }
19
+ * }
20
+ * }
21
+ * </pre>
22
+ */
23
+ export interface PluggableAuthClientOptions extends BaseExternalAccountClientOptions {
24
+ credential_source: {
25
+ executable: {
26
+ /**
27
+ * The command used to retrieve the 3rd party token.
28
+ */
29
+ command: string;
30
+ /**
31
+ * The timeout for executable to run in milliseconds. If none is provided it
32
+ * will be set to the default timeout of 30 seconds.
33
+ */
34
+ timeout_millis?: number;
35
+ /**
36
+ * An optional output file location that will be checked for a cached response
37
+ * from a previous run of the executable.
38
+ */
39
+ output_file?: string;
40
+ };
41
+ };
42
+ }
43
+ /**
44
+ * PluggableAuthClient enables the exchange of workload identity pool external credentials for
45
+ * Google access tokens by retrieving 3rd party tokens through a user supplied executable. These
46
+ * scripts/executables are completely independent of the Google Cloud Auth libraries. These
47
+ * credentials plug into ADC and will call the specified executable to retrieve the 3rd party token
48
+ * to be exchanged for a Google access token.
49
+ *
50
+ * <p>To use these credentials, the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment variable
51
+ * must be set to '1'. This is for security reasons.
52
+ *
53
+ * <p>Both OIDC and SAML are supported. The executable must adhere to a specific response format
54
+ * defined below.
55
+ *
56
+ * <p>The executable must print out the 3rd party token to STDOUT in JSON format. When an
57
+ * output_file is specified in the credential configuration, the executable must also handle writing the
58
+ * JSON response to this file.
59
+ *
60
+ * <pre>
61
+ * OIDC response sample:
62
+ * {
63
+ * "version": 1,
64
+ * "success": true,
65
+ * "token_type": "urn:ietf:params:oauth:token-type:id_token",
66
+ * "id_token": "HEADER.PAYLOAD.SIGNATURE",
67
+ * "expiration_time": 1620433341
68
+ * }
69
+ *
70
+ * SAML2 response sample:
71
+ * {
72
+ * "version": 1,
73
+ * "success": true,
74
+ * "token_type": "urn:ietf:params:oauth:token-type:saml2",
75
+ * "saml_response": "...",
76
+ * "expiration_time": 1620433341
77
+ * }
78
+ *
79
+ * Error response sample:
80
+ * {
81
+ * "version": 1,
82
+ * "success": false,
83
+ * "code": "401",
84
+ * "message": "Error message."
85
+ * }
86
+ * </pre>
87
+ *
88
+ * <p>The "expiration_time" field in the JSON response is only required for successful
89
+ * responses when an output file was specified in the credential configuration
90
+ *
91
+ * <p>The auth libraries will populate certain environment variables that will be accessible by the
92
+ * executable, such as: GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE, GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE,
93
+ * GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE, GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL, and
94
+ * GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE.
95
+ *
96
+ * <p>Please see this repositories README for a complete executable request/response specification.
97
+ */
98
+ export declare class PluggableAuthClient extends BaseExternalAccountClient {
99
+ /**
100
+ * The command used to retrieve the third party token.
101
+ */
102
+ private readonly command;
103
+ /**
104
+ * The timeout in milliseconds for running executable,
105
+ * set to default if none provided.
106
+ */
107
+ private readonly timeoutMillis;
108
+ /**
109
+ * The path to file to check for cached executable response.
110
+ */
111
+ private readonly outputFile?;
112
+ /**
113
+ * Executable and output file handler.
114
+ */
115
+ private readonly handler;
116
+ /**
117
+ * Instantiates a PluggableAuthClient instance using the provided JSON
118
+ * object loaded from an external account credentials file.
119
+ * An error is thrown if the credential is not a valid pluggable auth credential.
120
+ * @param options The external account options object typically loaded from
121
+ * the external account JSON credential file.
122
+ */
123
+ constructor(options: PluggableAuthClientOptions);
124
+ /**
125
+ * Triggered when an external subject token is needed to be exchanged for a
126
+ * GCP access token via GCP STS endpoint.
127
+ * This uses the `options.credential_source` object to figure out how
128
+ * to retrieve the token using the current environment. In this case,
129
+ * this calls a user provided executable which returns the subject token.
130
+ * The logic is summarized as:
131
+ * 1. Validated that the executable is allowed to run. The
132
+ * GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment must be set to
133
+ * 1 for security reasons.
134
+ * 2. If an output file is specified by the user, check the file location
135
+ * for a response. If the file exists and contains a valid response,
136
+ * return the subject token from the file.
137
+ * 3. Call the provided executable and return response.
138
+ * @return A promise that resolves with the external subject token.
139
+ */
140
+ retrieveSubjectToken(): Promise<string>;
141
+ }
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/crypto/crypto.js ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ // Copyright 2019 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ /* global window */
16
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ var desc = Object.getOwnPropertyDescriptor(m, k);
19
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
20
+ desc = { enumerable: true, get: function() { return m[k]; } };
21
+ }
22
+ Object.defineProperty(o, k2, desc);
23
+ }) : (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ o[k2] = m[k];
26
+ }));
27
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
28
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.createCrypto = createCrypto;
32
+ exports.hasBrowserCrypto = hasBrowserCrypto;
33
+ const crypto_1 = require("./browser/crypto");
34
+ const crypto_2 = require("./node/crypto");
35
+ __exportStar(require("./shared"), exports);
36
+ // Crypto interface will provide required crypto functions.
37
+ // Use `createCrypto()` factory function to create an instance
38
+ // of Crypto. It will either use Node.js `crypto` module, or
39
+ // use browser's SubtleCrypto interface. Since most of the
40
+ // SubtleCrypto methods return promises, we must make those
41
+ // methods return promises here as well, even though in Node.js
42
+ // they are synchronous.
43
+ function createCrypto() {
44
+ if (hasBrowserCrypto()) {
45
+ return new crypto_1.BrowserCrypto();
46
+ }
47
+ return new crypto_2.NodeCrypto();
48
+ }
49
+ function hasBrowserCrypto() {
50
+ return (typeof window !== 'undefined' &&
51
+ typeof window.crypto !== 'undefined' &&
52
+ typeof window.crypto.subtle !== 'undefined');
53
+ }
54
+ //# sourceMappingURL=crypto.js.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/crypto/node/crypto.d.ts ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Crypto } from '../shared';
2
+ export declare class NodeCrypto implements Crypto {
3
+ sha256DigestBase64(str: string): Promise<string>;
4
+ randomBytesBase64(count: number): string;
5
+ verify(pubkey: string, data: string | Buffer, signature: string): Promise<boolean>;
6
+ sign(privateKey: string, data: string | Buffer): Promise<string>;
7
+ decodeBase64StringUtf8(base64: string): string;
8
+ encodeBase64StringUtf8(text: string): string;
9
+ /**
10
+ * Computes the SHA-256 hash of the provided string.
11
+ * @param str The plain text string to hash.
12
+ * @return A promise that resolves with the SHA-256 hash of the provided
13
+ * string in hexadecimal encoding.
14
+ */
15
+ sha256DigestHex(str: string): Promise<string>;
16
+ /**
17
+ * Computes the HMAC hash of a message using the provided crypto key and the
18
+ * SHA-256 algorithm.
19
+ * @param key The secret crypto key in utf-8 or ArrayBuffer format.
20
+ * @param msg The plain text message.
21
+ * @return A promise that resolves with the HMAC-SHA256 hash in ArrayBuffer
22
+ * format.
23
+ */
24
+ signWithHmacSha256(key: string | ArrayBuffer, msg: string): Promise<ArrayBuffer>;
25
+ }
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-auth-library/build/src/crypto/shared.js ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ // Copyright 2025 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.fromArrayBufferToHex = fromArrayBufferToHex;
17
+ /**
18
+ * Converts an ArrayBuffer to a hexadecimal string.
19
+ * @param arrayBuffer The ArrayBuffer to convert to hexadecimal string.
20
+ * @return The hexadecimal encoding of the ArrayBuffer.
21
+ */
22
+ function fromArrayBufferToHex(arrayBuffer) {
23
+ // Convert buffer to byte array.
24
+ const byteArray = Array.from(new Uint8Array(arrayBuffer));
25
+ // Convert bytes to hex string.
26
+ return byteArray
27
+ .map(byte => {
28
+ return byte.toString(16).padStart(2, '0');
29
+ })
30
+ .join('');
31
+ }
32
+ //# sourceMappingURL=shared.js.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-logging-utils/build/src/logging-utils.js ADDED
@@ -0,0 +1,437 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ // Copyright 2021-2024 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.env = exports.DebugLogBackendBase = exports.placeholder = exports.AdhocDebugLogger = exports.LogSeverity = void 0;
50
+ exports.getNodeBackend = getNodeBackend;
51
+ exports.getDebugBackend = getDebugBackend;
52
+ exports.getStructuredBackend = getStructuredBackend;
53
+ exports.setBackend = setBackend;
54
+ exports.log = log;
55
+ const events_1 = require("events");
56
+ const process = __importStar(require("process"));
57
+ const util = __importStar(require("util"));
58
+ const colours_1 = require("./colours");
59
+ // Some functions (as noted) are based on the Node standard library, from
60
+ // the following file:
61
+ //
62
+ // https://github.com/nodejs/node/blob/main/lib/internal/util/debuglog.js
63
+ /**
64
+ * This module defines an ad-hoc debug logger for Google Cloud Platform
65
+ * client libraries in Node. An ad-hoc debug logger is a tool which lets
66
+ * users use an external, unified interface (in this case, environment
67
+ * variables) to determine what logging they want to see at runtime. This
68
+ * isn't necessarily fed into the console, but is meant to be under the
69
+ * control of the user. The kind of logging that will be produced by this
70
+ * is more like "call retry happened", not "events you'd want to record
71
+ * in Cloud Logger".
72
+ *
73
+ * More for Googlers implementing libraries with it:
74
+ * go/cloud-client-logging-design
75
+ */
76
+ /**
77
+ * Possible log levels. These are a subset of Cloud Observability levels.
78
+ * https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#LogSeverity
79
+ */
80
+ var LogSeverity;
81
+ (function (LogSeverity) {
82
+ LogSeverity["DEFAULT"] = "DEFAULT";
83
+ LogSeverity["DEBUG"] = "DEBUG";
84
+ LogSeverity["INFO"] = "INFO";
85
+ LogSeverity["WARNING"] = "WARNING";
86
+ LogSeverity["ERROR"] = "ERROR";
87
+ })(LogSeverity || (exports.LogSeverity = LogSeverity = {}));
88
+ /**
89
+ * Our logger instance. This actually contains the meat of dealing
90
+ * with log lines, including EventEmitter. This contains the function
91
+ * that will be passed back to users of the package.
92
+ */
93
+ class AdhocDebugLogger extends events_1.EventEmitter {
94
+ /**
95
+ * @param upstream The backend will pass a function that will be
96
+ * called whenever our logger function is invoked.
97
+ */
98
+ constructor(namespace, upstream) {
99
+ super();
100
+ this.namespace = namespace;
101
+ this.upstream = upstream;
102
+ this.func = Object.assign(this.invoke.bind(this), {
103
+ // Also add an instance pointer back to us.
104
+ instance: this,
105
+ // And pull over the EventEmitter functionality.
106
+ on: (event, listener) => this.on(event, listener),
107
+ });
108
+ // Convenience methods for log levels.
109
+ this.func.debug = (...args) => this.invokeSeverity(LogSeverity.DEBUG, ...args);
110
+ this.func.info = (...args) => this.invokeSeverity(LogSeverity.INFO, ...args);
111
+ this.func.warn = (...args) => this.invokeSeverity(LogSeverity.WARNING, ...args);
112
+ this.func.error = (...args) => this.invokeSeverity(LogSeverity.ERROR, ...args);
113
+ this.func.sublog = (namespace) => log(namespace, this.func);
114
+ }
115
+ invoke(fields, ...args) {
116
+ // Push out any upstream logger first.
117
+ if (this.upstream) {
118
+ try {
119
+ this.upstream(fields, ...args);
120
+ }
121
+ catch (e) {
122
+ // Swallow exceptions to avoid interfering with other logging.
123
+ }
124
+ }
125
+ // Emit sink events.
126
+ try {
127
+ this.emit('log', fields, args);
128
+ }
129
+ catch (e) {
130
+ // Swallow exceptions to avoid interfering with other logging.
131
+ }
132
+ }
133
+ invokeSeverity(severity, ...args) {
134
+ this.invoke({ severity }, ...args);
135
+ }
136
+ }
137
+ exports.AdhocDebugLogger = AdhocDebugLogger;
138
+ /**
139
+ * This can be used in place of a real logger while waiting for Promises or disabling logging.
140
+ */
141
+ exports.placeholder = new AdhocDebugLogger('', () => { }).func;
142
+ /**
143
+ * The base class for debug logging backends. It's possible to use this, but the
144
+ * same non-guarantees above still apply (unstable interface, etc).
145
+ *
146
+ * @private
147
+ * @internal
148
+ */
149
+ class DebugLogBackendBase {
150
+ constructor() {
151
+ var _a;
152
+ this.cached = new Map();
153
+ this.filters = [];
154
+ this.filtersSet = false;
155
+ // Look for the Node config variable for what systems to enable. We'll store
156
+ // these for the log method below, which will call setFilters() once.
157
+ let nodeFlag = (_a = process.env[exports.env.nodeEnables]) !== null && _a !== void 0 ? _a : '*';
158
+ if (nodeFlag === 'all') {
159
+ nodeFlag = '*';
160
+ }
161
+ this.filters = nodeFlag.split(',');
162
+ }
163
+ log(namespace, fields, ...args) {
164
+ try {
165
+ if (!this.filtersSet) {
166
+ this.setFilters();
167
+ this.filtersSet = true;
168
+ }
169
+ let logger = this.cached.get(namespace);
170
+ if (!logger) {
171
+ logger = this.makeLogger(namespace);
172
+ this.cached.set(namespace, logger);
173
+ }
174
+ logger(fields, ...args);
175
+ }
176
+ catch (e) {
177
+ // Silently ignore all errors; we don't want them to interfere with
178
+ // the user's running app.
179
+ // e;
180
+ console.error(e);
181
+ }
182
+ }
183
+ }
184
+ exports.DebugLogBackendBase = DebugLogBackendBase;
185
+ // The basic backend. This one definitely works, but it's less feature-filled.
186
+ //
187
+ // Rather than using util.debuglog, this implements the same basic logic directly.
188
+ // The reason for this decision is that debuglog checks the value of the
189
+ // NODE_DEBUG environment variable before any user code runs; we therefore
190
+ // can't pipe our own enables into it (and util.debuglog will never print unless
191
+ // the user duplicates it into NODE_DEBUG, which isn't reasonable).
192
+ //
193
+ class NodeBackend extends DebugLogBackendBase {
194
+ constructor() {
195
+ super(...arguments);
196
+ // Default to allowing all systems, since we gate earlier based on whether the
197
+ // variable is empty.
198
+ this.enabledRegexp = /.*/g;
199
+ }
200
+ isEnabled(namespace) {
201
+ return this.enabledRegexp.test(namespace);
202
+ }
203
+ makeLogger(namespace) {
204
+ if (!this.enabledRegexp.test(namespace)) {
205
+ return () => { };
206
+ }
207
+ return (fields, ...args) => {
208
+ var _a;
209
+ // TODO: `fields` needs to be turned into a string here, one way or another.
210
+ const nscolour = `${colours_1.Colours.green}${namespace}${colours_1.Colours.reset}`;
211
+ const pid = `${colours_1.Colours.yellow}${process.pid}${colours_1.Colours.reset}`;
212
+ let level;
213
+ switch (fields.severity) {
214
+ case LogSeverity.ERROR:
215
+ level = `${colours_1.Colours.red}${fields.severity}${colours_1.Colours.reset}`;
216
+ break;
217
+ case LogSeverity.INFO:
218
+ level = `${colours_1.Colours.magenta}${fields.severity}${colours_1.Colours.reset}`;
219
+ break;
220
+ case LogSeverity.WARNING:
221
+ level = `${colours_1.Colours.yellow}${fields.severity}${colours_1.Colours.reset}`;
222
+ break;
223
+ default:
224
+ level = (_a = fields.severity) !== null && _a !== void 0 ? _a : LogSeverity.DEFAULT;
225
+ break;
226
+ }
227
+ const msg = util.formatWithOptions({ colors: colours_1.Colours.enabled }, ...args);
228
+ const filteredFields = Object.assign({}, fields);
229
+ delete filteredFields.severity;
230
+ const fieldsJson = Object.getOwnPropertyNames(filteredFields).length
231
+ ? JSON.stringify(filteredFields)
232
+ : '';
233
+ const fieldsColour = fieldsJson
234
+ ? `${colours_1.Colours.grey}${fieldsJson}${colours_1.Colours.reset}`
235
+ : '';
236
+ console.error('%s [%s|%s] %s%s', pid, nscolour, level, msg, fieldsJson ? ` ${fieldsColour}` : '');
237
+ };
238
+ }
239
+ // Regexp patterns below are from here:
240
+ // https://github.com/nodejs/node/blob/c0aebed4b3395bd65d54b18d1fd00f071002ac20/lib/internal/util/debuglog.js#L36
241
+ setFilters() {
242
+ const totalFilters = this.filters.join(',');
243
+ const regexp = totalFilters
244
+ .replace(/[|\\{}()[\]^$+?.]/g, '\\$&')
245
+ .replace(/\*/g, '.*')
246
+ .replace(/,/g, '$|^');
247
+ this.enabledRegexp = new RegExp(`^${regexp}$`, 'i');
248
+ }
249
+ }
250
+ /**
251
+ * @returns A backend based on Node util.debuglog; this is the default.
252
+ */
253
+ function getNodeBackend() {
254
+ return new NodeBackend();
255
+ }
256
+ class DebugBackend extends DebugLogBackendBase {
257
+ constructor(pkg) {
258
+ super();
259
+ this.debugPkg = pkg;
260
+ }
261
+ makeLogger(namespace) {
262
+ const debugLogger = this.debugPkg(namespace);
263
+ return (fields, ...args) => {
264
+ // TODO: `fields` needs to be turned into a string here.
265
+ debugLogger(args[0], ...args.slice(1));
266
+ };
267
+ }
268
+ setFilters() {
269
+ var _a;
270
+ const existingFilters = (_a = process.env['NODE_DEBUG']) !== null && _a !== void 0 ? _a : '';
271
+ process.env['NODE_DEBUG'] = `${existingFilters}${existingFilters ? ',' : ''}${this.filters.join(',')}`;
272
+ }
273
+ }
274
+ /**
275
+ * Creates a "debug" package backend. The user must call require('debug') and pass
276
+ * the resulting object to this function.
277
+ *
278
+ * ```
279
+ * setBackend(getDebugBackend(require('debug')))
280
+ * ```
281
+ *
282
+ * https://www.npmjs.com/package/debug
283
+ *
284
+ * Note: Google does not explicitly endorse or recommend this package; it's just
285
+ * being provided as an option.
286
+ *
287
+ * @returns A backend based on the npm "debug" package.
288
+ */
289
+ function getDebugBackend(debugPkg) {
290
+ return new DebugBackend(debugPkg);
291
+ }
292
+ /**
293
+ * This pretty much works like the Node logger, but it outputs structured
294
+ * logging JSON matching Google Cloud's ingestion specs. Rather than handling
295
+ * its own output, it wraps another backend. The passed backend must be a subclass
296
+ * of `DebugLogBackendBase` (any of the backends exposed by this package will work).
297
+ */
298
+ class StructuredBackend extends DebugLogBackendBase {
299
+ constructor(upstream) {
300
+ var _a;
301
+ super();
302
+ this.upstream = (_a = upstream) !== null && _a !== void 0 ? _a : undefined;
303
+ }
304
+ makeLogger(namespace) {
305
+ var _a;
306
+ const debugLogger = (_a = this.upstream) === null || _a === void 0 ? void 0 : _a.makeLogger(namespace);
307
+ return (fields, ...args) => {
308
+ var _a;
309
+ const severity = (_a = fields.severity) !== null && _a !== void 0 ? _a : LogSeverity.INFO;
310
+ const json = Object.assign({
311
+ severity,
312
+ message: util.format(...args),
313
+ }, fields);
314
+ const jsonString = JSON.stringify(json);
315
+ if (debugLogger) {
316
+ debugLogger(fields, jsonString);
317
+ }
318
+ else {
319
+ console.log('%s', jsonString);
320
+ }
321
+ };
322
+ }
323
+ setFilters() {
324
+ var _a;
325
+ (_a = this.upstream) === null || _a === void 0 ? void 0 : _a.setFilters();
326
+ }
327
+ }
328
+ /**
329
+ * Creates a "structured logging" backend. This pretty much works like the
330
+ * Node logger, but it outputs structured logging JSON matching Google
331
+ * Cloud's ingestion specs instead of plain text.
332
+ *
333
+ * ```
334
+ * setBackend(getStructuredBackend())
335
+ * ```
336
+ *
337
+ * @param upstream If you want to use something besides the Node backend to
338
+ * write the actual log lines into, pass that here.
339
+ * @returns A backend based on Google Cloud structured logging.
340
+ */
341
+ function getStructuredBackend(upstream) {
342
+ return new StructuredBackend(upstream);
343
+ }
344
+ /**
345
+ * The environment variables that we standardized on, for all ad-hoc logging.
346
+ */
347
+ exports.env = {
348
+ /**
349
+ * Filter wildcards specific to the Node syntax, and similar to the built-in
350
+ * utils.debuglog() environment variable. If missing, disables logging.
351
+ */
352
+ nodeEnables: 'GOOGLE_SDK_NODE_LOGGING',
353
+ };
354
+ // Keep a copy of all namespaced loggers so users can reliably .on() them.
355
+ // Note that these cached functions will need to deal with changes in the backend.
356
+ const loggerCache = new Map();
357
+ // Our current global backend. This might be:
358
+ let cachedBackend = undefined;
359
+ /**
360
+ * Set the backend to use for our log output.
361
+ * - A backend object
362
+ * - null to disable logging
363
+ * - undefined for "nothing yet", defaults to the Node backend
364
+ *
365
+ * @param backend Results from one of the get*Backend() functions.
366
+ */
367
+ function setBackend(backend) {
368
+ cachedBackend = backend;
369
+ loggerCache.clear();
370
+ }
371
+ /**
372
+ * Creates a logging function. Multiple calls to this with the same namespace
373
+ * will produce the same logger, with the same event emitter hooks.
374
+ *
375
+ * Namespaces can be a simple string ("system" name), or a qualified string
376
+ * (system:subsystem), which can be used for filtering, or for "system:*".
377
+ *
378
+ * @param namespace The namespace, a descriptive text string.
379
+ * @returns A function you can call that works similar to console.log().
380
+ */
381
+ function log(namespace, parent) {
382
+ // If the enable environment variable isn't set, do nothing. The user
383
+ // can still choose to set a backend of their choice using the manual
384
+ // `setBackend()`.
385
+ if (!cachedBackend) {
386
+ const enablesFlag = process.env[exports.env.nodeEnables];
387
+ if (!enablesFlag) {
388
+ return exports.placeholder;
389
+ }
390
+ }
391
+ // This might happen mostly if the typings are dropped in a user's code,
392
+ // or if they're calling from JavaScript.
393
+ if (!namespace) {
394
+ return exports.placeholder;
395
+ }
396
+ // Handle sub-loggers.
397
+ if (parent) {
398
+ namespace = `${parent.instance.namespace}:${namespace}`;
399
+ }
400
+ // Reuse loggers so things like event sinks are persistent.
401
+ const existing = loggerCache.get(namespace);
402
+ if (existing) {
403
+ return existing.func;
404
+ }
405
+ // Do we have a backend yet?
406
+ if (cachedBackend === null) {
407
+ // Explicitly disabled.
408
+ return exports.placeholder;
409
+ }
410
+ else if (cachedBackend === undefined) {
411
+ // One hasn't been made yet, so default to Node.
412
+ cachedBackend = getNodeBackend();
413
+ }
414
+ // The logger is further wrapped so we can handle the backend changing out.
415
+ const logger = (() => {
416
+ let previousBackend = undefined;
417
+ const newLogger = new AdhocDebugLogger(namespace, (fields, ...args) => {
418
+ if (previousBackend !== cachedBackend) {
419
+ // Did the user pass a custom backend?
420
+ if (cachedBackend === null) {
421
+ // Explicitly disabled.
422
+ return;
423
+ }
424
+ else if (cachedBackend === undefined) {
425
+ // One hasn't been made yet, so default to Node.
426
+ cachedBackend = getNodeBackend();
427
+ }
428
+ previousBackend = cachedBackend;
429
+ }
430
+ cachedBackend === null || cachedBackend === void 0 ? void 0 : cachedBackend.log(namespace, fields, ...args);
431
+ });
432
+ return newLogger;
433
+ })();
434
+ loggerCache.set(namespace, logger);
435
+ return logger.func;
436
+ }
437
+ //# sourceMappingURL=logging-utils.js.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/google-logging-utils/build/src/temporal.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"temporal.js","sourceRoot":"","sources":["../../src/temporal.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AA6BjC;;;;;;;;;;GAUG;AACH,MAAa,QAAQ;IAOnB,YAAoB,MAAc;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,OAAoB;QAC1B,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,MAAM;gBACT,OAAO,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC;YAC7C,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC;YAC/C,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC;YAC/C,KAAK,aAAa;gBAChB,OAAO,IAAI,CAAC,MAAM,CAAC;YACrB;gBACE,MAAM,IAAI,KAAK,CAAC,sCAAsC,OAAO,EAAE,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,YAA0B;;QACpC,IA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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GoogleToken = void 0;
7
+ var fs = _interopRequireWildcard(require("fs"));
8
+ var _gaxios = require("gaxios");
9
+ var jws = _interopRequireWildcard(require("jws"));
10
+ var path = _interopRequireWildcard(require("path"));
11
+ var _util = require("util");
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t3 in e) "default" !== _t3 && {}.hasOwnProperty.call(e, _t3) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t3)) && (i.get || i.set) ? o(f, _t3, i) : f[_t3] = e[_t3]); return f; })(e, t); }
13
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
14
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
15
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
16
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
17
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
18
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
19
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
20
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
21
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
22
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
23
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
24
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
25
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
26
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
27
+ function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }
28
+ function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
29
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
30
+ function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } }
31
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
32
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
33
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
34
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
35
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
36
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
37
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
38
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
39
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } /**
40
+ * Copyright 2018 Google LLC
41
+ *
42
+ * Distributed under MIT license.
43
+ * See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
44
+ */
45
+ var readFile = fs.readFile ? (0, _util.promisify)(fs.readFile) : /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
46
+ return _regenerator().w(function (_context) {
47
+ while (1) switch (_context.n) {
48
+ case 0:
49
+ throw new ErrorWithCode('use key rather than keyFile.', 'MISSING_CREDENTIALS');
50
+ case 1:
51
+ return _context.a(2);
52
+ }
53
+ }, _callee);
54
+ }));
55
+ var GOOGLE_TOKEN_URL = 'https://oauth2.googleapis.com/token';
56
+ var GOOGLE_REVOKE_TOKEN_URL = 'https://oauth2.googleapis.com/revoke?token=';
57
+ var ErrorWithCode = /*#__PURE__*/function (_Error) {
58
+ function ErrorWithCode(message, code) {
59
+ var _this;
60
+ _classCallCheck(this, ErrorWithCode);
61
+ _this = _callSuper(this, ErrorWithCode, [message]);
62
+ _defineProperty(_this, "code", void 0);
63
+ _this.code = code;
64
+ return _this;
65
+ }
66
+ _inherits(ErrorWithCode, _Error);
67
+ return _createClass(ErrorWithCode);
68
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
69
+ var _inFlightRequest = /*#__PURE__*/new WeakMap();
70
+ var _GoogleToken_brand = /*#__PURE__*/new WeakSet();
71
+ var GoogleToken = exports.GoogleToken = /*#__PURE__*/function () {
72
+ /**
73
+ * Create a GoogleToken.
74
+ *
75
+ * @param options Configuration object.
76
+ */
77
+ function GoogleToken(_options) {
78
+ _classCallCheck(this, GoogleToken);
79
+ _classPrivateMethodInitSpec(this, _GoogleToken_brand);
80
+ _defineProperty(this, "expiresAt", void 0);
81
+ _defineProperty(this, "key", void 0);
82
+ _defineProperty(this, "keyFile", void 0);
83
+ _defineProperty(this, "iss", void 0);
84
+ _defineProperty(this, "sub", void 0);
85
+ _defineProperty(this, "scope", void 0);
86
+ _defineProperty(this, "rawToken", void 0);
87
+ _defineProperty(this, "tokenExpires", void 0);
88
+ _defineProperty(this, "email", void 0);
89
+ _defineProperty(this, "additionalClaims", void 0);
90
+ _defineProperty(this, "eagerRefreshThresholdMillis", void 0);
91
+ _defineProperty(this, "transporter", {
92
+ request: function request(opts) {
93
+ return (0, _gaxios.request)(opts);
94
+ }
95
+ });
96
+ _classPrivateFieldInitSpec(this, _inFlightRequest, void 0);
97
+ _assertClassBrand(_GoogleToken_brand, this, _configure).call(this, _options);
98
+ }
99
+
100
+ /**
101
+ * Returns whether the token has expired.
102
+ *
103
+ * @return true if the token has expired, false otherwise.
104
+ */
105
+ return _createClass(GoogleToken, [{
106
+ key: "accessToken",
107
+ get: function get() {
108
+ return this.rawToken ? this.rawToken.access_token : undefined;
109
+ }
110
+ }, {
111
+ key: "idToken",
112
+ get: function get() {
113
+ return this.rawToken ? this.rawToken.id_token : undefined;
114
+ }
115
+ }, {
116
+ key: "tokenType",
117
+ get: function get() {
118
+ return this.rawToken ? this.rawToken.token_type : undefined;
119
+ }
120
+ }, {
121
+ key: "refreshToken",
122
+ get: function get() {
123
+ return this.rawToken ? this.rawToken.refresh_token : undefined;
124
+ }
125
+ }, {
126
+ key: "hasExpired",
127
+ value: function hasExpired() {
128
+ var now = new Date().getTime();
129
+ if (this.rawToken && this.expiresAt) {
130
+ return now >= this.expiresAt;
131
+ } else {
132
+ return true;
133
+ }
134
+ }
135
+
136
+ /**
137
+ * Returns whether the token will expire within eagerRefreshThresholdMillis
138
+ *
139
+ * @return true if the token will be expired within eagerRefreshThresholdMillis, false otherwise.
140
+ */
141
+ }, {
142
+ key: "isTokenExpiring",
143
+ value: function isTokenExpiring() {
144
+ var _this$eagerRefreshThr;
145
+ var now = new Date().getTime();
146
+ var eagerRefreshThresholdMillis = (_this$eagerRefreshThr = this.eagerRefreshThresholdMillis) !== null && _this$eagerRefreshThr !== void 0 ? _this$eagerRefreshThr : 0;
147
+ if (this.rawToken && this.expiresAt) {
148
+ return this.expiresAt <= now + eagerRefreshThresholdMillis;
149
+ } else {
150
+ return true;
151
+ }
152
+ }
153
+
154
+ /**
155
+ * Returns a cached token or retrieves a new one from Google.
156
+ *
157
+ * @param callback The callback function.
158
+ */
159
+ }, {
160
+ key: "getToken",
161
+ value: function getToken(callback) {
162
+ var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
163
+ if (_typeof(callback) === 'object') {
164
+ opts = callback;
165
+ callback = undefined;
166
+ }
167
+ opts = Object.assign({
168
+ forceRefresh: false
169
+ }, opts);
170
+ if (callback) {
171
+ var cb = callback;
172
+ _assertClassBrand(_GoogleToken_brand, this, _getTokenAsync).call(this, opts).then(function (t) {
173
+ return cb(null, t);
174
+ }, callback);
175
+ return;
176
+ }
177
+ return _assertClassBrand(_GoogleToken_brand, this, _getTokenAsync).call(this, opts);
178
+ }
179
+
180
+ /**
181
+ * Given a keyFile, extract the key and client email if available
182
+ * @param keyFile Path to a json, pem, or p12 file that contains the key.
183
+ * @returns an object with privateKey and clientEmail properties
184
+ */
185
+ }, {
186
+ key: "getCredentials",
187
+ value: (function () {
188
+ var _getCredentials = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(keyFile) {
189
+ var ext, key, body, privateKey, clientEmail, _privateKey, _t;
190
+ return _regenerator().w(function (_context2) {
191
+ while (1) switch (_context2.n) {
192
+ case 0:
193
+ ext = path.extname(keyFile);
194
+ _t = ext;
195
+ _context2.n = _t === '.json' ? 1 : _t === '.der' ? 4 : _t === '.crt' ? 4 : _t === '.pem' ? 4 : _t === '.p12' ? 6 : _t === '.pfx' ? 6 : 7;
196
+ break;
197
+ case 1:
198
+ _context2.n = 2;
199
+ return readFile(keyFile, 'utf8');
200
+ case 2:
201
+ key = _context2.v;
202
+ body = JSON.parse(key);
203
+ privateKey = body.private_key;
204
+ clientEmail = body.client_email;
205
+ if (!(!privateKey || !clientEmail)) {
206
+ _context2.n = 3;
207
+ break;
208
+ }
209
+ throw new ErrorWithCode('private_key and client_email are required.', 'MISSING_CREDENTIALS');
210
+ case 3:
211
+ return _context2.a(2, {
212
+ privateKey: privateKey,
213
+ clientEmail: clientEmail
214
+ });
215
+ case 4:
216
+ _context2.n = 5;
217
+ return readFile(keyFile, 'utf8');
218
+ case 5:
219
+ _privateKey = _context2.v;
220
+ return _context2.a(2, {
221
+ privateKey: _privateKey
222
+ });
223
+ case 6:
224
+ throw new ErrorWithCode('*.p12 certificates are not supported after v6.1.2. ' + 'Consider utilizing *.json format or converting *.p12 to *.pem using the OpenSSL CLI.', 'UNKNOWN_CERTIFICATE_TYPE');
225
+ case 7:
226
+ throw new ErrorWithCode('Unknown certificate type. Type is determined based on file extension. ' + 'Current supported extensions are *.json, and *.pem.', 'UNKNOWN_CERTIFICATE_TYPE');
227
+ case 8:
228
+ return _context2.a(2);
229
+ }
230
+ }, _callee2);
231
+ }));
232
+ function getCredentials(_x) {
233
+ return _getCredentials.apply(this, arguments);
234
+ }
235
+ return getCredentials;
236
+ }())
237
+ }, {
238
+ key: "revokeToken",
239
+ value: function revokeToken(callback) {
240
+ if (callback) {
241
+ _assertClassBrand(_GoogleToken_brand, this, _revokeTokenAsync).call(this).then(function () {
242
+ return callback();
243
+ }, callback);
244
+ return;
245
+ }
246
+ return _assertClassBrand(_GoogleToken_brand, this, _revokeTokenAsync).call(this);
247
+ }
248
+ }]);
249
+ }();
250
+ function _getTokenAsync(_x2) {
251
+ return _getTokenAsync2.apply(this, arguments);
252
+ }
253
+ function _getTokenAsync2() {
254
+ _getTokenAsync2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(opts) {
255
+ return _regenerator().w(function (_context3) {
256
+ while (1) switch (_context3.n) {
257
+ case 0:
258
+ if (!(_classPrivateFieldGet(_inFlightRequest, this) && !opts.forceRefresh)) {
259
+ _context3.n = 1;
260
+ break;
261
+ }
262
+ return _context3.a(2, _classPrivateFieldGet(_inFlightRequest, this));
263
+ case 1:
264
+ _context3.p = 1;
265
+ _context3.n = 2;
266
+ return _classPrivateFieldSet(_inFlightRequest, this, _assertClassBrand(_GoogleToken_brand, this, _getTokenAsyncInner).call(this, opts));
267
+ case 2:
268
+ return _context3.a(2, _context3.v);
269
+ case 3:
270
+ _context3.p = 3;
271
+ _classPrivateFieldSet(_inFlightRequest, this, undefined);
272
+ return _context3.f(3);
273
+ case 4:
274
+ return _context3.a(2);
275
+ }
276
+ }, _callee3, this, [[1,, 3, 4]]);
277
+ }));
278
+ return _getTokenAsync2.apply(this, arguments);
279
+ }
280
+ function _getTokenAsyncInner(_x3) {
281
+ return _getTokenAsyncInner2.apply(this, arguments);
282
+ }
283
+ function _getTokenAsyncInner2() {
284
+ _getTokenAsyncInner2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(opts) {
285
+ var creds;
286
+ return _regenerator().w(function (_context4) {
287
+ while (1) switch (_context4.n) {
288
+ case 0:
289
+ if (!(this.isTokenExpiring() === false && opts.forceRefresh === false)) {
290
+ _context4.n = 1;
291
+ break;
292
+ }
293
+ return _context4.a(2, Promise.resolve(this.rawToken));
294
+ case 1:
295
+ if (!(!this.key && !this.keyFile)) {
296
+ _context4.n = 2;
297
+ break;
298
+ }
299
+ throw new Error('No key or keyFile set.');
300
+ case 2:
301
+ if (!(!this.key && this.keyFile)) {
302
+ _context4.n = 4;
303
+ break;
304
+ }
305
+ _context4.n = 3;
306
+ return this.getCredentials(this.keyFile);
307
+ case 3:
308
+ creds = _context4.v;
309
+ this.key = creds.privateKey;
310
+ this.iss = creds.clientEmail || this.iss;
311
+ if (!creds.clientEmail) {
312
+ _assertClassBrand(_GoogleToken_brand, this, _ensureEmail).call(this);
313
+ }
314
+ case 4:
315
+ return _context4.a(2, _assertClassBrand(_GoogleToken_brand, this, _requestToken).call(this));
316
+ }
317
+ }, _callee4, this);
318
+ }));
319
+ return _getTokenAsyncInner2.apply(this, arguments);
320
+ }
321
+ function _ensureEmail() {
322
+ if (!this.iss) {
323
+ throw new ErrorWithCode('email is required.', 'MISSING_CREDENTIALS');
324
+ }
325
+ }
326
+ function _revokeTokenAsync() {
327
+ return _revokeTokenAsync2.apply(this, arguments);
328
+ }
329
+ function _revokeTokenAsync2() {
330
+ _revokeTokenAsync2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
331
+ var url;
332
+ return _regenerator().w(function (_context5) {
333
+ while (1) switch (_context5.n) {
334
+ case 0:
335
+ if (this.accessToken) {
336
+ _context5.n = 1;
337
+ break;
338
+ }
339
+ throw new Error('No token to revoke.');
340
+ case 1:
341
+ url = GOOGLE_REVOKE_TOKEN_URL + this.accessToken;
342
+ _context5.n = 2;
343
+ return this.transporter.request({
344
+ url: url,
345
+ retry: true
346
+ });
347
+ case 2:
348
+ _assertClassBrand(_GoogleToken_brand, this, _configure).call(this, {
349
+ email: this.iss,
350
+ sub: this.sub,
351
+ key: this.key,
352
+ keyFile: this.keyFile,
353
+ scope: this.scope,
354
+ additionalClaims: this.additionalClaims
355
+ });
356
+ case 3:
357
+ return _context5.a(2);
358
+ }
359
+ }, _callee5, this);
360
+ }));
361
+ return _revokeTokenAsync2.apply(this, arguments);
362
+ }
363
+ /**
364
+ * Configure the GoogleToken for re-use.
365
+ * @param {object} options Configuration object.
366
+ */
367
+ function _configure() {
368
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
369
+ this.keyFile = options.keyFile;
370
+ this.key = options.key;
371
+ this.rawToken = undefined;
372
+ this.iss = options.email || options.iss;
373
+ this.sub = options.sub;
374
+ this.additionalClaims = options.additionalClaims;
375
+ if (_typeof(options.scope) === 'object') {
376
+ this.scope = options.scope.join(' ');
377
+ } else {
378
+ this.scope = options.scope;
379
+ }
380
+ this.eagerRefreshThresholdMillis = options.eagerRefreshThresholdMillis;
381
+ if (options.transporter) {
382
+ this.transporter = options.transporter;
383
+ }
384
+ }
385
+ /**
386
+ * Request the token from Google.
387
+ */
388
+ function _requestToken() {
389
+ return _requestToken2.apply(this, arguments);
390
+ }
391
+ function _requestToken2() {
392
+ _requestToken2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
393
+ var iat, additionalClaims, payload, signedJWT, r, _response, _response2, body, desc, _t2;
394
+ return _regenerator().w(function (_context6) {
395
+ while (1) switch (_context6.n) {
396
+ case 0:
397
+ iat = Math.floor(new Date().getTime() / 1000);
398
+ additionalClaims = this.additionalClaims || {};
399
+ payload = Object.assign({
400
+ iss: this.iss,
401
+ scope: this.scope,
402
+ aud: GOOGLE_TOKEN_URL,
403
+ exp: iat + 3600,
404
+ iat: iat,
405
+ sub: this.sub
406
+ }, additionalClaims);
407
+ signedJWT = jws.sign({
408
+ header: {
409
+ alg: 'RS256'
410
+ },
411
+ payload: payload,
412
+ secret: this.key
413
+ });
414
+ _context6.p = 1;
415
+ _context6.n = 2;
416
+ return this.transporter.request({
417
+ method: 'POST',
418
+ url: GOOGLE_TOKEN_URL,
419
+ data: new URLSearchParams({
420
+ grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
421
+ assertion: signedJWT
422
+ }),
423
+ responseType: 'json',
424
+ retryConfig: {
425
+ httpMethodsToRetry: ['POST']
426
+ }
427
+ });
428
+ case 2:
429
+ r = _context6.v;
430
+ this.rawToken = r.data;
431
+ this.expiresAt = r.data.expires_in === null || r.data.expires_in === undefined ? undefined : (iat + r.data.expires_in) * 1000;
432
+ return _context6.a(2, this.rawToken);
433
+ case 3:
434
+ _context6.p = 3;
435
+ _t2 = _context6.v;
436
+ this.rawToken = undefined;
437
+ this.tokenExpires = undefined;
438
+ body = _t2.response && (_response = _t2.response) !== null && _response !== void 0 && _response.data ? (_response2 = _t2.response) === null || _response2 === void 0 ? void 0 : _response2.data : {};
439
+ if (body.error) {
440
+ desc = body.error_description ? ": ".concat(body.error_description) : '';
441
+ _t2.message = "".concat(body.error).concat(desc);
442
+ }
443
+ throw _t2;
444
+ case 4:
445
+ return _context6.a(2);
446
+ }
447
+ }, _callee6, this, [[1, 3]]);
448
+ }));
449
+ return _requestToken2.apply(this, arguments);
450
+ }
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/hasown/.github/FUNDING.yml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # These are supported funding model platforms
2
+
3
+ github: [ljharb]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: npm/hasown
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ custom: # Replace with a single custom sponsorship URL
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/https-proxy-agent/dist/index.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,yCAA2B;AAE3B,oDAA4B;AAC5B,kDAAgC;AAChC,2CAAqD;AACrD,6BAA0B;AAC1B,iEAA4D;AAG5D,MAAM,KAAK,GAAG,IAAA,eAAW,EAAC,mBAAmB,CAAC,CAAC;AAE/C,MAAM,0BAA0B,GAAG,CAGlC,OAAU,EACT,EAAE;IACH,IACC,OAAO,CAAC,UAAU,KAAK,SAAS;QAChC,OAAO,CAAC,IAAI;QACZ,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EACtB;QACD,OAAO;YACN,GAAG,OAAO;YACV,UAAU,EAAE,OAAO,CAAC,IAAI;SACxB,CAAC;KACF;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAqBF;;;;;;;;;;;GAWG;AACH,MAAa,eAAoC,SAAQ,kBAAK;IAO7D,YAAY,KAAgB,EAAE,IAAkC;QAC/D,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,OAAO,GAAG,EAAE,IAAI,EAAE,SA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C;QACvD,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC;QAE3B,oEAAoE;QACpE,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAa,EAAE,EAAE;YACpC,KAAK,CAAC,2CAA2C,CAAC,CAAC;YACnD,IAAA,gBAAM,EAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAEpC,gEAAgE;YAChE,8DAA8D;YAC9D,YAAY;YACZ,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IACnB,CAAC;;AA9IM,yBAAS,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AADlC,0CAAe;AAkJ5B,SAAS,MAAM,CAAC,MAAkC;IACjD,MAAM,CAAC,MAAM,EAAE,CAAC;AACjB,CAAC;AAED,SAAS,IAAI,CACZ,GAAM,EACN,GAAG,IAAO;IAIV,MAAM,GAAG,GAAG,EAEX,CAAC;IACF,IAAI,GAAqB,CAAC;IAC1B,KAAK,GAAG,IAAI,GAAG,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;SACpB;KACD;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { IncomingHttpHeaders } from 'http';
5
+ import { Readable } from 'stream';
6
+ export interface ConnectResponse {
7
+ statusCode: number;
8
+ statusText: string;
9
+ headers: IncomingHttpHeaders;
10
+ }
11
+ export declare function parseProxyResponse(socket: Readable): Promise<{
12
+ connect: ConnectResponse;
13
+ buffered: Buffer;
14
+ }>;
15
+ //# sourceMappingURL=parse-proxy-response.d.ts.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/https-proxy-agent/dist/parse-proxy-response.js ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.parseProxyResponse = void 0;
7
+ const debug_1 = __importDefault(require("debug"));
8
+ const debug = (0, debug_1.default)('https-proxy-agent:parse-proxy-response');
9
+ function parseProxyResponse(socket) {
10
+ return new Promise((resolve, reject) => {
11
+ // we need to buffer any HTTP traffic that happens with the proxy before we get
12
+ // the CONNECT response, so that if the response is anything other than an "200"
13
+ // response code, then we can re-play the "data" events on the socket once the
14
+ // HTTP parser is hooked up...
15
+ let buffersLength = 0;
16
+ const buffers = [];
17
+ function read() {
18
+ const b = socket.read();
19
+ if (b)
20
+ ondata(b);
21
+ else
22
+ socket.once('readable', read);
23
+ }
24
+ function cleanup() {
25
+ socket.removeListener('end', onend);
26
+ socket.removeListener('error', onerror);
27
+ socket.removeListener('readable', read);
28
+ }
29
+ function onend() {
30
+ cleanup();
31
+ debug('onend');
32
+ reject(new Error('Proxy connection ended before receiving CONNECT response'));
33
+ }
34
+ function onerror(err) {
35
+ cleanup();
36
+ debug('onerror %o', err);
37
+ reject(err);
38
+ }
39
+ function ondata(b) {
40
+ buffers.push(b);
41
+ buffersLength += b.length;
42
+ const buffered = Buffer.concat(buffers, buffersLength);
43
+ const endOfHeaders = buffered.indexOf('\r\n\r\n');
44
+ if (endOfHeaders === -1) {
45
+ // keep buffering
46
+ debug('have not received end of HTTP headers yet...');
47
+ read();
48
+ return;
49
+ }
50
+ const headerParts = buffered
51
+ .slice(0, endOfHeaders)
52
+ .toString('ascii')
53
+ .split('\r\n');
54
+ const firstLine = headerParts.shift();
55
+ if (!firstLine) {
56
+ socket.destroy();
57
+ return reject(new Error('No header received from proxy CONNECT response'));
58
+ }
59
+ const firstLineParts = firstLine.split(' ');
60
+ const statusCode = +firstLineParts[1];
61
+ const statusText = firstLineParts.slice(2).join(' ');
62
+ const headers = {};
63
+ for (const header of headerParts) {
64
+ if (!header)
65
+ continue;
66
+ const firstColon = header.indexOf(':');
67
+ if (firstColon === -1) {
68
+ socket.destroy();
69
+ return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
70
+ }
71
+ const key = header.slice(0, firstColon).toLowerCase();
72
+ const value = header.slice(firstColon + 1).trimStart();
73
+ const current = headers[key];
74
+ if (typeof current === 'string') {
75
+ headers[key] = [current, value];
76
+ }
77
+ else if (Array.isArray(current)) {
78
+ current.push(value);
79
+ }
80
+ else {
81
+ headers[key] = value;
82
+ }
83
+ }
84
+ debug('got proxy server response: %o %o', firstLine, headers);
85
+ cleanup();
86
+ resolve({
87
+ connect: {
88
+ statusCode,
89
+ statusText,
90
+ headers,
91
+ },
92
+ buffered,
93
+ });
94
+ }
95
+ socket.on('error', onerror);
96
+ socket.on('end', onend);
97
+ read();
98
+ });
99
+ }
100
+ exports.parseProxyResponse = parseProxyResponse;
101
+ //# sourceMappingURL=parse-proxy-response.js.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/jackspeak/dist/esm/index.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.js","sourceRoot":"","s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,CAAC,uBAAuB,EAAE,OAAO,CAAC;YAC1C,6BAA6B;aAC5B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;YAC3B,2CAA2C;aAC1C,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC;aAC1B,IAAI,EAAE,CACV,CAAA;IACH,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC,CAAA;AAED,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,CAAC,CAAS,EAAE,MAAe,KAAK,EAAU,EAAE;IACpE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAClD,OAAO,GAAG,CAAC,CAAC;QACR,WAAW,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU;QAC/C,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;AACrC,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,CAAS,EAAE,MAAe,KAAK,EAAE,EAAE;IAC3D,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;SACxB,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC;SAC5B,IAAI,EAAE,CAAA;IACT,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AAC7B,CAAC,CAAA","sourcesContent":["import {\n inspect,\n InspectOptions,\n parseArgs,\n ParseArgsConfig,\n} from 'node:util'\n\n// it's a tiny API, just cast it inline, it's fine\n//@ts-ignore\nimport cliui from '@isaacs/cliui'\nimport { basename } from 'node:path'\n\nexport type ParseArgsOptions = Exclude<\n ParseArgsConfig['options'],\n undefined\n>\nexport type ParseArgsOption = ParseArgsOptions[string]\nexport type ParseArgsDefault = Exclude<ConfigValue, number | number[]>\n\nexport type ConfigType = 'number' | 'string' | 'boolean'\n\nexport const isConfigType = (t: unknown): t is ConfigType =>\n typeof t === 'string' &&\n (t === 'string' || t === 'number' || t === 'boolean')\n\nexport type ConfigValuePrimitive = string | boolean | number\nexport type ConfigValueArray = string[] | boolean[] | number[]\nexport type ConfigValue = ConfigValuePrimitive | ConfigValueArray\n\n/**\n * Given a Jack object, get the typeof its ConfigSet\n */\nexport type Unwrap<J> = J extends Jack<infer C> ? C : never\n\n/**\n * Defines the type of value that is valid, given a config definition's\n * {@link ConfigType} and boolean multiple setting\n */\nexport type ValidValue<\n T extends ConfigType = ConfigType,\n M extends boolean = boolean,\n> =\n [T, M] extends ['number', true] ? number[]\n : [T, M] extends ['string', true] ? string[]\n : [T, M] extends ['boolean', true] ? boolean[]\n : [T, M] extends ['number', false] ? number\n : [T, M] extends ['string', false] ? string\n : [T, M] extends ['boolean', false] ? boolean\n : [T, M] extends ['string', boolean] ? string | string[]\n : [T, M] extends ['boolean', boolean] ? boolean | boolean[]\n : [T, M] extends ['number', boolean] ? number | number[]\n : [T, M] extends [ConfigType, false] ? ConfigValuePrimitive\n : [T, M] extends [ConfigType, true] ? ConfigValueArray\n : ConfigValue\n\nconst isValidValue = <T extends ConfigType, M extends boolean>(\n v: unknown,\n type: T,\n multi: M,\n): v is ValidValue<T, M> => {\n if (multi) {\n if (!Array.isArray(v)) return false\n return !v.some((v: unknown) => !isValidValue(v, type, false))\n }\n if (Array.isArray(v)) return false\n return typeof v === type\n}\n\nexport type ReadonlyArrays = readonly number[] | readonly string[]\n\n/**\n * Defines the type of validOptions that are valid, given a config definition's\n * {@link ConfigType}\n */\nexport type ValidOptions<T extends ConfigType> =\n T extends 'boolean' ? undefined\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : ReadonlyArrays\n\nconst isValidOption = <T extends ConfigType>(\n v: unknown,\n vo: readonly unknown[],\n): vo is Exclude<ValidOptions<T>, undefined> =>\n !!vo &&\n (Array.isArray(v) ? v.every(x => isValidOption(x, vo)) : vo.includes(v))\n\n/**\n * A config field definition, in its full representation.\n * This is what is passed in to addFields so `type` is required.\n */\nexport type ConfigOption<\n T extends ConfigType = ConfigType,\n M extends boolean = boolean,\n O extends undefined | ValidOptions<T> = undefined | ValidOptions<T>,\n> = {\n type: T\n short?: string\n default?: ValidValue<T, M> &\n (O extends ReadonlyArrays ?\n M extends false ?\n O[number]\n : O[number][]\n : unknown)\n description?: string\n hint?: T extends 'boolean' ? undefined : string\n validate?:\n | ((v: unknown) => v is ValidValue<T, M>)\n | ((v: unknown) => boolean)\n validOptions?: O\n delim?: M extends false ? undefined : string\n multiple?: M\n}\n\n/**\n * Determine whether an unknown object is a {@link ConfigOption} based only\n * on its `type` and `multiple` property\n */\nexport const isConfigOptionOfType = <\n T extends ConfigType,\n M extends boolean,\n>(\n o: any,\n type: T,\n multi: M,\n): o is ConfigOption<T, M> =>\n !!o &&\n typeof o === 'object' &&\n isConfigType(o.type) &&\n o.type === type &&\n !!o.multiple === multi\n\n/**\n * Determine whether an unknown object is a {@link ConfigOption} based on\n * it having all valid properties\n */\nexport const isConfigOption = <T extends ConfigType, M extends boolean>(\n o: any,\n type: T,\n multi: M,\n): o is ConfigOption<T, M> =>\n isConfigOptionOfType(o, type, multi) &&\n undefOrType(o.short, 'string') &&\n undefOrType(o.description, 'string') &&\n undefOrType(o.hint, 'string') &&\n undefOrType(o.validate, 'function') &&\n (o.type === 'boolean' ?\n o.validOptions === undefined\n : undefOrTypeArray(o.validOptions, o.type)) &&\n (o.default === undefined || isValidValue(o.default, type, multi))\n\n/**\n * The meta information for a config option definition, when the\n * type and multiple values can be inferred by the method being used\n */\nexport type ConfigOptionMeta<\n T extends ConfigType,\n M extends boolean,\n O extends ConfigOption<T, M> = ConfigOption<T, M>,\n> = Pick<Partial<O>, 'type'> & Omit<O, 'type'>\n\n/**\n * A set of {@link ConfigOption} objects, referenced by their longOption\n * string values.\n */\nexport type ConfigSet = {\n [longOption: string]: ConfigOption\n}\n\n/**\n * A set of {@link ConfigOptionMeta} fields, referenced by their longOption\n * string values.\n */\nexport type ConfigMetaSet<T extends ConfigType, M extends boolean> = {\n [longOption: string]: ConfigOptionMeta<T, M>\n}\n\n/**\n * Infer {@link ConfigSet} fields from a given {@link ConfigMetaSet}\n */\nexport type ConfigSetFromMetaSet<\n T extends ConfigType,\n M extends boolean,\n S extends ConfigMetaSet<T, M>,\n> = S & { [longOption in keyof S]: ConfigOption<T, M> }\n\n/**\n * The 'values' field returned by {@link Jack#parse}. If a value has\n * a default field it will be required on the object otherwise it is optional.\n */\nexport type OptionsResults<T extends ConfigSet> = {\n [K in keyof T]:\n | (T[K]['validOptions'] extends ReadonlyArrays ?\n T[K] extends ConfigOption<'string' | 'number', false> ?\n T[K]['validOptions'][number]\n : T[K] extends ConfigOption<'string' | 'number', true> ?\n T[K]['validOptions'][number][]\n : never\n : T[K] extends ConfigOption<'string', false> ? string\n : T[K] extends ConfigOption<'string', true> ? string[]\n : T[K] extends ConfigOption<'number', false> ? number\n : T[K] extends ConfigOption<'number', true> ? number[]\n : T[K] extends ConfigOption<'boolean', false> ? boolean\n : T[K] extends ConfigOption<'boolean', true> ? boolean[]\n : never)\n | (T[K]['default'] extends ConfigValue ? never : undefined)\n}\n\n/**\n * The object retured by {@link Jack#parse}\n */\nexport type Parsed<T extends ConfigSet> = {\n values: OptionsResults<T>\n positionals: string[]\n}\n\n/**\n * A row used when generating the {@link Jack#usage} string\n */\nexport interface Row {\n left?: string\n text: string\n skipLine?: boolean\n type?: string\n}\n\n/**\n * A heading for a section in the usage, created by the jack.heading()\n * method.\n *\n * First heading is always level 1, subsequent headings default to 2.\n *\n * The level of the nearest heading level sets the indentation of the\n * description that follows.\n */\nexport interface Heading extends Row {\n type: 'heading'\n text: string\n left?: ''\n skipLine?: boolean\n level: number\n pre?: boolean\n}\n\nconst isHeading = (r: { type?: string }): r is Heading =>\n r.type === 'heading'\n\n/**\n * An arbitrary blob of text describing some stuff, set by the\n * jack.description() method.\n *\n * Indentation determined by level of the nearest header.\n */\nexport interface Description extends Row {\n type: 'description'\n text: string\n left?: ''\n skipLine?: boolean\n pre?: boolean\n}\n\nconst isDescription = (r: { type?: string }): r is Description =>\n r.type === 'description'\n\n/**\n * A heading or description row used when generating the {@link Jack#usage}\n * string\n */\nexport type TextRow = Heading | Description\n\n/**\n * Either a {@link TextRow} or a reference to a {@link ConfigOption}\n */\nexport type UsageField =\n | TextRow\n | {\n type: 'config'\n name: string\n value: ConfigOption\n }\n\nconst width = Math.min(process?.stdout?.columns ?? 80, 80)\n\n// indentation spaces from heading level\nconst indent = (n: number) => (n - 1) * 2\n\nconst toEnvKey = (pref: string, key: string): string =>\n [pref, key.replace(/[^a-zA-Z0-9]+/g, ' ')]\n .join(' ')\n .trim()\n .toUpperCase()\n .replace(/ /g, '_')\n\nconst toEnvVal = (value: ConfigValue, delim: string = '\\n'): string => {\n const str =\n typeof value === 'string' ? value\n : typeof value === 'boolean' ?\n value ? '1'\n : '0'\n : typeof value === 'number' ? String(value)\n : Array.isArray(value) ?\n value.map((v: ConfigValue) => toEnvVal(v)).join(delim)\n : /* c8 ignore start */ undefined\n if (typeof str !== 'string') {\n throw new Error(\n `could not serialize value to environment: ${JSON.stringify(value)}`,\n { cause: { code: 'JACKSPEAK' } },\n )\n }\n /* c8 ignore stop */\n return str\n}\n\nconst fromEnvVal = <T extends ConfigType, M extends boolean>(\n env: string,\n type: T,\n multiple: M,\n delim: string = '\\n',\n): ValidValue<T, M> =>\n (multiple ?\n env ? env.split(delim).map(v => fromEnvVal(v, type, false))\n : []\n : type === 'string' ? env\n : type === 'boolean' ? env === '1'\n : +env.trim()) as ValidValue<T, M>\n\nconst undefOrType = (v: unknown, t: string): boolean =>\n v === undefined || typeof v === t\n\nconst undefOrTypeArray = (v: unknown, t: string): boolean =>\n v === undefined || (Array.isArray(v) && v.every(x => typeof x === t))\n\n// print the value type, for error message reporting\nconst valueType = (\n v: ConfigValue | { type: ConfigType; multiple?: boolean },\n): string =>\n typeof v === 'string' ? 'string'\n : typeof v === 'boolean' ? 'boolean'\n : typeof v === 'number' ? 'number'\n : Array.isArray(v) ?\n `${joinTypes([...new Set(v.map(v => valueType(v)))])}[]`\n : `${v.type}${v.multiple ? '[]' : ''}`\n\nconst joinTypes = (types: string[]): string =>\n types.length === 1 && typeof types[0] === 'string' ?\n types[0]\n : `(${types.join('|')})`\n\nconst validateFieldMeta = <T extends ConfigType, M extends boolean>(\n field: ConfigOptionMeta<T, M>,\n fieldMeta?: { type: T; multiple: M },\n): { type: ConfigType; multiple: boolean } => {\n if (fieldMeta) {\n if (field.type !== undefined && field.type !== fieldMeta.type) {\n throw new TypeError(`invalid type`, {\n cause: {\n found: field.type,\n wanted: [fieldMeta.type, undefined],\n },\n })\n }\n if (\n field.multiple !== undefined &&\n !!field.multiple !== fieldMeta.multiple\n ) {\n throw new TypeError(`invalid multiple`, {\n cause: {\n found: field.multiple,\n wanted: [fieldMeta.multiple, undefined],\n },\n })\n }\n return fieldMeta\n }\n\n if (!isConfigType(field.type)) {\n throw new TypeError(`invalid type`, {\n cause: {\n found: field.type,\n wanted: ['string', 'number', 'boolean'],\n },\n })\n }\n\n return {\n type: field.type,\n multiple: !!field.multiple,\n }\n}\n\nconst validateField = (\n o: ConfigOption,\n type: ConfigType,\n multiple: boolean,\n): ConfigOption => {\n const validateValidOptions = <\n T extends ConfigValue | undefined,\n V extends T extends Array<infer U> ? U : T,\n >(\n def: T | undefined,\n validOptions: readonly V[] | undefined,\n ) => {\n if (!undefOrTypeArray(validOptions, type)) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: valueType({ type, multiple: true }),\n },\n })\n }\n if (def !== undefined && validOptions !== undefined) {\n const valid =\n Array.isArray(def) ?\n def.every(v => validOptions.includes(v as V))\n : validOptions.includes(def as V)\n if (!valid) {\n throw new TypeError('invalid default value not in validOptions', {\n cause: {\n found: def,\n wanted: validOptions,\n },\n })\n }\n }\n }\n\n if (\n o.default !== undefined &&\n !isValidValue(o.default, type, multiple)\n ) {\n throw new TypeError('invalid default value', {\n cause: {\n found: o.default,\n wanted: valueType({ type, multiple }),\n },\n })\n }\n\n if (\n isConfigOptionOfType(o, 'number', false) ||\n isConfigOptionOfType(o, 'number', true)\n ) {\n validateValidOptions(o.default, o.validOptions)\n } else if (\n isConfigOptionOfType(o, 'string', false) ||\n isConfigOptionOfType(o, 'string', true)\n ) {\n validateValidOptions(o.default, o.validOptions)\n } else if (\n isConfigOptionOfType(o, 'boolean', false) ||\n isConfigOptionOfType(o, 'boolean', true)\n ) {\n if (o.hint !== undefined) {\n throw new TypeError('cannot provide hint for flag')\n }\n if (o.validOptions !== undefined) {\n throw new TypeError('cannot provide validOptions for flag')\n }\n }\n\n return o\n}\n\nconst toParseArgsOptionsConfig = (\n options: ConfigSet,\n): ParseArgsOptions => {\n return Object.entries(options).reduce((acc, [longOption, o]) => {\n const p: ParseArgsOption = {\n type: 'string',\n multiple: !!o.multiple,\n ...(typeof o.short === 'string' ? { short: o.short } : undefined),\n }\n const setNoBool = () => {\n if (!longOption.startsWith('no-') && !options[`no-${longOption}`]) {\n acc[`no-${longOption}`] = {\n type: 'boolean',\n multiple: !!o.multiple,\n }\n }\n }\n const setDefault = <T>(\n def: T | undefined,\n fn: (d: T) => ParseArgsDefault,\n ) => {\n if (def !== undefined) {\n p.default = fn(def)\n }\n }\n if (isConfigOption(o, 'number', false)) {\n setDefault(o.default, String)\n } else if (isConfigOption(o, 'number', true)) {\n setDefault(o.default, d => d.map(v => String(v)))\n } else if (\n isConfigOption(o, 'string', false) ||\n isConfigOption(o, 'string', true)\n ) {\n setDefault(o.default, v => v)\n } else if (\n isConfigOption(o, 'boolean', false) ||\n isConfigOption(o, 'boolean', true)\n ) {\n p.type = 'boolean'\n setDefault(o.default, v => v)\n setNoBool()\n }\n acc[longOption] = p\n return acc\n }, {} as ParseArgsOptions)\n}\n\n/**\n * Options provided to the {@link Jack} constructor\n */\nexport interface JackOptions {\n /**\n * Whether to allow positional arguments\n *\n * @default true\n */\n allowPositionals?: boolean\n\n /**\n * Prefix to use when reading/writing the environment variables\n *\n * If not specified, environment behavior will not be available.\n */\n envPrefix?: string\n\n /**\n * Environment object to read/write. Defaults `process.env`.\n * No effect if `envPrefix` is not set.\n */\n env?: Record<string, string | undefined>\n\n /**\n * A short usage string. If not provided, will be generated from the\n * options provided, but that can of course be rather verbose if\n * there are a lot of options.\n */\n usage?: string\n\n /**\n * Stop parsing flags and opts at the first positional argument.\n * This is to support cases like `cmd [flags] <subcmd> [options]`, where\n * each subcommand may have different options. This effectively treats\n * any positional as a `--` argument. Only relevant if `allowPositionals`\n * is true.\n *\n * To do subcommands, set this option, look at the first positional, and\n * parse the remaining positionals as appropriate.\n *\n * @default false\n */\n stopAtPositional?: boolean\n\n /**\n * Conditional `stopAtPositional`. If set to a `(string)=>boolean` function,\n * will be called with each positional argument encountered. If the function\n * returns true, then parsing will stop at that point.\n */\n stopAtPositionalTest?: (arg: string) => boolean\n}\n\n/**\n * Class returned by the {@link jack} function and all configuration\n * definition methods. This is what gets chained together.\n */\nexport class Jack<C extends ConfigSet = {}> {\n #configSet: C\n #shorts: Record<string, string>\n #options: JackOptions\n #fields: UsageField[] = []\n #env: Record<string, string | undefined>\n #envPrefix?: string\n #allowPositionals: boolean\n #usage?: string\n #usageMarkdown?: string\n\n constructor(options: JackOptions = {}) {\n this.#options = options\n this.#allowPositionals = options.allowPositionals !== false\n this.#env =\n this.#options.env === undefined ? process.env : this.#options.env\n this.#envPrefix = options.envPrefix\n // We need to fib a little, because it's always the same object, but it\n // starts out as having an empty config set. Then each method that adds\n // fields returns `this as Jack<C & { ...newConfigs }>`\n this.#configSet = Object.create(null) as C\n this.#shorts = Object.create(null)\n }\n\n /**\n * Resulting definitions, suitable to be passed to Node's `util.parseArgs`,\n * but also including `description` and `short` fields, if set.\n */\n get definitions(): C {\n return this.#configSet\n }\n\n /** map of `{ <short>: <long> }` strings for each short name defined */\n get shorts() {\n return this.#shorts\n }\n\n /**\n * options passed to the {@link Jack} constructor\n */\n get jackOptions() {\n return this.#options\n }\n\n /**\n * the data used to generate {@link Jack#usage} and\n * {@link Jack#usageMarkdown} content.\n */\n get usageFields() {\n return this.#fields\n }\n\n /**\n * Set the default value (which will still be overridden by env or cli)\n * as if from a parsed config file. The optional `source` param, if\n * provided, will be included in error messages if a value is invalid or\n * unknown.\n */\n setConfigValues(values: Partial<OptionsResults<C>>, source = '') {\n try {\n this.validate(values)\n } catch (er) {\n if (source && er instanceof Error) {\n /* c8 ignore next */\n const cause = typeof er.cause === 'object' ? er.cause : {}\n er.cause = { ...cause, path: source }\n Error.captureStackTrace(er, this.setConfigValues)\n }\n throw er\n }\n for (const [field, value] of Object.entries(values)) {\n const my = this.#configSet[field]\n // already validated, just for TS's benefit\n /* c8 ignore start */\n if (!my) {\n throw new Error('unexpected field in config set: ' + field, {\n cause: {\n code: 'JACKSPEAK',\n found: field,\n },\n })\n }\n /* c8 ignore stop */\n my.default = value as ConfigValue\n }\n return this\n }\n\n /**\n * Parse a string of arguments, and return the resulting\n * `{ values, positionals }` object.\n *\n * If an {@link JackOptions#envPrefix} is set, then it will read default\n * values from the environment, and write the resulting values back\n * to the environment as well.\n *\n * Environment values always take precedence over any other value, except\n * an explicit CLI setting.\n */\n parse(args: string[] = process.argv): Parsed<C> {\n this.loadEnvDefaults()\n const p = this.parseRaw(args)\n this.applyDefaults(p)\n this.writeEnv(p)\n return p\n }\n\n loadEnvDefaults() {\n if (this.#envPrefix) {\n for (const [field, my] of Object.entries(this.#configSet)) {\n const ek = toEnvKey(this.#envPrefix, field)\n const env = this.#env[ek]\n if (env !== undefined) {\n my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim)\n }\n }\n }\n }\n\n applyDefaults(p: Parsed<C>) {\n for (const [field, c] of Object.entries(this.#configSet)) {\n if (c.default !== undefined && !(field in p.values)) {\n //@ts-ignore\n p.values[field] = c.default\n }\n }\n }\n\n /**\n * Only parse the command line arguments passed in.\n * Does not strip off the `node script.js` bits, so it must be just the\n * arguments you wish to have parsed.\n * Does not read from or write to the environment, or set defaults.\n */\n parseRaw(args: string[]): Parsed<C> {\n if (args === process.argv) {\n args = args.slice(\n (process as { _eval?: string })._eval !== undefined ? 1 : 2,\n )\n }\n\n const result = parseArgs({\n args,\n options: toParseArgsOptionsConfig(this.#configSet),\n // always strict, but using our own logic\n strict: false,\n allowPositionals: this.#allowPositionals,\n tokens: true,\n })\n\n const p: Parsed<C> = {\n values: {} as OptionsResults<C>,\n positionals: [],\n }\n for (const token of result.tokens) {\n if (token.kind === 'positional') {\n p.positionals.push(token.value)\n if (\n this.#options.stopAtPositional ||\n this.#options.stopAtPositionalTest?.(token.value)\n ) {\n p.positionals.push(...args.slice(token.index + 1))\n break\n }\n } else if (token.kind === 'option') {\n let value: ConfigValue | undefined = undefined\n if (token.name.startsWith('no-')) {\n const my = this.#configSet[token.name]\n const pname = token.name.substring('no-'.length)\n const pos = this.#configSet[pname]\n if (\n pos &&\n pos.type === 'boolean' &&\n (!my ||\n (my.type === 'boolean' && !!my.multiple === !!pos.multiple))\n ) {\n value = false\n token.name = pname\n }\n }\n const my = this.#configSet[token.name]\n if (!my) {\n throw new Error(\n `Unknown option '${token.rawName}'. ` +\n `To specify a positional argument starting with a '-', ` +\n `place it at the end of the command after '--', as in ` +\n `'-- ${token.rawName}'`,\n {\n cause: {\n code: 'JACKSPEAK',\n found:\n token.rawName + (token.value ? `=${token.value}` : ''),\n },\n },\n )\n }\n if (value === undefined) {\n if (token.value === undefined) {\n if (my.type !== 'boolean') {\n throw new Error(\n `No value provided for ${token.rawName}, expected ${my.type}`,\n {\n cause: {\n code: 'JACKSPEAK',\n name: token.rawName,\n wanted: valueType(my),\n },\n },\n )\n }\n value = true\n } else {\n if (my.type === 'boolean') {\n throw new Error(\n `Flag ${token.rawName} does not take a value, received '${token.value}'`,\n { cause: { code: 'JACKSPEAK', found: token } },\n )\n }\n if (my.type === 'string') {\n value = token.value\n } else {\n value = +token.value\n if (value !== value) {\n throw new Error(\n `Invalid value '${token.value}' provided for ` +\n `'${token.rawName}' option, expected number`,\n {\n cause: {\n code: 'JACKSPEAK',\n name: token.rawName,\n found: token.value,\n wanted: 'number',\n },\n },\n )\n }\n }\n }\n }\n if (my.multiple) {\n const pv = p.values as Record<string, ConfigValue[]>\n const tn = pv[token.name] ?? []\n pv[token.name] = tn\n tn.push(value)\n } else {\n const pv = p.values as Record<string, ConfigValue>\n pv[token.name] = value\n }\n }\n }\n\n for (const [field, value] of Object.entries(p.values)) {\n const valid = this.#configSet[field]?.validate\n const validOptions = this.#configSet[field]?.validOptions\n const cause =\n validOptions && !isValidOption(value, validOptions) ?\n { name: field, found: value, validOptions }\n : valid && !valid(value) ? { name: field, found: value }\n : undefined\n if (cause) {\n throw new Error(\n `Invalid value provided for --${field}: ${JSON.stringify(value)}`,\n { cause: { ...cause, code: 'JACKSPEAK' } },\n )\n }\n }\n\n return p\n }\n\n /**\n * do not set fields as 'no-foo' if 'foo' exists and both are bools\n * just set foo.\n */\n #noNoFields(f: string, val: unknown, s: string = f) {\n if (!f.startsWith('no-') || typeof val !== 'boolean') return\n const yes = f.substring('no-'.length)\n // recurse so we get the core config key we care about.\n this.#noNoFields(yes, val, s)\n if (this.#configSet[yes]?.type === 'boolean') {\n throw new Error(\n `do not set '${s}', instead set '${yes}' as desired.`,\n { cause: { code: 'JACKSPEAK', found: s, wanted: yes } },\n )\n }\n }\n\n /**\n * Validate that any arbitrary object is a valid configuration `values`\n * object. Useful when loading config files or other sources.\n */\n validate(o: unknown): asserts o is Parsed<C>['values'] {\n if (!o || typeof o !== 'object') {\n throw new Error('Invalid config: not an object', {\n cause: { code: 'JACKSPEAK', found: o },\n })\n }\n const opts = o as Record<string, ValidValue>\n for (const field in o) {\n const value = opts[field]\n /* c8 ignore next - for TS */\n if (value === undefined) continue\n this.#noNoFields(field, value)\n const config = this.#configSet[field]\n if (!config) {\n throw new Error(`Unknown config option: ${field}`, {\n cause: { code: 'JACKSPEAK', found: field },\n })\n }\n if (!isValidValue(value, config.type, !!config.multiple)) {\n throw new Error(\n `Invalid value ${valueType(value)} for ${field}, expected ${valueType(config)}`,\n {\n cause: {\n code: 'JACKSPEAK',\n name: field,\n found: value,\n wanted: valueType(config),\n },\n },\n )\n }\n const cause =\n config.validOptions && !isValidOption(value, config.validOptions) ?\n { name: field, found: value, validOptions: config.validOptions }\n : config.validate && !config.validate(value) ?\n { name: field, found: value }\n : undefined\n if (cause) {\n throw new Error(`Invalid config value for ${field}: ${value}`, {\n cause: { ...cause, code: 'JACKSPEAK' },\n })\n }\n }\n }\n\n writeEnv(p: Parsed<C>) {\n if (!this.#env || !this.#envPrefix) return\n for (const [field, value] of Object.entries(p.values)) {\n const my = this.#configSet[field]\n this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(\n value as ConfigValue,\n my?.delim,\n )\n }\n }\n\n /**\n * Add a heading to the usage output banner\n */\n heading(\n text: string,\n level?: 1 | 2 | 3 | 4 | 5 | 6,\n { pre = false }: { pre?: boolean } = {},\n ): Jack<C> {\n if (level === undefined) {\n level = this.#fields.some(r => isHeading(r)) ? 2 : 1\n }\n this.#fields.push({ type: 'heading', text, level, pre })\n return this\n }\n\n /**\n * Add a long-form description to the usage output at this position.\n */\n description(text: string, { pre }: { pre?: boolean } = {}): Jack<C> {\n this.#fields.push({ type: 'description', text, pre })\n return this\n }\n\n /**\n * Add one or more number fields.\n */\n num<F extends ConfigMetaSet<'number', false>>(\n fields: F,\n ): Jack<C & ConfigSetFromMetaSet<'number', false, F>> {\n return this.#addFieldsWith(fields, 'number', false)\n }\n\n /**\n * Add one or more multiple number fields.\n */\n numList<F extends ConfigMetaSet<'number', true>>(\n fields: F,\n ): Jack<C & ConfigSetFromMetaSet<'number', true, F>> {\n return this.#addFieldsWith(fields, 'number', true)\n }\n\n /**\n * Add one or more string option fields.\n */\n opt<F extends ConfigMetaSet<'string', false>>(\n fields: F,\n ): Jack<C & ConfigSetFromMetaSet<'string', false, F>> {\n return this.#addFieldsWith(fields, 'string', false)\n }\n\n /**\n * Add one or more multiple string option fields.\n */\n optList<F extends ConfigMetaSet<'string', true>>(\n fields: F,\n ): Jack<C & ConfigSetFromMetaSet<'string', true, F>> {\n return this.#addFieldsWith(fields, 'string', true)\n }\n\n /**\n * Add one or more flag fields.\n */\n flag<F extends ConfigMetaSet<'boolean', false>>(\n fields: F,\n ): Jack<C & ConfigSetFromMetaSet<'boolean', false, F>> {\n return this.#addFieldsWith(fields, 'boolean', false)\n }\n\n /**\n * Add one or more multiple flag fields.\n */\n flagList<F extends ConfigMetaSet<'boolean', true>>(\n fields: F,\n ): Jack<C & ConfigSetFromMetaSet<'boolean', true, F>> {\n return this.#addFieldsWith(fields, 'boolean', true)\n }\n\n /**\n * Generic field definition method. Similar to flag/flagList/number/etc,\n * but you must specify the `type` (and optionally `multiple` and `delim`)\n * fields on each one, or Jack won't know how to define them.\n */\n addFields<F extends ConfigSet>(fields: F): Jack<C & F> {\n return this.#addFields(this as unknown as Jack<C & F>, fields)\n }\n\n #addFieldsWith<\n T extends ConfigType,\n M extends boolean,\n F extends ConfigMetaSet<T, M>,\n O extends ConfigSetFromMetaSet<T, M, F>,\n >(fields: F, type: ConfigType, multiple: boolean): Jack<C & O> {\n return this.#addFields(this as unknown as Jack<C & O>, fields, {\n type,\n multiple,\n })\n }\n\n #addFields<\n T extends ConfigType,\n M extends boolean,\n F extends ConfigMetaSet<T, M>,\n O extends Jack,\n >(next: O, fields: F, opt?: { type: T; multiple: M }): O {\n Object.assign(\n next.#configSet,\n Object.fromEntries(\n Object.entries(fields).map(([name, field]) => {\n this.#validateName(name, field)\n const { type, multiple } = validateFieldMeta(field, opt)\n const value = { ...field, type, multiple }\n validateField(value, type, multiple)\n next.#fields.push({ type: 'config', name, value })\n return [name, value]\n }),\n ),\n )\n return next\n }\n\n #validateName(name: string, field: { short?: string }) {\n if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) {\n throw new TypeError(\n `Invalid option name: ${name}, ` +\n `must be '-' delimited ASCII alphanumeric`,\n )\n }\n if (this.#configSet[name]) {\n throw new TypeError(`Cannot redefine option ${field}`)\n }\n if (this.#shorts[name]) {\n throw new TypeError(\n `Cannot redefine option ${name}, already ` +\n `in use for ${this.#shorts[name]}`,\n )\n }\n if (field.short) {\n if (!/^[a-zA-Z0-9]$/.test(field.short)) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n 'must be 1 ASCII alphanumeric character',\n )\n }\n if (this.#shorts[field.short]) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n `already in use for ${this.#shorts[field.short]}`,\n )\n }\n this.#shorts[field.short] = name\n this.#shorts[name] = name\n }\n }\n\n /**\n * Return the usage banner for the given configuration\n */\n usage(): string {\n if (this.#usage) return this.#usage\n\n let headingLevel = 1\n //@ts-ignore\n const ui = cliui({ width })\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n ui.div({\n padding: [0, 0, 0, 0],\n text: normalize(first.text),\n })\n }\n ui.div({ padding: [0, 0, 0, 0], text: 'Usage:' })\n if (this.#options.usage) {\n ui.div({\n text: this.#options.usage,\n padding: [0, 0, 0, 2],\n })\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n ui.div({\n text: usage,\n padding: [0, 0, 0, 2],\n })\n }\n\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n const print = normalize(maybeDesc.text, maybeDesc.pre)\n start++\n ui.div({ padding: [0, 0, 0, 0], text: print })\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n\n const { rows, maxWidth } = this.#usageRows(start)\n\n // every heading/description after the first gets indented by 2\n // extra spaces.\n for (const row of rows) {\n if (row.left) {\n // If the row is too long, don't wrap it\n // Bump the right-hand side down a line to make room\n const configIndent = indent(Math.max(headingLevel, 2))\n if (row.left.length > maxWidth - 3) {\n ui.div({ text: row.left, padding: [0, 0, 0, configIndent] })\n ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] })\n } else {\n ui.div(\n {\n text: row.left,\n padding: [0, 1, 0, configIndent],\n width: maxWidth,\n },\n { padding: [0, 0, 0, 0], text: row.text },\n )\n }\n if (row.skipLine) {\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n } else {\n if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n // only h1 and h2 have bottom padding\n // h3-h6 do not\n const b = level <= 2 ? 1 : 0\n ui.div({ ...row, padding: [0, 0, b, indent(level)] })\n } else {\n ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] })\n }\n }\n }\n\n return (this.#usage = ui.toString())\n }\n\n /**\n * Return the usage banner markdown for the given configuration\n */\n usageMarkdown(): string {\n if (this.#usageMarkdown) return this.#usageMarkdown\n\n const out: string[] = []\n\n let headingLevel = 1\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n out.push(`# ${normalizeOneLine(first.text)}`)\n }\n out.push('Usage:')\n if (this.#options.usage) {\n out.push(normalizeMarkdown(this.#options.usage, true))\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n out.push(normalizeMarkdown(usage, true))\n }\n\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre))\n start++\n }\n\n const { rows } = this.#usageRows(start)\n\n // heading level in markdown is number of # ahead of text\n for (const row of rows) {\n if (row.left) {\n out.push(\n '#'.repeat(headingLevel + 1) +\n ' ' +\n normalizeOneLine(row.left, true),\n )\n if (row.text) out.push(normalizeMarkdown(row.text))\n } else if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n out.push(\n `${'#'.repeat(headingLevel)} ${normalizeOneLine(\n row.text,\n row.pre,\n )}`,\n )\n } else {\n out.push(normalizeMarkdown(row.text, !!(row as Description).pre))\n }\n }\n\n return (this.#usageMarkdown = out.join('\\n\\n') + '\\n')\n }\n\n #usageRows(start: number) {\n // turn each config type into a row, and figure out the width of the\n // left hand indentation for the option descriptions.\n let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3)))\n let maxWidth = 8\n let prev: Row | TextRow | undefined = undefined\n const rows: (Row | TextRow)[] = []\n for (const field of this.#fields.slice(start)) {\n if (field.type !== 'config') {\n if (prev?.type === 'config') prev.skipLine = true\n prev = undefined\n field.text = normalize(field.text, !!field.pre)\n rows.push(field)\n continue\n }\n const { value } = field\n const desc = value.description || ''\n const mult = value.multiple ? 'Can be set multiple times' : ''\n const opts =\n value.validOptions?.length ?\n `Valid options:${value.validOptions.map(\n v => ` ${JSON.stringify(v)}`,\n )}`\n : ''\n const dmDelim = desc.includes('\\n') ? '\\n\\n' : '\\n'\n const extra = [opts, mult].join(dmDelim).trim()\n const text = (normalize(desc) + dmDelim + extra).trim()\n const hint =\n value.hint ||\n (value.type === 'number' ? 'n'\n : value.type === 'string' ? field.name\n : undefined)\n const short =\n !value.short ? ''\n : value.type === 'boolean' ? `-${value.short} `\n : `-${value.short}<${hint}> `\n const left =\n value.type === 'boolean' ?\n `${short}--${field.name}`\n : `${short}--${field.name}=<${hint}>`\n const row: Row = { text, left, type: 'config' }\n if (text.length > width - maxMax) {\n row.skipLine = true\n }\n if (prev && left.length > maxMax) prev.skipLine = true\n prev = row\n const len = left.length + 4\n if (len > maxWidth && len < maxMax) {\n maxWidth = len\n }\n\n rows.push(row)\n }\n\n return { rows, maxWidth }\n }\n\n /**\n * Return the configuration options as a plain object\n */\n toJSON() {\n return Object.fromEntries(\n Object.entries(this.#configSet).map(([field, def]) => [\n field,\n {\n type: def.type,\n ...(def.multiple ? { multiple: true } : {}),\n ...(def.delim ? { delim: def.delim } : {}),\n ...(def.short ? { short: def.short } : {}),\n ...(def.description ?\n { description: normalize(def.description) }\n : {}),\n ...(def.validate ? { validate: def.validate } : {}),\n ...(def.validOptions ? { validOptions: def.validOptions } : {}),\n ...(def.default !== undefined ? { default: def.default } : {}),\n ...(def.hint ? { hint: def.hint } : {}),\n },\n ]),\n )\n }\n\n /**\n * Custom printer for `util.inspect`\n */\n [inspect.custom](_: number, options: InspectOptions) {\n return `Jack ${inspect(this.toJSON(), options)}`\n }\n}\n\n/**\n * Main entry point. Create and return a {@link Jack} object.\n */\nexport const jack = (options: JackOptions = {}) => new Jack(options)\n\n// Unwrap and un-indent, so we can wrap description\n// strings however makes them look nice in the code.\nconst normalize = (s: string, pre = false) => {\n if (pre)\n // prepend a ZWSP to each line so cliui doesn't strip it.\n return s\n .split('\\n')\n .map(l => `\\u200b${l}`)\n .join('\\n')\n return s\n .split(/^\\s*```\\s*$/gm)\n .map((s, i) => {\n if (i % 2 === 1) {\n if (!s.trim()) {\n return `\\`\\`\\`\\n\\`\\`\\`\\n`\n }\n // outdent the ``` blocks, but preserve whitespace otherwise.\n const split = s.split('\\n')\n // throw out the \\n at the start and end\n split.pop()\n split.shift()\n const si = split.reduce((shortest, l) => {\n /* c8 ignore next */\n const ind = l.match(/^\\s*/)?.[0] ?? ''\n if (ind.length) return Math.min(ind.length, shortest)\n else return shortest\n }, Infinity)\n /* c8 ignore next */\n const i = isFinite(si) ? si : 0\n return (\n '\\n```\\n' +\n split.map(s => `\\u200b${s.substring(i)}`).join('\\n') +\n '\\n```\\n'\n )\n }\n return (\n s\n // remove single line breaks, except for lists\n .replace(/([^\\n])\\n[ \\t]*([^\\n])/g, (_, $1, $2) =>\n !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\\n${$2}`,\n )\n // normalize mid-line whitespace\n .replace(/([^\\n])[ \\t]+([^\\n])/g, '$1 $2')\n // two line breaks are enough\n .replace(/\\n{3,}/g, '\\n\\n')\n // remove any spaces at the start of a line\n .replace(/\\n[ \\t]+/g, '\\n')\n .trim()\n )\n })\n .join('\\n')\n}\n\n// normalize for markdown printing, remove leading spaces on lines\nconst normalizeMarkdown = (s: string, pre: boolean = false): string => {\n const n = normalize(s, pre).replace(/\\\\/g, '\\\\\\\\')\n return pre ?\n `\\`\\`\\`\\n${n.replace(/\\u200b/g, '')}\\n\\`\\`\\``\n : n.replace(/\\n +/g, '\\n').trim()\n}\n\nconst normalizeOneLine = (s: string, pre: boolean = false) => {\n const n = normalize(s, pre)\n .replace(/[\\s\\u200b]+/g, ' ')\n .trim()\n return pre ? `\\`${n}\\`` : n\n}\n"]}
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/json-bigint/lib/parse.js ADDED
@@ -0,0 +1,443 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var BigNumber = null;
2
+
3
+ // regexpxs extracted from
4
+ // (c) BSD-3-Clause
5
+ // https://github.com/fastify/secure-json-parse/graphs/contributors and https://github.com/hapijs/bourne/graphs/contributors
6
+
7
+ const suspectProtoRx = /(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/;
8
+ const suspectConstructorRx = /(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;
9
+
10
+ /*
11
+ json_parse.js
12
+ 2012-06-20
13
+
14
+ Public Domain.
15
+
16
+ NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
17
+
18
+ This file creates a json_parse function.
19
+ During create you can (optionally) specify some behavioural switches
20
+
21
+ require('json-bigint')(options)
22
+
23
+ The optional options parameter holds switches that drive certain
24
+ aspects of the parsing process:
25
+ * options.strict = true will warn about duplicate-key usage in the json.
26
+ The default (strict = false) will silently ignore those and overwrite
27
+ values for keys that are in duplicate use.
28
+
29
+ The resulting function follows this signature:
30
+ json_parse(text, reviver)
31
+ This method parses a JSON text to produce an object or array.
32
+ It can throw a SyntaxError exception.
33
+
34
+ The optional reviver parameter is a function that can filter and
35
+ transform the results. It receives each of the keys and values,
36
+ and its return value is used instead of the original value.
37
+ If it returns what it received, then the structure is not modified.
38
+ If it returns undefined then the member is deleted.
39
+
40
+ Example:
41
+
42
+ // Parse the text. Values that look like ISO date strings will
43
+ // be converted to Date objects.
44
+
45
+ myData = json_parse(text, function (key, value) {
46
+ var a;
47
+ if (typeof value === 'string') {
48
+ a =
49
+ /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
50
+ if (a) {
51
+ return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
52
+ +a[5], +a[6]));
53
+ }
54
+ }
55
+ return value;
56
+ });
57
+
58
+ This is a reference implementation. You are free to copy, modify, or
59
+ redistribute.
60
+
61
+ This code should be minified before deployment.
62
+ See http://javascript.crockford.com/jsmin.html
63
+
64
+ USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
65
+ NOT CONTROL.
66
+ */
67
+
68
+ /*members "", "\"", "\/", "\\", at, b, call, charAt, f, fromCharCode,
69
+ hasOwnProperty, message, n, name, prototype, push, r, t, text
70
+ */
71
+
72
+ var json_parse = function (options) {
73
+ 'use strict';
74
+
75
+ // This is a function that can parse a JSON text, producing a JavaScript
76
+ // data structure. It is a simple, recursive descent parser. It does not use
77
+ // eval or regular expressions, so it can be used as a model for implementing
78
+ // a JSON parser in other languages.
79
+
80
+ // We are defining the function inside of another function to avoid creating
81
+ // global variables.
82
+
83
+ // Default options one can override by passing options to the parse()
84
+ var _options = {
85
+ strict: false, // not being strict means do not generate syntax errors for "duplicate key"
86
+ storeAsString: false, // toggles whether the values should be stored as BigNumber (default) or a string
87
+ alwaysParseAsBig: false, // toggles whether all numbers should be Big
88
+ useNativeBigInt: false, // toggles whether to use native BigInt instead of bignumber.js
89
+ protoAction: 'error',
90
+ constructorAction: 'error',
91
+ };
92
+
93
+ // If there are options, then use them to override the default _options
94
+ if (options !== undefined && options !== null) {
95
+ if (options.strict === true) {
96
+ _options.strict = true;
97
+ }
98
+ if (options.storeAsString === true) {
99
+ _options.storeAsString = true;
100
+ }
101
+ _options.alwaysParseAsBig =
102
+ options.alwaysParseAsBig === true ? options.alwaysParseAsBig : false;
103
+ _options.useNativeBigInt =
104
+ options.useNativeBigInt === true ? options.useNativeBigInt : false;
105
+
106
+ if (typeof options.constructorAction !== 'undefined') {
107
+ if (
108
+ options.constructorAction === 'error' ||
109
+ options.constructorAction === 'ignore' ||
110
+ options.constructorAction === 'preserve'
111
+ ) {
112
+ _options.constructorAction = options.constructorAction;
113
+ } else {
114
+ throw new Error(
115
+ `Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${options.constructorAction}`
116
+ );
117
+ }
118
+ }
119
+
120
+ if (typeof options.protoAction !== 'undefined') {
121
+ if (
122
+ options.protoAction === 'error' ||
123
+ options.protoAction === 'ignore' ||
124
+ options.protoAction === 'preserve'
125
+ ) {
126
+ _options.protoAction = options.protoAction;
127
+ } else {
128
+ throw new Error(
129
+ `Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${options.protoAction}`
130
+ );
131
+ }
132
+ }
133
+ }
134
+
135
+ var at, // The index of the current character
136
+ ch, // The current character
137
+ escapee = {
138
+ '"': '"',
139
+ '\\': '\\',
140
+ '/': '/',
141
+ b: '\b',
142
+ f: '\f',
143
+ n: '\n',
144
+ r: '\r',
145
+ t: '\t',
146
+ },
147
+ text,
148
+ error = function (m) {
149
+ // Call error when something is wrong.
150
+
151
+ throw {
152
+ name: 'SyntaxError',
153
+ message: m,
154
+ at: at,
155
+ text: text,
156
+ };
157
+ },
158
+ next = function (c) {
159
+ // If a c parameter is provided, verify that it matches the current character.
160
+
161
+ if (c && c !== ch) {
162
+ error("Expected '" + c + "' instead of '" + ch + "'");
163
+ }
164
+
165
+ // Get the next character. When there are no more characters,
166
+ // return the empty string.
167
+
168
+ ch = text.charAt(at);
169
+ at += 1;
170
+ return ch;
171
+ },
172
+ number = function () {
173
+ // Parse a number value.
174
+
175
+ var number,
176
+ string = '';
177
+
178
+ if (ch === '-') {
179
+ string = '-';
180
+ next('-');
181
+ }
182
+ while (ch >= '0' && ch <= '9') {
183
+ string += ch;
184
+ next();
185
+ }
186
+ if (ch === '.') {
187
+ string += '.';
188
+ while (next() && ch >= '0' && ch <= '9') {
189
+ string += ch;
190
+ }
191
+ }
192
+ if (ch === 'e' || ch === 'E') {
193
+ string += ch;
194
+ next();
195
+ if (ch === '-' || ch === '+') {
196
+ string += ch;
197
+ next();
198
+ }
199
+ while (ch >= '0' && ch <= '9') {
200
+ string += ch;
201
+ next();
202
+ }
203
+ }
204
+ number = +string;
205
+ if (!isFinite(number)) {
206
+ error('Bad number');
207
+ } else {
208
+ if (BigNumber == null) BigNumber = require('bignumber.js');
209
+ //if (number > 9007199254740992 || number < -9007199254740992)
210
+ // Bignumber has stricter check: everything with length > 15 digits disallowed
211
+ if (string.length > 15)
212
+ return _options.storeAsString
213
+ ? string
214
+ : _options.useNativeBigInt
215
+ ? BigInt(string)
216
+ : new BigNumber(string);
217
+ else
218
+ return !_options.alwaysParseAsBig
219
+ ? number
220
+ : _options.useNativeBigInt
221
+ ? BigInt(number)
222
+ : new BigNumber(number);
223
+ }
224
+ },
225
+ string = function () {
226
+ // Parse a string value.
227
+
228
+ var hex,
229
+ i,
230
+ string = '',
231
+ uffff;
232
+
233
+ // When parsing for string values, we must look for " and \ characters.
234
+
235
+ if (ch === '"') {
236
+ var startAt = at;
237
+ while (next()) {
238
+ if (ch === '"') {
239
+ if (at - 1 > startAt) string += text.substring(startAt, at - 1);
240
+ next();
241
+ return string;
242
+ }
243
+ if (ch === '\\') {
244
+ if (at - 1 > startAt) string += text.substring(startAt, at - 1);
245
+ next();
246
+ if (ch === 'u') {
247
+ uffff = 0;
248
+ for (i = 0; i < 4; i += 1) {
249
+ hex = parseInt(next(), 16);
250
+ if (!isFinite(hex)) {
251
+ break;
252
+ }
253
+ uffff = uffff * 16 + hex;
254
+ }
255
+ string += String.fromCharCode(uffff);
256
+ } else if (typeof escapee[ch] === 'string') {
257
+ string += escapee[ch];
258
+ } else {
259
+ break;
260
+ }
261
+ startAt = at;
262
+ }
263
+ }
264
+ }
265
+ error('Bad string');
266
+ },
267
+ white = function () {
268
+ // Skip whitespace.
269
+
270
+ while (ch && ch <= ' ') {
271
+ next();
272
+ }
273
+ },
274
+ word = function () {
275
+ // true, false, or null.
276
+
277
+ switch (ch) {
278
+ case 't':
279
+ next('t');
280
+ next('r');
281
+ next('u');
282
+ next('e');
283
+ return true;
284
+ case 'f':
285
+ next('f');
286
+ next('a');
287
+ next('l');
288
+ next('s');
289
+ next('e');
290
+ return false;
291
+ case 'n':
292
+ next('n');
293
+ next('u');
294
+ next('l');
295
+ next('l');
296
+ return null;
297
+ }
298
+ error("Unexpected '" + ch + "'");
299
+ },
300
+ value, // Place holder for the value function.
301
+ array = function () {
302
+ // Parse an array value.
303
+
304
+ var array = [];
305
+
306
+ if (ch === '[') {
307
+ next('[');
308
+ white();
309
+ if (ch === ']') {
310
+ next(']');
311
+ return array; // empty array
312
+ }
313
+ while (ch) {
314
+ array.push(value());
315
+ white();
316
+ if (ch === ']') {
317
+ next(']');
318
+ return array;
319
+ }
320
+ next(',');
321
+ white();
322
+ }
323
+ }
324
+ error('Bad array');
325
+ },
326
+ object = function () {
327
+ // Parse an object value.
328
+
329
+ var key,
330
+ object = Object.create(null);
331
+
332
+ if (ch === '{') {
333
+ next('{');
334
+ white();
335
+ if (ch === '}') {
336
+ next('}');
337
+ return object; // empty object
338
+ }
339
+ while (ch) {
340
+ key = string();
341
+ white();
342
+ next(':');
343
+ if (
344
+ _options.strict === true &&
345
+ Object.hasOwnProperty.call(object, key)
346
+ ) {
347
+ error('Duplicate key "' + key + '"');
348
+ }
349
+
350
+ if (suspectProtoRx.test(key) === true) {
351
+ if (_options.protoAction === 'error') {
352
+ error('Object contains forbidden prototype property');
353
+ } else if (_options.protoAction === 'ignore') {
354
+ value();
355
+ } else {
356
+ object[key] = value();
357
+ }
358
+ } else if (suspectConstructorRx.test(key) === true) {
359
+ if (_options.constructorAction === 'error') {
360
+ error('Object contains forbidden constructor property');
361
+ } else if (_options.constructorAction === 'ignore') {
362
+ value();
363
+ } else {
364
+ object[key] = value();
365
+ }
366
+ } else {
367
+ object[key] = value();
368
+ }
369
+
370
+ white();
371
+ if (ch === '}') {
372
+ next('}');
373
+ return object;
374
+ }
375
+ next(',');
376
+ white();
377
+ }
378
+ }
379
+ error('Bad object');
380
+ };
381
+
382
+ value = function () {
383
+ // Parse a JSON value. It could be an object, an array, a string, a number,
384
+ // or a word.
385
+
386
+ white();
387
+ switch (ch) {
388
+ case '{':
389
+ return object();
390
+ case '[':
391
+ return array();
392
+ case '"':
393
+ return string();
394
+ case '-':
395
+ return number();
396
+ default:
397
+ return ch >= '0' && ch <= '9' ? number() : word();
398
+ }
399
+ };
400
+
401
+ // Return the json_parse function. It will have access to all of the above
402
+ // functions and variables.
403
+
404
+ return function (source, reviver) {
405
+ var result;
406
+
407
+ text = source + '';
408
+ at = 0;
409
+ ch = ' ';
410
+ result = value();
411
+ white();
412
+ if (ch) {
413
+ error('Syntax error');
414
+ }
415
+
416
+ // If there is a reviver function, we recursively walk the new structure,
417
+ // passing each name/value pair to the reviver function for possible
418
+ // transformation, starting with a temporary root object that holds the result
419
+ // in an empty key. If there is not a reviver function, we simply return the
420
+ // result.
421
+
422
+ return typeof reviver === 'function'
423
+ ? (function walk(holder, key) {
424
+ var k,
425
+ v,
426
+ value = holder[key];
427
+ if (value && typeof value === 'object') {
428
+ Object.keys(value).forEach(function (k) {
429
+ v = walk(value, k);
430
+ if (v !== undefined) {
431
+ value[k] = v;
432
+ } else {
433
+ delete value[k];
434
+ }
435
+ });
436
+ }
437
+ return reviver.call(holder, key, value);
438
+ })({ '': result }, '')
439
+ : result;
440
+ };
441
+ };
442
+
443
+ module.exports = json_parse;
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/json-schema-ref-resolver/test/anchor.test.js ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict'
2
+
3
+ const assert = require('node:assert/strict')
4
+ const { test } = require('node:test')
5
+ const { RefResolver } = require('../index.js')
6
+
7
+ test('should get a sub schema by sub schema anchor', () => {
8
+ const refResolver = new RefResolver()
9
+
10
+ const schemaId = 'schemaId'
11
+ const subSchemaAnchor = '#subSchemaId'
12
+ const schema = {
13
+ $id: schemaId,
14
+ definitions: {
15
+ subSchema: {
16
+ $id: subSchemaAnchor,
17
+ type: 'object',
18
+ properties: {
19
+ foo: { type: 'string' }
20
+ }
21
+ }
22
+ }
23
+ }
24
+ refResolver.addSchema(schema)
25
+
26
+ const resolvedSchema = refResolver.getSchema(schemaId, subSchemaAnchor)
27
+ assert.equal(resolvedSchema, schema.definitions.subSchema)
28
+ })
29
+
30
+ test('should fail to find a schema using an anchor instead of schema id', () => {
31
+ const refResolver = new RefResolver()
32
+
33
+ const schemaId = 'schemaId'
34
+ const subSchemaAnchor = '#subSchemaId'
35
+ const schema = {
36
+ $id: schemaId,
37
+ definitions: {
38
+ subSchema: {
39
+ $id: subSchemaAnchor,
40
+ type: 'object',
41
+ properties: {
42
+ foo: { type: 'string' }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ refResolver.addSchema(schema)
48
+
49
+ try {
50
+ refResolver.getSchema(subSchemaAnchor)
51
+ } catch (err) {
52
+ assert.equal(
53
+ err.message, 'Cannot resolve ref "#subSchemaId#". Schema with id "#subSchemaId" is not found.'
54
+ )
55
+ }
56
+ })
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/json-schema-ref-resolver/test/deref-schema.test.js ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict'
2
+
3
+ const assert = require('node:assert/strict')
4
+ const { test } = require('node:test')
5
+ const { RefResolver } = require('../index.js')
6
+
7
+ test('should throw id schema not found', () => {
8
+ const refResolver = new RefResolver()
9
+
10
+ try {
11
+ refResolver.derefSchema('schemaId1')
12
+ } catch (err) {
13
+ assert.strictEqual(err.message, 'Schema with id "schemaId1" is not found.')
14
+ }
15
+ })
16
+
17
+ test('should throw id source schema has a key with a same key as ref schema, but diff value', () => {
18
+ const refResolver = new RefResolver()
19
+
20
+ const schemaId1 = 'schemaId1'
21
+ const schemaId2 = 'schemaId2'
22
+
23
+ const schema1 = {
24
+ $id: schemaId1,
25
+ $ref: schemaId2,
26
+ properties: {
27
+ foo: { type: 'string' }
28
+ }
29
+ }
30
+
31
+ const schema2 = {
32
+ $id: schemaId2,
33
+ type: 'object',
34
+ properties: {
35
+ foo: { type: 'number' }
36
+ }
37
+ }
38
+
39
+ refResolver.addSchema(schema1)
40
+ refResolver.addSchema(schema2)
41
+
42
+ try {
43
+ refResolver.derefSchema('schemaId1')
44
+ assert.fail('should throw error')
45
+ } catch (err) {
46
+ assert.strictEqual(
47
+ err.message,
48
+ 'Cannot resolve ref "schemaId2". Property "properties" already exists in schema "schemaId1".'
49
+ )
50
+ }
51
+ })
52
+
53
+ test('should not throw id source schema has a key with a same key and value as ref schema', () => {
54
+ const refResolver = new RefResolver()
55
+
56
+ const schemaId1 = 'schemaId1'
57
+ const schemaId2 = 'schemaId2'
58
+
59
+ const schema1 = {
60
+ $id: schemaId1,
61
+ $ref: schemaId2,
62
+ properties: {
63
+ foo: { type: 'string' }
64
+ }
65
+ }
66
+
67
+ const schema2 = {
68
+ $id: schemaId2,
69
+ type: 'object',
70
+ properties: {
71
+ foo: { type: 'string' }
72
+ }
73
+ }
74
+
75
+ refResolver.addSchema(schema1)
76
+ refResolver.addSchema(schema2)
77
+
78
+ refResolver.derefSchema(schemaId1)
79
+
80
+ const derefSchema = refResolver.getDerefSchema(schemaId1)
81
+ assert.deepStrictEqual(derefSchema, {
82
+ $id: schemaId1,
83
+ type: 'object',
84
+ properties: {
85
+ foo: { type: 'string' }
86
+ }
87
+ })
88
+ })
89
+
90
+ test('should get deref schema from the cache', () => {
91
+ const refResolver = new RefResolver()
92
+
93
+ const schemaId1 = 'schemaId1'
94
+ const schemaId2 = 'schemaId2'
95
+
96
+ const schema1 = {
97
+ $id: schemaId1,
98
+ $ref: schemaId2,
99
+ properties: {
100
+ foo: { type: 'string' }
101
+ }
102
+ }
103
+
104
+ const schema2 = {
105
+ $id: schemaId2,
106
+ type: 'object',
107
+ properties: {
108
+ foo: { type: 'string' }
109
+ }
110
+ }
111
+
112
+ refResolver.addSchema(schema1)
113
+ refResolver.addSchema(schema2)
114
+
115
+ refResolver.derefSchema(schemaId1)
116
+ schema1.properties = {}
117
+ refResolver.derefSchema(schemaId1)
118
+
119
+ const derefSchema = refResolver.getDerefSchema(schemaId1)
120
+ assert.deepStrictEqual(derefSchema, {
121
+ $id: schemaId1,
122
+ type: 'object',
123
+ properties: {
124
+ foo: { type: 'string' }
125
+ }
126
+ })
127
+ })
128
+
129
+ test('should insert ref symbol', () => {
130
+ const refResolver = new RefResolver({
131
+ insertRefSymbol: true
132
+ })
133
+
134
+ const schemaId1 = 'schemaId1'
135
+ const schemaId2 = 'schemaId2'
136
+
137
+ const schema1 = {
138
+ $id: schemaId1,
139
+ $ref: schemaId2
140
+ }
141
+
142
+ const schema2 = {
143
+ $id: schemaId2,
144
+ type: 'object',
145
+ properties: {
146
+ foo: { type: 'string' }
147
+ }
148
+ }
149
+
150
+ refResolver.addSchema(schema1)
151
+ refResolver.addSchema(schema2)
152
+
153
+ refResolver.derefSchema(schemaId1)
154
+
155
+ const derefSchema = refResolver.getDerefSchema(schemaId1)
156
+ assert.deepStrictEqual(derefSchema, {
157
+ $id: schemaId1,
158
+ type: 'object',
159
+ properties: {
160
+ foo: { type: 'string' }
161
+ },
162
+ [Symbol.for('json-schema-ref')]: schemaId2
163
+ })
164
+ })
165
+
166
+ test('should clone schema without refs', () => {
167
+ const refResolver = new RefResolver({
168
+ cloneSchemaWithoutRefs: true
169
+ })
170
+
171
+ const schemaId = 'schemaId2'
172
+
173
+ const schema = {
174
+ $id: schemaId,
175
+ type: 'object',
176
+ properties: {
177
+ foo: { type: 'string' }
178
+ }
179
+ }
180
+
181
+ refResolver.addSchema(schema)
182
+ refResolver.derefSchema(schemaId)
183
+
184
+ schema.properties = null
185
+
186
+ const derefSchema = refResolver.getDerefSchema(schemaId)
187
+ assert.deepStrictEqual(derefSchema, {
188
+ $id: schemaId,
189
+ type: 'object',
190
+ properties: {
191
+ foo: { type: 'string' }
192
+ }
193
+ })
194
+ })
195
+
196
+ test('should throw if target ref schema is not found', () => {
197
+ const inputSchema = {
198
+ $id: 'http://example.com/root.json',
199
+ definitions: {
200
+ A: { $id: '#foo' },
201
+ B: {
202
+ $id: 'other.json',
203
+ definitions: {
204
+ X: { $id: '#bar', type: 'string' },
205
+ Y: { $id: 't/inner.json' }
206
+ }
207
+ },
208
+ C: {
209
+ $id: 'urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f',
210
+ type: 'object'
211
+ }
212
+ }
213
+ }
214
+
215
+ const addresSchema = {
216
+ $id: 'relativeAddress', // Note: prefer always absolute URI like: http://mysite.com
217
+ type: 'object',
218
+ properties: {
219
+ zip: { $ref: 'urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f' },
220
+ city2: { $ref: '#foo' }
221
+ }
222
+ }
223
+
224
+ const refResolver = new RefResolver()
225
+ refResolver.addSchema(inputSchema)
226
+ refResolver.addSchema(addresSchema)
227
+
228
+ try {
229
+ refResolver.derefSchema('relativeAddress')
230
+ } catch (error) {
231
+ assert.strictEqual(
232
+ error.message,
233
+ 'Cannot resolve ref "#foo". Ref "#foo" is not found in schema "relativeAddress".'
234
+ )
235
+ }
236
+ })
237
+
238
+ test('should deref schema without root $id', () => {
239
+ const refResolver = new RefResolver()
240
+
241
+ const schemaId = 'schemaId1'
242
+ const schema = {
243
+ type: 'object',
244
+ definitions: {
245
+ id1: {
246
+ type: 'object',
247
+ properties: {
248
+ id1: {
249
+ type: 'integer'
250
+ }
251
+ }
252
+ }
253
+ },
254
+ allOf: [
255
+ {
256
+ $ref: '#/definitions/id1'
257
+ }
258
+ ]
259
+ }
260
+
261
+ refResolver.addSchema(schema, schemaId)
262
+ const derefSchema = refResolver.getDerefSchema(schemaId)
263
+
264
+ assert.deepStrictEqual(derefSchema, {
265
+ type: 'object',
266
+ definitions: {
267
+ id1: {
268
+ type: 'object',
269
+ properties: {
270
+ id1: {
271
+ type: 'integer'
272
+ }
273
+ }
274
+ }
275
+ },
276
+ allOf: [
277
+ {
278
+ type: 'object',
279
+ properties: {
280
+ id1: {
281
+ type: 'integer'
282
+ }
283
+ }
284
+ }
285
+ ]
286
+ })
287
+ })
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/json5/lib/parse.js ADDED
@@ -0,0 +1,1114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const util = require('./util')
2
+
3
+ let source
4
+ let parseState
5
+ let stack
6
+ let pos
7
+ let line
8
+ let column
9
+ let token
10
+ let key
11
+ let root
12
+
13
+ module.exports = function parse (text, reviver) {
14
+ source = String(text)
15
+ parseState = 'start'
16
+ stack = []
17
+ pos = 0
18
+ line = 1
19
+ column = 0
20
+ token = undefined
21
+ key = undefined
22
+ root = undefined
23
+
24
+ do {
25
+ token = lex()
26
+
27
+ // This code is unreachable.
28
+ // if (!parseStates[parseState]) {
29
+ // throw invalidParseState()
30
+ // }
31
+
32
+ parseStates[parseState]()
33
+ } while (token.type !== 'eof')
34
+
35
+ if (typeof reviver === 'function') {
36
+ return internalize({'': root}, '', reviver)
37
+ }
38
+
39
+ return root
40
+ }
41
+
42
+ function internalize (holder, name, reviver) {
43
+ const value = holder[name]
44
+ if (value != null && typeof value === 'object') {
45
+ if (Array.isArray(value)) {
46
+ for (let i = 0; i < value.length; i++) {
47
+ const key = String(i)
48
+ const replacement = internalize(value, key, reviver)
49
+ if (replacement === undefined) {
50
+ delete value[key]
51
+ } else {
52
+ Object.defineProperty(value, key, {
53
+ value: replacement,
54
+ writable: true,
55
+ enumerable: true,
56
+ configurable: true,
57
+ })
58
+ }
59
+ }
60
+ } else {
61
+ for (const key in value) {
62
+ const replacement = internalize(value, key, reviver)
63
+ if (replacement === undefined) {
64
+ delete value[key]
65
+ } else {
66
+ Object.defineProperty(value, key, {
67
+ value: replacement,
68
+ writable: true,
69
+ enumerable: true,
70
+ configurable: true,
71
+ })
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ return reviver.call(holder, name, value)
78
+ }
79
+
80
+ let lexState
81
+ let buffer
82
+ let doubleQuote
83
+ let sign
84
+ let c
85
+
86
+ function lex () {
87
+ lexState = 'default'
88
+ buffer = ''
89
+ doubleQuote = false
90
+ sign = 1
91
+
92
+ for (;;) {
93
+ c = peek()
94
+
95
+ // This code is unreachable.
96
+ // if (!lexStates[lexState]) {
97
+ // throw invalidLexState(lexState)
98
+ // }
99
+
100
+ const token = lexStates[lexState]()
101
+ if (token) {
102
+ return token
103
+ }
104
+ }
105
+ }
106
+
107
+ function peek () {
108
+ if (source[pos]) {
109
+ return String.fromCodePoint(source.codePointAt(pos))
110
+ }
111
+ }
112
+
113
+ function read () {
114
+ const c = peek()
115
+
116
+ if (c === '\n') {
117
+ line++
118
+ column = 0
119
+ } else if (c) {
120
+ column += c.length
121
+ } else {
122
+ column++
123
+ }
124
+
125
+ if (c) {
126
+ pos += c.length
127
+ }
128
+
129
+ return c
130
+ }
131
+
132
+ const lexStates = {
133
+ default () {
134
+ switch (c) {
135
+ case '\t':
136
+ case '\v':
137
+ case '\f':
138
+ case ' ':
139
+ case '\u00A0':
140
+ case '\uFEFF':
141
+ case '\n':
142
+ case '\r':
143
+ case '\u2028':
144
+ case '\u2029':
145
+ read()
146
+ return
147
+
148
+ case '/':
149
+ read()
150
+ lexState = 'comment'
151
+ return
152
+
153
+ case undefined:
154
+ read()
155
+ return newToken('eof')
156
+ }
157
+
158
+ if (util.isSpaceSeparator(c)) {
159
+ read()
160
+ return
161
+ }
162
+
163
+ // This code is unreachable.
164
+ // if (!lexStates[parseState]) {
165
+ // throw invalidLexState(parseState)
166
+ // }
167
+
168
+ return lexStates[parseState]()
169
+ },
170
+
171
+ comment () {
172
+ switch (c) {
173
+ case '*':
174
+ read()
175
+ lexState = 'multiLineComment'
176
+ return
177
+
178
+ case '/':
179
+ read()
180
+ lexState = 'singleLineComment'
181
+ return
182
+ }
183
+
184
+ throw invalidChar(read())
185
+ },
186
+
187
+ multiLineComment () {
188
+ switch (c) {
189
+ case '*':
190
+ read()
191
+ lexState = 'multiLineCommentAsterisk'
192
+ return
193
+
194
+ case undefined:
195
+ throw invalidChar(read())
196
+ }
197
+
198
+ read()
199
+ },
200
+
201
+ multiLineCommentAsterisk () {
202
+ switch (c) {
203
+ case '*':
204
+ read()
205
+ return
206
+
207
+ case '/':
208
+ read()
209
+ lexState = 'default'
210
+ return
211
+
212
+ case undefined:
213
+ throw invalidChar(read())
214
+ }
215
+
216
+ read()
217
+ lexState = 'multiLineComment'
218
+ },
219
+
220
+ singleLineComment () {
221
+ switch (c) {
222
+ case '\n':
223
+ case '\r':
224
+ case '\u2028':
225
+ case '\u2029':
226
+ read()
227
+ lexState = 'default'
228
+ return
229
+
230
+ case undefined:
231
+ read()
232
+ return newToken('eof')
233
+ }
234
+
235
+ read()
236
+ },
237
+
238
+ value () {
239
+ switch (c) {
240
+ case '{':
241
+ case '[':
242
+ return newToken('punctuator', read())
243
+
244
+ case 'n':
245
+ read()
246
+ literal('ull')
247
+ return newToken('null', null)
248
+
249
+ case 't':
250
+ read()
251
+ literal('rue')
252
+ return newToken('boolean', true)
253
+
254
+ case 'f':
255
+ read()
256
+ literal('alse')
257
+ return newToken('boolean', false)
258
+
259
+ case '-':
260
+ case '+':
261
+ if (read() === '-') {
262
+ sign = -1
263
+ }
264
+
265
+ lexState = 'sign'
266
+ return
267
+
268
+ case '.':
269
+ buffer = read()
270
+ lexState = 'decimalPointLeading'
271
+ return
272
+
273
+ case '0':
274
+ buffer = read()
275
+ lexState = 'zero'
276
+ return
277
+
278
+ case '1':
279
+ case '2':
280
+ case '3':
281
+ case '4':
282
+ case '5':
283
+ case '6':
284
+ case '7':
285
+ case '8':
286
+ case '9':
287
+ buffer = read()
288
+ lexState = 'decimalInteger'
289
+ return
290
+
291
+ case 'I':
292
+ read()
293
+ literal('nfinity')
294
+ return newToken('numeric', Infinity)
295
+
296
+ case 'N':
297
+ read()
298
+ literal('aN')
299
+ return newToken('numeric', NaN)
300
+
301
+ case '"':
302
+ case "'":
303
+ doubleQuote = (read() === '"')
304
+ buffer = ''
305
+ lexState = 'string'
306
+ return
307
+ }
308
+
309
+ throw invalidChar(read())
310
+ },
311
+
312
+ identifierNameStartEscape () {
313
+ if (c !== 'u') {
314
+ throw invalidChar(read())
315
+ }
316
+
317
+ read()
318
+ const u = unicodeEscape()
319
+ switch (u) {
320
+ case '$':
321
+ case '_':
322
+ break
323
+
324
+ default:
325
+ if (!util.isIdStartChar(u)) {
326
+ throw invalidIdentifier()
327
+ }
328
+
329
+ break
330
+ }
331
+
332
+ buffer += u
333
+ lexState = 'identifierName'
334
+ },
335
+
336
+ identifierName () {
337
+ switch (c) {
338
+ case '$':
339
+ case '_':
340
+ case '\u200C':
341
+ case '\u200D':
342
+ buffer += read()
343
+ return
344
+
345
+ case '\\':
346
+ read()
347
+ lexState = 'identifierNameEscape'
348
+ return
349
+ }
350
+
351
+ if (util.isIdContinueChar(c)) {
352
+ buffer += read()
353
+ return
354
+ }
355
+
356
+ return newToken('identifier', buffer)
357
+ },
358
+
359
+ identifierNameEscape () {
360
+ if (c !== 'u') {
361
+ throw invalidChar(read())
362
+ }
363
+
364
+ read()
365
+ const u = unicodeEscape()
366
+ switch (u) {
367
+ case '$':
368
+ case '_':
369
+ case '\u200C':
370
+ case '\u200D':
371
+ break
372
+
373
+ default:
374
+ if (!util.isIdContinueChar(u)) {
375
+ throw invalidIdentifier()
376
+ }
377
+
378
+ break
379
+ }
380
+
381
+ buffer += u
382
+ lexState = 'identifierName'
383
+ },
384
+
385
+ sign () {
386
+ switch (c) {
387
+ case '.':
388
+ buffer = read()
389
+ lexState = 'decimalPointLeading'
390
+ return
391
+
392
+ case '0':
393
+ buffer = read()
394
+ lexState = 'zero'
395
+ return
396
+
397
+ case '1':
398
+ case '2':
399
+ case '3':
400
+ case '4':
401
+ case '5':
402
+ case '6':
403
+ case '7':
404
+ case '8':
405
+ case '9':
406
+ buffer = read()
407
+ lexState = 'decimalInteger'
408
+ return
409
+
410
+ case 'I':
411
+ read()
412
+ literal('nfinity')
413
+ return newToken('numeric', sign * Infinity)
414
+
415
+ case 'N':
416
+ read()
417
+ literal('aN')
418
+ return newToken('numeric', NaN)
419
+ }
420
+
421
+ throw invalidChar(read())
422
+ },
423
+
424
+ zero () {
425
+ switch (c) {
426
+ case '.':
427
+ buffer += read()
428
+ lexState = 'decimalPoint'
429
+ return
430
+
431
+ case 'e':
432
+ case 'E':
433
+ buffer += read()
434
+ lexState = 'decimalExponent'
435
+ return
436
+
437
+ case 'x':
438
+ case 'X':
439
+ buffer += read()
440
+ lexState = 'hexadecimal'
441
+ return
442
+ }
443
+
444
+ return newToken('numeric', sign * 0)
445
+ },
446
+
447
+ decimalInteger () {
448
+ switch (c) {
449
+ case '.':
450
+ buffer += read()
451
+ lexState = 'decimalPoint'
452
+ return
453
+
454
+ case 'e':
455
+ case 'E':
456
+ buffer += read()
457
+ lexState = 'decimalExponent'
458
+ return
459
+ }
460
+
461
+ if (util.isDigit(c)) {
462
+ buffer += read()
463
+ return
464
+ }
465
+
466
+ return newToken('numeric', sign * Number(buffer))
467
+ },
468
+
469
+ decimalPointLeading () {
470
+ if (util.isDigit(c)) {
471
+ buffer += read()
472
+ lexState = 'decimalFraction'
473
+ return
474
+ }
475
+
476
+ throw invalidChar(read())
477
+ },
478
+
479
+ decimalPoint () {
480
+ switch (c) {
481
+ case 'e':
482
+ case 'E':
483
+ buffer += read()
484
+ lexState = 'decimalExponent'
485
+ return
486
+ }
487
+
488
+ if (util.isDigit(c)) {
489
+ buffer += read()
490
+ lexState = 'decimalFraction'
491
+ return
492
+ }
493
+
494
+ return newToken('numeric', sign * Number(buffer))
495
+ },
496
+
497
+ decimalFraction () {
498
+ switch (c) {
499
+ case 'e':
500
+ case 'E':
501
+ buffer += read()
502
+ lexState = 'decimalExponent'
503
+ return
504
+ }
505
+
506
+ if (util.isDigit(c)) {
507
+ buffer += read()
508
+ return
509
+ }
510
+
511
+ return newToken('numeric', sign * Number(buffer))
512
+ },
513
+
514
+ decimalExponent () {
515
+ switch (c) {
516
+ case '+':
517
+ case '-':
518
+ buffer += read()
519
+ lexState = 'decimalExponentSign'
520
+ return
521
+ }
522
+
523
+ if (util.isDigit(c)) {
524
+ buffer += read()
525
+ lexState = 'decimalExponentInteger'
526
+ return
527
+ }
528
+
529
+ throw invalidChar(read())
530
+ },
531
+
532
+ decimalExponentSign () {
533
+ if (util.isDigit(c)) {
534
+ buffer += read()
535
+ lexState = 'decimalExponentInteger'
536
+ return
537
+ }
538
+
539
+ throw invalidChar(read())
540
+ },
541
+
542
+ decimalExponentInteger () {
543
+ if (util.isDigit(c)) {
544
+ buffer += read()
545
+ return
546
+ }
547
+
548
+ return newToken('numeric', sign * Number(buffer))
549
+ },
550
+
551
+ hexadecimal () {
552
+ if (util.isHexDigit(c)) {
553
+ buffer += read()
554
+ lexState = 'hexadecimalInteger'
555
+ return
556
+ }
557
+
558
+ throw invalidChar(read())
559
+ },
560
+
561
+ hexadecimalInteger () {
562
+ if (util.isHexDigit(c)) {
563
+ buffer += read()
564
+ return
565
+ }
566
+
567
+ return newToken('numeric', sign * Number(buffer))
568
+ },
569
+
570
+ string () {
571
+ switch (c) {
572
+ case '\\':
573
+ read()
574
+ buffer += escape()
575
+ return
576
+
577
+ case '"':
578
+ if (doubleQuote) {
579
+ read()
580
+ return newToken('string', buffer)
581
+ }
582
+
583
+ buffer += read()
584
+ return
585
+
586
+ case "'":
587
+ if (!doubleQuote) {
588
+ read()
589
+ return newToken('string', buffer)
590
+ }
591
+
592
+ buffer += read()
593
+ return
594
+
595
+ case '\n':
596
+ case '\r':
597
+ throw invalidChar(read())
598
+
599
+ case '\u2028':
600
+ case '\u2029':
601
+ separatorChar(c)
602
+ break
603
+
604
+ case undefined:
605
+ throw invalidChar(read())
606
+ }
607
+
608
+ buffer += read()
609
+ },
610
+
611
+ start () {
612
+ switch (c) {
613
+ case '{':
614
+ case '[':
615
+ return newToken('punctuator', read())
616
+
617
+ // This code is unreachable since the default lexState handles eof.
618
+ // case undefined:
619
+ // return newToken('eof')
620
+ }
621
+
622
+ lexState = 'value'
623
+ },
624
+
625
+ beforePropertyName () {
626
+ switch (c) {
627
+ case '$':
628
+ case '_':
629
+ buffer = read()
630
+ lexState = 'identifierName'
631
+ return
632
+
633
+ case '\\':
634
+ read()
635
+ lexState = 'identifierNameStartEscape'
636
+ return
637
+
638
+ case '}':
639
+ return newToken('punctuator', read())
640
+
641
+ case '"':
642
+ case "'":
643
+ doubleQuote = (read() === '"')
644
+ lexState = 'string'
645
+ return
646
+ }
647
+
648
+ if (util.isIdStartChar(c)) {
649
+ buffer += read()
650
+ lexState = 'identifierName'
651
+ return
652
+ }
653
+
654
+ throw invalidChar(read())
655
+ },
656
+
657
+ afterPropertyName () {
658
+ if (c === ':') {
659
+ return newToken('punctuator', read())
660
+ }
661
+
662
+ throw invalidChar(read())
663
+ },
664
+
665
+ beforePropertyValue () {
666
+ lexState = 'value'
667
+ },
668
+
669
+ afterPropertyValue () {
670
+ switch (c) {
671
+ case ',':
672
+ case '}':
673
+ return newToken('punctuator', read())
674
+ }
675
+
676
+ throw invalidChar(read())
677
+ },
678
+
679
+ beforeArrayValue () {
680
+ if (c === ']') {
681
+ return newToken('punctuator', read())
682
+ }
683
+
684
+ lexState = 'value'
685
+ },
686
+
687
+ afterArrayValue () {
688
+ switch (c) {
689
+ case ',':
690
+ case ']':
691
+ return newToken('punctuator', read())
692
+ }
693
+
694
+ throw invalidChar(read())
695
+ },
696
+
697
+ end () {
698
+ // This code is unreachable since it's handled by the default lexState.
699
+ // if (c === undefined) {
700
+ // read()
701
+ // return newToken('eof')
702
+ // }
703
+
704
+ throw invalidChar(read())
705
+ },
706
+ }
707
+
708
+ function newToken (type, value) {
709
+ return {
710
+ type,
711
+ value,
712
+ line,
713
+ column,
714
+ }
715
+ }
716
+
717
+ function literal (s) {
718
+ for (const c of s) {
719
+ const p = peek()
720
+
721
+ if (p !== c) {
722
+ throw invalidChar(read())
723
+ }
724
+
725
+ read()
726
+ }
727
+ }
728
+
729
+ function escape () {
730
+ const c = peek()
731
+ switch (c) {
732
+ case 'b':
733
+ read()
734
+ return '\b'
735
+
736
+ case 'f':
737
+ read()
738
+ return '\f'
739
+
740
+ case 'n':
741
+ read()
742
+ return '\n'
743
+
744
+ case 'r':
745
+ read()
746
+ return '\r'
747
+
748
+ case 't':
749
+ read()
750
+ return '\t'
751
+
752
+ case 'v':
753
+ read()
754
+ return '\v'
755
+
756
+ case '0':
757
+ read()
758
+ if (util.isDigit(peek())) {
759
+ throw invalidChar(read())
760
+ }
761
+
762
+ return '\0'
763
+
764
+ case 'x':
765
+ read()
766
+ return hexEscape()
767
+
768
+ case 'u':
769
+ read()
770
+ return unicodeEscape()
771
+
772
+ case '\n':
773
+ case '\u2028':
774
+ case '\u2029':
775
+ read()
776
+ return ''
777
+
778
+ case '\r':
779
+ read()
780
+ if (peek() === '\n') {
781
+ read()
782
+ }
783
+
784
+ return ''
785
+
786
+ case '1':
787
+ case '2':
788
+ case '3':
789
+ case '4':
790
+ case '5':
791
+ case '6':
792
+ case '7':
793
+ case '8':
794
+ case '9':
795
+ throw invalidChar(read())
796
+
797
+ case undefined:
798
+ throw invalidChar(read())
799
+ }
800
+
801
+ return read()
802
+ }
803
+
804
+ function hexEscape () {
805
+ let buffer = ''
806
+ let c = peek()
807
+
808
+ if (!util.isHexDigit(c)) {
809
+ throw invalidChar(read())
810
+ }
811
+
812
+ buffer += read()
813
+
814
+ c = peek()
815
+ if (!util.isHexDigit(c)) {
816
+ throw invalidChar(read())
817
+ }
818
+
819
+ buffer += read()
820
+
821
+ return String.fromCodePoint(parseInt(buffer, 16))
822
+ }
823
+
824
+ function unicodeEscape () {
825
+ let buffer = ''
826
+ let count = 4
827
+
828
+ while (count-- > 0) {
829
+ const c = peek()
830
+ if (!util.isHexDigit(c)) {
831
+ throw invalidChar(read())
832
+ }
833
+
834
+ buffer += read()
835
+ }
836
+
837
+ return String.fromCodePoint(parseInt(buffer, 16))
838
+ }
839
+
840
+ const parseStates = {
841
+ start () {
842
+ if (token.type === 'eof') {
843
+ throw invalidEOF()
844
+ }
845
+
846
+ push()
847
+ },
848
+
849
+ beforePropertyName () {
850
+ switch (token.type) {
851
+ case 'identifier':
852
+ case 'string':
853
+ key = token.value
854
+ parseState = 'afterPropertyName'
855
+ return
856
+
857
+ case 'punctuator':
858
+ // This code is unreachable since it's handled by the lexState.
859
+ // if (token.value !== '}') {
860
+ // throw invalidToken()
861
+ // }
862
+
863
+ pop()
864
+ return
865
+
866
+ case 'eof':
867
+ throw invalidEOF()
868
+ }
869
+
870
+ // This code is unreachable since it's handled by the lexState.
871
+ // throw invalidToken()
872
+ },
873
+
874
+ afterPropertyName () {
875
+ // This code is unreachable since it's handled by the lexState.
876
+ // if (token.type !== 'punctuator' || token.value !== ':') {
877
+ // throw invalidToken()
878
+ // }
879
+
880
+ if (token.type === 'eof') {
881
+ throw invalidEOF()
882
+ }
883
+
884
+ parseState = 'beforePropertyValue'
885
+ },
886
+
887
+ beforePropertyValue () {
888
+ if (token.type === 'eof') {
889
+ throw invalidEOF()
890
+ }
891
+
892
+ push()
893
+ },
894
+
895
+ beforeArrayValue () {
896
+ if (token.type === 'eof') {
897
+ throw invalidEOF()
898
+ }
899
+
900
+ if (token.type === 'punctuator' && token.value === ']') {
901
+ pop()
902
+ return
903
+ }
904
+
905
+ push()
906
+ },
907
+
908
+ afterPropertyValue () {
909
+ // This code is unreachable since it's handled by the lexState.
910
+ // if (token.type !== 'punctuator') {
911
+ // throw invalidToken()
912
+ // }
913
+
914
+ if (token.type === 'eof') {
915
+ throw invalidEOF()
916
+ }
917
+
918
+ switch (token.value) {
919
+ case ',':
920
+ parseState = 'beforePropertyName'
921
+ return
922
+
923
+ case '}':
924
+ pop()
925
+ }
926
+
927
+ // This code is unreachable since it's handled by the lexState.
928
+ // throw invalidToken()
929
+ },
930
+
931
+ afterArrayValue () {
932
+ // This code is unreachable since it's handled by the lexState.
933
+ // if (token.type !== 'punctuator') {
934
+ // throw invalidToken()
935
+ // }
936
+
937
+ if (token.type === 'eof') {
938
+ throw invalidEOF()
939
+ }
940
+
941
+ switch (token.value) {
942
+ case ',':
943
+ parseState = 'beforeArrayValue'
944
+ return
945
+
946
+ case ']':
947
+ pop()
948
+ }
949
+
950
+ // This code is unreachable since it's handled by the lexState.
951
+ // throw invalidToken()
952
+ },
953
+
954
+ end () {
955
+ // This code is unreachable since it's handled by the lexState.
956
+ // if (token.type !== 'eof') {
957
+ // throw invalidToken()
958
+ // }
959
+ },
960
+ }
961
+
962
+ function push () {
963
+ let value
964
+
965
+ switch (token.type) {
966
+ case 'punctuator':
967
+ switch (token.value) {
968
+ case '{':
969
+ value = {}
970
+ break
971
+
972
+ case '[':
973
+ value = []
974
+ break
975
+ }
976
+
977
+ break
978
+
979
+ case 'null':
980
+ case 'boolean':
981
+ case 'numeric':
982
+ case 'string':
983
+ value = token.value
984
+ break
985
+
986
+ // This code is unreachable.
987
+ // default:
988
+ // throw invalidToken()
989
+ }
990
+
991
+ if (root === undefined) {
992
+ root = value
993
+ } else {
994
+ const parent = stack[stack.length - 1]
995
+ if (Array.isArray(parent)) {
996
+ parent.push(value)
997
+ } else {
998
+ Object.defineProperty(parent, key, {
999
+ value,
1000
+ writable: true,
1001
+ enumerable: true,
1002
+ configurable: true,
1003
+ })
1004
+ }
1005
+ }
1006
+
1007
+ if (value !== null && typeof value === 'object') {
1008
+ stack.push(value)
1009
+
1010
+ if (Array.isArray(value)) {
1011
+ parseState = 'beforeArrayValue'
1012
+ } else {
1013
+ parseState = 'beforePropertyName'
1014
+ }
1015
+ } else {
1016
+ const current = stack[stack.length - 1]
1017
+ if (current == null) {
1018
+ parseState = 'end'
1019
+ } else if (Array.isArray(current)) {
1020
+ parseState = 'afterArrayValue'
1021
+ } else {
1022
+ parseState = 'afterPropertyValue'
1023
+ }
1024
+ }
1025
+ }
1026
+
1027
+ function pop () {
1028
+ stack.pop()
1029
+
1030
+ const current = stack[stack.length - 1]
1031
+ if (current == null) {
1032
+ parseState = 'end'
1033
+ } else if (Array.isArray(current)) {
1034
+ parseState = 'afterArrayValue'
1035
+ } else {
1036
+ parseState = 'afterPropertyValue'
1037
+ }
1038
+ }
1039
+
1040
+ // This code is unreachable.
1041
+ // function invalidParseState () {
1042
+ // return new Error(`JSON5: invalid parse state '${parseState}'`)
1043
+ // }
1044
+
1045
+ // This code is unreachable.
1046
+ // function invalidLexState (state) {
1047
+ // return new Error(`JSON5: invalid lex state '${state}'`)
1048
+ // }
1049
+
1050
+ function invalidChar (c) {
1051
+ if (c === undefined) {
1052
+ return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
1053
+ }
1054
+
1055
+ return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
1056
+ }
1057
+
1058
+ function invalidEOF () {
1059
+ return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
1060
+ }
1061
+
1062
+ // This code is unreachable.
1063
+ // function invalidToken () {
1064
+ // if (token.type === 'eof') {
1065
+ // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
1066
+ // }
1067
+
1068
+ // const c = String.fromCodePoint(token.value.codePointAt(0))
1069
+ // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
1070
+ // }
1071
+
1072
+ function invalidIdentifier () {
1073
+ column -= 5
1074
+ return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`)
1075
+ }
1076
+
1077
+ function separatorChar (c) {
1078
+ console.warn(`JSON5: '${formatChar(c)}' in strings is not valid ECMAScript; consider escaping`)
1079
+ }
1080
+
1081
+ function formatChar (c) {
1082
+ const replacements = {
1083
+ "'": "\\'",
1084
+ '"': '\\"',
1085
+ '\\': '\\\\',
1086
+ '\b': '\\b',
1087
+ '\f': '\\f',
1088
+ '\n': '\\n',
1089
+ '\r': '\\r',
1090
+ '\t': '\\t',
1091
+ '\v': '\\v',
1092
+ '\0': '\\0',
1093
+ '\u2028': '\\u2028',
1094
+ '\u2029': '\\u2029',
1095
+ }
1096
+
1097
+ if (replacements[c]) {
1098
+ return replacements[c]
1099
+ }
1100
+
1101
+ if (c < ' ') {
1102
+ const hexString = c.charCodeAt(0).toString(16)
1103
+ return '\\x' + ('00' + hexString).substring(hexString.length)
1104
+ }
1105
+
1106
+ return c
1107
+ }
1108
+
1109
+ function syntaxError (message) {
1110
+ const err = new SyntaxError(message)
1111
+ err.lineNumber = line
1112
+ err.columnNumber = column
1113
+ return err
1114
+ }
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/jsonrepair/lib/esm/index.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ // Cross-platform, non-streaming JavaScript API
2
+ export { jsonrepair } from './regular/jsonrepair.js';
3
+ export { JSONRepairError } from './utils/JSONRepairError.js';
4
+ //# sourceMappingURL=index.js.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/jsonrepair/lib/types/regular/jsonrepair.d.ts ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Repair a string containing an invalid JSON document.
3
+ * For example changes JavaScript notation into JSON notation.
4
+ *
5
+ * Example:
6
+ *
7
+ * try {
8
+ * const json = "{name: 'John'}"
9
+ * const repaired = jsonrepair(json)
10
+ * console.log(repaired)
11
+ * // '{"name": "John"}'
12
+ * } catch (err) {
13
+ * console.error(err)
14
+ * }
15
+ *
16
+ */
17
+ export declare function jsonrepair(text: string): string;
18
+ //# sourceMappingURL=jsonrepair.d.ts.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/jsonrepair/lib/types/streaming/buffer/InputBuffer.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"InputBuffer.d.ts","sourceRoot":"","sources":["../../../../src/streaming/buffer/InputBuffer.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACjC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACrC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAA;IACjD,MAAM,EAAE,MAAM,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,MAAM,CAAA;IAC3B,iBAAiB,EAAE,MAAM,MAAM,CAAA;IAC/B,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACjC,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED,wBAAgB,iBAAiB,IAAI,WAAW,CAmF/C"}
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/jsonrepair/lib/types/utils/stringUtils.d.ts ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export declare function isHex(char: string): boolean;
2
+ export declare function isDigit(char: string): boolean;
3
+ export declare function isValidStringCharacter(char: string): boolean;
4
+ export declare function isDelimiter(char: string): boolean;
5
+ export declare function isFunctionNameCharStart(char: string): boolean;
6
+ export declare function isFunctionNameChar(char: string): boolean;
7
+ export declare const regexUrlStart: RegExp;
8
+ export declare const regexUrlChar: RegExp;
9
+ export declare function isUnquotedStringDelimiter(char: string): boolean;
10
+ export declare function isStartOfValue(char: string): boolean;
11
+ export declare function isControlCharacter(char: string): char is "\n" | "\r" | "\t" | "\b" | "\f";
12
+ export interface Text {
13
+ charCodeAt: (index: number) => number;
14
+ }
15
+ /**
16
+ * Check if the given character is a whitespace character like space, tab, or
17
+ * newline
18
+ */
19
+ export declare function isWhitespace(text: Text, index: number): boolean;
20
+ /**
21
+ * Check if the given character is a whitespace character like space or tab,
22
+ * but NOT a newline
23
+ */
24
+ export declare function isWhitespaceExceptNewline(text: Text, index: number): boolean;
25
+ /**
26
+ * Check if the given character is a special whitespace character, some
27
+ * unicode variant
28
+ */
29
+ export declare function isSpecialWhitespace(text: Text, index: number): boolean;
30
+ /**
31
+ * Test whether the given character is a quote or double quote character.
32
+ * Also tests for special variants of quotes.
33
+ */
34
+ export declare function isQuote(char: string): boolean;
35
+ /**
36
+ * Test whether the given character is a double quote character.
37
+ * Also tests for special variants of double quotes.
38
+ */
39
+ export declare function isDoubleQuoteLike(char: string): boolean;
40
+ /**
41
+ * Test whether the given character is a double quote character.
42
+ * Does NOT test for special variants of double quotes.
43
+ */
44
+ export declare function isDoubleQuote(char: string): boolean;
45
+ /**
46
+ * Test whether the given character is a single quote character.
47
+ * Also tests for special variants of single quotes.
48
+ */
49
+ export declare function isSingleQuoteLike(char: string): boolean;
50
+ /**
51
+ * Test whether the given character is a single quote character.
52
+ * Does NOT test for special variants of single quotes.
53
+ */
54
+ export declare function isSingleQuote(char: string): boolean;
55
+ /**
56
+ * Strip last occurrence of textToStrip from text
57
+ */
58
+ export declare function stripLastOccurrence(text: string, textToStrip: string, stripRemainingText?: boolean): string;
59
+ export declare function insertBeforeLastWhitespace(text: string, textToInsert: string): string;
60
+ export declare function removeAtIndex(text: string, start: number, count: number): string;
61
+ /**
62
+ * Test whether a string ends with a newline or comma character and optional whitespace
63
+ */
64
+ export declare function endsWithCommaOrNewline(text: string): boolean;
65
+ //# sourceMappingURL=stringUtils.d.ts.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/light-my-request/.github/workflows/benchmark.yml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Benchmark PR
2
+
3
+ on:
4
+ pull_request_target:
5
+ types:
6
+ - labeled
7
+
8
+ jobs:
9
+ benchmark:
10
+ if: ${{ github.event.label.name == 'benchmark' }}
11
+ uses: fastify/workflows/.github/workflows/plugins-benchmark-pr.yml@v5
12
+ with:
13
+ npm-script: benchmark
14
+
15
+ remove-label:
16
+ if: "always()"
17
+ needs:
18
+ - benchmark
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Remove benchmark label
22
+ uses: octokit/request-action@v2.x
23
+ id: remove-label
24
+ with:
25
+ route: DELETE /repos/{repo}/issues/{issue_number}/labels/{name}
26
+ repo: ${{ github.event.pull_request.head.repo.full_name }}
27
+ issue_number: ${{ github.event.pull_request.number }}
28
+ name: benchmark
29
+ env:
30
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/light-my-request/build/build-validation.js ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict'
2
+
3
+ const http = require('node:http')
4
+ const AjvStandaloneCompiler = require('@fastify/ajv-compiler/standalone')
5
+ const fs = require('node:fs')
6
+ const path = require('node:path')
7
+
8
+ const urlSchema = {
9
+ oneOf: [
10
+ { type: 'string' },
11
+ {
12
+ type: 'object',
13
+ properties: {
14
+ protocol: { type: 'string' },
15
+ hostname: { type: 'string' },
16
+ pathname: { type: 'string' }
17
+ // port type => any
18
+ // query type => any
19
+ },
20
+ additionalProperties: true,
21
+ required: ['pathname']
22
+ }
23
+ ]
24
+ }
25
+
26
+ const schema = {
27
+ type: 'object',
28
+ properties: {
29
+ url: urlSchema,
30
+ path: urlSchema,
31
+ cookies: {
32
+ type: 'object',
33
+ additionalProperties: true
34
+ },
35
+ headers: {
36
+ type: 'object',
37
+ additionalProperties: true
38
+ },
39
+ query: {
40
+ anyOf: [
41
+ {
42
+ type: 'object',
43
+ additionalProperties: true
44
+ },
45
+ {
46
+ type: 'string'
47
+ }
48
+ ]
49
+ },
50
+ simulate: {
51
+ type: 'object',
52
+ properties: {
53
+ end: { type: 'boolean' },
54
+ split: { type: 'boolean' },
55
+ error: { type: 'boolean' },
56
+ close: { type: 'boolean' }
57
+ }
58
+ },
59
+ authority: { type: 'string' },
60
+ remoteAddress: { type: 'string' },
61
+ method: { type: 'string', enum: http.METHODS.concat(http.METHODS.map(toLowerCase)) },
62
+ validate: { type: 'boolean' }
63
+ // payload type => any
64
+ },
65
+ additionalProperties: true,
66
+ oneOf: [
67
+ { required: ['url'] },
68
+ { required: ['path'] }
69
+ ]
70
+ }
71
+
72
+ function toLowerCase (m) { return m.toLowerCase() }
73
+
74
+ const factory = AjvStandaloneCompiler({
75
+ readMode: false,
76
+ storeFunction (routeOpts, schemaValidationCode) {
77
+ const moduleCode = `// This file is autogenerated by ${__filename.replace(__dirname, 'build')}, do not edit
78
+ /* c8 ignore start */
79
+ /* eslint-disable */
80
+ ${schemaValidationCode}
81
+ `
82
+ const file = path.join(__dirname, '..', 'lib', 'config-validator.js')
83
+ fs.writeFileSync(file, moduleCode)
84
+ console.log(`Saved ${file} file successfully`)
85
+ }
86
+ })
87
+
88
+ const compiler = factory({}, {
89
+ customOptions: {
90
+ code: {
91
+ source: true,
92
+ lines: true,
93
+ optimize: 3
94
+ },
95
+ removeAdditional: true,
96
+ coerceTypes: true
97
+ }
98
+ })
99
+
100
+ compiler({ schema })
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/light-my-request/node_modules/process-warning/.github/workflows/ci.yml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+ - next
9
+ - 'v*'
10
+ paths-ignore:
11
+ - 'docs/**'
12
+ - '*.md'
13
+ pull_request:
14
+ paths-ignore:
15
+ - 'docs/**'
16
+ - '*.md'
17
+
18
+ jobs:
19
+ test:
20
+ uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5
21
+ with:
22
+ license-check: true
23
+ lint: true
24
+ node-versions: '["16", "18", "20", "22"]'
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/light-my-request/node_modules/process-warning/eslint.config.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ 'use strict'
2
+
3
+ module.exports = require('neostandard')({
4
+ ignores: require('neostandard').resolveIgnoresFromGitignore(),
5
+ ts: true
6
+ })
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/light-my-request/node_modules/process-warning/test/no-warnings.test.js ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict'
2
+
3
+ const { test } = require('tap')
4
+ const { spawnSync } = require('node:child_process')
5
+ const { resolve } = require('node:path')
6
+
7
+ const entry = resolve(__dirname, '../examples', 'example.js')
8
+
9
+ test('--no-warnings is set in cli', t => {
10
+ t.plan(1)
11
+ const child = spawnSync(process.execPath, [
12
+ '--no-warnings',
13
+ entry
14
+ ])
15
+
16
+ const stderr = child.stderr.toString()
17
+ t.equal(stderr, '')
18
+ })
19
+
20
+ test('--no-warnings is not set in cli', t => {
21
+ t.plan(1)
22
+ const child = spawnSync(process.execPath, [
23
+ entry
24
+ ])
25
+
26
+ const stderr = child.stderr.toString()
27
+ t.match(stderr, /\[CUSTDEP001\] DeprecationWarning: This is a deprecation warning/)
28
+ })
29
+
30
+ test('NODE_NO_WARNINGS is set to 1', t => {
31
+ t.plan(1)
32
+ const child = spawnSync(process.execPath, [
33
+ entry
34
+ ], {
35
+ env: {
36
+ NODE_NO_WARNINGS: '1'
37
+ }
38
+ })
39
+
40
+ const stderr = child.stderr.toString()
41
+ t.equal(stderr, '')
42
+ })
43
+
44
+ test('NODE_NO_WARNINGS is set to 0', t => {
45
+ t.plan(1)
46
+ const child = spawnSync(process.execPath, [
47
+ entry
48
+ ], {
49
+ env: {
50
+ NODE_NO_WARNINGS: '0'
51
+ }
52
+ })
53
+
54
+ const stderr = child.stderr.toString()
55
+ t.match(stderr, /\[CUSTDEP001\] DeprecationWarning: This is a deprecation warning/)
56
+ })
57
+
58
+ test('NODE_NO_WARNINGS is not set', t => {
59
+ t.plan(1)
60
+ const child = spawnSync(process.execPath, [
61
+ entry
62
+ ])
63
+
64
+ const stderr = child.stderr.toString()
65
+ t.match(stderr, /\[CUSTDEP001\] DeprecationWarning: This is a deprecation warning/)
66
+ })
67
+
68
+ test('NODE_Options contains --no-warnings', t => {
69
+ t.plan(1)
70
+ const child = spawnSync(process.execPath, [
71
+ entry
72
+ ], {
73
+ env: {
74
+ NODE_OPTIONS: '--no-warnings'
75
+ }
76
+ })
77
+
78
+ const stderr = child.stderr.toString()
79
+ t.equal(stderr, '')
80
+ })
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/light-my-request/node_modules/process-warning/types/index.d.ts ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ declare namespace processWarning {
2
+ export interface WarningItem {
3
+ (a?: any, b?: any, c?: any): void;
4
+ name: string;
5
+ code: string;
6
+ message: string;
7
+ emitted: boolean;
8
+ unlimited: boolean;
9
+ format(a?: any, b?: any, c?: any): string;
10
+ }
11
+
12
+ export type WarningOptions = {
13
+ name: string;
14
+ code: string;
15
+ message: string;
16
+ unlimited?: boolean;
17
+ }
18
+
19
+ export type DeprecationOptions = Omit<WarningOptions, 'name'>
20
+
21
+ export type ProcessWarningOptions = {
22
+ unlimited?: boolean;
23
+ }
24
+
25
+ export type ProcessWarning = {
26
+ createWarning(params: WarningOptions): WarningItem;
27
+ createDeprecation(params: DeprecationOptions): WarningItem;
28
+ }
29
+
30
+ export function createWarning (params: WarningOptions): WarningItem
31
+ export function createDeprecation (params: DeprecationOptions): WarningItem
32
+
33
+ const processWarning: ProcessWarning
34
+ export { processWarning as default }
35
+ }
36
+
37
+ export = processWarning
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/commonjs/index.d.ts ADDED
@@ -0,0 +1,1306 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @module LRUCache
3
+ */
4
+ declare const TYPE: unique symbol;
5
+ export type PosInt = number & {
6
+ [TYPE]: 'Positive Integer';
7
+ };
8
+ export type Index = number & {
9
+ [TYPE]: 'LRUCache Index';
10
+ };
11
+ export type UintArray = Uint8Array | Uint16Array | Uint32Array;
12
+ export type NumberArray = UintArray | number[];
13
+ declare class ZeroArray extends Array<number> {
14
+ constructor(size: number);
15
+ }
16
+ export type { ZeroArray };
17
+ export type { Stack };
18
+ export type StackLike = Stack | Index[];
19
+ declare class Stack {
20
+ #private;
21
+ heap: NumberArray;
22
+ length: number;
23
+ static create(max: number): StackLike;
24
+ constructor(max: number, HeapCls: {
25
+ new (n: number): NumberArray;
26
+ });
27
+ push(n: Index): void;
28
+ pop(): Index;
29
+ }
30
+ /**
31
+ * Promise representing an in-progress {@link LRUCache#fetch} call
32
+ */
33
+ export type BackgroundFetch<V> = Promise<V | undefined> & {
34
+ __returned: BackgroundFetch<V> | undefined;
35
+ __abortController: AbortController;
36
+ __staleWhileFetching: V | undefined;
37
+ };
38
+ export type DisposeTask<K, V> = [
39
+ value: V,
40
+ key: K,
41
+ reason: LRUCache.DisposeReason
42
+ ];
43
+ export declare namespace LRUCache {
44
+ /**
45
+ * An integer greater than 0, reflecting the calculated size of items
46
+ */
47
+ type Size = number;
48
+ /**
49
+ * Integer greater than 0, representing some number of milliseconds, or the
50
+ * time at which a TTL started counting from.
51
+ */
52
+ type Milliseconds = number;
53
+ /**
54
+ * An integer greater than 0, reflecting a number of items
55
+ */
56
+ type Count = number;
57
+ /**
58
+ * The reason why an item was removed from the cache, passed
59
+ * to the {@link Disposer} methods.
60
+ *
61
+ * - `evict`: The item was evicted because it is the least recently used,
62
+ * and the cache is full.
63
+ * - `set`: A new value was set, overwriting the old value being disposed.
64
+ * - `delete`: The item was explicitly deleted, either by calling
65
+ * {@link LRUCache#delete}, {@link LRUCache#clear}, or
66
+ * {@link LRUCache#set} with an undefined value.
67
+ * - `expire`: The item was removed due to exceeding its TTL.
68
+ * - `fetch`: A {@link OptionsBase#fetchMethod} operation returned
69
+ * `undefined` or was aborted, causing the item to be deleted.
70
+ */
71
+ type DisposeReason = 'evict' | 'set' | 'delete' | 'expire' | 'fetch';
72
+ /**
73
+ * A method called upon item removal, passed as the
74
+ * {@link OptionsBase.dispose} and/or
75
+ * {@link OptionsBase.disposeAfter} options.
76
+ */
77
+ type Disposer<K, V> = (value: V, key: K, reason: DisposeReason) => void;
78
+ /**
79
+ * The reason why an item was added to the cache, passed
80
+ * to the {@link Inserter} methods.
81
+ *
82
+ * - `add`: the item was not found in the cache, and was added
83
+ * - `update`: the item was in the cache, with the same value provided
84
+ * - `replace`: the item was in the cache, and replaced
85
+ */
86
+ type InsertReason = 'add' | 'update' | 'replace';
87
+ /**
88
+ * A method called upon item insertion, passed as the
89
+ * {@link OptionsBase.insert}
90
+ */
91
+ type Inserter<K, V> = (value: V, key: K, reason: InsertReason) => void;
92
+ /**
93
+ * A function that returns the effective calculated size
94
+ * of an entry in the cache.
95
+ */
96
+ type SizeCalculator<K, V> = (value: V, key: K) => Size;
97
+ /**
98
+ * Options provided to the
99
+ * {@link OptionsBase.fetchMethod} function.
100
+ */
101
+ interface FetcherOptions<K, V, FC = unknown> {
102
+ signal: AbortSignal;
103
+ options: FetcherFetchOptions<K, V, FC>;
104
+ /**
105
+ * Object provided in the {@link FetchOptions.context} option to
106
+ * {@link LRUCache#fetch}
107
+ */
108
+ context: FC;
109
+ }
110
+ /**
111
+ * Occasionally, it may be useful to track the internal behavior of the
112
+ * cache, particularly for logging, debugging, or for behavior within the
113
+ * `fetchMethod`. To do this, you can pass a `status` object to the
114
+ * {@link LRUCache#fetch}, {@link LRUCache#get}, {@link LRUCache#set},
115
+ * {@link LRUCache#memo}, and {@link LRUCache#has} methods.
116
+ *
117
+ * The `status` option should be a plain JavaScript object. The following
118
+ * fields will be set on it appropriately, depending on the situation.
119
+ */
120
+ interface Status<V> {
121
+ /**
122
+ * The status of a set() operation.
123
+ *
124
+ * - add: the item was not found in the cache, and was added
125
+ * - update: the item was in the cache, with the same value provided
126
+ * - replace: the item was in the cache, and replaced
127
+ * - miss: the item was not added to the cache for some reason
128
+ */
129
+ set?: 'add' | 'update' | 'replace' | 'miss';
130
+ /**
131
+ * the ttl stored for the item, or undefined if ttls are not used.
132
+ */
133
+ ttl?: Milliseconds;
134
+ /**
135
+ * the start time for the item, or undefined if ttls are not used.
136
+ */
137
+ start?: Milliseconds;
138
+ /**
139
+ * The timestamp used for TTL calculation
140
+ */
141
+ now?: Milliseconds;
142
+ /**
143
+ * the remaining ttl for the item, or undefined if ttls are not used.
144
+ */
145
+ remainingTTL?: Milliseconds;
146
+ /**
147
+ * The calculated size for the item, if sizes are used.
148
+ */
149
+ entrySize?: Size;
150
+ /**
151
+ * The total calculated size of the cache, if sizes are used.
152
+ */
153
+ totalCalculatedSize?: Size;
154
+ /**
155
+ * A flag indicating that the item was not stored, due to exceeding the
156
+ * {@link OptionsBase.maxEntrySize}
157
+ */
158
+ maxEntrySizeExceeded?: true;
159
+ /**
160
+ * The old value, specified in the case of `set:'update'` or
161
+ * `set:'replace'`
162
+ */
163
+ oldValue?: V;
164
+ /**
165
+ * The results of a {@link LRUCache#has} operation
166
+ *
167
+ * - hit: the item was found in the cache
168
+ * - stale: the item was found in the cache, but is stale
169
+ * - miss: the item was not found in the cache
170
+ */
171
+ has?: 'hit' | 'stale' | 'miss';
172
+ /**
173
+ * The status of a {@link LRUCache#fetch} operation.
174
+ * Note that this can change as the underlying fetch() moves through
175
+ * various states.
176
+ *
177
+ * - inflight: there is another fetch() for this key which is in process
178
+ * - get: there is no {@link OptionsBase.fetchMethod}, so
179
+ * {@link LRUCache#get} was called.
180
+ * - miss: the item is not in cache, and will be fetched.
181
+ * - hit: the item is in the cache, and was resolved immediately.
182
+ * - stale: the item is in the cache, but stale.
183
+ * - refresh: the item is in the cache, and not stale, but
184
+ * {@link FetchOptions.forceRefresh} was specified.
185
+ */
186
+ fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh';
187
+ /**
188
+ * The {@link OptionsBase.fetchMethod} was called
189
+ */
190
+ fetchDispatched?: true;
191
+ /**
192
+ * The cached value was updated after a successful call to
193
+ * {@link OptionsBase.fetchMethod}
194
+ */
195
+ fetchUpdated?: true;
196
+ /**
197
+ * The reason for a fetch() rejection. Either the error raised by the
198
+ * {@link OptionsBase.fetchMethod}, or the reason for an
199
+ * AbortSignal.
200
+ */
201
+ fetchError?: Error;
202
+ /**
203
+ * The fetch received an abort signal
204
+ */
205
+ fetchAborted?: true;
206
+ /**
207
+ * The abort signal received was ignored, and the fetch was allowed to
208
+ * continue.
209
+ */
210
+ fetchAbortIgnored?: true;
211
+ /**
212
+ * The fetchMethod promise resolved successfully
213
+ */
214
+ fetchResolved?: true;
215
+ /**
216
+ * The fetchMethod promise was rejected
217
+ */
218
+ fetchRejected?: true;
219
+ /**
220
+ * The status of a {@link LRUCache#get} operation.
221
+ *
222
+ * - fetching: The item is currently being fetched. If a previous value
223
+ * is present and allowed, that will be returned.
224
+ * - stale: The item is in the cache, and is stale.
225
+ * - hit: the item is in the cache
226
+ * - miss: the item is not in the cache
227
+ */
228
+ get?: 'stale' | 'hit' | 'miss';
229
+ /**
230
+ * A fetch or get operation returned a stale value.
231
+ */
232
+ returnedStale?: true;
233
+ }
234
+ /**
235
+ * options which override the options set in the LRUCache constructor
236
+ * when calling {@link LRUCache#fetch}.
237
+ *
238
+ * This is the union of {@link GetOptions} and {@link SetOptions}, plus
239
+ * {@link OptionsBase.noDeleteOnFetchRejection},
240
+ * {@link OptionsBase.allowStaleOnFetchRejection},
241
+ * {@link FetchOptions.forceRefresh}, and
242
+ * {@link FetcherOptions.context}
243
+ *
244
+ * Any of these may be modified in the {@link OptionsBase.fetchMethod}
245
+ * function, but the {@link GetOptions} fields will of course have no
246
+ * effect, as the {@link LRUCache#get} call already happened by the time
247
+ * the fetchMethod is called.
248
+ */
249
+ interface FetcherFetchOptions<K, V, FC = unknown> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL' | 'noDeleteOnFetchRejection' | 'allowStaleOnFetchRejection' | 'ignoreFetchAbort' | 'allowStaleOnFetchAbort'> {
250
+ status?: Status<V>;
251
+ size?: Size;
252
+ }
253
+ /**
254
+ * Options that may be passed to the {@link LRUCache#fetch} method.
255
+ */
256
+ interface FetchOptions<K, V, FC> extends FetcherFetchOptions<K, V, FC> {
257
+ /**
258
+ * Set to true to force a re-load of the existing data, even if it
259
+ * is not yet stale.
260
+ */
261
+ forceRefresh?: boolean;
262
+ /**
263
+ * Context provided to the {@link OptionsBase.fetchMethod} as
264
+ * the {@link FetcherOptions.context} param.
265
+ *
266
+ * If the FC type is specified as unknown (the default),
267
+ * undefined or void, then this is optional. Otherwise, it will
268
+ * be required.
269
+ */
270
+ context?: FC;
271
+ signal?: AbortSignal;
272
+ status?: Status<V>;
273
+ }
274
+ /**
275
+ * Options provided to {@link LRUCache#fetch} when the FC type is something
276
+ * other than `unknown`, `undefined`, or `void`
277
+ */
278
+ interface FetchOptionsWithContext<K, V, FC> extends FetchOptions<K, V, FC> {
279
+ context: FC;
280
+ }
281
+ /**
282
+ * Options provided to {@link LRUCache#fetch} when the FC type is
283
+ * `undefined` or `void`
284
+ */
285
+ interface FetchOptionsNoContext<K, V> extends FetchOptions<K, V, undefined> {
286
+ context?: undefined;
287
+ }
288
+ interface MemoOptions<K, V, FC = unknown> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL' | 'noDeleteOnFetchRejection' | 'allowStaleOnFetchRejection' | 'ignoreFetchAbort' | 'allowStaleOnFetchAbort'> {
289
+ /**
290
+ * Set to true to force a re-load of the existing data, even if it
291
+ * is not yet stale.
292
+ */
293
+ forceRefresh?: boolean;
294
+ /**
295
+ * Context provided to the {@link OptionsBase.memoMethod} as
296
+ * the {@link MemoizerOptions.context} param.
297
+ *
298
+ * If the FC type is specified as unknown (the default),
299
+ * undefined or void, then this is optional. Otherwise, it will
300
+ * be required.
301
+ */
302
+ context?: FC;
303
+ status?: Status<V>;
304
+ }
305
+ /**
306
+ * Options provided to {@link LRUCache#memo} when the FC type is something
307
+ * other than `unknown`, `undefined`, or `void`
308
+ */
309
+ interface MemoOptionsWithContext<K, V, FC> extends MemoOptions<K, V, FC> {
310
+ context: FC;
311
+ }
312
+ /**
313
+ * Options provided to {@link LRUCache#memo} when the FC type is
314
+ * `undefined` or `void`
315
+ */
316
+ interface MemoOptionsNoContext<K, V> extends MemoOptions<K, V, undefined> {
317
+ context?: undefined;
318
+ }
319
+ /**
320
+ * Options provided to the
321
+ * {@link OptionsBase.memoMethod} function.
322
+ */
323
+ interface MemoizerOptions<K, V, FC = unknown> {
324
+ options: MemoizerMemoOptions<K, V, FC>;
325
+ /**
326
+ * Object provided in the {@link MemoOptions.context} option to
327
+ * {@link LRUCache#memo}
328
+ */
329
+ context: FC;
330
+ }
331
+ /**
332
+ * options which override the options set in the LRUCache constructor
333
+ * when calling {@link LRUCache#memo}.
334
+ *
335
+ * This is the union of {@link GetOptions} and {@link SetOptions}, plus
336
+ * {@link MemoOptions.forceRefresh}, and
337
+ * {@link MemoOptions.context}
338
+ *
339
+ * Any of these may be modified in the {@link OptionsBase.memoMethod}
340
+ * function, but the {@link GetOptions} fields will of course have no
341
+ * effect, as the {@link LRUCache#get} call already happened by the time
342
+ * the memoMethod is called.
343
+ */
344
+ interface MemoizerMemoOptions<K, V, FC = unknown> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL'> {
345
+ status?: Status<V>;
346
+ size?: Size;
347
+ start?: Milliseconds;
348
+ }
349
+ /**
350
+ * Options that may be passed to the {@link LRUCache#has} method.
351
+ */
352
+ interface HasOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'updateAgeOnHas'> {
353
+ status?: Status<V>;
354
+ }
355
+ /**
356
+ * Options that may be passed to the {@link LRUCache#get} method.
357
+ */
358
+ interface GetOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet'> {
359
+ status?: Status<V>;
360
+ }
361
+ /**
362
+ * Options that may be passed to the {@link LRUCache#peek} method.
363
+ */
364
+ interface PeekOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'allowStale'> {
365
+ }
366
+ /**
367
+ * Options that may be passed to the {@link LRUCache#set} method.
368
+ */
369
+ interface SetOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL'> {
370
+ /**
371
+ * If size tracking is enabled, then setting an explicit size
372
+ * in the {@link LRUCache#set} call will prevent calling the
373
+ * {@link OptionsBase.sizeCalculation} function.
374
+ */
375
+ size?: Size;
376
+ /**
377
+ * If TTL tracking is enabled, then setting an explicit start
378
+ * time in the {@link LRUCache#set} call will override the
379
+ * default time from `performance.now()` or `Date.now()`.
380
+ *
381
+ * Note that it must be a valid value for whichever time-tracking
382
+ * method is in use.
383
+ */
384
+ start?: Milliseconds;
385
+ status?: Status<V>;
386
+ }
387
+ /**
388
+ * The type signature for the {@link OptionsBase.fetchMethod} option.
389
+ */
390
+ type Fetcher<K, V, FC = unknown> = (key: K, staleValue: V | undefined, options: FetcherOptions<K, V, FC>) => Promise<V | undefined | void> | V | undefined | void;
391
+ /**
392
+ * the type signature for the {@link OptionsBase.memoMethod} option.
393
+ */
394
+ type Memoizer<K, V, FC = unknown> = (key: K, staleValue: V | undefined, options: MemoizerOptions<K, V, FC>) => V;
395
+ /**
396
+ * Options which may be passed to the {@link LRUCache} constructor.
397
+ *
398
+ * Most of these may be overridden in the various options that use
399
+ * them.
400
+ *
401
+ * Despite all being technically optional, the constructor requires that
402
+ * a cache is at minimum limited by one or more of {@link OptionsBase.max},
403
+ * {@link OptionsBase.ttl}, or {@link OptionsBase.maxSize}.
404
+ *
405
+ * If {@link OptionsBase.ttl} is used alone, then it is strongly advised
406
+ * (and in fact required by the type definitions here) that the cache
407
+ * also set {@link OptionsBase.ttlAutopurge}, to prevent potentially
408
+ * unbounded storage.
409
+ *
410
+ * All options are also available on the {@link LRUCache} instance, making
411
+ * it safe to pass an LRUCache instance as the options argumemnt to
412
+ * make another empty cache of the same type.
413
+ *
414
+ * Some options are marked as read-only, because changing them after
415
+ * instantiation is not safe. Changing any of the other options will of
416
+ * course only have an effect on subsequent method calls.
417
+ */
418
+ interface OptionsBase<K, V, FC> {
419
+ /**
420
+ * The maximum number of items to store in the cache before evicting
421
+ * old entries. This is read-only on the {@link LRUCache} instance,
422
+ * and may not be overridden.
423
+ *
424
+ * If set, then storage space will be pre-allocated at construction
425
+ * time, and the cache will perform significantly faster.
426
+ *
427
+ * Note that significantly fewer items may be stored, if
428
+ * {@link OptionsBase.maxSize} and/or {@link OptionsBase.ttl} are also
429
+ * set.
430
+ *
431
+ * **It is strongly recommended to set a `max` to prevent unbounded growth
432
+ * of the cache.**
433
+ */
434
+ max?: Count;
435
+ /**
436
+ * Max time in milliseconds for items to live in cache before they are
437
+ * considered stale. Note that stale items are NOT preemptively removed by
438
+ * default, and MAY live in the cache, contributing to its LRU max, long
439
+ * after they have expired, unless {@link OptionsBase.ttlAutopurge} is
440
+ * set.
441
+ *
442
+ * If set to `0` (the default value), then that means "do not track
443
+ * TTL", not "expire immediately".
444
+ *
445
+ * Also, as this cache is optimized for LRU/MRU operations, some of
446
+ * the staleness/TTL checks will reduce performance, as they will incur
447
+ * overhead by deleting items.
448
+ *
449
+ * This is not primarily a TTL cache, and does not make strong TTL
450
+ * guarantees. There is no pre-emptive pruning of expired items, but you
451
+ * _may_ set a TTL on the cache, and it will treat expired items as missing
452
+ * when they are fetched, and delete them.
453
+ *
454
+ * Optional, but must be a non-negative integer in ms if specified.
455
+ *
456
+ * This may be overridden by passing an options object to `cache.set()`.
457
+ *
458
+ * At least one of `max`, `maxSize`, or `TTL` is required. This must be a
459
+ * positive integer if set.
460
+ *
461
+ * Even if ttl tracking is enabled, **it is strongly recommended to set a
462
+ * `max` to prevent unbounded growth of the cache.**
463
+ *
464
+ * If ttl tracking is enabled, and `max` and `maxSize` are not set,
465
+ * and `ttlAutopurge` is not set, then a warning will be emitted
466
+ * cautioning about the potential for unbounded memory consumption.
467
+ * (The TypeScript definitions will also discourage this.)
468
+ */
469
+ ttl?: Milliseconds;
470
+ /**
471
+ * Minimum amount of time in ms in which to check for staleness.
472
+ * Defaults to 1, which means that the current time is checked
473
+ * at most once per millisecond.
474
+ *
475
+ * Set to 0 to check the current time every time staleness is tested.
476
+ * (This reduces performance, and is theoretically unnecessary.)
477
+ *
478
+ * Setting this to a higher value will improve performance somewhat
479
+ * while using ttl tracking, albeit at the expense of keeping stale
480
+ * items around a bit longer than their TTLs would indicate.
481
+ *
482
+ * @default 1
483
+ */
484
+ ttlResolution?: Milliseconds;
485
+ /**
486
+ * Preemptively remove stale items from the cache.
487
+ *
488
+ * Note that this may *significantly* degrade performance, especially if
489
+ * the cache is storing a large number of items. It is almost always best
490
+ * to just leave the stale items in the cache, and let them fall out as new
491
+ * items are added.
492
+ *
493
+ * Note that this means that {@link OptionsBase.allowStale} is a bit
494
+ * pointless, as stale items will be deleted almost as soon as they
495
+ * expire.
496
+ *
497
+ * Use with caution!
498
+ */
499
+ ttlAutopurge?: boolean;
500
+ /**
501
+ * When using time-expiring entries with `ttl`, setting this to `true` will
502
+ * make each item's age reset to 0 whenever it is retrieved from cache with
503
+ * {@link LRUCache#get}, causing it to not expire. (It can still fall out
504
+ * of cache based on recency of use, of course.)
505
+ *
506
+ * Has no effect if {@link OptionsBase.ttl} is not set.
507
+ *
508
+ * This may be overridden by passing an options object to `cache.get()`.
509
+ */
510
+ updateAgeOnGet?: boolean;
511
+ /**
512
+ * When using time-expiring entries with `ttl`, setting this to `true` will
513
+ * make each item's age reset to 0 whenever its presence in the cache is
514
+ * checked with {@link LRUCache#has}, causing it to not expire. (It can
515
+ * still fall out of cache based on recency of use, of course.)
516
+ *
517
+ * Has no effect if {@link OptionsBase.ttl} is not set.
518
+ */
519
+ updateAgeOnHas?: boolean;
520
+ /**
521
+ * Allow {@link LRUCache#get} and {@link LRUCache#fetch} calls to return
522
+ * stale data, if available.
523
+ *
524
+ * By default, if you set `ttl`, stale items will only be deleted from the
525
+ * cache when you `get(key)`. That is, it's not preemptively pruning items,
526
+ * unless {@link OptionsBase.ttlAutopurge} is set.
527
+ *
528
+ * If you set `allowStale:true`, it'll return the stale value *as well as*
529
+ * deleting it. If you don't set this, then it'll return `undefined` when
530
+ * you try to get a stale entry.
531
+ *
532
+ * Note that when a stale entry is fetched, _even if it is returned due to
533
+ * `allowStale` being set_, it is removed from the cache immediately. You
534
+ * can suppress this behavior by setting
535
+ * {@link OptionsBase.noDeleteOnStaleGet}, either in the constructor, or in
536
+ * the options provided to {@link LRUCache#get}.
537
+ *
538
+ * This may be overridden by passing an options object to `cache.get()`.
539
+ * The `cache.has()` method will always return `false` for stale items.
540
+ *
541
+ * Only relevant if a ttl is set.
542
+ */
543
+ allowStale?: boolean;
544
+ /**
545
+ * Function that is called on items when they are dropped from the
546
+ * cache, as `dispose(value, key, reason)`.
547
+ *
548
+ * This can be handy if you want to close file descriptors or do
549
+ * other cleanup tasks when items are no longer stored in the cache.
550
+ *
551
+ * **NOTE**: It is called _before_ the item has been fully removed
552
+ * from the cache, so if you want to put it right back in, you need
553
+ * to wait until the next tick. If you try to add it back in during
554
+ * the `dispose()` function call, it will break things in subtle and
555
+ * weird ways.
556
+ *
557
+ * Unlike several other options, this may _not_ be overridden by
558
+ * passing an option to `set()`, for performance reasons.
559
+ *
560
+ * The `reason` will be one of the following strings, corresponding
561
+ * to the reason for the item's deletion:
562
+ *
563
+ * - `evict` Item was evicted to make space for a new addition
564
+ * - `set` Item was overwritten by a new value
565
+ * - `expire` Item expired its TTL
566
+ * - `fetch` Item was deleted due to a failed or aborted fetch, or a
567
+ * fetchMethod returning `undefined.
568
+ * - `delete` Item was removed by explicit `cache.delete(key)`,
569
+ * `cache.clear()`, or `cache.set(key, undefined)`.
570
+ */
571
+ dispose?: Disposer<K, V>;
572
+ /**
573
+ * Function that is called when new items are inserted into the cache,
574
+ * as `onInsert(value, key, reason)`.
575
+ *
576
+ * This can be useful if you need to perform actions when an item is
577
+ * added, such as logging or tracking insertions.
578
+ *
579
+ * Unlike some other options, this may _not_ be overridden by passing
580
+ * an option to `set()`, for performance and consistency reasons.
581
+ */
582
+ onInsert?: Inserter<K, V>;
583
+ /**
584
+ * The same as {@link OptionsBase.dispose}, but called *after* the entry
585
+ * is completely removed and the cache is once again in a clean state.
586
+ *
587
+ * It is safe to add an item right back into the cache at this point.
588
+ * However, note that it is *very* easy to inadvertently create infinite
589
+ * recursion this way.
590
+ */
591
+ disposeAfter?: Disposer<K, V>;
592
+ /**
593
+ * Set to true to suppress calling the
594
+ * {@link OptionsBase.dispose} function if the entry key is
595
+ * still accessible within the cache.
596
+ *
597
+ * This may be overridden by passing an options object to
598
+ * {@link LRUCache#set}.
599
+ *
600
+ * Only relevant if `dispose` or `disposeAfter` are set.
601
+ */
602
+ noDisposeOnSet?: boolean;
603
+ /**
604
+ * Boolean flag to tell the cache to not update the TTL when setting a new
605
+ * value for an existing key (ie, when updating a value rather than
606
+ * inserting a new value). Note that the TTL value is _always_ set (if
607
+ * provided) when adding a new entry into the cache.
608
+ *
609
+ * Has no effect if a {@link OptionsBase.ttl} is not set.
610
+ *
611
+ * May be passed as an option to {@link LRUCache#set}.
612
+ */
613
+ noUpdateTTL?: boolean;
614
+ /**
615
+ * Set to a positive integer to track the sizes of items added to the
616
+ * cache, and automatically evict items in order to stay below this size.
617
+ * Note that this may result in fewer than `max` items being stored.
618
+ *
619
+ * Attempting to add an item to the cache whose calculated size is greater
620
+ * that this amount will be a no-op. The item will not be cached, and no
621
+ * other items will be evicted.
622
+ *
623
+ * Optional, must be a positive integer if provided.
624
+ *
625
+ * Sets `maxEntrySize` to the same value, unless a different value is
626
+ * provided for `maxEntrySize`.
627
+ *
628
+ * At least one of `max`, `maxSize`, or `TTL` is required. This must be a
629
+ * positive integer if set.
630
+ *
631
+ * Even if size tracking is enabled, **it is strongly recommended to set a
632
+ * `max` to prevent unbounded growth of the cache.**
633
+ *
634
+ * Note also that size tracking can negatively impact performance,
635
+ * though for most cases, only minimally.
636
+ */
637
+ maxSize?: Size;
638
+ /**
639
+ * The maximum allowed size for any single item in the cache.
640
+ *
641
+ * If a larger item is passed to {@link LRUCache#set} or returned by a
642
+ * {@link OptionsBase.fetchMethod} or {@link OptionsBase.memoMethod}, then
643
+ * it will not be stored in the cache.
644
+ *
645
+ * Attempting to add an item whose calculated size is greater than
646
+ * this amount will not cache the item or evict any old items, but
647
+ * WILL delete an existing value if one is already present.
648
+ *
649
+ * Optional, must be a positive integer if provided. Defaults to
650
+ * the value of `maxSize` if provided.
651
+ */
652
+ maxEntrySize?: Size;
653
+ /**
654
+ * A function that returns a number indicating the item's size.
655
+ *
656
+ * Requires {@link OptionsBase.maxSize} to be set.
657
+ *
658
+ * If not provided, and {@link OptionsBase.maxSize} or
659
+ * {@link OptionsBase.maxEntrySize} are set, then all
660
+ * {@link LRUCache#set} calls **must** provide an explicit
661
+ * {@link SetOptions.size} or sizeCalculation param.
662
+ */
663
+ sizeCalculation?: SizeCalculator<K, V>;
664
+ /**
665
+ * Method that provides the implementation for {@link LRUCache#fetch}
666
+ *
667
+ * ```ts
668
+ * fetchMethod(key, staleValue, { signal, options, context })
669
+ * ```
670
+ *
671
+ * If `fetchMethod` is not provided, then `cache.fetch(key)` is equivalent
672
+ * to `Promise.resolve(cache.get(key))`.
673
+ *
674
+ * If at any time, `signal.aborted` is set to `true`, or if the
675
+ * `signal.onabort` method is called, or if it emits an `'abort'` event
676
+ * which you can listen to with `addEventListener`, then that means that
677
+ * the fetch should be abandoned. This may be passed along to async
678
+ * functions aware of AbortController/AbortSignal behavior.
679
+ *
680
+ * The `fetchMethod` should **only** return `undefined` or a Promise
681
+ * resolving to `undefined` if the AbortController signaled an `abort`
682
+ * event. In all other cases, it should return or resolve to a value
683
+ * suitable for adding to the cache.
684
+ *
685
+ * The `options` object is a union of the options that may be provided to
686
+ * `set()` and `get()`. If they are modified, then that will result in
687
+ * modifying the settings to `cache.set()` when the value is resolved, and
688
+ * in the case of
689
+ * {@link OptionsBase.noDeleteOnFetchRejection} and
690
+ * {@link OptionsBase.allowStaleOnFetchRejection}, the handling of
691
+ * `fetchMethod` failures.
692
+ *
693
+ * For example, a DNS cache may update the TTL based on the value returned
694
+ * from a remote DNS server by changing `options.ttl` in the `fetchMethod`.
695
+ */
696
+ fetchMethod?: Fetcher<K, V, FC>;
697
+ /**
698
+ * Method that provides the implementation for {@link LRUCache#memo}
699
+ */
700
+ memoMethod?: Memoizer<K, V, FC>;
701
+ /**
702
+ * Set to true to suppress the deletion of stale data when a
703
+ * {@link OptionsBase.fetchMethod} returns a rejected promise.
704
+ */
705
+ noDeleteOnFetchRejection?: boolean;
706
+ /**
707
+ * Do not delete stale items when they are retrieved with
708
+ * {@link LRUCache#get}.
709
+ *
710
+ * Note that the `get` return value will still be `undefined`
711
+ * unless {@link OptionsBase.allowStale} is true.
712
+ *
713
+ * When using time-expiring entries with `ttl`, by default stale
714
+ * items will be removed from the cache when the key is accessed
715
+ * with `cache.get()`.
716
+ *
717
+ * Setting this option will cause stale items to remain in the cache, until
718
+ * they are explicitly deleted with `cache.delete(key)`, or retrieved with
719
+ * `noDeleteOnStaleGet` set to `false`.
720
+ *
721
+ * This may be overridden by passing an options object to `cache.get()`.
722
+ *
723
+ * Only relevant if a ttl is used.
724
+ */
725
+ noDeleteOnStaleGet?: boolean;
726
+ /**
727
+ * Set to true to allow returning stale data when a
728
+ * {@link OptionsBase.fetchMethod} throws an error or returns a rejected
729
+ * promise.
730
+ *
731
+ * This differs from using {@link OptionsBase.allowStale} in that stale
732
+ * data will ONLY be returned in the case that the {@link LRUCache#fetch}
733
+ * fails, not any other times.
734
+ *
735
+ * If a `fetchMethod` fails, and there is no stale value available, the
736
+ * `fetch()` will resolve to `undefined`. Ie, all `fetchMethod` errors are
737
+ * suppressed.
738
+ *
739
+ * Implies `noDeleteOnFetchRejection`.
740
+ *
741
+ * This may be set in calls to `fetch()`, or defaulted on the constructor,
742
+ * or overridden by modifying the options object in the `fetchMethod`.
743
+ */
744
+ allowStaleOnFetchRejection?: boolean;
745
+ /**
746
+ * Set to true to return a stale value from the cache when the
747
+ * `AbortSignal` passed to the {@link OptionsBase.fetchMethod} dispatches
748
+ * an `'abort'` event, whether user-triggered, or due to internal cache
749
+ * behavior.
750
+ *
751
+ * Unless {@link OptionsBase.ignoreFetchAbort} is also set, the underlying
752
+ * {@link OptionsBase.fetchMethod} will still be considered canceled, and
753
+ * any value it returns will be ignored and not cached.
754
+ *
755
+ * Caveat: since fetches are aborted when a new value is explicitly
756
+ * set in the cache, this can lead to fetch returning a stale value,
757
+ * since that was the fallback value _at the moment the `fetch()` was
758
+ * initiated_, even though the new updated value is now present in
759
+ * the cache.
760
+ *
761
+ * For example:
762
+ *
763
+ * ```ts
764
+ * const cache = new LRUCache<string, any>({
765
+ * ttl: 100,
766
+ * fetchMethod: async (url, oldValue, { signal }) => {
767
+ * const res = await fetch(url, { signal })
768
+ * return await res.json()
769
+ * }
770
+ * })
771
+ * cache.set('https://example.com/', { some: 'data' })
772
+ * // 100ms go by...
773
+ * const result = cache.fetch('https://example.com/')
774
+ * cache.set('https://example.com/', { other: 'thing' })
775
+ * console.log(await result) // { some: 'data' }
776
+ * console.log(cache.get('https://example.com/')) // { other: 'thing' }
777
+ * ```
778
+ */
779
+ allowStaleOnFetchAbort?: boolean;
780
+ /**
781
+ * Set to true to ignore the `abort` event emitted by the `AbortSignal`
782
+ * object passed to {@link OptionsBase.fetchMethod}, and still cache the
783
+ * resulting resolution value, as long as it is not `undefined`.
784
+ *
785
+ * When used on its own, this means aborted {@link LRUCache#fetch} calls
786
+ * are not immediately resolved or rejected when they are aborted, and
787
+ * instead take the full time to await.
788
+ *
789
+ * When used with {@link OptionsBase.allowStaleOnFetchAbort}, aborted
790
+ * {@link LRUCache#fetch} calls will resolve immediately to their stale
791
+ * cached value or `undefined`, and will continue to process and eventually
792
+ * update the cache when they resolve, as long as the resulting value is
793
+ * not `undefined`, thus supporting a "return stale on timeout while
794
+ * refreshing" mechanism by passing `AbortSignal.timeout(n)` as the signal.
795
+ *
796
+ * For example:
797
+ *
798
+ * ```ts
799
+ * const c = new LRUCache({
800
+ * ttl: 100,
801
+ * ignoreFetchAbort: true,
802
+ * allowStaleOnFetchAbort: true,
803
+ * fetchMethod: async (key, oldValue, { signal }) => {
804
+ * // note: do NOT pass the signal to fetch()!
805
+ * // let's say this fetch can take a long time.
806
+ * const res = await fetch(`https://slow-backend-server/${key}`)
807
+ * return await res.json()
808
+ * },
809
+ * })
810
+ *
811
+ * // this will return the stale value after 100ms, while still
812
+ * // updating in the background for next time.
813
+ * const val = await c.fetch('key', { signal: AbortSignal.timeout(100) })
814
+ * ```
815
+ *
816
+ * **Note**: regardless of this setting, an `abort` event _is still
817
+ * emitted on the `AbortSignal` object_, so may result in invalid results
818
+ * when passed to other underlying APIs that use AbortSignals.
819
+ *
820
+ * This may be overridden in the {@link OptionsBase.fetchMethod} or the
821
+ * call to {@link LRUCache#fetch}.
822
+ */
823
+ ignoreFetchAbort?: boolean;
824
+ }
825
+ interface OptionsMaxLimit<K, V, FC> extends OptionsBase<K, V, FC> {
826
+ max: Count;
827
+ }
828
+ interface OptionsTTLLimit<K, V, FC> extends OptionsBase<K, V, FC> {
829
+ ttl: Milliseconds;
830
+ ttlAutopurge: boolean;
831
+ }
832
+ interface OptionsSizeLimit<K, V, FC> extends OptionsBase<K, V, FC> {
833
+ maxSize: Size;
834
+ }
835
+ /**
836
+ * The valid safe options for the {@link LRUCache} constructor
837
+ */
838
+ type Options<K, V, FC> = OptionsMaxLimit<K, V, FC> | OptionsSizeLimit<K, V, FC> | OptionsTTLLimit<K, V, FC>;
839
+ /**
840
+ * Entry objects used by {@link LRUCache#load} and {@link LRUCache#dump},
841
+ * and returned by {@link LRUCache#info}.
842
+ */
843
+ interface Entry<V> {
844
+ value: V;
845
+ ttl?: Milliseconds;
846
+ size?: Size;
847
+ start?: Milliseconds;
848
+ }
849
+ }
850
+ /**
851
+ * Default export, the thing you're using this module to get.
852
+ *
853
+ * The `K` and `V` types define the key and value types, respectively. The
854
+ * optional `FC` type defines the type of the `context` object passed to
855
+ * `cache.fetch()` and `cache.memo()`.
856
+ *
857
+ * Keys and values **must not** be `null` or `undefined`.
858
+ *
859
+ * All properties from the options object (with the exception of `max`,
860
+ * `maxSize`, `fetchMethod`, `memoMethod`, `dispose` and `disposeAfter`) are
861
+ * added as normal public members. (The listed options are read-only getters.)
862
+ *
863
+ * Changing any of these will alter the defaults for subsequent method calls.
864
+ */
865
+ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
866
+ #private;
867
+ /**
868
+ * {@link LRUCache.OptionsBase.ttl}
869
+ */
870
+ ttl: LRUCache.Milliseconds;
871
+ /**
872
+ * {@link LRUCache.OptionsBase.ttlResolution}
873
+ */
874
+ ttlResolution: LRUCache.Milliseconds;
875
+ /**
876
+ * {@link LRUCache.OptionsBase.ttlAutopurge}
877
+ */
878
+ ttlAutopurge: boolean;
879
+ /**
880
+ * {@link LRUCache.OptionsBase.updateAgeOnGet}
881
+ */
882
+ updateAgeOnGet: boolean;
883
+ /**
884
+ * {@link LRUCache.OptionsBase.updateAgeOnHas}
885
+ */
886
+ updateAgeOnHas: boolean;
887
+ /**
888
+ * {@link LRUCache.OptionsBase.allowStale}
889
+ */
890
+ allowStale: boolean;
891
+ /**
892
+ * {@link LRUCache.OptionsBase.noDisposeOnSet}
893
+ */
894
+ noDisposeOnSet: boolean;
895
+ /**
896
+ * {@link LRUCache.OptionsBase.noUpdateTTL}
897
+ */
898
+ noUpdateTTL: boolean;
899
+ /**
900
+ * {@link LRUCache.OptionsBase.maxEntrySize}
901
+ */
902
+ maxEntrySize: LRUCache.Size;
903
+ /**
904
+ * {@link LRUCache.OptionsBase.sizeCalculation}
905
+ */
906
+ sizeCalculation?: LRUCache.SizeCalculator<K, V>;
907
+ /**
908
+ * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
909
+ */
910
+ noDeleteOnFetchRejection: boolean;
911
+ /**
912
+ * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
913
+ */
914
+ noDeleteOnStaleGet: boolean;
915
+ /**
916
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
917
+ */
918
+ allowStaleOnFetchAbort: boolean;
919
+ /**
920
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
921
+ */
922
+ allowStaleOnFetchRejection: boolean;
923
+ /**
924
+ * {@link LRUCache.OptionsBase.ignoreFetchAbort}
925
+ */
926
+ ignoreFetchAbort: boolean;
927
+ /**
928
+ * Do not call this method unless you need to inspect the
929
+ * inner workings of the cache. If anything returned by this
930
+ * object is modified in any way, strange breakage may occur.
931
+ *
932
+ * These fields are private for a reason!
933
+ *
934
+ * @internal
935
+ */
936
+ static unsafeExposeInternals<K extends {}, V extends {}, FC extends unknown = unknown>(c: LRUCache<K, V, FC>): {
937
+ starts: ZeroArray | undefined;
938
+ ttls: ZeroArray | undefined;
939
+ sizes: ZeroArray | undefined;
940
+ keyMap: Map<K, number>;
941
+ keyList: (K | undefined)[];
942
+ valList: (V | BackgroundFetch<V> | undefined)[];
943
+ next: NumberArray;
944
+ prev: NumberArray;
945
+ readonly head: Index;
946
+ readonly tail: Index;
947
+ free: StackLike;
948
+ isBackgroundFetch: (p: any) => p is BackgroundFetch<V>;
949
+ backgroundFetch: (k: K, index: number | undefined, options: LRUCache.FetchOptions<K, V, FC>, context: any) => BackgroundFetch<V>;
950
+ moveToTail: (index: number) => void;
951
+ indexes: (options?: {
952
+ allowStale: boolean;
953
+ }) => Generator<Index, void, unknown>;
954
+ rindexes: (options?: {
955
+ allowStale: boolean;
956
+ }) => Generator<Index, void, unknown>;
957
+ isStale: (index: number | undefined) => boolean;
958
+ };
959
+ /**
960
+ * {@link LRUCache.OptionsBase.max} (read-only)
961
+ */
962
+ get max(): LRUCache.Count;
963
+ /**
964
+ * {@link LRUCache.OptionsBase.maxSize} (read-only)
965
+ */
966
+ get maxSize(): LRUCache.Count;
967
+ /**
968
+ * The total computed size of items in the cache (read-only)
969
+ */
970
+ get calculatedSize(): LRUCache.Size;
971
+ /**
972
+ * The number of items stored in the cache (read-only)
973
+ */
974
+ get size(): LRUCache.Count;
975
+ /**
976
+ * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
977
+ */
978
+ get fetchMethod(): LRUCache.Fetcher<K, V, FC> | undefined;
979
+ get memoMethod(): LRUCache.Memoizer<K, V, FC> | undefined;
980
+ /**
981
+ * {@link LRUCache.OptionsBase.dispose} (read-only)
982
+ */
983
+ get dispose(): LRUCache.Disposer<K, V> | undefined;
984
+ /**
985
+ * {@link LRUCache.OptionsBase.onInsert} (read-only)
986
+ */
987
+ get onInsert(): LRUCache.Inserter<K, V> | undefined;
988
+ /**
989
+ * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
990
+ */
991
+ get disposeAfter(): LRUCache.Disposer<K, V> | undefined;
992
+ constructor(options: LRUCache.Options<K, V, FC> | LRUCache<K, V, FC>);
993
+ /**
994
+ * Return the number of ms left in the item's TTL. If item is not in cache,
995
+ * returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
996
+ */
997
+ getRemainingTTL(key: K): number;
998
+ /**
999
+ * Return a generator yielding `[key, value]` pairs,
1000
+ * in order from most recently used to least recently used.
1001
+ */
1002
+ entries(): Generator<[K, V], void, unknown>;
1003
+ /**
1004
+ * Inverse order version of {@link LRUCache.entries}
1005
+ *
1006
+ * Return a generator yielding `[key, value]` pairs,
1007
+ * in order from least recently used to most recently used.
1008
+ */
1009
+ rentries(): Generator<(K | V)[], void, unknown>;
1010
+ /**
1011
+ * Return a generator yielding the keys in the cache,
1012
+ * in order from most recently used to least recently used.
1013
+ */
1014
+ keys(): Generator<K, void, unknown>;
1015
+ /**
1016
+ * Inverse order version of {@link LRUCache.keys}
1017
+ *
1018
+ * Return a generator yielding the keys in the cache,
1019
+ * in order from least recently used to most recently used.
1020
+ */
1021
+ rkeys(): Generator<K, void, unknown>;
1022
+ /**
1023
+ * Return a generator yielding the values in the cache,
1024
+ * in order from most recently used to least recently used.
1025
+ */
1026
+ values(): Generator<V, void, unknown>;
1027
+ /**
1028
+ * Inverse order version of {@link LRUCache.values}
1029
+ *
1030
+ * Return a generator yielding the values in the cache,
1031
+ * in order from least recently used to most recently used.
1032
+ */
1033
+ rvalues(): Generator<V | undefined, void, unknown>;
1034
+ /**
1035
+ * Iterating over the cache itself yields the same results as
1036
+ * {@link LRUCache.entries}
1037
+ */
1038
+ [Symbol.iterator](): Generator<[K, V], void, unknown>;
1039
+ /**
1040
+ * A String value that is used in the creation of the default string
1041
+ * description of an object. Called by the built-in method
1042
+ * `Object.prototype.toString`.
1043
+ */
1044
+ [Symbol.toStringTag]: string;
1045
+ /**
1046
+ * Find a value for which the supplied fn method returns a truthy value,
1047
+ * similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
1048
+ */
1049
+ find(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => boolean, getOptions?: LRUCache.GetOptions<K, V, FC>): V | undefined;
1050
+ /**
1051
+ * Call the supplied function on each item in the cache, in order from most
1052
+ * recently used to least recently used.
1053
+ *
1054
+ * `fn` is called as `fn(value, key, cache)`.
1055
+ *
1056
+ * If `thisp` is provided, function will be called in the `this`-context of
1057
+ * the provided object, or the cache if no `thisp` object is provided.
1058
+ *
1059
+ * Does not update age or recenty of use, or iterate over stale values.
1060
+ */
1061
+ forEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => any, thisp?: any): void;
1062
+ /**
1063
+ * The same as {@link LRUCache.forEach} but items are iterated over in
1064
+ * reverse order. (ie, less recently used items are iterated over first.)
1065
+ */
1066
+ rforEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => any, thisp?: any): void;
1067
+ /**
1068
+ * Delete any stale entries. Returns true if anything was removed,
1069
+ * false otherwise.
1070
+ */
1071
+ purgeStale(): boolean;
1072
+ /**
1073
+ * Get the extended info about a given entry, to get its value, size, and
1074
+ * TTL info simultaneously. Returns `undefined` if the key is not present.
1075
+ *
1076
+ * Unlike {@link LRUCache#dump}, which is designed to be portable and survive
1077
+ * serialization, the `start` value is always the current timestamp, and the
1078
+ * `ttl` is a calculated remaining time to live (negative if expired).
1079
+ *
1080
+ * Always returns stale values, if their info is found in the cache, so be
1081
+ * sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
1082
+ * if relevant.
1083
+ */
1084
+ info(key: K): LRUCache.Entry<V> | undefined;
1085
+ /**
1086
+ * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
1087
+ * passed to {@link LRUCache#load}.
1088
+ *
1089
+ * The `start` fields are calculated relative to a portable `Date.now()`
1090
+ * timestamp, even if `performance.now()` is available.
1091
+ *
1092
+ * Stale entries are always included in the `dump`, even if
1093
+ * {@link LRUCache.OptionsBase.allowStale} is false.
1094
+ *
1095
+ * Note: this returns an actual array, not a generator, so it can be more
1096
+ * easily passed around.
1097
+ */
1098
+ dump(): [K, LRUCache.Entry<V>][];
1099
+ /**
1100
+ * Reset the cache and load in the items in entries in the order listed.
1101
+ *
1102
+ * The shape of the resulting cache may be different if the same options are
1103
+ * not used in both caches.
1104
+ *
1105
+ * The `start` fields are assumed to be calculated relative to a portable
1106
+ * `Date.now()` timestamp, even if `performance.now()` is available.
1107
+ */
1108
+ load(arr: [K, LRUCache.Entry<V>][]): void;
1109
+ /**
1110
+ * Add a value to the cache.
1111
+ *
1112
+ * Note: if `undefined` is specified as a value, this is an alias for
1113
+ * {@link LRUCache#delete}
1114
+ *
1115
+ * Fields on the {@link LRUCache.SetOptions} options param will override
1116
+ * their corresponding values in the constructor options for the scope
1117
+ * of this single `set()` operation.
1118
+ *
1119
+ * If `start` is provided, then that will set the effective start
1120
+ * time for the TTL calculation. Note that this must be a previous
1121
+ * value of `performance.now()` if supported, or a previous value of
1122
+ * `Date.now()` if not.
1123
+ *
1124
+ * Options object may also include `size`, which will prevent
1125
+ * calling the `sizeCalculation` function and just use the specified
1126
+ * number if it is a positive integer, and `noDisposeOnSet` which
1127
+ * will prevent calling a `dispose` function in the case of
1128
+ * overwrites.
1129
+ *
1130
+ * If the `size` (or return value of `sizeCalculation`) for a given
1131
+ * entry is greater than `maxEntrySize`, then the item will not be
1132
+ * added to the cache.
1133
+ *
1134
+ * Will update the recency of the entry.
1135
+ *
1136
+ * If the value is `undefined`, then this is an alias for
1137
+ * `cache.delete(key)`. `undefined` is never stored in the cache.
1138
+ */
1139
+ set(k: K, v: V | BackgroundFetch<V> | undefined, setOptions?: LRUCache.SetOptions<K, V, FC>): this;
1140
+ /**
1141
+ * Evict the least recently used item, returning its value or
1142
+ * `undefined` if cache is empty.
1143
+ */
1144
+ pop(): V | undefined;
1145
+ /**
1146
+ * Check if a key is in the cache, without updating the recency of use.
1147
+ * Will return false if the item is stale, even though it is technically
1148
+ * in the cache.
1149
+ *
1150
+ * Check if a key is in the cache, without updating the recency of
1151
+ * use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
1152
+ * to `true` in either the options or the constructor.
1153
+ *
1154
+ * Will return `false` if the item is stale, even though it is technically in
1155
+ * the cache. The difference can be determined (if it matters) by using a
1156
+ * `status` argument, and inspecting the `has` field.
1157
+ *
1158
+ * Will not update item age unless
1159
+ * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
1160
+ */
1161
+ has(k: K, hasOptions?: LRUCache.HasOptions<K, V, FC>): boolean;
1162
+ /**
1163
+ * Like {@link LRUCache#get} but doesn't update recency or delete stale
1164
+ * items.
1165
+ *
1166
+ * Returns `undefined` if the item is stale, unless
1167
+ * {@link LRUCache.OptionsBase.allowStale} is set.
1168
+ */
1169
+ peek(k: K, peekOptions?: LRUCache.PeekOptions<K, V, FC>): V | undefined;
1170
+ /**
1171
+ * Make an asynchronous cached fetch using the
1172
+ * {@link LRUCache.OptionsBase.fetchMethod} function.
1173
+ *
1174
+ * If the value is in the cache and not stale, then the returned
1175
+ * Promise resolves to the value.
1176
+ *
1177
+ * If not in the cache, or beyond its TTL staleness, then
1178
+ * `fetchMethod(key, staleValue, { options, signal, context })` is
1179
+ * called, and the value returned will be added to the cache once
1180
+ * resolved.
1181
+ *
1182
+ * If called with `allowStale`, and an asynchronous fetch is
1183
+ * currently in progress to reload a stale value, then the former
1184
+ * stale value will be returned.
1185
+ *
1186
+ * If called with `forceRefresh`, then the cached item will be
1187
+ * re-fetched, even if it is not stale. However, if `allowStale` is also
1188
+ * set, then the old value will still be returned. This is useful
1189
+ * in cases where you want to force a reload of a cached value. If
1190
+ * a background fetch is already in progress, then `forceRefresh`
1191
+ * has no effect.
1192
+ *
1193
+ * If multiple fetches for the same key are issued, then they will all be
1194
+ * coalesced into a single call to fetchMethod.
1195
+ *
1196
+ * Note that this means that handling options such as
1197
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort},
1198
+ * {@link LRUCache.FetchOptions.signal},
1199
+ * and {@link LRUCache.OptionsBase.allowStaleOnFetchRejection} will be
1200
+ * determined by the FIRST fetch() call for a given key.
1201
+ *
1202
+ * This is a known (fixable) shortcoming which will be addresed on when
1203
+ * someone complains about it, as the fix would involve added complexity and
1204
+ * may not be worth the costs for this edge case.
1205
+ *
1206
+ * If {@link LRUCache.OptionsBase.fetchMethod} is not specified, then this is
1207
+ * effectively an alias for `Promise.resolve(cache.get(key))`.
1208
+ *
1209
+ * When the fetch method resolves to a value, if the fetch has not
1210
+ * been aborted due to deletion, eviction, or being overwritten,
1211
+ * then it is added to the cache using the options provided.
1212
+ *
1213
+ * If the key is evicted or deleted before the `fetchMethod`
1214
+ * resolves, then the AbortSignal passed to the `fetchMethod` will
1215
+ * receive an `abort` event, and the promise returned by `fetch()`
1216
+ * will reject with the reason for the abort.
1217
+ *
1218
+ * If a `signal` is passed to the `fetch()` call, then aborting the
1219
+ * signal will abort the fetch and cause the `fetch()` promise to
1220
+ * reject with the reason provided.
1221
+ *
1222
+ * **Setting `context`**
1223
+ *
1224
+ * If an `FC` type is set to a type other than `unknown`, `void`, or
1225
+ * `undefined` in the {@link LRUCache} constructor, then all
1226
+ * calls to `cache.fetch()` _must_ provide a `context` option. If
1227
+ * set to `undefined` or `void`, then calls to fetch _must not_
1228
+ * provide a `context` option.
1229
+ *
1230
+ * The `context` param allows you to provide arbitrary data that
1231
+ * might be relevant in the course of fetching the data. It is only
1232
+ * relevant for the course of a single `fetch()` operation, and
1233
+ * discarded afterwards.
1234
+ *
1235
+ * **Note: `fetch()` calls are inflight-unique**
1236
+ *
1237
+ * If you call `fetch()` multiple times with the same key value,
1238
+ * then every call after the first will resolve on the same
1239
+ * promise<sup>1</sup>,
1240
+ * _even if they have different settings that would otherwise change
1241
+ * the behavior of the fetch_, such as `noDeleteOnFetchRejection`
1242
+ * or `ignoreFetchAbort`.
1243
+ *
1244
+ * In most cases, this is not a problem (in fact, only fetching
1245
+ * something once is what you probably want, if you're caching in
1246
+ * the first place). If you are changing the fetch() options
1247
+ * dramatically between runs, there's a good chance that you might
1248
+ * be trying to fit divergent semantics into a single object, and
1249
+ * would be better off with multiple cache instances.
1250
+ *
1251
+ * **1**: Ie, they're not the "same Promise", but they resolve at
1252
+ * the same time, because they're both waiting on the same
1253
+ * underlying fetchMethod response.
1254
+ */
1255
+ fetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : LRUCache.FetchOptionsWithContext<K, V, FC>): Promise<undefined | V>;
1256
+ fetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : never): Promise<undefined | V>;
1257
+ /**
1258
+ * In some cases, `cache.fetch()` may resolve to `undefined`, either because
1259
+ * a {@link LRUCache.OptionsBase#fetchMethod} was not provided (turning
1260
+ * `cache.fetch(k)` into just an async wrapper around `cache.get(k)`) or
1261
+ * because `ignoreFetchAbort` was specified (either to the constructor or
1262
+ * in the {@link LRUCache.FetchOptions}). Also, the
1263
+ * {@link LRUCache.OptionsBase.fetchMethod} may return `undefined` or `void`, making
1264
+ * the test even more complicated.
1265
+ *
1266
+ * Because inferring the cases where `undefined` might be returned are so
1267
+ * cumbersome, but testing for `undefined` can also be annoying, this method
1268
+ * can be used, which will reject if `this.fetch()` resolves to undefined.
1269
+ */
1270
+ forceFetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : LRUCache.FetchOptionsWithContext<K, V, FC>): Promise<V>;
1271
+ forceFetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : never): Promise<V>;
1272
+ /**
1273
+ * If the key is found in the cache, then this is equivalent to
1274
+ * {@link LRUCache#get}. If not, in the cache, then calculate the value using
1275
+ * the {@link LRUCache.OptionsBase.memoMethod}, and add it to the cache.
1276
+ *
1277
+ * If an `FC` type is set to a type other than `unknown`, `void`, or
1278
+ * `undefined` in the LRUCache constructor, then all calls to `cache.memo()`
1279
+ * _must_ provide a `context` option. If set to `undefined` or `void`, then
1280
+ * calls to memo _must not_ provide a `context` option.
1281
+ *
1282
+ * The `context` param allows you to provide arbitrary data that might be
1283
+ * relevant in the course of fetching the data. It is only relevant for the
1284
+ * course of a single `memo()` operation, and discarded afterwards.
1285
+ */
1286
+ memo(k: K, memoOptions: unknown extends FC ? LRUCache.MemoOptions<K, V, FC> : FC extends undefined | void ? LRUCache.MemoOptionsNoContext<K, V> : LRUCache.MemoOptionsWithContext<K, V, FC>): V;
1287
+ memo(k: unknown extends FC ? K : FC extends undefined | void ? K : never, memoOptions?: unknown extends FC ? LRUCache.MemoOptions<K, V, FC> : FC extends undefined | void ? LRUCache.MemoOptionsNoContext<K, V> : never): V;
1288
+ /**
1289
+ * Return a value from the cache. Will update the recency of the cache
1290
+ * entry found.
1291
+ *
1292
+ * If the key is not found, get() will return `undefined`.
1293
+ */
1294
+ get(k: K, getOptions?: LRUCache.GetOptions<K, V, FC>): V | undefined;
1295
+ /**
1296
+ * Deletes a key out of the cache.
1297
+ *
1298
+ * Returns true if the key was deleted, false otherwise.
1299
+ */
1300
+ delete(k: K): boolean;
1301
+ /**
1302
+ * Clear the cache entirely, throwing away all values.
1303
+ */
1304
+ clear(): void;
1305
+ }
1306
+ //# sourceMappingURL=index.d.ts.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/commonjs/index.min.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.LRUCache=void 0;var T=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,U=new Set,W=typeof process=="object"&&process?process:{},I=(a,t,e,i)=>{typeof W.emitWarning=="function"?W.emitWarning(a,t,e,i):console.error(`[${e}] ${t}: ${a}`)},C=globalThis.AbortController,x=globalThis.AbortSignal;if(typeof C>"u"){x=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,s){this._onabort.push(s)}},C=class{constructor(){t()}signal=new x;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i)}}};let a=W.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{a&&(a=!1,I("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var G=a=>!U.has(a),P=Symbol("type"),y=a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),M=a=>y(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?E:null:null,E=class extends Array{constructor(t){super(t),this.fill(0)}},D=class a{heap;length;static#l=!1;static create(t){let e=M(t);if(!e)return[];a.#l=!0;let i=new a(t,e);return a.#l=!1,i}constructor(t,e){if(!a.#l)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},L=class a{#l;#c;#p;#z;#w;#W;#D;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#S;#s;#i;#t;#a;#u;#o;#h;#_;#r;#b;#m;#d;#y;#E;#f;#L;static unsafeExposeInternals(t){return{starts:t.#m,ttls:t.#d,sizes:t.#b,keyMap:t.#s,keyList:t.#i,valList:t.#t,next:t.#a,prev:t.#u,get head(){return t.#o},get tail(){return t.#h},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,i,s,n)=>t.#I(e,i,s,n),moveToTail:e=>t.#R(e),indexes:e=>t.#A(e),rindexes:e=>t.#F(e),isStale:e=>t.#g(e)}}get max(){return this.#l}get maxSize(){return this.#c}get calculatedSize(){return this.#S}get size(){return this.#n}get fetchMethod(){return this.#W}get memoMethod(){return this.#D}get dispose(){return this.#p}get onInsert(){return this.#z}get disposeAfter(){return this.#w}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:h,updateAgeOnHas:o,allowStale:r,dispose:g,onInsert:_,disposeAfter:f,noDisposeOnSet:c,noUpdateTTL:u,maxSize:A=0,maxEntrySize:d=0,sizeCalculation:b,fetchMethod:l,memoMethod:w,noDeleteOnFetchRejection:m,noDeleteOnStaleGet:p,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:z,ignoreFetchAbort:F}=t;if(e!==0&&!y(e))throw new TypeError("max option must be a nonnegative integer");let v=e?M(e):Array;if(!v)throw new Error("invalid max value: "+e);if(this.#l=e,this.#c=A,this.maxEntrySize=d||this.#c,this.sizeCalculation=b,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(w!==void 0&&typeof w!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#D=w,l!==void 0&&typeof l!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#W=l,this.#E=!!l,this.#s=new Map,this.#i=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#a=new v(e),this.#u=new v(e),this.#o=0,this.#h=0,this.#_=D.create(e),this.#n=0,this.#S=0,typeof g=="function"&&(this.#p=g),typeof _=="function"&&(this.#z=_),typeof f=="function"?(this.#w=f,this.#r=[]):(this.#w=void 0,this.#r=void 0),this.#y=!!this.#p,this.#L=!!this.#z,this.#f=!!this.#w,this.noDisposeOnSet=!!c,this.noUpdateTTL=!!u,this.noDeleteOnFetchRejection=!!m,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!z,this.ignoreFetchAbort=!!F,this.maxEntrySize!==0){if(this.#c!==0&&!y(this.#c))throw new TypeError("maxSize must be a positive integer if specified");if(!y(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#k()}if(this.allowStale=!!r,this.noDeleteOnStaleGet=!!p,this.updateAgeOnGet=!!h,this.updateAgeOnHas=!!o,this.ttlResolution=y(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!y(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#M()}if(this.#l===0&&this.ttl===0&&this.#c===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#l&&!this.#c){let O="LRU_CACHE_UNBOUNDED";G(O)&&(U.add(O),I("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",O,a))}}getRemainingTTL(t){return this.#s.has(t)?1/0:0}#M(){let t=new E(this.#l),e=new E(this.#l);this.#d=t,this.#m=e,this.#G=(n,h,o=T.now())=>{if(e[n]=h!==0?o:0,t[n]=h,h!==0&&this.ttlAutopurge){let r=setTimeout(()=>{this.#g(n)&&this.#O(this.#i[n],"expire")},h+1);r.unref&&r.unref()}},this.#v=n=>{e[n]=t[n]!==0?T.now():0},this.#T=(n,h)=>{if(t[h]){let o=t[h],r=e[h];if(!o||!r)return;n.ttl=o,n.start=r,n.now=i||s();let g=n.now-r;n.remainingTTL=o-g}};let i=0,s=()=>{let n=T.now();if(this.ttlResolution>0){i=n;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref()}return n};this.getRemainingTTL=n=>{let h=this.#s.get(n);if(h===void 0)return 0;let o=t[h],r=e[h];if(!o||!r)return 1/0;let g=(i||s())-r;return o-g},this.#g=n=>{let h=e[n],o=t[n];return!!o&&!!h&&(i||s())-h>o}}#v=()=>{};#T=()=>{};#G=()=>{};#g=()=>!1;#k(){let t=new E(this.#l);this.#S=0,this.#b=t,this.#C=e=>{this.#S-=t[e],t[e]=0},this.#j=(e,i,s,n)=>{if(this.#e(i))return 0;if(!y(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,e),!y(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#x=(e,i,s)=>{if(t[e]=i,this.#c){let n=this.#c-t[e];for(;this.#S>n;)this.#U(!0)}this.#S+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#S)}}#C=t=>{};#x=(t,e,i)=>{};#j=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#A({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#h;!(!this.#N(e)||((t||!this.#g(e))&&(yield e),e===this.#o));)e=this.#u[e]}*#F({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#o;!(!this.#N(e)||((t||!this.#g(e))&&(yield e),e===this.#h));)e=this.#a[e]}#N(t){return t!==void 0&&this.#s.get(this.#i[t])===t}*entries(){for(let t of this.#A())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield[this.#i[t],this.#t[t]])}*rentries(){for(let t of this.#F())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield[this.#i[t],this.#t[t]])}*keys(){for(let t of this.#A()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e)}}*rkeys(){for(let t of this.#F()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e)}}*values(){for(let t of this.#A())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t])}*rvalues(){for(let t of this.#F())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;if(n!==void 0&&t(n,this.#i[i],this))return this.get(this.#i[i],e)}}forEach(t,e=this){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#i[i],this)}}rforEach(t,e=this){for(let i of this.#F()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#i[i],this)}}purgeStale(){let t=!1;for(let e of this.#F({allowStale:!0}))this.#g(e)&&(this.#O(this.#i[e],"expire"),t=!0);return t}info(t){let e=this.#s.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#d&&this.#m){let h=this.#d[e],o=this.#m[e];if(h&&o){let r=h-(T.now()-o);n.ttl=r,n.start=Date.now()}}return this.#b&&(n.size=this.#b[e]),n}dump(){let t=[];for(let e of this.#A({allowStale:!0})){let i=this.#i[e],s=this.#t[e],n=this.#e(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let h={value:n};if(this.#d&&this.#m){h.ttl=this.#d[e];let o=T.now()-this.#m[e];h.start=Math.floor(Date.now()-o)}this.#b&&(h.size=this.#b[e]),t.unshift([i,h])}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=T.now()-s}this.set(e,i.value,i)}}set(t,e,i={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:n,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:r}=i,{noUpdateTTL:g=this.noUpdateTTL}=i,_=this.#j(t,e,i.size||0,o);if(this.maxEntrySize&&_>this.maxEntrySize)return r&&(r.set="miss",r.maxEntrySizeExceeded=!0),this.#O(t,"set"),this;let f=this.#n===0?void 0:this.#s.get(t);if(f===void 0)f=this.#n===0?this.#h:this.#_.length!==0?this.#_.pop():this.#n===this.#l?this.#U(!1):this.#n,this.#i[f]=t,this.#t[f]=e,this.#s.set(t,f),this.#a[this.#h]=f,this.#u[f]=this.#h,this.#h=f,this.#n++,this.#x(f,_,r),r&&(r.set="add"),g=!1,this.#L&&this.#z?.(e,t,"add");else{this.#R(f);let c=this.#t[f];if(e!==c){if(this.#E&&this.#e(c)){c.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:u}=c;u!==void 0&&!h&&(this.#y&&this.#p?.(u,t,"set"),this.#f&&this.#r?.push([u,t,"set"]))}else h||(this.#y&&this.#p?.(c,t,"set"),this.#f&&this.#r?.push([c,t,"set"]));if(this.#C(f),this.#x(f,_,r),this.#t[f]=e,r){r.set="replace";let u=c&&this.#e(c)?c.__staleWhileFetching:c;u!==void 0&&(r.oldValue=u)}}else r&&(r.set="update");this.#L&&this.onInsert?.(e,t,e===c?"update":"replace")}if(s!==0&&!this.#d&&this.#M(),this.#d&&(g||this.#G(f,s,n),r&&this.#T(r,f)),!h&&this.#f&&this.#r){let c=this.#r,u;for(;u=c?.shift();)this.#w?.(...u)}return this}pop(){try{for(;this.#n;){let t=this.#t[this.#o];if(this.#U(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#f&&this.#r){let t=this.#r,e;for(;e=t?.shift();)this.#w?.(...e)}}}#U(t){let e=this.#o,i=this.#i[e],s=this.#t[e];return this.#E&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#y||this.#f)&&(this.#y&&this.#p?.(s,i,"evict"),this.#f&&this.#r?.push([s,i,"evict"])),this.#C(e),t&&(this.#i[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#n===1?(this.#o=this.#h=0,this.#_.length=0):this.#o=this.#a[e],this.#s.delete(i),this.#n--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,n=this.#s.get(t);if(n!==void 0){let h=this.#t[n];if(this.#e(h)&&h.__staleWhileFetching===void 0)return!1;if(this.#g(n))s&&(s.has="stale",this.#T(s,n));else return i&&this.#v(n),s&&(s.has="hit",this.#T(s,n)),!0}else s&&(s.has="miss");return!1}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#s.get(t);if(s===void 0||!i&&this.#g(s))return;let n=this.#t[s];return this.#e(n)?n.__staleWhileFetching:n}#I(t,e,i,s){let n=e===void 0?void 0:this.#t[e];if(this.#e(n))return n;let h=new C,{signal:o}=i;o?.addEventListener("abort",()=>h.abort(o.reason),{signal:h.signal});let r={signal:h.signal,options:i,context:s},g=(d,b=!1)=>{let{aborted:l}=h.signal,w=i.ignoreFetchAbort&&d!==void 0;if(i.status&&(l&&!b?(i.status.fetchAborted=!0,i.status.fetchError=h.signal.reason,w&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),l&&!w&&!b)return f(h.signal.reason);let m=u;return this.#t[e]===u&&(d===void 0?m.__staleWhileFetching?this.#t[e]=m.__staleWhileFetching:this.#O(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,d,r.options))),d},_=d=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=d),f(d)),f=d=>{let{aborted:b}=h.signal,l=b&&i.allowStaleOnFetchAbort,w=l||i.allowStaleOnFetchRejection,m=w||i.noDeleteOnFetchRejection,p=u;if(this.#t[e]===u&&(!m||p.__staleWhileFetching===void 0?this.#O(t,"fetch"):l||(this.#t[e]=p.__staleWhileFetching)),w)return i.status&&p.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),p.__staleWhileFetching;if(p.__returned===p)throw d},c=(d,b)=>{let l=this.#W?.(t,n,r);l&&l instanceof Promise&&l.then(w=>d(w===void 0?void 0:w),b),h.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(d(void 0),i.allowStaleOnFetchAbort&&(d=w=>g(w,!0)))})};i.status&&(i.status.fetchDispatched=!0);let u=new Promise(c).then(g,_),A=Object.assign(u,{__abortController:h,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.set(t,A,{...r.options,status:void 0}),e=this.#s.get(t)):this.#t[e]=A,A}#e(t){if(!this.#E)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof C}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:r=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:_=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:u=this.ignoreFetchAbort,allowStaleOnFetchAbort:A=this.allowStaleOnFetchAbort,context:d,forceRefresh:b=!1,status:l,signal:w}=e;if(!this.#E)return l&&(l.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:l});let m={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:h,noDisposeOnSet:o,size:r,sizeCalculation:g,noUpdateTTL:_,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:A,ignoreFetchAbort:u,status:l,signal:w},p=this.#s.get(t);if(p===void 0){l&&(l.fetch="miss");let S=this.#I(t,p,m,d);return S.__returned=S}else{let S=this.#t[p];if(this.#e(S)){let R=i&&S.__staleWhileFetching!==void 0;return l&&(l.fetch="inflight",R&&(l.returnedStale=!0)),R?S.__staleWhileFetching:S.__returned=S}let z=this.#g(p);if(!b&&!z)return l&&(l.fetch="hit"),this.#R(p),s&&this.#v(p),l&&this.#T(l,p),S;let F=this.#I(t,p,m,d),O=F.__staleWhileFetching!==void 0&&i;return l&&(l.fetch=z?"stale":"refresh",O&&z&&(l.returnedStale=!0)),O?F.__staleWhileFetching:F.__returned=F}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#D;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:n,...h}=e,o=this.get(t,h);if(!n&&o!==void 0)return o;let r=i(t,o,{options:h,context:s});return this.set(t,r,h),r}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:h}=e,o=this.#s.get(t);if(o!==void 0){let r=this.#t[o],g=this.#e(r);return h&&this.#T(h,o),this.#g(o)?(h&&(h.get="stale"),g?(h&&i&&r.__staleWhileFetching!==void 0&&(h.returnedStale=!0),i?r.__staleWhileFetching:void 0):(n||this.#O(t,"expire"),h&&i&&(h.returnedStale=!0),i?r:void 0)):(h&&(h.get="hit"),g?r.__staleWhileFetching:(this.#R(o),s&&this.#v(o),r))}else h&&(h.get="miss")}#P(t,e){this.#u[e]=t,this.#a[t]=e}#R(t){t!==this.#h&&(t===this.#o?this.#o=this.#a[t]:this.#P(this.#u[t],this.#a[t]),this.#P(this.#h,t),this.#h=t)}delete(t){return this.#O(t,"delete")}#O(t,e){let i=!1;if(this.#n!==0){let s=this.#s.get(t);if(s!==void 0)if(i=!0,this.#n===1)this.#H(e);else{this.#C(s);let n=this.#t[s];if(this.#e(n)?n.__abortController.abort(new Error("deleted")):(this.#y||this.#f)&&(this.#y&&this.#p?.(n,t,e),this.#f&&this.#r?.push([n,t,e])),this.#s.delete(t),this.#i[s]=void 0,this.#t[s]=void 0,s===this.#h)this.#h=this.#u[s];else if(s===this.#o)this.#o=this.#a[s];else{let h=this.#u[s];this.#a[h]=this.#a[s];let o=this.#a[s];this.#u[o]=this.#u[s]}this.#n--,this.#_.push(s)}}if(this.#f&&this.#r?.length){let s=this.#r,n;for(;n=s?.shift();)this.#w?.(...n)}return i}clear(){return this.#H("delete")}#H(t){for(let e of this.#F({allowStale:!0})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#i[e];this.#y&&this.#p?.(i,s,t),this.#f&&this.#r?.push([i,s,t])}}if(this.#s.clear(),this.#t.fill(void 0),this.#i.fill(void 0),this.#d&&this.#m&&(this.#d.fill(0),this.#m.fill(0)),this.#b&&this.#b.fill(0),this.#o=0,this.#h=0,this.#_.length=0,this.#S=0,this.#n=0,this.#f&&this.#r){let e=this.#r,i;for(;i=e?.shift();)this.#w?.(...i)}}};exports.LRUCache=L;
2
+ //# sourceMappingURL=index.min.js.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/commonjs/index.min.js.map ADDED
The diff for this file is too large to render. See raw diff
 
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/esm/index.d.ts ADDED
@@ -0,0 +1,1306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @module LRUCache
3
+ */
4
+ declare const TYPE: unique symbol;
5
+ export type PosInt = number & {
6
+ [TYPE]: 'Positive Integer';
7
+ };
8
+ export type Index = number & {
9
+ [TYPE]: 'LRUCache Index';
10
+ };
11
+ export type UintArray = Uint8Array | Uint16Array | Uint32Array;
12
+ export type NumberArray = UintArray | number[];
13
+ declare class ZeroArray extends Array<number> {
14
+ constructor(size: number);
15
+ }
16
+ export type { ZeroArray };
17
+ export type { Stack };
18
+ export type StackLike = Stack | Index[];
19
+ declare class Stack {
20
+ #private;
21
+ heap: NumberArray;
22
+ length: number;
23
+ static create(max: number): StackLike;
24
+ constructor(max: number, HeapCls: {
25
+ new (n: number): NumberArray;
26
+ });
27
+ push(n: Index): void;
28
+ pop(): Index;
29
+ }
30
+ /**
31
+ * Promise representing an in-progress {@link LRUCache#fetch} call
32
+ */
33
+ export type BackgroundFetch<V> = Promise<V | undefined> & {
34
+ __returned: BackgroundFetch<V> | undefined;
35
+ __abortController: AbortController;
36
+ __staleWhileFetching: V | undefined;
37
+ };
38
+ export type DisposeTask<K, V> = [
39
+ value: V,
40
+ key: K,
41
+ reason: LRUCache.DisposeReason
42
+ ];
43
+ export declare namespace LRUCache {
44
+ /**
45
+ * An integer greater than 0, reflecting the calculated size of items
46
+ */
47
+ type Size = number;
48
+ /**
49
+ * Integer greater than 0, representing some number of milliseconds, or the
50
+ * time at which a TTL started counting from.
51
+ */
52
+ type Milliseconds = number;
53
+ /**
54
+ * An integer greater than 0, reflecting a number of items
55
+ */
56
+ type Count = number;
57
+ /**
58
+ * The reason why an item was removed from the cache, passed
59
+ * to the {@link Disposer} methods.
60
+ *
61
+ * - `evict`: The item was evicted because it is the least recently used,
62
+ * and the cache is full.
63
+ * - `set`: A new value was set, overwriting the old value being disposed.
64
+ * - `delete`: The item was explicitly deleted, either by calling
65
+ * {@link LRUCache#delete}, {@link LRUCache#clear}, or
66
+ * {@link LRUCache#set} with an undefined value.
67
+ * - `expire`: The item was removed due to exceeding its TTL.
68
+ * - `fetch`: A {@link OptionsBase#fetchMethod} operation returned
69
+ * `undefined` or was aborted, causing the item to be deleted.
70
+ */
71
+ type DisposeReason = 'evict' | 'set' | 'delete' | 'expire' | 'fetch';
72
+ /**
73
+ * A method called upon item removal, passed as the
74
+ * {@link OptionsBase.dispose} and/or
75
+ * {@link OptionsBase.disposeAfter} options.
76
+ */
77
+ type Disposer<K, V> = (value: V, key: K, reason: DisposeReason) => void;
78
+ /**
79
+ * The reason why an item was added to the cache, passed
80
+ * to the {@link Inserter} methods.
81
+ *
82
+ * - `add`: the item was not found in the cache, and was added
83
+ * - `update`: the item was in the cache, with the same value provided
84
+ * - `replace`: the item was in the cache, and replaced
85
+ */
86
+ type InsertReason = 'add' | 'update' | 'replace';
87
+ /**
88
+ * A method called upon item insertion, passed as the
89
+ * {@link OptionsBase.insert}
90
+ */
91
+ type Inserter<K, V> = (value: V, key: K, reason: InsertReason) => void;
92
+ /**
93
+ * A function that returns the effective calculated size
94
+ * of an entry in the cache.
95
+ */
96
+ type SizeCalculator<K, V> = (value: V, key: K) => Size;
97
+ /**
98
+ * Options provided to the
99
+ * {@link OptionsBase.fetchMethod} function.
100
+ */
101
+ interface FetcherOptions<K, V, FC = unknown> {
102
+ signal: AbortSignal;
103
+ options: FetcherFetchOptions<K, V, FC>;
104
+ /**
105
+ * Object provided in the {@link FetchOptions.context} option to
106
+ * {@link LRUCache#fetch}
107
+ */
108
+ context: FC;
109
+ }
110
+ /**
111
+ * Occasionally, it may be useful to track the internal behavior of the
112
+ * cache, particularly for logging, debugging, or for behavior within the
113
+ * `fetchMethod`. To do this, you can pass a `status` object to the
114
+ * {@link LRUCache#fetch}, {@link LRUCache#get}, {@link LRUCache#set},
115
+ * {@link LRUCache#memo}, and {@link LRUCache#has} methods.
116
+ *
117
+ * The `status` option should be a plain JavaScript object. The following
118
+ * fields will be set on it appropriately, depending on the situation.
119
+ */
120
+ interface Status<V> {
121
+ /**
122
+ * The status of a set() operation.
123
+ *
124
+ * - add: the item was not found in the cache, and was added
125
+ * - update: the item was in the cache, with the same value provided
126
+ * - replace: the item was in the cache, and replaced
127
+ * - miss: the item was not added to the cache for some reason
128
+ */
129
+ set?: 'add' | 'update' | 'replace' | 'miss';
130
+ /**
131
+ * the ttl stored for the item, or undefined if ttls are not used.
132
+ */
133
+ ttl?: Milliseconds;
134
+ /**
135
+ * the start time for the item, or undefined if ttls are not used.
136
+ */
137
+ start?: Milliseconds;
138
+ /**
139
+ * The timestamp used for TTL calculation
140
+ */
141
+ now?: Milliseconds;
142
+ /**
143
+ * the remaining ttl for the item, or undefined if ttls are not used.
144
+ */
145
+ remainingTTL?: Milliseconds;
146
+ /**
147
+ * The calculated size for the item, if sizes are used.
148
+ */
149
+ entrySize?: Size;
150
+ /**
151
+ * The total calculated size of the cache, if sizes are used.
152
+ */
153
+ totalCalculatedSize?: Size;
154
+ /**
155
+ * A flag indicating that the item was not stored, due to exceeding the
156
+ * {@link OptionsBase.maxEntrySize}
157
+ */
158
+ maxEntrySizeExceeded?: true;
159
+ /**
160
+ * The old value, specified in the case of `set:'update'` or
161
+ * `set:'replace'`
162
+ */
163
+ oldValue?: V;
164
+ /**
165
+ * The results of a {@link LRUCache#has} operation
166
+ *
167
+ * - hit: the item was found in the cache
168
+ * - stale: the item was found in the cache, but is stale
169
+ * - miss: the item was not found in the cache
170
+ */
171
+ has?: 'hit' | 'stale' | 'miss';
172
+ /**
173
+ * The status of a {@link LRUCache#fetch} operation.
174
+ * Note that this can change as the underlying fetch() moves through
175
+ * various states.
176
+ *
177
+ * - inflight: there is another fetch() for this key which is in process
178
+ * - get: there is no {@link OptionsBase.fetchMethod}, so
179
+ * {@link LRUCache#get} was called.
180
+ * - miss: the item is not in cache, and will be fetched.
181
+ * - hit: the item is in the cache, and was resolved immediately.
182
+ * - stale: the item is in the cache, but stale.
183
+ * - refresh: the item is in the cache, and not stale, but
184
+ * {@link FetchOptions.forceRefresh} was specified.
185
+ */
186
+ fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh';
187
+ /**
188
+ * The {@link OptionsBase.fetchMethod} was called
189
+ */
190
+ fetchDispatched?: true;
191
+ /**
192
+ * The cached value was updated after a successful call to
193
+ * {@link OptionsBase.fetchMethod}
194
+ */
195
+ fetchUpdated?: true;
196
+ /**
197
+ * The reason for a fetch() rejection. Either the error raised by the
198
+ * {@link OptionsBase.fetchMethod}, or the reason for an
199
+ * AbortSignal.
200
+ */
201
+ fetchError?: Error;
202
+ /**
203
+ * The fetch received an abort signal
204
+ */
205
+ fetchAborted?: true;
206
+ /**
207
+ * The abort signal received was ignored, and the fetch was allowed to
208
+ * continue.
209
+ */
210
+ fetchAbortIgnored?: true;
211
+ /**
212
+ * The fetchMethod promise resolved successfully
213
+ */
214
+ fetchResolved?: true;
215
+ /**
216
+ * The fetchMethod promise was rejected
217
+ */
218
+ fetchRejected?: true;
219
+ /**
220
+ * The status of a {@link LRUCache#get} operation.
221
+ *
222
+ * - fetching: The item is currently being fetched. If a previous value
223
+ * is present and allowed, that will be returned.
224
+ * - stale: The item is in the cache, and is stale.
225
+ * - hit: the item is in the cache
226
+ * - miss: the item is not in the cache
227
+ */
228
+ get?: 'stale' | 'hit' | 'miss';
229
+ /**
230
+ * A fetch or get operation returned a stale value.
231
+ */
232
+ returnedStale?: true;
233
+ }
234
+ /**
235
+ * options which override the options set in the LRUCache constructor
236
+ * when calling {@link LRUCache#fetch}.
237
+ *
238
+ * This is the union of {@link GetOptions} and {@link SetOptions}, plus
239
+ * {@link OptionsBase.noDeleteOnFetchRejection},
240
+ * {@link OptionsBase.allowStaleOnFetchRejection},
241
+ * {@link FetchOptions.forceRefresh}, and
242
+ * {@link FetcherOptions.context}
243
+ *
244
+ * Any of these may be modified in the {@link OptionsBase.fetchMethod}
245
+ * function, but the {@link GetOptions} fields will of course have no
246
+ * effect, as the {@link LRUCache#get} call already happened by the time
247
+ * the fetchMethod is called.
248
+ */
249
+ interface FetcherFetchOptions<K, V, FC = unknown> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL' | 'noDeleteOnFetchRejection' | 'allowStaleOnFetchRejection' | 'ignoreFetchAbort' | 'allowStaleOnFetchAbort'> {
250
+ status?: Status<V>;
251
+ size?: Size;
252
+ }
253
+ /**
254
+ * Options that may be passed to the {@link LRUCache#fetch} method.
255
+ */
256
+ interface FetchOptions<K, V, FC> extends FetcherFetchOptions<K, V, FC> {
257
+ /**
258
+ * Set to true to force a re-load of the existing data, even if it
259
+ * is not yet stale.
260
+ */
261
+ forceRefresh?: boolean;
262
+ /**
263
+ * Context provided to the {@link OptionsBase.fetchMethod} as
264
+ * the {@link FetcherOptions.context} param.
265
+ *
266
+ * If the FC type is specified as unknown (the default),
267
+ * undefined or void, then this is optional. Otherwise, it will
268
+ * be required.
269
+ */
270
+ context?: FC;
271
+ signal?: AbortSignal;
272
+ status?: Status<V>;
273
+ }
274
+ /**
275
+ * Options provided to {@link LRUCache#fetch} when the FC type is something
276
+ * other than `unknown`, `undefined`, or `void`
277
+ */
278
+ interface FetchOptionsWithContext<K, V, FC> extends FetchOptions<K, V, FC> {
279
+ context: FC;
280
+ }
281
+ /**
282
+ * Options provided to {@link LRUCache#fetch} when the FC type is
283
+ * `undefined` or `void`
284
+ */
285
+ interface FetchOptionsNoContext<K, V> extends FetchOptions<K, V, undefined> {
286
+ context?: undefined;
287
+ }
288
+ interface MemoOptions<K, V, FC = unknown> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL' | 'noDeleteOnFetchRejection' | 'allowStaleOnFetchRejection' | 'ignoreFetchAbort' | 'allowStaleOnFetchAbort'> {
289
+ /**
290
+ * Set to true to force a re-load of the existing data, even if it
291
+ * is not yet stale.
292
+ */
293
+ forceRefresh?: boolean;
294
+ /**
295
+ * Context provided to the {@link OptionsBase.memoMethod} as
296
+ * the {@link MemoizerOptions.context} param.
297
+ *
298
+ * If the FC type is specified as unknown (the default),
299
+ * undefined or void, then this is optional. Otherwise, it will
300
+ * be required.
301
+ */
302
+ context?: FC;
303
+ status?: Status<V>;
304
+ }
305
+ /**
306
+ * Options provided to {@link LRUCache#memo} when the FC type is something
307
+ * other than `unknown`, `undefined`, or `void`
308
+ */
309
+ interface MemoOptionsWithContext<K, V, FC> extends MemoOptions<K, V, FC> {
310
+ context: FC;
311
+ }
312
+ /**
313
+ * Options provided to {@link LRUCache#memo} when the FC type is
314
+ * `undefined` or `void`
315
+ */
316
+ interface MemoOptionsNoContext<K, V> extends MemoOptions<K, V, undefined> {
317
+ context?: undefined;
318
+ }
319
+ /**
320
+ * Options provided to the
321
+ * {@link OptionsBase.memoMethod} function.
322
+ */
323
+ interface MemoizerOptions<K, V, FC = unknown> {
324
+ options: MemoizerMemoOptions<K, V, FC>;
325
+ /**
326
+ * Object provided in the {@link MemoOptions.context} option to
327
+ * {@link LRUCache#memo}
328
+ */
329
+ context: FC;
330
+ }
331
+ /**
332
+ * options which override the options set in the LRUCache constructor
333
+ * when calling {@link LRUCache#memo}.
334
+ *
335
+ * This is the union of {@link GetOptions} and {@link SetOptions}, plus
336
+ * {@link MemoOptions.forceRefresh}, and
337
+ * {@link MemoOptions.context}
338
+ *
339
+ * Any of these may be modified in the {@link OptionsBase.memoMethod}
340
+ * function, but the {@link GetOptions} fields will of course have no
341
+ * effect, as the {@link LRUCache#get} call already happened by the time
342
+ * the memoMethod is called.
343
+ */
344
+ interface MemoizerMemoOptions<K, V, FC = unknown> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL'> {
345
+ status?: Status<V>;
346
+ size?: Size;
347
+ start?: Milliseconds;
348
+ }
349
+ /**
350
+ * Options that may be passed to the {@link LRUCache#has} method.
351
+ */
352
+ interface HasOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'updateAgeOnHas'> {
353
+ status?: Status<V>;
354
+ }
355
+ /**
356
+ * Options that may be passed to the {@link LRUCache#get} method.
357
+ */
358
+ interface GetOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet'> {
359
+ status?: Status<V>;
360
+ }
361
+ /**
362
+ * Options that may be passed to the {@link LRUCache#peek} method.
363
+ */
364
+ interface PeekOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'allowStale'> {
365
+ }
366
+ /**
367
+ * Options that may be passed to the {@link LRUCache#set} method.
368
+ */
369
+ interface SetOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL'> {
370
+ /**
371
+ * If size tracking is enabled, then setting an explicit size
372
+ * in the {@link LRUCache#set} call will prevent calling the
373
+ * {@link OptionsBase.sizeCalculation} function.
374
+ */
375
+ size?: Size;
376
+ /**
377
+ * If TTL tracking is enabled, then setting an explicit start
378
+ * time in the {@link LRUCache#set} call will override the
379
+ * default time from `performance.now()` or `Date.now()`.
380
+ *
381
+ * Note that it must be a valid value for whichever time-tracking
382
+ * method is in use.
383
+ */
384
+ start?: Milliseconds;
385
+ status?: Status<V>;
386
+ }
387
+ /**
388
+ * The type signature for the {@link OptionsBase.fetchMethod} option.
389
+ */
390
+ type Fetcher<K, V, FC = unknown> = (key: K, staleValue: V | undefined, options: FetcherOptions<K, V, FC>) => Promise<V | undefined | void> | V | undefined | void;
391
+ /**
392
+ * the type signature for the {@link OptionsBase.memoMethod} option.
393
+ */
394
+ type Memoizer<K, V, FC = unknown> = (key: K, staleValue: V | undefined, options: MemoizerOptions<K, V, FC>) => V;
395
+ /**
396
+ * Options which may be passed to the {@link LRUCache} constructor.
397
+ *
398
+ * Most of these may be overridden in the various options that use
399
+ * them.
400
+ *
401
+ * Despite all being technically optional, the constructor requires that
402
+ * a cache is at minimum limited by one or more of {@link OptionsBase.max},
403
+ * {@link OptionsBase.ttl}, or {@link OptionsBase.maxSize}.
404
+ *
405
+ * If {@link OptionsBase.ttl} is used alone, then it is strongly advised
406
+ * (and in fact required by the type definitions here) that the cache
407
+ * also set {@link OptionsBase.ttlAutopurge}, to prevent potentially
408
+ * unbounded storage.
409
+ *
410
+ * All options are also available on the {@link LRUCache} instance, making
411
+ * it safe to pass an LRUCache instance as the options argumemnt to
412
+ * make another empty cache of the same type.
413
+ *
414
+ * Some options are marked as read-only, because changing them after
415
+ * instantiation is not safe. Changing any of the other options will of
416
+ * course only have an effect on subsequent method calls.
417
+ */
418
+ interface OptionsBase<K, V, FC> {
419
+ /**
420
+ * The maximum number of items to store in the cache before evicting
421
+ * old entries. This is read-only on the {@link LRUCache} instance,
422
+ * and may not be overridden.
423
+ *
424
+ * If set, then storage space will be pre-allocated at construction
425
+ * time, and the cache will perform significantly faster.
426
+ *
427
+ * Note that significantly fewer items may be stored, if
428
+ * {@link OptionsBase.maxSize} and/or {@link OptionsBase.ttl} are also
429
+ * set.
430
+ *
431
+ * **It is strongly recommended to set a `max` to prevent unbounded growth
432
+ * of the cache.**
433
+ */
434
+ max?: Count;
435
+ /**
436
+ * Max time in milliseconds for items to live in cache before they are
437
+ * considered stale. Note that stale items are NOT preemptively removed by
438
+ * default, and MAY live in the cache, contributing to its LRU max, long
439
+ * after they have expired, unless {@link OptionsBase.ttlAutopurge} is
440
+ * set.
441
+ *
442
+ * If set to `0` (the default value), then that means "do not track
443
+ * TTL", not "expire immediately".
444
+ *
445
+ * Also, as this cache is optimized for LRU/MRU operations, some of
446
+ * the staleness/TTL checks will reduce performance, as they will incur
447
+ * overhead by deleting items.
448
+ *
449
+ * This is not primarily a TTL cache, and does not make strong TTL
450
+ * guarantees. There is no pre-emptive pruning of expired items, but you
451
+ * _may_ set a TTL on the cache, and it will treat expired items as missing
452
+ * when they are fetched, and delete them.
453
+ *
454
+ * Optional, but must be a non-negative integer in ms if specified.
455
+ *
456
+ * This may be overridden by passing an options object to `cache.set()`.
457
+ *
458
+ * At least one of `max`, `maxSize`, or `TTL` is required. This must be a
459
+ * positive integer if set.
460
+ *
461
+ * Even if ttl tracking is enabled, **it is strongly recommended to set a
462
+ * `max` to prevent unbounded growth of the cache.**
463
+ *
464
+ * If ttl tracking is enabled, and `max` and `maxSize` are not set,
465
+ * and `ttlAutopurge` is not set, then a warning will be emitted
466
+ * cautioning about the potential for unbounded memory consumption.
467
+ * (The TypeScript definitions will also discourage this.)
468
+ */
469
+ ttl?: Milliseconds;
470
+ /**
471
+ * Minimum amount of time in ms in which to check for staleness.
472
+ * Defaults to 1, which means that the current time is checked
473
+ * at most once per millisecond.
474
+ *
475
+ * Set to 0 to check the current time every time staleness is tested.
476
+ * (This reduces performance, and is theoretically unnecessary.)
477
+ *
478
+ * Setting this to a higher value will improve performance somewhat
479
+ * while using ttl tracking, albeit at the expense of keeping stale
480
+ * items around a bit longer than their TTLs would indicate.
481
+ *
482
+ * @default 1
483
+ */
484
+ ttlResolution?: Milliseconds;
485
+ /**
486
+ * Preemptively remove stale items from the cache.
487
+ *
488
+ * Note that this may *significantly* degrade performance, especially if
489
+ * the cache is storing a large number of items. It is almost always best
490
+ * to just leave the stale items in the cache, and let them fall out as new
491
+ * items are added.
492
+ *
493
+ * Note that this means that {@link OptionsBase.allowStale} is a bit
494
+ * pointless, as stale items will be deleted almost as soon as they
495
+ * expire.
496
+ *
497
+ * Use with caution!
498
+ */
499
+ ttlAutopurge?: boolean;
500
+ /**
501
+ * When using time-expiring entries with `ttl`, setting this to `true` will
502
+ * make each item's age reset to 0 whenever it is retrieved from cache with
503
+ * {@link LRUCache#get}, causing it to not expire. (It can still fall out
504
+ * of cache based on recency of use, of course.)
505
+ *
506
+ * Has no effect if {@link OptionsBase.ttl} is not set.
507
+ *
508
+ * This may be overridden by passing an options object to `cache.get()`.
509
+ */
510
+ updateAgeOnGet?: boolean;
511
+ /**
512
+ * When using time-expiring entries with `ttl`, setting this to `true` will
513
+ * make each item's age reset to 0 whenever its presence in the cache is
514
+ * checked with {@link LRUCache#has}, causing it to not expire. (It can
515
+ * still fall out of cache based on recency of use, of course.)
516
+ *
517
+ * Has no effect if {@link OptionsBase.ttl} is not set.
518
+ */
519
+ updateAgeOnHas?: boolean;
520
+ /**
521
+ * Allow {@link LRUCache#get} and {@link LRUCache#fetch} calls to return
522
+ * stale data, if available.
523
+ *
524
+ * By default, if you set `ttl`, stale items will only be deleted from the
525
+ * cache when you `get(key)`. That is, it's not preemptively pruning items,
526
+ * unless {@link OptionsBase.ttlAutopurge} is set.
527
+ *
528
+ * If you set `allowStale:true`, it'll return the stale value *as well as*
529
+ * deleting it. If you don't set this, then it'll return `undefined` when
530
+ * you try to get a stale entry.
531
+ *
532
+ * Note that when a stale entry is fetched, _even if it is returned due to
533
+ * `allowStale` being set_, it is removed from the cache immediately. You
534
+ * can suppress this behavior by setting
535
+ * {@link OptionsBase.noDeleteOnStaleGet}, either in the constructor, or in
536
+ * the options provided to {@link LRUCache#get}.
537
+ *
538
+ * This may be overridden by passing an options object to `cache.get()`.
539
+ * The `cache.has()` method will always return `false` for stale items.
540
+ *
541
+ * Only relevant if a ttl is set.
542
+ */
543
+ allowStale?: boolean;
544
+ /**
545
+ * Function that is called on items when they are dropped from the
546
+ * cache, as `dispose(value, key, reason)`.
547
+ *
548
+ * This can be handy if you want to close file descriptors or do
549
+ * other cleanup tasks when items are no longer stored in the cache.
550
+ *
551
+ * **NOTE**: It is called _before_ the item has been fully removed
552
+ * from the cache, so if you want to put it right back in, you need
553
+ * to wait until the next tick. If you try to add it back in during
554
+ * the `dispose()` function call, it will break things in subtle and
555
+ * weird ways.
556
+ *
557
+ * Unlike several other options, this may _not_ be overridden by
558
+ * passing an option to `set()`, for performance reasons.
559
+ *
560
+ * The `reason` will be one of the following strings, corresponding
561
+ * to the reason for the item's deletion:
562
+ *
563
+ * - `evict` Item was evicted to make space for a new addition
564
+ * - `set` Item was overwritten by a new value
565
+ * - `expire` Item expired its TTL
566
+ * - `fetch` Item was deleted due to a failed or aborted fetch, or a
567
+ * fetchMethod returning `undefined.
568
+ * - `delete` Item was removed by explicit `cache.delete(key)`,
569
+ * `cache.clear()`, or `cache.set(key, undefined)`.
570
+ */
571
+ dispose?: Disposer<K, V>;
572
+ /**
573
+ * Function that is called when new items are inserted into the cache,
574
+ * as `onInsert(value, key, reason)`.
575
+ *
576
+ * This can be useful if you need to perform actions when an item is
577
+ * added, such as logging or tracking insertions.
578
+ *
579
+ * Unlike some other options, this may _not_ be overridden by passing
580
+ * an option to `set()`, for performance and consistency reasons.
581
+ */
582
+ onInsert?: Inserter<K, V>;
583
+ /**
584
+ * The same as {@link OptionsBase.dispose}, but called *after* the entry
585
+ * is completely removed and the cache is once again in a clean state.
586
+ *
587
+ * It is safe to add an item right back into the cache at this point.
588
+ * However, note that it is *very* easy to inadvertently create infinite
589
+ * recursion this way.
590
+ */
591
+ disposeAfter?: Disposer<K, V>;
592
+ /**
593
+ * Set to true to suppress calling the
594
+ * {@link OptionsBase.dispose} function if the entry key is
595
+ * still accessible within the cache.
596
+ *
597
+ * This may be overridden by passing an options object to
598
+ * {@link LRUCache#set}.
599
+ *
600
+ * Only relevant if `dispose` or `disposeAfter` are set.
601
+ */
602
+ noDisposeOnSet?: boolean;
603
+ /**
604
+ * Boolean flag to tell the cache to not update the TTL when setting a new
605
+ * value for an existing key (ie, when updating a value rather than
606
+ * inserting a new value). Note that the TTL value is _always_ set (if
607
+ * provided) when adding a new entry into the cache.
608
+ *
609
+ * Has no effect if a {@link OptionsBase.ttl} is not set.
610
+ *
611
+ * May be passed as an option to {@link LRUCache#set}.
612
+ */
613
+ noUpdateTTL?: boolean;
614
+ /**
615
+ * Set to a positive integer to track the sizes of items added to the
616
+ * cache, and automatically evict items in order to stay below this size.
617
+ * Note that this may result in fewer than `max` items being stored.
618
+ *
619
+ * Attempting to add an item to the cache whose calculated size is greater
620
+ * that this amount will be a no-op. The item will not be cached, and no
621
+ * other items will be evicted.
622
+ *
623
+ * Optional, must be a positive integer if provided.
624
+ *
625
+ * Sets `maxEntrySize` to the same value, unless a different value is
626
+ * provided for `maxEntrySize`.
627
+ *
628
+ * At least one of `max`, `maxSize`, or `TTL` is required. This must be a
629
+ * positive integer if set.
630
+ *
631
+ * Even if size tracking is enabled, **it is strongly recommended to set a
632
+ * `max` to prevent unbounded growth of the cache.**
633
+ *
634
+ * Note also that size tracking can negatively impact performance,
635
+ * though for most cases, only minimally.
636
+ */
637
+ maxSize?: Size;
638
+ /**
639
+ * The maximum allowed size for any single item in the cache.
640
+ *
641
+ * If a larger item is passed to {@link LRUCache#set} or returned by a
642
+ * {@link OptionsBase.fetchMethod} or {@link OptionsBase.memoMethod}, then
643
+ * it will not be stored in the cache.
644
+ *
645
+ * Attempting to add an item whose calculated size is greater than
646
+ * this amount will not cache the item or evict any old items, but
647
+ * WILL delete an existing value if one is already present.
648
+ *
649
+ * Optional, must be a positive integer if provided. Defaults to
650
+ * the value of `maxSize` if provided.
651
+ */
652
+ maxEntrySize?: Size;
653
+ /**
654
+ * A function that returns a number indicating the item's size.
655
+ *
656
+ * Requires {@link OptionsBase.maxSize} to be set.
657
+ *
658
+ * If not provided, and {@link OptionsBase.maxSize} or
659
+ * {@link OptionsBase.maxEntrySize} are set, then all
660
+ * {@link LRUCache#set} calls **must** provide an explicit
661
+ * {@link SetOptions.size} or sizeCalculation param.
662
+ */
663
+ sizeCalculation?: SizeCalculator<K, V>;
664
+ /**
665
+ * Method that provides the implementation for {@link LRUCache#fetch}
666
+ *
667
+ * ```ts
668
+ * fetchMethod(key, staleValue, { signal, options, context })
669
+ * ```
670
+ *
671
+ * If `fetchMethod` is not provided, then `cache.fetch(key)` is equivalent
672
+ * to `Promise.resolve(cache.get(key))`.
673
+ *
674
+ * If at any time, `signal.aborted` is set to `true`, or if the
675
+ * `signal.onabort` method is called, or if it emits an `'abort'` event
676
+ * which you can listen to with `addEventListener`, then that means that
677
+ * the fetch should be abandoned. This may be passed along to async
678
+ * functions aware of AbortController/AbortSignal behavior.
679
+ *
680
+ * The `fetchMethod` should **only** return `undefined` or a Promise
681
+ * resolving to `undefined` if the AbortController signaled an `abort`
682
+ * event. In all other cases, it should return or resolve to a value
683
+ * suitable for adding to the cache.
684
+ *
685
+ * The `options` object is a union of the options that may be provided to
686
+ * `set()` and `get()`. If they are modified, then that will result in
687
+ * modifying the settings to `cache.set()` when the value is resolved, and
688
+ * in the case of
689
+ * {@link OptionsBase.noDeleteOnFetchRejection} and
690
+ * {@link OptionsBase.allowStaleOnFetchRejection}, the handling of
691
+ * `fetchMethod` failures.
692
+ *
693
+ * For example, a DNS cache may update the TTL based on the value returned
694
+ * from a remote DNS server by changing `options.ttl` in the `fetchMethod`.
695
+ */
696
+ fetchMethod?: Fetcher<K, V, FC>;
697
+ /**
698
+ * Method that provides the implementation for {@link LRUCache#memo}
699
+ */
700
+ memoMethod?: Memoizer<K, V, FC>;
701
+ /**
702
+ * Set to true to suppress the deletion of stale data when a
703
+ * {@link OptionsBase.fetchMethod} returns a rejected promise.
704
+ */
705
+ noDeleteOnFetchRejection?: boolean;
706
+ /**
707
+ * Do not delete stale items when they are retrieved with
708
+ * {@link LRUCache#get}.
709
+ *
710
+ * Note that the `get` return value will still be `undefined`
711
+ * unless {@link OptionsBase.allowStale} is true.
712
+ *
713
+ * When using time-expiring entries with `ttl`, by default stale
714
+ * items will be removed from the cache when the key is accessed
715
+ * with `cache.get()`.
716
+ *
717
+ * Setting this option will cause stale items to remain in the cache, until
718
+ * they are explicitly deleted with `cache.delete(key)`, or retrieved with
719
+ * `noDeleteOnStaleGet` set to `false`.
720
+ *
721
+ * This may be overridden by passing an options object to `cache.get()`.
722
+ *
723
+ * Only relevant if a ttl is used.
724
+ */
725
+ noDeleteOnStaleGet?: boolean;
726
+ /**
727
+ * Set to true to allow returning stale data when a
728
+ * {@link OptionsBase.fetchMethod} throws an error or returns a rejected
729
+ * promise.
730
+ *
731
+ * This differs from using {@link OptionsBase.allowStale} in that stale
732
+ * data will ONLY be returned in the case that the {@link LRUCache#fetch}
733
+ * fails, not any other times.
734
+ *
735
+ * If a `fetchMethod` fails, and there is no stale value available, the
736
+ * `fetch()` will resolve to `undefined`. Ie, all `fetchMethod` errors are
737
+ * suppressed.
738
+ *
739
+ * Implies `noDeleteOnFetchRejection`.
740
+ *
741
+ * This may be set in calls to `fetch()`, or defaulted on the constructor,
742
+ * or overridden by modifying the options object in the `fetchMethod`.
743
+ */
744
+ allowStaleOnFetchRejection?: boolean;
745
+ /**
746
+ * Set to true to return a stale value from the cache when the
747
+ * `AbortSignal` passed to the {@link OptionsBase.fetchMethod} dispatches
748
+ * an `'abort'` event, whether user-triggered, or due to internal cache
749
+ * behavior.
750
+ *
751
+ * Unless {@link OptionsBase.ignoreFetchAbort} is also set, the underlying
752
+ * {@link OptionsBase.fetchMethod} will still be considered canceled, and
753
+ * any value it returns will be ignored and not cached.
754
+ *
755
+ * Caveat: since fetches are aborted when a new value is explicitly
756
+ * set in the cache, this can lead to fetch returning a stale value,
757
+ * since that was the fallback value _at the moment the `fetch()` was
758
+ * initiated_, even though the new updated value is now present in
759
+ * the cache.
760
+ *
761
+ * For example:
762
+ *
763
+ * ```ts
764
+ * const cache = new LRUCache<string, any>({
765
+ * ttl: 100,
766
+ * fetchMethod: async (url, oldValue, { signal }) => {
767
+ * const res = await fetch(url, { signal })
768
+ * return await res.json()
769
+ * }
770
+ * })
771
+ * cache.set('https://example.com/', { some: 'data' })
772
+ * // 100ms go by...
773
+ * const result = cache.fetch('https://example.com/')
774
+ * cache.set('https://example.com/', { other: 'thing' })
775
+ * console.log(await result) // { some: 'data' }
776
+ * console.log(cache.get('https://example.com/')) // { other: 'thing' }
777
+ * ```
778
+ */
779
+ allowStaleOnFetchAbort?: boolean;
780
+ /**
781
+ * Set to true to ignore the `abort` event emitted by the `AbortSignal`
782
+ * object passed to {@link OptionsBase.fetchMethod}, and still cache the
783
+ * resulting resolution value, as long as it is not `undefined`.
784
+ *
785
+ * When used on its own, this means aborted {@link LRUCache#fetch} calls
786
+ * are not immediately resolved or rejected when they are aborted, and
787
+ * instead take the full time to await.
788
+ *
789
+ * When used with {@link OptionsBase.allowStaleOnFetchAbort}, aborted
790
+ * {@link LRUCache#fetch} calls will resolve immediately to their stale
791
+ * cached value or `undefined`, and will continue to process and eventually
792
+ * update the cache when they resolve, as long as the resulting value is
793
+ * not `undefined`, thus supporting a "return stale on timeout while
794
+ * refreshing" mechanism by passing `AbortSignal.timeout(n)` as the signal.
795
+ *
796
+ * For example:
797
+ *
798
+ * ```ts
799
+ * const c = new LRUCache({
800
+ * ttl: 100,
801
+ * ignoreFetchAbort: true,
802
+ * allowStaleOnFetchAbort: true,
803
+ * fetchMethod: async (key, oldValue, { signal }) => {
804
+ * // note: do NOT pass the signal to fetch()!
805
+ * // let's say this fetch can take a long time.
806
+ * const res = await fetch(`https://slow-backend-server/${key}`)
807
+ * return await res.json()
808
+ * },
809
+ * })
810
+ *
811
+ * // this will return the stale value after 100ms, while still
812
+ * // updating in the background for next time.
813
+ * const val = await c.fetch('key', { signal: AbortSignal.timeout(100) })
814
+ * ```
815
+ *
816
+ * **Note**: regardless of this setting, an `abort` event _is still
817
+ * emitted on the `AbortSignal` object_, so may result in invalid results
818
+ * when passed to other underlying APIs that use AbortSignals.
819
+ *
820
+ * This may be overridden in the {@link OptionsBase.fetchMethod} or the
821
+ * call to {@link LRUCache#fetch}.
822
+ */
823
+ ignoreFetchAbort?: boolean;
824
+ }
825
+ interface OptionsMaxLimit<K, V, FC> extends OptionsBase<K, V, FC> {
826
+ max: Count;
827
+ }
828
+ interface OptionsTTLLimit<K, V, FC> extends OptionsBase<K, V, FC> {
829
+ ttl: Milliseconds;
830
+ ttlAutopurge: boolean;
831
+ }
832
+ interface OptionsSizeLimit<K, V, FC> extends OptionsBase<K, V, FC> {
833
+ maxSize: Size;
834
+ }
835
+ /**
836
+ * The valid safe options for the {@link LRUCache} constructor
837
+ */
838
+ type Options<K, V, FC> = OptionsMaxLimit<K, V, FC> | OptionsSizeLimit<K, V, FC> | OptionsTTLLimit<K, V, FC>;
839
+ /**
840
+ * Entry objects used by {@link LRUCache#load} and {@link LRUCache#dump},
841
+ * and returned by {@link LRUCache#info}.
842
+ */
843
+ interface Entry<V> {
844
+ value: V;
845
+ ttl?: Milliseconds;
846
+ size?: Size;
847
+ start?: Milliseconds;
848
+ }
849
+ }
850
+ /**
851
+ * Default export, the thing you're using this module to get.
852
+ *
853
+ * The `K` and `V` types define the key and value types, respectively. The
854
+ * optional `FC` type defines the type of the `context` object passed to
855
+ * `cache.fetch()` and `cache.memo()`.
856
+ *
857
+ * Keys and values **must not** be `null` or `undefined`.
858
+ *
859
+ * All properties from the options object (with the exception of `max`,
860
+ * `maxSize`, `fetchMethod`, `memoMethod`, `dispose` and `disposeAfter`) are
861
+ * added as normal public members. (The listed options are read-only getters.)
862
+ *
863
+ * Changing any of these will alter the defaults for subsequent method calls.
864
+ */
865
+ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
866
+ #private;
867
+ /**
868
+ * {@link LRUCache.OptionsBase.ttl}
869
+ */
870
+ ttl: LRUCache.Milliseconds;
871
+ /**
872
+ * {@link LRUCache.OptionsBase.ttlResolution}
873
+ */
874
+ ttlResolution: LRUCache.Milliseconds;
875
+ /**
876
+ * {@link LRUCache.OptionsBase.ttlAutopurge}
877
+ */
878
+ ttlAutopurge: boolean;
879
+ /**
880
+ * {@link LRUCache.OptionsBase.updateAgeOnGet}
881
+ */
882
+ updateAgeOnGet: boolean;
883
+ /**
884
+ * {@link LRUCache.OptionsBase.updateAgeOnHas}
885
+ */
886
+ updateAgeOnHas: boolean;
887
+ /**
888
+ * {@link LRUCache.OptionsBase.allowStale}
889
+ */
890
+ allowStale: boolean;
891
+ /**
892
+ * {@link LRUCache.OptionsBase.noDisposeOnSet}
893
+ */
894
+ noDisposeOnSet: boolean;
895
+ /**
896
+ * {@link LRUCache.OptionsBase.noUpdateTTL}
897
+ */
898
+ noUpdateTTL: boolean;
899
+ /**
900
+ * {@link LRUCache.OptionsBase.maxEntrySize}
901
+ */
902
+ maxEntrySize: LRUCache.Size;
903
+ /**
904
+ * {@link LRUCache.OptionsBase.sizeCalculation}
905
+ */
906
+ sizeCalculation?: LRUCache.SizeCalculator<K, V>;
907
+ /**
908
+ * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
909
+ */
910
+ noDeleteOnFetchRejection: boolean;
911
+ /**
912
+ * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
913
+ */
914
+ noDeleteOnStaleGet: boolean;
915
+ /**
916
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
917
+ */
918
+ allowStaleOnFetchAbort: boolean;
919
+ /**
920
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
921
+ */
922
+ allowStaleOnFetchRejection: boolean;
923
+ /**
924
+ * {@link LRUCache.OptionsBase.ignoreFetchAbort}
925
+ */
926
+ ignoreFetchAbort: boolean;
927
+ /**
928
+ * Do not call this method unless you need to inspect the
929
+ * inner workings of the cache. If anything returned by this
930
+ * object is modified in any way, strange breakage may occur.
931
+ *
932
+ * These fields are private for a reason!
933
+ *
934
+ * @internal
935
+ */
936
+ static unsafeExposeInternals<K extends {}, V extends {}, FC extends unknown = unknown>(c: LRUCache<K, V, FC>): {
937
+ starts: ZeroArray | undefined;
938
+ ttls: ZeroArray | undefined;
939
+ sizes: ZeroArray | undefined;
940
+ keyMap: Map<K, number>;
941
+ keyList: (K | undefined)[];
942
+ valList: (V | BackgroundFetch<V> | undefined)[];
943
+ next: NumberArray;
944
+ prev: NumberArray;
945
+ readonly head: Index;
946
+ readonly tail: Index;
947
+ free: StackLike;
948
+ isBackgroundFetch: (p: any) => p is BackgroundFetch<V>;
949
+ backgroundFetch: (k: K, index: number | undefined, options: LRUCache.FetchOptions<K, V, FC>, context: any) => BackgroundFetch<V>;
950
+ moveToTail: (index: number) => void;
951
+ indexes: (options?: {
952
+ allowStale: boolean;
953
+ }) => Generator<Index, void, unknown>;
954
+ rindexes: (options?: {
955
+ allowStale: boolean;
956
+ }) => Generator<Index, void, unknown>;
957
+ isStale: (index: number | undefined) => boolean;
958
+ };
959
+ /**
960
+ * {@link LRUCache.OptionsBase.max} (read-only)
961
+ */
962
+ get max(): LRUCache.Count;
963
+ /**
964
+ * {@link LRUCache.OptionsBase.maxSize} (read-only)
965
+ */
966
+ get maxSize(): LRUCache.Count;
967
+ /**
968
+ * The total computed size of items in the cache (read-only)
969
+ */
970
+ get calculatedSize(): LRUCache.Size;
971
+ /**
972
+ * The number of items stored in the cache (read-only)
973
+ */
974
+ get size(): LRUCache.Count;
975
+ /**
976
+ * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
977
+ */
978
+ get fetchMethod(): LRUCache.Fetcher<K, V, FC> | undefined;
979
+ get memoMethod(): LRUCache.Memoizer<K, V, FC> | undefined;
980
+ /**
981
+ * {@link LRUCache.OptionsBase.dispose} (read-only)
982
+ */
983
+ get dispose(): LRUCache.Disposer<K, V> | undefined;
984
+ /**
985
+ * {@link LRUCache.OptionsBase.onInsert} (read-only)
986
+ */
987
+ get onInsert(): LRUCache.Inserter<K, V> | undefined;
988
+ /**
989
+ * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
990
+ */
991
+ get disposeAfter(): LRUCache.Disposer<K, V> | undefined;
992
+ constructor(options: LRUCache.Options<K, V, FC> | LRUCache<K, V, FC>);
993
+ /**
994
+ * Return the number of ms left in the item's TTL. If item is not in cache,
995
+ * returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
996
+ */
997
+ getRemainingTTL(key: K): number;
998
+ /**
999
+ * Return a generator yielding `[key, value]` pairs,
1000
+ * in order from most recently used to least recently used.
1001
+ */
1002
+ entries(): Generator<[K, V], void, unknown>;
1003
+ /**
1004
+ * Inverse order version of {@link LRUCache.entries}
1005
+ *
1006
+ * Return a generator yielding `[key, value]` pairs,
1007
+ * in order from least recently used to most recently used.
1008
+ */
1009
+ rentries(): Generator<(K | V)[], void, unknown>;
1010
+ /**
1011
+ * Return a generator yielding the keys in the cache,
1012
+ * in order from most recently used to least recently used.
1013
+ */
1014
+ keys(): Generator<K, void, unknown>;
1015
+ /**
1016
+ * Inverse order version of {@link LRUCache.keys}
1017
+ *
1018
+ * Return a generator yielding the keys in the cache,
1019
+ * in order from least recently used to most recently used.
1020
+ */
1021
+ rkeys(): Generator<K, void, unknown>;
1022
+ /**
1023
+ * Return a generator yielding the values in the cache,
1024
+ * in order from most recently used to least recently used.
1025
+ */
1026
+ values(): Generator<V, void, unknown>;
1027
+ /**
1028
+ * Inverse order version of {@link LRUCache.values}
1029
+ *
1030
+ * Return a generator yielding the values in the cache,
1031
+ * in order from least recently used to most recently used.
1032
+ */
1033
+ rvalues(): Generator<V | undefined, void, unknown>;
1034
+ /**
1035
+ * Iterating over the cache itself yields the same results as
1036
+ * {@link LRUCache.entries}
1037
+ */
1038
+ [Symbol.iterator](): Generator<[K, V], void, unknown>;
1039
+ /**
1040
+ * A String value that is used in the creation of the default string
1041
+ * description of an object. Called by the built-in method
1042
+ * `Object.prototype.toString`.
1043
+ */
1044
+ [Symbol.toStringTag]: string;
1045
+ /**
1046
+ * Find a value for which the supplied fn method returns a truthy value,
1047
+ * similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
1048
+ */
1049
+ find(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => boolean, getOptions?: LRUCache.GetOptions<K, V, FC>): V | undefined;
1050
+ /**
1051
+ * Call the supplied function on each item in the cache, in order from most
1052
+ * recently used to least recently used.
1053
+ *
1054
+ * `fn` is called as `fn(value, key, cache)`.
1055
+ *
1056
+ * If `thisp` is provided, function will be called in the `this`-context of
1057
+ * the provided object, or the cache if no `thisp` object is provided.
1058
+ *
1059
+ * Does not update age or recenty of use, or iterate over stale values.
1060
+ */
1061
+ forEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => any, thisp?: any): void;
1062
+ /**
1063
+ * The same as {@link LRUCache.forEach} but items are iterated over in
1064
+ * reverse order. (ie, less recently used items are iterated over first.)
1065
+ */
1066
+ rforEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => any, thisp?: any): void;
1067
+ /**
1068
+ * Delete any stale entries. Returns true if anything was removed,
1069
+ * false otherwise.
1070
+ */
1071
+ purgeStale(): boolean;
1072
+ /**
1073
+ * Get the extended info about a given entry, to get its value, size, and
1074
+ * TTL info simultaneously. Returns `undefined` if the key is not present.
1075
+ *
1076
+ * Unlike {@link LRUCache#dump}, which is designed to be portable and survive
1077
+ * serialization, the `start` value is always the current timestamp, and the
1078
+ * `ttl` is a calculated remaining time to live (negative if expired).
1079
+ *
1080
+ * Always returns stale values, if their info is found in the cache, so be
1081
+ * sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
1082
+ * if relevant.
1083
+ */
1084
+ info(key: K): LRUCache.Entry<V> | undefined;
1085
+ /**
1086
+ * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
1087
+ * passed to {@link LRUCache#load}.
1088
+ *
1089
+ * The `start` fields are calculated relative to a portable `Date.now()`
1090
+ * timestamp, even if `performance.now()` is available.
1091
+ *
1092
+ * Stale entries are always included in the `dump`, even if
1093
+ * {@link LRUCache.OptionsBase.allowStale} is false.
1094
+ *
1095
+ * Note: this returns an actual array, not a generator, so it can be more
1096
+ * easily passed around.
1097
+ */
1098
+ dump(): [K, LRUCache.Entry<V>][];
1099
+ /**
1100
+ * Reset the cache and load in the items in entries in the order listed.
1101
+ *
1102
+ * The shape of the resulting cache may be different if the same options are
1103
+ * not used in both caches.
1104
+ *
1105
+ * The `start` fields are assumed to be calculated relative to a portable
1106
+ * `Date.now()` timestamp, even if `performance.now()` is available.
1107
+ */
1108
+ load(arr: [K, LRUCache.Entry<V>][]): void;
1109
+ /**
1110
+ * Add a value to the cache.
1111
+ *
1112
+ * Note: if `undefined` is specified as a value, this is an alias for
1113
+ * {@link LRUCache#delete}
1114
+ *
1115
+ * Fields on the {@link LRUCache.SetOptions} options param will override
1116
+ * their corresponding values in the constructor options for the scope
1117
+ * of this single `set()` operation.
1118
+ *
1119
+ * If `start` is provided, then that will set the effective start
1120
+ * time for the TTL calculation. Note that this must be a previous
1121
+ * value of `performance.now()` if supported, or a previous value of
1122
+ * `Date.now()` if not.
1123
+ *
1124
+ * Options object may also include `size`, which will prevent
1125
+ * calling the `sizeCalculation` function and just use the specified
1126
+ * number if it is a positive integer, and `noDisposeOnSet` which
1127
+ * will prevent calling a `dispose` function in the case of
1128
+ * overwrites.
1129
+ *
1130
+ * If the `size` (or return value of `sizeCalculation`) for a given
1131
+ * entry is greater than `maxEntrySize`, then the item will not be
1132
+ * added to the cache.
1133
+ *
1134
+ * Will update the recency of the entry.
1135
+ *
1136
+ * If the value is `undefined`, then this is an alias for
1137
+ * `cache.delete(key)`. `undefined` is never stored in the cache.
1138
+ */
1139
+ set(k: K, v: V | BackgroundFetch<V> | undefined, setOptions?: LRUCache.SetOptions<K, V, FC>): this;
1140
+ /**
1141
+ * Evict the least recently used item, returning its value or
1142
+ * `undefined` if cache is empty.
1143
+ */
1144
+ pop(): V | undefined;
1145
+ /**
1146
+ * Check if a key is in the cache, without updating the recency of use.
1147
+ * Will return false if the item is stale, even though it is technically
1148
+ * in the cache.
1149
+ *
1150
+ * Check if a key is in the cache, without updating the recency of
1151
+ * use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
1152
+ * to `true` in either the options or the constructor.
1153
+ *
1154
+ * Will return `false` if the item is stale, even though it is technically in
1155
+ * the cache. The difference can be determined (if it matters) by using a
1156
+ * `status` argument, and inspecting the `has` field.
1157
+ *
1158
+ * Will not update item age unless
1159
+ * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
1160
+ */
1161
+ has(k: K, hasOptions?: LRUCache.HasOptions<K, V, FC>): boolean;
1162
+ /**
1163
+ * Like {@link LRUCache#get} but doesn't update recency or delete stale
1164
+ * items.
1165
+ *
1166
+ * Returns `undefined` if the item is stale, unless
1167
+ * {@link LRUCache.OptionsBase.allowStale} is set.
1168
+ */
1169
+ peek(k: K, peekOptions?: LRUCache.PeekOptions<K, V, FC>): V | undefined;
1170
+ /**
1171
+ * Make an asynchronous cached fetch using the
1172
+ * {@link LRUCache.OptionsBase.fetchMethod} function.
1173
+ *
1174
+ * If the value is in the cache and not stale, then the returned
1175
+ * Promise resolves to the value.
1176
+ *
1177
+ * If not in the cache, or beyond its TTL staleness, then
1178
+ * `fetchMethod(key, staleValue, { options, signal, context })` is
1179
+ * called, and the value returned will be added to the cache once
1180
+ * resolved.
1181
+ *
1182
+ * If called with `allowStale`, and an asynchronous fetch is
1183
+ * currently in progress to reload a stale value, then the former
1184
+ * stale value will be returned.
1185
+ *
1186
+ * If called with `forceRefresh`, then the cached item will be
1187
+ * re-fetched, even if it is not stale. However, if `allowStale` is also
1188
+ * set, then the old value will still be returned. This is useful
1189
+ * in cases where you want to force a reload of a cached value. If
1190
+ * a background fetch is already in progress, then `forceRefresh`
1191
+ * has no effect.
1192
+ *
1193
+ * If multiple fetches for the same key are issued, then they will all be
1194
+ * coalesced into a single call to fetchMethod.
1195
+ *
1196
+ * Note that this means that handling options such as
1197
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort},
1198
+ * {@link LRUCache.FetchOptions.signal},
1199
+ * and {@link LRUCache.OptionsBase.allowStaleOnFetchRejection} will be
1200
+ * determined by the FIRST fetch() call for a given key.
1201
+ *
1202
+ * This is a known (fixable) shortcoming which will be addresed on when
1203
+ * someone complains about it, as the fix would involve added complexity and
1204
+ * may not be worth the costs for this edge case.
1205
+ *
1206
+ * If {@link LRUCache.OptionsBase.fetchMethod} is not specified, then this is
1207
+ * effectively an alias for `Promise.resolve(cache.get(key))`.
1208
+ *
1209
+ * When the fetch method resolves to a value, if the fetch has not
1210
+ * been aborted due to deletion, eviction, or being overwritten,
1211
+ * then it is added to the cache using the options provided.
1212
+ *
1213
+ * If the key is evicted or deleted before the `fetchMethod`
1214
+ * resolves, then the AbortSignal passed to the `fetchMethod` will
1215
+ * receive an `abort` event, and the promise returned by `fetch()`
1216
+ * will reject with the reason for the abort.
1217
+ *
1218
+ * If a `signal` is passed to the `fetch()` call, then aborting the
1219
+ * signal will abort the fetch and cause the `fetch()` promise to
1220
+ * reject with the reason provided.
1221
+ *
1222
+ * **Setting `context`**
1223
+ *
1224
+ * If an `FC` type is set to a type other than `unknown`, `void`, or
1225
+ * `undefined` in the {@link LRUCache} constructor, then all
1226
+ * calls to `cache.fetch()` _must_ provide a `context` option. If
1227
+ * set to `undefined` or `void`, then calls to fetch _must not_
1228
+ * provide a `context` option.
1229
+ *
1230
+ * The `context` param allows you to provide arbitrary data that
1231
+ * might be relevant in the course of fetching the data. It is only
1232
+ * relevant for the course of a single `fetch()` operation, and
1233
+ * discarded afterwards.
1234
+ *
1235
+ * **Note: `fetch()` calls are inflight-unique**
1236
+ *
1237
+ * If you call `fetch()` multiple times with the same key value,
1238
+ * then every call after the first will resolve on the same
1239
+ * promise<sup>1</sup>,
1240
+ * _even if they have different settings that would otherwise change
1241
+ * the behavior of the fetch_, such as `noDeleteOnFetchRejection`
1242
+ * or `ignoreFetchAbort`.
1243
+ *
1244
+ * In most cases, this is not a problem (in fact, only fetching
1245
+ * something once is what you probably want, if you're caching in
1246
+ * the first place). If you are changing the fetch() options
1247
+ * dramatically between runs, there's a good chance that you might
1248
+ * be trying to fit divergent semantics into a single object, and
1249
+ * would be better off with multiple cache instances.
1250
+ *
1251
+ * **1**: Ie, they're not the "same Promise", but they resolve at
1252
+ * the same time, because they're both waiting on the same
1253
+ * underlying fetchMethod response.
1254
+ */
1255
+ fetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : LRUCache.FetchOptionsWithContext<K, V, FC>): Promise<undefined | V>;
1256
+ fetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : never): Promise<undefined | V>;
1257
+ /**
1258
+ * In some cases, `cache.fetch()` may resolve to `undefined`, either because
1259
+ * a {@link LRUCache.OptionsBase#fetchMethod} was not provided (turning
1260
+ * `cache.fetch(k)` into just an async wrapper around `cache.get(k)`) or
1261
+ * because `ignoreFetchAbort` was specified (either to the constructor or
1262
+ * in the {@link LRUCache.FetchOptions}). Also, the
1263
+ * {@link LRUCache.OptionsBase.fetchMethod} may return `undefined` or `void`, making
1264
+ * the test even more complicated.
1265
+ *
1266
+ * Because inferring the cases where `undefined` might be returned are so
1267
+ * cumbersome, but testing for `undefined` can also be annoying, this method
1268
+ * can be used, which will reject if `this.fetch()` resolves to undefined.
1269
+ */
1270
+ forceFetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : LRUCache.FetchOptionsWithContext<K, V, FC>): Promise<V>;
1271
+ forceFetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : never): Promise<V>;
1272
+ /**
1273
+ * If the key is found in the cache, then this is equivalent to
1274
+ * {@link LRUCache#get}. If not, in the cache, then calculate the value using
1275
+ * the {@link LRUCache.OptionsBase.memoMethod}, and add it to the cache.
1276
+ *
1277
+ * If an `FC` type is set to a type other than `unknown`, `void`, or
1278
+ * `undefined` in the LRUCache constructor, then all calls to `cache.memo()`
1279
+ * _must_ provide a `context` option. If set to `undefined` or `void`, then
1280
+ * calls to memo _must not_ provide a `context` option.
1281
+ *
1282
+ * The `context` param allows you to provide arbitrary data that might be
1283
+ * relevant in the course of fetching the data. It is only relevant for the
1284
+ * course of a single `memo()` operation, and discarded afterwards.
1285
+ */
1286
+ memo(k: K, memoOptions: unknown extends FC ? LRUCache.MemoOptions<K, V, FC> : FC extends undefined | void ? LRUCache.MemoOptionsNoContext<K, V> : LRUCache.MemoOptionsWithContext<K, V, FC>): V;
1287
+ memo(k: unknown extends FC ? K : FC extends undefined | void ? K : never, memoOptions?: unknown extends FC ? LRUCache.MemoOptions<K, V, FC> : FC extends undefined | void ? LRUCache.MemoOptionsNoContext<K, V> : never): V;
1288
+ /**
1289
+ * Return a value from the cache. Will update the recency of the cache
1290
+ * entry found.
1291
+ *
1292
+ * If the key is not found, get() will return `undefined`.
1293
+ */
1294
+ get(k: K, getOptions?: LRUCache.GetOptions<K, V, FC>): V | undefined;
1295
+ /**
1296
+ * Deletes a key out of the cache.
1297
+ *
1298
+ * Returns true if the key was deleted, false otherwise.
1299
+ */
1300
+ delete(k: K): boolean;
1301
+ /**
1302
+ * Clear the cache entirely, throwing away all values.
1303
+ */
1304
+ clear(): void;
1305
+ }
1306
+ //# sourceMappingURL=index.d.ts.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/esm/index.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AA0FH,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,MAAM,MAAM,MAAM,G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AAE,CAAC,GAC5C,CAAC;IAEJ,IAAI,CACF,CAAC,EAAE,OAAO,SAAS,EAAE,GACjB,CAAC,GACD,EAAE,SAAS,SAAS,GAAG,IAAI,GAC3B,CAAC,GACD,KAAK,EACT,WAAW,CAAC,EAAE,OAAO,SAAS,EAAE,GAC5B,QAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAC9B,EAAE,SAAS,SAAS,GAAG,IAAI,GAC3B,QAAQ,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,GACnC,KAAK,GACR,CAAC;IAiBJ;;;;;OAKG;IACH,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,GAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAM;IAgFxD;;;;OAIG;IACH,MAAM,CAAC,CAAC,EAAE,CAAC;IAqDX;;OAEG;IACH,KAAK;CA0CN"}
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/esm/index.min.js.map ADDED
The diff for this file is too large to render. See raw diff
 
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/lru-cache/dist/esm/package.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "type": "module"
3
+ }
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"assert-valid-pattern.js","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAA;AAC7B,MAAM,kBAAkB,GAA2B,CACxD,OAAY,EACe,EAAE;IAC7B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAA;IACxC,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,kBAAkB,EAAE,CAAC;QACxC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAA;IAC5C,CAAC;AACH,CAAC,CAAA;AAVY,QAAA,kBAAkB,sBAU9B","sourcesContent":["const MAX_PATTERN_LENGTH = 1024 * 64\nexport const assertValidPattern: (pattern: any) => void = (\n pattern: any\n): asserts pattern is string => {\n if (typeof pattern !== 'string') {\n throw new TypeError('invalid pattern')\n }\n\n if (pattern.length > MAX_PATTERN_LENGTH) {\n throw new TypeError('pattern is too long')\n }\n}\n"]}
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/ast.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAwCvD,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AAkCrD,qBAAa,GAAG;;IACd,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;gBAiBtB,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,GAAE,gBAAqB;IAahC,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAUlC;IAGD,QAAQ,IAAI,MAAM;IA+ClB,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE;IAY/B,MAAM;IAgBN,OAAO,IAAI,OAAO;IAgBlB,KAAK,IAAI,OAAO;IAYhB,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM;IAKzB,KAAK,CAAC,MAAM,EAAE,GAAG;IAsIjB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAA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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ // parse a single path portion
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AST = void 0;
5
+ const brace_expressions_js_1 = require("./brace-expressions.js");
6
+ const unescape_js_1 = require("./unescape.js");
7
+ const types = new Set(['!', '?', '+', '*', '@']);
8
+ const isExtglobType = (c) => types.has(c);
9
+ // Patterns that get prepended to bind to the start of either the
10
+ // entire string, or just a single path portion, to prevent dots
11
+ // and/or traversal patterns, when needed.
12
+ // Exts don't need the ^ or / bit, because the root binds that already.
13
+ const startNoTraversal = '(?!(?:^|/)\\.\\.?(?:$|/))';
14
+ const startNoDot = '(?!\\.)';
15
+ // characters that indicate a start of pattern needs the "no dots" bit,
16
+ // because a dot *might* be matched. ( is not in the list, because in
17
+ // the case of a child extglob, it will handle the prevention itself.
18
+ const addPatternStart = new Set(['[', '.']);
19
+ // cases where traversal is A-OK, no dot prevention needed
20
+ const justDots = new Set(['..', '.']);
21
+ const reSpecials = new Set('().*{}+?[]^$\\!');
22
+ const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
23
+ // any single thing other than /
24
+ const qmark = '[^/]';
25
+ // * => any number of characters
26
+ const star = qmark + '*?';
27
+ // use + when we need to ensure that *something* matches, because the * is
28
+ // the only thing in the path portion.
29
+ const starNoEmpty = qmark + '+?';
30
+ // remove the \ chars that we added if we end up doing a nonmagic compare
31
+ // const deslash = (s: string) => s.replace(/\\(.)/g, '$1')
32
+ class AST {
33
+ type;
34
+ #root;
35
+ #hasMagic;
36
+ #uflag = false;
37
+ #parts = [];
38
+ #parent;
39
+ #parentIndex;
40
+ #negs;
41
+ #filledNegs = false;
42
+ #options;
43
+ #toString;
44
+ // set to true if it's an extglob with no children
45
+ // (which really means one child of '')
46
+ #emptyExt = false;
47
+ constructor(type, parent, options = {}) {
48
+ this.type = type;
49
+ // extglobs are inherently magical
50
+ if (type)
51
+ this.#hasMagic = true;
52
+ this.#parent = parent;
53
+ this.#root = this.#parent ? this.#parent.#root : this;
54
+ this.#options = this.#root === this ? options : this.#root.#options;
55
+ this.#negs = this.#root === this ? [] : this.#root.#negs;
56
+ if (type === '!' && !this.#root.#filledNegs)
57
+ this.#negs.push(this);
58
+ this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
59
+ }
60
+ get hasMagic() {
61
+ /* c8 ignore start */
62
+ if (this.#hasMagic !== undefined)
63
+ return this.#hasMagic;
64
+ /* c8 ignore stop */
65
+ for (const p of this.#parts) {
66
+ if (typeof p === 'string')
67
+ continue;
68
+ if (p.type || p.hasMagic)
69
+ return (this.#hasMagic = true);
70
+ }
71
+ // note: will be undefined until we generate the regexp src and find out
72
+ return this.#hasMagic;
73
+ }
74
+ // reconstructs the pattern
75
+ toString() {
76
+ if (this.#toString !== undefined)
77
+ return this.#toString;
78
+ if (!this.type) {
79
+ return (this.#toString = this.#parts.map(p => String(p)).join(''));
80
+ }
81
+ else {
82
+ return (this.#toString =
83
+ this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')');
84
+ }
85
+ }
86
+ #fillNegs() {
87
+ /* c8 ignore start */
88
+ if (this !== this.#root)
89
+ throw new Error('should only call on root');
90
+ if (this.#filledNegs)
91
+ return this;
92
+ /* c8 ignore stop */
93
+ // call toString() once to fill this out
94
+ this.toString();
95
+ this.#filledNegs = true;
96
+ let n;
97
+ while ((n = this.#negs.pop())) {
98
+ if (n.type !== '!')
99
+ continue;
100
+ // walk up the tree, appending everthing that comes AFTER parentIndex
101
+ let p = n;
102
+ let pp = p.#parent;
103
+ while (pp) {
104
+ for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
105
+ for (const part of n.#parts) {
106
+ /* c8 ignore start */
107
+ if (typeof part === 'string') {
108
+ throw new Error('string part in extglob AST??');
109
+ }
110
+ /* c8 ignore stop */
111
+ part.copyIn(pp.#parts[i]);
112
+ }
113
+ }
114
+ p = pp;
115
+ pp = p.#parent;
116
+ }
117
+ }
118
+ return this;
119
+ }
120
+ push(...parts) {
121
+ for (const p of parts) {
122
+ if (p === '')
123
+ continue;
124
+ /* c8 ignore start */
125
+ if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) {
126
+ throw new Error('invalid part: ' + p);
127
+ }
128
+ /* c8 ignore stop */
129
+ this.#parts.push(p);
130
+ }
131
+ }
132
+ toJSON() {
133
+ const ret = this.type === null
134
+ ? this.#parts.slice().map(p => (typeof p === 'string' ? p : p.toJSON()))
135
+ : [this.type, ...this.#parts.map(p => p.toJSON())];
136
+ if (this.isStart() && !this.type)
137
+ ret.unshift([]);
138
+ if (this.isEnd() &&
139
+ (this === this.#root ||
140
+ (this.#root.#filledNegs && this.#parent?.type === '!'))) {
141
+ ret.push({});
142
+ }
143
+ return ret;
144
+ }
145
+ isStart() {
146
+ if (this.#root === this)
147
+ return true;
148
+ // if (this.type) return !!this.#parent?.isStart()
149
+ if (!this.#parent?.isStart())
150
+ return false;
151
+ if (this.#parentIndex === 0)
152
+ return true;
153
+ // if everything AHEAD of this is a negation, then it's still the "start"
154
+ const p = this.#parent;
155
+ for (let i = 0; i < this.#parentIndex; i++) {
156
+ const pp = p.#parts[i];
157
+ if (!(pp instanceof AST && pp.type === '!')) {
158
+ return false;
159
+ }
160
+ }
161
+ return true;
162
+ }
163
+ isEnd() {
164
+ if (this.#root === this)
165
+ return true;
166
+ if (this.#parent?.type === '!')
167
+ return true;
168
+ if (!this.#parent?.isEnd())
169
+ return false;
170
+ if (!this.type)
171
+ return this.#parent?.isEnd();
172
+ // if not root, it'll always have a parent
173
+ /* c8 ignore start */
174
+ const pl = this.#parent ? this.#parent.#parts.length : 0;
175
+ /* c8 ignore stop */
176
+ return this.#parentIndex === pl - 1;
177
+ }
178
+ copyIn(part) {
179
+ if (typeof part === 'string')
180
+ this.push(part);
181
+ else
182
+ this.push(part.clone(this));
183
+ }
184
+ clone(parent) {
185
+ const c = new AST(this.type, parent);
186
+ for (const p of this.#parts) {
187
+ c.copyIn(p);
188
+ }
189
+ return c;
190
+ }
191
+ static #parseAST(str, ast, pos, opt) {
192
+ let escaping = false;
193
+ let inBrace = false;
194
+ let braceStart = -1;
195
+ let braceNeg = false;
196
+ if (ast.type === null) {
197
+ // outside of a extglob, append until we find a start
198
+ let i = pos;
199
+ let acc = '';
200
+ while (i < str.length) {
201
+ const c = str.charAt(i++);
202
+ // still accumulate escapes at this point, but we do ignore
203
+ // starts that are escaped
204
+ if (escaping || c === '\\') {
205
+ escaping = !escaping;
206
+ acc += c;
207
+ continue;
208
+ }
209
+ if (inBrace) {
210
+ if (i === braceStart + 1) {
211
+ if (c === '^' || c === '!') {
212
+ braceNeg = true;
213
+ }
214
+ }
215
+ else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {
216
+ inBrace = false;
217
+ }
218
+ acc += c;
219
+ continue;
220
+ }
221
+ else if (c === '[') {
222
+ inBrace = true;
223
+ braceStart = i;
224
+ braceNeg = false;
225
+ acc += c;
226
+ continue;
227
+ }
228
+ if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {
229
+ ast.push(acc);
230
+ acc = '';
231
+ const ext = new AST(c, ast);
232
+ i = AST.#parseAST(str, ext, i, opt);
233
+ ast.push(ext);
234
+ continue;
235
+ }
236
+ acc += c;
237
+ }
238
+ ast.push(acc);
239
+ return i;
240
+ }
241
+ // some kind of extglob, pos is at the (
242
+ // find the next | or )
243
+ let i = pos + 1;
244
+ let part = new AST(null, ast);
245
+ const parts = [];
246
+ let acc = '';
247
+ while (i < str.length) {
248
+ const c = str.charAt(i++);
249
+ // still accumulate escapes at this point, but we do ignore
250
+ // starts that are escaped
251
+ if (escaping || c === '\\') {
252
+ escaping = !escaping;
253
+ acc += c;
254
+ continue;
255
+ }
256
+ if (inBrace) {
257
+ if (i === braceStart + 1) {
258
+ if (c === '^' || c === '!') {
259
+ braceNeg = true;
260
+ }
261
+ }
262
+ else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {
263
+ inBrace = false;
264
+ }
265
+ acc += c;
266
+ continue;
267
+ }
268
+ else if (c === '[') {
269
+ inBrace = true;
270
+ braceStart = i;
271
+ braceNeg = false;
272
+ acc += c;
273
+ continue;
274
+ }
275
+ if (isExtglobType(c) && str.charAt(i) === '(') {
276
+ part.push(acc);
277
+ acc = '';
278
+ const ext = new AST(c, part);
279
+ part.push(ext);
280
+ i = AST.#parseAST(str, ext, i, opt);
281
+ continue;
282
+ }
283
+ if (c === '|') {
284
+ part.push(acc);
285
+ acc = '';
286
+ parts.push(part);
287
+ part = new AST(null, ast);
288
+ continue;
289
+ }
290
+ if (c === ')') {
291
+ if (acc === '' && ast.#parts.length === 0) {
292
+ ast.#emptyExt = true;
293
+ }
294
+ part.push(acc);
295
+ acc = '';
296
+ ast.push(...parts, part);
297
+ return i;
298
+ }
299
+ acc += c;
300
+ }
301
+ // unfinished extglob
302
+ // if we got here, it was a malformed extglob! not an extglob, but
303
+ // maybe something else in there.
304
+ ast.type = null;
305
+ ast.#hasMagic = undefined;
306
+ ast.#parts = [str.substring(pos - 1)];
307
+ return i;
308
+ }
309
+ static fromGlob(pattern, options = {}) {
310
+ const ast = new AST(null, undefined, options);
311
+ AST.#parseAST(pattern, ast, 0, options);
312
+ return ast;
313
+ }
314
+ // returns the regular expression if there's magic, or the unescaped
315
+ // string if not.
316
+ toMMPattern() {
317
+ // should only be called on root
318
+ /* c8 ignore start */
319
+ if (this !== this.#root)
320
+ return this.#root.toMMPattern();
321
+ /* c8 ignore stop */
322
+ const glob = this.toString();
323
+ const [re, body, hasMagic, uflag] = this.toRegExpSource();
324
+ // if we're in nocase mode, and not nocaseMagicOnly, then we do
325
+ // still need a regular expression if we have to case-insensitively
326
+ // match capital/lowercase characters.
327
+ const anyMagic = hasMagic ||
328
+ this.#hasMagic ||
329
+ (this.#options.nocase &&
330
+ !this.#options.nocaseMagicOnly &&
331
+ glob.toUpperCase() !== glob.toLowerCase());
332
+ if (!anyMagic) {
333
+ return body;
334
+ }
335
+ const flags = (this.#options.nocase ? 'i' : '') + (uflag ? 'u' : '');
336
+ return Object.assign(new RegExp(`^${re}$`, flags), {
337
+ _src: re,
338
+ _glob: glob,
339
+ });
340
+ }
341
+ get options() {
342
+ return this.#options;
343
+ }
344
+ // returns the string match, the regexp source, whether there's magic
345
+ // in the regexp (so a regular expression is required) and whether or
346
+ // not the uflag is needed for the regular expression (for posix classes)
347
+ // TODO: instead of injecting the start/end at this point, just return
348
+ // the BODY of the regexp, along with the start/end portions suitable
349
+ // for binding the start/end in either a joined full-path makeRe context
350
+ // (where we bind to (^|/), or a standalone matchPart context (where
351
+ // we bind to ^, and not /). Otherwise slashes get duped!
352
+ //
353
+ // In part-matching mode, the start is:
354
+ // - if not isStart: nothing
355
+ // - if traversal possible, but not allowed: ^(?!\.\.?$)
356
+ // - if dots allowed or not possible: ^
357
+ // - if dots possible and not allowed: ^(?!\.)
358
+ // end is:
359
+ // - if not isEnd(): nothing
360
+ // - else: $
361
+ //
362
+ // In full-path matching mode, we put the slash at the START of the
363
+ // pattern, so start is:
364
+ // - if first pattern: same as part-matching mode
365
+ // - if not isStart(): nothing
366
+ // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
367
+ // - if dots allowed or not possible: /
368
+ // - if dots possible and not allowed: /(?!\.)
369
+ // end is:
370
+ // - if last pattern, same as part-matching mode
371
+ // - else nothing
372
+ //
373
+ // Always put the (?:$|/) on negated tails, though, because that has to be
374
+ // there to bind the end of the negated pattern portion, and it's easier to
375
+ // just stick it in now rather than try to inject it later in the middle of
376
+ // the pattern.
377
+ //
378
+ // We can just always return the same end, and leave it up to the caller
379
+ // to know whether it's going to be used joined or in parts.
380
+ // And, if the start is adjusted slightly, can do the same there:
381
+ // - if not isStart: nothing
382
+ // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
383
+ // - if dots allowed or not possible: (?:/|^)
384
+ // - if dots possible and not allowed: (?:/|^)(?!\.)
385
+ //
386
+ // But it's better to have a simpler binding without a conditional, for
387
+ // performance, so probably better to return both start options.
388
+ //
389
+ // Then the caller just ignores the end if it's not the first pattern,
390
+ // and the start always gets applied.
391
+ //
392
+ // But that's always going to be $ if it's the ending pattern, or nothing,
393
+ // so the caller can just attach $ at the end of the pattern when building.
394
+ //
395
+ // So the todo is:
396
+ // - better detect what kind of start is needed
397
+ // - return both flavors of starting pattern
398
+ // - attach $ at the end of the pattern when creating the actual RegExp
399
+ //
400
+ // Ah, but wait, no, that all only applies to the root when the first pattern
401
+ // is not an extglob. If the first pattern IS an extglob, then we need all
402
+ // that dot prevention biz to live in the extglob portions, because eg
403
+ // +(*|.x*) can match .xy but not .yx.
404
+ //
405
+ // So, return the two flavors if it's #root and the first child is not an
406
+ // AST, otherwise leave it to the child AST to handle it, and there,
407
+ // use the (?:^|/) style of start binding.
408
+ //
409
+ // Even simplified further:
410
+ // - Since the start for a join is eg /(?!\.) and the start for a part
411
+ // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
412
+ // or start or whatever) and prepend ^ or / at the Regexp construction.
413
+ toRegExpSource(allowDot) {
414
+ const dot = allowDot ?? !!this.#options.dot;
415
+ if (this.#root === this)
416
+ this.#fillNegs();
417
+ if (!this.type) {
418
+ const noEmpty = this.isStart() && this.isEnd();
419
+ const src = this.#parts
420
+ .map(p => {
421
+ const [re, _, hasMagic, uflag] = typeof p === 'string'
422
+ ? AST.#parseGlob(p, this.#hasMagic, noEmpty)
423
+ : p.toRegExpSource(allowDot);
424
+ this.#hasMagic = this.#hasMagic || hasMagic;
425
+ this.#uflag = this.#uflag || uflag;
426
+ return re;
427
+ })
428
+ .join('');
429
+ let start = '';
430
+ if (this.isStart()) {
431
+ if (typeof this.#parts[0] === 'string') {
432
+ // this is the string that will match the start of the pattern,
433
+ // so we need to protect against dots and such.
434
+ // '.' and '..' cannot match unless the pattern is that exactly,
435
+ // even if it starts with . or dot:true is set.
436
+ const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
437
+ if (!dotTravAllowed) {
438
+ const aps = addPatternStart;
439
+ // check if we have a possibility of matching . or ..,
440
+ // and prevent that.
441
+ const needNoTrav =
442
+ // dots are allowed, and the pattern starts with [ or .
443
+ (dot && aps.has(src.charAt(0))) ||
444
+ // the pattern starts with \., and then [ or .
445
+ (src.startsWith('\\.') && aps.has(src.charAt(2))) ||
446
+ // the pattern starts with \.\., and then [ or .
447
+ (src.startsWith('\\.\\.') && aps.has(src.charAt(4)));
448
+ // no need to prevent dots if it can't match a dot, or if a
449
+ // sub-pattern will be preventing it anyway.
450
+ const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
451
+ start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : '';
452
+ }
453
+ }
454
+ }
455
+ // append the "end of path portion" pattern to negation tails
456
+ let end = '';
457
+ if (this.isEnd() &&
458
+ this.#root.#filledNegs &&
459
+ this.#parent?.type === '!') {
460
+ end = '(?:$|\\/)';
461
+ }
462
+ const final = start + src + end;
463
+ return [
464
+ final,
465
+ (0, unescape_js_1.unescape)(src),
466
+ (this.#hasMagic = !!this.#hasMagic),
467
+ this.#uflag,
468
+ ];
469
+ }
470
+ // We need to calculate the body *twice* if it's a repeat pattern
471
+ // at the start, once in nodot mode, then again in dot mode, so a
472
+ // pattern like *(?) can match 'x.y'
473
+ const repeated = this.type === '*' || this.type === '+';
474
+ // some kind of extglob
475
+ const start = this.type === '!' ? '(?:(?!(?:' : '(?:';
476
+ let body = this.#partsToRegExp(dot);
477
+ if (this.isStart() && this.isEnd() && !body && this.type !== '!') {
478
+ // invalid extglob, has to at least be *something* present, if it's
479
+ // the entire path portion.
480
+ const s = this.toString();
481
+ this.#parts = [s];
482
+ this.type = null;
483
+ this.#hasMagic = undefined;
484
+ return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
485
+ }
486
+ // XXX abstract out this map method
487
+ let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot
488
+ ? ''
489
+ : this.#partsToRegExp(true);
490
+ if (bodyDotAllowed === body) {
491
+ bodyDotAllowed = '';
492
+ }
493
+ if (bodyDotAllowed) {
494
+ body = `(?:${body})(?:${bodyDotAllowed})*?`;
495
+ }
496
+ // an empty !() is exactly equivalent to a starNoEmpty
497
+ let final = '';
498
+ if (this.type === '!' && this.#emptyExt) {
499
+ final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty;
500
+ }
501
+ else {
502
+ const close = this.type === '!'
503
+ ? // !() must match something,but !(x) can match ''
504
+ '))' +
505
+ (this.isStart() && !dot && !allowDot ? startNoDot : '') +
506
+ star +
507
+ ')'
508
+ : this.type === '@'
509
+ ? ')'
510
+ : this.type === '?'
511
+ ? ')?'
512
+ : this.type === '+' && bodyDotAllowed
513
+ ? ')'
514
+ : this.type === '*' && bodyDotAllowed
515
+ ? `)?`
516
+ : `)${this.type}`;
517
+ final = start + body + close;
518
+ }
519
+ return [
520
+ final,
521
+ (0, unescape_js_1.unescape)(body),
522
+ (this.#hasMagic = !!this.#hasMagic),
523
+ this.#uflag,
524
+ ];
525
+ }
526
+ #partsToRegExp(dot) {
527
+ return this.#parts
528
+ .map(p => {
529
+ // extglob ASTs should only contain parent ASTs
530
+ /* c8 ignore start */
531
+ if (typeof p === 'string') {
532
+ throw new Error('string type in extglob ast??');
533
+ }
534
+ /* c8 ignore stop */
535
+ // can ignore hasMagic, because extglobs are already always magic
536
+ const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
537
+ this.#uflag = this.#uflag || uflag;
538
+ return re;
539
+ })
540
+ .filter(p => !(this.isStart() && this.isEnd()) || !!p)
541
+ .join('|');
542
+ }
543
+ static #parseGlob(glob, hasMagic, noEmpty = false) {
544
+ let escaping = false;
545
+ let re = '';
546
+ let uflag = false;
547
+ for (let i = 0; i < glob.length; i++) {
548
+ const c = glob.charAt(i);
549
+ if (escaping) {
550
+ escaping = false;
551
+ re += (reSpecials.has(c) ? '\\' : '') + c;
552
+ continue;
553
+ }
554
+ if (c === '\\') {
555
+ if (i === glob.length - 1) {
556
+ re += '\\\\';
557
+ }
558
+ else {
559
+ escaping = true;
560
+ }
561
+ continue;
562
+ }
563
+ if (c === '[') {
564
+ const [src, needUflag, consumed, magic] = (0, brace_expressions_js_1.parseClass)(glob, i);
565
+ if (consumed) {
566
+ re += src;
567
+ uflag = uflag || needUflag;
568
+ i += consumed - 1;
569
+ hasMagic = hasMagic || magic;
570
+ continue;
571
+ }
572
+ }
573
+ if (c === '*') {
574
+ if (noEmpty && glob === '*')
575
+ re += starNoEmpty;
576
+ else
577
+ re += star;
578
+ hasMagic = true;
579
+ continue;
580
+ }
581
+ if (c === '?') {
582
+ re += qmark;
583
+ hasMagic = true;
584
+ continue;
585
+ }
586
+ re += regExpEscape(c);
587
+ }
588
+ return [re, (0, unescape_js_1.unescape)(glob), !!hasMagic, uflag];
589
+ }
590
+ }
591
+ exports.AST = AST;
592
+ //# sourceMappingURL=ast.js.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/ast.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"ast.js","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":";AAAA,8BAA8B;;;AAE9B,iEAAmD;AAEnD,+C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oBAAE,EAAE,IAAI,WAAW,CAAA;;oBACzC,EAAE,IAAI,IAAI,CAAA;gBACf,QAAQ,GAAG,IAAI,CAAA;gBACf,SAAQ;YACV,CAAC;YACD,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;gBACd,EAAE,IAAI,KAAK,CAAA;gBACX,QAAQ,GAAG,IAAI,CAAA;gBACf,SAAQ;YACV,CAAC;YACD,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC,CAAA;QACvB,CAAC;QACD,OAAO,CAAC,EAAE,EAAE,IAAA,sBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;CACF;AA/kBD,kBA+kBC","sourcesContent":["// parse a single path portion\n\nimport { parseClass } from './brace-expressions.js'\nimport { MinimatchOptions, MMRegExp } from './index.js'\nimport { unescape } from './unescape.js'\n\n// classes [] are handled by the parseClass method\n// for positive extglobs, we sub-parse the contents, and combine,\n// with the appropriate regexp close.\n// for negative extglobs, we sub-parse the contents, but then\n// have to include the rest of the pattern, then the parent, etc.,\n// as the thing that cannot be because RegExp negative lookaheads\n// are different from globs.\n//\n// So for example:\n// a@(i|w!(x|y)z|j)b => ^a(i|w((!?(x|y)zb).*)z|j)b$\n// 1 2 3 4 5 6 1 2 3 46 5 6\n//\n// Assembling the extglob requires not just the negated patterns themselves,\n// but also anything following the negative patterns up to the boundary\n// of the current pattern, plus anything following in the parent pattern.\n//\n//\n// So, first, we parse the string into an AST of extglobs, without turning\n// anything into regexps yet.\n//\n// ['a', {@ [['i'], ['w', {!['x', 'y']}, 'z'], ['j']]}, 'b']\n//\n// Then, for all the negative extglobs, we append whatever comes after in\n// each parent as their tail\n//\n// ['a', {@ [['i'], ['w', {!['x', 'y'], 'z', 'b'}, 'z'], ['j']]}, 'b']\n//\n// Lastly, we turn each of these pieces into a regexp, and join\n//\n// v----- .* because there's more following,\n// v v otherwise, .+ because it must be\n// v v *something* there.\n// ['^a', {@ ['i', 'w(?:(!?(?:x|y).*zb$).*)z', 'j' ]}, 'b$']\n// copy what follows into here--^^^^^\n// ['^a', '(?:i|w(?:(?!(?:x|y).*zb$).*)z|j)', 'b$']\n// ['^a(?:i|w(?:(?!(?:x|y).*zb$).*)z|j)b$']\n\nexport type ExtglobType = '!' | '?' | '+' | '*' | '@'\nconst types = new Set<ExtglobType>(['!', '?', '+', '*', '@'])\nconst isExtglobType = (c: string): c is ExtglobType =>\n types.has(c as ExtglobType)\n\n// Patterns that get prepended to bind to the start of either the\n// entire string, or just a single path portion, to prevent dots\n// and/or traversal patterns, when needed.\n// Exts don't need the ^ or / bit, because the root binds that already.\nconst startNoTraversal = '(?!(?:^|/)\\\\.\\\\.?(?:$|/))'\nconst startNoDot = '(?!\\\\.)'\n\n// characters that indicate a start of pattern needs the \"no dots\" bit,\n// because a dot *might* be matched. ( is not in the list, because in\n// the case of a child extglob, it will handle the prevention itself.\nconst addPatternStart = new Set(['[', '.'])\n// cases where traversal is A-OK, no dot prevention needed\nconst justDots = new Set(['..', '.'])\nconst reSpecials = new Set('().*{}+?[]^$\\\\!')\nconst regExpEscape = (s: string) =>\n s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\n// any single thing other than /\nconst qmark = '[^/]'\n\n// * => any number of characters\nconst star = qmark + '*?'\n// use + when we need to ensure that *something* matches, because the * is\n// the only thing in the path portion.\nconst starNoEmpty = qmark + '+?'\n\n// remove the \\ chars that we added if we end up doing a nonmagic compare\n// const deslash = (s: string) => s.replace(/\\\\(.)/g, '$1')\n\nexport class AST {\n type: ExtglobType | null\n readonly #root: AST\n\n #hasMagic?: boolean\n #uflag: boolean = false\n #parts: (string | AST)[] = []\n readonly #parent?: AST\n readonly #parentIndex: number\n #negs: AST[]\n #filledNegs: boolean = false\n #options: MinimatchOptions\n #toString?: string\n // set to true if it's an extglob with no children\n // (which really means one child of '')\n #emptyExt: boolean = false\n\n constructor(\n type: ExtglobType | null,\n parent?: AST,\n options: MinimatchOptions = {}\n ) {\n this.type = type\n // extglobs are inherently magical\n if (type) this.#hasMagic = true\n this.#parent = parent\n this.#root = this.#parent ? this.#parent.#root : this\n this.#options = this.#root === this ? options : this.#root.#options\n this.#negs = this.#root === this ? [] : this.#root.#negs\n if (type === '!' && !this.#root.#filledNegs) this.#negs.push(this)\n this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0\n }\n\n get hasMagic(): boolean | undefined {\n /* c8 ignore start */\n if (this.#hasMagic !== undefined) return this.#hasMagic\n /* c8 ignore stop */\n for (const p of this.#parts) {\n if (typeof p === 'string') continue\n if (p.type || p.hasMagic) return (this.#hasMagic = true)\n }\n // note: will be undefined until we generate the regexp src and find out\n return this.#hasMagic\n }\n\n // reconstructs the pattern\n toString(): string {\n if (this.#toString !== undefined) return this.#toString\n if (!this.type) {\n return (this.#toString = this.#parts.map(p => String(p)).join(''))\n } else {\n return (this.#toString =\n this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')')\n }\n }\n\n #fillNegs() {\n /* c8 ignore start */\n if (this !== this.#root) throw new Error('should only call on root')\n if (this.#filledNegs) return this\n /* c8 ignore stop */\n\n // call toString() once to fill this out\n this.toString()\n this.#filledNegs = true\n let n: AST | undefined\n while ((n = this.#negs.pop())) {\n if (n.type !== '!') continue\n // walk up the tree, appending everthing that comes AFTER parentIndex\n let p: AST | undefined = n\n let pp = p.#parent\n while (pp) {\n for (\n let i = p.#parentIndex + 1;\n !pp.type && i < pp.#parts.length;\n i++\n ) {\n for (const part of n.#parts) {\n /* c8 ignore start */\n if (typeof part === 'string') {\n throw new Error('string part in extglob AST??')\n }\n /* c8 ignore stop */\n part.copyIn(pp.#parts[i])\n }\n }\n p = pp\n pp = p.#parent\n }\n }\n return this\n }\n\n push(...parts: (string | AST)[]) {\n for (const p of parts) {\n if (p === '') continue\n /* c8 ignore start */\n if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) {\n throw new Error('invalid part: ' + p)\n }\n /* c8 ignore stop */\n this.#parts.push(p)\n }\n }\n\n toJSON() {\n const ret: any[] =\n this.type === null\n ? this.#parts.slice().map(p => (typeof p === 'string' ? p : p.toJSON()))\n : [this.type, ...this.#parts.map(p => (p as AST).toJSON())]\n if (this.isStart() && !this.type) ret.unshift([])\n if (\n this.isEnd() &&\n (this === this.#root ||\n (this.#root.#filledNegs && this.#parent?.type === '!'))\n ) {\n ret.push({})\n }\n return ret\n }\n\n isStart(): boolean {\n if (this.#root === this) return true\n // if (this.type) return !!this.#parent?.isStart()\n if (!this.#parent?.isStart()) return false\n if (this.#parentIndex === 0) return true\n // if everything AHEAD of this is a negation, then it's still the \"start\"\n const p = this.#parent\n for (let i = 0; i < this.#parentIndex; i++) {\n const pp = p.#parts[i]\n if (!(pp instanceof AST && pp.type === '!')) {\n return false\n }\n }\n return true\n }\n\n isEnd(): boolean {\n if (this.#root === this) return true\n if (this.#parent?.type === '!') return true\n if (!this.#parent?.isEnd()) return false\n if (!this.type) return this.#parent?.isEnd()\n // if not root, it'll always have a parent\n /* c8 ignore start */\n const pl = this.#parent ? this.#parent.#parts.length : 0\n /* c8 ignore stop */\n return this.#parentIndex === pl - 1\n }\n\n copyIn(part: AST | string) {\n if (typeof part === 'string') this.push(part)\n else this.push(part.clone(this))\n }\n\n clone(parent: AST) {\n const c = new AST(this.type, parent)\n for (const p of this.#parts) {\n c.copyIn(p)\n }\n return c\n }\n\n static #parseAST(\n str: string,\n ast: AST,\n pos: number,\n opt: MinimatchOptions\n ): number {\n let escaping = false\n let inBrace = false\n let braceStart = -1\n let braceNeg = false\n if (ast.type === null) {\n // outside of a extglob, append until we find a start\n let i = pos\n let acc = ''\n while (i < str.length) {\n const c = str.charAt(i++)\n // still accumulate escapes at this point, but we do ignore\n // starts that are escaped\n if (escaping || c === '\\\\') {\n escaping = !escaping\n acc += c\n continue\n }\n\n if (inBrace) {\n if (i === braceStart + 1) {\n if (c === '^' || c === '!') {\n braceNeg = true\n }\n } else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {\n inBrace = false\n }\n acc += c\n continue\n } else if (c === '[') {\n inBrace = true\n braceStart = i\n braceNeg = false\n acc += c\n continue\n }\n\n if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {\n ast.push(acc)\n acc = ''\n const ext = new AST(c, ast)\n i = AST.#parseAST(str, ext, i, opt)\n ast.push(ext)\n continue\n }\n acc += c\n }\n ast.push(acc)\n return i\n }\n\n // some kind of extglob, pos is at the (\n // find the next | or )\n let i = pos + 1\n let part = new AST(null, ast)\n const parts: AST[] = []\n let acc = ''\n while (i < str.length) {\n const c = str.charAt(i++)\n // still accumulate escapes at this point, but we do ignore\n // starts that are escaped\n if (escaping || c === '\\\\') {\n escaping = !escaping\n acc += c\n continue\n }\n\n if (inBrace) {\n if (i === braceStart + 1) {\n if (c === '^' || c === '!') {\n braceNeg = true\n }\n } else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {\n inBrace = false\n }\n acc += c\n continue\n } else if (c === '[') {\n inBrace = true\n braceStart = i\n braceNeg = false\n acc += c\n continue\n }\n\n if (isExtglobType(c) && str.charAt(i) === '(') {\n part.push(acc)\n acc = ''\n const ext = new AST(c, part)\n part.push(ext)\n i = AST.#parseAST(str, ext, i, opt)\n continue\n }\n if (c === '|') {\n part.push(acc)\n acc = ''\n parts.push(part)\n part = new AST(null, ast)\n continue\n }\n if (c === ')') {\n if (acc === '' && ast.#parts.length === 0) {\n ast.#emptyExt = true\n }\n part.push(acc)\n acc = ''\n ast.push(...parts, part)\n return i\n }\n acc += c\n }\n\n // unfinished extglob\n // if we got here, it was a malformed extglob! not an extglob, but\n // maybe something else in there.\n ast.type = null\n ast.#hasMagic = undefined\n ast.#parts = [str.substring(pos - 1)]\n return i\n }\n\n static fromGlob(pattern: string, options: MinimatchOptions = {}) {\n const ast = new AST(null, undefined, options)\n AST.#parseAST(pattern, ast, 0, options)\n return ast\n }\n\n // returns the regular expression if there's magic, or the unescaped\n // string if not.\n toMMPattern(): MMRegExp | string {\n // should only be called on root\n /* c8 ignore start */\n if (this !== this.#root) return this.#root.toMMPattern()\n /* c8 ignore stop */\n const glob = this.toString()\n const [re, body, hasMagic, uflag] = this.toRegExpSource()\n // if we're in nocase mode, and not nocaseMagicOnly, then we do\n // still need a regular expression if we have to case-insensitively\n // match capital/lowercase characters.\n const anyMagic =\n hasMagic ||\n this.#hasMagic ||\n (this.#options.nocase &&\n !this.#options.nocaseMagicOnly &&\n glob.toUpperCase() !== glob.toLowerCase())\n if (!anyMagic) {\n return body\n }\n\n const flags = (this.#options.nocase ? 'i' : '') + (uflag ? 'u' : '')\n return Object.assign(new RegExp(`^${re}$`, flags), {\n _src: re,\n _glob: glob,\n })\n }\n\n get options() {\n return this.#options\n }\n\n // returns the string match, the regexp source, whether there's magic\n // in the regexp (so a regular expression is required) and whether or\n // not the uflag is needed for the regular expression (for posix classes)\n // TODO: instead of injecting the start/end at this point, just return\n // the BODY of the regexp, along with the start/end portions suitable\n // for binding the start/end in either a joined full-path makeRe context\n // (where we bind to (^|/), or a standalone matchPart context (where\n // we bind to ^, and not /). Otherwise slashes get duped!\n //\n // In part-matching mode, the start is:\n // - if not isStart: nothing\n // - if traversal possible, but not allowed: ^(?!\\.\\.?$)\n // - if dots allowed or not possible: ^\n // - if dots possible and not allowed: ^(?!\\.)\n // end is:\n // - if not isEnd(): nothing\n // - else: $\n //\n // In full-path matching mode, we put the slash at the START of the\n // pattern, so start is:\n // - if first pattern: same as part-matching mode\n // - if not isStart(): nothing\n // - if traversal possible, but not allowed: /(?!\\.\\.?(?:$|/))\n // - if dots allowed or not possible: /\n // - if dots possible and not allowed: /(?!\\.)\n // end is:\n // - if last pattern, same as part-matching mode\n // - else nothing\n //\n // Always put the (?:$|/) on negated tails, though, because that has to be\n // there to bind the end of the negated pattern portion, and it's easier to\n // just stick it in now rather than try to inject it later in the middle of\n // the pattern.\n //\n // We can just always return the same end, and leave it up to the caller\n // to know whether it's going to be used joined or in parts.\n // And, if the start is adjusted slightly, can do the same there:\n // - if not isStart: nothing\n // - if traversal possible, but not allowed: (?:/|^)(?!\\.\\.?$)\n // - if dots allowed or not possible: (?:/|^)\n // - if dots possible and not allowed: (?:/|^)(?!\\.)\n //\n // But it's better to have a simpler binding without a conditional, for\n // performance, so probably better to return both start options.\n //\n // Then the caller just ignores the end if it's not the first pattern,\n // and the start always gets applied.\n //\n // But that's always going to be $ if it's the ending pattern, or nothing,\n // so the caller can just attach $ at the end of the pattern when building.\n //\n // So the todo is:\n // - better detect what kind of start is needed\n // - return both flavors of starting pattern\n // - attach $ at the end of the pattern when creating the actual RegExp\n //\n // Ah, but wait, no, that all only applies to the root when the first pattern\n // is not an extglob. If the first pattern IS an extglob, then we need all\n // that dot prevention biz to live in the extglob portions, because eg\n // +(*|.x*) can match .xy but not .yx.\n //\n // So, return the two flavors if it's #root and the first child is not an\n // AST, otherwise leave it to the child AST to handle it, and there,\n // use the (?:^|/) style of start binding.\n //\n // Even simplified further:\n // - Since the start for a join is eg /(?!\\.) and the start for a part\n // is ^(?!\\.), we can just prepend (?!\\.) to the pattern (either root\n // or start or whatever) and prepend ^ or / at the Regexp construction.\n toRegExpSource(\n allowDot?: boolean\n ): [re: string, body: string, hasMagic: boolean, uflag: boolean] {\n const dot = allowDot ?? !!this.#options.dot\n if (this.#root === this) this.#fillNegs()\n if (!this.type) {\n const noEmpty = this.isStart() && this.isEnd()\n const src = this.#parts\n .map(p => {\n const [re, _, hasMagic, uflag] =\n typeof p === 'string'\n ? AST.#parseGlob(p, this.#hasMagic, noEmpty)\n : p.toRegExpSource(allowDot)\n this.#hasMagic = this.#hasMagic || hasMagic\n this.#uflag = this.#uflag || uflag\n return re\n })\n .join('')\n\n let start = ''\n if (this.isStart()) {\n if (typeof this.#parts[0] === 'string') {\n // this is the string that will match the start of the pattern,\n // so we need to protect against dots and such.\n\n // '.' and '..' cannot match unless the pattern is that exactly,\n // even if it starts with . or dot:true is set.\n const dotTravAllowed =\n this.#parts.length === 1 && justDots.has(this.#parts[0])\n if (!dotTravAllowed) {\n const aps = addPatternStart\n // check if we have a possibility of matching . or ..,\n // and prevent that.\n const needNoTrav =\n // dots are allowed, and the pattern starts with [ or .\n (dot && aps.has(src.charAt(0))) ||\n // the pattern starts with \\., and then [ or .\n (src.startsWith('\\\\.') && aps.has(src.charAt(2))) ||\n // the pattern starts with \\.\\., and then [ or .\n (src.startsWith('\\\\.\\\\.') && aps.has(src.charAt(4)))\n // no need to prevent dots if it can't match a dot, or if a\n // sub-pattern will be preventing it anyway.\n const needNoDot = !dot && !allowDot && aps.has(src.charAt(0))\n\n start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : ''\n }\n }\n }\n\n // append the \"end of path portion\" pattern to negation tails\n let end = ''\n if (\n this.isEnd() &&\n this.#root.#filledNegs &&\n this.#parent?.type === '!'\n ) {\n end = '(?:$|\\\\/)'\n }\n const final = start + src + end\n return [\n final,\n unescape(src),\n (this.#hasMagic = !!this.#hasMagic),\n this.#uflag,\n ]\n }\n\n // We need to calculate the body *twice* if it's a repeat pattern\n // at the start, once in nodot mode, then again in dot mode, so a\n // pattern like *(?) can match 'x.y'\n\n const repeated = this.type === '*' || this.type === '+'\n // some kind of extglob\n const start = this.type === '!' ? '(?:(?!(?:' : '(?:'\n let body = this.#partsToRegExp(dot)\n\n if (this.isStart() && this.isEnd() && !body && this.type !== '!') {\n // invalid extglob, has to at least be *something* present, if it's\n // the entire path portion.\n const s = this.toString()\n this.#parts = [s]\n this.type = null\n this.#hasMagic = undefined\n return [s, unescape(this.toString()), false, false]\n }\n\n // XXX abstract out this map method\n let bodyDotAllowed =\n !repeated || allowDot || dot || !startNoDot\n ? ''\n : this.#partsToRegExp(true)\n if (bodyDotAllowed === body) {\n bodyDotAllowed = ''\n }\n if (bodyDotAllowed) {\n body = `(?:${body})(?:${bodyDotAllowed})*?`\n }\n\n // an empty !() is exactly equivalent to a starNoEmpty\n let final = ''\n if (this.type === '!' && this.#emptyExt) {\n final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty\n } else {\n const close =\n this.type === '!'\n ? // !() must match something,but !(x) can match ''\n '))' +\n (this.isStart() && !dot && !allowDot ? startNoDot : '') +\n star +\n ')'\n : this.type === '@'\n ? ')'\n : this.type === '?'\n ? ')?'\n : this.type === '+' && bodyDotAllowed\n ? ')'\n : this.type === '*' && bodyDotAllowed\n ? `)?`\n : `)${this.type}`\n final = start + body + close\n }\n return [\n final,\n unescape(body),\n (this.#hasMagic = !!this.#hasMagic),\n this.#uflag,\n ]\n }\n\n #partsToRegExp(dot: boolean) {\n return this.#parts\n .map(p => {\n // extglob ASTs should only contain parent ASTs\n /* c8 ignore start */\n if (typeof p === 'string') {\n throw new Error('string type in extglob ast??')\n }\n /* c8 ignore stop */\n // can ignore hasMagic, because extglobs are already always magic\n const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot)\n this.#uflag = this.#uflag || uflag\n return re\n })\n .filter(p => !(this.isStart() && this.isEnd()) || !!p)\n .join('|')\n }\n\n static #parseGlob(\n glob: string,\n hasMagic: boolean | undefined,\n noEmpty: boolean = false\n ): [re: string, body: string, hasMagic: boolean, uflag: boolean] {\n let escaping = false\n let re = ''\n let uflag = false\n for (let i = 0; i < glob.length; i++) {\n const c = glob.charAt(i)\n if (escaping) {\n escaping = false\n re += (reSpecials.has(c) ? '\\\\' : '') + c\n continue\n }\n if (c === '\\\\') {\n if (i === glob.length - 1) {\n re += '\\\\\\\\'\n } else {\n escaping = true\n }\n continue\n }\n if (c === '[') {\n const [src, needUflag, consumed, magic] = parseClass(glob, i)\n if (consumed) {\n re += src\n uflag = uflag || needUflag\n i += consumed - 1\n hasMagic = hasMagic || magic\n continue\n }\n }\n if (c === '*') {\n if (noEmpty && glob === '*') re += starNoEmpty\n else re += star\n hasMagic = true\n continue\n }\n if (c === '?') {\n re += qmark\n hasMagic = true\n continue\n }\n re += regExpEscape(c)\n }\n return [re, unescape(glob), !!hasMagic, uflag]\n }\n}\n"]}
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/brace-expressions.js ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ // translate the various posix character classes into unicode properties
3
+ // this works across all unicode locales
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.parseClass = void 0;
6
+ // { <posix class>: [<translation>, /u flag required, negated]
7
+ const posixClasses = {
8
+ '[:alnum:]': ['\\p{L}\\p{Nl}\\p{Nd}', true],
9
+ '[:alpha:]': ['\\p{L}\\p{Nl}', true],
10
+ '[:ascii:]': ['\\x' + '00-\\x' + '7f', false],
11
+ '[:blank:]': ['\\p{Zs}\\t', true],
12
+ '[:cntrl:]': ['\\p{Cc}', true],
13
+ '[:digit:]': ['\\p{Nd}', true],
14
+ '[:graph:]': ['\\p{Z}\\p{C}', true, true],
15
+ '[:lower:]': ['\\p{Ll}', true],
16
+ '[:print:]': ['\\p{C}', true],
17
+ '[:punct:]': ['\\p{P}', true],
18
+ '[:space:]': ['\\p{Z}\\t\\r\\n\\v\\f', true],
19
+ '[:upper:]': ['\\p{Lu}', true],
20
+ '[:word:]': ['\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}', true],
21
+ '[:xdigit:]': ['A-Fa-f0-9', false],
22
+ };
23
+ // only need to escape a few things inside of brace expressions
24
+ // escapes: [ \ ] -
25
+ const braceEscape = (s) => s.replace(/[[\]\\-]/g, '\\$&');
26
+ // escape all regexp magic characters
27
+ const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
28
+ // everything has already been escaped, we just have to join
29
+ const rangesToString = (ranges) => ranges.join('');
30
+ // takes a glob string at a posix brace expression, and returns
31
+ // an equivalent regular expression source, and boolean indicating
32
+ // whether the /u flag needs to be applied, and the number of chars
33
+ // consumed to parse the character class.
34
+ // This also removes out of order ranges, and returns ($.) if the
35
+ // entire class just no good.
36
+ const parseClass = (glob, position) => {
37
+ const pos = position;
38
+ /* c8 ignore start */
39
+ if (glob.charAt(pos) !== '[') {
40
+ throw new Error('not in a brace expression');
41
+ }
42
+ /* c8 ignore stop */
43
+ const ranges = [];
44
+ const negs = [];
45
+ let i = pos + 1;
46
+ let sawStart = false;
47
+ let uflag = false;
48
+ let escaping = false;
49
+ let negate = false;
50
+ let endPos = pos;
51
+ let rangeStart = '';
52
+ WHILE: while (i < glob.length) {
53
+ const c = glob.charAt(i);
54
+ if ((c === '!' || c === '^') && i === pos + 1) {
55
+ negate = true;
56
+ i++;
57
+ continue;
58
+ }
59
+ if (c === ']' && sawStart && !escaping) {
60
+ endPos = i + 1;
61
+ break;
62
+ }
63
+ sawStart = true;
64
+ if (c === '\\') {
65
+ if (!escaping) {
66
+ escaping = true;
67
+ i++;
68
+ continue;
69
+ }
70
+ // escaped \ char, fall through and treat like normal char
71
+ }
72
+ if (c === '[' && !escaping) {
73
+ // either a posix class, a collation equivalent, or just a [
74
+ for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
75
+ if (glob.startsWith(cls, i)) {
76
+ // invalid, [a-[] is fine, but not [a-[:alpha]]
77
+ if (rangeStart) {
78
+ return ['$.', false, glob.length - pos, true];
79
+ }
80
+ i += cls.length;
81
+ if (neg)
82
+ negs.push(unip);
83
+ else
84
+ ranges.push(unip);
85
+ uflag = uflag || u;
86
+ continue WHILE;
87
+ }
88
+ }
89
+ }
90
+ // now it's just a normal character, effectively
91
+ escaping = false;
92
+ if (rangeStart) {
93
+ // throw this range away if it's not valid, but others
94
+ // can still match.
95
+ if (c > rangeStart) {
96
+ ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c));
97
+ }
98
+ else if (c === rangeStart) {
99
+ ranges.push(braceEscape(c));
100
+ }
101
+ rangeStart = '';
102
+ i++;
103
+ continue;
104
+ }
105
+ // now might be the start of a range.
106
+ // can be either c-d or c-] or c<more...>] or c] at this point
107
+ if (glob.startsWith('-]', i + 1)) {
108
+ ranges.push(braceEscape(c + '-'));
109
+ i += 2;
110
+ continue;
111
+ }
112
+ if (glob.startsWith('-', i + 1)) {
113
+ rangeStart = c;
114
+ i += 2;
115
+ continue;
116
+ }
117
+ // not the start of a range, just a single character
118
+ ranges.push(braceEscape(c));
119
+ i++;
120
+ }
121
+ if (endPos < i) {
122
+ // didn't see the end of the class, not a valid class,
123
+ // but might still be valid as a literal match.
124
+ return ['', false, 0, false];
125
+ }
126
+ // if we got no ranges and no negates, then we have a range that
127
+ // cannot possibly match anything, and that poisons the whole glob
128
+ if (!ranges.length && !negs.length) {
129
+ return ['$.', false, glob.length - pos, true];
130
+ }
131
+ // if we got one positive range, and it's a single character, then that's
132
+ // not actually a magic pattern, it's just that one literal character.
133
+ // we should not treat that as "magic", we should just return the literal
134
+ // character. [_] is a perfectly valid way to escape glob magic chars.
135
+ if (negs.length === 0 &&
136
+ ranges.length === 1 &&
137
+ /^\\?.$/.test(ranges[0]) &&
138
+ !negate) {
139
+ const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
140
+ return [regexpEscape(r), false, endPos - pos, false];
141
+ }
142
+ const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']';
143
+ const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']';
144
+ const comb = ranges.length && negs.length
145
+ ? '(' + sranges + '|' + snegs + ')'
146
+ : ranges.length
147
+ ? sranges
148
+ : snegs;
149
+ return [comb, uflag, endPos - pos, true];
150
+ };
151
+ exports.parseClass = parseClass;
152
+ //# sourceMappingURL=brace-expressions.js.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/brace-expressions.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"brace-expressions.js","sourceRoot":"","sources":["../../src/brace-expressions.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,wCAAwC;;;AAExC,8DAA8D;AAC9D,MAAM,YAAY,GAA0D;IAC1E,WAAW,EAAE,CAAC,sBAAsB,EAAE,IAAI,CAAC;IAC3C,WAAW,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,KAAK,GAAG,QAAQ,GAAG,IAAI,EAAE,KAAK,CAAC;IAC7C,WAAW,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC;IACjC,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC;IACzC,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC;IAC7B,WAAW,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC;IAC7B,WAAW,EAAE,CAAC,uBAAuB,EAAE,IAAI,CAAC;IAC5C,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,UAAU,EAAE,CAAC,6BAA6B,EAAE,IAAI,CAAC;IACjD,YAAY,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC;CACnC,CAAA;AAED,+DAA+D;AAC/D,mBAAmB;AACnB,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;AACjE,qCAAqC;AACrC,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,EAAE,CACjC,CAAC,CAAC,OAA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B,MAAM,CAAC,MAAM,KAAK,CAAC;QACnB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC,MAAM,EACP,CAAC;QACD,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAClE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,KAAK,CAAC,CAAA;IACtD,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG,GAAG,CAAA;IACxE,MAAM,KAAK,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACpE,MAAM,IAAI,GACR,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM;QAC1B,CAAC,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG;QACnC,CAAC,CAAC,MAAM,CAAC,MAAM;YACf,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,KAAK,CAAA;IAEX,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,CAAA;AAC1C,CAAC,CAAA;AAhIY,QAAA,UAAU,cAgItB","sourcesContent":["// translate the various posix character classes into unicode properties\n// this works across all unicode locales\n\n// { <posix class>: [<translation>, /u flag required, negated]\nconst posixClasses: { [k: string]: [e: string, u: boolean, n?: boolean] } = {\n '[:alnum:]': ['\\\\p{L}\\\\p{Nl}\\\\p{Nd}', true],\n '[:alpha:]': ['\\\\p{L}\\\\p{Nl}', true],\n '[:ascii:]': ['\\\\x' + '00-\\\\x' + '7f', false],\n '[:blank:]': ['\\\\p{Zs}\\\\t', true],\n '[:cntrl:]': ['\\\\p{Cc}', true],\n '[:digit:]': ['\\\\p{Nd}', true],\n '[:graph:]': ['\\\\p{Z}\\\\p{C}', true, true],\n '[:lower:]': ['\\\\p{Ll}', true],\n '[:print:]': ['\\\\p{C}', true],\n '[:punct:]': ['\\\\p{P}', true],\n '[:space:]': ['\\\\p{Z}\\\\t\\\\r\\\\n\\\\v\\\\f', true],\n '[:upper:]': ['\\\\p{Lu}', true],\n '[:word:]': ['\\\\p{L}\\\\p{Nl}\\\\p{Nd}\\\\p{Pc}', true],\n '[:xdigit:]': ['A-Fa-f0-9', false],\n}\n\n// only need to escape a few things inside of brace expressions\n// escapes: [ \\ ] -\nconst braceEscape = (s: string) => s.replace(/[[\\]\\\\-]/g, '\\\\$&')\n// escape all regexp magic characters\nconst regexpEscape = (s: string) =>\n s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\n// everything has already been escaped, we just have to join\nconst rangesToString = (ranges: string[]): string => ranges.join('')\n\nexport type ParseClassResult = [\n src: string,\n uFlag: boolean,\n consumed: number,\n hasMagic: boolean\n]\n\n// takes a glob string at a posix brace expression, and returns\n// an equivalent regular expression source, and boolean indicating\n// whether the /u flag needs to be applied, and the number of chars\n// consumed to parse the character class.\n// This also removes out of order ranges, and returns ($.) if the\n// entire class just no good.\nexport const parseClass = (\n glob: string,\n position: number\n): ParseClassResult => {\n const pos = position\n /* c8 ignore start */\n if (glob.charAt(pos) !== '[') {\n throw new Error('not in a brace expression')\n }\n /* c8 ignore stop */\n const ranges: string[] = []\n const negs: string[] = []\n\n let i = pos + 1\n let sawStart = false\n let uflag = false\n let escaping = false\n let negate = false\n let endPos = pos\n let rangeStart = ''\n WHILE: while (i < glob.length) {\n const c = glob.charAt(i)\n if ((c === '!' || c === '^') && i === pos + 1) {\n negate = true\n i++\n continue\n }\n\n if (c === ']' && sawStart && !escaping) {\n endPos = i + 1\n break\n }\n\n sawStart = true\n if (c === '\\\\') {\n if (!escaping) {\n escaping = true\n i++\n continue\n }\n // escaped \\ char, fall through and treat like normal char\n }\n if (c === '[' && !escaping) {\n // either a posix class, a collation equivalent, or just a [\n for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {\n if (glob.startsWith(cls, i)) {\n // invalid, [a-[] is fine, but not [a-[:alpha]]\n if (rangeStart) {\n return ['$.', false, glob.length - pos, true]\n }\n i += cls.length\n if (neg) negs.push(unip)\n else ranges.push(unip)\n uflag = uflag || u\n continue WHILE\n }\n }\n }\n\n // now it's just a normal character, effectively\n escaping = false\n if (rangeStart) {\n // throw this range away if it's not valid, but others\n // can still match.\n if (c > rangeStart) {\n ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c))\n } else if (c === rangeStart) {\n ranges.push(braceEscape(c))\n }\n rangeStart = ''\n i++\n continue\n }\n\n // now might be the start of a range.\n // can be either c-d or c-] or c<more...>] or c] at this point\n if (glob.startsWith('-]', i + 1)) {\n ranges.push(braceEscape(c + '-'))\n i += 2\n continue\n }\n if (glob.startsWith('-', i + 1)) {\n rangeStart = c\n i += 2\n continue\n }\n\n // not the start of a range, just a single character\n ranges.push(braceEscape(c))\n i++\n }\n\n if (endPos < i) {\n // didn't see the end of the class, not a valid class,\n // but might still be valid as a literal match.\n return ['', false, 0, false]\n }\n\n // if we got no ranges and no negates, then we have a range that\n // cannot possibly match anything, and that poisons the whole glob\n if (!ranges.length && !negs.length) {\n return ['$.', false, glob.length - pos, true]\n }\n\n // if we got one positive range, and it's a single character, then that's\n // not actually a magic pattern, it's just that one literal character.\n // we should not treat that as \"magic\", we should just return the literal\n // character. [_] is a perfectly valid way to escape glob magic chars.\n if (\n negs.length === 0 &&\n ranges.length === 1 &&\n /^\\\\?.$/.test(ranges[0]) &&\n !negate\n ) {\n const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]\n return [regexpEscape(r), false, endPos - pos, false]\n }\n\n const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']'\n const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']'\n const comb =\n ranges.length && negs.length\n ? '(' + sranges + '|' + snegs + ')'\n : ranges.length\n ? sranges\n : snegs\n\n return [comb, uflag, endPos - pos, true]\n}\n"]}
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/escape.d.ts ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { MinimatchOptions } from './index.js';
2
+ /**
3
+ * Escape all magic characters in a glob pattern.
4
+ *
5
+ * If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}
6
+ * option is used, then characters are escaped by wrapping in `[]`, because
7
+ * a magic character wrapped in a character class can only be satisfied by
8
+ * that exact character. In this mode, `\` is _not_ escaped, because it is
9
+ * not interpreted as a magic character, but instead as a path separator.
10
+ */
11
+ export declare const escape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
12
+ //# sourceMappingURL=escape.d.ts.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/index.d.ts ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { AST } from './ast.js';
2
+ type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
3
+ export interface MinimatchOptions {
4
+ nobrace?: boolean;
5
+ nocomment?: boolean;
6
+ nonegate?: boolean;
7
+ debug?: boolean;
8
+ noglobstar?: boolean;
9
+ noext?: boolean;
10
+ nonull?: boolean;
11
+ windowsPathsNoEscape?: boolean;
12
+ allowWindowsEscape?: boolean;
13
+ partial?: boolean;
14
+ dot?: boolean;
15
+ nocase?: boolean;
16
+ nocaseMagicOnly?: boolean;
17
+ magicalBraces?: boolean;
18
+ matchBase?: boolean;
19
+ flipNegate?: boolean;
20
+ preserveMultipleSlashes?: boolean;
21
+ optimizationLevel?: number;
22
+ platform?: Platform;
23
+ windowsNoMagicRoot?: boolean;
24
+ }
25
+ export declare const minimatch: {
26
+ (p: string, pattern: string, options?: MinimatchOptions): boolean;
27
+ sep: Sep;
28
+ GLOBSTAR: typeof GLOBSTAR;
29
+ filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
30
+ defaults: (def: MinimatchOptions) => typeof minimatch;
31
+ braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
32
+ makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
33
+ match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
34
+ AST: typeof AST;
35
+ Minimatch: typeof Minimatch;
36
+ escape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
37
+ unescape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
38
+ };
39
+ type Sep = '\\' | '/';
40
+ export declare const sep: Sep;
41
+ export declare const GLOBSTAR: unique symbol;
42
+ export declare const filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
43
+ export declare const defaults: (def: MinimatchOptions) => typeof minimatch;
44
+ export declare const braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
45
+ export declare const makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
46
+ export declare const match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
47
+ export type MMRegExp = RegExp & {
48
+ _src?: string;
49
+ _glob?: string;
50
+ };
51
+ export type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR;
52
+ export type ParseReturn = ParseReturnFiltered | false;
53
+ export declare class Minimatch {
54
+ options: MinimatchOptions;
55
+ set: ParseReturnFiltered[][];
56
+ pattern: string;
57
+ windowsPathsNoEscape: boolean;
58
+ nonegate: boolean;
59
+ negate: boolean;
60
+ comment: boolean;
61
+ empty: boolean;
62
+ preserveMultipleSlashes: boolean;
63
+ partial: boolean;
64
+ globSet: string[];
65
+ globParts: string[][];
66
+ nocase: boolean;
67
+ isWindows: boolean;
68
+ platform: Platform;
69
+ windowsNoMagicRoot: boolean;
70
+ regexp: false | null | MMRegExp;
71
+ constructor(pattern: string, options?: MinimatchOptions);
72
+ hasMagic(): boolean;
73
+ debug(..._: any[]): void;
74
+ make(): void;
75
+ preprocess(globParts: string[][]): string[][];
76
+ adjascentGlobstarOptimize(globParts: string[][]): string[][];
77
+ levelOneOptimize(globParts: string[][]): string[][];
78
+ levelTwoFileOptimize(parts: string | string[]): string[];
79
+ firstPhasePreProcess(globParts: string[][]): string[][];
80
+ secondPhasePreProcess(globParts: string[][]): string[][];
81
+ partsMatch(a: string[], b: string[], emptyGSMatch?: boolean): false | string[];
82
+ parseNegate(): void;
83
+ matchOne(file: string[], pattern: ParseReturn[], partial?: boolean): boolean;
84
+ braceExpand(): string[];
85
+ parse(pattern: string): ParseReturn;
86
+ makeRe(): false | MMRegExp;
87
+ slashSplit(p: string): string[];
88
+ match(f: string, partial?: boolean): boolean;
89
+ static defaults(def: MinimatchOptions): typeof Minimatch;
90
+ }
91
+ export { AST } from './ast.js';
92
+ export { escape } from './escape.js';
93
+ export { unescape } from './unescape.js';
94
+ //# sourceMappingURL=index.d.ts.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/index.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unescape = exports.escape = exports.AST = exports.Minimatch = exports.match = exports.makeRe = exports.braceExpand = exports.defaults = exports.filter = exports.GLOBSTAR = exports.sep = exports.minimatch = void 0;
4
+ const brace_expansion_1 = require("@isaacs/brace-expansion");
5
+ const assert_valid_pattern_js_1 = require("./assert-valid-pattern.js");
6
+ const ast_js_1 = require("./ast.js");
7
+ const escape_js_1 = require("./escape.js");
8
+ const unescape_js_1 = require("./unescape.js");
9
+ const minimatch = (p, pattern, options = {}) => {
10
+ (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
11
+ // shortcut: comments match nothing.
12
+ if (!options.nocomment && pattern.charAt(0) === '#') {
13
+ return false;
14
+ }
15
+ return new Minimatch(pattern, options).match(p);
16
+ };
17
+ exports.minimatch = minimatch;
18
+ // Optimized checking for the most common glob patterns.
19
+ const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
20
+ const starDotExtTest = (ext) => (f) => !f.startsWith('.') && f.endsWith(ext);
21
+ const starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
22
+ const starDotExtTestNocase = (ext) => {
23
+ ext = ext.toLowerCase();
24
+ return (f) => !f.startsWith('.') && f.toLowerCase().endsWith(ext);
25
+ };
26
+ const starDotExtTestNocaseDot = (ext) => {
27
+ ext = ext.toLowerCase();
28
+ return (f) => f.toLowerCase().endsWith(ext);
29
+ };
30
+ const starDotStarRE = /^\*+\.\*+$/;
31
+ const starDotStarTest = (f) => !f.startsWith('.') && f.includes('.');
32
+ const starDotStarTestDot = (f) => f !== '.' && f !== '..' && f.includes('.');
33
+ const dotStarRE = /^\.\*+$/;
34
+ const dotStarTest = (f) => f !== '.' && f !== '..' && f.startsWith('.');
35
+ const starRE = /^\*+$/;
36
+ const starTest = (f) => f.length !== 0 && !f.startsWith('.');
37
+ const starTestDot = (f) => f.length !== 0 && f !== '.' && f !== '..';
38
+ const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
39
+ const qmarksTestNocase = ([$0, ext = '']) => {
40
+ const noext = qmarksTestNoExt([$0]);
41
+ if (!ext)
42
+ return noext;
43
+ ext = ext.toLowerCase();
44
+ return (f) => noext(f) && f.toLowerCase().endsWith(ext);
45
+ };
46
+ const qmarksTestNocaseDot = ([$0, ext = '']) => {
47
+ const noext = qmarksTestNoExtDot([$0]);
48
+ if (!ext)
49
+ return noext;
50
+ ext = ext.toLowerCase();
51
+ return (f) => noext(f) && f.toLowerCase().endsWith(ext);
52
+ };
53
+ const qmarksTestDot = ([$0, ext = '']) => {
54
+ const noext = qmarksTestNoExtDot([$0]);
55
+ return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
56
+ };
57
+ const qmarksTest = ([$0, ext = '']) => {
58
+ const noext = qmarksTestNoExt([$0]);
59
+ return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
60
+ };
61
+ const qmarksTestNoExt = ([$0]) => {
62
+ const len = $0.length;
63
+ return (f) => f.length === len && !f.startsWith('.');
64
+ };
65
+ const qmarksTestNoExtDot = ([$0]) => {
66
+ const len = $0.length;
67
+ return (f) => f.length === len && f !== '.' && f !== '..';
68
+ };
69
+ /* c8 ignore start */
70
+ const defaultPlatform = (typeof process === 'object' && process
71
+ ? (typeof process.env === 'object' &&
72
+ process.env &&
73
+ process.env.__MINIMATCH_TESTING_PLATFORM__) ||
74
+ process.platform
75
+ : 'posix');
76
+ const path = {
77
+ win32: { sep: '\\' },
78
+ posix: { sep: '/' },
79
+ };
80
+ /* c8 ignore stop */
81
+ exports.sep = defaultPlatform === 'win32' ? path.win32.sep : path.posix.sep;
82
+ exports.minimatch.sep = exports.sep;
83
+ exports.GLOBSTAR = Symbol('globstar **');
84
+ exports.minimatch.GLOBSTAR = exports.GLOBSTAR;
85
+ // any single thing other than /
86
+ // don't need to escape / when using new RegExp()
87
+ const qmark = '[^/]';
88
+ // * => any number of characters
89
+ const star = qmark + '*?';
90
+ // ** when dots are allowed. Anything goes, except .. and .
91
+ // not (^ or / followed by one or two dots followed by $ or /),
92
+ // followed by anything, any number of times.
93
+ const twoStarDot = '(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?';
94
+ // not a ^ or / followed by a dot,
95
+ // followed by anything, any number of times.
96
+ const twoStarNoDot = '(?:(?!(?:\\/|^)\\.).)*?';
97
+ const filter = (pattern, options = {}) => (p) => (0, exports.minimatch)(p, pattern, options);
98
+ exports.filter = filter;
99
+ exports.minimatch.filter = exports.filter;
100
+ const ext = (a, b = {}) => Object.assign({}, a, b);
101
+ const defaults = (def) => {
102
+ if (!def || typeof def !== 'object' || !Object.keys(def).length) {
103
+ return exports.minimatch;
104
+ }
105
+ const orig = exports.minimatch;
106
+ const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
107
+ return Object.assign(m, {
108
+ Minimatch: class Minimatch extends orig.Minimatch {
109
+ constructor(pattern, options = {}) {
110
+ super(pattern, ext(def, options));
111
+ }
112
+ static defaults(options) {
113
+ return orig.defaults(ext(def, options)).Minimatch;
114
+ }
115
+ },
116
+ AST: class AST extends orig.AST {
117
+ /* c8 ignore start */
118
+ constructor(type, parent, options = {}) {
119
+ super(type, parent, ext(def, options));
120
+ }
121
+ /* c8 ignore stop */
122
+ static fromGlob(pattern, options = {}) {
123
+ return orig.AST.fromGlob(pattern, ext(def, options));
124
+ }
125
+ },
126
+ unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
127
+ escape: (s, options = {}) => orig.escape(s, ext(def, options)),
128
+ filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
129
+ defaults: (options) => orig.defaults(ext(def, options)),
130
+ makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
131
+ braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
132
+ match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
133
+ sep: orig.sep,
134
+ GLOBSTAR: exports.GLOBSTAR,
135
+ });
136
+ };
137
+ exports.defaults = defaults;
138
+ exports.minimatch.defaults = exports.defaults;
139
+ // Brace expansion:
140
+ // a{b,c}d -> abd acd
141
+ // a{b,}c -> abc ac
142
+ // a{0..3}d -> a0d a1d a2d a3d
143
+ // a{b,c{d,e}f}g -> abg acdfg acefg
144
+ // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
145
+ //
146
+ // Invalid sets are not expanded.
147
+ // a{2..}b -> a{2..}b
148
+ // a{b}c -> a{b}c
149
+ const braceExpand = (pattern, options = {}) => {
150
+ (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
151
+ // Thanks to Yeting Li <https://github.com/yetingli> for
152
+ // improving this regexp to avoid a ReDOS vulnerability.
153
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
154
+ // shortcut. no need to expand.
155
+ return [pattern];
156
+ }
157
+ return (0, brace_expansion_1.expand)(pattern);
158
+ };
159
+ exports.braceExpand = braceExpand;
160
+ exports.minimatch.braceExpand = exports.braceExpand;
161
+ // parse a component of the expanded set.
162
+ // At this point, no pattern may contain "/" in it
163
+ // so we're going to return a 2d array, where each entry is the full
164
+ // pattern, split on '/', and then turned into a regular expression.
165
+ // A regexp is made at the end which joins each array with an
166
+ // escaped /, and another full one which joins each regexp with |.
167
+ //
168
+ // Following the lead of Bash 4.1, note that "**" only has special meaning
169
+ // when it is the *only* thing in a path portion. Otherwise, any series
170
+ // of * is equivalent to a single *. Globstar behavior is enabled by
171
+ // default, and can be disabled by setting options.noglobstar.
172
+ const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
173
+ exports.makeRe = makeRe;
174
+ exports.minimatch.makeRe = exports.makeRe;
175
+ const match = (list, pattern, options = {}) => {
176
+ const mm = new Minimatch(pattern, options);
177
+ list = list.filter(f => mm.match(f));
178
+ if (mm.options.nonull && !list.length) {
179
+ list.push(pattern);
180
+ }
181
+ return list;
182
+ };
183
+ exports.match = match;
184
+ exports.minimatch.match = exports.match;
185
+ // replace stuff like \* with *
186
+ const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
187
+ const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
188
+ class Minimatch {
189
+ options;
190
+ set;
191
+ pattern;
192
+ windowsPathsNoEscape;
193
+ nonegate;
194
+ negate;
195
+ comment;
196
+ empty;
197
+ preserveMultipleSlashes;
198
+ partial;
199
+ globSet;
200
+ globParts;
201
+ nocase;
202
+ isWindows;
203
+ platform;
204
+ windowsNoMagicRoot;
205
+ regexp;
206
+ constructor(pattern, options = {}) {
207
+ (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
208
+ options = options || {};
209
+ this.options = options;
210
+ this.pattern = pattern;
211
+ this.platform = options.platform || defaultPlatform;
212
+ this.isWindows = this.platform === 'win32';
213
+ this.windowsPathsNoEscape =
214
+ !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
215
+ if (this.windowsPathsNoEscape) {
216
+ this.pattern = this.pattern.replace(/\\/g, '/');
217
+ }
218
+ this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
219
+ this.regexp = null;
220
+ this.negate = false;
221
+ this.nonegate = !!options.nonegate;
222
+ this.comment = false;
223
+ this.empty = false;
224
+ this.partial = !!options.partial;
225
+ this.nocase = !!this.options.nocase;
226
+ this.windowsNoMagicRoot =
227
+ options.windowsNoMagicRoot !== undefined
228
+ ? options.windowsNoMagicRoot
229
+ : !!(this.isWindows && this.nocase);
230
+ this.globSet = [];
231
+ this.globParts = [];
232
+ this.set = [];
233
+ // make the set of regexps etc.
234
+ this.make();
235
+ }
236
+ hasMagic() {
237
+ if (this.options.magicalBraces && this.set.length > 1) {
238
+ return true;
239
+ }
240
+ for (const pattern of this.set) {
241
+ for (const part of pattern) {
242
+ if (typeof part !== 'string')
243
+ return true;
244
+ }
245
+ }
246
+ return false;
247
+ }
248
+ debug(..._) { }
249
+ make() {
250
+ const pattern = this.pattern;
251
+ const options = this.options;
252
+ // empty patterns and comments match nothing.
253
+ if (!options.nocomment && pattern.charAt(0) === '#') {
254
+ this.comment = true;
255
+ return;
256
+ }
257
+ if (!pattern) {
258
+ this.empty = true;
259
+ return;
260
+ }
261
+ // step 1: figure out negation, etc.
262
+ this.parseNegate();
263
+ // step 2: expand braces
264
+ this.globSet = [...new Set(this.braceExpand())];
265
+ if (options.debug) {
266
+ this.debug = (...args) => console.error(...args);
267
+ }
268
+ this.debug(this.pattern, this.globSet);
269
+ // step 3: now we have a set, so turn each one into a series of
270
+ // path-portion matching patterns.
271
+ // These will be regexps, except in the case of "**", which is
272
+ // set to the GLOBSTAR object for globstar behavior,
273
+ // and will not contain any / characters
274
+ //
275
+ // First, we preprocess to make the glob pattern sets a bit simpler
276
+ // and deduped. There are some perf-killing patterns that can cause
277
+ // problems with a glob walk, but we can simplify them down a bit.
278
+ const rawGlobParts = this.globSet.map(s => this.slashSplit(s));
279
+ this.globParts = this.preprocess(rawGlobParts);
280
+ this.debug(this.pattern, this.globParts);
281
+ // glob --> regexps
282
+ let set = this.globParts.map((s, _, __) => {
283
+ if (this.isWindows && this.windowsNoMagicRoot) {
284
+ // check if it's a drive or unc path.
285
+ const isUNC = s[0] === '' &&
286
+ s[1] === '' &&
287
+ (s[2] === '?' || !globMagic.test(s[2])) &&
288
+ !globMagic.test(s[3]);
289
+ const isDrive = /^[a-z]:/i.test(s[0]);
290
+ if (isUNC) {
291
+ return [...s.slice(0, 4), ...s.slice(4).map(ss => this.parse(ss))];
292
+ }
293
+ else if (isDrive) {
294
+ return [s[0], ...s.slice(1).map(ss => this.parse(ss))];
295
+ }
296
+ }
297
+ return s.map(ss => this.parse(ss));
298
+ });
299
+ this.debug(this.pattern, set);
300
+ // filter out everything that didn't compile properly.
301
+ this.set = set.filter(s => s.indexOf(false) === -1);
302
+ // do not treat the ? in UNC paths as magic
303
+ if (this.isWindows) {
304
+ for (let i = 0; i < this.set.length; i++) {
305
+ const p = this.set[i];
306
+ if (p[0] === '' &&
307
+ p[1] === '' &&
308
+ this.globParts[i][2] === '?' &&
309
+ typeof p[3] === 'string' &&
310
+ /^[a-z]:$/i.test(p[3])) {
311
+ p[2] = '?';
312
+ }
313
+ }
314
+ }
315
+ this.debug(this.pattern, this.set);
316
+ }
317
+ // various transforms to equivalent pattern sets that are
318
+ // faster to process in a filesystem walk. The goal is to
319
+ // eliminate what we can, and push all ** patterns as far
320
+ // to the right as possible, even if it increases the number
321
+ // of patterns that we have to process.
322
+ preprocess(globParts) {
323
+ // if we're not in globstar mode, then turn all ** into *
324
+ if (this.options.noglobstar) {
325
+ for (let i = 0; i < globParts.length; i++) {
326
+ for (let j = 0; j < globParts[i].length; j++) {
327
+ if (globParts[i][j] === '**') {
328
+ globParts[i][j] = '*';
329
+ }
330
+ }
331
+ }
332
+ }
333
+ const { optimizationLevel = 1 } = this.options;
334
+ if (optimizationLevel >= 2) {
335
+ // aggressive optimization for the purpose of fs walking
336
+ globParts = this.firstPhasePreProcess(globParts);
337
+ globParts = this.secondPhasePreProcess(globParts);
338
+ }
339
+ else if (optimizationLevel >= 1) {
340
+ // just basic optimizations to remove some .. parts
341
+ globParts = this.levelOneOptimize(globParts);
342
+ }
343
+ else {
344
+ // just collapse multiple ** portions into one
345
+ globParts = this.adjascentGlobstarOptimize(globParts);
346
+ }
347
+ return globParts;
348
+ }
349
+ // just get rid of adjascent ** portions
350
+ adjascentGlobstarOptimize(globParts) {
351
+ return globParts.map(parts => {
352
+ let gs = -1;
353
+ while (-1 !== (gs = parts.indexOf('**', gs + 1))) {
354
+ let i = gs;
355
+ while (parts[i + 1] === '**') {
356
+ i++;
357
+ }
358
+ if (i !== gs) {
359
+ parts.splice(gs, i - gs);
360
+ }
361
+ }
362
+ return parts;
363
+ });
364
+ }
365
+ // get rid of adjascent ** and resolve .. portions
366
+ levelOneOptimize(globParts) {
367
+ return globParts.map(parts => {
368
+ parts = parts.reduce((set, part) => {
369
+ const prev = set[set.length - 1];
370
+ if (part === '**' && prev === '**') {
371
+ return set;
372
+ }
373
+ if (part === '..') {
374
+ if (prev && prev !== '..' && prev !== '.' && prev !== '**') {
375
+ set.pop();
376
+ return set;
377
+ }
378
+ }
379
+ set.push(part);
380
+ return set;
381
+ }, []);
382
+ return parts.length === 0 ? [''] : parts;
383
+ });
384
+ }
385
+ levelTwoFileOptimize(parts) {
386
+ if (!Array.isArray(parts)) {
387
+ parts = this.slashSplit(parts);
388
+ }
389
+ let didSomething = false;
390
+ do {
391
+ didSomething = false;
392
+ // <pre>/<e>/<rest> -> <pre>/<rest>
393
+ if (!this.preserveMultipleSlashes) {
394
+ for (let i = 1; i < parts.length - 1; i++) {
395
+ const p = parts[i];
396
+ // don't squeeze out UNC patterns
397
+ if (i === 1 && p === '' && parts[0] === '')
398
+ continue;
399
+ if (p === '.' || p === '') {
400
+ didSomething = true;
401
+ parts.splice(i, 1);
402
+ i--;
403
+ }
404
+ }
405
+ if (parts[0] === '.' &&
406
+ parts.length === 2 &&
407
+ (parts[1] === '.' || parts[1] === '')) {
408
+ didSomething = true;
409
+ parts.pop();
410
+ }
411
+ }
412
+ // <pre>/<p>/../<rest> -> <pre>/<rest>
413
+ let dd = 0;
414
+ while (-1 !== (dd = parts.indexOf('..', dd + 1))) {
415
+ const p = parts[dd - 1];
416
+ if (p && p !== '.' && p !== '..' && p !== '**') {
417
+ didSomething = true;
418
+ parts.splice(dd - 1, 2);
419
+ dd -= 2;
420
+ }
421
+ }
422
+ } while (didSomething);
423
+ return parts.length === 0 ? [''] : parts;
424
+ }
425
+ // First phase: single-pattern processing
426
+ // <pre> is 1 or more portions
427
+ // <rest> is 1 or more portions
428
+ // <p> is any portion other than ., .., '', or **
429
+ // <e> is . or ''
430
+ //
431
+ // **/.. is *brutal* for filesystem walking performance, because
432
+ // it effectively resets the recursive walk each time it occurs,
433
+ // and ** cannot be reduced out by a .. pattern part like a regexp
434
+ // or most strings (other than .., ., and '') can be.
435
+ //
436
+ // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
437
+ // <pre>/<e>/<rest> -> <pre>/<rest>
438
+ // <pre>/<p>/../<rest> -> <pre>/<rest>
439
+ // **/**/<rest> -> **/<rest>
440
+ //
441
+ // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
442
+ // this WOULD be allowed if ** did follow symlinks, or * didn't
443
+ firstPhasePreProcess(globParts) {
444
+ let didSomething = false;
445
+ do {
446
+ didSomething = false;
447
+ // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
448
+ for (let parts of globParts) {
449
+ let gs = -1;
450
+ while (-1 !== (gs = parts.indexOf('**', gs + 1))) {
451
+ let gss = gs;
452
+ while (parts[gss + 1] === '**') {
453
+ // <pre>/**/**/<rest> -> <pre>/**/<rest>
454
+ gss++;
455
+ }
456
+ // eg, if gs is 2 and gss is 4, that means we have 3 **
457
+ // parts, and can remove 2 of them.
458
+ if (gss > gs) {
459
+ parts.splice(gs + 1, gss - gs);
460
+ }
461
+ let next = parts[gs + 1];
462
+ const p = parts[gs + 2];
463
+ const p2 = parts[gs + 3];
464
+ if (next !== '..')
465
+ continue;
466
+ if (!p ||
467
+ p === '.' ||
468
+ p === '..' ||
469
+ !p2 ||
470
+ p2 === '.' ||
471
+ p2 === '..') {
472
+ continue;
473
+ }
474
+ didSomething = true;
475
+ // edit parts in place, and push the new one
476
+ parts.splice(gs, 1);
477
+ const other = parts.slice(0);
478
+ other[gs] = '**';
479
+ globParts.push(other);
480
+ gs--;
481
+ }
482
+ // <pre>/<e>/<rest> -> <pre>/<rest>
483
+ if (!this.preserveMultipleSlashes) {
484
+ for (let i = 1; i < parts.length - 1; i++) {
485
+ const p = parts[i];
486
+ // don't squeeze out UNC patterns
487
+ if (i === 1 && p === '' && parts[0] === '')
488
+ continue;
489
+ if (p === '.' || p === '') {
490
+ didSomething = true;
491
+ parts.splice(i, 1);
492
+ i--;
493
+ }
494
+ }
495
+ if (parts[0] === '.' &&
496
+ parts.length === 2 &&
497
+ (parts[1] === '.' || parts[1] === '')) {
498
+ didSomething = true;
499
+ parts.pop();
500
+ }
501
+ }
502
+ // <pre>/<p>/../<rest> -> <pre>/<rest>
503
+ let dd = 0;
504
+ while (-1 !== (dd = parts.indexOf('..', dd + 1))) {
505
+ const p = parts[dd - 1];
506
+ if (p && p !== '.' && p !== '..' && p !== '**') {
507
+ didSomething = true;
508
+ const needDot = dd === 1 && parts[dd + 1] === '**';
509
+ const splin = needDot ? ['.'] : [];
510
+ parts.splice(dd - 1, 2, ...splin);
511
+ if (parts.length === 0)
512
+ parts.push('');
513
+ dd -= 2;
514
+ }
515
+ }
516
+ }
517
+ } while (didSomething);
518
+ return globParts;
519
+ }
520
+ // second phase: multi-pattern dedupes
521
+ // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
522
+ // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
523
+ // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
524
+ //
525
+ // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
526
+ // ^-- not valid because ** doens't follow symlinks
527
+ secondPhasePreProcess(globParts) {
528
+ for (let i = 0; i < globParts.length - 1; i++) {
529
+ for (let j = i + 1; j < globParts.length; j++) {
530
+ const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
531
+ if (matched) {
532
+ globParts[i] = [];
533
+ globParts[j] = matched;
534
+ break;
535
+ }
536
+ }
537
+ }
538
+ return globParts.filter(gs => gs.length);
539
+ }
540
+ partsMatch(a, b, emptyGSMatch = false) {
541
+ let ai = 0;
542
+ let bi = 0;
543
+ let result = [];
544
+ let which = '';
545
+ while (ai < a.length && bi < b.length) {
546
+ if (a[ai] === b[bi]) {
547
+ result.push(which === 'b' ? b[bi] : a[ai]);
548
+ ai++;
549
+ bi++;
550
+ }
551
+ else if (emptyGSMatch && a[ai] === '**' && b[bi] === a[ai + 1]) {
552
+ result.push(a[ai]);
553
+ ai++;
554
+ }
555
+ else if (emptyGSMatch && b[bi] === '**' && a[ai] === b[bi + 1]) {
556
+ result.push(b[bi]);
557
+ bi++;
558
+ }
559
+ else if (a[ai] === '*' &&
560
+ b[bi] &&
561
+ (this.options.dot || !b[bi].startsWith('.')) &&
562
+ b[bi] !== '**') {
563
+ if (which === 'b')
564
+ return false;
565
+ which = 'a';
566
+ result.push(a[ai]);
567
+ ai++;
568
+ bi++;
569
+ }
570
+ else if (b[bi] === '*' &&
571
+ a[ai] &&
572
+ (this.options.dot || !a[ai].startsWith('.')) &&
573
+ a[ai] !== '**') {
574
+ if (which === 'a')
575
+ return false;
576
+ which = 'b';
577
+ result.push(b[bi]);
578
+ ai++;
579
+ bi++;
580
+ }
581
+ else {
582
+ return false;
583
+ }
584
+ }
585
+ // if we fall out of the loop, it means they two are identical
586
+ // as long as their lengths match
587
+ return a.length === b.length && result;
588
+ }
589
+ parseNegate() {
590
+ if (this.nonegate)
591
+ return;
592
+ const pattern = this.pattern;
593
+ let negate = false;
594
+ let negateOffset = 0;
595
+ for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) {
596
+ negate = !negate;
597
+ negateOffset++;
598
+ }
599
+ if (negateOffset)
600
+ this.pattern = pattern.slice(negateOffset);
601
+ this.negate = negate;
602
+ }
603
+ // set partial to true to test if, for example,
604
+ // "/a/b" matches the start of "/*/b/*/d"
605
+ // Partial means, if you run out of file before you run
606
+ // out of pattern, then that's fine, as long as all
607
+ // the parts match.
608
+ matchOne(file, pattern, partial = false) {
609
+ const options = this.options;
610
+ // UNC paths like //?/X:/... can match X:/... and vice versa
611
+ // Drive letters in absolute drive or unc paths are always compared
612
+ // case-insensitively.
613
+ if (this.isWindows) {
614
+ const fileDrive = typeof file[0] === 'string' && /^[a-z]:$/i.test(file[0]);
615
+ const fileUNC = !fileDrive &&
616
+ file[0] === '' &&
617
+ file[1] === '' &&
618
+ file[2] === '?' &&
619
+ /^[a-z]:$/i.test(file[3]);
620
+ const patternDrive = typeof pattern[0] === 'string' && /^[a-z]:$/i.test(pattern[0]);
621
+ const patternUNC = !patternDrive &&
622
+ pattern[0] === '' &&
623
+ pattern[1] === '' &&
624
+ pattern[2] === '?' &&
625
+ typeof pattern[3] === 'string' &&
626
+ /^[a-z]:$/i.test(pattern[3]);
627
+ const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined;
628
+ const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined;
629
+ if (typeof fdi === 'number' && typeof pdi === 'number') {
630
+ const [fd, pd] = [file[fdi], pattern[pdi]];
631
+ if (fd.toLowerCase() === pd.toLowerCase()) {
632
+ pattern[pdi] = fd;
633
+ if (pdi > fdi) {
634
+ pattern = pattern.slice(pdi);
635
+ }
636
+ else if (fdi > pdi) {
637
+ file = file.slice(fdi);
638
+ }
639
+ }
640
+ }
641
+ }
642
+ // resolve and reduce . and .. portions in the file as well.
643
+ // dont' need to do the second phase, because it's only one string[]
644
+ const { optimizationLevel = 1 } = this.options;
645
+ if (optimizationLevel >= 2) {
646
+ file = this.levelTwoFileOptimize(file);
647
+ }
648
+ this.debug('matchOne', this, { file, pattern });
649
+ this.debug('matchOne', file.length, pattern.length);
650
+ for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
651
+ this.debug('matchOne loop');
652
+ var p = pattern[pi];
653
+ var f = file[fi];
654
+ this.debug(pattern, p, f);
655
+ // should be impossible.
656
+ // some invalid regexp stuff in the set.
657
+ /* c8 ignore start */
658
+ if (p === false) {
659
+ return false;
660
+ }
661
+ /* c8 ignore stop */
662
+ if (p === exports.GLOBSTAR) {
663
+ this.debug('GLOBSTAR', [pattern, p, f]);
664
+ // "**"
665
+ // a/**/b/**/c would match the following:
666
+ // a/b/x/y/z/c
667
+ // a/x/y/z/b/c
668
+ // a/b/x/b/x/c
669
+ // a/b/c
670
+ // To do this, take the rest of the pattern after
671
+ // the **, and see if it would match the file remainder.
672
+ // If so, return success.
673
+ // If not, the ** "swallows" a segment, and try again.
674
+ // This is recursively awful.
675
+ //
676
+ // a/**/b/**/c matching a/b/x/y/z/c
677
+ // - a matches a
678
+ // - doublestar
679
+ // - matchOne(b/x/y/z/c, b/**/c)
680
+ // - b matches b
681
+ // - doublestar
682
+ // - matchOne(x/y/z/c, c) -> no
683
+ // - matchOne(y/z/c, c) -> no
684
+ // - matchOne(z/c, c) -> no
685
+ // - matchOne(c, c) yes, hit
686
+ var fr = fi;
687
+ var pr = pi + 1;
688
+ if (pr === pl) {
689
+ this.debug('** at the end');
690
+ // a ** at the end will just swallow the rest.
691
+ // We have found a match.
692
+ // however, it will not swallow /.x, unless
693
+ // options.dot is set.
694
+ // . and .. are *never* matched by **, for explosively
695
+ // exponential reasons.
696
+ for (; fi < fl; fi++) {
697
+ if (file[fi] === '.' ||
698
+ file[fi] === '..' ||
699
+ (!options.dot && file[fi].charAt(0) === '.'))
700
+ return false;
701
+ }
702
+ return true;
703
+ }
704
+ // ok, let's see if we can swallow whatever we can.
705
+ while (fr < fl) {
706
+ var swallowee = file[fr];
707
+ this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
708
+ // XXX remove this slice. Just pass the start index.
709
+ if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
710
+ this.debug('globstar found match!', fr, fl, swallowee);
711
+ // found a match.
712
+ return true;
713
+ }
714
+ else {
715
+ // can't swallow "." or ".." ever.
716
+ // can only swallow ".foo" when explicitly asked.
717
+ if (swallowee === '.' ||
718
+ swallowee === '..' ||
719
+ (!options.dot && swallowee.charAt(0) === '.')) {
720
+ this.debug('dot detected!', file, fr, pattern, pr);
721
+ break;
722
+ }
723
+ // ** swallows a segment, and continue.
724
+ this.debug('globstar swallow a segment, and continue');
725
+ fr++;
726
+ }
727
+ }
728
+ // no match was found.
729
+ // However, in partial mode, we can't say this is necessarily over.
730
+ /* c8 ignore start */
731
+ if (partial) {
732
+ // ran out of file
733
+ this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
734
+ if (fr === fl) {
735
+ return true;
736
+ }
737
+ }
738
+ /* c8 ignore stop */
739
+ return false;
740
+ }
741
+ // something other than **
742
+ // non-magic patterns just have to match exactly
743
+ // patterns with magic have been turned into regexps.
744
+ let hit;
745
+ if (typeof p === 'string') {
746
+ hit = f === p;
747
+ this.debug('string match', p, f, hit);
748
+ }
749
+ else {
750
+ hit = p.test(f);
751
+ this.debug('pattern match', p, f, hit);
752
+ }
753
+ if (!hit)
754
+ return false;
755
+ }
756
+ // Note: ending in / means that we'll get a final ""
757
+ // at the end of the pattern. This can only match a
758
+ // corresponding "" at the end of the file.
759
+ // If the file ends in /, then it can only match a
760
+ // a pattern that ends in /, unless the pattern just
761
+ // doesn't have any more for it. But, a/b/ should *not*
762
+ // match "a/b/*", even though "" matches against the
763
+ // [^/]*? pattern, except in partial mode, where it might
764
+ // simply not be reached yet.
765
+ // However, a/b/ should still satisfy a/*
766
+ // now either we fell off the end of the pattern, or we're done.
767
+ if (fi === fl && pi === pl) {
768
+ // ran out of pattern and filename at the same time.
769
+ // an exact hit!
770
+ return true;
771
+ }
772
+ else if (fi === fl) {
773
+ // ran out of file, but still had pattern left.
774
+ // this is ok if we're doing the match as part of
775
+ // a glob fs traversal.
776
+ return partial;
777
+ }
778
+ else if (pi === pl) {
779
+ // ran out of pattern, still have file left.
780
+ // this is only acceptable if we're on the very last
781
+ // empty segment of a file with a trailing slash.
782
+ // a/* should match a/b/
783
+ return fi === fl - 1 && file[fi] === '';
784
+ /* c8 ignore start */
785
+ }
786
+ else {
787
+ // should be unreachable.
788
+ throw new Error('wtf?');
789
+ }
790
+ /* c8 ignore stop */
791
+ }
792
+ braceExpand() {
793
+ return (0, exports.braceExpand)(this.pattern, this.options);
794
+ }
795
+ parse(pattern) {
796
+ (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
797
+ const options = this.options;
798
+ // shortcuts
799
+ if (pattern === '**')
800
+ return exports.GLOBSTAR;
801
+ if (pattern === '')
802
+ return '';
803
+ // far and away, the most common glob pattern parts are
804
+ // *, *.*, and *.<ext> Add a fast check method for those.
805
+ let m;
806
+ let fastTest = null;
807
+ if ((m = pattern.match(starRE))) {
808
+ fastTest = options.dot ? starTestDot : starTest;
809
+ }
810
+ else if ((m = pattern.match(starDotExtRE))) {
811
+ fastTest = (options.nocase
812
+ ? options.dot
813
+ ? starDotExtTestNocaseDot
814
+ : starDotExtTestNocase
815
+ : options.dot
816
+ ? starDotExtTestDot
817
+ : starDotExtTest)(m[1]);
818
+ }
819
+ else if ((m = pattern.match(qmarksRE))) {
820
+ fastTest = (options.nocase
821
+ ? options.dot
822
+ ? qmarksTestNocaseDot
823
+ : qmarksTestNocase
824
+ : options.dot
825
+ ? qmarksTestDot
826
+ : qmarksTest)(m);
827
+ }
828
+ else if ((m = pattern.match(starDotStarRE))) {
829
+ fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
830
+ }
831
+ else if ((m = pattern.match(dotStarRE))) {
832
+ fastTest = dotStarTest;
833
+ }
834
+ const re = ast_js_1.AST.fromGlob(pattern, this.options).toMMPattern();
835
+ if (fastTest && typeof re === 'object') {
836
+ // Avoids overriding in frozen environments
837
+ Reflect.defineProperty(re, 'test', { value: fastTest });
838
+ }
839
+ return re;
840
+ }
841
+ makeRe() {
842
+ if (this.regexp || this.regexp === false)
843
+ return this.regexp;
844
+ // at this point, this.set is a 2d array of partial
845
+ // pattern strings, or "**".
846
+ //
847
+ // It's better to use .match(). This function shouldn't
848
+ // be used, really, but it's pretty convenient sometimes,
849
+ // when you just want to work with a regex.
850
+ const set = this.set;
851
+ if (!set.length) {
852
+ this.regexp = false;
853
+ return this.regexp;
854
+ }
855
+ const options = this.options;
856
+ const twoStar = options.noglobstar
857
+ ? star
858
+ : options.dot
859
+ ? twoStarDot
860
+ : twoStarNoDot;
861
+ const flags = new Set(options.nocase ? ['i'] : []);
862
+ // regexpify non-globstar patterns
863
+ // if ** is only item, then we just do one twoStar
864
+ // if ** is first, and there are more, prepend (\/|twoStar\/)? to next
865
+ // if ** is last, append (\/twoStar|) to previous
866
+ // if ** is in the middle, append (\/|\/twoStar\/) to previous
867
+ // then filter out GLOBSTAR symbols
868
+ let re = set
869
+ .map(pattern => {
870
+ const pp = pattern.map(p => {
871
+ if (p instanceof RegExp) {
872
+ for (const f of p.flags.split(''))
873
+ flags.add(f);
874
+ }
875
+ return typeof p === 'string'
876
+ ? regExpEscape(p)
877
+ : p === exports.GLOBSTAR
878
+ ? exports.GLOBSTAR
879
+ : p._src;
880
+ });
881
+ pp.forEach((p, i) => {
882
+ const next = pp[i + 1];
883
+ const prev = pp[i - 1];
884
+ if (p !== exports.GLOBSTAR || prev === exports.GLOBSTAR) {
885
+ return;
886
+ }
887
+ if (prev === undefined) {
888
+ if (next !== undefined && next !== exports.GLOBSTAR) {
889
+ pp[i + 1] = '(?:\\/|' + twoStar + '\\/)?' + next;
890
+ }
891
+ else {
892
+ pp[i] = twoStar;
893
+ }
894
+ }
895
+ else if (next === undefined) {
896
+ pp[i - 1] = prev + '(?:\\/|' + twoStar + ')?';
897
+ }
898
+ else if (next !== exports.GLOBSTAR) {
899
+ pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next;
900
+ pp[i + 1] = exports.GLOBSTAR;
901
+ }
902
+ });
903
+ return pp.filter(p => p !== exports.GLOBSTAR).join('/');
904
+ })
905
+ .join('|');
906
+ // need to wrap in parens if we had more than one thing with |,
907
+ // otherwise only the first will be anchored to ^ and the last to $
908
+ const [open, close] = set.length > 1 ? ['(?:', ')'] : ['', ''];
909
+ // must match entire pattern
910
+ // ending in a * or ** will make it less strict.
911
+ re = '^' + open + re + close + '$';
912
+ // can match anything, as long as it's not this.
913
+ if (this.negate)
914
+ re = '^(?!' + re + ').+$';
915
+ try {
916
+ this.regexp = new RegExp(re, [...flags].join(''));
917
+ /* c8 ignore start */
918
+ }
919
+ catch (ex) {
920
+ // should be impossible
921
+ this.regexp = false;
922
+ }
923
+ /* c8 ignore stop */
924
+ return this.regexp;
925
+ }
926
+ slashSplit(p) {
927
+ // if p starts with // on windows, we preserve that
928
+ // so that UNC paths aren't broken. Otherwise, any number of
929
+ // / characters are coalesced into one, unless
930
+ // preserveMultipleSlashes is set to true.
931
+ if (this.preserveMultipleSlashes) {
932
+ return p.split('/');
933
+ }
934
+ else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
935
+ // add an extra '' for the one we lose
936
+ return ['', ...p.split(/\/+/)];
937
+ }
938
+ else {
939
+ return p.split(/\/+/);
940
+ }
941
+ }
942
+ match(f, partial = this.partial) {
943
+ this.debug('match', f, this.pattern);
944
+ // short-circuit in the case of busted things.
945
+ // comments, etc.
946
+ if (this.comment) {
947
+ return false;
948
+ }
949
+ if (this.empty) {
950
+ return f === '';
951
+ }
952
+ if (f === '/' && partial) {
953
+ return true;
954
+ }
955
+ const options = this.options;
956
+ // windows: need to use /, not \
957
+ if (this.isWindows) {
958
+ f = f.split('\\').join('/');
959
+ }
960
+ // treat the test path as a set of pathparts.
961
+ const ff = this.slashSplit(f);
962
+ this.debug(this.pattern, 'split', ff);
963
+ // just ONE of the pattern sets in this.set needs to match
964
+ // in order for it to be valid. If negating, then just one
965
+ // match means that we have failed.
966
+ // Either way, return on the first hit.
967
+ const set = this.set;
968
+ this.debug(this.pattern, 'set', set);
969
+ // Find the basename of the path by looking for the last non-empty segment
970
+ let filename = ff[ff.length - 1];
971
+ if (!filename) {
972
+ for (let i = ff.length - 2; !filename && i >= 0; i--) {
973
+ filename = ff[i];
974
+ }
975
+ }
976
+ for (let i = 0; i < set.length; i++) {
977
+ const pattern = set[i];
978
+ let file = ff;
979
+ if (options.matchBase && pattern.length === 1) {
980
+ file = [filename];
981
+ }
982
+ const hit = this.matchOne(file, pattern, partial);
983
+ if (hit) {
984
+ if (options.flipNegate) {
985
+ return true;
986
+ }
987
+ return !this.negate;
988
+ }
989
+ }
990
+ // didn't get any hits. this is success if it's a negative
991
+ // pattern, failure otherwise.
992
+ if (options.flipNegate) {
993
+ return false;
994
+ }
995
+ return this.negate;
996
+ }
997
+ static defaults(def) {
998
+ return exports.minimatch.defaults(def).Minimatch;
999
+ }
1000
+ }
1001
+ exports.Minimatch = Minimatch;
1002
+ /* c8 ignore start */
1003
+ var ast_js_2 = require("./ast.js");
1004
+ Object.defineProperty(exports, "AST", { enumerable: true, get: function () { return ast_js_2.AST; } });
1005
+ var escape_js_2 = require("./escape.js");
1006
+ Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return escape_js_2.escape; } });
1007
+ var unescape_js_2 = require("./unescape.js");
1008
+ Object.defineProperty(exports, "unescape", { enumerable: true, get: function () { return unescape_js_2.unescape; } });
1009
+ /* c8 ignore stop */
1010
+ exports.minimatch.AST = ast_js_1.AST;
1011
+ exports.minimatch.Minimatch = Minimatch;
1012
+ exports.minimatch.escape = escape_js_1.escape;
1013
+ exports.minimatch.unescape = unescape_js_1.unescape;
1014
+ //# sourceMappingURL=index.js.map
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/minimatch/dist/commonjs/unescape.d.ts ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { MinimatchOptions } from './index.js';
2
+ /**
3
+ * Un-escape a string that has been escaped with {@link escape}.
4
+ *
5
+ * If the {@link windowsPathsNoEscape} option is used, then square-brace
6
+ * escapes are removed, but not backslash escapes. For example, it will turn
7
+ * the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
8
+ * becuase `\` is a path separator in `windowsPathsNoEscape` mode.
9
+ *
10
+ * When `windowsPathsNoEscape` is not set, then both brace escapes and
11
+ * backslash escapes are removed.
12
+ *
13
+ * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
14
+ * or unescaped.
15
+ */
16
+ export declare const unescape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
17
+ //# sourceMappingURL=unescape.d.ts.map