@endorr/core-sdk 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/README.md +79 -0
- package/dist/client.d.ts +202 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +108 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +28 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +45 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/nextjs.d.ts +44 -0
- package/dist/nextjs.d.ts.map +1 -0
- package/dist/nextjs.js +92 -0
- package/dist/nextjs.js.map +1 -0
- package/dist/oauth.d.ts +64 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +122 -0
- package/dist/oauth.js.map +1 -0
- package/dist/react.d.ts +31 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +73 -0
- package/dist/react.js.map +1 -0
- package/dist/types.d.ts +205 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/upload.d.ts +19 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +35 -0
- package/dist/upload.js.map +1 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @endorr/core-sdk
|
|
2
|
+
|
|
3
|
+
TypeScript client for Endorr Core: Login with Endorr (OAuth 2.0 / OIDC with PKCE), the typed `/v1`
|
|
4
|
+
API (account, organisations, files, folders, permissions, shares), a browser upload helper, and
|
|
5
|
+
Next.js / React glue. Zero runtime dependencies besides `jose`.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @endorr/core-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Login with Endorr in a Next.js app
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// lib/endorr.ts (server only)
|
|
15
|
+
import { createEndorrAuth } from '@endorr/core-sdk/nextjs';
|
|
16
|
+
export const endorrAuth = createEndorrAuth({
|
|
17
|
+
issuer: 'https://auth.endorr.com',
|
|
18
|
+
clientId: 'endorr-suite',
|
|
19
|
+
clientSecret: process.env.ENDORR_CLIENT_SECRET!,
|
|
20
|
+
redirectUri: 'https://cloud.endorr.com/auth/endorr/callback',
|
|
21
|
+
cookieSecret: process.env.ENDORR_COOKIE_SECRET!,
|
|
22
|
+
scope: ['openid', 'profile', 'email', 'offline_access', 'organizations', 'files:read', 'files:write', 'account'],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// app/auth/endorr/login/route.ts
|
|
26
|
+
import { endorrLoginHandler } from '@endorr/core-sdk/nextjs';
|
|
27
|
+
import { endorrAuth } from '@/lib/endorr';
|
|
28
|
+
export const { GET } = endorrLoginHandler(endorrAuth);
|
|
29
|
+
|
|
30
|
+
// app/auth/endorr/callback/route.ts
|
|
31
|
+
import { endorrCallbackHandler } from '@endorr/core-sdk/nextjs';
|
|
32
|
+
import { endorrAuth } from '@/lib/endorr';
|
|
33
|
+
export const { GET } = endorrCallbackHandler(endorrAuth, {
|
|
34
|
+
onSuccess: async ({ tokens, claims, returnTo }) => {
|
|
35
|
+
// claims.sub is the Endorr user id; claims.org_id the selected organisation.
|
|
36
|
+
await sessions.create({ endorrUserId: claims.sub, orgId: claims.org_id, refreshToken: tokens.refresh_token });
|
|
37
|
+
return Response.redirect(new URL(returnTo, 'https://cloud.endorr.com'), 303);
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Send users to `/auth/endorr/login?return_to=/files` and they come back signed in.
|
|
43
|
+
|
|
44
|
+
## Calling the API
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { EndorrClient } from '@endorr/core-sdk';
|
|
48
|
+
const core = new EndorrClient({ baseUrl: 'https://auth.endorr.com', accessToken: () => session.accessToken() });
|
|
49
|
+
|
|
50
|
+
const me = await core.me.get();
|
|
51
|
+
const { folders, files } = await core.folders.children(null); // organisation root
|
|
52
|
+
await core.permissions.grant('folder', folderId, { principal_type: 'team', principal_id: teamId, role: 'editor' });
|
|
53
|
+
const { url } = await core.files.download(fileId);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Errors are `EndorrApiError` with `status`, `code` (`forbidden`, `not_found`, `validation_failed`, …) and `fieldError(path)`.
|
|
57
|
+
|
|
58
|
+
## Uploads from the browser
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { EndorrProvider, useEndorrUpload } from '@endorr/core-sdk/react';
|
|
62
|
+
|
|
63
|
+
function Dropzone() {
|
|
64
|
+
const { upload, progress, uploading } = useEndorrUpload();
|
|
65
|
+
return <input type="file" disabled={uploading} onChange={(e) => e.target.files && upload(e.target.files[0], { folderId })} />;
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Bytes go straight from the browser to storage through a signed URL; Core and your app only see metadata.
|
|
70
|
+
|
|
71
|
+
## Refreshing tokens
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
const next = await endorrAuth.oauth.refresh(storedRefreshToken);
|
|
75
|
+
await sessions.update({ accessToken: next.access_token, refreshToken: next.refresh_token }); // rotating: keep the newest
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
A `401` from the API or `invalid_grant` on refresh means the user disconnected your product in
|
|
79
|
+
Endorr or reuse detection fired: drop your session and send them through login again.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type { Me, EndorrUser, OrganizationSummary, SessionInfo, ConnectedApp, Member, Invite, Team, EndorrFile, EndorrFolder, UploadTicket, DownloadTicket, Grant, ShareLink, StorageUsage, OrgRole, ResourceRole, PrincipalType, StorageClass, ResourceType } from './types';
|
|
2
|
+
export interface ClientConfig {
|
|
3
|
+
/** Core origin, e.g. https://auth.endorr.com */
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
/** Access token, or a function returning the current one (refresh handled by you / the Next.js helper). */
|
|
6
|
+
accessToken?: string | (() => string | Promise<string>);
|
|
7
|
+
/** For same-origin first-party calls with the Core session cookie instead of a token. */
|
|
8
|
+
credentials?: RequestCredentials;
|
|
9
|
+
fetch?: typeof fetch;
|
|
10
|
+
/** Extra headers on every request (e.g. x-request-id propagation). */
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
type Query = Record<string, string | number | boolean | undefined | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Typed client for the Endorr Core /v1 API. Every method throws EndorrApiError with the server's
|
|
16
|
+
* stable `code`, so callers can branch on 403 (needs a role) vs 404 (not yours / gone).
|
|
17
|
+
*/
|
|
18
|
+
export declare class EndorrClient {
|
|
19
|
+
private readonly cfg;
|
|
20
|
+
private readonly base;
|
|
21
|
+
private readonly f;
|
|
22
|
+
constructor(cfg: ClientConfig);
|
|
23
|
+
/** Same client, different token (e.g. after a refresh, or per request in a server handler). */
|
|
24
|
+
withToken(accessToken: string): EndorrClient;
|
|
25
|
+
request<T>(method: string, path: string, opts?: {
|
|
26
|
+
body?: unknown;
|
|
27
|
+
query?: Query;
|
|
28
|
+
}): Promise<T>;
|
|
29
|
+
me: {
|
|
30
|
+
get: () => Promise<Me>;
|
|
31
|
+
updateProfile: (input: {
|
|
32
|
+
name?: string;
|
|
33
|
+
}) => Promise<{
|
|
34
|
+
user: EndorrUser;
|
|
35
|
+
}>;
|
|
36
|
+
changePassword: (input: {
|
|
37
|
+
current_password: string;
|
|
38
|
+
new_password: string;
|
|
39
|
+
}) => Promise<{
|
|
40
|
+
ok: true;
|
|
41
|
+
}>;
|
|
42
|
+
resendVerification: () => Promise<{
|
|
43
|
+
ok: true;
|
|
44
|
+
}>;
|
|
45
|
+
organizations: () => Promise<OrganizationSummary[]>;
|
|
46
|
+
createOrganization: (input: {
|
|
47
|
+
name: string;
|
|
48
|
+
}) => Promise<OrganizationSummary>;
|
|
49
|
+
sessions: {
|
|
50
|
+
list: () => Promise<SessionInfo[]>;
|
|
51
|
+
revoke: (id: string) => Promise<{
|
|
52
|
+
ok: true;
|
|
53
|
+
signed_out_current: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
revokeOthers: () => Promise<{
|
|
56
|
+
ok: true;
|
|
57
|
+
revoked: number;
|
|
58
|
+
}>;
|
|
59
|
+
};
|
|
60
|
+
connectedApps: {
|
|
61
|
+
list: () => Promise<ConnectedApp[]>;
|
|
62
|
+
disconnect: (clientId: string) => Promise<{
|
|
63
|
+
ok: true;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
organizations: {
|
|
68
|
+
get: (id: string) => Promise<OrganizationSummary & {
|
|
69
|
+
created_at: string;
|
|
70
|
+
}>;
|
|
71
|
+
update: (id: string, input: {
|
|
72
|
+
name?: string;
|
|
73
|
+
}) => Promise<OrganizationSummary>;
|
|
74
|
+
members: (id: string) => Promise<Member[]>;
|
|
75
|
+
setMemberRole: (id: string, userId: string, role: OrgRole) => Promise<{
|
|
76
|
+
ok: true;
|
|
77
|
+
}>;
|
|
78
|
+
removeMember: (id: string, userId: string) => Promise<{
|
|
79
|
+
ok: true;
|
|
80
|
+
}>;
|
|
81
|
+
invites: (id: string) => Promise<Invite[]>;
|
|
82
|
+
invite: (id: string, input: {
|
|
83
|
+
email: string;
|
|
84
|
+
role?: "admin" | "member";
|
|
85
|
+
}) => Promise<Invite>;
|
|
86
|
+
revokeInvite: (id: string, inviteId: string) => Promise<{
|
|
87
|
+
ok: true;
|
|
88
|
+
}>;
|
|
89
|
+
teams: (id: string) => Promise<Team[]>;
|
|
90
|
+
createTeam: (id: string, input: {
|
|
91
|
+
name: string;
|
|
92
|
+
}) => Promise<Team>;
|
|
93
|
+
};
|
|
94
|
+
teams: {
|
|
95
|
+
delete: (teamId: string) => Promise<{
|
|
96
|
+
ok: true;
|
|
97
|
+
}>;
|
|
98
|
+
addMember: (teamId: string, userId: string) => Promise<{
|
|
99
|
+
ok: true;
|
|
100
|
+
}>;
|
|
101
|
+
removeMember: (teamId: string, userId: string) => Promise<{
|
|
102
|
+
ok: true;
|
|
103
|
+
}>;
|
|
104
|
+
};
|
|
105
|
+
files: {
|
|
106
|
+
createUpload: (input: {
|
|
107
|
+
name: string;
|
|
108
|
+
mime_type?: string;
|
|
109
|
+
size_bytes?: number;
|
|
110
|
+
folder_id?: string | null;
|
|
111
|
+
organization_id?: string | null;
|
|
112
|
+
storage_class?: StorageClass;
|
|
113
|
+
}) => Promise<UploadTicket>;
|
|
114
|
+
complete: (fileId: string, input?: {
|
|
115
|
+
sha256?: string | null;
|
|
116
|
+
size_bytes?: number | null;
|
|
117
|
+
}) => Promise<EndorrFile>;
|
|
118
|
+
get: (fileId: string) => Promise<EndorrFile>;
|
|
119
|
+
download: (fileId: string) => Promise<DownloadTicket>;
|
|
120
|
+
update: (fileId: string, input: {
|
|
121
|
+
name?: string;
|
|
122
|
+
folder_id?: string | null;
|
|
123
|
+
storage_class?: StorageClass;
|
|
124
|
+
}) => Promise<EndorrFile>;
|
|
125
|
+
keepPermanently: (fileId: string) => Promise<EndorrFile>;
|
|
126
|
+
delete: (fileId: string) => Promise<{
|
|
127
|
+
ok: true;
|
|
128
|
+
}>;
|
|
129
|
+
recent: (limit?: number) => Promise<EndorrFile[]>;
|
|
130
|
+
addRelationship: (sourceFileId: string, input: {
|
|
131
|
+
derived_file_id: string;
|
|
132
|
+
relationship_type: string;
|
|
133
|
+
}) => Promise<{
|
|
134
|
+
id: string;
|
|
135
|
+
source_file_id: string;
|
|
136
|
+
derived_file_id: string;
|
|
137
|
+
relationship_type: string;
|
|
138
|
+
}>;
|
|
139
|
+
};
|
|
140
|
+
folders: {
|
|
141
|
+
create: (input: {
|
|
142
|
+
name: string;
|
|
143
|
+
parent_folder_id?: string | null;
|
|
144
|
+
organization_id?: string | null;
|
|
145
|
+
}) => Promise<EndorrFolder>;
|
|
146
|
+
get: (folderId: string) => Promise<EndorrFolder>;
|
|
147
|
+
/** `null` lists the organisation root. */
|
|
148
|
+
children: (folderId: string | null) => Promise<{
|
|
149
|
+
folder_id: string | null;
|
|
150
|
+
folders: EndorrFolder[];
|
|
151
|
+
files: EndorrFile[];
|
|
152
|
+
}>;
|
|
153
|
+
update: (folderId: string, input: {
|
|
154
|
+
name?: string;
|
|
155
|
+
parent_folder_id?: string | null;
|
|
156
|
+
}) => Promise<EndorrFolder>;
|
|
157
|
+
delete: (folderId: string) => Promise<{
|
|
158
|
+
ok: true;
|
|
159
|
+
}>;
|
|
160
|
+
};
|
|
161
|
+
permissions: {
|
|
162
|
+
list: (type: ResourceType, id: string) => Promise<Grant[]>;
|
|
163
|
+
grant: (type: ResourceType, id: string, input: {
|
|
164
|
+
principal_type: PrincipalType;
|
|
165
|
+
principal_id: string;
|
|
166
|
+
role: ResourceRole;
|
|
167
|
+
}) => Promise<Grant>;
|
|
168
|
+
revoke: (type: ResourceType, id: string, grantId: string) => Promise<{
|
|
169
|
+
ok: true;
|
|
170
|
+
}>;
|
|
171
|
+
};
|
|
172
|
+
shares: {
|
|
173
|
+
create: (type: ResourceType, id: string, input?: {
|
|
174
|
+
expires_in_days?: number;
|
|
175
|
+
max_downloads?: number;
|
|
176
|
+
}) => Promise<ShareLink>;
|
|
177
|
+
revoke: (shareId: string) => Promise<{
|
|
178
|
+
ok: true;
|
|
179
|
+
}>;
|
|
180
|
+
/** Anonymous: resolve a share token from a link landing page. */
|
|
181
|
+
resolve: (token: string) => Promise<{
|
|
182
|
+
type: "file";
|
|
183
|
+
file: EndorrFile;
|
|
184
|
+
download: {
|
|
185
|
+
url: string;
|
|
186
|
+
expires_at: string;
|
|
187
|
+
};
|
|
188
|
+
} | {
|
|
189
|
+
type: "folder";
|
|
190
|
+
folder: {
|
|
191
|
+
id: string;
|
|
192
|
+
name: string;
|
|
193
|
+
};
|
|
194
|
+
files: EndorrFile[];
|
|
195
|
+
}>;
|
|
196
|
+
};
|
|
197
|
+
storage: {
|
|
198
|
+
usage: () => Promise<StorageUsage>;
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
export {};
|
|
202
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,EAAE,EAAE,UAAU,EAAE,mBAAmB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAC9G,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAC/H,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,2GAA2G;IAC3G,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACxD,yFAAyF;IACzF,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;AAE1E;;;GAGG;AACH,qBAAa,YAAY;IAIX,OAAO,CAAC,QAAQ,CAAC,GAAG;IAHhC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAe;gBAEJ,GAAG,EAAE,YAAY;IAK9C,+FAA+F;IAC/F,SAAS,CAAC,WAAW,EAAE,MAAM,GA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;uBAE3G,YAAY,MAAM,MAAM,WAAW,MAAM;gBAAwB,IAAI;;MACpF;IAEF,MAAM;uBACW,YAAY,MAAM,MAAM,UAAS;YAAE,eAAe,CAAC,EAAE,MAAM,CAAC;YAAC,aAAa,CAAC,EAAE,MAAM,CAAA;SAAE;0BAElF,MAAM;gBAAwB,IAAI;;QACpD,iEAAiE;yBAChD,MAAM;kBAA0B,MAAM;kBAAQ,UAAU;sBAAY;gBAAE,GAAG,EAAE,MAAM,CAAC;gBAAC,UAAU,EAAE,MAAM,CAAA;aAAE;;kBAAa,QAAQ;oBAAU;gBAAE,EAAE,EAAE,MAAM,CAAC;gBAAC,IAAI,EAAE,MAAM,CAAA;aAAE;mBAAS,UAAU,EAAE;;MACxM;IAEF,OAAO;;MAEL;CACH"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { throwForResponse } from './errors';
|
|
2
|
+
/**
|
|
3
|
+
* Typed client for the Endorr Core /v1 API. Every method throws EndorrApiError with the server's
|
|
4
|
+
* stable `code`, so callers can branch on 403 (needs a role) vs 404 (not yours / gone).
|
|
5
|
+
*/
|
|
6
|
+
export class EndorrClient {
|
|
7
|
+
cfg;
|
|
8
|
+
base;
|
|
9
|
+
f;
|
|
10
|
+
constructor(cfg) {
|
|
11
|
+
this.cfg = cfg;
|
|
12
|
+
this.base = cfg.baseUrl.replace(/\/$/, '');
|
|
13
|
+
this.f = cfg.fetch ?? fetch;
|
|
14
|
+
}
|
|
15
|
+
/** Same client, different token (e.g. after a refresh, or per request in a server handler). */
|
|
16
|
+
withToken(accessToken) {
|
|
17
|
+
return new EndorrClient({ ...this.cfg, accessToken });
|
|
18
|
+
}
|
|
19
|
+
async request(method, path, opts = {}) {
|
|
20
|
+
const url = new URL(this.base + path);
|
|
21
|
+
for (const [k, v] of Object.entries(opts.query ?? {}))
|
|
22
|
+
if (v !== undefined && v !== null)
|
|
23
|
+
url.searchParams.set(k, String(v));
|
|
24
|
+
const headers = new Headers({ accept: 'application/json', ...(this.cfg.headers ?? {}) });
|
|
25
|
+
const token = typeof this.cfg.accessToken === 'function' ? await this.cfg.accessToken() : this.cfg.accessToken;
|
|
26
|
+
if (token)
|
|
27
|
+
headers.set('authorization', `Bearer ${token}`);
|
|
28
|
+
if (opts.body !== undefined)
|
|
29
|
+
headers.set('content-type', 'application/json');
|
|
30
|
+
const res = await this.f(url, { method, headers, body: opts.body !== undefined ? JSON.stringify(opts.body) : undefined, credentials: this.cfg.credentials });
|
|
31
|
+
if (!res.ok)
|
|
32
|
+
await throwForResponse(res);
|
|
33
|
+
const text = await res.text();
|
|
34
|
+
return (text ? JSON.parse(text) : {});
|
|
35
|
+
}
|
|
36
|
+
/* ── Identity & account (account scope for mutations) ─────────────────────────── */
|
|
37
|
+
me = {
|
|
38
|
+
get: () => this.request('GET', '/v1/me'),
|
|
39
|
+
updateProfile: (input) => this.request('PATCH', '/v1/me', { body: input }),
|
|
40
|
+
changePassword: (input) => this.request('POST', '/v1/me/password', { body: input }),
|
|
41
|
+
resendVerification: () => this.request('POST', '/v1/me/verification/resend', { body: {} }),
|
|
42
|
+
organizations: () => this.request('GET', '/v1/me/organizations').then((r) => r.organizations),
|
|
43
|
+
createOrganization: (input) => this.request('POST', '/v1/me/organizations', { body: input }).then((r) => r.organization),
|
|
44
|
+
sessions: {
|
|
45
|
+
list: () => this.request('GET', '/v1/me/sessions').then((r) => r.sessions),
|
|
46
|
+
revoke: (id) => this.request('DELETE', `/v1/me/sessions/${enc(id)}`),
|
|
47
|
+
revokeOthers: () => this.request('POST', '/v1/me/sessions/revoke-others', { body: {} }),
|
|
48
|
+
},
|
|
49
|
+
connectedApps: {
|
|
50
|
+
list: () => this.request('GET', '/v1/me/connected-apps').then((r) => r.apps),
|
|
51
|
+
disconnect: (clientId) => this.request('DELETE', `/v1/me/connected-apps/${enc(clientId)}`),
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
/* ── Organisations, members, invitations, teams (organizations scope) ──────────── */
|
|
55
|
+
organizations = {
|
|
56
|
+
get: (id) => this.request('GET', `/v1/organizations/${enc(id)}`).then((r) => r.organization),
|
|
57
|
+
update: (id, input) => this.request('PATCH', `/v1/organizations/${enc(id)}`, { body: input }).then((r) => r.organization),
|
|
58
|
+
members: (id) => this.request('GET', `/v1/organizations/${enc(id)}/members`).then((r) => r.members),
|
|
59
|
+
setMemberRole: (id, userId, role) => this.request('PATCH', `/v1/organizations/${enc(id)}/members/${enc(userId)}`, { body: { role } }),
|
|
60
|
+
removeMember: (id, userId) => this.request('DELETE', `/v1/organizations/${enc(id)}/members/${enc(userId)}`),
|
|
61
|
+
invites: (id) => this.request('GET', `/v1/organizations/${enc(id)}/invites`).then((r) => r.invites),
|
|
62
|
+
invite: (id, input) => this.request('POST', `/v1/organizations/${enc(id)}/invites`, { body: input }).then((r) => r.invite),
|
|
63
|
+
revokeInvite: (id, inviteId) => this.request('DELETE', `/v1/organizations/${enc(id)}/invites/${enc(inviteId)}`),
|
|
64
|
+
teams: (id) => this.request('GET', `/v1/organizations/${enc(id)}/teams`).then((r) => r.teams),
|
|
65
|
+
createTeam: (id, input) => this.request('POST', `/v1/organizations/${enc(id)}/teams`, { body: input }).then((r) => r.team),
|
|
66
|
+
};
|
|
67
|
+
teams = {
|
|
68
|
+
delete: (teamId) => this.request('DELETE', `/v1/teams/${enc(teamId)}`),
|
|
69
|
+
addMember: (teamId, userId) => this.request('PUT', `/v1/teams/${enc(teamId)}/members/${enc(userId)}`, { body: {} }),
|
|
70
|
+
removeMember: (teamId, userId) => this.request('DELETE', `/v1/teams/${enc(teamId)}/members/${enc(userId)}`),
|
|
71
|
+
};
|
|
72
|
+
/* ── Files (files:read / files:write) ─────────────────────────────────────────── */
|
|
73
|
+
files = {
|
|
74
|
+
createUpload: (input) => this.request('POST', '/v1/files/uploads', { body: input }),
|
|
75
|
+
complete: (fileId, input = {}) => this.request('POST', `/v1/files/${enc(fileId)}/complete`, { body: input }).then((r) => r.file),
|
|
76
|
+
get: (fileId) => this.request('GET', `/v1/files/${enc(fileId)}`).then((r) => r.file),
|
|
77
|
+
download: (fileId) => this.request('POST', `/v1/files/${enc(fileId)}/download`, { body: {} }),
|
|
78
|
+
update: (fileId, input) => this.request('PATCH', `/v1/files/${enc(fileId)}`, { body: input }).then((r) => r.file),
|
|
79
|
+
keepPermanently: (fileId) => this.files.update(fileId, { storage_class: 'permanent' }),
|
|
80
|
+
delete: (fileId) => this.request('DELETE', `/v1/files/${enc(fileId)}`),
|
|
81
|
+
recent: (limit = 20) => this.request('GET', '/v1/files/recent', { query: { limit } }).then((r) => r.files),
|
|
82
|
+
addRelationship: (sourceFileId, input) => this.request('POST', `/v1/files/${enc(sourceFileId)}/relationships`, { body: input }).then((r) => r.relationship),
|
|
83
|
+
};
|
|
84
|
+
folders = {
|
|
85
|
+
create: (input) => this.request('POST', '/v1/folders', { body: input }).then((r) => r.folder),
|
|
86
|
+
get: (folderId) => this.request('GET', `/v1/folders/${enc(folderId)}`).then((r) => r.folder),
|
|
87
|
+
/** `null` lists the organisation root. */
|
|
88
|
+
children: (folderId) => this.request('GET', `/v1/folders/${folderId ? enc(folderId) : 'root'}/children`),
|
|
89
|
+
update: (folderId, input) => this.request('PATCH', `/v1/folders/${enc(folderId)}`, { body: input }).then((r) => r.folder),
|
|
90
|
+
delete: (folderId) => this.request('DELETE', `/v1/folders/${enc(folderId)}`),
|
|
91
|
+
};
|
|
92
|
+
permissions = {
|
|
93
|
+
list: (type, id) => this.request('GET', `/v1/${type}s/${enc(id)}/permissions`).then((r) => r.grants),
|
|
94
|
+
grant: (type, id, input) => this.request('PUT', `/v1/${type}s/${enc(id)}/permissions`, { body: input }).then((r) => r.grant),
|
|
95
|
+
revoke: (type, id, grantId) => this.request('DELETE', `/v1/${type}s/${enc(id)}/permissions/${enc(grantId)}`),
|
|
96
|
+
};
|
|
97
|
+
shares = {
|
|
98
|
+
create: (type, id, input = {}) => this.request('POST', `/v1/${type}s/${enc(id)}/shares`, { body: input }).then((r) => r.share),
|
|
99
|
+
revoke: (shareId) => this.request('DELETE', `/v1/shares/${enc(shareId)}`),
|
|
100
|
+
/** Anonymous: resolve a share token from a link landing page. */
|
|
101
|
+
resolve: (token) => this.request('GET', `/v1/shares/resolve/${enc(token)}`),
|
|
102
|
+
};
|
|
103
|
+
storage = {
|
|
104
|
+
usage: () => this.request('GET', '/v1/storage/usage'),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function enc(s) { return encodeURIComponent(s); }
|
|
108
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAgB5C;;;GAGG;AACH,MAAM,OAAO,YAAY;IAIM;IAHZ,IAAI,CAAS;IACb,CAAC,CAAe;IAEjC,YAA6B,GAAiB;QAAjB,QAAG,GAAH,GAAG,CAAc;QAC5C,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC;IAC9B,CAAC;IAED,+FAA+F;IAC/F,SAAS,CAAC,WAAmB;QAC3B,OAAO,IAAI,YAAY,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,OAAO,CAAI,MAAc,EAAE,IAAY,EAAE,OAA0C,EAAE;QACzF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;QACtC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAAE,IAAI,CAAC,KAAK,SAAS,IAA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GAAG,CAAC,CAAS,IAAI,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Error returned by the Core API: `code` is stable and documented, `details` carries field errors for 422. */
|
|
2
|
+
export declare class EndorrApiError extends Error {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
readonly code: string;
|
|
5
|
+
readonly details?: {
|
|
6
|
+
path?: string;
|
|
7
|
+
message: string;
|
|
8
|
+
}[] | undefined;
|
|
9
|
+
readonly requestId?: string | undefined;
|
|
10
|
+
constructor(status: number, code: string, message: string, details?: {
|
|
11
|
+
path?: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}[] | undefined, requestId?: string | undefined);
|
|
14
|
+
/** Field-level message for 422 responses. */
|
|
15
|
+
fieldError(path: string): string | undefined;
|
|
16
|
+
get isUnauthorized(): boolean;
|
|
17
|
+
get isForbidden(): boolean;
|
|
18
|
+
get isNotFound(): boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Error from the OAuth token/authorization endpoints (RFC 6749 §5.2). */
|
|
21
|
+
export declare class EndorrOAuthError extends Error {
|
|
22
|
+
readonly error: string;
|
|
23
|
+
readonly description?: string | undefined;
|
|
24
|
+
readonly status?: number | undefined;
|
|
25
|
+
constructor(error: string, description?: string | undefined, status?: number | undefined);
|
|
26
|
+
}
|
|
27
|
+
export declare function throwForResponse(res: Response): Promise<never>;
|
|
28
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,qBAAa,cAAe,SAAQ,KAAK;aAErB,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,MAAM;aAEZ,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE;aAC9C,SAAS,CAAC,EAAE,MAAM;gBAJlB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,YAAA,EAC9C,SAAS,CAAC,EAAE,MAAM,YAAA;IAKpC,6CAA6C;IAC7C,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAG5C,IAAI,cAAc,YAAkC;IACpD,IAAI,WAAW,YAAkC;IACjD,IAAI,UAAU,YAAkC;CACjD;AAED,0EAA0E;AAC1E,qBAAa,gBAAiB,SAAQ,KAAK;aACb,KAAK,EAAE,MAAM;aAAkB,WAAW,CAAC,EAAE,MAAM;aAAkB,MAAM,CAAC,EAAE,MAAM;gBAApF,KAAK,EAAE,MAAM,EAAkB,WAAW,CAAC,EAAE,MAAM,YAAA,EAAkB,MAAM,CAAC,EAAE,MAAM,YAAA;CAIjH;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAKpE"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Error returned by the Core API: `code` is stable and documented, `details` carries field errors for 422. */
|
|
2
|
+
export class EndorrApiError extends Error {
|
|
3
|
+
status;
|
|
4
|
+
code;
|
|
5
|
+
details;
|
|
6
|
+
requestId;
|
|
7
|
+
constructor(status, code, message, details, requestId) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.status = status;
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.details = details;
|
|
12
|
+
this.requestId = requestId;
|
|
13
|
+
this.name = 'EndorrApiError';
|
|
14
|
+
}
|
|
15
|
+
/** Field-level message for 422 responses. */
|
|
16
|
+
fieldError(path) {
|
|
17
|
+
return this.details?.find((d) => d.path === path)?.message;
|
|
18
|
+
}
|
|
19
|
+
get isUnauthorized() { return this.status === 401; }
|
|
20
|
+
get isForbidden() { return this.status === 403; }
|
|
21
|
+
get isNotFound() { return this.status === 404; }
|
|
22
|
+
}
|
|
23
|
+
/** Error from the OAuth token/authorization endpoints (RFC 6749 §5.2). */
|
|
24
|
+
export class EndorrOAuthError extends Error {
|
|
25
|
+
error;
|
|
26
|
+
description;
|
|
27
|
+
status;
|
|
28
|
+
constructor(error, description, status) {
|
|
29
|
+
super(description ? `${error}: ${description}` : error);
|
|
30
|
+
this.error = error;
|
|
31
|
+
this.description = description;
|
|
32
|
+
this.status = status;
|
|
33
|
+
this.name = 'EndorrOAuthError';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export async function throwForResponse(res) {
|
|
37
|
+
let body = null;
|
|
38
|
+
try {
|
|
39
|
+
body = await res.json();
|
|
40
|
+
}
|
|
41
|
+
catch { /* not json */ }
|
|
42
|
+
const e = body?.error;
|
|
43
|
+
throw new EndorrApiError(res.status, e?.code ?? 'http_error', e?.message ?? `Endorr Core answered ${res.status}`, e?.details, e?.request_id ?? res.headers.get('x-request-id') ?? undefined);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,MAAM,OAAO,cAAe,SAAQ,KAAK;IAErB;IACA;IAEA;IACA;IALlB,YACkB,MAAc,EACd,IAAY,EAC5B,OAAe,EACC,OAA8C,EAC9C,SAAkB;QAElC,KAAK,CAAC,OAAO,CAAC,CAAC;QANC,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QAEZ,YAAO,GAAP,OAAO,CAAuC;QAC9C,cAAS,GAAT,SAAS,CAAS;QAGlC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;IACD,6CAA6C;IAC7C,UAAU,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EAAE,UAAU,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,SAAS,CAAC,CAAC;AAC/L,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { EndorrOAuth, generatePkce, randomState, DEFAULT_SCOPES } from './oauth';
|
|
2
|
+
export type { OAuthConfig, AuthorizationUrlOptions } from './oauth';
|
|
3
|
+
export { EndorrClient } from './client';
|
|
4
|
+
export type { ClientConfig } from './client';
|
|
5
|
+
export { uploadFile } from './upload';
|
|
6
|
+
export type { UploadOptions } from './upload';
|
|
7
|
+
export { EndorrApiError, EndorrOAuthError } from './errors';
|
|
8
|
+
export * from './types';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACjF,YAAY,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5D,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { EndorrOAuth, generatePkce, randomState, DEFAULT_SCOPES } from './oauth';
|
|
2
|
+
export { EndorrClient } from './client';
|
|
3
|
+
export { uploadFile } from './upload';
|
|
4
|
+
export { EndorrApiError, EndorrOAuthError } from './errors';
|
|
5
|
+
export * from './types';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5D,cAAc,SAAS,CAAC"}
|
package/dist/nextjs.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EndorrOAuth, type OAuthConfig } from './oauth';
|
|
2
|
+
import type { IdTokenClaims, TokenSet } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Next.js (App Router) helpers for the Login with Endorr dance.
|
|
5
|
+
*
|
|
6
|
+
* // app/auth/endorr/login/route.ts
|
|
7
|
+
* export const { GET } = endorrLoginHandler(auth);
|
|
8
|
+
* // app/auth/endorr/callback/route.ts
|
|
9
|
+
* export const { GET } = endorrCallbackHandler(auth, { onSuccess: async ({ tokens, claims }) => { …create your session…; return NextResponse.redirect('/') } });
|
|
10
|
+
*
|
|
11
|
+
* The pending login (state, PKCE verifier, nonce, return path) travels in one short-lived,
|
|
12
|
+
* HttpOnly, HMAC-signed cookie, so no server-side store is needed.
|
|
13
|
+
*/
|
|
14
|
+
export interface NextAuthConfig extends OAuthConfig {
|
|
15
|
+
/** 32+ byte secret used to sign the transient login cookie. */
|
|
16
|
+
cookieSecret: string;
|
|
17
|
+
cookieName?: string;
|
|
18
|
+
/** Force Secure cookies (defaults to true when redirectUri is https). */
|
|
19
|
+
secureCookies?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface CallbackSuccess {
|
|
22
|
+
tokens: TokenSet;
|
|
23
|
+
claims: IdTokenClaims;
|
|
24
|
+
returnTo: string;
|
|
25
|
+
request: Request;
|
|
26
|
+
}
|
|
27
|
+
export interface CallbackHandlers {
|
|
28
|
+
onSuccess: (ctx: CallbackSuccess) => Promise<Response> | Response;
|
|
29
|
+
onError?: (error: Error, request: Request) => Promise<Response> | Response;
|
|
30
|
+
}
|
|
31
|
+
export declare function createEndorrAuth(cfg: NextAuthConfig): {
|
|
32
|
+
oauth: EndorrOAuth;
|
|
33
|
+
login: (req: Request) => Promise<Response>;
|
|
34
|
+
callback: (req: Request, handlers: CallbackHandlers) => Promise<Response>;
|
|
35
|
+
};
|
|
36
|
+
export type EndorrAuth = ReturnType<typeof createEndorrAuth>;
|
|
37
|
+
/** Route-file sugar: `export const { GET } = endorrLoginHandler(auth)`. */
|
|
38
|
+
export declare function endorrLoginHandler(auth: EndorrAuth): {
|
|
39
|
+
GET: (req: Request) => Promise<Response>;
|
|
40
|
+
};
|
|
41
|
+
export declare function endorrCallbackHandler(auth: EndorrAuth, handlers: CallbackHandlers): {
|
|
42
|
+
GET: (req: Request) => Promise<Response>;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=nextjs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextjs.d.ts","sourceRoot":"","sources":["../src/nextjs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA6B,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AACnF,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,+DAA+D;IAC/D,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAwCD,MAAM,WAAW,eAAe;IAAG,MAAM,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,aAAa,C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