@nestm/storage 0.1.0-alpha.6 → 0.1.0-alpha.7

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 (67) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +182 -2
  3. package/SECURITY.md +40 -0
  4. package/dist/ai-sdk/ai-sdk-workspace-tools.d.ts +63 -0
  5. package/dist/ai-sdk/ai-sdk-workspace-tools.d.ts.map +1 -0
  6. package/dist/ai-sdk/ai-sdk-workspace-tools.js +383 -0
  7. package/dist/ai-sdk/ai-sdk-workspace-tools.js.map +1 -0
  8. package/dist/ai-sdk/index.d.ts +2 -0
  9. package/dist/ai-sdk/index.d.ts.map +1 -0
  10. package/dist/ai-sdk/index.js +2 -0
  11. package/dist/ai-sdk/index.js.map +1 -0
  12. package/dist/files-sdk/files-sdk.driver.d.ts +16 -2
  13. package/dist/files-sdk/files-sdk.driver.d.ts.map +1 -1
  14. package/dist/files-sdk/files-sdk.driver.js +159 -0
  15. package/dist/files-sdk/files-sdk.driver.js.map +1 -1
  16. package/dist/files-sdk/fs/index.d.ts +21 -2
  17. package/dist/files-sdk/fs/index.d.ts.map +1 -1
  18. package/dist/files-sdk/fs/index.js +600 -1
  19. package/dist/files-sdk/fs/index.js.map +1 -1
  20. package/dist/files-sdk/index.d.ts +1 -1
  21. package/dist/files-sdk/index.d.ts.map +1 -1
  22. package/dist/files-sdk/index.js.map +1 -1
  23. package/dist/files-sdk/provider/index.d.ts.map +1 -1
  24. package/dist/files-sdk/provider/index.js +7 -0
  25. package/dist/files-sdk/provider/index.js.map +1 -1
  26. package/dist/files-sdk/s3/index.d.ts +12 -3
  27. package/dist/files-sdk/s3/index.d.ts.map +1 -1
  28. package/dist/files-sdk/s3/index.js +203 -37
  29. package/dist/files-sdk/s3/index.js.map +1 -1
  30. package/dist/storage.client.d.ts +5 -1
  31. package/dist/storage.client.d.ts.map +1 -1
  32. package/dist/storage.client.js +49 -0
  33. package/dist/storage.client.js.map +1 -1
  34. package/dist/storage.driver.d.ts +3 -1
  35. package/dist/storage.driver.d.ts.map +1 -1
  36. package/dist/storage.driver.js.map +1 -1
  37. package/dist/storage.service.d.ts.map +1 -1
  38. package/dist/storage.service.js +28 -3
  39. package/dist/storage.service.js.map +1 -1
  40. package/dist/storage.types.d.ts +36 -0
  41. package/dist/storage.types.d.ts.map +1 -1
  42. package/dist/storage.types.js.map +1 -1
  43. package/dist/workspace/index.d.ts +4 -0
  44. package/dist/workspace/index.d.ts.map +1 -0
  45. package/dist/workspace/index.js +4 -0
  46. package/dist/workspace/index.js.map +1 -0
  47. package/dist/workspace/storage-workspace.cursor.d.ts +6 -0
  48. package/dist/workspace/storage-workspace.cursor.d.ts.map +1 -0
  49. package/dist/workspace/storage-workspace.cursor.js +45 -0
  50. package/dist/workspace/storage-workspace.cursor.js.map +1 -0
  51. package/dist/workspace/storage-workspace.d.ts +6 -0
  52. package/dist/workspace/storage-workspace.d.ts.map +1 -0
  53. package/dist/workspace/storage-workspace.error.d.ts +28 -0
  54. package/dist/workspace/storage-workspace.error.d.ts.map +1 -0
  55. package/dist/workspace/storage-workspace.error.js +67 -0
  56. package/dist/workspace/storage-workspace.error.js.map +1 -0
  57. package/dist/workspace/storage-workspace.js +747 -0
  58. package/dist/workspace/storage-workspace.js.map +1 -0
  59. package/dist/workspace/storage-workspace.path.d.ts +9 -0
  60. package/dist/workspace/storage-workspace.path.d.ts.map +1 -0
  61. package/dist/workspace/storage-workspace.path.js +68 -0
  62. package/dist/workspace/storage-workspace.path.js.map +1 -0
  63. package/dist/workspace/storage-workspace.types.d.ts +97 -0
  64. package/dist/workspace/storage-workspace.types.d.ts.map +1 -0
  65. package/dist/workspace/storage-workspace.types.js +20 -0
  66. package/dist/workspace/storage-workspace.types.js.map +1 -0
  67. package/package.json +23 -4
@@ -1 +1 @@
1
- {"version":3,"file":"storage.types.d.ts","sourceRoot":"","sources":["../src/storage.types.ts"],"names":[],"mappings":"AAAA,OAAO,K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js","sourceRoot":"","sources":["../src/storage.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Readable } from 'node:stream';\n\nimport type { StorageError } from './storage.error.js';\nimport type { StorageUploadControl } from './storage-upload-control.js';\n\nexport type StorageBody =\n | Blob\n | File\n | ReadableStream<Uint8Array>\n | Readable\n | ArrayBuffer\n | ArrayBufferView\n | Uint8Array\n | string;\n\nexport interface StorageRetryContext {\n attempt: number;\n error: StorageError;\n}\n\nexport type StorageRetryOptions =\n | number\n | {\n max: number;\n backoff?: (context: StorageRetryContext) => number;\n };\n\nexport interface StorageOperationOptions {\n signal?: AbortSignal;\n timeout?: number;\n retries?: StorageRetryOptions;\n}\n\n/**\n * Preconditions for promoting a staged object to its final key. At least one\n * source identity must be supplied; unsupported identities fail closed.\n */\nexport interface StoragePromotionOptions extends StorageOperationOptions {\n /** Copy only the source object whose provider ETag exactly matches. */\n sourceEtag?: string;\n /** Copy this immutable provider version of the source object. */\n sourceVersion?: string;\n}\n\nexport interface StorageMultipartOptions {\n partSize?: number;\n concurrency?: number;\n}\n\nexport interface StorageUploadProgress {\n loaded: number;\n total?: number;\n}\n\nexport interface StorageUploadOptions extends StorageOperationOptions {\n contentType?: string;\n cacheControl?: string;\n metadata?: Record<string, string>;\n onProgress?: (progress: StorageUploadProgress) => void;\n multipart?: boolean | StorageMultipartOptions;\n control?: StorageUploadControl;\n}\n\nexport interface StorageUploadResult {\n key: string;\n size: number;\n contentType: string;\n etag?: string;\n lastModified?: Date;\n}\n\nexport interface StorageObjectMetadata {\n key: string;\n name: string;\n size: number;\n contentType: string;\n etag?: string;\n lastModified?: Date;\n metadata?: Record<string, string>;\n}\n\nexport interface StorageObject extends StorageObjectMetadata {\n body: ReadableStream<Uint8Array>;\n}\n\nexport interface StorageByteRange {\n start: number;\n end?: number;\n}\n\nexport interface StorageDownloadOptions extends StorageOperationOptions {\n range?: StorageByteRange;\n}\n\nexport interface StorageBufferedDownloadOptions extends StorageDownloadOptions {\n /**\n * Maximum number of bytes buffered in memory. Defaults to 10 MiB.\n * Pass `Infinity` only when the caller has independently bounded the object.\n */\n maxBytes?: number;\n}\n\nexport interface StorageListOptions extends StorageOperationOptions {\n prefix?: string;\n cursor?: string;\n limit?: number;\n delimiter?: string;\n}\n\nexport interface StorageListResult {\n items: StorageObjectMetadata[];\n prefixes?: string[];\n cursor?: string;\n}\n\nexport type StorageSearchMatch = 'glob' | 'regex' | 'substring' | 'exact';\n\nexport interface StorageSearchOptions extends StorageOperationOptions {\n prefix?: string;\n limit?: number;\n maxResults?: number;\n match?: StorageSearchMatch;\n caseInsensitive?: boolean;\n}\n\nexport interface StorageSignedDownloadOptions extends StorageOperationOptions {\n expiresIn?: number;\n responseContentDisposition?: string;\n}\n\nexport interface StorageSignedUploadOptions extends StorageOperationOptions {\n expiresIn: number;\n contentType?: string;\n maxSize?: number;\n minSize?: number;\n}\n\nexport type StorageSignedUpload =\n | {\n method: 'PUT';\n url: string;\n headers?: Record<string, string>;\n }\n | {\n method: 'POST';\n url: string;\n fields: Record<string, string>;\n };\n\nexport interface StorageSignedUrlCapability {\n supported: boolean;\n maxExpiresIn?: number;\n}\n\nexport interface StorageConditionalCopyCapability {\n supported: boolean;\n etag: boolean;\n version: boolean;\n}\n\nexport interface StorageSignedUploadPolicyCapability {\n /** The signed request fixes the exact declared content type. */\n contentType: boolean;\n /** The signed request enforces the requested min/max byte range. */\n sizeRange: boolean;\n}\n\nexport interface StorageSignedDownloadPolicyCapability {\n /** Every generated URL honors the requested expiry. */\n expiresIn: boolean;\n}\n\nexport interface StorageCapabilities {\n rangeRead: boolean;\n /** True when the provider reports native byte-level upload progress. */\n nativeUploadProgress: boolean;\n delimiter: boolean;\n metadata: boolean;\n cacheControl: boolean;\n resumableUpload: boolean;\n serverSideCopy: boolean;\n /**\n * Conditional server-side copy used to promote an already verified staged\n * object without a validation/copy race. Absent means unsupported for\n * compatibility with drivers built against earlier package versions.\n */\n conditionalCopy?: StorageConditionalCopyCapability;\n signedDownload: StorageSignedUrlCapability;\n /** Expiry guarantees enforced by the provider adapter. */\n signedDownloadPolicy?: StorageSignedDownloadPolicyCapability;\n /**\n * Some providers decide support from credentials or requested constraints,\n * so direct-upload support can only be known when the call is attempted.\n */\n signedUpload: boolean | 'runtime';\n /**\n * Constraints cryptographically/provider-policy enforced by direct upload.\n * Absent means callers must not assume request options are enforced.\n */\n signedUploadPolicy?: StorageSignedUploadPolicyCapability;\n}\n\nexport interface StorageBulkOptions {\n concurrency?: number;\n stopOnError?: boolean;\n}\n\nexport interface StorageBulkError {\n key: string;\n error: StorageError;\n}\n\nexport interface StorageUploadManyItem {\n key: string;\n body: StorageBody;\n contentType?: string;\n cacheControl?: string;\n metadata?: Record<string, string>;\n multipart?: boolean | StorageMultipartOptions;\n}\n\nexport interface StorageUploadManyOptions\n extends StorageBulkOptions, StorageOperationOptions {\n onProgress?: (progress: StorageUploadProgress & { key: string }) => void;\n}\n\nexport interface StorageUploadManyResult {\n uploaded: StorageUploadResult[];\n errors?: StorageBulkError[];\n}\n\nexport interface StorageDownloadManyResult {\n downloaded: StorageObject[];\n errors?: StorageBulkError[];\n}\n\nexport interface StorageHeadManyResult {\n objects: StorageObjectMetadata[];\n errors?: StorageBulkError[];\n}\n\nexport interface StorageExistsManyResult {\n existing: string[];\n missing: string[];\n errors?: StorageBulkError[];\n}\n\nexport interface StorageDeleteManyResult {\n deleted: string[];\n errors?: StorageBulkError[];\n}\n\nexport type StorageOperationName =\n | 'upload'\n | 'download'\n | 'head'\n | 'exists'\n | 'delete'\n | 'copy'\n | 'move'\n | 'promote'\n | 'list'\n | 'search'\n | 'signDownload'\n | 'signUpload';\n\nexport interface StorageOperationContext {\n store: string;\n operation: StorageOperationName;\n key?: string;\n from?: string;\n to?: string;\n}\n\nexport interface StoragePlugin {\n name?: string;\n /**\n * Runs before the driver and may reject an operation, for example to enforce\n * policy. Hooks run in registration order.\n */\n beforeOperation?: (context: StorageOperationContext) => void | Promise<void>;\n /**\n * Observes a successful operation. Throwing turns the call into a failure,\n * which is useful for mandatory audit sinks.\n *\n * For streaming downloads, success means the provider returned a stream.\n * Later consumption failures are normalized for the stream consumer but do\n * not re-enter plugin hooks.\n */\n afterOperation?: (\n context: StorageOperationContext,\n result: unknown,\n ) => void | Promise<void>;\n /**\n * Best-effort error observation. Hook failures never replace the original\n * storage error.\n */\n onError?: (\n context: StorageOperationContext,\n error: StorageError,\n ) => void | Promise<void>;\n}\n\nexport interface StorageTransferProgress {\n done: number;\n total: number;\n key: string;\n status: 'transferred' | 'skipped';\n}\n\nexport interface StorageTransferOptions extends StorageBulkOptions {\n from: string;\n to: string;\n prefix?: string;\n transformKey?: (key: string) => string;\n overwrite?: boolean;\n limit?: number;\n signal?: AbortSignal;\n onProgress?: (progress: StorageTransferProgress) => void;\n}\n\nexport interface StorageTransferResult {\n transferred: string[];\n skipped?: string[];\n errors?: StorageBulkError[];\n}\n\nexport type StorageSyncCompare =\n | 'etag'\n | 'size'\n | ((\n source: StorageObjectMetadata,\n destination: StorageObjectMetadata,\n ) => boolean);\n\nexport interface StorageSyncProgress {\n done: number;\n total: number;\n key: string;\n status: 'uploaded' | 'skipped' | 'deleted';\n}\n\nexport interface StorageSyncOptions extends StorageBulkOptions {\n from: string;\n to: string;\n prefix?: string;\n destinationPrefix?: string;\n transformKey?: (key: string) => string;\n prune?: boolean;\n compare?: StorageSyncCompare;\n dryRun?: boolean;\n limit?: number;\n signal?: AbortSignal;\n onProgress?: (progress: StorageSyncProgress) => void;\n}\n\nexport interface StorageSyncResult {\n uploaded: string[];\n skipped: string[];\n deleted?: string[];\n errors?: StorageBulkError[];\n}\n"]}
1
+ {"version":3,"file":"storage.types.js","sourceRoot":"","sources":["../src/storage.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Readable } from 'node:stream';\n\nimport type { StorageError } from './storage.error.js';\nimport type { StorageUploadControl } from './storage-upload-control.js';\n\nexport type StorageBody =\n | Blob\n | File\n | ReadableStream<Uint8Array>\n | Readable\n | ArrayBuffer\n | ArrayBufferView\n | Uint8Array\n | string;\n\nexport interface StorageRetryContext {\n attempt: number;\n error: StorageError;\n}\n\nexport type StorageRetryOptions =\n | number\n | {\n max: number;\n backoff?: (context: StorageRetryContext) => number;\n };\n\nexport interface StorageOperationOptions {\n signal?: AbortSignal;\n timeout?: number;\n retries?: StorageRetryOptions;\n}\n\n/**\n * Preconditions for promoting a staged object to its final key. At least one\n * source identity must be supplied; unsupported identities fail closed.\n */\nexport interface StoragePromotionOptions extends StorageOperationOptions {\n /** Copy only the source object whose provider ETag exactly matches. */\n sourceEtag?: string;\n /** Copy this immutable provider version of the source object. */\n sourceVersion?: string;\n}\n\nexport interface StorageMultipartOptions {\n partSize?: number;\n concurrency?: number;\n}\n\nexport interface StorageUploadProgress {\n loaded: number;\n total?: number;\n}\n\nexport interface StorageUploadOptions extends StorageOperationOptions {\n contentType?: string;\n cacheControl?: string;\n metadata?: Record<string, string>;\n onProgress?: (progress: StorageUploadProgress) => void;\n multipart?: boolean | StorageMultipartOptions;\n control?: StorageUploadControl;\n}\n\nexport type StorageConditionalUploadOptions = StorageUploadOptions &\n (\n | {\n /** Atomically create the object only when its key does not exist. */\n condition: { type: 'create' };\n }\n | {\n /** Atomically replace the object only when its current ETag matches. */\n condition: { type: 'replace'; etag: string };\n }\n );\n\nexport interface StorageConditionalDeleteOptions extends StorageOperationOptions {\n /** Atomically delete the object only when its current ETag matches. */\n condition: { etag: string };\n}\n\nexport interface StorageUploadResult {\n key: string;\n size: number;\n contentType: string;\n etag?: string;\n lastModified?: Date;\n}\n\nexport interface StorageObjectMetadata {\n key: string;\n name: string;\n size: number;\n contentType: string;\n etag?: string;\n lastModified?: Date;\n metadata?: Record<string, string>;\n}\n\nexport interface StorageObject extends StorageObjectMetadata {\n body: ReadableStream<Uint8Array>;\n}\n\nexport interface StorageByteRange {\n start: number;\n end?: number;\n}\n\nexport interface StorageDownloadOptions extends StorageOperationOptions {\n range?: StorageByteRange;\n}\n\nexport interface StorageBufferedDownloadOptions extends StorageDownloadOptions {\n /**\n * Maximum number of bytes buffered in memory. Defaults to 10 MiB.\n * Pass `Infinity` only when the caller has independently bounded the object.\n */\n maxBytes?: number;\n}\n\nexport interface StorageListOptions extends StorageOperationOptions {\n prefix?: string;\n cursor?: string;\n limit?: number;\n delimiter?: string;\n}\n\nexport interface StorageListResult {\n items: StorageObjectMetadata[];\n prefixes?: string[];\n cursor?: string;\n}\n\nexport type StorageSearchMatch = 'glob' | 'regex' | 'substring' | 'exact';\n\nexport interface StorageSearchOptions extends StorageOperationOptions {\n prefix?: string;\n limit?: number;\n maxResults?: number;\n match?: StorageSearchMatch;\n caseInsensitive?: boolean;\n}\n\nexport interface StorageSignedDownloadOptions extends StorageOperationOptions {\n expiresIn?: number;\n responseContentDisposition?: string;\n}\n\nexport interface StorageSignedUploadOptions extends StorageOperationOptions {\n expiresIn: number;\n contentType?: string;\n maxSize?: number;\n minSize?: number;\n}\n\nexport type StorageSignedUpload =\n | {\n method: 'PUT';\n url: string;\n headers?: Record<string, string>;\n }\n | {\n method: 'POST';\n url: string;\n fields: Record<string, string>;\n };\n\nexport interface StorageSignedUrlCapability {\n supported: boolean;\n maxExpiresIn?: number;\n}\n\nexport interface StorageConditionalCopyCapability {\n supported: boolean;\n etag: boolean;\n version: boolean;\n}\n\nexport interface StorageConditionalMutationCapability {\n /** Native create-if-absent support. */\n create: boolean;\n /** Native replace-if-current-ETag-matches support. */\n replace: boolean;\n /** Native delete-if-current-ETag-matches support. */\n delete: boolean;\n /**\n * Successful conditional uploads return an ETag usable for CAS. A provider\n * that commits without returning one must fail rather than report success.\n */\n etag: boolean;\n}\n\nexport interface StorageSignedUploadPolicyCapability {\n /** The signed request fixes the exact declared content type. */\n contentType: boolean;\n /** The signed request enforces the requested min/max byte range. */\n sizeRange: boolean;\n}\n\nexport interface StorageSignedDownloadPolicyCapability {\n /** Every generated URL honors the requested expiry. */\n expiresIn: boolean;\n}\n\nexport interface StorageCapabilities {\n rangeRead: boolean;\n /** True when the provider reports native byte-level upload progress. */\n nativeUploadProgress: boolean;\n delimiter: boolean;\n metadata: boolean;\n cacheControl: boolean;\n resumableUpload: boolean;\n serverSideCopy: boolean;\n /**\n * Conditional server-side copy used to promote an already verified staged\n * object without a validation/copy race. Absent means unsupported for\n * compatibility with drivers built against earlier package versions.\n */\n conditionalCopy?: StorageConditionalCopyCapability;\n /**\n * Native conditional mutations. Absent means unsupported; callers must not\n * emulate these operations with a separate `exists()` or `head()` request.\n */\n conditionalMutation?: StorageConditionalMutationCapability;\n signedDownload: StorageSignedUrlCapability;\n /** Expiry guarantees enforced by the provider adapter. */\n signedDownloadPolicy?: StorageSignedDownloadPolicyCapability;\n /**\n * Some providers decide support from credentials or requested constraints,\n * so direct-upload support can only be known when the call is attempted.\n */\n signedUpload: boolean | 'runtime';\n /**\n * Constraints cryptographically/provider-policy enforced by direct upload.\n * Absent means callers must not assume request options are enforced.\n */\n signedUploadPolicy?: StorageSignedUploadPolicyCapability;\n}\n\nexport interface StorageBulkOptions {\n concurrency?: number;\n stopOnError?: boolean;\n}\n\nexport interface StorageBulkError {\n key: string;\n error: StorageError;\n}\n\nexport interface StorageUploadManyItem {\n key: string;\n body: StorageBody;\n contentType?: string;\n cacheControl?: string;\n metadata?: Record<string, string>;\n multipart?: boolean | StorageMultipartOptions;\n}\n\nexport interface StorageUploadManyOptions\n extends StorageBulkOptions, StorageOperationOptions {\n onProgress?: (progress: StorageUploadProgress & { key: string }) => void;\n}\n\nexport interface StorageUploadManyResult {\n uploaded: StorageUploadResult[];\n errors?: StorageBulkError[];\n}\n\nexport interface StorageDownloadManyResult {\n downloaded: StorageObject[];\n errors?: StorageBulkError[];\n}\n\nexport interface StorageHeadManyResult {\n objects: StorageObjectMetadata[];\n errors?: StorageBulkError[];\n}\n\nexport interface StorageExistsManyResult {\n existing: string[];\n missing: string[];\n errors?: StorageBulkError[];\n}\n\nexport interface StorageDeleteManyResult {\n deleted: string[];\n errors?: StorageBulkError[];\n}\n\nexport type StorageOperationName =\n | 'upload'\n | 'download'\n | 'head'\n | 'exists'\n | 'delete'\n | 'copy'\n | 'move'\n | 'promote'\n | 'list'\n | 'search'\n | 'signDownload'\n | 'signUpload';\n\nexport interface StorageOperationContext {\n store: string;\n operation: StorageOperationName;\n key?: string;\n from?: string;\n to?: string;\n}\n\nexport interface StoragePlugin {\n name?: string;\n /**\n * Runs before the driver and may reject an operation, for example to enforce\n * policy. Hooks run in registration order.\n */\n beforeOperation?: (context: StorageOperationContext) => void | Promise<void>;\n /**\n * Observes a successful operation. Throwing turns the call into a failure,\n * which is useful for mandatory audit sinks.\n *\n * For streaming downloads, success means the provider returned a stream.\n * Later consumption failures are normalized for the stream consumer but do\n * not re-enter plugin hooks.\n */\n afterOperation?: (\n context: StorageOperationContext,\n result: unknown,\n ) => void | Promise<void>;\n /**\n * Best-effort error observation. Hook failures never replace the original\n * storage error.\n */\n onError?: (\n context: StorageOperationContext,\n error: StorageError,\n ) => void | Promise<void>;\n}\n\nexport interface StorageTransferProgress {\n done: number;\n total: number;\n key: string;\n status: 'transferred' | 'skipped';\n}\n\nexport interface StorageTransferOptions extends StorageBulkOptions {\n from: string;\n to: string;\n prefix?: string;\n transformKey?: (key: string) => string;\n overwrite?: boolean;\n limit?: number;\n signal?: AbortSignal;\n onProgress?: (progress: StorageTransferProgress) => void;\n}\n\nexport interface StorageTransferResult {\n transferred: string[];\n skipped?: string[];\n errors?: StorageBulkError[];\n}\n\nexport type StorageSyncCompare =\n | 'etag'\n | 'size'\n | ((\n source: StorageObjectMetadata,\n destination: StorageObjectMetadata,\n ) => boolean);\n\nexport interface StorageSyncProgress {\n done: number;\n total: number;\n key: string;\n status: 'uploaded' | 'skipped' | 'deleted';\n}\n\nexport interface StorageSyncOptions extends StorageBulkOptions {\n from: string;\n to: string;\n prefix?: string;\n destinationPrefix?: string;\n transformKey?: (key: string) => string;\n prune?: boolean;\n compare?: StorageSyncCompare;\n dryRun?: boolean;\n limit?: number;\n signal?: AbortSignal;\n onProgress?: (progress: StorageSyncProgress) => void;\n}\n\nexport interface StorageSyncResult {\n uploaded: string[];\n skipped: string[];\n deleted?: string[];\n errors?: StorageBulkError[];\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export { StorageWorkspaceError, isStorageWorkspaceError, } from './storage-workspace.error.js';
2
+ export { createStorageWorkspace, mountStorageWorkspace, } from './storage-workspace.js';
3
+ export { DEFAULT_STORAGE_WORKSPACE_LIMITS, STORAGE_WORKSPACE_PERMISSIONS, type MountStorageWorkspaceOptions, type StorageWorkspaceBody, type StorageWorkspace, type StorageWorkspaceDirectory, type StorageWorkspaceEntry, type StorageWorkspaceFile, type StorageWorkspaceLimits, type StorageWorkspaceListOptions, type StorageWorkspaceMountOptions, type StorageWorkspaceMutationOptions, type StorageWorkspacePage, type StorageWorkspacePermission, type StorageWorkspaceReadOptions, type StorageWorkspaceSearchMatch, type StorageWorkspaceSearchOptions, type StorageWorkspaceTextFile, type StorageWorkspaceWriteOptions, } from './storage-workspace.types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workspace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gCAAgC,EAChC,6BAA6B,EAC7B,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACpC,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,GAClC,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { StorageWorkspaceError, isStorageWorkspaceError, } from './storage-workspace.error.js';
2
+ export { createStorageWorkspace, mountStorageWorkspace, } from './storage-workspace.js';
3
+ export { DEFAULT_STORAGE_WORKSPACE_LIMITS, STORAGE_WORKSPACE_PERMISSIONS, } from './storage-workspace.types.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workspace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gCAAgC,EAChC,6BAA6B,GAkB9B,MAAM,8BAA8B,CAAC","sourcesContent":["export {\n StorageWorkspaceError,\n isStorageWorkspaceError,\n} from './storage-workspace.error.js';\nexport {\n createStorageWorkspace,\n mountStorageWorkspace,\n} from './storage-workspace.js';\nexport {\n DEFAULT_STORAGE_WORKSPACE_LIMITS,\n STORAGE_WORKSPACE_PERMISSIONS,\n type MountStorageWorkspaceOptions,\n type StorageWorkspaceBody,\n type StorageWorkspace,\n type StorageWorkspaceDirectory,\n type StorageWorkspaceEntry,\n type StorageWorkspaceFile,\n type StorageWorkspaceLimits,\n type StorageWorkspaceListOptions,\n type StorageWorkspaceMountOptions,\n type StorageWorkspaceMutationOptions,\n type StorageWorkspacePage,\n type StorageWorkspacePermission,\n type StorageWorkspaceReadOptions,\n type StorageWorkspaceSearchMatch,\n type StorageWorkspaceSearchOptions,\n type StorageWorkspaceTextFile,\n type StorageWorkspaceWriteOptions,\n} from './storage-workspace.types.js';\n"]}
@@ -0,0 +1,6 @@
1
+ export declare class StorageWorkspaceCursorStore {
2
+ #private;
3
+ issue<State>(binding: string, state: State, ttlMs: number): string;
4
+ consume<State>(cursor: string, binding: string): State;
5
+ }
6
+ //# sourceMappingURL=storage-workspace.cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-workspace.cursor.d.ts","sourceRoot":"","sources":["../../src/workspace/storage-workspace.cursor.ts"],"names":[],"mappings":"AAcA,qBAAa,2BAA2B;;IAGtC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAmBjE;IAED,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAsBrD;CAUF"}
@@ -0,0 +1,45 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import { StorageErrorCode } from '../storage.error.js';
3
+ import { workspaceError } from './storage-workspace.error.js';
4
+ const MAX_ACTIVE_CURSORS = 1024;
5
+ export class StorageWorkspaceCursorStore {
6
+ #records = new Map();
7
+ issue(binding, state, ttlMs) {
8
+ this.#prune();
9
+ if (this.#records.size >= MAX_ACTIVE_CURSORS) {
10
+ throw workspaceError(StorageErrorCode.LIMIT_EXCEEDED, 'Workspace has too many active cursors.', { permanent: true });
11
+ }
12
+ let cursor;
13
+ do {
14
+ cursor = randomBytes(24).toString('base64url');
15
+ } while (this.#records.has(cursor));
16
+ this.#records.set(cursor, {
17
+ binding,
18
+ expiresAt: Date.now() + ttlMs,
19
+ state,
20
+ });
21
+ return cursor;
22
+ }
23
+ consume(cursor, binding) {
24
+ if (!/^[A-Za-z0-9_-]{32}$/u.test(cursor)) {
25
+ throw workspaceError(StorageErrorCode.INVALID_ARGUMENT, 'Workspace cursor has an invalid format.', { permanent: true });
26
+ }
27
+ const record = this.#records.get(cursor);
28
+ this.#records.delete(cursor);
29
+ if (record === undefined ||
30
+ record.expiresAt <= Date.now() ||
31
+ record.binding !== binding) {
32
+ throw workspaceError(StorageErrorCode.INVALID_ARGUMENT, 'Workspace cursor is invalid, expired, or belongs to another query.', { permanent: true });
33
+ }
34
+ return record.state;
35
+ }
36
+ #prune() {
37
+ const now = Date.now();
38
+ for (const [cursor, record] of this.#records) {
39
+ if (record.expiresAt <= now) {
40
+ this.#records.delete(cursor);
41
+ }
42
+ }
43
+ }
44
+ }
45
+ //# sourceMappingURL=storage-workspace.cursor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-workspace.cursor.js","sourceRoot":"","sources":["../../src/workspace/storage-workspace.cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQ9D,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,MAAM,OAAO,2BAA2B;IAC7B,QAAQ,GAAG,IAAI,GAAG,EAAiC,CAAC;IAE7D,KAAK,CAAQ,OAAe,EAAE,KAAY,EAAE,KAAa;QACvD,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,kBAAkB,EAAE,CAAC;YAC7C,MAAM,cAAc,CAClB,gBAAgB,CAAC,cAAc,EAC/B,wCAAwC,EACxC,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAC;QACJ,CAAC;QACD,IAAI,MAAc,CAAC;QACnB,GAAG,CAAC;YACF,MAAM,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACjD,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QACpC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE;YACxB,OAAO;YACP,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;YAC7B,KAAK;SACN,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,CAAQ,MAAc,EAAE,OAAe;QAC5C,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACzC,MAAM,cAAc,CAClB,gBAAgB,CAAC,gBAAgB,EACjC,yCAAyC,EACzC,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7B,IACE,MAAM,KAAK,SAAS;YACpB,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE;YAC9B,MAAM,CAAC,OAAO,KAAK,OAAO,EAC1B,CAAC;YACD,MAAM,cAAc,CAClB,gBAAgB,CAAC,gBAAgB,EACjC,oEAAoE,EACpE,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC,KAAc,CAAC;IAC/B,CAAC;IAED,MAAM;QACJ,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC7C,IAAI,MAAM,CAAC,SAAS,IAAI,GAAG,EAAE,CAAC;gBAC5B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { randomBytes } from 'node:crypto';\n\nimport { StorageErrorCode } from '../storage.error.js';\n\nimport { workspaceError } from './storage-workspace.error.js';\n\ninterface CursorRecord<State> {\n readonly binding: string;\n readonly expiresAt: number;\n readonly state: State;\n}\n\nconst MAX_ACTIVE_CURSORS = 1024;\n\nexport class StorageWorkspaceCursorStore {\n readonly #records = new Map<string, CursorRecord<unknown>>();\n\n issue<State>(binding: string, state: State, ttlMs: number): string {\n this.#prune();\n if (this.#records.size >= MAX_ACTIVE_CURSORS) {\n throw workspaceError(\n StorageErrorCode.LIMIT_EXCEEDED,\n 'Workspace has too many active cursors.',\n { permanent: true },\n );\n }\n let cursor: string;\n do {\n cursor = randomBytes(24).toString('base64url');\n } while (this.#records.has(cursor));\n this.#records.set(cursor, {\n binding,\n expiresAt: Date.now() + ttlMs,\n state,\n });\n return cursor;\n }\n\n consume<State>(cursor: string, binding: string): State {\n if (!/^[A-Za-z0-9_-]{32}$/u.test(cursor)) {\n throw workspaceError(\n StorageErrorCode.INVALID_ARGUMENT,\n 'Workspace cursor has an invalid format.',\n { permanent: true },\n );\n }\n const record = this.#records.get(cursor);\n this.#records.delete(cursor);\n if (\n record === undefined ||\n record.expiresAt <= Date.now() ||\n record.binding !== binding\n ) {\n throw workspaceError(\n StorageErrorCode.INVALID_ARGUMENT,\n 'Workspace cursor is invalid, expired, or belongs to another query.',\n { permanent: true },\n );\n }\n return record.state as State;\n }\n\n #prune(): void {\n const now = Date.now();\n for (const [cursor, record] of this.#records) {\n if (record.expiresAt <= now) {\n this.#records.delete(cursor);\n }\n }\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { StorageClient } from '../storage.client.js';
2
+ import type { MountStorageWorkspaceOptions, StorageWorkspace as StorageWorkspaceContract } from './storage-workspace.types.js';
3
+ export declare function mountStorageWorkspace(client: StorageClient, options: MountStorageWorkspaceOptions): StorageWorkspaceContract;
4
+ /** @deprecated Prefer {@link mountStorageWorkspace}. */
5
+ export declare const createStorageWorkspace: typeof mountStorageWorkspace;
6
+ //# sourceMappingURL=storage-workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-workspace.d.ts","sourceRoot":"","sources":["../../src/workspace/storage-workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAwBrD,OAAO,KAAK,EACV,4BAA4B,EAC5B,gBAAgB,IAAI,wBAAwB,EAgB7C,MAAM,8BAA8B,CAAC;AAukCtC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,4BAA4B,GACpC,wBAAwB,CAiB1B;AAED,wDAAwD;AACxD,eAAO,MAAM,sBAAsB,8BAAwB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { StorageError } from '../storage.error.js';
2
+ import type { StorageErrorCode as StorageErrorCodeValue } from '../storage.error.js';
3
+ declare const STORAGE_WORKSPACE_ERROR_BRAND: unique symbol;
4
+ export declare class StorageWorkspaceError extends StorageError {
5
+ readonly [STORAGE_WORKSPACE_ERROR_BRAND]: true;
6
+ readonly code: StorageErrorCodeValue;
7
+ readonly operation: string | undefined;
8
+ readonly path: string | undefined;
9
+ readonly permanent: boolean;
10
+ constructor(message: string, options: {
11
+ code: StorageErrorCodeValue;
12
+ operation?: string;
13
+ path?: string;
14
+ permanent?: boolean;
15
+ });
16
+ }
17
+ export declare function isStorageWorkspaceError(error: unknown): error is StorageWorkspaceError;
18
+ export declare function workspaceError(code: StorageErrorCodeValue, message: string, options?: {
19
+ operation?: string;
20
+ path?: string;
21
+ permanent?: boolean;
22
+ }): StorageWorkspaceError;
23
+ export declare function sanitizeWorkspaceError(error: unknown, options: {
24
+ operation: string;
25
+ path?: string;
26
+ }): StorageWorkspaceError;
27
+ export {};
28
+ //# sourceMappingURL=storage-workspace.error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-workspace.error.d.ts","sourceRoot":"","sources":["../../src/workspace/storage-workspace.error.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAErF,QAAA,MAAM,6BAA6B,eAAkC,CAAC;AAEtE,qBAAa,qBAAsB,SAAQ,YAAY;IACrD,SAAiB,CAAC,6BAA6B,CAAC,EAAE,IAAI,CAAC;IACvD,SAAkB,IAAI,EAAE,qBAAqB,CAAC;IAC9C,SAAkB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,SAAkB,SAAS,EAAE,OAAO,CAAC;IAErC,YACE,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;QACP,IAAI,EAAE,qBAAqB,CAAC;QAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,EAqBF;CACF;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,qBAAqB,CA4BhC;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,qBAAqB,EAC3B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GACvE,qBAAqB,CAEvB;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5C,qBAAqB,CAmBvB"}
@@ -0,0 +1,67 @@
1
+ import { StorageError, StorageErrorCode, isStorageError, } from '../storage.error.js';
2
+ const STORAGE_WORKSPACE_ERROR_BRAND = Symbol('StorageWorkspaceError');
3
+ export class StorageWorkspaceError extends StorageError {
4
+ code;
5
+ operation;
6
+ path;
7
+ permanent;
8
+ constructor(message, options) {
9
+ super(message, {
10
+ code: options.code,
11
+ ...(options.path !== undefined && { key: options.path }),
12
+ ...(options.operation !== undefined && {
13
+ operation: options.operation,
14
+ }),
15
+ permanent: options.permanent === true,
16
+ });
17
+ Object.defineProperty(this, STORAGE_WORKSPACE_ERROR_BRAND, {
18
+ configurable: false,
19
+ enumerable: false,
20
+ value: true,
21
+ writable: false,
22
+ });
23
+ this.name = 'StorageWorkspaceError';
24
+ this.code = options.code;
25
+ this.operation = options.operation;
26
+ this.path = options.path;
27
+ this.permanent = options.permanent === true;
28
+ }
29
+ }
30
+ export function isStorageWorkspaceError(error) {
31
+ if (error instanceof StorageWorkspaceError) {
32
+ return true;
33
+ }
34
+ if (!(error instanceof Error) || error.name !== 'StorageWorkspaceError') {
35
+ return false;
36
+ }
37
+ try {
38
+ const candidate = error;
39
+ return (candidate[STORAGE_WORKSPACE_ERROR_BRAND] === true &&
40
+ Object.values(StorageErrorCode).includes(candidate.code) &&
41
+ (candidate.operation === undefined ||
42
+ typeof candidate.operation === 'string') &&
43
+ (candidate.path === undefined || typeof candidate.path === 'string') &&
44
+ typeof candidate.permanent === 'boolean');
45
+ }
46
+ catch {
47
+ return false;
48
+ }
49
+ }
50
+ export function workspaceError(code, message, options = {}) {
51
+ return new StorageWorkspaceError(message, { code, ...options });
52
+ }
53
+ export function sanitizeWorkspaceError(error, options) {
54
+ if (isStorageWorkspaceError(error)) {
55
+ return error;
56
+ }
57
+ const code = isStorageError(error) ? error.code : StorageErrorCode.PROVIDER;
58
+ const permanent = isStorageError(error) ? error.permanent : false;
59
+ const logicalPath = options.path;
60
+ const target = logicalPath === undefined ? '' : ` for "${logicalPath}"`;
61
+ return workspaceError(code, `Workspace ${options.operation} failed${target}.`, {
62
+ operation: options.operation,
63
+ ...(logicalPath !== undefined && { path: logicalPath }),
64
+ permanent,
65
+ });
66
+ }
67
+ //# sourceMappingURL=storage-workspace.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-workspace.error.js","sourceRoot":"","sources":["../../src/workspace/storage-workspace.error.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAG7B,MAAM,6BAA6B,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;A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CAAC,SAAS,UAAU,MAAM,GAAG,EACjD;QACE,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,GAAG,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;QACvD,SAAS;KACV,CACF,CAAC;AACJ,CAAC","sourcesContent":["import {\n StorageError,\n StorageErrorCode,\n isStorageError,\n} from '../storage.error.js';\nimport type { StorageErrorCode as StorageErrorCodeValue } from '../storage.error.js';\n\nconst STORAGE_WORKSPACE_ERROR_BRAND = Symbol('StorageWorkspaceError');\n\nexport class StorageWorkspaceError extends StorageError {\n declare readonly [STORAGE_WORKSPACE_ERROR_BRAND]: true;\n override readonly code: StorageErrorCodeValue;\n override readonly operation: string | undefined;\n readonly path: string | undefined;\n override readonly permanent: boolean;\n\n constructor(\n message: string,\n options: {\n code: StorageErrorCodeValue;\n operation?: string;\n path?: string;\n permanent?: boolean;\n },\n ) {\n super(message, {\n code: options.code,\n ...(options.path !== undefined && { key: options.path }),\n ...(options.operation !== undefined && {\n operation: options.operation,\n }),\n permanent: options.permanent === true,\n });\n Object.defineProperty(this, STORAGE_WORKSPACE_ERROR_BRAND, {\n configurable: false,\n enumerable: false,\n value: true,\n writable: false,\n });\n this.name = 'StorageWorkspaceError';\n this.code = options.code;\n this.operation = options.operation;\n this.path = options.path;\n this.permanent = options.permanent === true;\n }\n}\n\nexport function isStorageWorkspaceError(\n error: unknown,\n): error is StorageWorkspaceError {\n if (error instanceof StorageWorkspaceError) {\n return true;\n }\n if (!(error instanceof Error) || error.name !== 'StorageWorkspaceError') {\n return false;\n }\n try {\n const candidate = error as Error & {\n readonly [STORAGE_WORKSPACE_ERROR_BRAND]?: unknown;\n readonly code?: unknown;\n readonly operation?: unknown;\n readonly path?: unknown;\n readonly permanent?: unknown;\n };\n return (\n candidate[STORAGE_WORKSPACE_ERROR_BRAND] === true &&\n Object.values(StorageErrorCode).includes(\n candidate.code as StorageErrorCodeValue,\n ) &&\n (candidate.operation === undefined ||\n typeof candidate.operation === 'string') &&\n (candidate.path === undefined || typeof candidate.path === 'string') &&\n typeof candidate.permanent === 'boolean'\n );\n } catch {\n return false;\n }\n}\n\nexport function workspaceError(\n code: StorageErrorCodeValue,\n message: string,\n options: { operation?: string; path?: string; permanent?: boolean } = {},\n): StorageWorkspaceError {\n return new StorageWorkspaceError(message, { code, ...options });\n}\n\nexport function sanitizeWorkspaceError(\n error: unknown,\n options: { operation: string; path?: string },\n): StorageWorkspaceError {\n if (isStorageWorkspaceError(error)) {\n return error;\n }\n\n const code = isStorageError(error) ? error.code : StorageErrorCode.PROVIDER;\n const permanent = isStorageError(error) ? error.permanent : false;\n const logicalPath = options.path;\n const target = logicalPath === undefined ? '' : ` for \"${logicalPath}\"`;\n\n return workspaceError(\n code,\n `Workspace ${options.operation} failed${target}.`,\n {\n operation: options.operation,\n ...(logicalPath !== undefined && { path: logicalPath }),\n permanent,\n },\n );\n}\n"]}