@finueva/drive 0.1.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 +8 -0
- package/LICENSE +15 -0
- package/README.md +91 -0
- package/THIRD_PARTY_NOTICES.md +55 -0
- package/dist/client.d.ts +5 -0
- package/dist/client.js +1337 -0
- package/dist/contract.d.ts +2101 -0
- package/dist/core.d.ts +31 -0
- package/dist/core.js +53 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1337 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +1344 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +0 -0
- package/package.json +72 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# @finueva/drive
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 80bb160: Add the first Local Experimental managed-folder and permission client for browsers, Cloudflare Workers, and Node.js.
|
|
8
|
+
- 2a61a60: Add managed upload quota reservation and release operations for browser, Worker, and Node clients.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Finueva
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# `@finueva/drive`
|
|
2
|
+
|
|
3
|
+
The public TypeScript client for Finueva Drive. The initial API is Local Experimental and is not yet published to npm.
|
|
4
|
+
|
|
5
|
+
The package is ESM-only. Node.js 22 is the exact minimum; package CI qualifies Node.js 22 and 24. Modern browsers and Cloudflare Workers use Web Fetch, Streams, URL, and AbortSignal.
|
|
6
|
+
|
|
7
|
+
## Exports
|
|
8
|
+
|
|
9
|
+
| Import | Runtime |
|
|
10
|
+
| ----------------------- | ------------------------------------------------------ |
|
|
11
|
+
| `@finueva/drive` | Browser-safe client factory, errors, and curated types |
|
|
12
|
+
| `@finueva/drive/client` | Browser-safe client factory |
|
|
13
|
+
| `@finueva/drive/server` | Request-scoped Worker and Node client factory |
|
|
14
|
+
| `@finueva/drive/core` | Reviewed error values only |
|
|
15
|
+
| `@finueva/drive/types` | Curated folder, permission, and upload quota types |
|
|
16
|
+
|
|
17
|
+
## Browser
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { createDriveClient } from "@finueva/drive";
|
|
21
|
+
|
|
22
|
+
const drive = createDriveClient({
|
|
23
|
+
baseUrl: "https://drive.example.com",
|
|
24
|
+
getCredential: ({ signal }) => auth.getDriveCredential({ signal }),
|
|
25
|
+
timeoutMilliseconds: 30_000,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const page = await drive.listFolderChildren({
|
|
29
|
+
workspaceId,
|
|
30
|
+
itemId,
|
|
31
|
+
limit: 50,
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The provider runs once for every request. The SDK sends its result only as `Authorization: Bearer`, always sets `credentials: "omit"` and `cache: "no-store"`, and never reads cookies. Configuration does not accept default headers. Credential acquisition, Fetch, and response handling share one bounded request deadline: 30 seconds by default, configurable from 1 millisecond through 120 seconds.
|
|
36
|
+
|
|
37
|
+
## Worker And Node
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { createDriveServerClient } from "@finueva/drive/server";
|
|
41
|
+
|
|
42
|
+
const drive = createDriveServerClient({
|
|
43
|
+
baseUrl: "https://drive.example.com",
|
|
44
|
+
credential: ({ signal }) => requestCredential(request, signal),
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
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.
|
|
49
|
+
|
|
50
|
+
## Operations
|
|
51
|
+
|
|
52
|
+
Methods use the Native API operation IDs:
|
|
53
|
+
|
|
54
|
+
- `listFolderChildren`
|
|
55
|
+
- `createFolder`
|
|
56
|
+
- `listItemPermissions`
|
|
57
|
+
- `readEffectiveItemPermissions`
|
|
58
|
+
- `createItemPermission`
|
|
59
|
+
- `updateItemPermission`
|
|
60
|
+
- `revokeItemPermission`
|
|
61
|
+
- `createUpload`
|
|
62
|
+
- `abortUpload`
|
|
63
|
+
|
|
64
|
+
Every mutation requires the API's explicit idempotency key when the operation defines one and, for grants, a precondition validator. Mutations are never retried automatically. Sparse updates omit `undefined` properties and preserve explicit `null` expiry.
|
|
65
|
+
|
|
66
|
+
Successful calls return `{ data, status, requestId, validators }`. A successful response must carry one valid `X-Request-ID`; canonical API errors must carry the same request ID in their header and body. Any missing, malformed, or mismatched value is an `invalid_response`. The only exposed validators are `etag`, `permissionCollectionEtag`, and `permissionGrantEtag`.
|
|
67
|
+
|
|
68
|
+
`createUpload` and `abortUpload` only reserve and release managed upload quota. They return reservation metadata and no transfer URL, capability, provider data, or file bytes. Upload-byte transfer, completion, and file-byte helpers remain excluded until issue #81.
|
|
69
|
+
|
|
70
|
+
## Errors
|
|
71
|
+
|
|
72
|
+
Failures throw `DriveError`. Known canonical API envelopes preserve their closed API code, HTTP status, and request ID. SDK-owned codes are:
|
|
73
|
+
|
|
74
|
+
- `credential_unavailable`
|
|
75
|
+
- `invalid_input`
|
|
76
|
+
- `network_error`
|
|
77
|
+
- `timeout`
|
|
78
|
+
- `aborted`
|
|
79
|
+
- `invalid_response`
|
|
80
|
+
|
|
81
|
+
Messages are fixed and details are always empty. Every operation input is runtime-validated before credential lookup or Fetch. Response bodies, URLs, credentials, provider exceptions, submitted values, and raw thrown values are never included. JSON response reads have byte, chunk, and elapsed-time bounds and are cancelled when rejected.
|
|
82
|
+
|
|
83
|
+
## Base URL
|
|
84
|
+
|
|
85
|
+
Use an absolute HTTPS URL. Plain HTTP is accepted only for `localhost`, `127.0.0.1`, or `[::1]`. Credentials, query strings, fragments, and other protocols are rejected.
|
|
86
|
+
|
|
87
|
+
## Release Status
|
|
88
|
+
|
|
89
|
+
This release prepares `0.1.0` from the reviewed minor Changesets. Qualification builds the exact compiled Drive Worker, obtains `/api/v1/openapi.json` through Miniflare, checks generated types byte-for-byte, packs the package, and installs that tarball into clean external projects with lifecycle scripts disabled.
|
|
90
|
+
|
|
91
|
+
`@finueva/drive` does not yet exist on npm. The source repository is private, so public provenance is unavailable. First publication must follow ADR 0016's exact retained-artifact maintainer-2FA bootstrap. The protected OIDC workflow stages only later releases after npm trusts the exact workflow; it has no npm token and cannot bootstrap the package itself.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
`@finueva/drive` bundles runtime code from these packages.
|
|
4
|
+
|
|
5
|
+
## openapi-fetch 0.17.0
|
|
6
|
+
|
|
7
|
+
Source: https://github.com/openapi-ts/openapi-typescript
|
|
8
|
+
|
|
9
|
+
MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2023 Drew Powers
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
|
|
31
|
+
## ufo 1.6.4
|
|
32
|
+
|
|
33
|
+
Source: https://github.com/unjs/ufo
|
|
34
|
+
|
|
35
|
+
MIT License
|
|
36
|
+
|
|
37
|
+
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
|
38
|
+
|
|
39
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
40
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
41
|
+
in the Software without restriction, including without limitation the rights
|
|
42
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
43
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
44
|
+
furnished to do so, subject to the following conditions:
|
|
45
|
+
|
|
46
|
+
The above copyright notice and this permission notice shall be included in all
|
|
47
|
+
copies or substantial portions of the Software.
|
|
48
|
+
|
|
49
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
50
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
51
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
52
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
53
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
54
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
55
|
+
SOFTWARE.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { O as UploadQuotaReservation, T as ReservedUploadQuota, a as CreateUploadInput, l as DriveCredentialProvider, n as AbortedUploadQuota, o as DriveClient, s as DriveClientConfig, t as AbortUploadInput } from "./contract.js";
|
|
2
|
+
//#region src/client.d.ts
|
|
3
|
+
declare function createDriveClient(config: DriveClientConfig): DriveClient;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { type AbortUploadInput, type AbortedUploadQuota, type CreateUploadInput, type DriveClient, type DriveClientConfig, type DriveCredentialProvider, type ReservedUploadQuota, type UploadQuotaReservation, createDriveClient };
|