Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/PerpetualSoftware/pad
/ functions
Functions
8,091 in github.com/PerpetualSoftware/pad
⨍
Functions
8,091
◇
Types & classes
983
↓ 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
Method
close
()
web/src/lib/services/sseFirstConnectSync.svelte.test.ts:42
↓ 13 callers
Method
copyOK
copyOK issues the copy as the owner and requires a 201.
internal/server/handlers_items_copy_test.go:94
↓ 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
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:327
↓ 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
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:1821
↓ 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
↓ 13 callers
Method
restrictedEditor
--- authorization: the four checks, in order -------------------------- restrictedEditor returns an editor in both workspaces whose membership in each
internal/server/handlers_items_copy_preflight_test.go:652
↓ 13 callers
Function
taskSchema
()
internal/items/validate_test.go:10
↓ 13 callers
Function
uploadIntegrationPNG
(t *testing.T, srv *Server, slug string, w, h int)
internal/server/handlers_attachments_transform_test.go:41
↓ 12 callers
Method
AddConnectionWorkspace
AddConnectionWorkspace inserts a (request_id, workspace_id) row in the allow-list join table. Idempotent: re-adding an existing pair is a no-op (INSER
internal/store/oauth_connections.go:303
↓ 12 callers
Function
EnsureServer
EnsureServer checks if the pad server is running; if not, starts it in the background.
internal/cli/server.go:16
↓ 12 callers
Function
ExtractWikiLinks
ExtractWikiLinks scans `content` for [[...]] occurrences OUTSIDE any fenced or inline code region, parses each into a WikiLinkRef, and returns them in
internal/links/extract.go:477
↓ 12 callers
Method
ForceRefreshRoom
ForceRefreshRoom makes items.content the canonical source for an item's collab state: it runs `commit` under the per-item lock (so the caller can atom
internal/collab/manager.go:1058
↓ 12 callers
Method
GetOAuthConnectionAccess
GetOAuthConnectionAccess is the hot-path projection used by the MCP introspection middleware. Runs at most two cheap indexed queries (one PK lookup, o
internal/store/oauth_connections.go:151
↓ 12 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:4400
↓ 12 callers
Function
New
New creates a MemoryBus with the default replay buffer size.
internal/watchevents/watchevents.go:272
↓ 12 callers
Function
NewRegistry
NewRegistry returns an empty registry.
internal/attachments/registry.go:26
↓ 12 callers
Method
Search
(params SearchParams)
internal/store/search.go:89
↓ 12 callers
Method
Subscribe
Subscribe registers a new subscriber for the given workspace. Returns a buffered channel that will receive events for that workspace.
internal/events/bus.go:127
↓ 12 callers
Method
SubscriberCount
SubscriberCount returns the number of active subscribers whose itemID matches. Used by the room manager to decide when the active peer count has dropp
internal/collab/memory_bus.go:154
↓ 12 callers
Function
ValidateUpload
ValidateUpload combines the sniff result, the client-supplied MIME header, and the filename's extension to produce one of: - (entry, "", nil) — accep
internal/attachments/mime.go:242
↓ 12 callers
Function
acquire
(exemptRoot: HTMLElement)
web/src/lib/a11y/viewerBackdrop.ts:217
↓ 12 callers
Function
bootstrapBody
(email string)
internal/server/handlers_auth_bootstrap_token_test.go:45
↓ 12 callers
Method
checkItemVisible
checkItemVisible is the context-free visibility decision. Returns (true, nil) when the (user, role) pair can see `item` under the same rules `requireI
internal/server/server.go:2174
↓ 12 callers
Function
childLinkTypeSQL
childLinkTypeSQL returns a SQL IN clause fragment like "'parent','implements'" for filtering item_links by child relationship types.
internal/store/items.go:23
↓ 12 callers
Function
collectionSchemaJSONFromFlags
collectionSchemaJSONFromFlags resolves the --schema and --fields flags into a marshaled CollectionSchema JSON string. Exactly one of schemaInput or f
cmd/pad/cmd_collection.go:80
↓ 12 callers
Function
contextWithResolvedWorkspaceIDForTest
(ctx context.Context, wsID string)
internal/server/authz_cross_workspace_test.go:23
↓ 12 callers
Function
doAuthedJSON
Mutation-endpoint tests for /api/v1/connected-apps/{id}/... routes (PLAN-1519 / TASK-1524 / IDEA-1517 §3). What's covered (per endpoint): - PATCH /n
internal/server/handlers_connected_apps_mutations_test.go:35
↓ 12 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
↓ 12 callers
Method
movedTo
movedTo parses the response and returns the moved_to block. It also asserts the disclosure rule's negative half: when the block is absent the KEY must
internal/server/item_moved_to_test.go:181
↓ 12 callers
Function
newMockStore
(hooks []models.Webhook)
internal/webhooks/dispatcher_test.go:25
↓ 12 callers
Function
newRequestCapture
()
internal/mcp/dispatch_http_advanced_test.go:908
↓ 12 callers
Function
newTestConfig
newTestConfig points DataDir at a fresh tmp dir and BrowserURL at the given test server. Most tests want both wired up together.
internal/cli/bootstrap_test.go:39
↓ 12 callers
Function
newVerifiedEmailFixture
(t *testing.T, cloud bool)
internal/server/middleware_verified_email_test.go:46
↓ 12 callers
Method
reload
(t *testing.T)
internal/mcp/dispatch_http_clear_assignment_test.go:121
↓ 12 callers
Function
runHelp
runHelp invokes the help command with the given args and returns (stdout, stderr, error).
cmd/pad/help_cmdhelp_test.go:46
↓ 11 callers
Method
AppendYjsUpdate
(itemID string, data []byte, schemaVersion string)
internal/collab/manager_test.go:61
↓ 11 callers
Method
CopyItem
CopyItem performs the MUTATING cross-workspace copy. NEVER RETRY THIS CALL (DR-13). See the file header for the four mechanisms that enforce it. On f
internal/cli/client_items_copy.go:268
↓ 11 callers
Method
CreateActivity
(a models.Activity)
internal/store/activities.go:17
↓ 11 callers
Method
CreateActivityDebounced
CreateActivityDebounced creates a new activity or updates an existing one if a matching activity (same document, same user, same action) was recorded
internal/store/activities.go:39
↓ 11 callers
Function
DeriveClaimCode
DeriveClaimCode produces the 6-digit code for the given (user, workspace) at the given wall-clock time. Exported so the Phase E "Connect project" moda
internal/server/claim_codes.go:78
↓ 11 callers
Method
GetOAuthClient
GetOAuthClient looks up a registered client by ID. Returns ErrOAuthNotFound if no row matches.
internal/store/oauth.go:136
↓ 11 callers
Method
GetParentForItem
GetParentForItem returns the parent link for an item, or nil if it has no parent. A parent link pointing to a soft-deleted item is treated as no paren
internal/store/items.go:3507
↓ 11 callers
Method
GetUserWorkspaces
(userID string)
internal/mcp/dispatch_http_lister.go:51
↓ 11 callers
Method
LoadYjsUpdatesSince
(itemID string, sinceID int64)
internal/collab/room.go:233
↓ 11 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:24
↓ 11 callers
Function
NewFetcher
NewFetcher returns a Fetcher with production defaults applied.
internal/urlimport/fetch.go:92
↓ 11 callers
Function
NewSQLite
NewSQLite returns a *store.Store backed by a fresh SQLite file in t.TempDir(), fully migrated. See the package doc for the template+copy mechanism. St
internal/store/storetest/storetest.go:54
↓ 11 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:2708
↓ 11 callers
Method
Save
Save writes the persisted Pad config to disk.
internal/config/config.go:253
↓ 11 callers
Method
SetEncryptionKey
SetEncryptionKey configures the store's AES-256 encryption key for encrypting sensitive fields (e.g., TOTP secrets) at rest. The key must be exactly 3
internal/store/encryption.go:19
↓ 11 callers
Method
SetTOTPSecret
--- TOTP 2FA --- SetTOTPSecret stores the TOTP secret for a user (before 2FA is verified). The secret is encrypted at rest if an encryption key is con
internal/store/users.go:1183
↓ 11 callers
Method
StarItem
StarItem stars an item for a user. Idempotent — re-starring is a no-op.
internal/store/item_stars.go:13
↓ 11 callers
Method
Unsubscribe
Unsubscribe removes a subscriber and closes its channel.
internal/events/bus.go:136
↓ 11 callers
Function
callToolRequest
── test helpers ── callToolRequest builds an mcp.CallToolRequest with the given input arguments — the public constructor isn't exposed by mcp-go so we
internal/mcp/catalog_test.go:320
↓ 11 callers
Function
containsToolText
containsToolText looks for substr in any TextContent block of res. MCP results can carry multiple content blocks; checking all of them keeps the asser
internal/mcp/dispatch_http_test.go:977
↓ 11 callers
Function
contextWithWorkspaceRoleForTest
contextWithWorkspaceRoleForTest / contextWithResolvedWorkspaceIDForTest stash the two values RequireWorkspaceAccess populates for the REQUEST's worksp
internal/server/authz_cross_workspace_test.go:19
↓ 11 callers
Function
createBlocksLink
helper: create a "blocks" link from source to target
internal/server/handlers_dashboard_test.go:37
↓ 11 callers
Method
dest
dest creates a destination item in ws and returns it.
internal/store/item_workspace_moves_test.go:37
↓ 11 callers
Function
diffFields
(oldFields, newFields string)
internal/server/handlers_documents.go:414
↓ 11 callers
Method
dispatch
(t *testing.T, cmd []string, input map[string]any)
internal/mcp/dispatch_http_clear_parent_test.go:100
↓ 11 callers
Function
equalStrings
(a, b []string)
internal/mcp/catalog_test.go:338
↓ 11 callers
Function
hydrateItemComputedMetadata
(item *models.Item)
internal/store/items.go:5041
↓ 11 callers
Function
makeFanOutHandler
makeFanOutHandler returns the ToolHandlerFunc that mcp-go invokes when the tool is called. Reads `action` from the input, looks up the handler, and fo
internal/mcp/catalog.go:399
↓ 11 callers
Function
makeTestImage
makeTestImage returns a freshly-allocated NRGBA image filled with a distinguishable pattern so transformation tests can assert on specific pixels. Wid
internal/attachments/processor_test.go:23
↓ 11 callers
Function
mapItemList
(BUG-2001) The dispatcher used to mirror the CLI's hardcoded active-status allowlist here. That wrongly hid open items in collections with custom stat
internal/mcp/dispatch_http_routes.go:1156
↓ 11 callers
Function
mustParseQueryFromPath
mustParseQueryFromPath extracts the query-string portion of path and parses it. Test-only — fails the test on malformed input.
internal/mcp/dispatch_http_routes_test.go:27
↓ 11 callers
Function
newCopyTestClient
newCopyTestClient points a Client at ts with a HOME that has no saved credentials, so the test never picks up the developer's real token.
internal/cli/client_items_copy_test.go:17
↓ 11 callers
Function
newHTTPResourceFetcher
newHTTPResourceFetcher wires an HTTPResourceFetcher over a test mux with a fixed authenticated user, mirroring the dispatch_http_*_test.go setup. The
internal/mcp/resources_http_test.go:24
↓ 11 callers
Function
newMoveFixture
(t *testing.T, name string)
internal/store/item_workspace_moves_test.go:22
↓ 11 callers
Function
newPadServer
newPadServer stands up the same *server.Server that production uses, wired to a fast fixture SQLite store (storetest.NewSQLite, IDEA-1914). Mirrors te
internal/mcp/dispatch_http_test.go:948
↓ 11 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
↓ 10 callers
Function
AddPadEntry
AddPadEntry reads (or creates) the JSON config at path, ensures mcpServers.pad points to `binary`, and writes the file back. Existing entries outside
internal/mcp/install.go:211
↓ 10 callers
Method
CreateDocument
(workspaceID string, input models.DocumentCreate)
internal/store/documents.go:146
↓ 10 callers
Function
Decode
Decode parses an artifact's portable on-disk form back into an Artifact. It splits a leading "---\n ... \n---" frontmatter block from the body, unmar
internal/artifact/decode.go:21
↓ 10 callers
Method
Delete
Delete removes the blob identified by key. Deleting a missing key is NOT an error — callers (e.g. the orphan GC) treat it as the success case.
internal/attachments/store.go:54
↓ 10 callers
Method
DeleteCollection
DeleteCollection soft-deletes a collection by id. When expectedUpdatedAt is non-empty it opts into optimistic-concurrency control (BUG-2265): the row'
internal/store/collections.go:497
↓ 10 callers
Function
DetectWorkspace
DetectWorkspace walks up the directory tree from cwd looking for .pad.toml.
internal/cli/workspace.go:25
↓ 10 callers
Method
Dispatch
Dispatch sends the event payload to all matching active webhooks for the workspace. Each delivery runs in its own goroutine so the caller is never blo
internal/webhooks/dispatcher.go:180
↓ 10 callers
Method
GetWorkspaceByID
(id string)
internal/store/workspaces.go:151
↓ 10 callers
Method
Handle
(_ context.Context, r slog.Record)
internal/store/items_test.go:1805
↓ 10 callers
Method
ListUserOAuthConnections
ListUserOAuthConnections returns every OAuth connection the user has active. "Active" means at least one access OR refresh token in the chain still ha
internal/store/connected_apps.go:59
↓ 10 callers
Function
New
(s *store.Store)
internal/server/server.go:416
↓ 10 callers
Method
Publish
Publish assigns the Notification a monotonic ID, stores it in the replay buffer, and fans it out to every live Subscribe channel. ID assignment and bu
internal/watchevents/watchevents.go:147
↓ 10 callers
Method
Register
Register installs store under prefix (e.g. "fs", "s3"). The prefix MUST NOT contain a colon — Resolve splits keys on the first colon, so a prefix with
internal/attachments/registry.go:37
↓ 10 callers
Function
RunBrowserBootstrap
RunBrowserBootstrap walks the operator through the browser-based first- admin bootstrap. Returns nil on success (server has flipped to setup_required:
internal/cli/bootstrap.go:92
↓ 10 callers
Method
SetPlatformSetting
SetPlatformSetting upserts a platform setting.
internal/store/platform_settings.go:16
↓ 10 callers
Method
UpdateCollection
(id string, input models.CollectionUpdate)
internal/store/collections.go:306
↓ 10 callers
Method
WorkspaceAttachments
WorkspaceAttachments lists original (non-derived) attachments in a workspace, with optional filtering + sorting + pagination. Returns the page rows an
internal/store/attachments.go:476
↓ 10 callers
Function
appendToCatalog
appendToCatalog inserts def into Catalog. Called from catalog_<resource>.go init() functions. Keep this small + simple; validation happens at Register
internal/mcp/catalog.go:194
↓ 10 callers
Function
configureBootstrapToken
configureBootstrapToken seeds a known token on the server so tests don't depend on the random generator. The on-disk file is created in a temp dir so
internal/server/handlers_auth_bootstrap_token_test.go:34
↓ 10 callers
Function
connectSSE
connectSSE connects to the SSE endpoint on a real test server and returns a channel of parsed events. Cancel the context to disconnect.
internal/server/handlers_events_test.go:35
↓ 10 callers
Function
createBulkTestItem
createBulkTestItem creates a task and returns it.
internal/server/handlers_items_bulk_test.go:15
↓ 10 callers
Function
createTestWorkspace
createTestWorkspace creates a workspace via API and returns its slug.
internal/server/handlers_events_test.go:113
↓ 10 callers
Method
decrypt
decrypt decrypts a value that was encrypted with encrypt(). If the value doesn't have the "enc:" prefix, it's treated as plaintext (backward compatibi
internal/store/encryption.go:60
↓ 10 callers
Method
dispatchWebhook
dispatchWebhook fires a webhook event if a dispatcher is configured.
internal/server/handlers_webhooks.go:25
← previous
next →
301–400 of 8,091, ranked by callers