@meistrari/auth-core 2.3.0 → 2.5.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/dist/index.d.mts +21 -13
- package/dist/index.d.ts +21 -13
- package/dist/index.mjs +14 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -884,7 +884,9 @@ declare class ApplicationService {
|
|
|
884
884
|
* Lists candidate organizations for a specific application.
|
|
885
885
|
*
|
|
886
886
|
* Returns organizations where the authenticated user is a member and
|
|
887
|
-
* the
|
|
887
|
+
* the effective entitlement grants access through its rules. An enabled global
|
|
888
|
+
* entitlement is selected first; organization entitlements are considered only
|
|
889
|
+
* when no global entitlement is enabled.
|
|
888
890
|
*
|
|
889
891
|
* @param applicationId - The application ID to get candidate organizations for
|
|
890
892
|
* @returns The list of candidate organizations
|
|
@@ -993,8 +995,10 @@ declare class ApplicationService {
|
|
|
993
995
|
* Switches the active organization for the authenticated user.
|
|
994
996
|
*
|
|
995
997
|
* Issues new access and refresh tokens scoped to the specified organization.
|
|
996
|
-
*
|
|
997
|
-
*
|
|
998
|
+
* Requires active membership in the target organization and an enabled entitlement
|
|
999
|
+
* whose rules allow the user. The global entitlement is selected first, and its
|
|
1000
|
+
* denial never falls back to an organization entitlement. Organization entitlements
|
|
1001
|
+
* are considered only when no global entitlement is enabled.
|
|
998
1002
|
*
|
|
999
1003
|
* @param organizationId - The ID of the organization to switch to
|
|
1000
1004
|
* @param accessToken - Access token for authentication, sent as the `x-tela-access-token` header
|
|
@@ -1414,7 +1418,7 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
|
|
|
1414
1418
|
getActions: ($fetch: better_auth_client.BetterFetch) => {
|
|
1415
1419
|
customEndpoints: {
|
|
1416
1420
|
organizations: {
|
|
1417
|
-
apiKeys: () => Promise<ApiKeyWithoutSecret[]>;
|
|
1421
|
+
apiKeys: (organizationId?: string) => Promise<ApiKeyWithoutSecret[]>;
|
|
1418
1422
|
};
|
|
1419
1423
|
teams: {
|
|
1420
1424
|
members: (teamId: string) => Promise<TeamMembersResponse>;
|
|
@@ -4434,15 +4438,15 @@ type CreateAdminApplicationOptions = {
|
|
|
4434
4438
|
homeUrl?: string | null;
|
|
4435
4439
|
/** Custom application authentication settings. */
|
|
4436
4440
|
config?: ApplicationConfig | null;
|
|
4437
|
-
/**
|
|
4441
|
+
/** Organization or global entitlements to create for this application. */
|
|
4438
4442
|
entitlements?: CreateAdminApplicationEntitlementOptions[];
|
|
4439
4443
|
};
|
|
4440
4444
|
/**
|
|
4441
|
-
* Options accepted when
|
|
4445
|
+
* Options accepted when creating an organization or global entitlement for an application.
|
|
4442
4446
|
*/
|
|
4443
4447
|
type CreateAdminApplicationEntitlementOptions = {
|
|
4444
|
-
/** Organization
|
|
4445
|
-
organizationId: string;
|
|
4448
|
+
/** Organization ID for type `organization`; passing null creates an entitlement with type `global`. */
|
|
4449
|
+
organizationId: string | null;
|
|
4446
4450
|
};
|
|
4447
4451
|
/**
|
|
4448
4452
|
* Options accepted when creating a client secret for an application.
|
|
@@ -4856,8 +4860,11 @@ type AdminApplicationOrganization = {
|
|
|
4856
4860
|
*/
|
|
4857
4861
|
type AdminApplicationEntitlement = {
|
|
4858
4862
|
id: string;
|
|
4863
|
+
/** Access scope. Defaults to `organization` when omitted; the API returns the resolved type. Type `global` applies across organizations. */
|
|
4864
|
+
entitlementType?: 'organization' | 'global';
|
|
4859
4865
|
applicationId: string;
|
|
4860
|
-
|
|
4866
|
+
/** Required for type `organization` and constrained to null for type `global`. */
|
|
4867
|
+
organizationId: string | null;
|
|
4861
4868
|
enabled: boolean;
|
|
4862
4869
|
createdAt: string;
|
|
4863
4870
|
updatedAt: string;
|
|
@@ -4881,10 +4888,10 @@ type CreateAdminApplicationRoleOptions = Omit<AdminApplicationRole, 'application
|
|
|
4881
4888
|
/** Options accepted when updating an application role. */
|
|
4882
4889
|
type UpdateAdminApplicationRoleOptions = CreateAdminApplicationRoleOptions;
|
|
4883
4890
|
/** Kind of matcher an entitlement rule applies. */
|
|
4884
|
-
type AdminEntitlementRuleType = 'email_equals' | 'email_domain_equals' | 'organization_member' | 'user_id_equals';
|
|
4891
|
+
type AdminEntitlementRuleType = 'email_equals' | 'email_domain_equals' | 'organization_member' | 'user_id_equals' | 'global';
|
|
4885
4892
|
/**
|
|
4886
4893
|
* A single access rule on an entitlement. Rules are evaluated in `position`
|
|
4887
|
-
* order, first match wins. A non-null `role` grants access with that role; a
|
|
4894
|
+
* order with the global catch-all always last, first match wins. A non-null `role` grants access with that role; a
|
|
4888
4895
|
* null `role` denies access.
|
|
4889
4896
|
*/
|
|
4890
4897
|
type AdminEntitlementRule = {
|
|
@@ -6116,11 +6123,12 @@ declare class ApiKeyService {
|
|
|
6116
6123
|
offset: number | undefined;
|
|
6117
6124
|
}>;
|
|
6118
6125
|
/**
|
|
6119
|
-
* Lists all API keys belonging to
|
|
6126
|
+
* Lists all API keys belonging to an organization.
|
|
6120
6127
|
*
|
|
6128
|
+
* @param organizationId - Defaults to the active organization. Only global admins may select another organization.
|
|
6121
6129
|
* @returns An array of API keys (without secret key values)
|
|
6122
6130
|
*/
|
|
6123
|
-
listOrganizationApiKeys(): Promise<ApiKeyWithoutSecret[]>;
|
|
6131
|
+
listOrganizationApiKeys(organizationId?: string): Promise<ApiKeyWithoutSecret[]>;
|
|
6124
6132
|
/**
|
|
6125
6133
|
* Updates an existing API key.
|
|
6126
6134
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -884,7 +884,9 @@ declare class ApplicationService {
|
|
|
884
884
|
* Lists candidate organizations for a specific application.
|
|
885
885
|
*
|
|
886
886
|
* Returns organizations where the authenticated user is a member and
|
|
887
|
-
* the
|
|
887
|
+
* the effective entitlement grants access through its rules. An enabled global
|
|
888
|
+
* entitlement is selected first; organization entitlements are considered only
|
|
889
|
+
* when no global entitlement is enabled.
|
|
888
890
|
*
|
|
889
891
|
* @param applicationId - The application ID to get candidate organizations for
|
|
890
892
|
* @returns The list of candidate organizations
|
|
@@ -993,8 +995,10 @@ declare class ApplicationService {
|
|
|
993
995
|
* Switches the active organization for the authenticated user.
|
|
994
996
|
*
|
|
995
997
|
* Issues new access and refresh tokens scoped to the specified organization.
|
|
996
|
-
*
|
|
997
|
-
*
|
|
998
|
+
* Requires active membership in the target organization and an enabled entitlement
|
|
999
|
+
* whose rules allow the user. The global entitlement is selected first, and its
|
|
1000
|
+
* denial never falls back to an organization entitlement. Organization entitlements
|
|
1001
|
+
* are considered only when no global entitlement is enabled.
|
|
998
1002
|
*
|
|
999
1003
|
* @param organizationId - The ID of the organization to switch to
|
|
1000
1004
|
* @param accessToken - Access token for authentication, sent as the `x-tela-access-token` header
|
|
@@ -1414,7 +1418,7 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
|
|
|
1414
1418
|
getActions: ($fetch: better_auth_client.BetterFetch) => {
|
|
1415
1419
|
customEndpoints: {
|
|
1416
1420
|
organizations: {
|
|
1417
|
-
apiKeys: () => Promise<ApiKeyWithoutSecret[]>;
|
|
1421
|
+
apiKeys: (organizationId?: string) => Promise<ApiKeyWithoutSecret[]>;
|
|
1418
1422
|
};
|
|
1419
1423
|
teams: {
|
|
1420
1424
|
members: (teamId: string) => Promise<TeamMembersResponse>;
|
|
@@ -4434,15 +4438,15 @@ type CreateAdminApplicationOptions = {
|
|
|
4434
4438
|
homeUrl?: string | null;
|
|
4435
4439
|
/** Custom application authentication settings. */
|
|
4436
4440
|
config?: ApplicationConfig | null;
|
|
4437
|
-
/**
|
|
4441
|
+
/** Organization or global entitlements to create for this application. */
|
|
4438
4442
|
entitlements?: CreateAdminApplicationEntitlementOptions[];
|
|
4439
4443
|
};
|
|
4440
4444
|
/**
|
|
4441
|
-
* Options accepted when
|
|
4445
|
+
* Options accepted when creating an organization or global entitlement for an application.
|
|
4442
4446
|
*/
|
|
4443
4447
|
type CreateAdminApplicationEntitlementOptions = {
|
|
4444
|
-
/** Organization
|
|
4445
|
-
organizationId: string;
|
|
4448
|
+
/** Organization ID for type `organization`; passing null creates an entitlement with type `global`. */
|
|
4449
|
+
organizationId: string | null;
|
|
4446
4450
|
};
|
|
4447
4451
|
/**
|
|
4448
4452
|
* Options accepted when creating a client secret for an application.
|
|
@@ -4856,8 +4860,11 @@ type AdminApplicationOrganization = {
|
|
|
4856
4860
|
*/
|
|
4857
4861
|
type AdminApplicationEntitlement = {
|
|
4858
4862
|
id: string;
|
|
4863
|
+
/** Access scope. Defaults to `organization` when omitted; the API returns the resolved type. Type `global` applies across organizations. */
|
|
4864
|
+
entitlementType?: 'organization' | 'global';
|
|
4859
4865
|
applicationId: string;
|
|
4860
|
-
|
|
4866
|
+
/** Required for type `organization` and constrained to null for type `global`. */
|
|
4867
|
+
organizationId: string | null;
|
|
4861
4868
|
enabled: boolean;
|
|
4862
4869
|
createdAt: string;
|
|
4863
4870
|
updatedAt: string;
|
|
@@ -4881,10 +4888,10 @@ type CreateAdminApplicationRoleOptions = Omit<AdminApplicationRole, 'application
|
|
|
4881
4888
|
/** Options accepted when updating an application role. */
|
|
4882
4889
|
type UpdateAdminApplicationRoleOptions = CreateAdminApplicationRoleOptions;
|
|
4883
4890
|
/** Kind of matcher an entitlement rule applies. */
|
|
4884
|
-
type AdminEntitlementRuleType = 'email_equals' | 'email_domain_equals' | 'organization_member' | 'user_id_equals';
|
|
4891
|
+
type AdminEntitlementRuleType = 'email_equals' | 'email_domain_equals' | 'organization_member' | 'user_id_equals' | 'global';
|
|
4885
4892
|
/**
|
|
4886
4893
|
* A single access rule on an entitlement. Rules are evaluated in `position`
|
|
4887
|
-
* order, first match wins. A non-null `role` grants access with that role; a
|
|
4894
|
+
* order with the global catch-all always last, first match wins. A non-null `role` grants access with that role; a
|
|
4888
4895
|
* null `role` denies access.
|
|
4889
4896
|
*/
|
|
4890
4897
|
type AdminEntitlementRule = {
|
|
@@ -6116,11 +6123,12 @@ declare class ApiKeyService {
|
|
|
6116
6123
|
offset: number | undefined;
|
|
6117
6124
|
}>;
|
|
6118
6125
|
/**
|
|
6119
|
-
* Lists all API keys belonging to
|
|
6126
|
+
* Lists all API keys belonging to an organization.
|
|
6120
6127
|
*
|
|
6128
|
+
* @param organizationId - Defaults to the active organization. Only global admins may select another organization.
|
|
6121
6129
|
* @returns An array of API keys (without secret key values)
|
|
6122
6130
|
*/
|
|
6123
|
-
listOrganizationApiKeys(): Promise<ApiKeyWithoutSecret[]>;
|
|
6131
|
+
listOrganizationApiKeys(organizationId?: string): Promise<ApiKeyWithoutSecret[]>;
|
|
6124
6132
|
/**
|
|
6125
6133
|
* Updates an existing API key.
|
|
6126
6134
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,7 @@ function isTokenExpired(token, expiresInMs) {
|
|
|
21
21
|
return nowInSeconds > expirationTime;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const version = "2.
|
|
24
|
+
const version = "2.5.0";
|
|
25
25
|
|
|
26
26
|
function parsedEnumValues(schema) {
|
|
27
27
|
return Object.fromEntries(
|
|
@@ -373,8 +373,8 @@ function customEndpointsPluginClient() {
|
|
|
373
373
|
getActions: ($fetch) => ({
|
|
374
374
|
customEndpoints: {
|
|
375
375
|
organizations: {
|
|
376
|
-
apiKeys: async () => {
|
|
377
|
-
return await $fetch("/custom-endpoints/organizations/api-keys");
|
|
376
|
+
apiKeys: async (organizationId) => {
|
|
377
|
+
return await $fetch("/custom-endpoints/organizations/api-keys", organizationId === void 0 ? void 0 : { query: { organizationId } });
|
|
378
378
|
}
|
|
379
379
|
},
|
|
380
380
|
teams: {
|
|
@@ -1471,7 +1471,9 @@ class ApplicationService {
|
|
|
1471
1471
|
* Lists candidate organizations for a specific application.
|
|
1472
1472
|
*
|
|
1473
1473
|
* Returns organizations where the authenticated user is a member and
|
|
1474
|
-
* the
|
|
1474
|
+
* the effective entitlement grants access through its rules. An enabled global
|
|
1475
|
+
* entitlement is selected first; organization entitlements are considered only
|
|
1476
|
+
* when no global entitlement is enabled.
|
|
1475
1477
|
*
|
|
1476
1478
|
* @param applicationId - The application ID to get candidate organizations for
|
|
1477
1479
|
* @returns The list of candidate organizations
|
|
@@ -1681,8 +1683,10 @@ class ApplicationService {
|
|
|
1681
1683
|
* Switches the active organization for the authenticated user.
|
|
1682
1684
|
*
|
|
1683
1685
|
* Issues new access and refresh tokens scoped to the specified organization.
|
|
1684
|
-
*
|
|
1685
|
-
*
|
|
1686
|
+
* Requires active membership in the target organization and an enabled entitlement
|
|
1687
|
+
* whose rules allow the user. The global entitlement is selected first, and its
|
|
1688
|
+
* denial never falls back to an organization entitlement. Organization entitlements
|
|
1689
|
+
* are considered only when no global entitlement is enabled.
|
|
1686
1690
|
*
|
|
1687
1691
|
* @param organizationId - The ID of the organization to switch to
|
|
1688
1692
|
* @param accessToken - Access token for authentication, sent as the `x-tela-access-token` header
|
|
@@ -2219,12 +2223,13 @@ class ApiKeyService {
|
|
|
2219
2223
|
return await this.client.apiKey.list();
|
|
2220
2224
|
}
|
|
2221
2225
|
/**
|
|
2222
|
-
* Lists all API keys belonging to
|
|
2226
|
+
* Lists all API keys belonging to an organization.
|
|
2223
2227
|
*
|
|
2228
|
+
* @param organizationId - Defaults to the active organization. Only global admins may select another organization.
|
|
2224
2229
|
* @returns An array of API keys (without secret key values)
|
|
2225
2230
|
*/
|
|
2226
|
-
async listOrganizationApiKeys() {
|
|
2227
|
-
return await this.client.customEndpoints.organizations.apiKeys();
|
|
2231
|
+
async listOrganizationApiKeys(organizationId) {
|
|
2232
|
+
return await this.client.customEndpoints.organizations.apiKeys(organizationId);
|
|
2228
2233
|
}
|
|
2229
2234
|
/**
|
|
2230
2235
|
* Updates an existing API key.
|