@nestm/storage 0.1.0-alpha.8 → 0.1.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +86 -1
- package/dist/ai-sdk/ai-sdk-workspace-tools.d.ts +9 -2
- package/dist/ai-sdk/ai-sdk-workspace-tools.d.ts.map +1 -1
- package/dist/ai-sdk/ai-sdk-workspace-tools.js +117 -58
- package/dist/ai-sdk/ai-sdk-workspace-tools.js.map +1 -1
- package/dist/ai-sdk/index.d.ts +1 -1
- package/dist/ai-sdk/index.d.ts.map +1 -1
- package/dist/ai-sdk/index.js.map +1 -1
- package/dist/files-sdk/files-sdk.driver.d.ts.map +1 -1
- package/dist/files-sdk/files-sdk.driver.js +51 -4
- package/dist/files-sdk/files-sdk.driver.js.map +1 -1
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js.map +1 -1
- package/dist/workspace/storage-workspace.d.ts.map +1 -1
- package/dist/workspace/storage-workspace.js +116 -24
- package/dist/workspace/storage-workspace.js.map +1 -1
- package/dist/workspace/storage-workspace.types.d.ts +22 -4
- package/dist/workspace/storage-workspace.types.d.ts.map +1 -1
- package/dist/workspace/storage-workspace.types.js +1 -0
- package/dist/workspace/storage-workspace.types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { StorageBody, StorageOperationOptions } from '../storage.types.js';
|
|
2
2
|
import type { StorageWorkspaceCursorConfiguration } from './storage-workspace.cursor.js';
|
|
3
|
-
export declare const STORAGE_WORKSPACE_PERMISSIONS: readonly ['list', 'read', 'search', 'create', 'replace', 'copy', 'move', 'delete'];
|
|
3
|
+
export declare const STORAGE_WORKSPACE_PERMISSIONS: readonly ['list', 'read', 'search', 'write', 'create', 'replace', 'copy', 'move', 'delete'];
|
|
4
4
|
export type StorageWorkspacePermission = (typeof STORAGE_WORKSPACE_PERMISSIONS)[number];
|
|
5
5
|
export interface StorageWorkspaceLimits {
|
|
6
6
|
/** Maximum UTF-8 byte length of an opaque continuation cursor. */
|
|
7
7
|
maxCursorBytes: number;
|
|
8
8
|
/** Maximum UTF-8 byte length of a workspace-relative path. */
|
|
9
9
|
maxPathBytes: number;
|
|
10
|
-
/** Maximum bytes returned by
|
|
10
|
+
/** Maximum bytes returned by one buffered text or binary read. */
|
|
11
11
|
maxReadBytes: number;
|
|
12
12
|
/** Maximum bytes accepted by one write. */
|
|
13
13
|
maxWriteBytes: number;
|
|
@@ -42,6 +42,9 @@ export type StorageWorkspaceEntry = StorageWorkspaceFile | StorageWorkspaceDirec
|
|
|
42
42
|
export interface StorageWorkspaceTextFile extends StorageWorkspaceFile {
|
|
43
43
|
text: string;
|
|
44
44
|
}
|
|
45
|
+
export interface StorageWorkspaceByteFile extends StorageWorkspaceFile {
|
|
46
|
+
bytes: Uint8Array;
|
|
47
|
+
}
|
|
45
48
|
export interface StorageWorkspacePage {
|
|
46
49
|
entries: StorageWorkspaceEntry[];
|
|
47
50
|
cursor?: string;
|
|
@@ -79,6 +82,10 @@ interface StorageWorkspaceWriteCommon extends StorageOperationOptions {
|
|
|
79
82
|
}
|
|
80
83
|
export type StorageWorkspaceWriteOptions = StorageWorkspaceWriteCommon & ({
|
|
81
84
|
mode: 'create';
|
|
85
|
+
}
|
|
86
|
+
/** Unconditionally writes the destination through the ordinary Files path. */
|
|
87
|
+
| {
|
|
88
|
+
mode: 'overwrite';
|
|
82
89
|
} | {
|
|
83
90
|
mode: 'replace';
|
|
84
91
|
etag: string;
|
|
@@ -86,6 +93,16 @@ export type StorageWorkspaceWriteOptions = StorageWorkspaceWriteCommon & ({
|
|
|
86
93
|
export interface StorageWorkspaceMutationOptions extends StorageOperationOptions {
|
|
87
94
|
etag: string;
|
|
88
95
|
}
|
|
96
|
+
export interface StorageWorkspaceOverwriteOptions extends StorageOperationOptions {
|
|
97
|
+
/** Unconditionally overwrites the destination through the ordinary Files path. */
|
|
98
|
+
mode: 'overwrite';
|
|
99
|
+
}
|
|
100
|
+
export interface StorageWorkspaceUnconditionalDeleteOptions extends StorageOperationOptions {
|
|
101
|
+
/** Deletes the current destination without an ETag precondition. */
|
|
102
|
+
mode: 'unconditional';
|
|
103
|
+
}
|
|
104
|
+
export type StorageWorkspaceCopyOptions = StorageWorkspaceMutationOptions | StorageWorkspaceOverwriteOptions;
|
|
105
|
+
export type StorageWorkspaceDeleteOptions = StorageWorkspaceMutationOptions | StorageWorkspaceUnconditionalDeleteOptions;
|
|
89
106
|
export type StorageWorkspaceBody = Extract<StorageBody, string | Uint8Array>;
|
|
90
107
|
export interface StorageWorkspace {
|
|
91
108
|
readonly permissions: ReadonlySet<StorageWorkspacePermission>;
|
|
@@ -93,12 +110,13 @@ export interface StorageWorkspace {
|
|
|
93
110
|
allows(permission: StorageWorkspacePermission): boolean;
|
|
94
111
|
stat(path: string, options?: StorageOperationOptions): Promise<StorageWorkspaceFile>;
|
|
95
112
|
readText(path: string, options?: StorageWorkspaceReadOptions): Promise<StorageWorkspaceTextFile>;
|
|
113
|
+
readBytes(path: string, options?: StorageWorkspaceReadOptions): Promise<StorageWorkspaceByteFile>;
|
|
96
114
|
list(options?: StorageWorkspaceListOptions): Promise<StorageWorkspacePage>;
|
|
97
115
|
search(query: string, options?: StorageWorkspaceSearchOptions): Promise<StorageWorkspacePage>;
|
|
98
116
|
writeFile(path: string, body: StorageWorkspaceBody, options: StorageWorkspaceWriteOptions): Promise<StorageWorkspaceFile>;
|
|
99
|
-
copyFile(source: string, destination: string, options:
|
|
117
|
+
copyFile(source: string, destination: string, options: StorageWorkspaceCopyOptions): Promise<StorageWorkspaceFile>;
|
|
100
118
|
moveFile(source: string, destination: string, options: StorageWorkspaceMutationOptions): Promise<StorageWorkspaceFile>;
|
|
101
|
-
deleteFile(path: string, options:
|
|
119
|
+
deleteFile(path: string, options: StorageWorkspaceDeleteOptions): Promise<void>;
|
|
102
120
|
mount(directory: string, options?: StorageWorkspaceMountOptions): StorageWorkspace;
|
|
103
121
|
}
|
|
104
122
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-workspace.types.d.ts","sourceRoot":"","sources":["../../src/workspace/storage-workspace.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,+BAA+B,CAAC;AAEzF,eAAO,MAAM,6BAA6B,YACxC,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,CACA,CAAC;AAEX,MAAM,MAAM,0BAA0B,GACpC,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjD,MAAM,WAAW,sBAAsB;IACrC,kEAAkE;IAClE,cAAc,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,YAAY,EAAE,MAAM,CAAC;IACrB,
|
|
1
|
+
{"version":3,"file":"storage-workspace.types.d.ts","sourceRoot":"","sources":["../../src/workspace/storage-workspace.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,+BAA+B,CAAC;AAEzF,eAAO,MAAM,6BAA6B,YACxC,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,CACA,CAAC;AAEX,MAAM,MAAM,0BAA0B,GACpC,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjD,MAAM,WAAW,sBAAsB;IACrC,kEAAkE;IAClE,cAAc,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,YAAY,EAAE,MAAM,CAAC;IACrB,kEAAkE;IA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AAC;IACjC,QAAQ,CACN,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,QAAQ,CACN,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,UAAU,CACR,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,KAAK,CACH,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,4BAA4B,GACrC,gBAAgB,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-workspace.types.js","sourceRoot":"","sources":["../../src/workspace/storage-workspace.types.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,MAAM;IACN,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,MAAM;IACN,MAAM;IACN,QAAQ;CACA,CAAC;AA2BX,MAAM,CAAC,MAAM,gCAAgC,GAC3C,MAAM,CAAC,MAAM,CAAC;IACZ,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;IAC1B,cAAc,EAAE,KAAK;IACrB,WAAW,EAAE,GAAG;IAChB,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI,GAAG,IAAI;IACzB,gBAAgB,EAAE,GAAG;IACrB,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,IAAI,GAAG,IAAI;CAC3B,CAAC,CAAC","sourcesContent":["import type { StorageBody, StorageOperationOptions } from '../storage.types.js';\n\nimport type { StorageWorkspaceCursorConfiguration } from './storage-workspace.cursor.js';\n\nexport const STORAGE_WORKSPACE_PERMISSIONS = [\n 'list',\n 'read',\n 'search',\n 'create',\n 'replace',\n 'copy',\n 'move',\n 'delete',\n] as const;\n\nexport type StorageWorkspacePermission =\n (typeof STORAGE_WORKSPACE_PERMISSIONS)[number];\n\nexport interface StorageWorkspaceLimits {\n /** Maximum UTF-8 byte length of an opaque continuation cursor. */\n maxCursorBytes: number;\n /** Maximum UTF-8 byte length of a workspace-relative path. */\n maxPathBytes: number;\n /** Maximum bytes returned by
|
|
1
|
+
{"version":3,"file":"storage-workspace.types.js","sourceRoot":"","sources":["../../src/workspace/storage-workspace.types.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,MAAM;IACN,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;IACN,MAAM;IACN,QAAQ;CACA,CAAC;AA2BX,MAAM,CAAC,MAAM,gCAAgC,GAC3C,MAAM,CAAC,MAAM,CAAC;IACZ,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;IAC1B,cAAc,EAAE,KAAK;IACrB,WAAW,EAAE,GAAG;IAChB,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI,GAAG,IAAI;IACzB,gBAAgB,EAAE,GAAG;IACrB,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,IAAI,GAAG,IAAI;CAC3B,CAAC,CAAC","sourcesContent":["import type { StorageBody, StorageOperationOptions } from '../storage.types.js';\n\nimport type { StorageWorkspaceCursorConfiguration } from './storage-workspace.cursor.js';\n\nexport const STORAGE_WORKSPACE_PERMISSIONS = [\n 'list',\n 'read',\n 'search',\n 'write',\n 'create',\n 'replace',\n 'copy',\n 'move',\n 'delete',\n] as const;\n\nexport type StorageWorkspacePermission =\n (typeof STORAGE_WORKSPACE_PERMISSIONS)[number];\n\nexport interface StorageWorkspaceLimits {\n /** Maximum UTF-8 byte length of an opaque continuation cursor. */\n maxCursorBytes: number;\n /** Maximum UTF-8 byte length of a workspace-relative path. */\n maxPathBytes: number;\n /** Maximum bytes returned by one buffered text or binary read. */\n maxReadBytes: number;\n /** Maximum bytes accepted by one write. */\n maxWriteBytes: number;\n /** Maximum entries returned by one list page. */\n maxPageSize: number;\n /** Maximum entries returned by one search page. */\n maxSearchResults: number;\n /** Maximum objects inspected by one search query across all pages. */\n maxSearchScan: number;\n /**\n * Authorization ceiling for an opaque continuation cursor. It does not\n * extend the lifetime or availability of an embedded provider cursor.\n */\n cursorTtlMs: number;\n}\n\nexport const DEFAULT_STORAGE_WORKSPACE_LIMITS: Readonly<StorageWorkspaceLimits> =\n Object.freeze({\n cursorTtlMs: 5 * 60 * 1000,\n maxCursorBytes: 4_096,\n maxPageSize: 100,\n maxPathBytes: 1024,\n maxReadBytes: 1024 * 1024,\n maxSearchResults: 100,\n maxSearchScan: 1000,\n maxWriteBytes: 1024 * 1024,\n });\n\nexport interface StorageWorkspaceFile {\n kind: 'file';\n path: string;\n name: string;\n size: number;\n contentType: string;\n etag?: string;\n lastModified?: Date;\n}\n\nexport interface StorageWorkspaceDirectory {\n kind: 'directory';\n path: string;\n name: string;\n}\n\nexport type StorageWorkspaceEntry =\n StorageWorkspaceFile | StorageWorkspaceDirectory;\n\nexport interface StorageWorkspaceTextFile extends StorageWorkspaceFile {\n text: string;\n}\n\nexport interface StorageWorkspaceByteFile extends StorageWorkspaceFile {\n bytes: Uint8Array;\n}\n\nexport interface StorageWorkspacePage {\n entries: StorageWorkspaceEntry[];\n cursor?: string;\n}\n\nexport interface StorageWorkspaceMountOptions {\n permissions?: Iterable<StorageWorkspacePermission>;\n limits?: Partial<StorageWorkspaceLimits>;\n}\n\nexport interface MountStorageWorkspaceOptions extends StorageWorkspaceMountOptions {\n /** Trusted backend namespace. It is never exposed through the workspace. */\n prefix: string;\n /** Stable server-owned cursor configuration shared across serving replicas. */\n cursor?: StorageWorkspaceCursorConfiguration;\n}\n\nexport interface StorageWorkspaceReadOptions extends StorageOperationOptions {\n maxBytes?: number;\n}\n\nexport interface StorageWorkspaceListOptions extends StorageOperationOptions {\n directory?: string | undefined;\n recursive?: boolean | undefined;\n limit?: number | undefined;\n cursor?: string | undefined;\n}\n\nexport type StorageWorkspaceSearchMatch = 'glob' | 'substring' | 'exact';\n\nexport interface StorageWorkspaceSearchOptions extends StorageOperationOptions {\n directory?: string | undefined;\n match?: StorageWorkspaceSearchMatch | undefined;\n caseInsensitive?: boolean | undefined;\n limit?: number | undefined;\n cursor?: string | undefined;\n}\n\ninterface StorageWorkspaceWriteCommon extends StorageOperationOptions {\n contentType?: string;\n metadata?: Record<string, string>;\n}\n\nexport type StorageWorkspaceWriteOptions = StorageWorkspaceWriteCommon &\n (\n | { mode: 'create' }\n /** Unconditionally writes the destination through the ordinary Files path. */\n | { mode: 'overwrite' }\n | {\n mode: 'replace';\n etag: string;\n }\n );\n\nexport interface StorageWorkspaceMutationOptions extends StorageOperationOptions {\n etag: string;\n}\n\nexport interface StorageWorkspaceOverwriteOptions extends StorageOperationOptions {\n /** Unconditionally overwrites the destination through the ordinary Files path. */\n mode: 'overwrite';\n}\n\nexport interface StorageWorkspaceUnconditionalDeleteOptions extends StorageOperationOptions {\n /** Deletes the current destination without an ETag precondition. */\n mode: 'unconditional';\n}\n\nexport type StorageWorkspaceCopyOptions =\n StorageWorkspaceMutationOptions | StorageWorkspaceOverwriteOptions;\n\nexport type StorageWorkspaceDeleteOptions =\n StorageWorkspaceMutationOptions | StorageWorkspaceUnconditionalDeleteOptions;\n\nexport type StorageWorkspaceBody = Extract<StorageBody, string | Uint8Array>;\n\nexport interface StorageWorkspace {\n readonly permissions: ReadonlySet<StorageWorkspacePermission>;\n readonly limits: Readonly<StorageWorkspaceLimits>;\n allows(permission: StorageWorkspacePermission): boolean;\n stat(\n path: string,\n options?: StorageOperationOptions,\n ): Promise<StorageWorkspaceFile>;\n readText(\n path: string,\n options?: StorageWorkspaceReadOptions,\n ): Promise<StorageWorkspaceTextFile>;\n readBytes(\n path: string,\n options?: StorageWorkspaceReadOptions,\n ): Promise<StorageWorkspaceByteFile>;\n list(options?: StorageWorkspaceListOptions): Promise<StorageWorkspacePage>;\n search(\n query: string,\n options?: StorageWorkspaceSearchOptions,\n ): Promise<StorageWorkspacePage>;\n writeFile(\n path: string,\n body: StorageWorkspaceBody,\n options: StorageWorkspaceWriteOptions,\n ): Promise<StorageWorkspaceFile>;\n copyFile(\n source: string,\n destination: string,\n options: StorageWorkspaceCopyOptions,\n ): Promise<StorageWorkspaceFile>;\n moveFile(\n source: string,\n destination: string,\n options: StorageWorkspaceMutationOptions,\n ): Promise<StorageWorkspaceFile>;\n deleteFile(\n path: string,\n options: StorageWorkspaceDeleteOptions,\n ): Promise<void>;\n mount(\n directory: string,\n options?: StorageWorkspaceMountOptions,\n ): StorageWorkspace;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestm/storage",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.9",
|
|
4
4
|
"description": "Framework-neutral storage clients, capability-scoped agent workspaces, NestJS 12 integration, and guarded HTTP access.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Kauan Guesser",
|