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:
dataSetIdsprovided: creates contexts for exactly those data setsproviderIdsprovided: creates contexts for exactly those providers- Neither provided: uses smart selection with
count(default 2)
Example
Section titled “Example”// Create contexts for specific providersconst ctxs = await storage.createContexts({ providerIds: [1n, 2n] })
// Create 3 contexts via smart selectionconst ctxs = await storage.createContexts({ count: 3 })
// Create contexts for specific data setsconst ctxs = await storage.createContexts({ dataSetIds: [5n, 10n] })Extends
Section titled “Extends”Extended by
Section titled “Extended by”Properties
Section titled “Properties”callbacks?
Section titled “callbacks?”
optionalcallbacks:StorageContextCallbacks
Defined in: packages/synapse-sdk/src/types.ts:313
Callbacks for context creation process
Inherited from
Section titled “Inherited from”count?
Section titled “count?”
optionalcount:number
Defined in: packages/synapse-sdk/src/types.ts:395
Number of contexts to create.
- When NEITHER
dataSetIdsnorproviderIdsare specified: controls smart selection - When explicit IDs are provided: if specified, must match the deduplicated array length
Default
Section titled “Default”2 (only for smart selection)dataSetIds?
Section titled “dataSetIds?”
optionaldataSetIds: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
countis 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.
Throws
Section titled “Throws”If any data set does not exist or is not owned by client
Throws
Section titled “Throws”If data sets resolve to duplicate providers
Throws
Section titled “Throws”If combined with providerIds
Throws
Section titled “Throws”If count does not match deduplicated array length
excludeProviderIds?
Section titled “excludeProviderIds?”
optionalexcludeProviderIds: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
metadata?
Section titled “metadata?”
optionalmetadata: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.
Inherited from
Section titled “Inherited from”providerIds?
Section titled “providerIds?”
optionalproviderIds: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
countis specified, it must match the deduplicated length - Each provider must exist in the registry
- Existing data sets matching
metadataare reused when available - Mutually exclusive with
dataSetIds
Note: Bypasses smart selection. Endorsed provider prioritization and ordering logic are your responsibility when using explicit IDs.
Throws
Section titled “Throws”If any provider is not found in registry
Throws
Section titled “Throws”If combined with dataSetIds
Throws
Section titled “Throws”If count does not match deduplicated array length
withCDN?
Section titled “withCDN?”
optionalwithCDN:boolean
Defined in: packages/synapse-sdk/src/types.ts:304
Whether to enable CDN services for the context