@frontmcp/utils 1.11.3 → 1.12.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 (36) hide show
  1. package/README.md +4 -2
  2. package/browser/crypto/index.mjs +25 -1
  3. package/browser/crypto/standard-webhooks.mjs +96 -0
  4. package/browser/fs/index.mjs +3 -0
  5. package/browser/fs/watch-files.mjs +177 -0
  6. package/browser/index.mjs +45 -2
  7. package/browser/net/index.mjs +15 -2
  8. package/browser/net/ip-address.mjs +30 -0
  9. package/browser/net/outbound-request.mjs +190 -0
  10. package/browser/net/outbound-url.mjs +43 -0
  11. package/browser/serialization/canonical-json.mjs +35 -0
  12. package/browser/serialization/index.mjs +2 -0
  13. package/browser/stdio-bridge/claude-code-channels.mjs +73 -0
  14. package/browser/stdio-bridge/notification-stream.mjs +111 -0
  15. package/browser/stdio-bridge/sse-frames.mjs +48 -0
  16. package/browser/stdio-bridge/upstream-client.mjs +89 -37
  17. package/crypto/index.d.ts +1 -0
  18. package/crypto/standard-webhooks.d.ts +35 -0
  19. package/env/browser-runtime-context.d.ts +1 -1
  20. package/env/runtime-context.d.ts +1 -1
  21. package/esm/index.mjs +1 -1
  22. package/fs/index.d.ts +2 -0
  23. package/fs/watch-files.d.ts +22 -0
  24. package/index.d.ts +6 -6
  25. package/index.js +1 -1
  26. package/net/index.d.ts +5 -1
  27. package/net/ip-address.d.ts +2 -0
  28. package/net/outbound-request.d.ts +46 -0
  29. package/net/outbound-url.d.ts +18 -0
  30. package/package.json +2 -2
  31. package/serialization/canonical-json.d.ts +2 -0
  32. package/serialization/index.d.ts +1 -0
  33. package/stdio-bridge/claude-code-channels.d.ts +28 -0
  34. package/stdio-bridge/notification-stream.d.ts +29 -0
  35. package/stdio-bridge/sse-frames.d.ts +8 -0
  36. package/stdio-bridge/upstream-client.d.ts +13 -0
package/fs/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export { readFile, readFileSync, readFileBuffer, writeFile, appendFile, mkdir, rename, unlink, stat, lstat, chmod, copyFile, cp, readdir, readdirSync, realpath, rm, mkdtemp, symlink, access, fileExists, fileExistsSync, readJSON, writeJSON, ensureDir, ensureDirSync, isDirEmpty, runCmd, watchFile, getSpawnFn, } from './fs';
2
2
  export type { FileWatcherHandle, SymlinkType } from './fs';
3
+ export { watchFiles, WATCH_FILES_RETRY_MS } from './watch-files';
4
+ export type { FileWatchEvent, FileWatchEventType, WatchFilesOptions } from './watch-files';
@@ -0,0 +1,22 @@
1
+ /** What happened to a watched file: it appeared, its content changed, or it is gone. */
2
+ export type FileWatchEventType = 'add' | 'change' | 'unlink';
3
+ export interface FileWatchEvent {
4
+ type: FileWatchEventType;
5
+ /** The absolute path of the file. */
6
+ path: string;
7
+ }
8
+ export interface WatchFilesOptions {
9
+ /** The kinds of event to yield. @default every kind */
10
+ events?: FileWatchEventType[];
11
+ /** How long a watched path must stay quiet before its changes are yielded, in milliseconds. @default 100 */
12
+ debounceMs?: number;
13
+ /** Ends the iteration and closes the watchers when it aborts. */
14
+ signal?: AbortSignal;
15
+ }
16
+ /** How often a path that cannot be read, or watched for want of a directory to watch, is looked at again. */
17
+ export declare const WATCH_FILES_RETRY_MS = 500;
18
+ /**
19
+ * Watch files and directories, and yield what happens to their files, until `signal` aborts or the loop is left. A
20
+ * directory is watched for its direct files; a path that does not exist yet, from the moment it appears. Node.js only.
21
+ */
22
+ export declare function watchFiles(paths: string | string[], options?: WatchFilesOptions): AsyncGenerator<FileWatchEvent, void, undefined>;
package/index.d.ts CHANGED
@@ -13,10 +13,10 @@ export { trimSlashes, joinPath, pathResolve, pathJoin, basename, dirname, extnam
13
13
  export { sanitizeToJson, inferMimeType, findNonFiniteNumber, findDroppedKeys } from './content';
14
14
  export { validateBaseUrl, buildSetCookie, parseCookies, getCookie, isLocalhost, isSecureRequest } from './http';
15
15
  export type { CookieOptions, SecureDetectionRequest } from './http';
16
- export { classifyIpAddress, expandIpv6, extractEmbeddedIpv4, parseIpv4, isRedirectResponse } from './net';
17
- export type { IpAddressClassification, IpAddressRange, SpecialPurposeIpRange, RedirectCandidate } from './net';
18
- export { readFile, readFileSync, readFileBuffer, writeFile, appendFile, mkdir, rename, unlink, stat, lstat, chmod, copyFile, cp, readdir, readdirSync, realpath, rm, mkdtemp, symlink, access, fileExists, fileExistsSync, readJSON, writeJSON, ensureDir, ensureDirSync, isDirEmpty, runCmd, watchFile, getSpawnFn, } from './fs';
19
- export type { FileWatcherHandle } from './fs';
16
+ export { classifyIpAddress, expandIpv6, extractEmbeddedIpv4, isGloballyRoutableIp, parseIpv4, isRedirectResponse, validateOutboundUrl, sendOutboundRequest, outboundFailureCategory, OUTBOUND_TIMEOUT_MS, OUTBOUND_MAX_REQUEST_BYTES, } from './net';
17
+ export type { IpAddressClassification, IpAddressRange, SpecialPurposeIpRange, RedirectCandidate, OutboundTargetOptions, OutboundUrlCheck, OutboundUrlProblem, OutboundRequest, OutboundAnswer, OutboundFailure, OutboundFailureReason, OutboundFailureCategory, OutboundResult, } from './net';
18
+ export { readFile, readFileSync, readFileBuffer, writeFile, appendFile, mkdir, rename, unlink, stat, lstat, chmod, copyFile, cp, readdir, readdirSync, realpath, rm, mkdtemp, symlink, access, fileExists, fileExistsSync, readJSON, writeJSON, ensureDir, ensureDirSync, isDirEmpty, runCmd, watchFile, watchFiles, getSpawnFn, } from './fs';
19
+ export type { FileWatcherHandle, FileWatchEvent, FileWatchEventType, WatchFilesOptions } from './fs';
20
20
  export { processTreeSpawnOptions, signalProcessTree, isProcessTreeAlive, stopProcessTree, spawnOwned, reapOrphans, OwnedProcessError, watchParent, watchPath, } from './process';
21
21
  export type { ProcessTreeDeps, SpawnOwnedOptions, OwnedProcess, ReapOrphansOptions, ParentGoneReason, ProcessWatcher, WatchParentOptions, WatchPathOptions, } from './process';
22
22
  export { DEV_BUFFER_FULL, DEV_ERROR_MESSAGE, DEV_RELOAD_DEADLINE, DEV_SERVER_UNREACHABLE, makeDevError, listChangedNotifications, createBridgeStateMachine, createStdioFramer, createHttpUpstream, createPipeUpstream, } from './stdio-bridge';
@@ -25,8 +25,8 @@ export { redactFields, redactJson } from './redaction';
25
25
  export type { RedactedFields } from './redaction';
26
26
  export { escapeHtml, escapeHtmlAttr, escapeJsString, escapeScriptClose, safeJsonForScript } from './escape';
27
27
  export { brandClass, isBrandedInstance } from './class-brand';
28
- export { safeStringify } from './serialization';
29
- export { getCrypto, rsaVerify, rsaVerifySync, pemToPublicJwk, generateRsaKeyPair, rsaSignBase64Url, type RsaJwk, type RsaKeyPair, jwtAlgToNodeAlg, isRsaPssAlg, randomUUID, randomBytes, sha256, sha256Hex, sha256Base64url, hmacSha256, hkdfSha256, encryptAesGcm, decryptAesGcm, timingSafeEqual, bytesToHex, base64urlEncode, base64urlDecode, base64Encode, base64Decode, isNode, isBrowser, assertNode, EncryptedBlobError, encryptValue, decryptValue, tryDecryptValue, serializeBlob, deserializeBlob, tryDeserializeBlob, isValidEncryptedBlob, encryptAndSerialize, deserializeAndDecrypt, tryDeserializeAndDecrypt, generateCodeVerifier, generateCodeChallenge, verifyCodeChallenge, generatePkcePair, isValidCodeVerifier, isValidCodeChallenge, MIN_CODE_VERIFIER_LENGTH, MAX_CODE_VERIFIER_LENGTH, DEFAULT_CODE_VERIFIER_LENGTH, PkceError, type PkcePair, type SecretData, type SecretPersistenceOptions, type SecretValidationResult, secretDataSchema, validateSecretData, parseSecretData, isSecretPersistenceEnabled, resolveSecretPath, loadSecret, saveSecret, deleteSecret, generateSecret, createSecretData, getOrCreateSecret, clearCachedSecret, isSecretCached, type SignedData, type HmacSigningConfig, signData, verifyData, isSignedData, verifyOrParseData, type BaseKeyData, type SecretKeyData, type AsymmetricKeyData, type AnyKeyData, type KeyPersistenceOptions, type CreateKeyPersistenceOptions, type CreateSecretOptions, type CreateAsymmetricOptions, type KeyValidationResult, asymmetricAlgSchema, secretKeyDataSchema, asymmetricKeyDataSchema, anyKeyDataSchema, validateKeyData, parseKeyData, isSecretKeyData, isAsymmetricKeyData, KeyPersistence, createKeyPersistence, createKeyPersistenceWithStorage, } from './crypto';
28
+ export { safeStringify, canonicalJson } from './serialization';
29
+ export { getCrypto, rsaVerify, rsaVerifySync, pemToPublicJwk, generateRsaKeyPair, rsaSignBase64Url, type RsaJwk, type RsaKeyPair, jwtAlgToNodeAlg, isRsaPssAlg, randomUUID, randomBytes, sha256, sha256Hex, sha256Base64url, hmacSha256, hkdfSha256, encryptAesGcm, decryptAesGcm, timingSafeEqual, bytesToHex, base64urlEncode, base64urlDecode, base64Encode, base64Decode, isNode, isBrowser, assertNode, EncryptedBlobError, encryptValue, decryptValue, tryDecryptValue, serializeBlob, deserializeBlob, tryDeserializeBlob, isValidEncryptedBlob, encryptAndSerialize, deserializeAndDecrypt, tryDeserializeAndDecrypt, generateCodeVerifier, generateCodeChallenge, verifyCodeChallenge, generatePkcePair, isValidCodeVerifier, isValidCodeChallenge, MIN_CODE_VERIFIER_LENGTH, MAX_CODE_VERIFIER_LENGTH, DEFAULT_CODE_VERIFIER_LENGTH, PkceError, type PkcePair, type SecretData, type SecretPersistenceOptions, type SecretValidationResult, secretDataSchema, validateSecretData, parseSecretData, isSecretPersistenceEnabled, resolveSecretPath, loadSecret, saveSecret, deleteSecret, generateSecret, createSecretData, getOrCreateSecret, clearCachedSecret, isSecretCached, type SignedData, type HmacSigningConfig, signData, verifyData, isSignedData, verifyOrParseData, WEBHOOK_ID_HEADER, WEBHOOK_TIMESTAMP_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, signingKeyOf, isStandardWebhookSecret, generateStandardWebhookSecret, generateWebhookMessageId, signWebhookMessage, webhookSignatureHeaders, verifyWebhookSignature, type WebhookMessage, type SignedWebhookMessage, type WebhookSignatureCheck, type BaseKeyData, type SecretKeyData, type AsymmetricKeyData, type AnyKeyData, type KeyPersistenceOptions, type CreateKeyPersistenceOptions, type CreateSecretOptions, type CreateAsymmetricOptions, type KeyValidationResult, asymmetricAlgSchema, secretKeyDataSchema, asymmetricKeyDataSchema, anyKeyDataSchema, validateKeyData, parseKeyData, isSecretKeyData, isAsymmetricKeyData, KeyPersistence, createKeyPersistence, createKeyPersistenceWithStorage, } from './crypto';
30
30
  export type { CryptoProvider, EncBlob, EncryptedBlob } from './crypto';
31
31
  export { AsyncContextOverlapError, AsyncLocalStorage, awaitOutsideRequest, getAsyncContextMode, runRequestExclusive, type AsyncContextMode, } from './async-context';
32
32
  export { EventEmitter } from './event-emitter';