Publish the SDK under the Gnosys Labs npm organization
Hop-State: A_06FPAHQDE2YC3AQWGQGNQN0 Hop-Proposal: R_06FPAHP3Q77W9A2D641H4SR Hop-Task: T_06FPAH33SHXWSFZ2V45R2Z8 Hop-Attempt: AT_06FPAH33SGNKEM8JTS1KX70
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
# `@stuffbox/sdk`
|
||||
# `@gnosyslabs/stuffbox-sdk`
|
||||
|
||||
The official TypeScript SDK for connecting applications to Stuffbox, a user-owned media library. The package includes a framework-neutral client, shared API types, PKCE helpers, typed errors, and optional React upload helpers.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install @stuffbox/sdk
|
||||
npm install @gnosyslabs/stuffbox-sdk
|
||||
```
|
||||
|
||||
The core entry point has no runtime dependencies. If you use `@stuffbox/sdk/react`, install React 18.2 or React 19 in your application.
|
||||
The core entry point has no runtime dependencies. If you use `@gnosyslabs/stuffbox-sdk/react`, install React 18.2 or React 19 in your application.
|
||||
|
||||
## Connect a user
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
StuffboxClient,
|
||||
createPkcePair,
|
||||
generateState,
|
||||
} from "@stuffbox/sdk";
|
||||
} from "@gnosyslabs/stuffbox-sdk";
|
||||
|
||||
const stuffbox = new StuffboxClient({ baseUrl: "https://stuffbox.xyz" });
|
||||
const pkce = await createPkcePair();
|
||||
@@ -85,7 +85,7 @@ Request only the permissions your feature uses: `assets:read`, `assets:write`, a
|
||||
The optional React entry point exports `useStuffboxUpload`, `uploadFile`, and their types:
|
||||
|
||||
```tsx
|
||||
import { useStuffboxUpload, type UploadTransport } from "@stuffbox/sdk/react";
|
||||
import { useStuffboxUpload, type UploadTransport } from "@gnosyslabs/stuffbox-sdk/react";
|
||||
|
||||
const transport: UploadTransport = {
|
||||
async createUpload(input, options) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Third-Party Notices
|
||||
|
||||
`@stuffbox/sdk` does not bundle third-party source code.
|
||||
`@gnosyslabs/stuffbox-sdk` does not bundle third-party source code.
|
||||
|
||||
React is an optional peer dependency of the `@stuffbox/sdk/react` entry point and is distributed separately under its own license. Dependency licenses and notices remain with their respective packages.
|
||||
React is an optional peer dependency of the `@gnosyslabs/stuffbox-sdk/react` entry point and is distributed separately under its own license. Dependency licenses and notices remain with their respective packages.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Integration examples
|
||||
|
||||
- [`server-connection.ts`](server-connection.ts) shows PKCE connection, authorization-code exchange, and gallery pagination on an application server.
|
||||
- [`react-upload.tsx`](react-upload.tsx) shows a native-feeling upload control using `@stuffbox/sdk/react` and app-owned same-origin endpoints.
|
||||
- [`react-upload.tsx`](react-upload.tsx) shows a native-feeling upload control using `@gnosyslabs/stuffbox-sdk/react` and app-owned same-origin endpoints.
|
||||
|
||||
The same-origin endpoints in the React example are intentional. Keep Stuffbox access and refresh tokens on your server; return only the short-lived upload session or completed asset to browser code.
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { ChangeEvent } from "react";
|
||||
import {
|
||||
useStuffboxUpload,
|
||||
type UploadTransport,
|
||||
} from "@stuffbox/sdk/react";
|
||||
} from "@gnosyslabs/stuffbox-sdk/react";
|
||||
|
||||
async function responseJson<T>(response: Response): Promise<T> {
|
||||
if (!response.ok) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
type Asset,
|
||||
type StuffboxScope,
|
||||
type TokenSet,
|
||||
} from "@stuffbox/sdk";
|
||||
} from "@gnosyslabs/stuffbox-sdk";
|
||||
|
||||
const stuffbox = new StuffboxClient({ baseUrl: "https://stuffbox.xyz" });
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@stuffbox/sdk",
|
||||
"name": "@gnosyslabs/stuffbox-sdk",
|
||||
"version": "0.1.0",
|
||||
"description": "Official Stuffbox SDK with framework-neutral APIs and optional React upload helpers",
|
||||
"packageManager": "pnpm@10.30.3",
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
"noEmit": true,
|
||||
"rootDir": ".",
|
||||
"paths": {
|
||||
"@stuffbox/sdk": ["./src/index.ts"],
|
||||
"@stuffbox/sdk/react": ["./src/react/index.ts"]
|
||||
"@gnosyslabs/stuffbox-sdk": ["./src/index.ts"],
|
||||
"@gnosyslabs/stuffbox-sdk/react": ["./src/react/index.ts"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.ts", "examples/**/*.ts", "examples/**/*.tsx"]
|
||||
|
||||
Reference in New Issue
Block a user