Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Jussinevavuori/kilpi
/ functions
Functions
316 in github.com/Jussinevavuori/kilpi
⨍
Functions
316
◇
Types & classes
53
↓ 76 callers
Method
authorize
* Public API for evaluating the policy and returning the decision. * * Additionally supports the `.assert()` method for throwing on denied acces
packages/core/src/KilpiPolicy.ts:95
↓ 64 callers
Method
authorize
* Fetch the authorization decision from the Kilpi server. Cached.
packages/client/src/KilpiClientPolicy.ts:51
↓ 44 callers
Function
Grant
(subject: TSubject)
packages/core/src/decision.ts:6
↓ 43 callers
Method
queueJob
* Add a job to the current batch or initialize a new batch.
packages/client/src/utils/Batcher.ts:93
↓ 39 callers
Function
Deny
( input: Omit<DeniedDecision, "granted"> = { message: "Unauthorized" }, )
packages/core/src/decision.ts:16
↓ 28 callers
Method
assert
(onUnauthorizedAssert?: KilpiOnUnauthorizedAssertHandler)
packages/core/src/KilpiPolicy.ts:111
↓ 24 callers
Function
cn
(...inputs: ClassValue[])
apps/docs/src/utils/cn.ts:4
↓ 24 callers
Function
createKilpi
({ plugins = [], ...kilpiCoreOptions }: KilpiConstructorArgs<TGetSubject, TPolicyset> & { // Support up
packages/core/src/createKilpi.ts:45
↓ 19 callers
Function
cn
(...inputs: ClassValue[])
examples/next-js/src/utils/cn.ts:4
↓ 18 callers
Method
flushBatch
* Utility function used to flush the current batch and run all jobs in batch using * the provided `runJobs` function.
packages/client/src/utils/Batcher.ts:77
↓ 14 callers
Function
deepEquals
(a: unknown, b: unknown)
packages/client/src/utils/deepEquals.ts:4
↓ 12 callers
Method
get
* Get a value from cache (or undefined if no value in cache). If the value is expired, it will be * removed from the cache.
packages/client/src/utils/ClientCache.ts:69
↓ 10 callers
Method
onSubjectRequestFromCache
* Register a new `onSubjectRequestFromCache` hook. Returns an unsubscribe function.
packages/core/src/KilpiHooks.ts:185
↓ 10 callers
Method
onSubjectResolved
* Register a new `onSubjectResolved` hook. Returns an unsubscribe function.
packages/core/src/KilpiHooks.ts:177
↓ 10 callers
Method
onUnauthorizedAssert
* Register a new `onUnauthorizedAssert` hook. Returns an unsubscribe function.
packages/core/src/KilpiHooks.ts:193
↓ 9 callers
Function
AbortSignalAll
(signals: AbortSignal[])
packages/client/src/utils/AbortSignalAll.ts:4
↓ 9 callers
Function
EndpointPlugin
(options: { secret: string; getContext?: (req: Request) => T["$$infer"]["context"]; onBeforeHandleReques
packages/core/src/plugins/EndpointPlugin/EndpointPlugin.ts:32
↓ 8 callers
Method
$getSubject
* Expose the `getSubject` method for use outside of Kilpi. * * ## Example usage * * ```ts * // Without context * const subject = awa
packages/core/src/KilpiCore.ts:163
↓ 8 callers
Function
createKilpiClient
({ plugins = [], ...options }: KilpiClientOptions & { infer?: T; // Support up to 9 strongly typed plu
packages/client/src/createKilpiClient.ts:43
↓ 7 callers
Function
init
* Setup a new server and client.
packages/client/__tests__/KilpiClientCache.test.ts:16
↓ 7 callers
Method
onAfterAuthorization
* Register a new `onAfterAuthorization` hook. Returns an unsubscribe function.
packages/core/src/KilpiHooks.ts:169
↓ 6 callers
Method
$query
* Create a protected query using the `$query` method. * * ## Example usage * * ```ts * const getUserData = Kilpi.$query( * async (
packages/core/src/KilpiCore.ts:139
↓ 6 callers
Function
AuditPlugin
( /** * Options for selecting the flushing strategy */ options: AnyFlushStrategyOptions<T> & { /
packages/core/src/plugins/AuditPlugin/AuditPlugin.ts:13
↓ 6 callers
Method
expose
* Utility to expose internal properties for plugins. * * ## Example usage * * ```ts * const policies = KilpiCore.expose(instance).polic
packages/core/src/KilpiCore.ts:242
↓ 6 callers
Method
unregisterAll
* Unregister all hooks. Optionally provide a type of hook to unregister only that type.
packages/core/src/KilpiHooks.ts:201
↓ 6 callers
Method
useAuthorize
* Extend policies with a useAuthorize hook for usage in client-side React components.
packages/react-client/src/type.extension.ts:15
↓ 5 callers
Method
$invalidate
* Allow fine-grained invalidation of the cache for this specific policy + inputs.
packages/client/src/KilpiClientPolicy.ts:143
↓ 5 callers
Function
getStatusWithFlags
* Utility to return status with flags
packages/react-client/src/hooks/useAuthorize.ts:72
↓ 5 callers
Method
invalidate
* Invalidate the full cache, a single key or a path of keys. * * @usage * ```ts * cache.invalidate(); // Invalidate all * ca
packages/client/src/KilpiClientCache.ts:48
↓ 4 callers
Function
createKilpiPlugin
( plugin: KilpiPlugin<TCore, TCoreExtension>, )
packages/core/src/KilpiPlugin.ts:41
↓ 4 callers
Function
createSquareBatcher
(mockFn: ReturnType<typeof vi.fn>, timeoutMs = 0)
packages/client/__tests__/BatchJob.abortSignal.test.ts:7
↓ 4 callers
Method
keyMatchesPath
* Check if a target cache key matches a path. Matches if the key is a prefix of the path * or equals the path.
packages/client/src/KilpiClientCache.ts:97
↓ 4 callers
Function
useFormField
()
examples/next-js/src/components/ui/form.tsx:43
↓ 3 callers
Function
ReactClientPlugin
()
packages/react-client/src/plugins/ReactClientPlugin.ts:13
↓ 3 callers
Function
ReactServerPlugin
( options: { disableSubjectCaching?: boolean; } = {}, )
packages/react-server/src/plugins/ReactServerPlugin.ts:14
↓ 3 callers
Method
clear
* Clear entire cache
packages/client/src/utils/ClientCache.ts:109
↓ 3 callers
Function
linkClassName
(extraClassName: string = "")
apps/docs/src/components/layout/MobileNav.tsx:29
↓ 3 callers
Method
onCacheInvalidate
* Register a new `onCacheInvalidate` hook. Returns an unsubscribe function.
packages/client/src/KilpiClientHooks.ts:82
↓ 3 callers
Method
set
* Set a value in the cache.
packages/client/src/utils/ClientCache.ts:60
↓ 2 callers
Function
PromiseWithResolvers
()
packages/core/src/utils/PromiseWithResolvers.ts:5
↓ 2 callers
Function
createRecursiveProxy
( callback: RecursiveProxyCallback, options: { path: readonly string[]; decorateNamespace?: (path:
packages/client/src/utils/proxy.ts:13
↓ 2 callers
Function
createRecursiveProxy
(callback: RecursiveProxyCallback, path: readonly string[])
packages/core/src/utils/proxy.ts:13
↓ 2 callers
Function
createRscCache
(initialValue: T)
packages/react-server/src/utils/createRscCache.ts:8
↓ 2 callers
Method
dedupe
* Public utility to dedupe a job: When another job with the same payload is detected, call this * to use the same job instance for both requests.
packages/client/src/utils/BatchJob.ts:57
↓ 2 callers
Method
flushBatch
* Manually flush the queue
packages/core/src/plugins/AuditPlugin/Batcher.ts:69
↓ 2 callers
Function
getSyncStorageKey
(syncKey: string)
apps/docs/src/components/mdx/TabButtons.tsx:17
↓ 2 callers
Function
handleAborted
(reason: unknown)
packages/client/src/utils/AbortSignalAll.ts:15
↓ 2 callers
Function
init
* Setup a new server and client.
packages/client/__tests__/EndpointPlugin.secret.test.ts:9
↓ 2 callers
Function
init
* Setup a new server and client.
packages/client/__tests__/KilpiClientPolicy.test.ts:11
↓ 2 callers
Function
navigate
(url: string)
apps/docs/src/components/pagefind/PagefindSearch.tsx:27
↓ 2 callers
Function
revealTab
(tab: string)
apps/docs/src/components/mdx/TabButtons.tsx:47
↓ 2 callers
Function
score
(item: SidebarDocument | SidebarFolder)
apps/docs/src/components/docs/getSidebar.ts:62
↓ 2 callers
Method
serializeKey
* Stable key serialization utility.
packages/client/src/utils/ClientCache.ts:90
↓ 2 callers
Function
tryCatch
(promise: Promise<T>)
packages/client/src/utils/tryCatch.ts:1
↓ 1 callers
Method
#runJobs
* Private utility function used to fetch all requests as batched jobs.
packages/client/src/KilpiClient.ts:104
↓ 1 callers
Function
PromiseWithResolvers
()
packages/client/src/utils/PromiseWithResolvers.ts:5
↓ 1 callers
Function
TestPlugin
()
packages/core/__tests__/KilpiPlugin.test.ts:7
↓ 1 callers
Function
authorize
({ output })
packages/core/__tests__/KilpiQuery.test.ts:45
↓ 1 callers
Function
createArticleAction
(raw: z.infer<typeof createArticleAction_schema>)
examples/next-js/src/article-actions.ts:16
↓ 1 callers
Function
createAuditFlushStrategy
( options: AnyFlushStrategyOptions<T>, )
packages/core/src/plugins/AuditPlugin/AuditFlushStrategyFactory.ts:32
↓ 1 callers
Function
createEnv
* Use Bun.file to copy `../../.env.example` as `.env` if it does not exist.
examples/next-js/src/scripts/env.ts:4
↓ 1 callers
Function
createHandleRequestStrategy
(options: AnyRequestStrategyOptions)
packages/client/src/utils/HandleRequestStrategy.ts:22
↓ 1 callers
Function
createKilpiClientPlugin
( plugin: KilpiClientPlugin<TCore, TExtension>, )
packages/client/src/KilpiClientPlugin.ts:47
↓ 1 callers
Function
createKilpiQuery
( core: TCore, query: (...args: TInput) => TRawOutput, options: { authorize?: KilpiQueryAuthorizeFn<
packages/core/src/KilpiQuery.ts:53
↓ 1 callers
Function
createResponse
(data: T)
packages/core/src/plugins/EndpointPlugin/EndpointPlugin.ts:56
↓ 1 callers
Function
createSubscribable
()
apps/docs/src/utils/createSubscribable.ts:1
↓ 1 callers
Function
create_Authorize
(core: TCore)
packages/react-server/src/components/Authorize.tsx:46
↓ 1 callers
Function
create_AuthorizeClient
(client: TClient)
packages/react-client/src/components/AuthorizeClient.tsx:90
↓ 1 callers
Function
create_useAuthorize
(Client: TClient, policy: KilpiClientPolicy<TClient, TAction>)
packages/react-client/src/hooks/useAuthorize.ts:63
↓ 1 callers
Function
deleteArticleAction
(raw: z.infer<typeof deleteArticleAction_schema>)
examples/next-js/src/article-actions.ts:40
↓ 1 callers
Function
enable
()
packages/core/src/plugins/AuditPlugin/AuditPlugin.ts:39
↓ 1 callers
Method
evaluate
* Internally evaluates the policy when invoked.
packages/core/src/KilpiPolicy.ts:47
↓ 1 callers
Method
expose
* Utility to expose internal properties for plugins. * * ## Example usage * * ```ts * const batcher = KilpiClient.expose(instance).batc
packages/client/src/KilpiClient.ts:170
↓ 1 callers
Function
getPagefind
()
apps/docs/src/components/pagefind/getPagefind.ts:4
↓ 1 callers
Function
getPolicyByAction
(policyset: TPolicyset, action: TAction)
packages/core/src/getPolicyByAction.ts:9
↓ 1 callers
Function
getRequestErrorMessage
(status: number)
packages/client/src/utils/getRequestErrorMessage.ts:4
↓ 1 callers
Function
handleSelectTab
(tab: string)
apps/docs/src/components/mdx/TabButtons.tsx:55
↓ 1 callers
Method
onAuditEvent
* Add event to storage.
packages/core/src/plugins/AuditPlugin/AuditFlushStrategy.ts:23
↓ 1 callers
Method
onBeforeSendRequest
* Register a new `onBeforeSendRequest` hook. Returns an unsubscribe function.
packages/client/src/KilpiClientHooks.ts:74
↓ 1 callers
Function
processRequests
* Utility function to process requests into a JSON object that can be responded with.
packages/core/src/plugins/EndpointPlugin/EndpointPlugin.ts:42
↓ 1 callers
Method
queueJob
* Add a job to the current batch or initialize a new batch.
packages/core/src/plugins/AuditPlugin/Batcher.ts:86
↓ 1 callers
Function
removeStringSuffix
(str: string, postfix: string)
packages/client/src/utils/removeStringSuffix.ts:8
↓ 1 callers
Method
request
(body: unknown, options?: RequestOptions)
packages/client/src/utils/HandleRequestStrategy.ts:9
↓ 1 callers
Method
runAsyncCachedFunction
* Wrap a function with a cache key to cache the result.
packages/client/src/KilpiClientCache.ts:18
↓ 1 callers
Function
search
()
apps/docs/src/hooks/usePagefind.ts:34
↓ 1 callers
Function
seed
()
examples/next-js/src/scripts/seed.ts:6
↓ 1 callers
Function
sortSidebarRecursive
(folder: SidebarFolder)
apps/docs/src/components/docs/getSidebar.ts:72
↓ 1 callers
Function
traverse
(folder: SidebarFolder)
apps/docs/src/components/docs/getAdjacentDocs.ts:12
↓ 1 callers
Method
triggerFlush
()
packages/core/src/plugins/AuditPlugin/PeriodicalAuditFlushStrategy.ts:36
↓ 1 callers
Method
triggerFlush
* Trigger flushing manually
packages/core/src/plugins/AuditPlugin/AuditFlushStrategy.ts:28
↓ 1 callers
Function
tryCatch
(promise: Promise<T>)
packages/core/src/utils/tryCatch.ts:1
↓ 1 callers
Function
updateArticleAction
(raw: z.infer<typeof updateArticleAction_schema>)
examples/next-js/src/article-actions.ts:29
↓ 1 callers
Function
useDebounce
(value: T, debouceMs = 200)
apps/docs/src/hooks/useDebounce.ts:3
↓ 1 callers
Function
usePagefind
(query: string)
apps/docs/src/hooks/usePagefind.ts:14
↓ 1 callers
Function
useShortcut
(key: string, onShortcut: () => void)
apps/docs/src/hooks/useShortcut.ts:7
↓ 1 callers
Function
useUnmountAbortSignalRef
()
packages/react-client/src/hooks/useUnmountAbortSignalRef.ts:6
Method
#object
()
packages/client/src/KilpiClientPolicy.ts:23
Method
#object
()
packages/core/src/KilpiPolicy.ts:26
Method
$cacheKey
* The cache key for this policy + inputs.
packages/client/src/KilpiClientNamespace.ts:22
Method
$cacheKey
* The cache key for this policy + inputs.
packages/client/src/KilpiClientPolicy.ts:44
next →
1–100 of 316, ranked by callers