MCPcopy Create free account

hub / github.com/Jussinevavuori/kilpi / functions

Functions316 in github.com/Jussinevavuori/kilpi

↓ 76 callersMethodauthorize
* 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 callersMethodauthorize
* Fetch the authorization decision from the Kilpi server. Cached.
packages/client/src/KilpiClientPolicy.ts:51
↓ 44 callersFunctionGrant
(subject: TSubject)
packages/core/src/decision.ts:6
↓ 43 callersMethodqueueJob
* Add a job to the current batch or initialize a new batch.
packages/client/src/utils/Batcher.ts:93
↓ 39 callersFunctionDeny
( input: Omit<DeniedDecision, "granted"> = { message: "Unauthorized" }, )
packages/core/src/decision.ts:16
↓ 28 callersMethodassert
(onUnauthorizedAssert?: KilpiOnUnauthorizedAssertHandler)
packages/core/src/KilpiPolicy.ts:111
↓ 24 callersFunctioncn
(...inputs: ClassValue[])
apps/docs/src/utils/cn.ts:4
↓ 24 callersFunctioncreateKilpi
({ plugins = [], ...kilpiCoreOptions }: KilpiConstructorArgs<TGetSubject, TPolicyset> & { // Support up
packages/core/src/createKilpi.ts:45
↓ 19 callersFunctioncn
(...inputs: ClassValue[])
examples/next-js/src/utils/cn.ts:4
↓ 18 callersMethodflushBatch
* 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 callersFunctiondeepEquals
(a: unknown, b: unknown)
packages/client/src/utils/deepEquals.ts:4
↓ 12 callersMethodget
* 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 callersMethodonSubjectRequestFromCache
* Register a new `onSubjectRequestFromCache` hook. Returns an unsubscribe function.
packages/core/src/KilpiHooks.ts:185
↓ 10 callersMethodonSubjectResolved
* Register a new `onSubjectResolved` hook. Returns an unsubscribe function.
packages/core/src/KilpiHooks.ts:177
↓ 10 callersMethodonUnauthorizedAssert
* Register a new `onUnauthorizedAssert` hook. Returns an unsubscribe function.
packages/core/src/KilpiHooks.ts:193
↓ 9 callersFunctionAbortSignalAll
(signals: AbortSignal[])
packages/client/src/utils/AbortSignalAll.ts:4
↓ 9 callersFunctionEndpointPlugin
(options: { secret: string; getContext?: (req: Request) => T["$$infer"]["context"]; onBeforeHandleReques
packages/core/src/plugins/EndpointPlugin/EndpointPlugin.ts:32
↓ 8 callersMethod$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 callersFunctioncreateKilpiClient
({ plugins = [], ...options }: KilpiClientOptions & { infer?: T; // Support up to 9 strongly typed plu
packages/client/src/createKilpiClient.ts:43
↓ 7 callersFunctioninit
* Setup a new server and client.
packages/client/__tests__/KilpiClientCache.test.ts:16
↓ 7 callersMethodonAfterAuthorization
* Register a new `onAfterAuthorization` hook. Returns an unsubscribe function.
packages/core/src/KilpiHooks.ts:169
↓ 6 callersMethod$query
* Create a protected query using the `$query` method. * * ## Example usage * * ```ts * const getUserData = Kilpi.$query( * async (
packages/core/src/KilpiCore.ts:139
↓ 6 callersFunctionAuditPlugin
( /** * Options for selecting the flushing strategy */ options: AnyFlushStrategyOptions<T> & { /
packages/core/src/plugins/AuditPlugin/AuditPlugin.ts:13
↓ 6 callersMethodexpose
* Utility to expose internal properties for plugins. * * ## Example usage * * ```ts * const policies = KilpiCore.expose(instance).polic
packages/core/src/KilpiCore.ts:242
↓ 6 callersMethodunregisterAll
* Unregister all hooks. Optionally provide a type of hook to unregister only that type.
packages/core/src/KilpiHooks.ts:201
↓ 6 callersMethoduseAuthorize
* Extend policies with a useAuthorize hook for usage in client-side React components.
packages/react-client/src/type.extension.ts:15
↓ 5 callersMethod$invalidate
* Allow fine-grained invalidation of the cache for this specific policy + inputs.
packages/client/src/KilpiClientPolicy.ts:143
↓ 5 callersFunctiongetStatusWithFlags
* Utility to return status with flags
packages/react-client/src/hooks/useAuthorize.ts:72
↓ 5 callersMethodinvalidate
* 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 callersFunctioncreateKilpiPlugin
( plugin: KilpiPlugin<TCore, TCoreExtension>, )
packages/core/src/KilpiPlugin.ts:41
↓ 4 callersFunctioncreateSquareBatcher
(mockFn: ReturnType<typeof vi.fn>, timeoutMs = 0)
packages/client/__tests__/BatchJob.abortSignal.test.ts:7
↓ 4 callersMethodkeyMatchesPath
* 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 callersFunctionuseFormField
()
examples/next-js/src/components/ui/form.tsx:43
↓ 3 callersFunctionReactClientPlugin
()
packages/react-client/src/plugins/ReactClientPlugin.ts:13
↓ 3 callersFunctionReactServerPlugin
( options: { disableSubjectCaching?: boolean; } = {}, )
packages/react-server/src/plugins/ReactServerPlugin.ts:14
↓ 3 callersMethodclear
* Clear entire cache
packages/client/src/utils/ClientCache.ts:109
↓ 3 callersFunctionlinkClassName
(extraClassName: string = "")
apps/docs/src/components/layout/MobileNav.tsx:29
↓ 3 callersMethodonCacheInvalidate
* Register a new `onCacheInvalidate` hook. Returns an unsubscribe function.
packages/client/src/KilpiClientHooks.ts:82
↓ 3 callersMethodset
* Set a value in the cache.
packages/client/src/utils/ClientCache.ts:60
↓ 2 callersFunctionPromiseWithResolvers
()
packages/core/src/utils/PromiseWithResolvers.ts:5
↓ 2 callersFunctioncreateRecursiveProxy
( callback: RecursiveProxyCallback, options: { path: readonly string[]; decorateNamespace?: (path:
packages/client/src/utils/proxy.ts:13
↓ 2 callersFunctioncreateRecursiveProxy
(callback: RecursiveProxyCallback, path: readonly string[])
packages/core/src/utils/proxy.ts:13
↓ 2 callersFunctioncreateRscCache
(initialValue: T)
packages/react-server/src/utils/createRscCache.ts:8
↓ 2 callersMethoddedupe
* 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 callersMethodflushBatch
* Manually flush the queue
packages/core/src/plugins/AuditPlugin/Batcher.ts:69
↓ 2 callersFunctiongetSyncStorageKey
(syncKey: string)
apps/docs/src/components/mdx/TabButtons.tsx:17
↓ 2 callersFunctionhandleAborted
(reason: unknown)
packages/client/src/utils/AbortSignalAll.ts:15
↓ 2 callersFunctioninit
* Setup a new server and client.
packages/client/__tests__/EndpointPlugin.secret.test.ts:9
↓ 2 callersFunctioninit
* Setup a new server and client.
packages/client/__tests__/KilpiClientPolicy.test.ts:11
↓ 2 callersFunctionnavigate
(url: string)
apps/docs/src/components/pagefind/PagefindSearch.tsx:27
↓ 2 callersFunctionrevealTab
(tab: string)
apps/docs/src/components/mdx/TabButtons.tsx:47
↓ 2 callersFunctionscore
(item: SidebarDocument | SidebarFolder)
apps/docs/src/components/docs/getSidebar.ts:62
↓ 2 callersMethodserializeKey
* Stable key serialization utility.
packages/client/src/utils/ClientCache.ts:90
↓ 2 callersFunctiontryCatch
(promise: Promise<T>)
packages/client/src/utils/tryCatch.ts:1
↓ 1 callersMethod#runJobs
* Private utility function used to fetch all requests as batched jobs.
packages/client/src/KilpiClient.ts:104
↓ 1 callersFunctionPromiseWithResolvers
()
packages/client/src/utils/PromiseWithResolvers.ts:5
↓ 1 callersFunctionTestPlugin
()
packages/core/__tests__/KilpiPlugin.test.ts:7
↓ 1 callersFunctionauthorize
({ output })
packages/core/__tests__/KilpiQuery.test.ts:45
↓ 1 callersFunctioncreateArticleAction
(raw: z.infer<typeof createArticleAction_schema>)
examples/next-js/src/article-actions.ts:16
↓ 1 callersFunctioncreateAuditFlushStrategy
( options: AnyFlushStrategyOptions<T>, )
packages/core/src/plugins/AuditPlugin/AuditFlushStrategyFactory.ts:32
↓ 1 callersFunctioncreateEnv
* Use Bun.file to copy `../../.env.example` as `.env` if it does not exist.
examples/next-js/src/scripts/env.ts:4
↓ 1 callersFunctioncreateHandleRequestStrategy
(options: AnyRequestStrategyOptions)
packages/client/src/utils/HandleRequestStrategy.ts:22
↓ 1 callersFunctioncreateKilpiClientPlugin
( plugin: KilpiClientPlugin<TCore, TExtension>, )
packages/client/src/KilpiClientPlugin.ts:47
↓ 1 callersFunctioncreateKilpiQuery
( core: TCore, query: (...args: TInput) => TRawOutput, options: { authorize?: KilpiQueryAuthorizeFn<
packages/core/src/KilpiQuery.ts:53
↓ 1 callersFunctioncreateResponse
(data: T)
packages/core/src/plugins/EndpointPlugin/EndpointPlugin.ts:56
↓ 1 callersFunctioncreateSubscribable
()
apps/docs/src/utils/createSubscribable.ts:1
↓ 1 callersFunctioncreate_Authorize
(core: TCore)
packages/react-server/src/components/Authorize.tsx:46
↓ 1 callersFunctioncreate_AuthorizeClient
(client: TClient)
packages/react-client/src/components/AuthorizeClient.tsx:90
↓ 1 callersFunctioncreate_useAuthorize
(Client: TClient, policy: KilpiClientPolicy<TClient, TAction>)
packages/react-client/src/hooks/useAuthorize.ts:63
↓ 1 callersFunctiondeleteArticleAction
(raw: z.infer<typeof deleteArticleAction_schema>)
examples/next-js/src/article-actions.ts:40
↓ 1 callersFunctionenable
()
packages/core/src/plugins/AuditPlugin/AuditPlugin.ts:39
↓ 1 callersMethodevaluate
* Internally evaluates the policy when invoked.
packages/core/src/KilpiPolicy.ts:47
↓ 1 callersMethodexpose
* Utility to expose internal properties for plugins. * * ## Example usage * * ```ts * const batcher = KilpiClient.expose(instance).batc
packages/client/src/KilpiClient.ts:170
↓ 1 callersFunctiongetPagefind
()
apps/docs/src/components/pagefind/getPagefind.ts:4
↓ 1 callersFunctiongetPolicyByAction
(policyset: TPolicyset, action: TAction)
packages/core/src/getPolicyByAction.ts:9
↓ 1 callersFunctiongetRequestErrorMessage
(status: number)
packages/client/src/utils/getRequestErrorMessage.ts:4
↓ 1 callersFunctionhandleSelectTab
(tab: string)
apps/docs/src/components/mdx/TabButtons.tsx:55
↓ 1 callersMethodonAuditEvent
* Add event to storage.
packages/core/src/plugins/AuditPlugin/AuditFlushStrategy.ts:23
↓ 1 callersMethodonBeforeSendRequest
* Register a new `onBeforeSendRequest` hook. Returns an unsubscribe function.
packages/client/src/KilpiClientHooks.ts:74
↓ 1 callersFunctionprocessRequests
* Utility function to process requests into a JSON object that can be responded with.
packages/core/src/plugins/EndpointPlugin/EndpointPlugin.ts:42
↓ 1 callersMethodqueueJob
* Add a job to the current batch or initialize a new batch.
packages/core/src/plugins/AuditPlugin/Batcher.ts:86
↓ 1 callersFunctionremoveStringSuffix
(str: string, postfix: string)
packages/client/src/utils/removeStringSuffix.ts:8
↓ 1 callersMethodrequest
(body: unknown, options?: RequestOptions)
packages/client/src/utils/HandleRequestStrategy.ts:9
↓ 1 callersMethodrunAsyncCachedFunction
* Wrap a function with a cache key to cache the result.
packages/client/src/KilpiClientCache.ts:18
↓ 1 callersFunctionsearch
()
apps/docs/src/hooks/usePagefind.ts:34
↓ 1 callersFunctionseed
()
examples/next-js/src/scripts/seed.ts:6
↓ 1 callersFunctionsortSidebarRecursive
(folder: SidebarFolder)
apps/docs/src/components/docs/getSidebar.ts:72
↓ 1 callersFunctiontraverse
(folder: SidebarFolder)
apps/docs/src/components/docs/getAdjacentDocs.ts:12
↓ 1 callersMethodtriggerFlush
()
packages/core/src/plugins/AuditPlugin/PeriodicalAuditFlushStrategy.ts:36
↓ 1 callersMethodtriggerFlush
* Trigger flushing manually
packages/core/src/plugins/AuditPlugin/AuditFlushStrategy.ts:28
↓ 1 callersFunctiontryCatch
(promise: Promise<T>)
packages/core/src/utils/tryCatch.ts:1
↓ 1 callersFunctionupdateArticleAction
(raw: z.infer<typeof updateArticleAction_schema>)
examples/next-js/src/article-actions.ts:29
↓ 1 callersFunctionuseDebounce
(value: T, debouceMs = 200)
apps/docs/src/hooks/useDebounce.ts:3
↓ 1 callersFunctionusePagefind
(query: string)
apps/docs/src/hooks/usePagefind.ts:14
↓ 1 callersFunctionuseShortcut
(key: string, onShortcut: () => void)
apps/docs/src/hooks/useShortcut.ts:7
↓ 1 callersFunctionuseUnmountAbortSignalRef
()
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