Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/PerpetualSoftware/pad
/ functions
Functions
9,998 in github.com/PerpetualSoftware/pad
⨍
Functions
9,998
◇
Types & classes
1,131
↓ 17 callers
Method
release
* Drop the lease. `released` is false on a repeat call (no-op). `stackEmpty` * reports whether any lease remains AFTER this release — the caller use
web/src/lib/a11y/viewerBackdrop.ts:37
↓ 17 callers
Function
testServerWithCollab
testServerWithCollab wires a RoomManager onto a fresh test server so the collab handler answers 200/101 on the happy path. Tests that only assert on a
internal/server/handlers_collab_test.go:21
↓ 17 callers
Function
testServerWithPresence
testServerWithPresence gives a server both the watch bus and the presence registry — the production pairing (cmd_server.go wires them on adjacent line
internal/server/handlers_sessions_test.go:19
↓ 17 callers
Function
testStoreOAuth
Tests for the OAuth server constructor + audience strategy + storage adapter (PLAN-943 TASK-951 sub-PR B). Each layer is covered: - NewServer: requir
internal/oauth/server_test.go:40
↓ 16 callers
Method
Add
Add implements SessionPresence. Returns the generated id even when the Redis write fails. That is deliberate and it is the same posture the rest of t
internal/server/session_presence_redis.go:458
↓ 16 callers
Method
CreateAccessToken
============================================================ Access tokens (handler/oauth2/storage.go AccessTokenStorage) ============================
internal/store/oauth.go:310
↓ 16 callers
Method
GetPlatformSetting
GetPlatformSetting returns a single platform setting value, or empty string if not set.
internal/store/platform_settings.go:6
↓ 16 callers
Function
NewProcessor
NewProcessor returns the Processor compiled into this binary. Pure-Go build → pureGoProcessor. libvips build → vipsProcessor (Phase 2). Constructed o
internal/attachments/processor_purego.go:43
↓ 16 callers
Function
NewRedisSessionPresence
NewRedisSessionPresence returns a shared registry backed by client. The client is the SAME one the watch bus uses (cmd/pad/cmd_server.go dials once o
internal/server/session_presence_redis.go:420
↓ 16 callers
Method
SetObserver
SetObserver attaches an Observer. Passing nil detaches. Safe to call after the bus is running; cmd/pad/cmd_server.go calls it at wiring time.
internal/watchevents/observer.go:157
↓ 16 callers
Method
SetSessionPresence
SetSessionPresence attaches the live-session registry read by GET /api/v1/sessions and written by GET /api/v1/events/stream (PLAN-2558 S1). Nil-checke
internal/server/server.go:822
↓ 16 callers
Method
SetUserPlan
SetUserPlan updates a user's billing plan.
internal/store/limits.go:327
↓ 16 callers
Method
SetWatchEventsBus
SetWatchEventsBus attaches the watch/nudge notification bus consumed by GET /api/v1/events/stream (TASK-2533). Nil-checked by every producer and by th
internal/server/server.go:812
↓ 16 callers
Function
WithTokenAllowedWorkspaces
WithTokenAllowedWorkspaces returns ctx decorated with the OAuth token's workspace allow-list set at consent time (TASK-952). The list is either a set
internal/server/context.go:140
↓ 16 callers
Method
cycledCount
()
internal/events/observer_test.go:73
↓ 16 callers
Method
fanOutFromRedis
fanOutFromRedis is the receive path: a message that arrived on the subscription identified by gen, carrying the ID space it belongs to. A zero epoch
internal/events/redis_bus.go:2444
↓ 16 callers
Method
getAsset
getAsset issues GET on the asset endpoint. rawQuery is appended verbatim (already URL-formed, no leading '?').
internal/server/handlers_share_attachments_test.go:214
↓ 16 callers
Function
getOnlyAttachmentID
getOnlyAttachmentID returns the ID of the single live attachment row in a workspace — the test infrastructure uploads at most one blob per call, so th
internal/server/handlers_storage_test.go:410
↓ 16 callers
Function
imageRef
(id string)
internal/server/handlers_share_attachments_test.go:179
↓ 16 callers
Function
newMovedToFixture
(t *testing.T)
internal/server/item_moved_to_test.go:49
↓ 16 callers
Method
setContent
setContent overwrites an item's markdown body.
internal/server/handlers_share_attachments_test.go:172
↓ 15 callers
Method
Add
Add implements SessionPresence.
internal/server/session_presence.go:348
↓ 15 callers
Method
CreateShareLink
CreateShareLink creates a new share link and returns it with the raw token. The raw token is only available in this response — it is not stored.
internal/store/share_links.go:47
↓ 15 callers
Method
DeleteWorkspace
(slug string)
internal/store/workspaces.go:262
↓ 15 callers
Method
GetItemIncludeDeleted
GetItemIncludeDeleted finds an item by id including soft-deleted items. Used by code paths that need to act on records the user already owns even thou
internal/store/items.go:881
↓ 15 callers
Method
IsConfigured
IsConfigured reports whether the client has an explicit global connection configuration, either from config.toml or an environment/flag override.
internal/config/config.go:564
↓ 15 callers
Method
JSONExtractText
JSONExtractText returns SQL to extract a text value from a JSON column. SQLite: json_extract(col, '$.key') PostgreSQL: col->>'key'
internal/store/dialect.go:33
↓ 15 callers
Function
MigrateFields
MigrateFields maps field values from a source schema to a target schema. Fields with matching keys and compatible types are transferred. Incompatible
internal/items/migrate.go:62
↓ 15 callers
Function
ParseCollectionTraits
ParseCollectionTraits decodes a stored traits JSON blob. An empty or "null" blob yields the zero value with no error — a collection that declares no t
internal/models/collection_traits.go:176
↓ 15 callers
Method
RestoreItem
RestoreItem un-archives a soft-deleted item and bumps the workspace-scoped seq so delta-sync clients re-materialize the row. Same lock + subquery shap
internal/store/items.go:2813
↓ 15 callers
Method
SeedDefaultCollections
SeedDefaultCollections rescues a workspace that ended up with zero collections by seeding it with the standard Software-shape Defaults(). It is intent
internal/store/collections.go:836
↓ 15 callers
Method
archiveSource
()
internal/server/item_moved_to_test.go:108
↓ 15 callers
Method
bearerHeaders
()
internal/server/handlers_grant_visibility_test.go:104
↓ 15 callers
Method
copy
(t *testing.T, req CrossWorkspaceCopyRequest)
internal/store/items_cross_workspace_copy_test.go:55
↓ 15 callers
Method
cycleIfIdle
cycleIfIdle ends this instance's coverage and replaces its subscription when nothing has arrived for the idle timeout. DROP-AND-CYCLE, NOT DROP ALONE
internal/watchevents/heartbeat.go:297
↓ 15 callers
Function
decodePayload
decodePayload parses the "<epoch>|<id>|<json>" wire form publishScript emits, and ALSO accepts a bare JSON body with no prefix. THE BARE FORM IS NOT
internal/events/redis_bus.go:2331
↓ 15 callers
Function
newMockStore
(hooks []models.Webhook)
internal/webhooks/dispatcher_test.go:26
↓ 15 callers
Function
newShareAssetFixture
(t *testing.T)
internal/server/handlers_share_attachments_test.go:115
↓ 15 callers
Function
postFormWithCookie
postFormWithCookie POSTs an x-www-form-urlencoded body with both a session cookie and the matching CSRF cookie set, plus the session-bound User-Agent.
internal/server/handlers_oauth_test.go:2497
↓ 15 callers
Function
postOAuthForm
postOAuthForm POSTs an x-www-form-urlencoded body without any auth (used for /oauth/revoke + /oauth/token, where client_id rides in the form for publi
internal/server/handlers_oauth_test.go:2631
↓ 15 callers
Function
runAuthCodeFlow
runAuthCodeFlow drives a full /oauth/authorize/decide → /oauth/token exchange and returns the parsed token JSON. Each invocation needs a unique verifi
internal/server/handlers_oauth_test.go:2567
↓ 15 callers
Function
seedParentAndChildren
seedParentAndChildren creates a plan + N child tasks with the given statuses (one per child), returning the parent and the slice of child refs in crea
internal/server/handlers_items_open_children_guard_test.go:24
↓ 15 callers
Function
waitElectable
waitElectable polls until the room for itemID has at least n conns that pickApplier would actually elect — writable, anchored (replayDone), not frozen
internal/collab/manager_test.go:306
↓ 15 callers
Function
waitForFrameWithEvent
(t *testing.T, frames <-chan string, eventType string)
internal/server/handlers_events_resume_test.go:63
↓ 15 callers
Function
writeOutboxTx
writeOutboxTx appends one canonical event to the outbox on the caller's transaction. Two rejections, both deliberately hard errors that fail the encl
internal/store/event_outbox.go:145
↓ 14 callers
Method
Apply
Apply walks doc and stamps EnumSource + resolved Enum values on matching args and flags. Resolution failures are silent: the document continues to adv
internal/cmdhelp/dynamic.go:113
↓ 14 callers
Method
CreateDocument
(workspaceID string, input models.DocumentCreate)
internal/store/documents.go:147
↓ 14 callers
Function
CrossWorkspaceWorkspaceOnlyScope
CrossWorkspaceWorkspaceOnlyScope requests a WORKSPACE-LEVEL CHECK ONLY, which is almost never sufficient on its own. It answers "does this caller hav
internal/server/authz_cross_workspace.go:374
↓ 14 callers
Method
Fetch
(ctx context.Context, args []string)
internal/mcp/resources.go:47
↓ 14 callers
Method
GetItemLinks
GetItemLinks returns links where the given item is either source or target. Links pointing to or from soft-deleted items are filtered out so callers (
internal/store/items.go:3182
↓ 14 callers
Method
ListWorkspaces
(ctx context.Context)
internal/mcp/errors.go:322
↓ 14 callers
Method
MoveItem
MoveItem moves an item to a different collection within the same workspace. It updates the collection_id and fields JSON. The item_number is preserved
internal/store/items.go:4628
↓ 14 callers
Function
NewStorage
NewStorage wraps a *store.Store as a fosite-compatible adapter. The store must be a fully-initialized pad store (migrations applied); no validation he
internal/oauth/storage.go:129
↓ 14 callers
Method
SetEventBus
SetEventBus attaches an event bus for real-time SSE streaming.
internal/server/server.go:804
↓ 14 callers
Method
SetSSELimits
SetSSELimits configures the streaming connection limits. A value of 0 means unlimited for any of them. `global` and `perUser` bound BOTH stream endpo
internal/server/server.go:1103
↓ 14 callers
Method
SubscribeAndReplaySince
SubscribeAndReplaySince atomically checks the per-workspace limit, registers the subscriber, and captures the buffered events above sinceID — all in O
internal/events/bus.go:254
↓ 14 callers
Method
append
append adds an event to the ring buffer, evicting the oldest if full.
internal/events/bus.go:403
↓ 14 callers
Function
assertSourceSet
(t *testing.T, p *AttachmentCopyPlan, want ...string)
internal/store/attachments_copy_plan_test.go:115
↓ 14 callers
Method
copyOK
copyOK issues the copy as the owner and requires a 201.
internal/server/handlers_items_copy_test.go:94
↓ 14 callers
Function
dialCollab
dialCollab opens a WebSocket against the test server's collab endpoint with the given itemID. Returns the connection and the HTTP response. The respon
internal/server/handlers_collab_test.go:40
↓ 14 callers
Function
doRequestWithBearer
doRequestWithBearer dispatches a request with an Authorization: Bearer header set. The existing test helpers in server_test.go don't take a token para
internal/server/middleware_auth_public_paths_test.go:25
↓ 14 callers
Function
doTransform
(srv *Server, slug, attachmentID string, body transformRequestBody)
internal/server/handlers_attachments_transform_test.go:29
↓ 14 callers
Method
executeRequest
executeRequest builds + serves + packages a single HTTP request against the wrapped handler. Pulled out of Dispatch so the special-case methods (dispa
internal/mcp/dispatch_http.go:475
↓ 14 callers
Method
getSource
getSource performs GET on the source item exactly as the router would and requires a 200. Use rawGetSource when the status is what is under test.
internal/server/item_moved_to_test.go:124
↓ 14 callers
Function
mcpAndOAuthEnabledTestServer
===================================================================== mcp ↔ OAuth integration (sub-PR E, TASK-1027) ==================================
internal/server/handlers_mcp_test.go:512
↓ 14 callers
Function
mcpEnabledTestServer
mcpEnabledTestServer builds a Server with cloud mode + a stub streamable-HTTP transport so tests targeting auth / discovery / routing don't need to dr
internal/server/handlers_mcp_test.go:487
↓ 14 callers
Function
mustList
mustList reads a registry's session list, failing the test if the read itself failed. ListForUser gained an error when an out-of-process implementati
internal/server/session_presence_test.go:192
↓ 14 callers
Function
newRecordingObserver
()
internal/watchevents/observer_test.go:30
↓ 14 callers
Function
outboxPayloadFor
outboxPayloadFor returns the decoded payload of the single event of the given type for an item, failing if there is not exactly one.
internal/store/event_outbox_test.go:50
↓ 14 callers
Function
requireRole
requireRole checks if the user's workspace role meets the minimum required level. Role hierarchy: owner > editor > viewer.
internal/server/middleware_auth.go:772
↓ 14 callers
Method
runOrphanGCSweep
runOrphanGCSweep walks the orphaned-attachments query and reclaims rows past the grace period. Two reclamation paths: - DB row only. content_hash is
internal/server/orphan_gc.go:78
↓ 14 callers
Function
setupPushTest
setupPushTest mirrors setupItemOpenTest (item_open_test.go): points getClient()/getWorkspace() at a fake httptest server via the same urlFlag/workspac
cmd/pad/cmd_push_test.go:14
↓ 14 callers
Function
waitFor
waitFor polls until cond holds or the deadline passes. Delivery crosses a goroutine and a socket, so a bare read after Publish is a race.
internal/watchevents/redis_bus_integration_test.go:41
↓ 14 callers
Function
wedge
wedge simulates the failure this whole unit exists to detect: the outbound probe keeps SUCCEEDING and nothing ever comes back. It has to be simulated
internal/events/redis_heartbeat_test.go:115
↓ 14 callers
Function
workspaceRole
workspaceRole returns the user's role in the current workspace, as set by RequireWorkspaceAccess. Returns empty string if not set.
internal/server/middleware_auth.go:716
↓ 14 callers
Method
writeItemResolveError
writeItemResolveError distinguishes a soft-deleted (archived) item from a genuinely-missing one for mutation handlers. An archived item still appears
internal/server/handlers_items.go:845
↓ 13 callers
Method
BackfillOAuthConnections
BackfillOAuthConnections walks every distinct grant chain found in oauth_access_tokens and oauth_refresh_tokens, parses the newest chain row's session
internal/store/oauth_connections_backfill.go:93
↓ 13 callers
Function
EnsureServer
EnsureServer checks if the pad server is running; if not, starts it in the background.
internal/cli/server.go:16
↓ 13 callers
Method
GetCrossWorkspaceBacklinks
GetCrossWorkspaceBacklinks returns inbound `[[ws::REF]]` backlinks pointing at the queried target (`targetWorkspaceID`, `targetRef`) from EVERY OTHER
internal/store/wiki_links.go:1239
↓ 13 callers
Method
InsertMCPAuditEntry
InsertMCPAuditEntry persists one audit row. Called from the audit middleware's async writer; the caller owns the buffered channel + the ordering, so t
internal/store/mcp_audit.go:53
↓ 13 callers
Function
NewRedisBusWithKeys
NewRedisBusWithKeys is NewRedisBus with an explicit key namespace (BUG-2724). cmd/pad/cmd_server.go uses this one, passing the value shared with the w
internal/events/redis_bus.go:830
↓ 13 callers
Function
NewRegistry
NewRegistry returns an empty registry.
internal/attachments/registry.go:26
↓ 13 callers
Function
NormalizeItemLinkType
NormalizeItemLinkType canonicalizes supported link types and returns an error for unknown values.
internal/models/item_links.go:33
↓ 13 callers
Function
SetWorkspaceTool
SetWorkspaceTool returns the (Tool, Handler) pair for the built-in pad_set_workspace tool. The handler updates state in place. Exposed as a construct
internal/mcp/workspace.go:121
↓ 13 callers
Method
Start
Start begins probing in the background. It runs one probe SYNCHRONOUSLY before returning, so a server that has finished starting has a real answer rat
internal/server/redis_health.go:142
↓ 13 callers
Method
UpdateItemWithParentLink
UpdateItemWithParentLink is UpdateItemWithPreCheck plus an OPTIONAL parent-link mutation applied inside the same transaction (BUG-2013). When parentLi
internal/store/items.go:2068
↓ 13 callers
Method
ValidateSession
ValidateSession hashes the provided token, looks it up, checks expiry, and returns the session info including the associated user and binding metadata
internal/store/sessions.go:62
↓ 13 callers
Function
WithTokenScopes
WithTokenScopes returns ctx decorated with the API token's JSON-encoded scopes string (e.g. `["read"]`, `["*"]`). Stashed by the MCP Bearer middleware
internal/server/context.go:89
↓ 13 callers
Method
acquireWorkspaceSeqLock
acquireWorkspaceSeqLock takes a Postgres advisory transaction lock keyed on the workspace ID so concurrent seq-bumping mutations serialize. The lock a
internal/store/items.go:121
↓ 13 callers
Function
bootstrapAccountDeleteUser
bootstrapAccountDeleteUser creates the first admin user, sets a Stripe customer ID on them, and returns (userID, sessionToken). Used by the handleDele
internal/server/handlers_account_test.go:70
↓ 13 callers
Function
deleteAccountReq
deleteAccountReq issues the delete-account request from a client IP that differs from the loopback address bootstrap ran on. The session-IP-change mid
internal/server/handlers_account_test.go:93
↓ 13 callers
Function
downloadAs
downloadAs issues GET or HEAD on the blob endpoint as a specific user + workspace role, bypassing the auth middleware the same way deleteAsUser does.
internal/server/handlers_attachments_download_authz_test.go:158
↓ 13 callers
Method
flush
Run a flush immediately for the given `markdown` + `ctx`, applying the * full recovery/dedupe gauntlet before the injected PATCH. Used by the *
web/src/lib/collab/collabFlush.svelte.ts:114
↓ 13 callers
Function
getSessions
(t *testing.T, baseURL, token string)
internal/server/handlers_sessions_test.go:26
↓ 13 callers
Method
goAsync
goAsync spawns fn in a goroutine that's tracked by s.bg, so Stop() can wait for in-flight background work to finish. Use this for any fire-and-forget
internal/server/server.go:377
↓ 13 callers
Function
isolateHome
isolateHome redirects HOME to a temp dir and chdirs to a fresh temp project dir so credential writes and .pad.toml detection don't leak into the real
cmd/pad/setup_headless_test.go:89
↓ 13 callers
Function
liveGen
--- reconciliation on the receive path --------------------------------- liveGen subscribes the workspace and returns the generation a real receive lo
internal/events/redis_idspace_test.go:263
↓ 13 callers
Function
mustSeedWorkspaceWithRole
mustSeedWorkspaceWithRole is a test helper that creates a workspace + adds the user as a member with the given role. Centralized here because TASK-952
internal/server/handlers_oauth_test.go:1915
↓ 13 callers
Function
newTestClient
Tests for the OAuth 2.1 storage layer (PLAN-943 TASK-951 sub-PR A). The store layer is fosite-agnostic by design — sub-PR B introduces the fosite impo
internal/store/oauth_test.go:22
↓ 13 callers
Function
passThrough
passThrough returns an ActionFn that forwards the input verbatim to the given cmdPath via env.Dispatch. The vast majority of catalog actions use this
internal/mcp/catalog.go:178
← previous
next →
301–400 of 9,998, ranked by callers