@drmhse/sso-sdk 0.2.6 → 0.2.8

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 CHANGED
@@ -5,20 +5,20 @@
5
5
 
6
6
  A zero-dependency, strongly-typed TypeScript SDK for the multi-tenant SSO Platform API.
7
7
 
8
- **📚 [View Full Documentation →](https://drmhse.com/docs/sso/)**
8
+ **[View Full Documentation →](https://drmhse.com/docs/sso/)**
9
9
 
10
10
  ## Features
11
11
 
12
- - **Zero Dependencies** - Built on native `fetch` API
13
- - **Strongly Typed** - Complete TypeScript definitions
14
- - **Framework Agnostic** - Works in any JavaScript environment
15
- - **OAuth 2.0 Flows** - Support for GitHub, Google, Microsoft
16
- - **Password Authentication** - Native email/password auth with MFA
17
- - **Device Flow** - RFC 8628 for CLIs and headless apps
18
- - **Multi-Factor Authentication** - TOTP-based 2FA with backup codes
19
- - **Organization Management** - Multi-tenant with RBAC
20
- - **Analytics & Audit Logs** - Track authentication and administrative actions
21
- - **SAML 2.0** - Act as Identity Provider
12
+ - **Zero Dependencies** - Built on native `fetch` API
13
+ - **Strongly Typed** - Complete TypeScript definitions
14
+ - **Framework Agnostic** - Works in any JavaScript environment
15
+ - **OAuth 2.0 Flows** - Support for GitHub, Google, Microsoft
16
+ - **Password Authentication** - Native email/password auth with MFA
17
+ - **Device Flow** - RFC 8628 for CLIs and headless apps
18
+ - **Multi-Factor Authentication** - TOTP-based 2FA with backup codes
19
+ - **Organization Management** - Multi-tenant with RBAC
20
+ - **Analytics & Audit Logs** - Track authentication and administrative actions
21
+ - **SAML 2.0** - Act as Identity Provider
22
22
 
23
23
  ## Installation
24
24
 
@@ -127,7 +127,7 @@ const interval = setInterval(async () => {
127
127
 
128
128
  sso.setAuthToken(tokens.access_token);
129
129
  clearInterval(interval);
130
- console.log('Authentication successful!');
130
+ console.log('Authentication successful!');
131
131
  } catch (error) {
132
132
  // Continue polling...
133
133
  }
@@ -324,7 +324,7 @@ const decoded = jwt.verify(token, publicKey, {
324
324
  });
325
325
  ```
326
326
 
327
- **📚 [See Backend Validation Guide →](https://drmhse.com/docs/sso/api/concepts/token-validation)**
327
+ **[See Backend Validation Guide →](https://drmhse.com/docs/sso/api/concepts/token-validation)**
328
328
 
329
329
  ## Documentation
330
330
 
package/dist/index.d.mts CHANGED
@@ -477,12 +477,11 @@ interface OrganizationMember {
477
477
  joined_at: string;
478
478
  }
479
479
  /**
480
- * Create organization payload (public endpoint)
480
+ * Create organization payload (authenticated endpoint)
481
481
  */
482
482
  interface CreateOrganizationPayload {
483
483
  slug: string;
484
484
  name: string;
485
- owner_email: string;
486
485
  }
487
486
  /**
488
487
  * Create organization response
@@ -496,6 +495,8 @@ interface CreateOrganizationResponse {
496
495
  created_at: string;
497
496
  };
498
497
  membership: Membership;
498
+ access_token: string;
499
+ refresh_token: string;
499
500
  }
500
501
  /**
501
502
  * Update organization payload
@@ -2047,23 +2048,24 @@ declare class OrganizationsModule {
2047
2048
  */
2048
2049
  webhooks: WebhooksModule;
2049
2050
  /**
2050
- * Create a new organization (public endpoint).
2051
- * The organization will be created with 'pending' status and requires
2052
- * platform owner approval before becoming active.
2051
+ * Create a new organization (requires authentication).
2052
+ * The authenticated user becomes the organization owner.
2053
+ * Returns JWT tokens with organization context, eliminating the need to re-authenticate.
2053
2054
  *
2054
2055
  * @param payload Organization creation payload
2055
- * @returns Created organization with owner and membership details
2056
+ * @returns Created organization with owner, membership, and JWT tokens
2056
2057
  *
2057
2058
  * @example
2058
2059
  * ```typescript
2059
- * const result = await sso.organizations.createPublic({
2060
+ * const result = await sso.organizations.create({
2060
2061
  * slug: 'acme-corp',
2061
- * name: 'Acme Corporation',
2062
- * owner_email: 'founder@acme.com'
2062
+ * name: 'Acme Corporation'
2063
2063
  * });
2064
+ * // Store the new tokens with org context
2065
+ * authStore.setTokens(result.access_token, result.refresh_token);
2064
2066
  * ```
2065
2067
  */
2066
- createPublic(payload: CreateOrganizationPayload): Promise<CreateOrganizationResponse>;
2068
+ create(payload: CreateOrganizationPayload): Promise<CreateOrganizationResponse>;
2067
2069
  /**
2068
2070
  * List all organizations the authenticated user is a member of.
2069
2071
  *
package/dist/index.d.ts CHANGED
@@ -477,12 +477,11 @@ interface OrganizationMember {
477
477
  joined_at: string;
478
478
  }
479
479
  /**
480
- * Create organization payload (public endpoint)
480
+ * Create organization payload (authenticated endpoint)
481
481
  */
482
482
  interface CreateOrganizationPayload {
483
483
  slug: string;
484
484
  name: string;
485
- owner_email: string;
486
485
  }
487
486
  /**
488
487
  * Create organization response
@@ -496,6 +495,8 @@ interface CreateOrganizationResponse {
496
495
  created_at: string;
497
496
  };
498
497
  membership: Membership;
498
+ access_token: string;
499
+ refresh_token: string;
499
500
  }
500
501
  /**
501
502
  * Update organization payload
@@ -2047,23 +2048,24 @@ declare class OrganizationsModule {
2047
2048
  */
2048
2049
  webhooks: WebhooksModule;
2049
2050
  /**
2050
- * Create a new organization (public endpoint).
2051
- * The organization will be created with 'pending' status and requires
2052
- * platform owner approval before becoming active.
2051
+ * Create a new organization (requires authentication).
2052
+ * The authenticated user becomes the organization owner.
2053
+ * Returns JWT tokens with organization context, eliminating the need to re-authenticate.
2053
2054
  *
2054
2055
  * @param payload Organization creation payload
2055
- * @returns Created organization with owner and membership details
2056
+ * @returns Created organization with owner, membership, and JWT tokens
2056
2057
  *
2057
2058
  * @example
2058
2059
  * ```typescript
2059
- * const result = await sso.organizations.createPublic({
2060
+ * const result = await sso.organizations.create({
2060
2061
  * slug: 'acme-corp',
2061
- * name: 'Acme Corporation',
2062
- * owner_email: 'founder@acme.com'
2062
+ * name: 'Acme Corporation'
2063
2063
  * });
2064
+ * // Store the new tokens with org context
2065
+ * authStore.setTokens(result.access_token, result.refresh_token);
2064
2066
  * ```
2065
2067
  */
2066
- createPublic(payload: CreateOrganizationPayload): Promise<CreateOrganizationResponse>;
2068
+ create(payload: CreateOrganizationPayload): Promise<CreateOrganizationResponse>;
2067
2069
  /**
2068
2070
  * List all organizations the authenticated user is a member of.
2069
2071
  *
package/dist/index.js CHANGED
@@ -1356,23 +1356,24 @@ var OrganizationsModule = class {
1356
1356
  this.webhooks = new WebhooksModule(http);
1357
1357
  }
1358
1358
  /**
1359
- * Create a new organization (public endpoint).
1360
- * The organization will be created with 'pending' status and requires
1361
- * platform owner approval before becoming active.
1359
+ * Create a new organization (requires authentication).
1360
+ * The authenticated user becomes the organization owner.
1361
+ * Returns JWT tokens with organization context, eliminating the need to re-authenticate.
1362
1362
  *
1363
1363
  * @param payload Organization creation payload
1364
- * @returns Created organization with owner and membership details
1364
+ * @returns Created organization with owner, membership, and JWT tokens
1365
1365
  *
1366
1366
  * @example
1367
1367
  * ```typescript
1368
- * const result = await sso.organizations.createPublic({
1368
+ * const result = await sso.organizations.create({
1369
1369
  * slug: 'acme-corp',
1370
- * name: 'Acme Corporation',
1371
- * owner_email: 'founder@acme.com'
1370
+ * name: 'Acme Corporation'
1372
1371
  * });
1372
+ * // Store the new tokens with org context
1373
+ * authStore.setTokens(result.access_token, result.refresh_token);
1373
1374
  * ```
1374
1375
  */
1375
- async createPublic(payload) {
1376
+ async create(payload) {
1376
1377
  const response = await this.http.post("/api/organizations", payload);
1377
1378
  return response.data;
1378
1379
  }
package/dist/index.mjs CHANGED
@@ -1322,23 +1322,24 @@ var OrganizationsModule = class {
1322
1322
  this.webhooks = new WebhooksModule(http);
1323
1323
  }
1324
1324
  /**
1325
- * Create a new organization (public endpoint).
1326
- * The organization will be created with 'pending' status and requires
1327
- * platform owner approval before becoming active.
1325
+ * Create a new organization (requires authentication).
1326
+ * The authenticated user becomes the organization owner.
1327
+ * Returns JWT tokens with organization context, eliminating the need to re-authenticate.
1328
1328
  *
1329
1329
  * @param payload Organization creation payload
1330
- * @returns Created organization with owner and membership details
1330
+ * @returns Created organization with owner, membership, and JWT tokens
1331
1331
  *
1332
1332
  * @example
1333
1333
  * ```typescript
1334
- * const result = await sso.organizations.createPublic({
1334
+ * const result = await sso.organizations.create({
1335
1335
  * slug: 'acme-corp',
1336
- * name: 'Acme Corporation',
1337
- * owner_email: 'founder@acme.com'
1336
+ * name: 'Acme Corporation'
1338
1337
  * });
1338
+ * // Store the new tokens with org context
1339
+ * authStore.setTokens(result.access_token, result.refresh_token);
1339
1340
  * ```
1340
1341
  */
1341
- async createPublic(payload) {
1342
+ async create(payload) {
1342
1343
  const response = await this.http.post("/api/organizations", payload);
1343
1344
  return response.data;
1344
1345
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drmhse/sso-sdk",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Zero-dependency TypeScript SDK for the multi-tenant SSO Platform API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",