@frontmcp/utils 1.8.6 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/env/browser-env.d.ts +1 -0
  2. package/env/browser-env.js +5 -0
  3. package/env/browser-runtime-context.d.ts +2 -1
  4. package/env/browser-runtime-context.js +104 -0
  5. package/env/index.d.ts +1 -1
  6. package/env/node-env.d.ts +11 -0
  7. package/env/node-env.js +8 -2
  8. package/env/runtime-context.d.ts +12 -5
  9. package/env/runtime-context.js +192 -0
  10. package/esm/async-context/browser-async-context.mjs +3 -2
  11. package/esm/async-context/node-async-context.mjs +3 -2
  12. package/esm/crypto/browser.mjs +3 -2
  13. package/esm/crypto/node.mjs +3 -2
  14. package/esm/env/browser-env.mjs +7 -2
  15. package/esm/env/browser-runtime-context.mjs +77 -0
  16. package/esm/env/node-env.mjs +10 -4
  17. package/esm/env/runtime-context.mjs +172 -0
  18. package/esm/event-emitter/browser-event-emitter.mjs +3 -2
  19. package/esm/event-emitter/node-event-emitter.mjs +3 -2
  20. package/esm/index.mjs +251 -250
  21. package/esm/path/browser-path.mjs +50 -0
  22. package/esm/path/node-path.mjs +16 -0
  23. package/index.d.ts +3 -3
  24. package/index.js +261 -274
  25. package/package.json +26 -8
  26. package/path/browser-path.js +79 -0
  27. package/path/node-path.js +45 -0
  28. package/storage/adapters/base.d.ts +6 -1
  29. package/storage/adapters/cloudflare-kv.d.ts +1 -0
  30. package/storage/adapters/index.d.ts +2 -1
  31. package/storage/adapters/memory.d.ts +2 -1
  32. package/storage/adapters/redis.d.ts +19 -0
  33. package/storage/adapters/upstash.d.ts +2 -1
  34. package/storage/adapters/vercel-kv.d.ts +2 -1
  35. package/storage/index.d.ts +4 -2
  36. package/storage/namespace.d.ts +2 -1
  37. package/storage/redis-error-listener.d.ts +27 -0
  38. package/storage/types.d.ts +11 -0
  39. package/storage/utils/compare-and-delete.d.ts +2 -0
@@ -0,0 +1,50 @@
1
+ var __frontmcpModule = typeof process !== "undefined" && typeof process.getBuiltinModule === "function" ? process.getBuiltinModule("module") : undefined;
2
+ const require = __frontmcpModule ? __frontmcpModule.createRequire(import.meta.url || 'file:///') : undefined;
3
+ // __frontmcpCreateRequire
4
+ // libs/utils/src/path/browser-path.ts
5
+ function notAvailable(name) {
6
+ throw new Error(`path.${name}() is not available in browser environments`);
7
+ }
8
+ function resolve(..._segments) {
9
+ return notAvailable("resolve");
10
+ }
11
+ function join(..._segments) {
12
+ return notAvailable("join");
13
+ }
14
+ function basename(p, ext) {
15
+ const trimmed = p.replace(/[/\\]+$/, "");
16
+ const lastSep = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
17
+ let base = lastSep >= 0 ? trimmed.slice(lastSep + 1) : trimmed;
18
+ if (ext && base.endsWith(ext)) {
19
+ base = base.slice(0, -ext.length);
20
+ }
21
+ return base;
22
+ }
23
+ function dirname(_p) {
24
+ return notAvailable("dirname");
25
+ }
26
+ function extname(p) {
27
+ const base = basename(p);
28
+ const dotIndex = base.lastIndexOf(".");
29
+ return dotIndex > 0 ? base.slice(dotIndex) : "";
30
+ }
31
+ function isAbsolute(p) {
32
+ if (!p) return false;
33
+ if (p.startsWith("/") || p.startsWith("\\")) return true;
34
+ if (/^[A-Za-z]:[\\/]/.test(p)) return true;
35
+ return false;
36
+ }
37
+ function pathToFileURL(_p) {
38
+ return notAvailable("pathToFileURL");
39
+ }
40
+ var sep = "/";
41
+ export {
42
+ basename,
43
+ dirname,
44
+ extname,
45
+ isAbsolute,
46
+ join,
47
+ pathToFileURL,
48
+ resolve,
49
+ sep
50
+ };
@@ -0,0 +1,16 @@
1
+ var __frontmcpModule = typeof process !== "undefined" && typeof process.getBuiltinModule === "function" ? process.getBuiltinModule("module") : undefined;
2
+ const require = __frontmcpModule ? __frontmcpModule.createRequire(import.meta.url || 'file:///') : undefined;
3
+ // __frontmcpCreateRequire
4
+ // libs/utils/src/path/node-path.ts
5
+ import { resolve, join, basename, dirname, extname, isAbsolute, sep } from "path";
6
+ import { pathToFileURL } from "url";
7
+ export {
8
+ basename,
9
+ dirname,
10
+ extname,
11
+ isAbsolute,
12
+ join,
13
+ pathToFileURL,
14
+ resolve,
15
+ sep
16
+ };
package/index.d.ts CHANGED
@@ -23,11 +23,11 @@ export { getCrypto, rsaVerify, rsaVerifySync, pemToPublicJwk, generateRsaKeyPair
23
23
  export type { CryptoProvider, EncBlob, EncryptedBlob } from './crypto';
24
24
  export { AsyncContextOverlapError, AsyncLocalStorage, awaitOutsideRequest, getAsyncContextMode, runRequestExclusive, type AsyncContextMode, } from './async-context';
25
25
  export { EventEmitter } from './event-emitter';
26
- export { getEnv, getCwd, isProduction, isDevelopment, getEnvFlag, isDebug, setEnv, isEdgeRuntime, isServerless, supportsAnsi, getRuntimeContext, resetRuntimeContext, detectRuntimeContext, isEntryAvailable, checkEntryAvailability, entryAvailabilitySchema, } from './env';
26
+ export { getEnv, getNodeEnv, getCwd, isProduction, isDevelopment, getEnvFlag, isDebug, setEnv, isEdgeRuntime, isServerless, supportsAnsi, getRuntimeContext, resetRuntimeContext, detectRuntimeContext, isEntryAvailable, checkEntryAvailability, entryAvailabilitySchema, } from './env';
27
27
  export type { RuntimeContext, EntryAvailability } from './env';
28
28
  export { analyzePattern, isPatternSafe, createSafeRegExp, safeTest, safeMatch, safeReplace, safeExec, isInputLengthSafe, DEFAULT_MAX_INPUT_LENGTH, REDOS_THRESHOLDS, trimLeading, trimTrailing, trimBoth, trimChars, extractBracedParams, expandTemplate, hasTemplatePlaceholders, collapseChar, collapseWhitespace, type SafeRegexOptions, type PatternAnalysisResult, } from './regex';
29
- export { createStorage, createMemoryStorage, getDetectedStorageType, NamespacedStorageImpl, createRootStorage, createNamespacedStorage, buildPrefix, NAMESPACE_SEPARATOR, StorageError, StorageConnectionError, StorageOperationError, StorageNotSupportedError, StorageConfigError, StorageTTLError, StoragePatternError, StorageNotConnectedError, EncryptedStorageError, BaseStorageAdapter, MemoryStorageAdapter, RedisStorageAdapter, VercelKvStorageAdapter, UpstashStorageAdapter, FileSystemStorageAdapter, type FileSystemAdapterOptions, TypedStorage, type TypedStorageOptions, type TypedSetOptions, type TypedSetEntry, EncryptedTypedStorage, type EncryptedTypedStorageOptions, type EncryptedSetOptions, type EncryptedSetEntry, type EncryptionKey, type StoredEncryptedBlob, type ClientKeyBinding, globToRegex, matchesPattern, validatePattern, escapeGlob, MAX_TTL_SECONDS, validateTTL, validateOptionalTTL, ttlToExpiresAt, expiresAtToTTL, isExpired, normalizeTTL, } from './storage';
30
- export type { StorageAdapter, NamespacedStorage, RootStorage, SetOptions, SetEntry, MessageHandler, Unsubscribe, MemoryAdapterOptions, RedisAdapterOptions, VercelKvAdapterOptions, UpstashAdapterOptions, StorageType, StorageConfig, } from './storage';
29
+ export { createStorage, createMemoryStorage, getDetectedStorageType, NamespacedStorageImpl, createRootStorage, createNamespacedStorage, buildPrefix, NAMESPACE_SEPARATOR, StorageError, StorageConnectionError, StorageOperationError, StorageNotSupportedError, StorageConfigError, StorageTTLError, StoragePatternError, StorageNotConnectedError, EncryptedStorageError, BaseStorageAdapter, MemoryStorageAdapter, RedisStorageAdapter, createRedisClient, VercelKvStorageAdapter, UpstashStorageAdapter, FileSystemStorageAdapter, type FileSystemAdapterOptions, TypedStorage, type TypedStorageOptions, type TypedSetOptions, type TypedSetEntry, EncryptedTypedStorage, type EncryptedTypedStorageOptions, type EncryptedSetOptions, type EncryptedSetEntry, type EncryptionKey, type StoredEncryptedBlob, type ClientKeyBinding, globToRegex, matchesPattern, validatePattern, escapeGlob, MAX_TTL_SECONDS, validateTTL, validateOptionalTTL, ttlToExpiresAt, expiresAtToTTL, isExpired, normalizeTTL, attachRedisErrorListener, DEFAULT_REDIS_ERROR_LOG_INTERVAL_MS, } from './storage';
30
+ export type { StorageAdapter, NamespacedStorage, RootStorage, SetOptions, SetEntry, MessageHandler, Unsubscribe, MemoryAdapterOptions, RedisAdapterOptions, VercelKvAdapterOptions, UpstashAdapterOptions, StorageType, StorageConfig, RedisErrorListenerOptions, CreateRedisClientOptions, ErrorEmitterClient, } from './storage';
31
31
  export { processPlatformToolCalls } from './llm';
32
32
  export type { CallToolFn, OpenAIToolCallItem, OpenAIToolResponse, ClaudeToolUseBlock, ClaudeToolResultBlock, VercelToolCallInfo, PlatformToolCallsInput, PlatformToolCallsOutput, SupportedPlatform, } from './llm';
33
33
  export { getMachineId, setMachineIdOverride } from './machine-id';