Skip to content

CreateContextsOptions

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

Options for creating multiple storage contexts

Used by StorageManager.createContexts() and StorageContext.createContexts(). Uses plural providerIds and dataSetIds to match the multi-context semantics.

Three mutually exclusive modes:

  1. dataSetIds provided: creates contexts for exactly those data sets
  2. providerIds provided: creates contexts for exactly those providers
  3. Neither provided: uses smart selection with count (default 2)
// Create contexts for specific providers
const ctxs = await storage.createContexts({ providerIds: [1n, 2n] })
// Create 3 contexts via smart selection
const ctxs = await storage.createContexts({ count: 3 })
// Create contexts for specific data sets
const ctxs = await storage.createContexts({ dataSetIds: [5n, 10n] })

optional callbacks: StorageContextCallbacks

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

Callbacks for context creation process

BaseContextOptions.callbacks


optional count: number

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

Number of contexts to create.

  • When NEITHER dataSetIds nor providerIds are specified: controls smart selection
  • When explicit IDs are provided: if specified, must match the deduplicated array length
2 (only for smart selection)

optional dataSetIds: bigint[]

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

Specific data set IDs to use.

When provided:

  • Contexts are created for exactly these data sets (duplicates removed)
  • If count is specified, it must match the deduplicated length
  • Each data set must exist and belong to the current client
  • Each data set must belong to a unique provider (no duplicates)
  • Mutually exclusive with providerIds

Note: Bypasses smart selection. Endorsed provider prioritization and ordering logic are your responsibility when using explicit IDs.

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

If data sets resolve to duplicate providers

If combined with providerIds

If count does not match deduplicated array length


optional excludeProviderIds: bigint[]

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

Internal

Provider IDs to exclude from smart selection.

Only applies when NEITHER dataSetIds nor providerIds are specified. Used internally by retry logic to avoid re-selecting failed providers.

Not recommended for general use


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 providerIds: bigint[]

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

Specific provider IDs to use.

When provided:

  • Contexts are created for exactly these providers (duplicates removed)
  • If count is specified, it must match the deduplicated length
  • Each provider must exist in the registry
  • Existing data sets matching metadata are reused when available
  • Mutually exclusive with dataSetIds

Note: Bypasses smart selection. Endorsed provider prioritization and ordering logic are your responsibility when using explicit IDs.

If any provider is not found in registry

If combined with dataSetIds

If count does not match deduplicated array length


optional withCDN: boolean

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

Whether to enable CDN services for the context

BaseContextOptions.withCDN