@fias/create-fias-plugin 1.5.0 → 1.6.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/package.json
CHANGED
|
@@ -744,6 +744,7 @@ if ('canceled' in picked) {
|
|
|
744
744
|
const granted = await userDocs.list(); // all granted docs
|
|
745
745
|
const { document, content } = await userDocs.get(id, { includeContent: true }); // text docs
|
|
746
746
|
const { url } = await userDocs.getDownloadUrl(id); // binary docs (images, PDFs)
|
|
747
|
+
const { bytes } = await userDocs.getBytes(id); // raw bytes for PROCESSING binary docs
|
|
747
748
|
```
|
|
748
749
|
|
|
749
750
|
**The consent model (what to tell your users):**
|
|
@@ -752,7 +753,9 @@ const { url } = await userDocs.getDownloadUrl(id); // binary docs (images, PDFs)
|
|
|
752
753
|
- After revocation, `get`/`getDownloadUrl` reject with `DOCUMENT_NOT_FOUND` — handle that path gracefully (drop the document from your UI; do not retry in a loop).
|
|
753
754
|
- `proprietary`-sensitivity documents are never grantable (they don't even appear in the picker).
|
|
754
755
|
- Every read is audited by the platform; a new document _version_ is a new documentId, so a re-pick is needed after the user replaces a document.
|
|
755
|
-
-
|
|
756
|
+
- `getDownloadUrl` is for DISPLAY (`<img src>`); your iframe cannot fetch the URL (CSP). To process binary content (parse a PDF, transform an image), use `getBytes(id)` — size-capped at 15 MB (`CONSENTED_DOCUMENT_TOO_LARGE` names the cap; ask the user to open the file manually instead). `getBytes` has a tighter per-minute budget than the rest of the family because it can move megabytes: read sequentially, and surface a rate-limit error rather than retrying in a loop.
|
|
757
|
+
- Revocation behaves differently per method: `getBytes` and `get` re-check the grant on every call, so they start failing immediately. A URL already handed out by `getDownloadUrl` keeps working until it expires (1 hour) — that is the documented contract, not a bug.
|
|
758
|
+
- **Testable in the dev harness (mock mode).** `pick()` grants a small fixture set — a text file, a real PDF, and one deliberately over the 15 MB cap — and `list` / `get` / `getDownloadUrl` / `getBytes` all resolve against it, including the refusals (`BINARY_DOCUMENT` on a text read of a PDF, `CONSENTED_DOCUMENT_TOO_LARGE`, `DOCUMENT_NOT_FOUND`). Run the harness with `FIAS_HARNESS_VAULT_PICK=canceled` to exercise the cancel branch. Not available in the builder preview — `pick()` resolves `{ canceled: true }` there.
|
|
756
759
|
|
|
757
760
|
### `useFiasAIActions()` — Let the platform's Fias AI assistant operate your plugin
|
|
758
761
|
|
|
@@ -744,6 +744,7 @@ if ('canceled' in picked) {
|
|
|
744
744
|
const granted = await userDocs.list(); // all granted docs
|
|
745
745
|
const { document, content } = await userDocs.get(id, { includeContent: true }); // text docs
|
|
746
746
|
const { url } = await userDocs.getDownloadUrl(id); // binary docs (images, PDFs)
|
|
747
|
+
const { bytes } = await userDocs.getBytes(id); // raw bytes for PROCESSING binary docs
|
|
747
748
|
```
|
|
748
749
|
|
|
749
750
|
**The consent model (what to tell your users):**
|
|
@@ -752,7 +753,9 @@ const { url } = await userDocs.getDownloadUrl(id); // binary docs (images, PDFs)
|
|
|
752
753
|
- After revocation, `get`/`getDownloadUrl` reject with `DOCUMENT_NOT_FOUND` — handle that path gracefully (drop the document from your UI; do not retry in a loop).
|
|
753
754
|
- `proprietary`-sensitivity documents are never grantable (they don't even appear in the picker).
|
|
754
755
|
- Every read is audited by the platform; a new document _version_ is a new documentId, so a re-pick is needed after the user replaces a document.
|
|
755
|
-
-
|
|
756
|
+
- `getDownloadUrl` is for DISPLAY (`<img src>`); your iframe cannot fetch the URL (CSP). To process binary content (parse a PDF, transform an image), use `getBytes(id)` — size-capped at 15 MB (`CONSENTED_DOCUMENT_TOO_LARGE` names the cap; ask the user to open the file manually instead). `getBytes` has a tighter per-minute budget than the rest of the family because it can move megabytes: read sequentially, and surface a rate-limit error rather than retrying in a loop.
|
|
757
|
+
- Revocation behaves differently per method: `getBytes` and `get` re-check the grant on every call, so they start failing immediately. A URL already handed out by `getDownloadUrl` keeps working until it expires (1 hour) — that is the documented contract, not a bug.
|
|
758
|
+
- **Testable in the dev harness (mock mode).** `pick()` grants a small fixture set — a text file, a real PDF, and one deliberately over the 15 MB cap — and `list` / `get` / `getDownloadUrl` / `getBytes` all resolve against it, including the refusals (`BINARY_DOCUMENT` on a text read of a PDF, `CONSENTED_DOCUMENT_TOO_LARGE`, `DOCUMENT_NOT_FOUND`). Run the harness with `FIAS_HARNESS_VAULT_PICK=canceled` to exercise the cancel branch. Not available in the builder preview — `pick()` resolves `{ canceled: true }` there.
|
|
756
759
|
|
|
757
760
|
### `useFiasAIActions()` — Let the platform's Fias AI assistant operate your plugin
|
|
758
761
|
|