authula 0.7.10 → 0.7.12

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.
@@ -17,16 +17,26 @@ function wrapGenerated(mod, client) {
17
17
  wrapped[key] = value;
18
18
  continue;
19
19
  }
20
- if (isHookKey(key)) wrapped[key] = (options, ...rest) => value({
21
- ...options,
22
- request: {
23
- ...options?.request,
20
+ if (isHookKey(key)) wrapped[key] = (...args) => {
21
+ const ctx = {
24
22
  baseUrl,
25
23
  cookies,
26
24
  onBeforeFetch,
27
25
  onAfterFetch
28
- }
29
- }, ...rest);
26
+ };
27
+ let optionsIdx = Math.max(0, value.length - 2);
28
+ if (args[optionsIdx] != null && typeof args[optionsIdx] !== "object") optionsIdx = Math.max(0, value.length - 1);
29
+ while (args.length <= optionsIdx) args.push(void 0);
30
+ const existing = args[optionsIdx] ?? {};
31
+ args[optionsIdx] = {
32
+ ...typeof existing === "object" && existing !== null ? existing : {},
33
+ request: {
34
+ ...existing?.request ?? {},
35
+ ...ctx
36
+ }
37
+ };
38
+ return value(...args);
39
+ };
30
40
  else wrapped[key] = (...args) => {
31
41
  const ctx = {
32
42
  baseUrl,
@@ -3767,26 +3777,31 @@ const withQueryKey$5 = (query, queryKey) => {
3767
3777
  }
3768
3778
  return result;
3769
3779
  };
3770
- const getListOrganizationsUrl = () => {
3771
- return `/organizations`;
3780
+ const getListOrganizationsUrl = (params) => {
3781
+ const normalizedParams = new URLSearchParams();
3782
+ Object.entries(params || {}).forEach(([key, value]) => {
3783
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
3784
+ });
3785
+ const stringifiedParams = normalizedParams.toString();
3786
+ return stringifiedParams.length > 0 ? `/organizations?${stringifiedParams}` : `/organizations`;
3772
3787
  };
3773
3788
  /**
3774
- * Lists all organizations owned by the authenticated user.
3789
+ * Lists every organization the authenticated user can access, both the ones they own and the ones they are a member of, newest first. Results are paginated: `page` defaults to 1 and `limit` defaults to 10, with a hard maximum of 100. Out-of-range values are clamped silently rather than rejected.
3775
3790
  * @summary List organizations
3776
3791
  */
3777
- const listOrganizations = async (options) => {
3778
- return customFetch(getListOrganizationsUrl(), {
3792
+ const listOrganizations = async (params, options) => {
3793
+ return customFetch(getListOrganizationsUrl(params), {
3779
3794
  ...options,
3780
3795
  method: "GET"
3781
3796
  });
3782
3797
  };
3783
- const getListOrganizationsQueryKey = () => {
3784
- return [`/organizations`];
3798
+ const getListOrganizationsQueryKey = (params) => {
3799
+ return [`/organizations`, ...params ? [params] : []];
3785
3800
  };
3786
- const getListOrganizationsQueryOptions = (options) => {
3801
+ const getListOrganizationsQueryOptions = (params, options) => {
3787
3802
  const { query: queryOptions, request: requestOptions } = options ?? {};
3788
- const queryKey = queryOptions?.queryKey ?? getListOrganizationsQueryKey();
3789
- const queryFn = ({ signal }) => listOrganizations({
3803
+ const queryKey = queryOptions?.queryKey ?? getListOrganizationsQueryKey(params);
3804
+ const queryFn = ({ signal }) => listOrganizations(params, {
3790
3805
  signal,
3791
3806
  ...requestOptions
3792
3807
  });
@@ -3799,8 +3814,8 @@ const getListOrganizationsQueryOptions = (options) => {
3799
3814
  /**
3800
3815
  * @summary List organizations
3801
3816
  */
3802
- function useListOrganizations(options, queryClient) {
3803
- const queryOptions = getListOrganizationsQueryOptions(options);
3817
+ function useListOrganizations(params, options, queryClient) {
3818
+ const queryOptions = getListOrganizationsQueryOptions(params, options);
3804
3819
  const query = useQuery(queryOptions, queryClient);
3805
3820
  return withQueryKey$5(query, queryOptions.queryKey);
3806
3821
  }
@@ -4015,26 +4030,31 @@ const withQueryKey$4 = (query, queryKey) => {
4015
4030
  }
4016
4031
  return result;
4017
4032
  };
4018
- const getListOrganizationInvitationsUrl = (organizationId) => {
4019
- return `/organizations/${organizationId}/invitations`;
4033
+ const getListOrganizationInvitationsUrl = (organizationId, params) => {
4034
+ const normalizedParams = new URLSearchParams();
4035
+ Object.entries(params || {}).forEach(([key, value]) => {
4036
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
4037
+ });
4038
+ const stringifiedParams = normalizedParams.toString();
4039
+ return stringifiedParams.length > 0 ? `/organizations/${organizationId}/invitations?${stringifiedParams}` : `/organizations/${organizationId}/invitations`;
4020
4040
  };
4021
4041
  /**
4022
- * Lists all invitations for an organization.
4042
+ * Lists the invitations for an organization, newest first. Results are paginated: `page` defaults to 1 and `limit` defaults to 10, with a hard maximum of 100. Out-of-range values are clamped silently rather than rejected.
4023
4043
  * @summary List invitations
4024
4044
  */
4025
- const listOrganizationInvitations = async (organizationId, options) => {
4026
- return customFetch(getListOrganizationInvitationsUrl(organizationId), {
4045
+ const listOrganizationInvitations = async (organizationId, params, options) => {
4046
+ return customFetch(getListOrganizationInvitationsUrl(organizationId, params), {
4027
4047
  ...options,
4028
4048
  method: "GET"
4029
4049
  });
4030
4050
  };
4031
- const getListOrganizationInvitationsQueryKey = (organizationId) => {
4032
- return [`/organizations/${organizationId}/invitations`];
4051
+ const getListOrganizationInvitationsQueryKey = (organizationId, params) => {
4052
+ return [`/organizations/${organizationId}/invitations`, ...params ? [params] : []];
4033
4053
  };
4034
- const getListOrganizationInvitationsQueryOptions = (organizationId, options) => {
4054
+ const getListOrganizationInvitationsQueryOptions = (organizationId, params, options) => {
4035
4055
  const { query: queryOptions, request: requestOptions } = options ?? {};
4036
- const queryKey = queryOptions?.queryKey ?? getListOrganizationInvitationsQueryKey(organizationId);
4037
- const queryFn = ({ signal }) => listOrganizationInvitations(organizationId, {
4056
+ const queryKey = queryOptions?.queryKey ?? getListOrganizationInvitationsQueryKey(organizationId, params);
4057
+ const queryFn = ({ signal }) => listOrganizationInvitations(organizationId, params, {
4038
4058
  signal,
4039
4059
  ...requestOptions
4040
4060
  });
@@ -4048,8 +4068,8 @@ const getListOrganizationInvitationsQueryOptions = (organizationId, options) =>
4048
4068
  /**
4049
4069
  * @summary List invitations
4050
4070
  */
4051
- function useListOrganizationInvitations(organizationId, options, queryClient) {
4052
- const queryOptions = getListOrganizationInvitationsQueryOptions(organizationId, options);
4071
+ function useListOrganizationInvitations(organizationId, params, options, queryClient) {
4072
+ const queryOptions = getListOrganizationInvitationsQueryOptions(organizationId, params, options);
4053
4073
  const query = useQuery(queryOptions, queryClient);
4054
4074
  return withQueryKey$4(query, queryOptions.queryKey);
4055
4075
  }
@@ -4324,7 +4344,7 @@ const getListOrganizationMembersUrl = (organizationId, params) => {
4324
4344
  return stringifiedParams.length > 0 ? `/organizations/${organizationId}/members?${stringifiedParams}` : `/organizations/${organizationId}/members`;
4325
4345
  };
4326
4346
  /**
4327
- * Lists all members of an organization with pagination.
4347
+ * Lists the members of an organization, newest first. Results are paginated: `page` defaults to 1 and `limit` defaults to 10, with a hard maximum of 100. Out-of-range values are clamped silently rather than rejected.
4328
4348
  * @summary List members
4329
4349
  */
4330
4350
  const listOrganizationMembers = async (organizationId, params, options) => {
@@ -4603,26 +4623,31 @@ const withQueryKey$2 = (query, queryKey) => {
4603
4623
  }
4604
4624
  return result;
4605
4625
  };
4606
- const getListOrganizationTeamsUrl = (organizationId) => {
4607
- return `/organizations/${organizationId}/teams`;
4626
+ const getListOrganizationTeamsUrl = (organizationId, params) => {
4627
+ const normalizedParams = new URLSearchParams();
4628
+ Object.entries(params || {}).forEach(([key, value]) => {
4629
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
4630
+ });
4631
+ const stringifiedParams = normalizedParams.toString();
4632
+ return stringifiedParams.length > 0 ? `/organizations/${organizationId}/teams?${stringifiedParams}` : `/organizations/${organizationId}/teams`;
4608
4633
  };
4609
4634
  /**
4610
- * Lists all teams within an organization.
4635
+ * Lists the teams within an organization, newest first. Results are paginated: `page` defaults to 1 and `limit` defaults to 10, with a hard maximum of 100. Out-of-range values are clamped silently rather than rejected.
4611
4636
  * @summary List teams
4612
4637
  */
4613
- const listOrganizationTeams = async (organizationId, options) => {
4614
- return customFetch(getListOrganizationTeamsUrl(organizationId), {
4638
+ const listOrganizationTeams = async (organizationId, params, options) => {
4639
+ return customFetch(getListOrganizationTeamsUrl(organizationId, params), {
4615
4640
  ...options,
4616
4641
  method: "GET"
4617
4642
  });
4618
4643
  };
4619
- const getListOrganizationTeamsQueryKey = (organizationId) => {
4620
- return [`/organizations/${organizationId}/teams`];
4644
+ const getListOrganizationTeamsQueryKey = (organizationId, params) => {
4645
+ return [`/organizations/${organizationId}/teams`, ...params ? [params] : []];
4621
4646
  };
4622
- const getListOrganizationTeamsQueryOptions = (organizationId, options) => {
4647
+ const getListOrganizationTeamsQueryOptions = (organizationId, params, options) => {
4623
4648
  const { query: queryOptions, request: requestOptions } = options ?? {};
4624
- const queryKey = queryOptions?.queryKey ?? getListOrganizationTeamsQueryKey(organizationId);
4625
- const queryFn = ({ signal }) => listOrganizationTeams(organizationId, {
4649
+ const queryKey = queryOptions?.queryKey ?? getListOrganizationTeamsQueryKey(organizationId, params);
4650
+ const queryFn = ({ signal }) => listOrganizationTeams(organizationId, params, {
4626
4651
  signal,
4627
4652
  ...requestOptions
4628
4653
  });
@@ -4636,8 +4661,8 @@ const getListOrganizationTeamsQueryOptions = (organizationId, options) => {
4636
4661
  /**
4637
4662
  * @summary List teams
4638
4663
  */
4639
- function useListOrganizationTeams(organizationId, options, queryClient) {
4640
- const queryOptions = getListOrganizationTeamsQueryOptions(organizationId, options);
4664
+ function useListOrganizationTeams(organizationId, params, options, queryClient) {
4665
+ const queryOptions = getListOrganizationTeamsQueryOptions(organizationId, params, options);
4641
4666
  const query = useQuery(queryOptions, queryClient);
4642
4667
  return withQueryKey$2(query, queryOptions.queryKey);
4643
4668
  }
@@ -4853,7 +4878,7 @@ const getListOrganizationTeamMembersUrl = (organizationId, teamId, params) => {
4853
4878
  return stringifiedParams.length > 0 ? `/organizations/${organizationId}/teams/${teamId}/members?${stringifiedParams}` : `/organizations/${organizationId}/teams/${teamId}/members`;
4854
4879
  };
4855
4880
  /**
4856
- * Lists all members of a team with pagination.
4881
+ * Lists the members of a team, newest first. Results are paginated: `page` defaults to 1 and `limit` defaults to 10, with a hard maximum of 100. Out-of-range values are clamped silently rather than rejected.
4857
4882
  * @summary List team members
4858
4883
  */
4859
4884
  const listOrganizationTeamMembers = async (organizationId, teamId, params, options) => {