Skip to content

Commit c8ea701

Browse files
authored
Merge branch 'master' into workerd_fixes
2 parents c78ecf7 + b0c8463 commit c8ea701

File tree

10 files changed

+612
-35
lines changed

10 files changed

+612
-35
lines changed

.github/actions/rl-scanner/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ runs:
3131
- name: Install RL Wrapper
3232
shell: bash
3333
run: |
34-
pip install rl-wrapper>=1.0.0 --index-url "https://${{ env.PRODSEC_TOOLS_USER }}:${{ env.PRODSEC_TOOLS_TOKEN }}@a0us.jfrog.io/artifactory/api/pypi/python-local/simple"
34+
pip install "rl-wrapper>=1.0.9" --index-url "https://${{ env.PRODSEC_TOOLS_USER }}:${{ env.PRODSEC_TOOLS_TOKEN }}@a0us.jfrog.io/artifactory/api/pypi/python-local/simple"
3535
3636
- name: Run RL Scanner
3737
shell: bash

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ export * from './auth/index.js';
33
export * from './userinfo/index.js';
44
export * from './lib/errors.js';
55
export * from './lib/models.js';
6+
export * from './lib/httpResponseHeadersUtils.js';
67
export * from './deprecations.js';
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
export interface TokenQuotaLimit {
2+
quota: number;
3+
remaining: number;
4+
resetAfter: number;
5+
}
6+
7+
export interface TokenQuotaBucket {
8+
perHour?: TokenQuotaLimit;
9+
perDay?: TokenQuotaLimit;
10+
}
11+
12+
export class HttpResponseHeadersUtils {
13+
/**
14+
* Gets the client token quota limits from the provided headers.
15+
*
16+
* @param headers the HTTP response headers.
17+
* @return a TokenQuotaBucket containing client rate limits, or null if not present.
18+
*/
19+
static getClientQuotaLimit(headers: Headers | Record<string, string>): TokenQuotaBucket | null {
20+
const getHeaderValue = (key: string): string | null => {
21+
if (headers instanceof Headers) {
22+
return headers.get(key);
23+
}
24+
return headers[key] || null;
25+
};
26+
27+
const quotaHeader = getHeaderValue('auth0-client-quota-limit');
28+
return quotaHeader ? this.parseQuota(quotaHeader) : null;
29+
}
30+
31+
/**
32+
* Gets the organization token quota limits from the provided headers.
33+
*
34+
* @param headers the HTTP response headers.
35+
* @return a TokenQuotaBucket containing organization rate limits, or null if not present.
36+
*/
37+
static getOrganizationQuotaLimit(
38+
headers: Headers | Record<string, string>
39+
): TokenQuotaBucket | null {
40+
const getHeaderValue = (key: string): string | null => {
41+
if (headers instanceof Headers) {
42+
return headers.get(key);
43+
}
44+
return headers[key] || null;
45+
};
46+
47+
const quotaHeader = getHeaderValue('auth0-organization-quota-limit');
48+
return quotaHeader ? this.parseQuota(quotaHeader) : null;
49+
}
50+
51+
/**
52+
* Parses a token quota string into a TokenQuotaBucket.
53+
*
54+
* @param tokenQuota the token quota string.
55+
* @return a TokenQuotaBucket containing parsed rate limits.
56+
*/
57+
private static parseQuota(tokenQuota: string): TokenQuotaBucket {
58+
let perHour: TokenQuotaLimit | undefined;
59+
let perDay: TokenQuotaLimit | undefined;
60+
61+
const parts = tokenQuota.split(',');
62+
for (const part of parts) {
63+
const attributes = part.split(';');
64+
let quota = 0,
65+
remaining = 0,
66+
resetAfter = 0;
67+
68+
for (const attribute of attributes) {
69+
const [key, value] = attribute.split('=').map((s) => s.trim());
70+
if (!key || !value) continue;
71+
72+
switch (key) {
73+
case 'q':
74+
quota = parseInt(value, 10);
75+
break;
76+
case 'r':
77+
remaining = parseInt(value, 10);
78+
break;
79+
case 't':
80+
resetAfter = parseInt(value, 10);
81+
break;
82+
}
83+
}
84+
85+
if (attributes.length > 0 && attributes[0].includes('per_hour')) {
86+
perHour = { quota, remaining, resetAfter };
87+
} else if (attributes.length > 0 && attributes[0].includes('per_day')) {
88+
perDay = { quota, remaining, resetAfter };
89+
}
90+
}
91+
92+
return { perHour, perDay };
93+
}
94+
}

src/management/__generated/managers/organizations-manager.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ export class OrganizationsManager extends BaseAPI {
488488
}
489489

490490
/**
491-
* Get a specific organization by name
491+
* Retrieve details about a single Organization specified by name.
492492
*
493493
* Get organization by name
494494
*
@@ -627,19 +627,25 @@ export class OrganizationsManager extends BaseAPI {
627627
}
628628

629629
/**
630-
* List available organizations. This endpoint supports two types of pagination:
631-
* - Offset pagination
632-
* - Checkpoint pagination
630+
* Retrieve detailed list of all Organizations available in your tenant. For more information, see Auth0 Organizations.
631+
*
632+
* This endpoint supports two types of pagination:
633+
* <ul>
634+
* <li>Offset pagination</li>
635+
* <li>Checkpoint pagination</li>
636+
* </ul>
633637
*
634638
* Checkpoint pagination must be used if you need to retrieve more than 1000 organizations.
635639
*
636640
* <h2>Checkpoint Pagination</h2>
637641
*
638642
* To search by checkpoint, use the following parameters:
639-
* - from: Optional id from which to start selection.
640-
* - take: The total amount of entries to retrieve when using the from parameter. Defaults to 50.
643+
* <ul>
644+
* <li><code>from</code>: Optional id from which to start selection.</li>
645+
* <li><code>take</code>: The total number of entries to retrieve when using the <code>from</code> parameter. Defaults to 50.</li>
646+
* </ul>
641647
*
642-
* Note: The first time you call this endpoint using Checkpoint Pagination, you should omit the <code>from</code> parameter. If there are more results, a <code>next</code> value will be included in the response. You can use this for subsequent API calls. When <code>next</code> is no longer included in the response, this indicates there are no more pages remaining.
648+
* <b>Note</b>: The first time you call this endpoint using checkpoint pagination, omit the <code>from</code> parameter. If there are more results, a <code>next</code> value is included in the response. You can use this for subsequent API calls. When <code>next</code> is no longer included in the response, no pages are remaining.
643649
*
644650
* Get organizations
645651
*
@@ -697,7 +703,7 @@ export class OrganizationsManager extends BaseAPI {
697703
}
698704

699705
/**
700-
* Get a specific organization
706+
* Retrieve details about a single Organization specified by ID.
701707
*
702708
* Get organization
703709
*
@@ -757,7 +763,7 @@ export class OrganizationsManager extends BaseAPI {
757763
}
758764

759765
/**
760-
* Modify an organization
766+
* Update the details of a specific <a href="https://auth0.com/docs/manage-users/organizations/configure-organizations/create-organizations">Organization</a>, such as name and display name, branding options, and metadata.
761767
*
762768
* Modify an Organization
763769
*
@@ -950,7 +956,7 @@ export class OrganizationsManager extends BaseAPI {
950956
}
951957

952958
/**
953-
* Create an organization
959+
* Create a new Organization within your tenant. To learn more about Organization settings, behavior, and configuration options, review <a href="https://auth0.com/docs/manage-users/organizations/create-first-organization">Create Your First Organization</a>.
954960
*
955961
* Create an Organization
956962
*

src/management/__generated/managers/users-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ export class UsersManager extends BaseAPI {
689689
}
690690

691691
/**
692-
* This endpoint will retrieve all organizations that the specified user is a member of.
692+
* Retrieve list of the specified user's current Organization memberships. User must be specified by user ID. For more information, review <a href="https://auth0.com/docs/manage-users/organizations">Auth0 Organizations</a>.
693693
*
694694
* List user's organizations
695695
*

0 commit comments

Comments
 (0)