@finueva/drive 0.23.0 → 0.25.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.
- package/CHANGELOG.md +17 -0
- package/README.md +44 -26
- package/dist/client.d.ts +2 -2
- package/dist/client.js +1 -1
- package/dist/contract.d.ts +491 -1523
- package/dist/contract2.d.ts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @finueva/drive
|
|
2
2
|
|
|
3
|
+
## 0.25.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 33e693a: Add explicit authenticated personal storage setup through `ensurePersonalWorkspace`, using canonical server policy and current user authority.
|
|
8
|
+
|
|
9
|
+
## 0.24.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- e26c07a: Breaking change for the 0.x client: replace upload session and multipart/version upload APIs with the current verified-transfer protocol. Remove createUpload, getUploadStatus, createUploadPartDescriptor, recordUploadPart, completeUpload, abortUpload, createFileVersionUpload, commitFileVersion, uploadFile and uploadFileVersion. Use prepareVerifiedTransfer, recoverVerifiedTransfer, publishVerifiedTransfer and uploadVerifiedFile with bounded operation-key validity instead. Read, access-context, editing, sharing and visitor interfaces remain available.
|
|
14
|
+
|
|
15
|
+
Upgrade the client and service together or isolate existing clients and pending legacy operations before activating the current namespace. Publishing this client alone does not qualify the service or migrate old operations.
|
|
16
|
+
|
|
17
|
+
- cdce13c: Add authenticated current-user file storage usage, separate from permission-gated workspace aggregate quota accounting.
|
|
18
|
+
- 21a19fb: Add authenticated immutable verified transfers and a bounded three-request browser upload that verifies the full provider checksum and returns complete published file metadata without polling or readback. Preserve scoped credentials, conditional version writes and exact provider capabilities.
|
|
19
|
+
|
|
3
20
|
## 0.23.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ Grants expire within 30 days, challenges within 24 hours and sessions within sev
|
|
|
31
31
|
Approved ecosystem servers can separately use `createDriveProvisioningClient` from `/server` to call `provisionWorkspace(command)`. Configure an exact environment and `getProvisioningCredential` provider using Auth service credentials, not User credentials. Commands require a stable provisioning ID, exact workspace reference, and explicit versioned storage entitlement. The client does not infer quotas, follow redirects, or retry. See [Workspace Provisioning](../../apps/developer/docs/sdk/provisioning.md) for ownership and recovery boundaries.
|
|
32
32
|
|
|
33
33
|
```ts
|
|
34
|
-
import { createDriveClient } from "@finueva/drive";
|
|
34
|
+
import { createDriveClient, createVerifiedOperationKey } from "@finueva/drive";
|
|
35
35
|
|
|
36
36
|
const drive = createDriveClient({
|
|
37
37
|
baseUrl: "https://drive.example.com",
|
|
@@ -57,13 +57,13 @@ const matches = await drive.searchWorkspaceItems({
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
const completionIdempotencyKey = crypto.randomUUID();
|
|
60
|
-
const uploaded = await drive.
|
|
60
|
+
const uploaded = await drive.uploadVerifiedFile({
|
|
61
61
|
workspaceId: workspace.workspaceId,
|
|
62
|
-
parentItemId: workspace.rootItemId,
|
|
62
|
+
target: { type: "create", parentItemId: workspace.rootItemId, name: file.name },
|
|
63
63
|
source: file, // Blob; File is supported without being required
|
|
64
|
-
displayFilename: file.name,
|
|
65
64
|
mediaType: file.type || "application/octet-stream",
|
|
66
|
-
|
|
65
|
+
protectionClassification: "ordinary",
|
|
66
|
+
idempotencyKey: createVerifiedOperationKey(),
|
|
67
67
|
completionIdempotencyKey,
|
|
68
68
|
onProgress: ({ phase, confirmedByteLength, totalByteLength }) => {
|
|
69
69
|
renderProgress(phase, confirmedByteLength, totalByteLength);
|
|
@@ -90,7 +90,7 @@ const drive = createDriveServerClient({
|
|
|
90
90
|
|
|
91
91
|
Create a client per request when using user authority. A fixed `credential` string is accepted for an explicitly scoped credential, but the SDK does not create, refresh, persist, or infer sessions, cookies, provider tokens, or service authority.
|
|
92
92
|
|
|
93
|
-
The server client exposes
|
|
93
|
+
The server client exposes the current API operations and streaming `downloadItem`. Browser and user clients additionally expose Blob-based `uploadVerifiedFile`. The server client accepts explicit prepare, recover and publish commands rather than Blob orchestration.
|
|
94
94
|
|
|
95
95
|
## Workspace Discovery
|
|
96
96
|
|
|
@@ -117,12 +117,31 @@ These source additions require backend migration `0010`, deployment and SDK rele
|
|
|
117
117
|
|
|
118
118
|
## Operations
|
|
119
119
|
|
|
120
|
-
Methods use the
|
|
121
|
-
|
|
120
|
+
Methods use the current API operation IDs; `downloadItem` and `uploadVerifiedFile` are transport helpers:
|
|
121
|
+
|
|
122
|
+
- `createVisitorGrant`
|
|
123
|
+
- `getVisitorGrant`
|
|
124
|
+
- `listVisitorGrants`
|
|
125
|
+
- `revokeVisitorGrant`
|
|
126
|
+
- `getFileAccessContext`
|
|
127
|
+
- `createEditingSession`
|
|
128
|
+
- `renewEditingSession`
|
|
129
|
+
- `closeEditingSession`
|
|
130
|
+
- `revokeEditingSession`
|
|
131
|
+
- `listOwnedItems`
|
|
132
|
+
- `transferItemOwnership`
|
|
133
|
+
- `archiveItem`
|
|
134
|
+
- `getWorkspaceSharingPolicy`
|
|
135
|
+
- `updateWorkspaceSharingPolicy`
|
|
136
|
+
- `registerItemRecipient`
|
|
137
|
+
- `listItemSharingPeople`
|
|
138
|
+
- `listIncomingShares`
|
|
122
139
|
- `getCurrentWorkspace`
|
|
123
|
-
- `
|
|
140
|
+
- `ensureOrganizationWorkspaceAccess`
|
|
124
141
|
- `listWorkspaceItems`
|
|
142
|
+
- `getCurrentUserWorkspaceUsage`
|
|
125
143
|
- `getWorkspaceUsage`
|
|
144
|
+
- `getCurrentWorkspaceSources`
|
|
126
145
|
- `getItem`
|
|
127
146
|
- `searchWorkspaceItems`
|
|
128
147
|
- `listFolderChildren`
|
|
@@ -135,19 +154,18 @@ Methods use the Native API operation IDs:
|
|
|
135
154
|
- `getItemVersion`
|
|
136
155
|
- `restoreItemVersion`
|
|
137
156
|
- `createDownload`
|
|
138
|
-
- `downloadItem`
|
|
157
|
+
- `downloadItem`
|
|
139
158
|
- `listItemPermissions`
|
|
140
159
|
- `readEffectiveItemPermissions`
|
|
141
160
|
- `createItemPermission`
|
|
161
|
+
- `createInternalItemPermission`
|
|
142
162
|
- `updateItemPermission`
|
|
143
163
|
- `revokeItemPermission`
|
|
144
|
-
- `
|
|
145
|
-
- `
|
|
146
|
-
- `
|
|
147
|
-
- `
|
|
148
|
-
- `
|
|
149
|
-
- `abortUpload`
|
|
150
|
-
- `uploadFile` (high-level orchestration)
|
|
164
|
+
- `revokeInternalItemPermission`
|
|
165
|
+
- `prepareVerifiedTransfer`
|
|
166
|
+
- `publishVerifiedTransfer`
|
|
167
|
+
- `recoverVerifiedTransfer`
|
|
168
|
+
- `uploadVerifiedFile`
|
|
151
169
|
|
|
152
170
|
`getCurrentWorkspace` maps the credential's selected Auth context to the provisioned Drive workspace and canonical managed root. It accepts only an optional `{ signal }` input, never provisions as a side effect, and returns no entitlement, credential, or private persistence fields.
|
|
153
171
|
|
|
@@ -176,21 +194,21 @@ changed evidence discards the preview. These are content validators, not item li
|
|
|
176
194
|
ETags. Visitors remain viewer-only and cannot query private permissions or restore
|
|
177
195
|
cold content.
|
|
178
196
|
|
|
179
|
-
|
|
197
|
+
## Verified transfers
|
|
180
198
|
|
|
181
|
-
|
|
199
|
+
See [the coordinated SDK cutover](../../apps/developer/docs/sdk/verified-transfers.md) for consumer and qualification boundaries.
|
|
182
200
|
|
|
183
|
-
|
|
201
|
+
`uploadVerifiedFile` prepares one immutable whole-object transfer, streams the exact Blob directly to its signed provider URL, and publishes only after Drive independently verifies the retained provider receipt. The ordinary path is prepare → PUT → publish; it does not poll an upload job or read metadata back. The final `published` result includes current item/version identity, exact bytes, full SHA-256, media type, protection classification and provider ETag.
|
|
184
202
|
|
|
185
|
-
|
|
203
|
+
A create target is `{ type: "create", parentItemId, name }`. A replacement is `{ type: "replace", itemId, currentVersionId }`; the explicit current version is the write precondition. Editing clients use the same replacement protocol with their scoped editing credential and audience. `getFileAccessContext` remains available for current file access and editing context.
|
|
186
204
|
|
|
187
|
-
|
|
205
|
+
Generate the prepare key with `createVerifiedOperationKey()`, then retain that key, the completion key and the exact source/intent for retry. The key has a fixed 24-hour replay deadline; new keys permit bounded client clock skew. Retired, expired or incorrectly issued keys return actionable closed reasons. They never authorize silently creating a new operation. An interrupted prepare or publication permits at most one immediate retry for network errors/timeouts. A lost PUT response or immutable create-only `412` proceeds to publication without a caller ETag; Drive must independently prove the exact retained object. A published prepare replay performs no provider PUT. Recovery returns only the current capability for that original admitted operation.
|
|
188
206
|
|
|
189
|
-
|
|
207
|
+
The generic helper supports zero through 1 GiB and incrementally hashes in 256 KiB windows. It does not materialize the whole source as an ArrayBuffer or base64 string. Signed provider headers require whole SHA-256, exact content type and length, `cache-control: no-store, no-transform`, immutable `if-none-match: *`, and the complete encryption tuple when present. Requests omit user authority, cookies and referrers; redirects are refused. The SDK validates the returned canonical receipt against the source and requested classification. An ETag is provider identity, not a substitute for the checksum.
|
|
190
208
|
|
|
191
|
-
|
|
209
|
+
Progress callbacks are immutable and isolated from the operation. Uploading all bytes enters `completing`; success requires the canonical `published` result. Caller cancellation stops further orchestration and reports `aborted`. It does not call a retired abort route or release a capacity hold: the service's bounded retention worker reconciles the original immutable operation.
|
|
192
210
|
|
|
193
|
-
|
|
211
|
+
The old multipart/session write and control API is intentionally absent: `createUpload`, `getUploadStatus`, `createUploadPartDescriptor`, `recordUploadPart`, `completeUpload`, `abortUpload`, `createFileVersionUpload`, `commitFileVersion`, `uploadFile` and `uploadFileVersion`. This is a coordinated breaking cutover. Deploy only with the matching current service and upgraded consumers or an isolated v2 deployment. Historical reads, downloads, editing, grants, visitor access and immutable version metadata remain available; absence of a new accounting authority is never treated as permission to adopt legacy data.
|
|
194
212
|
|
|
195
213
|
## Errors
|
|
196
214
|
|
|
@@ -203,7 +221,7 @@ Failures throw `DriveError`. Known canonical API envelopes preserve their closed
|
|
|
203
221
|
- `aborted`
|
|
204
222
|
- `invalid_response`
|
|
205
223
|
|
|
206
|
-
Messages are fixed. `details` is empty or
|
|
224
|
+
Messages are fixed. `details` is empty or contains exactly one `reason` from `DRIVE_API_ERROR_REASONS`, read through typed `error.details.reason`. Transfer replay failures distinguish `transfer_operation_retired`, `transfer_operation_expired` and `transfer_operation_clock_skew`; callers must not substitute a new key automatically. Unknown details or reasons are `invalid_response`. Every operation validates input before credential lookup or Fetch. Error output never includes response bodies, URLs, credentials, provider exceptions or submitted values. JSON reads have byte, chunk and deadline bounds and are cancelled when rejected.
|
|
207
225
|
|
|
208
226
|
## Base URL
|
|
209
227
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as ListOwnedItemsInput, $t as WorkspaceItemSearchPage, A as DriveVisitorClient, At as TransferItemOwnershipInput, B as GetItemInput, Bt as VisitorChildren, C as DriveEditingClientConfig, Ct as RegisterItemRecipientInput, Et as RestoreItemVersionInput, Ft as UploadFilePhase, G as IncomingSharePage, Gt as VisitorGrantCreation, H as GetVisitorGrantInput, I as FileAccessContext, It as UploadFileProgress, J as ListFolderChildrenInput, K as ItemOwnershipTransfer, Kt as VisitorGrantPage, L as FolderItem, Lt as UploadFileProgressCallback, M as EditingSession, Mt as UpdateItemInput, N as EditingSessionCreation, Ot as RevokeVisitorGrantInput, Pt as UpdateWorkspaceSharingPolicyInput, Q as ListItemVersionsInput, Qt as WorkspaceItemSearchItem, R as FolderPage, Rt as UploadVerifiedFileInput, S as DriveEditingClient, St as RecoverVerifiedTransferInput, Tt as RestoreItemInput, U as GetWorkspaceUsageInput, V as GetItemVersionInput, W as IncomingShareContext, Wt as VisitorGrant, Xt as WorkspaceDiscoveryItem, Y as ListIncomingSharesInput, Yt as VisitorSession, Z as ListItemSharingPeopleInput, Zt as WorkspaceDiscoveryPage, _ as DownloadItemResult, _t as PreparedVerifiedTransfer, a as CollectOwnedItemsInput, at as ManagedItemVersionPage, bt as PublishedVerifiedTransfer, c as CreateEditingSessionInput, ct as ManagedLifecycleItem, en as WorkspaceSharingPolicy, et as ListWorkspaceItemsInput, f as CreateVisitorGrantInput, g as DeleteItemInput, gt as PrepareVerifiedTransferInput, h as CurrentWorkspaceSources, i as ChangeEditingSessionInput, it as ManagedItemVersion, j as DriveVisitorClientConfig, jt as TrashItemInput, kt as SearchWorkspaceItemsInput, lt as OwnedItem, m as CurrentWorkspace, n as ArchiveItemInput, nt as ManagedDownloadRestorePending, o as CollectedOwnedItems, ot as ManagedItemVersionResource, q as ItemSharingPeoplePage, qt as VisitorItem, r as ArchivedItem, rt as ManagedItemMetadata, s as CreateDownloadInput, st as ManagedItemVersionRestoreResult, t as AdmittedVerifiedTransfer, tn as WorkspaceUsage, tt as ManagedDownloadDescriptor, ut as OwnedItemPage, v as DriveClient, vt as ProtectionClassification, wt as RegisteredRecipientDisplay, x as DriveCredentialProvider, y as DriveClientConfig, yt as PublishVerifiedTransferInput, z as GetCurrentWorkspaceInput, zt as VerifiedTransferOperations } from "./contract.js";
|
|
2
2
|
import { n as createDriveVisitorClient, r as createVisitorSessionToken, t as collectOwnedItems } from "./contract2.js";
|
|
3
3
|
//#region src/client.d.ts
|
|
4
4
|
declare function createDriveEditingClient(config: DriveEditingClientConfig): DriveEditingClient;
|
|
5
5
|
declare function createDriveClient(config: DriveClientConfig): DriveClient;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { type
|
|
7
|
+
export { type AdmittedVerifiedTransfer, type ArchiveItemInput, type ArchivedItem, type ChangeEditingSessionInput, type CollectOwnedItemsInput, type CollectedOwnedItems, type CreateDownloadInput, type CreateEditingSessionInput, type CreateVisitorGrantInput, type CurrentWorkspace, type CurrentWorkspaceSources, type DeleteItemInput, type DownloadItemResult, type DriveClient, type DriveClientConfig, type DriveCredentialProvider, type DriveEditingClient, type DriveEditingClientConfig, type DriveVisitorClient, type DriveVisitorClientConfig, type EditingSession, type EditingSessionCreation, type FileAccessContext, type FolderItem, type FolderPage, type GetCurrentWorkspaceInput, type GetItemInput, type GetItemVersionInput, type GetVisitorGrantInput, type GetWorkspaceUsageInput, type IncomingShareContext, type IncomingSharePage, type ItemOwnershipTransfer, type ItemSharingPeoplePage, type ListFolderChildrenInput, type ListIncomingSharesInput, type ListItemSharingPeopleInput, type ListItemVersionsInput, type ListOwnedItemsInput, type ListWorkspaceItemsInput, type ManagedDownloadDescriptor, type ManagedDownloadRestorePending, type ManagedItemMetadata, type ManagedItemVersion, type ManagedItemVersionPage, type ManagedItemVersionResource, type ManagedItemVersionRestoreResult, type ManagedLifecycleItem, type OwnedItem, type OwnedItemPage, type PrepareVerifiedTransferInput, type PreparedVerifiedTransfer, type ProtectionClassification, type PublishVerifiedTransferInput, type PublishedVerifiedTransfer, type RecoverVerifiedTransferInput, type RegisterItemRecipientInput, type RegisteredRecipientDisplay, type RestoreItemInput, type RestoreItemVersionInput, type RevokeVisitorGrantInput, type SearchWorkspaceItemsInput, type TransferItemOwnershipInput, type TrashItemInput, type UpdateItemInput, type UpdateWorkspaceSharingPolicyInput, type UploadFilePhase, type UploadFileProgress, type UploadFileProgressCallback, type UploadVerifiedFileInput, type VerifiedTransferOperations, type VisitorChildren, type VisitorGrant, type VisitorGrantCreation, type VisitorGrantPage, type VisitorItem, type VisitorSession, type WorkspaceDiscoveryItem, type WorkspaceDiscoveryPage, type WorkspaceItemSearchItem, type WorkspaceItemSearchPage, type WorkspaceSharingPolicy, type WorkspaceUsage, collectOwnedItems, createDriveClient, createDriveEditingClient, createDriveVisitorClient, createVisitorSessionToken };
|