Skip to content

CreateContextOptions

Defined in: packages/synapse-sdk/src/types.ts:334

Options for creating a single storage context

Used by StorageManager.createContext() and StorageContext.create(). Uses singular providerId and dataSetId to match the single-context semantics.

// Create context for specific provider
const ctx = await storage.createContext({ providerId: 1n })
// Create context for specific data set
const ctx = await storage.createContext({ dataSetId: 5n })
// Let smart selection choose (with CDN enabled)
const ctx = await storage.createContext({ withCDN: true })

optional callbacks: StorageContextCallbacks

Defined in: packages/synapse-sdk/src/types.ts:313

Callbacks for context creation process

BaseContextOptions.callbacks


optional dataSetId: bigint

Defined in: packages/synapse-sdk/src/types.ts:360

Specific data set ID to use.

When provided:

  • Context is created for this specific data set
  • Data set must exist and belong to the current client
  • Mutually exclusive with providerId

If data set does not exist or is not owned by client

If combined with providerId


optional metadata: Record<string, string>

Defined in: packages/synapse-sdk/src/types.ts:310

Custom metadata for data sets (key-value pairs). Used to match existing data sets during provider selection or smart selection.

BaseContextOptions.metadata


optional providerId: bigint

Defined in: packages/synapse-sdk/src/types.ts:347

Specific provider ID to use.

When provided:

  • Context is created for this specific provider
  • Provider must exist in the registry
  • Existing data set matching metadata is reused when available
  • Mutually exclusive with dataSetId

If provider is not found in registry

If combined with dataSetId


optional withCDN: boolean

Defined in: packages/synapse-sdk/src/types.ts:304

Whether to enable CDN services for the context

BaseContextOptions.withCDN