@portaidentity/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 +224 -0
- package/dist/agent.d.ts +42 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +146 -0
- package/dist/agent.js.map +1 -0
- package/dist/auth/cli-auth.d.ts +83 -0
- package/dist/auth/cli-auth.d.ts.map +1 -0
- package/dist/auth/cli-auth.js +188 -0
- package/dist/auth/cli-auth.js.map +1 -0
- package/dist/auth/client-credentials-auth.d.ts +54 -0
- package/dist/auth/client-credentials-auth.d.ts.map +1 -0
- package/dist/auth/client-credentials-auth.js +147 -0
- package/dist/auth/client-credentials-auth.js.map +1 -0
- package/dist/auth/index.d.ts +20 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +16 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/token-auth.d.ts +40 -0
- package/dist/auth/token-auth.d.ts.map +1 -0
- package/dist/auth/token-auth.js +44 -0
- package/dist/auth/token-auth.js.map +1 -0
- package/dist/auth/types.d.ts +28 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +11 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/browser.d.ts +12 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +12 -0
- package/dist/browser.js.map +1 -0
- package/dist/client.d.ts +52 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +52 -0
- package/dist/client.js.map +1 -0
- package/dist/domains/applications.d.ts +23 -0
- package/dist/domains/applications.d.ts.map +1 -0
- package/dist/domains/applications.js +59 -0
- package/dist/domains/applications.js.map +1 -0
- package/dist/domains/audit.d.ts +13 -0
- package/dist/domains/audit.d.ts.map +1 -0
- package/dist/domains/audit.js +19 -0
- package/dist/domains/audit.js.map +1 -0
- package/dist/domains/branding.d.ts +16 -0
- package/dist/domains/branding.d.ts.map +1 -0
- package/dist/domains/branding.js +29 -0
- package/dist/domains/branding.js.map +1 -0
- package/dist/domains/bulk.d.ts +12 -0
- package/dist/domains/bulk.d.ts.map +1 -0
- package/dist/domains/bulk.js +14 -0
- package/dist/domains/bulk.js.map +1 -0
- package/dist/domains/clients.d.ts +22 -0
- package/dist/domains/clients.d.ts.map +1 -0
- package/dist/domains/clients.js +55 -0
- package/dist/domains/clients.js.map +1 -0
- package/dist/domains/config.d.ts +14 -0
- package/dist/domains/config.d.ts.map +1 -0
- package/dist/domains/config.js +23 -0
- package/dist/domains/config.js.map +1 -0
- package/dist/domains/custom-claims.d.ts +17 -0
- package/dist/domains/custom-claims.d.ts.map +1 -0
- package/dist/domains/custom-claims.js +35 -0
- package/dist/domains/custom-claims.js.map +1 -0
- package/dist/domains/exports.d.ts +12 -0
- package/dist/domains/exports.d.ts.map +1 -0
- package/dist/domains/exports.js +20 -0
- package/dist/domains/exports.js.map +1 -0
- package/dist/domains/helpers.d.ts +27 -0
- package/dist/domains/helpers.d.ts.map +1 -0
- package/dist/domains/helpers.js +46 -0
- package/dist/domains/helpers.js.map +1 -0
- package/dist/domains/imports.d.ts +12 -0
- package/dist/domains/imports.d.ts.map +1 -0
- package/dist/domains/imports.js +14 -0
- package/dist/domains/imports.js.map +1 -0
- package/dist/domains/index.d.ts +45 -0
- package/dist/domains/index.d.ts.map +1 -0
- package/dist/domains/index.js +46 -0
- package/dist/domains/index.js.map +1 -0
- package/dist/domains/keys.d.ts +14 -0
- package/dist/domains/keys.d.ts.map +1 -0
- package/dist/domains/keys.js +23 -0
- package/dist/domains/keys.js.map +1 -0
- package/dist/domains/organizations.d.ts +33 -0
- package/dist/domains/organizations.d.ts.map +1 -0
- package/dist/domains/organizations.js +69 -0
- package/dist/domains/organizations.js.map +1 -0
- package/dist/domains/permissions.d.ts +16 -0
- package/dist/domains/permissions.d.ts.map +1 -0
- package/dist/domains/permissions.js +31 -0
- package/dist/domains/permissions.js.map +1 -0
- package/dist/domains/roles.d.ts +19 -0
- package/dist/domains/roles.d.ts.map +1 -0
- package/dist/domains/roles.js +41 -0
- package/dist/domains/roles.js.map +1 -0
- package/dist/domains/sessions.d.ts +17 -0
- package/dist/domains/sessions.d.ts.map +1 -0
- package/dist/domains/sessions.js +28 -0
- package/dist/domains/sessions.js.map +1 -0
- package/dist/domains/stats.d.ts +12 -0
- package/dist/domains/stats.d.ts.map +1 -0
- package/dist/domains/stats.js +14 -0
- package/dist/domains/stats.js.map +1 -0
- package/dist/domains/two-factor.d.ts +14 -0
- package/dist/domains/two-factor.d.ts.map +1 -0
- package/dist/domains/two-factor.js +24 -0
- package/dist/domains/two-factor.js.map +1 -0
- package/dist/domains/user-claims.d.ts +14 -0
- package/dist/domains/user-claims.d.ts.map +1 -0
- package/dist/domains/user-claims.js +24 -0
- package/dist/domains/user-claims.js.map +1 -0
- package/dist/domains/user-roles.d.ts +14 -0
- package/dist/domains/user-roles.d.ts.map +1 -0
- package/dist/domains/user-roles.js +24 -0
- package/dist/domains/user-roles.js.map +1 -0
- package/dist/domains/users.d.ts +25 -0
- package/dist/domains/users.d.ts.map +1 -0
- package/dist/domains/users.js +67 -0
- package/dist/domains/users.js.map +1 -0
- package/dist/errors/index.d.ts +110 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +206 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +14 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +12 -0
- package/dist/node.js.map +1 -0
- package/dist/pagination/index.d.ts +87 -0
- package/dist/pagination/index.d.ts.map +1 -0
- package/dist/pagination/index.js +67 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/transport/browser-transport.d.ts +64 -0
- package/dist/transport/browser-transport.d.ts.map +1 -0
- package/dist/transport/browser-transport.js +96 -0
- package/dist/transport/browser-transport.js.map +1 -0
- package/dist/transport/node-transport.d.ts +51 -0
- package/dist/transport/node-transport.d.ts.map +1 -0
- package/dist/transport/node-transport.js +108 -0
- package/dist/transport/node-transport.js.map +1 -0
- package/dist/transport/types.d.ts +84 -0
- package/dist/transport/types.d.ts.map +1 -0
- package/dist/transport/types.js +13 -0
- package/dist/transport/types.js.map +1 -0
- package/dist/transport/utils.d.ts +78 -0
- package/dist/transport/utils.d.ts.map +1 -0
- package/dist/transport/utils.js +126 -0
- package/dist/transport/utils.js.map +1 -0
- package/dist/types/applications.d.ts +48 -0
- package/dist/types/applications.d.ts.map +1 -0
- package/dist/types/applications.js +7 -0
- package/dist/types/applications.js.map +1 -0
- package/dist/types/audit.d.ts +31 -0
- package/dist/types/audit.d.ts.map +1 -0
- package/dist/types/audit.js +7 -0
- package/dist/types/audit.js.map +1 -0
- package/dist/types/branding.d.ts +13 -0
- package/dist/types/branding.d.ts.map +1 -0
- package/dist/types/branding.js +7 -0
- package/dist/types/branding.js.map +1 -0
- package/dist/types/bulk.d.ts +22 -0
- package/dist/types/bulk.d.ts.map +1 -0
- package/dist/types/bulk.js +7 -0
- package/dist/types/bulk.js.map +1 -0
- package/dist/types/clients.d.ts +70 -0
- package/dist/types/clients.d.ts.map +1 -0
- package/dist/types/clients.js +7 -0
- package/dist/types/clients.js.map +1 -0
- package/dist/types/common.d.ts +75 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +7 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/config.d.ts +15 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +7 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/custom-claims.d.ts +48 -0
- package/dist/types/custom-claims.d.ts.map +1 -0
- package/dist/types/custom-claims.js +7 -0
- package/dist/types/custom-claims.js.map +1 -0
- package/dist/types/exports.d.ts +14 -0
- package/dist/types/exports.d.ts.map +1 -0
- package/dist/types/exports.js +7 -0
- package/dist/types/exports.js.map +1 -0
- package/dist/types/imports.d.ts +31 -0
- package/dist/types/imports.d.ts.map +1 -0
- package/dist/types/imports.js +7 -0
- package/dist/types/imports.js.map +1 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/keys.d.ts +14 -0
- package/dist/types/keys.d.ts.map +1 -0
- package/dist/types/keys.js +7 -0
- package/dist/types/keys.js.map +1 -0
- package/dist/types/organizations.d.ts +47 -0
- package/dist/types/organizations.d.ts.map +1 -0
- package/dist/types/organizations.js +7 -0
- package/dist/types/organizations.js.map +1 -0
- package/dist/types/permissions.d.ts +23 -0
- package/dist/types/permissions.d.ts.map +1 -0
- package/dist/types/permissions.js +7 -0
- package/dist/types/permissions.js.map +1 -0
- package/dist/types/roles.d.ts +30 -0
- package/dist/types/roles.d.ts.map +1 -0
- package/dist/types/roles.js +7 -0
- package/dist/types/roles.js.map +1 -0
- package/dist/types/sessions.d.ts +25 -0
- package/dist/types/sessions.d.ts.map +1 -0
- package/dist/types/sessions.js +7 -0
- package/dist/types/sessions.js.map +1 -0
- package/dist/types/stats.d.ts +18 -0
- package/dist/types/stats.d.ts.map +1 -0
- package/dist/types/stats.js +7 -0
- package/dist/types/stats.js.map +1 -0
- package/dist/types/two-factor.d.ts +14 -0
- package/dist/types/two-factor.d.ts.map +1 -0
- package/dist/types/two-factor.js +7 -0
- package/dist/types/two-factor.js.map +1 -0
- package/dist/types/user-claims.d.ts +16 -0
- package/dist/types/user-claims.d.ts.map +1 -0
- package/dist/types/user-claims.js +7 -0
- package/dist/types/user-claims.js.map +1 -0
- package/dist/types/user-roles.d.ts +17 -0
- package/dist/types/user-roles.d.ts.map +1 -0
- package/dist/types/user-roles.js +7 -0
- package/dist/types/user-roles.js.map +1 -0
- package/dist/types/users.d.ts +53 -0
- package/dist/types/users.d.ts.map +1 -0
- package/dist/types/users.js +7 -0
- package/dist/types/users.js.map +1 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +9 -0
- package/dist/version.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Two-Factor domain — admin 2FA status and management.
|
|
3
|
+
*
|
|
4
|
+
* @module domains/two-factor
|
|
5
|
+
*/
|
|
6
|
+
import { unwrapData } from './helpers.js';
|
|
7
|
+
export function createTwoFactorDomain(transport) {
|
|
8
|
+
function base(orgId, userId) {
|
|
9
|
+
return `/organizations/${orgId}/users/${userId}/two-factor`;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
async getStatus(orgId, userId) {
|
|
13
|
+
const res = await transport.request({ method: 'GET', path: base(orgId, userId) });
|
|
14
|
+
return unwrapData(res.body);
|
|
15
|
+
},
|
|
16
|
+
async disable(orgId, userId) {
|
|
17
|
+
await transport.request({ method: 'POST', path: `${base(orgId, userId)}/disable` });
|
|
18
|
+
},
|
|
19
|
+
async reset(orgId, userId) {
|
|
20
|
+
await transport.request({ method: 'POST', path: `${base(orgId, userId)}/reset` });
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=two-factor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"two-factor.js","sourceRoot":"","sources":["../../src/domains/two-factor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,MAAM,UAAU,qBAAqB,CAAC,SAAwB;IAC5D,SAAS,IAAI,CAAC,KAAa,EAAE,MAAc;QACzC,OAAO,kBAAkB,KAAK,UAAU,MAAM,aAAa,CAAC;IAC9D,CAAC;IAED,OAAO;QACL,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM;YAC3B,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;YAClF,OAAO,UAAU,CAAkB,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/C,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM;YACzB,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;QACtF,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM;YACvB,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QACpF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User Claims domain — get/set/remove claim values for a user.
|
|
3
|
+
*
|
|
4
|
+
* @module domains/user-claims
|
|
5
|
+
*/
|
|
6
|
+
import type { HttpTransport } from '../transport/types.js';
|
|
7
|
+
import type { UserClaimEntry } from '../types/index.js';
|
|
8
|
+
export interface UserClaimsDomain {
|
|
9
|
+
list(orgId: string, userId: string): Promise<UserClaimEntry[]>;
|
|
10
|
+
set(orgId: string, userId: string, claimId: string, value: unknown): Promise<void>;
|
|
11
|
+
remove(orgId: string, userId: string, claimId: string): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare function createUserClaimsDomain(transport: HttpTransport): UserClaimsDomain;
|
|
14
|
+
//# sourceMappingURL=user-claims.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-claims.d.ts","sourceRoot":"","sources":["../../src/domains/user-claims.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAC/D,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnF,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,aAAa,GAAG,gBAAgB,CAiBjF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User Claims domain — get/set/remove claim values for a user.
|
|
3
|
+
*
|
|
4
|
+
* @module domains/user-claims
|
|
5
|
+
*/
|
|
6
|
+
import { unwrapData } from './helpers.js';
|
|
7
|
+
export function createUserClaimsDomain(transport) {
|
|
8
|
+
function base(orgId, userId) {
|
|
9
|
+
return `/organizations/${orgId}/users/${userId}/claims`;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
async list(orgId, userId) {
|
|
13
|
+
const res = await transport.request({ method: 'GET', path: base(orgId, userId) });
|
|
14
|
+
return unwrapData(res.body);
|
|
15
|
+
},
|
|
16
|
+
async set(orgId, userId, claimId, value) {
|
|
17
|
+
await transport.request({ method: 'PUT', path: `${base(orgId, userId)}/${claimId}`, body: { value } });
|
|
18
|
+
},
|
|
19
|
+
async remove(orgId, userId, claimId) {
|
|
20
|
+
await transport.request({ method: 'DELETE', path: `${base(orgId, userId)}/${claimId}` });
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=user-claims.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-claims.js","sourceRoot":"","sources":["../../src/domains/user-claims.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,MAAM,UAAU,sBAAsB,CAAC,SAAwB;IAC7D,SAAS,IAAI,CAAC,KAAa,EAAE,MAAc;QACzC,OAAO,kBAAkB,KAAK,UAAU,MAAM,SAAS,CAAC;IAC1D,CAAC;IAED,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;YACtB,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;YAClF,OAAO,UAAU,CAAmB,GAAG,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK;YACrC,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACzG,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO;YACjC,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,EAAE,CAAC,CAAC;QAC3F,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User Roles domain — assign/remove/list roles for a user.
|
|
3
|
+
*
|
|
4
|
+
* @module domains/user-roles
|
|
5
|
+
*/
|
|
6
|
+
import type { HttpTransport } from '../transport/types.js';
|
|
7
|
+
import type { UserRoleAssignment } from '../types/index.js';
|
|
8
|
+
export interface UserRolesDomain {
|
|
9
|
+
list(orgId: string, userId: string): Promise<UserRoleAssignment[]>;
|
|
10
|
+
assign(orgId: string, userId: string, roleId: string): Promise<void>;
|
|
11
|
+
remove(orgId: string, userId: string, roleId: string): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare function createUserRolesDomain(transport: HttpTransport): UserRolesDomain;
|
|
14
|
+
//# sourceMappingURL=user-roles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-roles.d.ts","sourceRoot":"","sources":["../../src/domains/user-roles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACnE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtE;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,aAAa,GAAG,eAAe,CAiB/E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User Roles domain — assign/remove/list roles for a user.
|
|
3
|
+
*
|
|
4
|
+
* @module domains/user-roles
|
|
5
|
+
*/
|
|
6
|
+
import { unwrapData } from './helpers.js';
|
|
7
|
+
export function createUserRolesDomain(transport) {
|
|
8
|
+
function base(orgId, userId) {
|
|
9
|
+
return `/organizations/${orgId}/users/${userId}/roles`;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
async list(orgId, userId) {
|
|
13
|
+
const res = await transport.request({ method: 'GET', path: base(orgId, userId) });
|
|
14
|
+
return unwrapData(res.body);
|
|
15
|
+
},
|
|
16
|
+
async assign(orgId, userId, roleId) {
|
|
17
|
+
await transport.request({ method: 'POST', path: base(orgId, userId), body: { roleId } });
|
|
18
|
+
},
|
|
19
|
+
async remove(orgId, userId, roleId) {
|
|
20
|
+
await transport.request({ method: 'DELETE', path: `${base(orgId, userId)}/${roleId}` });
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=user-roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-roles.js","sourceRoot":"","sources":["../../src/domains/user-roles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,MAAM,UAAU,qBAAqB,CAAC,SAAwB;IAC5D,SAAS,IAAI,CAAC,KAAa,EAAE,MAAc;QACzC,OAAO,kBAAkB,KAAK,UAAU,MAAM,QAAQ,CAAC;IACzD,CAAC;IAED,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;YACtB,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;YAClF,OAAO,UAAU,CAAuB,GAAG,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM;YAChC,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QAC3F,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM;YAChC,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;QAC1F,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Users domain — CRUD, status lifecycle, invite, password.
|
|
3
|
+
*
|
|
4
|
+
* @module domains/users
|
|
5
|
+
*/
|
|
6
|
+
import type { HttpTransport } from '../transport/types.js';
|
|
7
|
+
import type { User, CreateUserInput, UpdateUserInput, InviteUserInput, SetPasswordInput, UserListParams, PaginatedResponse, ETagResponse, HistoryEntry, ListParams } from '../types/index.js';
|
|
8
|
+
export interface UsersDomain {
|
|
9
|
+
list(orgId: string, params?: UserListParams): Promise<PaginatedResponse<User>>;
|
|
10
|
+
listAll(orgId: string, params?: Omit<UserListParams, 'page' | 'cursor'>): Promise<User[]>;
|
|
11
|
+
get(orgId: string, userId: string): Promise<ETagResponse<User>>;
|
|
12
|
+
create(input: CreateUserInput): Promise<User>;
|
|
13
|
+
update(orgId: string, userId: string, input: UpdateUserInput, etag?: string): Promise<User>;
|
|
14
|
+
invite(input: InviteUserInput): Promise<User>;
|
|
15
|
+
setPassword(orgId: string, userId: string, input: SetPasswordInput): Promise<void>;
|
|
16
|
+
suspend(orgId: string, userId: string): Promise<void>;
|
|
17
|
+
activate(orgId: string, userId: string): Promise<void>;
|
|
18
|
+
lock(orgId: string, userId: string): Promise<void>;
|
|
19
|
+
unlock(orgId: string, userId: string): Promise<void>;
|
|
20
|
+
deactivate(orgId: string, userId: string): Promise<void>;
|
|
21
|
+
reactivate(orgId: string, userId: string): Promise<void>;
|
|
22
|
+
getHistory(orgId: string, userId: string, params?: ListParams): Promise<HistoryEntry[]>;
|
|
23
|
+
}
|
|
24
|
+
export declare function createUsersDomain(transport: HttpTransport): UsersDomain;
|
|
25
|
+
//# sourceMappingURL=users.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/domains/users.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EACV,IAAI,EACJ,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,UAAU,EACX,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/E,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1F,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,MAAM,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5F,MAAM,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnF,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CACzF;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,aAAa,GAAG,WAAW,CAwEvE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Users domain — CRUD, status lifecycle, invite, password.
|
|
3
|
+
*
|
|
4
|
+
* @module domains/users
|
|
5
|
+
*/
|
|
6
|
+
import { listAll } from '../pagination/index.js';
|
|
7
|
+
import { unwrapData, unwrapWithEtag, etagHeaders, toQueryParams } from './helpers.js';
|
|
8
|
+
export function createUsersDomain(transport) {
|
|
9
|
+
function userBase(orgId) {
|
|
10
|
+
return `/organizations/${orgId}/users`;
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
async list(orgId, params) {
|
|
14
|
+
const res = await transport.request({ method: 'GET', path: userBase(orgId), params: toQueryParams(params) });
|
|
15
|
+
return res.body;
|
|
16
|
+
},
|
|
17
|
+
listAll(orgId, params) {
|
|
18
|
+
return listAll((p) => this.list(orgId, { ...params, ...p }), params);
|
|
19
|
+
},
|
|
20
|
+
async get(orgId, userId) {
|
|
21
|
+
const res = await transport.request({ method: 'GET', path: `${userBase(orgId)}/${userId}` });
|
|
22
|
+
return unwrapWithEtag(res);
|
|
23
|
+
},
|
|
24
|
+
async create(input) {
|
|
25
|
+
const res = await transport.request({ method: 'POST', path: userBase(input.organizationId), body: input });
|
|
26
|
+
return unwrapData(res.body);
|
|
27
|
+
},
|
|
28
|
+
async update(orgId, userId, input, etag) {
|
|
29
|
+
const res = await transport.request({
|
|
30
|
+
method: 'PUT', path: `${userBase(orgId)}/${userId}`, body: input, headers: etagHeaders(etag),
|
|
31
|
+
});
|
|
32
|
+
return unwrapData(res.body);
|
|
33
|
+
},
|
|
34
|
+
async invite(input) {
|
|
35
|
+
const res = await transport.request({ method: 'POST', path: `${userBase(input.organizationId)}/invite`, body: input });
|
|
36
|
+
return unwrapData(res.body);
|
|
37
|
+
},
|
|
38
|
+
async setPassword(orgId, userId, input) {
|
|
39
|
+
await transport.request({ method: 'POST', path: `${userBase(orgId)}/${userId}/password`, body: input });
|
|
40
|
+
},
|
|
41
|
+
async suspend(orgId, userId) {
|
|
42
|
+
await transport.request({ method: 'POST', path: `${userBase(orgId)}/${userId}/suspend` });
|
|
43
|
+
},
|
|
44
|
+
async activate(orgId, userId) {
|
|
45
|
+
await transport.request({ method: 'POST', path: `${userBase(orgId)}/${userId}/activate` });
|
|
46
|
+
},
|
|
47
|
+
async lock(orgId, userId) {
|
|
48
|
+
await transport.request({ method: 'POST', path: `${userBase(orgId)}/${userId}/lock` });
|
|
49
|
+
},
|
|
50
|
+
async unlock(orgId, userId) {
|
|
51
|
+
await transport.request({ method: 'POST', path: `${userBase(orgId)}/${userId}/unlock` });
|
|
52
|
+
},
|
|
53
|
+
async deactivate(orgId, userId) {
|
|
54
|
+
await transport.request({ method: 'POST', path: `${userBase(orgId)}/${userId}/deactivate` });
|
|
55
|
+
},
|
|
56
|
+
async reactivate(orgId, userId) {
|
|
57
|
+
await transport.request({ method: 'POST', path: `${userBase(orgId)}/${userId}/reactivate` });
|
|
58
|
+
},
|
|
59
|
+
async getHistory(orgId, userId, params) {
|
|
60
|
+
const res = await transport.request({
|
|
61
|
+
method: 'GET', path: `${userBase(orgId)}/${userId}/history`, params: toQueryParams(params),
|
|
62
|
+
});
|
|
63
|
+
return unwrapData(res.body);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/domains/users.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAmBtF,MAAM,UAAU,iBAAiB,CAAC,SAAwB;IACxD,SAAS,QAAQ,CAAC,KAAa;QAC7B,OAAO,kBAAkB,KAAK,QAAQ,CAAC;IACzC,CAAC;IAED,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAO;YACvB,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC7G,OAAO,GAAG,CAAC,IAA+B,CAAC;QAC7C,CAAC;QAED,OAAO,CAAC,KAAK,EAAE,MAAO;YACpB,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,C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EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,aAAa,EAAE,CAAC,CAAC;QAC/F,CAAC;QAED,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM;YAC5B,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,aAAa,EAAE,CAAC,CAAC;QAC/F,CAAC;QAED,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAO;YACrC,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC;gBAClC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC;aAC3F,CAAC,CAAC;YACH,OAAO,UAAU,CAAiB,GAAG,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Porta SDK error hierarchy.
|
|
3
|
+
*
|
|
4
|
+
* All SDK errors extend from PortaError → PortaHttpError.
|
|
5
|
+
* Specific error classes map to HTTP status codes, making it
|
|
6
|
+
* easy to catch and handle specific failure types:
|
|
7
|
+
*
|
|
8
|
+
* ```typescript
|
|
9
|
+
* try {
|
|
10
|
+
* await client.organizations.get('unknown');
|
|
11
|
+
* } catch (err) {
|
|
12
|
+
* if (err instanceof PortaNotFoundError) {
|
|
13
|
+
* // Handle 404
|
|
14
|
+
* } else if (err instanceof PortaValidationError) {
|
|
15
|
+
* // Handle 400 — err.details has field-level errors
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import type { TransportResponse } from '../transport/types.js';
|
|
21
|
+
/**
|
|
22
|
+
* Base error class for all Porta SDK errors.
|
|
23
|
+
* Extends native Error with optional cause chaining.
|
|
24
|
+
*/
|
|
25
|
+
export declare class PortaError extends Error {
|
|
26
|
+
constructor(message: string, options?: {
|
|
27
|
+
cause?: unknown;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* HTTP error from the Porta API.
|
|
32
|
+
* Contains the HTTP status code and the raw response body.
|
|
33
|
+
*/
|
|
34
|
+
export declare class PortaHttpError extends PortaError {
|
|
35
|
+
readonly status: number;
|
|
36
|
+
readonly body: unknown;
|
|
37
|
+
constructor(status: number, message: string, body?: unknown);
|
|
38
|
+
}
|
|
39
|
+
/** Validation error detail — one entry per invalid field */
|
|
40
|
+
export interface ValidationDetail {
|
|
41
|
+
path: string;
|
|
42
|
+
message: string;
|
|
43
|
+
code?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 400 Bad Request — input validation failed.
|
|
47
|
+
* The `details` array contains field-level error information
|
|
48
|
+
* extracted from the server's Zod validation response.
|
|
49
|
+
*/
|
|
50
|
+
export declare class PortaValidationError extends PortaHttpError {
|
|
51
|
+
readonly details: ValidationDetail[];
|
|
52
|
+
constructor(body: unknown);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 401 Unauthorized — authentication required or token expired.
|
|
56
|
+
* Transports typically handle 401 first (redirect or retry),
|
|
57
|
+
* so this error surfaces only when recovery fails.
|
|
58
|
+
*/
|
|
59
|
+
export declare class PortaAuthenticationError extends PortaHttpError {
|
|
60
|
+
constructor(body?: unknown);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 403 Forbidden — insufficient permissions.
|
|
64
|
+
* The authenticated user lacks the required RBAC role or permission.
|
|
65
|
+
*/
|
|
66
|
+
export declare class PortaForbiddenError extends PortaHttpError {
|
|
67
|
+
constructor(body?: unknown);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 404 Not Found — the requested resource does not exist.
|
|
71
|
+
*/
|
|
72
|
+
export declare class PortaNotFoundError extends PortaHttpError {
|
|
73
|
+
constructor(body?: unknown);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 409 Conflict — state conflict or ETag mismatch.
|
|
77
|
+
* Common causes: concurrent update (If-Match failed),
|
|
78
|
+
* or entity already in the requested state.
|
|
79
|
+
*/
|
|
80
|
+
export declare class PortaConflictError extends PortaHttpError {
|
|
81
|
+
constructor(body?: unknown);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* 429 Too Many Requests — rate limit exceeded.
|
|
85
|
+
* The `retryAfter` field (seconds) is extracted from the
|
|
86
|
+
* `Retry-After` response header when present.
|
|
87
|
+
*/
|
|
88
|
+
export declare class PortaRateLimitError extends PortaHttpError {
|
|
89
|
+
readonly retryAfter: number | null;
|
|
90
|
+
constructor(body?: unknown, retryAfter?: number | null);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 500-599 Server Error — internal server failure.
|
|
94
|
+
* The specific status code is preserved for debugging.
|
|
95
|
+
*/
|
|
96
|
+
export declare class PortaServerError extends PortaHttpError {
|
|
97
|
+
constructor(status: number, body?: unknown);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Maps a non-2xx TransportResponse to the appropriate error class.
|
|
101
|
+
*
|
|
102
|
+
* Called by both BrowserTransport and NodeTransport after detecting
|
|
103
|
+
* a non-successful HTTP response. The error hierarchy allows callers
|
|
104
|
+
* to use `instanceof` checks for specific error handling.
|
|
105
|
+
*
|
|
106
|
+
* @param response - The transport response with a non-2xx status code
|
|
107
|
+
* @returns A typed PortaHttpError subclass
|
|
108
|
+
*/
|
|
109
|
+
export declare function mapResponseToError(response: TransportResponse): PortaHttpError;
|
|
110
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":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EAAE,MAAM,GAAG,IAAI;CAMvD;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,cAAc;gBACtC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CAK3C;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,cAAc,CA0B9E"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Porta SDK error hierarchy.
|
|
3
|
+
*
|
|
4
|
+
* All SDK errors extend from PortaError → PortaHttpError.
|
|
5
|
+
* Specific error classes map to HTTP status codes, making it
|
|
6
|
+
* easy to catch and handle specific failure types:
|
|
7
|
+
*
|
|
8
|
+
* ```typescript
|
|
9
|
+
* try {
|
|
10
|
+
* await client.organizations.get('unknown');
|
|
11
|
+
* } catch (err) {
|
|
12
|
+
* if (err instanceof PortaNotFoundError) {
|
|
13
|
+
* // Handle 404
|
|
14
|
+
* } else if (err instanceof PortaValidationError) {
|
|
15
|
+
* // Handle 400 — err.details has field-level errors
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Base error class for all Porta SDK errors.
|
|
22
|
+
* Extends native Error with optional cause chaining.
|
|
23
|
+
*/
|
|
24
|
+
export class PortaError extends Error {
|
|
25
|
+
constructor(message, options) {
|
|
26
|
+
super(message, options);
|
|
27
|
+
this.name = 'PortaError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* HTTP error from the Porta API.
|
|
32
|
+
* Contains the HTTP status code and the raw response body.
|
|
33
|
+
*/
|
|
34
|
+
export class PortaHttpError extends PortaError {
|
|
35
|
+
status;
|
|
36
|
+
body;
|
|
37
|
+
constructor(status, message, body) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.name = 'PortaHttpError';
|
|
40
|
+
this.status = status;
|
|
41
|
+
this.body = body;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 400 Bad Request — input validation failed.
|
|
46
|
+
* The `details` array contains field-level error information
|
|
47
|
+
* extracted from the server's Zod validation response.
|
|
48
|
+
*/
|
|
49
|
+
export class PortaValidationError extends PortaHttpError {
|
|
50
|
+
details;
|
|
51
|
+
constructor(body) {
|
|
52
|
+
const message = extractMessage(body, 'Validation failed');
|
|
53
|
+
super(400, message, body);
|
|
54
|
+
this.name = 'PortaValidationError';
|
|
55
|
+
this.details = extractDetails(body);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 401 Unauthorized — authentication required or token expired.
|
|
60
|
+
* Transports typically handle 401 first (redirect or retry),
|
|
61
|
+
* so this error surfaces only when recovery fails.
|
|
62
|
+
*/
|
|
63
|
+
export class PortaAuthenticationError extends PortaHttpError {
|
|
64
|
+
constructor(body) {
|
|
65
|
+
const message = extractMessage(body, 'Authentication required');
|
|
66
|
+
super(401, message, body);
|
|
67
|
+
this.name = 'PortaAuthenticationError';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 403 Forbidden — insufficient permissions.
|
|
72
|
+
* The authenticated user lacks the required RBAC role or permission.
|
|
73
|
+
*/
|
|
74
|
+
export class PortaForbiddenError extends PortaHttpError {
|
|
75
|
+
constructor(body) {
|
|
76
|
+
const message = extractMessage(body, 'Forbidden');
|
|
77
|
+
super(403, message, body);
|
|
78
|
+
this.name = 'PortaForbiddenError';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 404 Not Found — the requested resource does not exist.
|
|
83
|
+
*/
|
|
84
|
+
export class PortaNotFoundError extends PortaHttpError {
|
|
85
|
+
constructor(body) {
|
|
86
|
+
const message = extractMessage(body, 'Not found');
|
|
87
|
+
super(404, message, body);
|
|
88
|
+
this.name = 'PortaNotFoundError';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 409 Conflict — state conflict or ETag mismatch.
|
|
93
|
+
* Common causes: concurrent update (If-Match failed),
|
|
94
|
+
* or entity already in the requested state.
|
|
95
|
+
*/
|
|
96
|
+
export class PortaConflictError extends PortaHttpError {
|
|
97
|
+
constructor(body) {
|
|
98
|
+
const message = extractMessage(body, 'Conflict');
|
|
99
|
+
super(409, message, body);
|
|
100
|
+
this.name = 'PortaConflictError';
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 429 Too Many Requests — rate limit exceeded.
|
|
105
|
+
* The `retryAfter` field (seconds) is extracted from the
|
|
106
|
+
* `Retry-After` response header when present.
|
|
107
|
+
*/
|
|
108
|
+
export class PortaRateLimitError extends PortaHttpError {
|
|
109
|
+
retryAfter;
|
|
110
|
+
constructor(body, retryAfter) {
|
|
111
|
+
const message = extractMessage(body, 'Rate limit exceeded');
|
|
112
|
+
super(429, message, body);
|
|
113
|
+
this.name = 'PortaRateLimitError';
|
|
114
|
+
this.retryAfter = retryAfter ?? null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 500-599 Server Error — internal server failure.
|
|
119
|
+
* The specific status code is preserved for debugging.
|
|
120
|
+
*/
|
|
121
|
+
export class PortaServerError extends PortaHttpError {
|
|
122
|
+
constructor(status, body) {
|
|
123
|
+
const message = extractMessage(body, 'Server error');
|
|
124
|
+
super(status, message, body);
|
|
125
|
+
this.name = 'PortaServerError';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Maps a non-2xx TransportResponse to the appropriate error class.
|
|
130
|
+
*
|
|
131
|
+
* Called by both BrowserTransport and NodeTransport after detecting
|
|
132
|
+
* a non-successful HTTP response. The error hierarchy allows callers
|
|
133
|
+
* to use `instanceof` checks for specific error handling.
|
|
134
|
+
*
|
|
135
|
+
* @param response - The transport response with a non-2xx status code
|
|
136
|
+
* @returns A typed PortaHttpError subclass
|
|
137
|
+
*/
|
|
138
|
+
export function mapResponseToError(response) {
|
|
139
|
+
const { status, body, headers } = response;
|
|
140
|
+
switch (status) {
|
|
141
|
+
case 400:
|
|
142
|
+
return new PortaValidationError(body);
|
|
143
|
+
case 401:
|
|
144
|
+
return new PortaAuthenticationError(body);
|
|
145
|
+
case 403:
|
|
146
|
+
return new PortaForbiddenError(body);
|
|
147
|
+
case 404:
|
|
148
|
+
return new PortaNotFoundError(body);
|
|
149
|
+
case 409:
|
|
150
|
+
return new PortaConflictError(body);
|
|
151
|
+
case 429: {
|
|
152
|
+
const retryAfterHeader = headers['retry-after'];
|
|
153
|
+
const retryAfter = retryAfterHeader ? parseInt(retryAfterHeader, 10) : null;
|
|
154
|
+
return new PortaRateLimitError(body, Number.isNaN(retryAfter) ? null : retryAfter);
|
|
155
|
+
}
|
|
156
|
+
default:
|
|
157
|
+
// 500-599 → PortaServerError; all other 4xx → generic PortaHttpError
|
|
158
|
+
if (status >= 500 && status <= 599) {
|
|
159
|
+
return new PortaServerError(status, body);
|
|
160
|
+
}
|
|
161
|
+
return new PortaHttpError(status, extractMessage(body, `HTTP ${status}`), body);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// ── Internal helpers ──────────────────────────────────────────────
|
|
165
|
+
/**
|
|
166
|
+
* Extracts a human-readable message from a response body.
|
|
167
|
+
* Looks for common server response shapes: { error: string },
|
|
168
|
+
* { message: string }, or { error: { message: string } }.
|
|
169
|
+
*/
|
|
170
|
+
function extractMessage(body, fallback) {
|
|
171
|
+
if (body && typeof body === 'object') {
|
|
172
|
+
const obj = body;
|
|
173
|
+
// { error: "message" }
|
|
174
|
+
if (typeof obj.error === 'string')
|
|
175
|
+
return obj.error;
|
|
176
|
+
// { message: "message" }
|
|
177
|
+
if (typeof obj.message === 'string')
|
|
178
|
+
return obj.message;
|
|
179
|
+
// { error: { message: "message" } }
|
|
180
|
+
if (obj.error && typeof obj.error === 'object') {
|
|
181
|
+
const nested = obj.error;
|
|
182
|
+
if (typeof nested.message === 'string')
|
|
183
|
+
return nested.message;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return fallback;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Extracts validation details from a 400 response body.
|
|
190
|
+
* Looks for { details: [{ path, message, code? }] } or
|
|
191
|
+
* { errors: [{ path, message, code? }] }.
|
|
192
|
+
*/
|
|
193
|
+
function extractDetails(body) {
|
|
194
|
+
if (!body || typeof body !== 'object')
|
|
195
|
+
return [];
|
|
196
|
+
const obj = body;
|
|
197
|
+
const raw = Array.isArray(obj.details) ? obj.details : Array.isArray(obj.errors) ? obj.errors : [];
|
|
198
|
+
return raw
|
|
199
|
+
.filter((item) => item && typeof item === 'object')
|
|
200
|
+
.map((item) => ({
|
|
201
|
+
path: typeof item.path === 'string' ? item.path : String(item.path ?? ''),
|
|
202
|
+
message: typeof item.message === 'string' ? item.message : String(item.message ?? ''),
|
|
203
|
+
...(typeof item.code === 'string' ? { code: item.code } : {}),
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,UAAU;IACnC,MAAM,CAAS;IACf,IAAI,CAAU;IAEvB,YAAY,MAAc,EAAE,OAAe,EAAE,IAAc;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,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AAE,CAAC;KAC9D,CAAC,CAAC,CAAC;AACR,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @portaidentity/sdk — Main entrypoint.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the client factory, all types, domain interfaces,
|
|
5
|
+
* error classes, and pagination utilities.
|
|
6
|
+
*
|
|
7
|
+
* Transport and auth providers are available from platform-specific entrypoints:
|
|
8
|
+
* - `@portaidentity/sdk/node` — Node.js transport + all auth providers
|
|
9
|
+
* - `@portaidentity/sdk/browser` — Browser (fetch) transport
|
|
10
|
+
* - `@portaidentity/sdk/agent` — AI agent tool definitions
|
|
11
|
+
*
|
|
12
|
+
* @module @portaidentity/sdk
|
|
13
|
+
*/
|
|
14
|
+
export { createPortaClient } from './client.js';
|
|
15
|
+
export type { PortaClient, PortaClientOptions } from './client.js';
|
|
16
|
+
export { SDK_VERSION } from './version.js';
|
|
17
|
+
export type * from './types/index.js';
|
|
18
|
+
export type { OrganizationsDomain, ApplicationsDomain, ClientsDomain, UsersDomain, RolesDomain, PermissionsDomain, CustomClaimsDomain, UserRolesDomain, UserClaimsDomain, ConfigDomain, KeysDomain, AuditDomain, StatsDomain, SessionsDomain, BulkDomain, BrandingDomain, ExportsDomain, TwoFactorDomain, ImportsDomain, SlugValidation, DestroyResult, } from './domains/index.js';
|
|
19
|
+
export type { HttpTransport, TransportRequest, TransportResponse, HttpMethod, } from './transport/types.js';
|
|
20
|
+
export type { AuthProvider } from './auth/index.js';
|
|
21
|
+
export { PortaError, PortaHttpError, PortaAuthenticationError, PortaForbiddenError, PortaNotFoundError, PortaConflictError, PortaValidationError, PortaRateLimitError, PortaServerError, mapResponseToError, } from './errors/index.js';
|
|
22
|
+
export { listAll } from './pagination/index.js';
|
|
23
|
+
export type { PaginatedResult, PaginatedListParams } from './pagination/index.js';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGnE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,mBAAmB,kBAAkB,CAAC;AAGtC,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACX,cAAc,EACd,UAAU,EACV,cAAc,EACd,aAAa,EACb,eAAe,EACf,aAAa,EACb,cAAc,EACd,aAAa,GACd,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,GACX,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,OAAO,EACL,UAAU,EACV,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @portaidentity/sdk — Main entrypoint.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the client factory, all types, domain interfaces,
|
|
5
|
+
* error classes, and pagination utilities.
|
|
6
|
+
*
|
|
7
|
+
* Transport and auth providers are available from platform-specific entrypoints:
|
|
8
|
+
* - `@portaidentity/sdk/node` — Node.js transport + all auth providers
|
|
9
|
+
* - `@portaidentity/sdk/browser` — Browser (fetch) transport
|
|
10
|
+
* - `@portaidentity/sdk/agent` — AI agent tool definitions
|
|
11
|
+
*
|
|
12
|
+
* @module @portaidentity/sdk
|
|
13
|
+
*/
|
|
14
|
+
// Client factory
|
|
15
|
+
export { createPortaClient } from './client.js';
|
|
16
|
+
// Version
|
|
17
|
+
export { SDK_VERSION } from './version.js';
|
|
18
|
+
// Error classes
|
|
19
|
+
export { PortaError, PortaHttpError, PortaAuthenticationError, PortaForbiddenError, PortaNotFoundError, PortaConflictError, PortaValidationError, PortaRateLimitError, PortaServerError, mapResponseToError, } from './errors/index.js';
|
|
20
|
+
// Pagination
|
|
21
|
+
export { listAll } from './pagination/index.js';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,iBAAiB;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,UAAU;AACV,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAyC3C,gBAAgB;AAChB,OAAO,EACL,UAAU,EACV,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAE3B,aAAa;AACb,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @portaidentity/sdk/node — Node.js entrypoint.
|
|
3
|
+
*
|
|
4
|
+
* Exports Node.js-specific transport and all auth providers.
|
|
5
|
+
*
|
|
6
|
+
* @module @portaidentity/sdk/node
|
|
7
|
+
*/
|
|
8
|
+
export { createNodeTransport } from './transport/node-transport.js';
|
|
9
|
+
export type { NodeTransportOptions } from './transport/node-transport.js';
|
|
10
|
+
export { createTokenAuth, createClientCredentialsAuth, createCliAuth } from './auth/index.js';
|
|
11
|
+
export type { AuthProvider } from './auth/index.js';
|
|
12
|
+
export type { ClientCredentialsAuthOptions } from './auth/client-credentials-auth.js';
|
|
13
|
+
export type { CliAuthOptions, StoredCredentials } from './auth/cli-auth.js';
|
|
14
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAG1E,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9F,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACtF,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|