@voyantjs/auth-react 0.31.1 → 0.31.2

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.
@@ -5,5 +5,7 @@ export { type CancelOrganizationInvitationInput, type InviteOrganizationMemberIn
5
5
  export { type UseOrganizationInvitationsOptions, useOrganizationInvitations, } from "./use-organization-invitations.js";
6
6
  export { type RemoveOrganizationMemberInput, type UpdateOrganizationMemberRoleInput, useOrganizationMemberMutation, } from "./use-organization-member-mutation.js";
7
7
  export { type UseOrganizationMembersOptions, useOrganizationMembers, } from "./use-organization-members.js";
8
+ export { type CreateApiTokenInput, type CreateServiceApiKeyInput, type DeleteApiTokenInput, type DeleteServiceApiKeyInput, type UpdateApiTokenInput, type UpdateServiceApiKeyInput, useApiTokenMutation, useServiceApiKeyMutation, } from "./use-service-api-key-mutation.js";
9
+ export { type UseApiTokensOptions, type UseServiceApiKeysOptions, useApiTokens, useServiceApiKeys, } from "./use-service-api-keys.js";
8
10
  export { useWorkspaceMutation } from "./use-workspace-mutation.js";
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAC/E,OAAO,EAAE,KAAK,qBAAqB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAClF,OAAO,EAAE,KAAK,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACjG,OAAO,EACL,KAAK,iCAAiC,EACtC,KAAK,6BAA6B,EAClC,iCAAiC,GAClC,MAAM,2CAA2C,CAAA;AAClD,OAAO,EACL,KAAK,iCAAiC,EACtC,0BAA0B,GAC3B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,iCAAiC,EACtC,6BAA6B,GAC9B,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACL,KAAK,6BAA6B,EAClC,sBAAsB,GACvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAC/E,OAAO,EAAE,KAAK,qBAAqB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAClF,OAAO,EAAE,KAAK,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACjG,OAAO,EACL,KAAK,iCAAiC,EACtC,KAAK,6BAA6B,EAClC,iCAAiC,GAClC,MAAM,2CAA2C,CAAA;AAClD,OAAO,EACL,KAAK,iCAAiC,EACtC,0BAA0B,GAC3B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,iCAAiC,EACtC,6BAA6B,GAC9B,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACL,KAAK,6BAA6B,EAClC,sBAAsB,GACvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,YAAY,EACZ,iBAAiB,GAClB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA"}
@@ -5,4 +5,6 @@ export { useOrganizationInvitationMutation, } from "./use-organization-invitatio
5
5
  export { useOrganizationInvitations, } from "./use-organization-invitations.js";
6
6
  export { useOrganizationMemberMutation, } from "./use-organization-member-mutation.js";
7
7
  export { useOrganizationMembers, } from "./use-organization-members.js";
8
+ export { useApiTokenMutation, useServiceApiKeyMutation, } from "./use-service-api-key-mutation.js";
9
+ export { useApiTokens, useServiceApiKeys, } from "./use-service-api-keys.js";
8
10
  export { useWorkspaceMutation } from "./use-workspace-mutation.js";
@@ -0,0 +1,77 @@
1
+ import type { ApiKeyPermissions } from "@voyantjs/types/api-keys";
2
+ export interface CreateServiceApiKeyInput {
3
+ name: string;
4
+ permissions: ApiKeyPermissions;
5
+ expiresIn?: number | null;
6
+ remaining?: number | null;
7
+ prefix?: string;
8
+ configId?: string;
9
+ organizationId?: string;
10
+ metadata?: Record<string, unknown> | null;
11
+ }
12
+ export type CreateApiTokenInput = CreateServiceApiKeyInput;
13
+ export interface UpdateServiceApiKeyInput {
14
+ keyId: string;
15
+ name?: string;
16
+ enabled?: boolean;
17
+ permissions?: ApiKeyPermissions;
18
+ expiresIn?: number | null;
19
+ configId?: string;
20
+ metadata?: Record<string, unknown> | null;
21
+ }
22
+ export type UpdateApiTokenInput = UpdateServiceApiKeyInput;
23
+ export interface DeleteServiceApiKeyInput {
24
+ keyId: string;
25
+ configId?: string;
26
+ }
27
+ export type DeleteApiTokenInput = DeleteServiceApiKeyInput;
28
+ export declare function useServiceApiKeyMutation(): {
29
+ create: import("@tanstack/react-query").UseMutationResult<{
30
+ configId: string;
31
+ name: string | null;
32
+ enabled: boolean;
33
+ permissions: ApiKeyPermissions;
34
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
35
+ id: string;
36
+ createdAt: string;
37
+ key: string;
38
+ start?: string | null | undefined;
39
+ prefix?: string | null | undefined;
40
+ referenceId?: string | null | undefined;
41
+ rateLimitEnabled?: boolean | null | undefined;
42
+ rateLimitTimeWindow?: number | null | undefined;
43
+ rateLimitMax?: number | null | undefined;
44
+ requestCount?: number | null | undefined;
45
+ remaining?: number | null | undefined;
46
+ lastRequest?: string | null | undefined;
47
+ updatedAt?: string | null | undefined;
48
+ expiresAt?: string | null | undefined;
49
+ metadata?: unknown;
50
+ }, Error, CreateServiceApiKeyInput, unknown>;
51
+ update: import("@tanstack/react-query").UseMutationResult<{
52
+ configId: string;
53
+ name: string | null;
54
+ enabled: boolean;
55
+ permissions: ApiKeyPermissions;
56
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
57
+ id: string;
58
+ createdAt: string;
59
+ start?: string | null | undefined;
60
+ prefix?: string | null | undefined;
61
+ referenceId?: string | null | undefined;
62
+ rateLimitEnabled?: boolean | null | undefined;
63
+ rateLimitTimeWindow?: number | null | undefined;
64
+ rateLimitMax?: number | null | undefined;
65
+ requestCount?: number | null | undefined;
66
+ remaining?: number | null | undefined;
67
+ lastRequest?: string | null | undefined;
68
+ updatedAt?: string | null | undefined;
69
+ expiresAt?: string | null | undefined;
70
+ metadata?: unknown;
71
+ }, Error, UpdateServiceApiKeyInput, unknown>;
72
+ remove: import("@tanstack/react-query").UseMutationResult<{
73
+ success: boolean;
74
+ }, Error, DeleteServiceApiKeyInput, unknown>;
75
+ };
76
+ export declare const useApiTokenMutation: typeof useServiceApiKeyMutation;
77
+ //# sourceMappingURL=use-service-api-key-mutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-service-api-key-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-service-api-key-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAWjE,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,iBAAiB,CAAA;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CAC1C;AAED,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,CAAA;AAE1D,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CAC1C;AAED,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,CAAA;AAE1D,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,CAAA;AAM1D,wBAAgB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4DvC;AAED,eAAO,MAAM,mBAAmB,iCAA2B,CAAA"}
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { fetchWithValidation } from "../client.js";
4
+ import { useVoyantAuthContext } from "../provider.js";
5
+ import { authQueryKeys } from "../query-keys.js";
6
+ import { deleteServiceApiKeyResponseSchema, serviceApiKeySchema, serviceApiKeyWithSecretSchema, } from "../schemas.js";
7
+ function invalidateApiKeyQueries(queryClient) {
8
+ void queryClient.invalidateQueries({ queryKey: authQueryKeys.serviceApiKeys() });
9
+ }
10
+ export function useServiceApiKeyMutation() {
11
+ const { baseUrl, fetcher } = useVoyantAuthContext();
12
+ const queryClient = useQueryClient();
13
+ const create = useMutation({
14
+ mutationFn: async (input) => fetchWithValidation("/auth/api-tokens", serviceApiKeyWithSecretSchema, { baseUrl, fetcher }, {
15
+ method: "POST",
16
+ body: JSON.stringify({
17
+ configId: input.configId,
18
+ name: input.name,
19
+ expiresIn: input.expiresIn ?? undefined,
20
+ remaining: input.remaining ?? undefined,
21
+ prefix: input.prefix,
22
+ organizationId: input.organizationId,
23
+ metadata: input.metadata ?? undefined,
24
+ permissions: input.permissions,
25
+ }),
26
+ }),
27
+ onSuccess: () => invalidateApiKeyQueries(queryClient),
28
+ });
29
+ const update = useMutation({
30
+ mutationFn: async (input) => fetchWithValidation(`/auth/api-tokens/${encodeURIComponent(input.keyId)}`, serviceApiKeySchema, { baseUrl, fetcher }, {
31
+ method: "POST",
32
+ body: JSON.stringify({
33
+ configId: input.configId,
34
+ name: input.name,
35
+ enabled: input.enabled,
36
+ expiresIn: input.expiresIn ?? undefined,
37
+ metadata: input.metadata ?? undefined,
38
+ ...(input.permissions ? { permissions: input.permissions } : {}),
39
+ }),
40
+ }),
41
+ onSuccess: () => invalidateApiKeyQueries(queryClient),
42
+ });
43
+ const remove = useMutation({
44
+ mutationFn: async (input) => fetchWithValidation(`/auth/api-tokens/${encodeURIComponent(input.keyId)}`, deleteServiceApiKeyResponseSchema, { baseUrl, fetcher }, { method: "DELETE", body: JSON.stringify({ configId: input.configId }) }),
45
+ onSuccess: () => invalidateApiKeyQueries(queryClient),
46
+ });
47
+ return { create, update, remove };
48
+ }
49
+ export const useApiTokenMutation = useServiceApiKeyMutation;
@@ -0,0 +1,33 @@
1
+ import type { ServiceApiKeysListFilters } from "../query-keys.js";
2
+ export interface UseServiceApiKeysOptions extends ServiceApiKeysListFilters {
3
+ enabled?: boolean;
4
+ }
5
+ export declare function useServiceApiKeys(options?: UseServiceApiKeysOptions): import("@tanstack/react-query").UseQueryResult<{
6
+ apiKeys: {
7
+ configId: string;
8
+ name: string | null;
9
+ enabled: boolean;
10
+ permissions: import("@voyantjs/types/api-keys").ApiKeyPermissions;
11
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
12
+ id: string;
13
+ createdAt: string;
14
+ start?: string | null | undefined;
15
+ prefix?: string | null | undefined;
16
+ referenceId?: string | null | undefined;
17
+ rateLimitEnabled?: boolean | null | undefined;
18
+ rateLimitTimeWindow?: number | null | undefined;
19
+ rateLimitMax?: number | null | undefined;
20
+ requestCount?: number | null | undefined;
21
+ remaining?: number | null | undefined;
22
+ lastRequest?: string | null | undefined;
23
+ updatedAt?: string | null | undefined;
24
+ expiresAt?: string | null | undefined;
25
+ metadata?: unknown;
26
+ }[];
27
+ total: number;
28
+ limit?: number | null | undefined;
29
+ offset?: number | null | undefined;
30
+ }, Error>;
31
+ export type UseApiTokensOptions = UseServiceApiKeysOptions;
32
+ export declare const useApiTokens: typeof useServiceApiKeys;
33
+ //# sourceMappingURL=use-service-api-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-service-api-keys.d.ts","sourceRoot":"","sources":["../../src/hooks/use-service-api-keys.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAGjE,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B;;;;;;;;;;;;;;;;;;;;;;;;;UAQvE;AAED,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,CAAA;AAC1D,eAAO,MAAM,YAAY,0BAAoB,CAAA"}
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { useVoyantAuthContext } from "../provider.js";
4
+ import { getServiceApiKeysQueryOptions } from "../query-options.js";
5
+ export function useServiceApiKeys(options = {}) {
6
+ const { baseUrl, fetcher } = useVoyantAuthContext();
7
+ const { enabled = true, ...filters } = options;
8
+ return useQuery({
9
+ ...getServiceApiKeysQueryOptions(filters, { baseUrl, fetcher }),
10
+ enabled,
11
+ });
12
+ }
13
+ export const useApiTokens = useServiceApiKeys;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export type { AuthStatus, CurrentUser } from "@voyantjs/auth/workspace";
2
2
  export { defaultFetcher, fetchWithValidation, VoyantApiError, type VoyantFetcher, withQueryParams, } from "./client.js";
3
3
  export * from "./hooks/index.js";
4
4
  export { useVoyantAuthContext, type VoyantAuthContextValue, VoyantAuthProvider, type VoyantAuthProviderProps, } from "./provider.js";
5
- export { authQueryKeys, type OrganizationInvitationsListFilters, type OrganizationMembersListFilters, } from "./query-keys.js";
6
- export { getAuthStatusQueryOptions, getCurrentUserQueryOptions, getCurrentWorkspaceQueryOptions, getOrganizationInvitationsQueryOptions, getOrganizationMembersQueryOptions, } from "./query-options.js";
5
+ export { authQueryKeys, type OrganizationInvitationsListFilters, type OrganizationMembersListFilters, type ServiceApiKeysListFilters, } from "./query-keys.js";
6
+ export { getAuthStatusQueryOptions, getCurrentUserQueryOptions, getCurrentWorkspaceQueryOptions, getOrganizationInvitationsQueryOptions, getOrganizationMembersQueryOptions, getServiceApiKeysQueryOptions, } from "./query-options.js";
7
7
  export * from "./schemas.js";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,EAClB,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,oBAAoB,EACpB,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,aAAa,EACb,KAAK,kCAAkC,EACvC,KAAK,8BAA8B,GACpC,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,sCAAsC,EACtC,kCAAkC,GACnC,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,EAClB,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,oBAAoB,EACpB,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,aAAa,EACb,KAAK,kCAAkC,EACvC,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,GAC/B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,sCAAsC,EACtC,kCAAkC,EAClC,6BAA6B,GAC9B,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA"}
package/dist/index.js CHANGED
@@ -2,5 +2,5 @@ export { defaultFetcher, fetchWithValidation, VoyantApiError, withQueryParams, }
2
2
  export * from "./hooks/index.js";
3
3
  export { useVoyantAuthContext, VoyantAuthProvider, } from "./provider.js";
4
4
  export { authQueryKeys, } from "./query-keys.js";
5
- export { getAuthStatusQueryOptions, getCurrentUserQueryOptions, getCurrentWorkspaceQueryOptions, getOrganizationInvitationsQueryOptions, getOrganizationMembersQueryOptions, } from "./query-options.js";
5
+ export { getAuthStatusQueryOptions, getCurrentUserQueryOptions, getCurrentWorkspaceQueryOptions, getOrganizationInvitationsQueryOptions, getOrganizationMembersQueryOptions, getServiceApiKeysQueryOptions, } from "./query-options.js";
6
6
  export * from "./schemas.js";
@@ -4,6 +4,14 @@ export interface OrganizationMembersListFilters {
4
4
  export interface OrganizationInvitationsListFilters {
5
5
  organizationId?: string;
6
6
  }
7
+ export interface ServiceApiKeysListFilters {
8
+ configId?: string;
9
+ organizationId?: string;
10
+ limit?: number;
11
+ offset?: number;
12
+ sortBy?: string;
13
+ sortDirection?: "asc" | "desc";
14
+ }
7
15
  export declare const authQueryKeys: {
8
16
  all: readonly ["auth"];
9
17
  currentUser: () => readonly ["auth", "current-user"];
@@ -11,5 +19,6 @@ export declare const authQueryKeys: {
11
19
  currentWorkspace: () => readonly ["auth", "current-workspace"];
12
20
  organizationMembers: (filters?: OrganizationMembersListFilters) => readonly ["auth", "organization-members", OrganizationMembersListFilters];
13
21
  organizationInvitations: (filters?: OrganizationInvitationsListFilters) => readonly ["auth", "organization-invitations", OrganizationInvitationsListFilters];
22
+ serviceApiKeys: (filters?: ServiceApiKeysListFilters) => readonly ["auth", "service-api-keys", ServiceApiKeysListFilters];
14
23
  };
15
24
  //# sourceMappingURL=query-keys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,8BAA8B;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,kCAAkC;IACjD,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,eAAO,MAAM,aAAa;;;;;oCAKO,8BAA8B;wCAE1B,kCAAkC;CAEtE,CAAA"}
1
+ {"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,8BAA8B;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,kCAAkC;IACjD,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CAC/B;AAED,eAAO,MAAM,aAAa;;;;;oCAKO,8BAA8B;wCAE1B,kCAAkC;+BAE3C,yBAAyB;CAEpD,CAAA"}
@@ -5,4 +5,5 @@ export const authQueryKeys = {
5
5
  currentWorkspace: () => [...authQueryKeys.all, "current-workspace"],
6
6
  organizationMembers: (filters = {}) => [...authQueryKeys.all, "organization-members", filters],
7
7
  organizationInvitations: (filters = {}) => [...authQueryKeys.all, "organization-invitations", filters],
8
+ serviceApiKeys: (filters = {}) => [...authQueryKeys.all, "service-api-keys", filters],
8
9
  };
@@ -1,5 +1,5 @@
1
1
  import { type FetchWithValidationOptions } from "./client.js";
2
- import { type OrganizationInvitationsListFilters, type OrganizationMembersListFilters } from "./query-keys.js";
2
+ import { type OrganizationInvitationsListFilters, type OrganizationMembersListFilters, type ServiceApiKeysListFilters } from "./query-keys.js";
3
3
  export declare function getCurrentUserQueryOptions(client: FetchWithValidationOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
4
4
  id: string;
5
5
  email: string | null;
@@ -256,4 +256,112 @@ export declare function getOrganizationInvitationsQueryOptions(filters: Organiza
256
256
  [dataTagErrorSymbol]: Error;
257
257
  };
258
258
  };
259
+ export declare function getServiceApiKeysQueryOptions(filters: ServiceApiKeysListFilters, client: FetchWithValidationOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
260
+ apiKeys: {
261
+ configId: string;
262
+ name: string | null;
263
+ enabled: boolean;
264
+ permissions: import("@voyantjs/types/api-keys").ApiKeyPermissions;
265
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
266
+ id: string;
267
+ createdAt: string;
268
+ start?: string | null | undefined;
269
+ prefix?: string | null | undefined;
270
+ referenceId?: string | null | undefined;
271
+ rateLimitEnabled?: boolean | null | undefined;
272
+ rateLimitTimeWindow?: number | null | undefined;
273
+ rateLimitMax?: number | null | undefined;
274
+ requestCount?: number | null | undefined;
275
+ remaining?: number | null | undefined;
276
+ lastRequest?: string | null | undefined;
277
+ updatedAt?: string | null | undefined;
278
+ expiresAt?: string | null | undefined;
279
+ metadata?: unknown;
280
+ }[];
281
+ total: number;
282
+ limit?: number | null | undefined;
283
+ offset?: number | null | undefined;
284
+ }, Error, {
285
+ apiKeys: {
286
+ configId: string;
287
+ name: string | null;
288
+ enabled: boolean;
289
+ permissions: import("@voyantjs/types/api-keys").ApiKeyPermissions;
290
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
291
+ id: string;
292
+ createdAt: string;
293
+ start?: string | null | undefined;
294
+ prefix?: string | null | undefined;
295
+ referenceId?: string | null | undefined;
296
+ rateLimitEnabled?: boolean | null | undefined;
297
+ rateLimitTimeWindow?: number | null | undefined;
298
+ rateLimitMax?: number | null | undefined;
299
+ requestCount?: number | null | undefined;
300
+ remaining?: number | null | undefined;
301
+ lastRequest?: string | null | undefined;
302
+ updatedAt?: string | null | undefined;
303
+ expiresAt?: string | null | undefined;
304
+ metadata?: unknown;
305
+ }[];
306
+ total: number;
307
+ limit?: number | null | undefined;
308
+ offset?: number | null | undefined;
309
+ }, readonly ["auth", "service-api-keys", ServiceApiKeysListFilters]>, "queryFn"> & {
310
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
311
+ apiKeys: {
312
+ configId: string;
313
+ name: string | null;
314
+ enabled: boolean;
315
+ permissions: import("@voyantjs/types/api-keys").ApiKeyPermissions;
316
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
317
+ id: string;
318
+ createdAt: string;
319
+ start?: string | null | undefined;
320
+ prefix?: string | null | undefined;
321
+ referenceId?: string | null | undefined;
322
+ rateLimitEnabled?: boolean | null | undefined;
323
+ rateLimitTimeWindow?: number | null | undefined;
324
+ rateLimitMax?: number | null | undefined;
325
+ requestCount?: number | null | undefined;
326
+ remaining?: number | null | undefined;
327
+ lastRequest?: string | null | undefined;
328
+ updatedAt?: string | null | undefined;
329
+ expiresAt?: string | null | undefined;
330
+ metadata?: unknown;
331
+ }[];
332
+ total: number;
333
+ limit?: number | null | undefined;
334
+ offset?: number | null | undefined;
335
+ }, readonly ["auth", "service-api-keys", ServiceApiKeysListFilters], never> | undefined;
336
+ } & {
337
+ queryKey: readonly ["auth", "service-api-keys", ServiceApiKeysListFilters] & {
338
+ [dataTagSymbol]: {
339
+ apiKeys: {
340
+ configId: string;
341
+ name: string | null;
342
+ enabled: boolean;
343
+ permissions: import("@voyantjs/types/api-keys").ApiKeyPermissions;
344
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
345
+ id: string;
346
+ createdAt: string;
347
+ start?: string | null | undefined;
348
+ prefix?: string | null | undefined;
349
+ referenceId?: string | null | undefined;
350
+ rateLimitEnabled?: boolean | null | undefined;
351
+ rateLimitTimeWindow?: number | null | undefined;
352
+ rateLimitMax?: number | null | undefined;
353
+ requestCount?: number | null | undefined;
354
+ remaining?: number | null | undefined;
355
+ lastRequest?: string | null | undefined;
356
+ updatedAt?: string | null | undefined;
357
+ expiresAt?: string | null | undefined;
358
+ metadata?: unknown;
359
+ }[];
360
+ total: number;
361
+ limit?: number | null | undefined;
362
+ offset?: number | null | undefined;
363
+ };
364
+ [dataTagErrorSymbol]: Error;
365
+ };
366
+ };
259
367
  //# sourceMappingURL=query-options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-options.d.ts","sourceRoot":"","sources":["../src/query-options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,0BAA0B,EAAwC,MAAM,aAAa,CAAA;AACnG,OAAO,EAEL,KAAK,kCAAkC,EACvC,KAAK,8BAA8B,EACpC,MAAM,iBAAiB,CAAA;AASxB,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,0BAA0B;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWnC;AAED,wBAAgB,sCAAsC,CACpD,OAAO,EAAE,kCAAkC,EAC3C,MAAM,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWnC;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,yBAAyB,EAClC,MAAM,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWnC"}
@@ -2,7 +2,7 @@
2
2
  import { queryOptions } from "@tanstack/react-query";
3
3
  import { fetchWithValidation, withQueryParams } from "./client.js";
4
4
  import { authQueryKeys, } from "./query-keys.js";
5
- import { authStatusSchema, currentUserSchema, currentWorkspaceSchema, organizationInvitationsResponseSchema, organizationMembersResponseSchema, } from "./schemas.js";
5
+ import { authStatusSchema, currentUserSchema, currentWorkspaceSchema, organizationInvitationsResponseSchema, organizationMembersResponseSchema, serviceApiKeysResponseSchema, } from "./schemas.js";
6
6
  export function getCurrentUserQueryOptions(client) {
7
7
  return queryOptions({
8
8
  queryKey: authQueryKeys.currentUser(),
@@ -33,3 +33,9 @@ export function getOrganizationInvitationsQueryOptions(filters, client) {
33
33
  queryFn: () => fetchWithValidation(withQueryParams("/auth/organization/list-invitations", filters), organizationInvitationsResponseSchema, client),
34
34
  });
35
35
  }
36
+ export function getServiceApiKeysQueryOptions(filters, client) {
37
+ return queryOptions({
38
+ queryKey: authQueryKeys.serviceApiKeys(filters),
39
+ queryFn: () => fetchWithValidation(withQueryParams("/auth/api-tokens", filters), serviceApiKeysResponseSchema, client),
40
+ });
41
+ }
package/dist/schemas.d.ts CHANGED
@@ -116,4 +116,388 @@ export declare const organizationInvitationsResponseSchema: z.ZodArray<z.ZodObje
116
116
  createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
117
117
  }, z.core.$strip>>;
118
118
  export type OrganizationInvitationsResponse = z.infer<typeof organizationInvitationsResponseSchema>;
119
+ export declare const serviceApiKeySchema: z.ZodPipe<z.ZodObject<{
120
+ id: z.ZodString;
121
+ configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
122
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
+ start: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
+ prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
125
+ referenceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
126
+ enabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
127
+ rateLimitEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
128
+ rateLimitTimeWindow: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
129
+ rateLimitMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
130
+ requestCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
131
+ remaining: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
132
+ lastRequest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
133
+ createdAt: z.ZodString;
134
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
136
+ permissions: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>]>>>;
137
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
138
+ }, z.core.$strip>, z.ZodTransform<{
139
+ configId: string;
140
+ name: string | null;
141
+ enabled: boolean;
142
+ permissions: import("@voyantjs/types/api-keys").ApiKeyPermissions;
143
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
144
+ id: string;
145
+ createdAt: string;
146
+ start?: string | null | undefined;
147
+ prefix?: string | null | undefined;
148
+ referenceId?: string | null | undefined;
149
+ rateLimitEnabled?: boolean | null | undefined;
150
+ rateLimitTimeWindow?: number | null | undefined;
151
+ rateLimitMax?: number | null | undefined;
152
+ requestCount?: number | null | undefined;
153
+ remaining?: number | null | undefined;
154
+ lastRequest?: string | null | undefined;
155
+ updatedAt?: string | null | undefined;
156
+ expiresAt?: string | null | undefined;
157
+ metadata?: unknown;
158
+ }, {
159
+ id: string;
160
+ createdAt: string;
161
+ configId?: string | null | undefined;
162
+ name?: string | null | undefined;
163
+ start?: string | null | undefined;
164
+ prefix?: string | null | undefined;
165
+ referenceId?: string | null | undefined;
166
+ enabled?: boolean | null | undefined;
167
+ rateLimitEnabled?: boolean | null | undefined;
168
+ rateLimitTimeWindow?: number | null | undefined;
169
+ rateLimitMax?: number | null | undefined;
170
+ requestCount?: number | null | undefined;
171
+ remaining?: number | null | undefined;
172
+ lastRequest?: string | null | undefined;
173
+ updatedAt?: string | null | undefined;
174
+ expiresAt?: string | null | undefined;
175
+ permissions?: string | Record<string, string[]> | null | undefined;
176
+ metadata?: unknown;
177
+ }>>;
178
+ export type ServiceApiKey = z.infer<typeof serviceApiKeySchema>;
179
+ export declare const apiTokenSchema: z.ZodPipe<z.ZodObject<{
180
+ id: z.ZodString;
181
+ configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
182
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
183
+ start: z.ZodOptional<z.ZodNullable<z.ZodString>>;
184
+ prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
185
+ referenceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
186
+ enabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
187
+ rateLimitEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
188
+ rateLimitTimeWindow: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
189
+ rateLimitMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
190
+ requestCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
191
+ remaining: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
192
+ lastRequest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
193
+ createdAt: z.ZodString;
194
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
195
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
196
+ permissions: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>]>>>;
197
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
198
+ }, z.core.$strip>, z.ZodTransform<{
199
+ configId: string;
200
+ name: string | null;
201
+ enabled: boolean;
202
+ permissions: import("@voyantjs/types/api-keys").ApiKeyPermissions;
203
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
204
+ id: string;
205
+ createdAt: string;
206
+ start?: string | null | undefined;
207
+ prefix?: string | null | undefined;
208
+ referenceId?: string | null | undefined;
209
+ rateLimitEnabled?: boolean | null | undefined;
210
+ rateLimitTimeWindow?: number | null | undefined;
211
+ rateLimitMax?: number | null | undefined;
212
+ requestCount?: number | null | undefined;
213
+ remaining?: number | null | undefined;
214
+ lastRequest?: string | null | undefined;
215
+ updatedAt?: string | null | undefined;
216
+ expiresAt?: string | null | undefined;
217
+ metadata?: unknown;
218
+ }, {
219
+ id: string;
220
+ createdAt: string;
221
+ configId?: string | null | undefined;
222
+ name?: string | null | undefined;
223
+ start?: string | null | undefined;
224
+ prefix?: string | null | undefined;
225
+ referenceId?: string | null | undefined;
226
+ enabled?: boolean | null | undefined;
227
+ rateLimitEnabled?: boolean | null | undefined;
228
+ rateLimitTimeWindow?: number | null | undefined;
229
+ rateLimitMax?: number | null | undefined;
230
+ requestCount?: number | null | undefined;
231
+ remaining?: number | null | undefined;
232
+ lastRequest?: string | null | undefined;
233
+ updatedAt?: string | null | undefined;
234
+ expiresAt?: string | null | undefined;
235
+ permissions?: string | Record<string, string[]> | null | undefined;
236
+ metadata?: unknown;
237
+ }>>;
238
+ export type ApiToken = ServiceApiKey;
239
+ export declare const serviceApiKeyWithSecretSchema: z.ZodPipe<z.ZodObject<{
240
+ id: z.ZodString;
241
+ configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
242
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
243
+ start: z.ZodOptional<z.ZodNullable<z.ZodString>>;
244
+ prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
245
+ referenceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
246
+ enabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
247
+ rateLimitEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
248
+ rateLimitTimeWindow: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
249
+ rateLimitMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
250
+ requestCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
251
+ remaining: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
252
+ lastRequest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
253
+ createdAt: z.ZodString;
254
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
255
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
256
+ permissions: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>]>>>;
257
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
258
+ key: z.ZodString;
259
+ }, z.core.$strip>, z.ZodTransform<{
260
+ configId: string;
261
+ name: string | null;
262
+ enabled: boolean;
263
+ permissions: import("@voyantjs/types/api-keys").ApiKeyPermissions;
264
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
265
+ id: string;
266
+ createdAt: string;
267
+ key: string;
268
+ start?: string | null | undefined;
269
+ prefix?: string | null | undefined;
270
+ referenceId?: string | null | undefined;
271
+ rateLimitEnabled?: boolean | null | undefined;
272
+ rateLimitTimeWindow?: number | null | undefined;
273
+ rateLimitMax?: number | null | undefined;
274
+ requestCount?: number | null | undefined;
275
+ remaining?: number | null | undefined;
276
+ lastRequest?: string | null | undefined;
277
+ updatedAt?: string | null | undefined;
278
+ expiresAt?: string | null | undefined;
279
+ metadata?: unknown;
280
+ }, {
281
+ id: string;
282
+ createdAt: string;
283
+ key: string;
284
+ configId?: string | null | undefined;
285
+ name?: string | null | undefined;
286
+ start?: string | null | undefined;
287
+ prefix?: string | null | undefined;
288
+ referenceId?: string | null | undefined;
289
+ enabled?: boolean | null | undefined;
290
+ rateLimitEnabled?: boolean | null | undefined;
291
+ rateLimitTimeWindow?: number | null | undefined;
292
+ rateLimitMax?: number | null | undefined;
293
+ requestCount?: number | null | undefined;
294
+ remaining?: number | null | undefined;
295
+ lastRequest?: string | null | undefined;
296
+ updatedAt?: string | null | undefined;
297
+ expiresAt?: string | null | undefined;
298
+ permissions?: string | Record<string, string[]> | null | undefined;
299
+ metadata?: unknown;
300
+ }>>;
301
+ export type ServiceApiKeyWithSecret = z.infer<typeof serviceApiKeyWithSecretSchema>;
302
+ export declare const apiTokenWithSecretSchema: z.ZodPipe<z.ZodObject<{
303
+ id: z.ZodString;
304
+ configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
305
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
306
+ start: z.ZodOptional<z.ZodNullable<z.ZodString>>;
307
+ prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
308
+ referenceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
309
+ enabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
310
+ rateLimitEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
311
+ rateLimitTimeWindow: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
312
+ rateLimitMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
313
+ requestCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
314
+ remaining: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
315
+ lastRequest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
316
+ createdAt: z.ZodString;
317
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
318
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
319
+ permissions: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>]>>>;
320
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
321
+ key: z.ZodString;
322
+ }, z.core.$strip>, z.ZodTransform<{
323
+ configId: string;
324
+ name: string | null;
325
+ enabled: boolean;
326
+ permissions: import("@voyantjs/types/api-keys").ApiKeyPermissions;
327
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
328
+ id: string;
329
+ createdAt: string;
330
+ key: string;
331
+ start?: string | null | undefined;
332
+ prefix?: string | null | undefined;
333
+ referenceId?: string | null | undefined;
334
+ rateLimitEnabled?: boolean | null | undefined;
335
+ rateLimitTimeWindow?: number | null | undefined;
336
+ rateLimitMax?: number | null | undefined;
337
+ requestCount?: number | null | undefined;
338
+ remaining?: number | null | undefined;
339
+ lastRequest?: string | null | undefined;
340
+ updatedAt?: string | null | undefined;
341
+ expiresAt?: string | null | undefined;
342
+ metadata?: unknown;
343
+ }, {
344
+ id: string;
345
+ createdAt: string;
346
+ key: string;
347
+ configId?: string | null | undefined;
348
+ name?: string | null | undefined;
349
+ start?: string | null | undefined;
350
+ prefix?: string | null | undefined;
351
+ referenceId?: string | null | undefined;
352
+ enabled?: boolean | null | undefined;
353
+ rateLimitEnabled?: boolean | null | undefined;
354
+ rateLimitTimeWindow?: number | null | undefined;
355
+ rateLimitMax?: number | null | undefined;
356
+ requestCount?: number | null | undefined;
357
+ remaining?: number | null | undefined;
358
+ lastRequest?: string | null | undefined;
359
+ updatedAt?: string | null | undefined;
360
+ expiresAt?: string | null | undefined;
361
+ permissions?: string | Record<string, string[]> | null | undefined;
362
+ metadata?: unknown;
363
+ }>>;
364
+ export type ApiTokenWithSecret = ServiceApiKeyWithSecret;
365
+ export declare const serviceApiKeysResponseSchema: z.ZodObject<{
366
+ apiKeys: z.ZodArray<z.ZodPipe<z.ZodObject<{
367
+ id: z.ZodString;
368
+ configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
369
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
370
+ start: z.ZodOptional<z.ZodNullable<z.ZodString>>;
371
+ prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
372
+ referenceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
373
+ enabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
374
+ rateLimitEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
375
+ rateLimitTimeWindow: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
376
+ rateLimitMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
377
+ requestCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
378
+ remaining: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
379
+ lastRequest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
380
+ createdAt: z.ZodString;
381
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
382
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
383
+ permissions: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>]>>>;
384
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
385
+ }, z.core.$strip>, z.ZodTransform<{
386
+ configId: string;
387
+ name: string | null;
388
+ enabled: boolean;
389
+ permissions: import("@voyantjs/types/api-keys").ApiKeyPermissions;
390
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
391
+ id: string;
392
+ createdAt: string;
393
+ start?: string | null | undefined;
394
+ prefix?: string | null | undefined;
395
+ referenceId?: string | null | undefined;
396
+ rateLimitEnabled?: boolean | null | undefined;
397
+ rateLimitTimeWindow?: number | null | undefined;
398
+ rateLimitMax?: number | null | undefined;
399
+ requestCount?: number | null | undefined;
400
+ remaining?: number | null | undefined;
401
+ lastRequest?: string | null | undefined;
402
+ updatedAt?: string | null | undefined;
403
+ expiresAt?: string | null | undefined;
404
+ metadata?: unknown;
405
+ }, {
406
+ id: string;
407
+ createdAt: string;
408
+ configId?: string | null | undefined;
409
+ name?: string | null | undefined;
410
+ start?: string | null | undefined;
411
+ prefix?: string | null | undefined;
412
+ referenceId?: string | null | undefined;
413
+ enabled?: boolean | null | undefined;
414
+ rateLimitEnabled?: boolean | null | undefined;
415
+ rateLimitTimeWindow?: number | null | undefined;
416
+ rateLimitMax?: number | null | undefined;
417
+ requestCount?: number | null | undefined;
418
+ remaining?: number | null | undefined;
419
+ lastRequest?: string | null | undefined;
420
+ updatedAt?: string | null | undefined;
421
+ expiresAt?: string | null | undefined;
422
+ permissions?: string | Record<string, string[]> | null | undefined;
423
+ metadata?: unknown;
424
+ }>>>;
425
+ total: z.ZodNumber;
426
+ limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
427
+ offset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
428
+ }, z.core.$strip>;
429
+ export type ServiceApiKeysResponse = z.infer<typeof serviceApiKeysResponseSchema>;
430
+ export declare const apiTokensResponseSchema: z.ZodObject<{
431
+ apiKeys: z.ZodArray<z.ZodPipe<z.ZodObject<{
432
+ id: z.ZodString;
433
+ configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
434
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
435
+ start: z.ZodOptional<z.ZodNullable<z.ZodString>>;
436
+ prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
437
+ referenceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
438
+ enabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
439
+ rateLimitEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
440
+ rateLimitTimeWindow: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
441
+ rateLimitMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
442
+ requestCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
443
+ remaining: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
444
+ lastRequest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
445
+ createdAt: z.ZodString;
446
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
447
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
448
+ permissions: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>]>>>;
449
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
450
+ }, z.core.$strip>, z.ZodTransform<{
451
+ configId: string;
452
+ name: string | null;
453
+ enabled: boolean;
454
+ permissions: import("@voyantjs/types/api-keys").ApiKeyPermissions;
455
+ permissionList: import("@voyantjs/types/api-keys").ApiKeyPermissionString[];
456
+ id: string;
457
+ createdAt: string;
458
+ start?: string | null | undefined;
459
+ prefix?: string | null | undefined;
460
+ referenceId?: string | null | undefined;
461
+ rateLimitEnabled?: boolean | null | undefined;
462
+ rateLimitTimeWindow?: number | null | undefined;
463
+ rateLimitMax?: number | null | undefined;
464
+ requestCount?: number | null | undefined;
465
+ remaining?: number | null | undefined;
466
+ lastRequest?: string | null | undefined;
467
+ updatedAt?: string | null | undefined;
468
+ expiresAt?: string | null | undefined;
469
+ metadata?: unknown;
470
+ }, {
471
+ id: string;
472
+ createdAt: string;
473
+ configId?: string | null | undefined;
474
+ name?: string | null | undefined;
475
+ start?: string | null | undefined;
476
+ prefix?: string | null | undefined;
477
+ referenceId?: string | null | undefined;
478
+ enabled?: boolean | null | undefined;
479
+ rateLimitEnabled?: boolean | null | undefined;
480
+ rateLimitTimeWindow?: number | null | undefined;
481
+ rateLimitMax?: number | null | undefined;
482
+ requestCount?: number | null | undefined;
483
+ remaining?: number | null | undefined;
484
+ lastRequest?: string | null | undefined;
485
+ updatedAt?: string | null | undefined;
486
+ expiresAt?: string | null | undefined;
487
+ permissions?: string | Record<string, string[]> | null | undefined;
488
+ metadata?: unknown;
489
+ }>>>;
490
+ total: z.ZodNumber;
491
+ limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
492
+ offset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
493
+ }, z.core.$strip>;
494
+ export type ApiTokensResponse = ServiceApiKeysResponse;
495
+ export declare const deleteServiceApiKeyResponseSchema: z.ZodObject<{
496
+ success: z.ZodBoolean;
497
+ }, z.core.$strip>;
498
+ export type DeleteServiceApiKeyResponse = z.infer<typeof deleteServiceApiKeyResponseSchema>;
499
+ export declare const deleteApiTokenResponseSchema: z.ZodObject<{
500
+ success: z.ZodBoolean;
501
+ }, z.core.$strip>;
502
+ export type DeleteApiTokenResponse = DeleteServiceApiKeyResponse;
119
503
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iBAAiB;;;;;;;;;;iBAY5B,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D,eAAO,MAAM,gBAAgB;;;;iBAI3B,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,sBAAsB,6DAA6C,CAAA;AAChF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAErE,eAAO,MAAM,yBAAyB;;;;;;;iBAOpC,CAAA;AACF,MA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, permissionsToStrings } from "@voyantjs/types/api-keys";
1
2
  import { z } from "zod";
2
3
  export const currentUserSchema = z.object({
3
4
  id: z.string(),
@@ -62,3 +63,57 @@ export const organizationInvitationSchema = z.object({
62
63
  createdAt: z.string().nullable().optional(),
63
64
  });
64
65
  export const organizationInvitationsResponseSchema = z.array(organizationInvitationSchema);
66
+ const apiKeyPermissionsSchema = z.union([z.string(), z.record(z.string(), z.array(z.string()))]);
67
+ const serviceApiKeyBaseSchema = z.object({
68
+ id: z.string(),
69
+ configId: z.string().nullable().optional(),
70
+ name: z.string().nullable().optional(),
71
+ start: z.string().nullable().optional(),
72
+ prefix: z.string().nullable().optional(),
73
+ referenceId: z.string().nullable().optional(),
74
+ enabled: z.boolean().nullable().optional(),
75
+ rateLimitEnabled: z.boolean().nullable().optional(),
76
+ rateLimitTimeWindow: z.number().nullable().optional(),
77
+ rateLimitMax: z.number().nullable().optional(),
78
+ requestCount: z.number().nullable().optional(),
79
+ remaining: z.number().nullable().optional(),
80
+ lastRequest: z.string().nullable().optional(),
81
+ createdAt: z.string(),
82
+ updatedAt: z.string().nullable().optional(),
83
+ expiresAt: z.string().nullable().optional(),
84
+ permissions: apiKeyPermissionsSchema.nullable().optional(),
85
+ metadata: z.unknown().nullable().optional(),
86
+ });
87
+ export const serviceApiKeySchema = serviceApiKeyBaseSchema.transform((key) => ({
88
+ ...key,
89
+ configId: key.configId ?? "default",
90
+ name: key.name ?? null,
91
+ enabled: key.enabled ?? true,
92
+ permissions: normalizeApiKeyPermissions(key.permissions),
93
+ permissionList: permissionsToStrings(key.permissions),
94
+ }));
95
+ export const apiTokenSchema = serviceApiKeySchema;
96
+ export const serviceApiKeyWithSecretSchema = serviceApiKeyBaseSchema
97
+ .extend({
98
+ key: z.string(),
99
+ })
100
+ .transform((key) => ({
101
+ ...key,
102
+ configId: key.configId ?? "default",
103
+ name: key.name ?? null,
104
+ enabled: key.enabled ?? true,
105
+ permissions: normalizeApiKeyPermissions(key.permissions),
106
+ permissionList: permissionsToStrings(key.permissions),
107
+ }));
108
+ export const apiTokenWithSecretSchema = serviceApiKeyWithSecretSchema;
109
+ export const serviceApiKeysResponseSchema = z.object({
110
+ apiKeys: z.array(serviceApiKeySchema),
111
+ total: z.number(),
112
+ limit: z.number().nullable().optional(),
113
+ offset: z.number().nullable().optional(),
114
+ });
115
+ export const apiTokensResponseSchema = serviceApiKeysResponseSchema;
116
+ export const deleteServiceApiKeyResponseSchema = z.object({
117
+ success: z.boolean(),
118
+ });
119
+ export const deleteApiTokenResponseSchema = deleteServiceApiKeyResponseSchema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/auth-react",
3
- "version": "0.31.1",
3
+ "version": "0.31.2",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,7 +41,8 @@
41
41
  "react": "^19.0.0",
42
42
  "react-dom": "^19.0.0",
43
43
  "zod": "^4.0.0",
44
- "@voyantjs/auth": "0.31.1"
44
+ "@voyantjs/auth": "0.31.2",
45
+ "@voyantjs/types": "0.31.2"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@tanstack/react-query": "^5.96.2",
@@ -52,12 +53,13 @@
52
53
  "typescript": "^6.0.2",
53
54
  "vitest": "^4.1.2",
54
55
  "zod": "^4.3.6",
55
- "@voyantjs/auth": "0.31.1",
56
- "@voyantjs/react": "0.31.1",
56
+ "@voyantjs/auth": "0.31.2",
57
+ "@voyantjs/react": "0.31.2",
58
+ "@voyantjs/types": "0.31.2",
57
59
  "@voyantjs/voyant-typescript-config": "0.1.0"
58
60
  },
59
61
  "dependencies": {
60
- "@voyantjs/react": "0.31.1"
62
+ "@voyantjs/react": "0.31.2"
61
63
  },
62
64
  "files": [
63
65
  "dist"